ð_cflow: eliminates if/while by rewriting them into either/await congruences. Same
type in, same type out (ComputablePlusCal.Statement/.Block/.Branches) â if/while are
eliminated as a runtime fact, not type-encoded; only the producer maintains the invariant that
while must be immediately preceded by a label.
ð_cflow(l: while e do {B1}; B2; goto l') = l: if e then {B1; goto l} else {B2; goto l'}
ð_cflow(if e then B1 else B2) = either {await e; B1} or {await ÂŽe; B2}
if's rewrite is an ordinary per-statement congruence: both branches already share the if's
own terminal-ness, recurse and reassemble. while's rewrite operates at the block level, not
per-statement: since a while must be immediately preceded by a real label (already enforced
by the desugarer), it's always the first statement of its containing block, so Block.cflow
special-cases while cond B1 :: rest and absorbs whatever followed the while (rest) into
the loop-exit branch. The loop-continue branch reuses B1's own terminal statement directly if
it's already terminal (a labelled step was extracted from the loop body, already ending in a
goto back to the loop's own label); otherwise it synthesizes that goto itself (coerceGoto)
â matching the doc comment on ElaboratedPlusCal.Statement.while's own B field exactly.
ÂŽe is built directly as opCall (var "\\neg" ...) [e], the same shape
Desugarer/TLAPlus.lean's PrefixOperator.canonicalName/Elaborator/Declarations.lean's
builtin-Îâ entry for \neg already establish for this operator.
ð_cflow over a single statement. label is the enclosing top-level block's own label,
threaded through unchanged (only ever consulted by Block.cflow's while-rewrite; harmless,
unused for statements nested where a while can't legally occur).
ð_cflow over a block â the one place while actually gets rewritten, per the module doc
above.
ð_cflow over a whole algorithm: applied per (label, Block) pair, across every thread of
every process â the label a while inside that block would need for coerceGoto, per the
module doc above.
Equations
- One or more equations did not get rendered due to their size.