Skip to main content

Module guarded_choice

Module guarded_choice 

Source
Expand description

The guard rule, the Lean’s Wf3 (choicesWf, Proc.choicesLead), on the typed term of each entry point’s body.

A choice tree is a [] or a guard with the guards and choices nested directly in it (branchesOf): its leaves are what is left, each under the conjunction of the guards above it in the tree. Outside the head:

  • every leaf of a choice is guarded (choicesLead, and with it [⊤] overlapping every other branch): a branch with no guard;
  • no two leaves’ conjunctions hold together, unless both receive, on different channels (branchesApart);
  • one of them always holds (branchesExhaustive); a lone guard is a tree of one leaf, so it can block.

Each choice is checked on its own guards: a choice after a ;, a prefix or a call is a tree of its own, whatever guards enclose it. The graph does not tell them apart, since flattening conjoins an enclosing guard onto the first edges of the choice it guards.

The term is where this check runs for now; the aim is to run it on the Ccfg, as the other graph checks are, once an edge records which choice each conjunct of its guard comes from (#691).

The walk unfolds a process at its first reference and stops at one being walked, as flattening does (μ and X). The head, where the entry starts, is recv_head.rs’s and protected.rs’s: its trees are not checked here, but a branch there that is a call does not begin with an event (choicesLead). A default is already a guard (rast/desugar.rs).