EasyCrypt's sp: deterministic code at the start, into the precondition #
stmt_sp -- EC's `sp`: on every side, as long as the first statement is deterministic
stmt_sp{i} -- EC's `sp` on side `i` of a relational judgment
stmt_sp n -- EC's `sp n` (`stmt_sp{i} n`): `n` statements (on each side)
EC's sp moves the precondition forward over the assignments at the start of the code: P
becomes exists x₀, P[x₀/x] /\ x = e[x₀/x]. Here, for a deterministic statement d running as
the update upd (Stmt.Det d upd, assignments and the resets inlining leaves among them), the
precondition A becomes fun σ => ∃ τ, A τ ∧ σ = upd τ (hoareStmt_sp, phoareStmt_sp,
prhlStmt_sp_left/_right). A phoare bound is a function of the state: sp needs it unchanged
by upd (a constant bound, as EC's usually are; left as a goal otherwise).
A deterministic statement, then s: s from the updated state.
EC's sp on a Hoare triple: the first statement, deterministic, into the precondition.
EC's sp on a phoare judgment, its bound unchanged by the update.
hoareStmt_sp, the precondition kept on the new state when the update cannot change it (an
assignment to a variable it does not read): EC's P /\ x = e where P does not mention x.
phoareStmt_sp, the precondition kept on the new state (as hoareStmt_sp_keep).
The resets inlining leaves: not EC's statements #
A reset (reset_vars S, the callee's locals set to their initial values) is no statement of EC's,
whose inlining has none; past it the precondition is kept as it is, when the reset cannot change
it (A reads none of S), and the reset forgotten — its values are never read before the
callee's code assigns them.
hoareStmt_sp_keep, the update forgotten.
phoareStmt_sp_keep, the update forgotten.
EC's P /\ x = e: an assignment as a read #
For an assignment x <- e (the update upd τ = x.set (e τ) τ) that changes neither P nor e,
the precondition after it is P ∧ x = e, a fact about reads (EC's), rather than the equation of
states σ = upd τ: reads go through the later steps (the inliner's renamings among them).
hoareStmt_sp for an assignment: A ∧ x = e.
phoareStmt_sp for an assignment: A ∧ x = e.
EC's exists x0, P[x0/x] /\ x = e[x0/x]: an assignment reading its variable #
For x <- e with e reading x (C.c <- C.c + 1), the old value is existentially quantified
(EC's sp, then elim *), not the whole state: the precondition stays a fact about reads.
hoareStmt_sp for an assignment reading its variable: ∃ v, A[v/x] ∧ x = E[v/x].
phoareStmt_sp for an assignment reading its variable (as hoareStmt_sp_exval).
The lens an assignment's setter writes through (Lens.toSetter X, liftLens X), if any.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The statement of side side? of the goal (the only one of a Hoare or phoare judgment).
Equations
- GaudisCrypt.ECSp.stmtOf g side? = do let __discr ← GaudisCrypt.Judgment.descOf g side? match __discr with | (d, ty) => pure (ty.getArg! d.stmtArg)
Instances For
One step of sp on side side?: the first statement, if deterministic, into the
precondition; none if it is not.
Equations
- One or more equations did not get rendered due to their size.
Instances For
sp on side side?, n? statements (all deterministic ones at the start for none).
EC's sp: see the module docstring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The losslessness goal of equiv_while{i} I V from a phoare judgment about the body
(EC's while{i} goal on the body is a phoare … = 1).
while_ll_phoare: the lossless goal of equiv_while{i} I V as
∀ σ₂, phoare[ I ∧ guard ==> 1 ] = 1 about the body, for the phoare tactics (EC's while{i}
body goal: auto; sp; rcondt 1; …).
Equations
- GaudisCrypt.tacticWhile_ll_phoare = Lean.ParserDescr.node `GaudisCrypt.tacticWhile_ll_phoare 1024 (Lean.ParserDescr.nonReservedSymbol "while_ll_phoare" false)
Instances For
EC's sp n m on a relational judgment, with EC's code positions (TacticMisc.ecGapIn: EC's
statements, the resets inlining leaves not counted): the statements before the gap n of the left side and before the gap m of the right forward (0:
none; -k: up to and with the k-th statement from the end).
Equations
- One or more equations did not get rendered due to their size.