EasyCrypt's hoare and conseq #
phoare_hoare -- EC's `hoare`: `phoare[c : P ==> Q] ≤ r` (or `= 0`) from
-- `hoare[c : P ==> !Q]`
stmt_exists* e -- EC's `exists* e`: `phoare[c : P ∧ e = h ==> Q]` for every
-- `h` (then `intro h`, EC's `elim* => h`)
hoare_conseq (: P ==> Q) -- EC's `conseq (: P ==> Q)` on a Hoare triple (`_` keeps one)
phoare_conseq (: P ==> Q) -- … on an upper bound `phoare[ … ] ≤ r`
equiv_conseq (: P ==> Q) -- … on a relational judgment (`§x{1}`, `§x{2}`)
conseq's goals, as EC's: the implications, then the judgment with the new conditions. For an
upper bound, the event may only grow: the old event implies the new one.
A run after which g vanishes: its expectation of g is 0.
EC's hoare on an upper bound: g vanishing after the run bounds its expectation by
anything.
EC's hoare on phoare[ … ] = 0.
EC's exists* e on a phoare judgment: the judgment for every value h of e at the
start, the precondition with e = h.
EC's exists* e on a procedure judgment: e reads both sides' arguments and globals.
A marker: equiv_exists* on a procedure judgment reads e off the precondition
existsMark e that equiv[ p₁ ~ p₂ : … ] elaborates.
Equations
Instances For
EC's exists* e on a Hoare triple.
EC's hoare on a phoare goal with an upper bound, or the bound 0: the Hoare triple
that its event fails (phoareStmt_le_of_hoare, phoareStmt_eq_zero_of_hoare).
Equations
- tacticPhoare_hoare = Lean.ParserDescr.node `tacticPhoare_hoare 1024 (Lean.ParserDescr.nonReservedSymbol "phoare_hoare" false)
Instances For
A condition on one state, written as the judgment's (§x, the code's variables by name).
Equations
- One or more equations did not get rendered due to their size.
Instances For
_: the condition kept.
Equations
- GaudisCrypt.ECConseq.isHole t = t.raw.isOfKind `Lean.Parser.Term.hole
Instances For
Run refine stx; its goals tagged, the given ones in EC's order (then any others).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's conseq (: P ==> Q) on a Hoare triple: goals pre (the precondition implies P),
post, then the triple with P, Q; _ keeps a condition. post is EC's
P => (frame) => Q' => Q: the variables the conditions read that the code does not modify keep
their values from the start (hoareStmt_conseq_frame, as equiv_conseq), so the precondition's
facts about them are there (EC's conseq (_: _ ==> Q') => //; move=> &m -> …).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's conseq (: P ==> Q) on an upper bound phoare[ c : A ==> E ] ≤ r: goals pre,
post (the old event's expectation below Q's indicator: for an event, E implies Q), then
the judgment with P, Q; _ keeps a condition.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's conseq (: P ==> Q) on a relational judgment (§x{1}, §x{2}): goals pre,
post, then the judgment with P, Q; _ keeps a condition. On statements, post is EC's
P => (frames) => Q' => Q: the variables Q reads that the code does not modify keep their
values from the start (prhlStmt_conseq_frame).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's exists* e on a phoare judgment or a Hoare triple: e an expression of the state
(§Preimage2.hash); the goal for every value of it, ∀ v, … : A ∧ e = v … (EC's elim* => h is
intro h).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's exists* e₁, …, eₙ on a relational judgment: the eᵢ relational terms (§x{1},
§y{2}); the goal for all their values, ∀ v₁ … vₙ, equiv[ (A ∧ e₁ = v₁) ∧ … ∧ eₙ = vₙ ==> … ]
(EC's elim* => v₁ … vₙ is intro v₁ … vₙ).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's conseq H on a relational judgment: the judgment H (about the same statements or
procedures) for the goal's; goals pre (the goal's precondition implies H's) and post
(H's postcondition implies the goal's), each closed when it is a matter of logic (the
conditions the same up to equal arguments: as EC's conseq H closes them), else left.
Equations
- One or more equations did not get rendered due to their size.