EasyCrypt's two-sided while I #
equiv_while_raw (I) -- EC's `while I` on two loops ending both sides' code
EC's while I on c₁; while b₁ do s₁ ~ c₂; while b₂ do s₂ : P ==> Q leaves two goals (checked on
opaque modules, ~/easycrypt-transfer-probes/while_if.ec):
- the bodies:
s₁ ~ s₂ : I ∧ b₁{1} ∧ b₂{2} ==> I ∧ (b₁{1} ⇔ b₂{2}); - the code before:
c₁ ~ c₂ : P ==> (I ∧ (b₁{1} ⇔ b₂{2})) ∧ ∀ (modified variables), ¬b₁ ⇒ ¬b₂ ⇒ I ⇒ Q: on exit only what the loops modify has changed.
Here the second is ∀ τ₁ τ₂, F₁ σ₁ τ₁ → F₂ σ₂ τ₂ → I τ₁ τ₂ → b₁ τ₁ = false → b₂ τ₂ = false → Q τ₁ τ₂, the frames F₁, F₂ the variables Q reads that the loops keep (as for EC's
conseq, Logic/ECConseqFrame.lean). The rule (prhlStmt_seq_while_ec) is derived from the
loop rule with the invariant I ∧ b₁ = b₂ and EC's frame (prhlStmt_conseq_frame).
The older form, four goals (body, guard, exit, hpre) and no frame, is equiv_while_raw.
EC's one-sided while{i} I V: the last statement of side i is a loop, run on that side
only, with the invariant I and the variant V : ℕ (relational). Goals: lossless (the body
terminates under I and the guard), variant (the body keeps I and decreases V, a Hoare
triple for each state of the other side and each value of V), then the code before the loop:
I, and for every final state of the loop that keeps what it does not write (EC's frame, the
variables the postcondition or the invariant reads), I and a false guard give the postcondition
(prhlStmt_seq_while_left_ec/_right_ec). The older form, with a separate exit goal and no
frame, is equiv_while_noframe{i}.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's while I on two loops ending the code of both sides: goals body and hpre (see
the module docstring; prhlStmt_seq_while_ec).
Equations
- One or more equations did not get rendered due to their size.
Instances For
ECSim.simWhileHook: on g, ending in two loops, prhlStmt_seq_while_ec with the invariant
I and EC's frames of the relation after the loops (as equiv_while's); the goals body and
hpre, or none if the code does not end in two loops.
Equations
- One or more equations did not get rendered due to their size.