EasyCrypt's inline* and sim #
stmt_inline* -- EC's `inline*`: every call whose callee is spelled out, on both sides
stmt_inline*{i} -- … on side `i`
phoare_inline*, hoare_inline*
sim -- EC's `sim`, on a relational judgment about two statements
inline* inlines call sites until only calls of abstract procedures are left (EC's inline*,
which does not inline a declared module either).
sim goes backwards over the two statements, computing the relation needed before each step
from the one needed after it, as EC's sim does with its sets of equal variables, but with any
relation: deterministic code on either side by wp (stmt_wp: copies, dead assignments and
the frame resets of inlined calls disappear into the relation), samplings on both sides
coupled by the identity (equiv_rnd), calls of the same procedure on both sides from equal
arguments and globals (equiv_call), conditionals on both sides (prhlStmt_seq_if_bwd):
equal guards, each branch's relation found by sim on the branches (a branch it does not
finish stops it at the conditional), and loops on both sides (prhlStmt_seq_while): EC's
equality set as the invariant (the relation after the loops and the variables they mention
equal; failing that, EC's equality set of pairs: the locals at corresponding positions of the
two loops named differently on the two sides, an inlined callee's i0 against i, equal), the
bodies by sim. Where both statements are used up, the precondition must imply
what is left (equiv_skip), closed by simp_all if it can; anything else (calls of different
procedures, a sampling against other code) stops sim with that goal.
States equal outside L as an equation: the second is the first with the second's L
written (so that sim's implications are about chains of writes, lensWriteNorm).
EC's inline* on side side? of the goal g (a registered judgment): call sites inlined
(Flatten.judgmentInline) until every one left fails (an abstract procedure).
Equations
- One or more equations did not get rendered due to their size.
Instances For
inlineAll on both sides of a relational judgment, or on the one statement.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- GaudisCrypt.ECSim.instBEqLast.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
The last statement of the right-nested s (after stripLets).
The kind of the last statement of s.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Close ∀ …, A → B (what equiv_skip leaves) by simp_all, if it can. The attempts by
simp_all alone go without a declared module's restrictions (clear_decl_hyps: a join of
dozens of footprints, which simp_all would simplify in each attempt); those through glob A
keep them, for fp_disjoint, and run only on a goal that has a region.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run the tactic stx on g, the goals it leaves.
Equations
- GaudisCrypt.ECSim.runOn g stx = Lean.Elab.Tactic.evalTacticAt stx.raw g
Instances For
EC's equality set of a relational precondition A (fun σ₁ σ₂ => …): the regions it keeps
equal (R.touched_getter.get σ₁.globals = …) and the global variables it reads.
Equations
- One or more equations did not get rendered due to their size.
Instances For
e (a conjunction) has the conjunct a.globals = b.globals.
Does the relational precondition A keep all globals equal (σ₁.globals = σ₂.globals, a
conjunct of it)?
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim through a call with an equality set: when the judgment's precondition keeps a
region R equal (R.touched_getter.get σ₁.globals = R.touched_getter.get σ₂.globals) that
contains the callee M (fp_le), the call rule prhlStmt_seq_call_glob, its frames the global
variables the precondition or the postcondition reads that M does not touch (fp_disjoint).
none if no region fits, with the reason.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The program variables the statements ss mention: the locals (localVarLens, of the
program state) and the global variables (global_vars, of the globals, or a clone's alias of one,
FRO.m := ROhandle.FRO.m, as written), in order.
Equations
- One or more equations did not get rendered due to their size.
Instances For
e (headed by c) a reducible alias of a global variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's equality sets, backwards: the variables that must be equal on the two sides before
s (run on both) for those of S to be equal after it. An assignment or sampling to variables
of S replaces them by what it reads (otherwise it does not matter); a conditional adds its
guard; a loop the fixpoint of its body with its guard; anything else (a call, a hole) everything
it mentions.
EC's sim invariant of two loops: the relation B after them, and the variables both loops
mention equal on the two sides (a variable of one side only — Perm.m against PRPi.m, EC's
sim (_: ={m,mi}(Perm,PRPi)) — is related by B, if at all).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim invariant of two loops as an equality set: the variables the relation B after
them reads, closed backwards through each loop (eqBack), equal on the two sides (B itself left
out: it may read what the loops change, F.RO.m at the loops' p; at the exit it follows from
the equalities).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The variables (lenses of the state or of the globals) a relational precondition A keeps
equal, x.get σ₁ = x.get σ₂: EC's equality set.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The variables s writes (assignments and samplings, through conditionals and loops), or
none when it has a statement whose writes are not read off its syntax (a call, a hole).
loopInvEq under EC's frame of the loops' exit (simWhileHook): of the variables B reads,
only those a loop writes (the others the frame keeps, and they may differ between the sides:
x0{1} against x1{2}), closed backwards through each loop.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim (_: J) invariant of two loops: J, the variables both loops mention equal, and
of the precondition's equality set (its regions Rs, its variables xs) what neither or both
loops mention.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's equality set of pairs: the locals at corresponding positions of two statements of
the same shape that are named differently on the two sides (an inlined callee's i0 against i,
EC's sim relates them), as pairs (x, y), each local in at most one pair. none when the
statements differ in more than their locals' names.
EC's sim invariant of two loops with pairs, an equality set as EC's: the locals the
loops use at corresponding positions under different names equal (alignLocals; not an inlined
call's temporaries, which the bodies reset or write before reading), the variables both loops
need under the same name, and the equalities the relation B after the loops contains.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's framed loop rule, for sim: on a goal ending in two loops, with the invariant I,
prhlStmt_seq_while_ec with EC's frames of the relation after the loops (what the loops keep of
the variables it reads); the goals body and hpre. Logic/ECWhileRel.lean sets it (the
frames need Logic/ECConseqFrame.lean, which comes later than this file).
auto_close (Logic/ECClose.lean, which imports this file) on g, when the environment has
it: the goals left ([g] if it does not close it).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim on the relational goal g, backwards (see the module docstring); the goals left.
open?: the precondition is a metavariable to be found (a branch of a conditional), assigned the
relation left where the statements are used up.
EC's inline* on a statement judgment, on both sides of a relational one or on side i
with stmt_inline*{i}.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's inline* on a phoare statement judgment.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's inline* on a Hoare triple about a statement.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim: see the module docstring.
Equations
- GaudisCrypt.tacticSim = Lean.ParserDescr.node `GaudisCrypt.tacticSim 1024 (Lean.ParserDescr.nonReservedSymbol "sim" false)
Instances For
EC's sim (_: I): sim with the relation I (§x{1}, §y{2}; EC's
={m,mi}(Perm,PRPi) is §Perm.m{1} = §PRPi.m{2} ∧ …) kept through loops, with EC's equality
set: the loops' invariant is I, the variables both loops mention equal, and the
precondition's equalities the loops keep.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim n₁ n₂: sim on the code after the first n₁ statements of the left side and
the first n₂ of the right; the goal left is the code before, its postcondition what sim needs
(the relation between the two parts is open, for sim to compute).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's sim with a frame: sim / x₁, …, xₙ, the states equal except on the globals xᵢ
(EC's ={glob A}: variables the calls of the same procedure do not touch, written by one side
only or at different times), calls of the same procedure by prhlStmt_seq_call_outside.
Equations
- One or more equations did not get rendered due to their size.