The syntactic frame for expectations: concrete supermartingales #
EasyCrypt's fel bounds a bad event through the oracles: each call increases the potential (the
bad event plus what remains to be paid) by at most nothing in expectation. For a concrete oracle
that changes the potential's state only through a few sampling procedures (Gcol.sample_c), the
step lemma of those procedures is all that matters: every other write keeps the state.
StmtWithHoles.ExpDecr G φ s says that of s: each write keeps G of the globals, and each call
either is to a procedure that does not increase φ ∘ G in expectation or has a body of which
ExpDecr holds again. Stmt.ewp_le_of_expDecr concludes that s does not increase φ ∘ G
(loops with φ ∘ G as the invariant). The tactic exp_decr reduces an ExpDecr goal to the
single writes as writes_keep does, closing a call by a step lemma from the context when one
applies.
Each write of the statement keeps G of the globals, and each call either is to a procedure
that does not increase φ ∘ G in expectation or satisfies ExpDecr itself.
Equations
- One or more equations did not get rendered due to their size.
- GaudisCrypt.StmtWithHoles.ExpDecr G φ (GaudiProg[ skip; ]) = True
- GaudisCrypt.StmtWithHoles.ExpDecr G φ (GaudiProg[ x_1 <$ §a_1; ]) = ∀ (v : a) (σ : GaudisCrypt.ProgramState), G (x_1.set v σ).globals = G σ.globals
- GaudisCrypt.StmtWithHoles.ExpDecr G φ (GaudiProg[ a <- holecall n (§a_1); ]) = False
- GaudisCrypt.StmtWithHoles.ExpDecr G φ (GaudiProg[ stmt s; stmt t; ]) = (GaudisCrypt.StmtWithHoles.ExpDecr G φ s ∧ GaudisCrypt.StmtWithHoles.ExpDecr G φ t)
- GaudisCrypt.StmtWithHoles.ExpDecr G φ (GaudiProg[ while (§a) { stmt t; } ]) = GaudisCrypt.StmtWithHoles.ExpDecr G φ t
Instances For
A procedure's expectation, as its body's from the initial locals.
The syntactic frame for expectations: a statement satisfying ExpDecr G φ does not increase
the expectation of φ ∘ G.
Stmt.ewp_le_of_expDecr for a procedure.
Split a goal StmtWithHoles.ExpDecr G φ s down to its single writes, as stmtPredSplit does
for WritesKeep; at a call, first try to close the step-lemma alternative by a hypothesis.
Close ∀ v σ, L.get ((x.set v σ).globals) = L.get σ.globals (a write to a global lens X) by
touched_set_of_le_compl with a hypothesis X.footprint ≤ (L.footprint)ᶜ from the context, trying
the hypotheses one by one (the written lens is only known once the term is elaborated).
Equations
- GaudisCrypt.tacticExp_decr_write = Lean.ParserDescr.node `GaudisCrypt.tacticExp_decr_write 1024 (Lean.ParserDescr.nonReservedSymbol "exp_decr_write" false)
Instances For
exp_decr: on a goal StmtWithHoles.ExpDecr G φ s, the conditions on the single writes of
s, callees included; a call is closed by a step lemma in the context when one matches. Writes to
local variables are closed by rfl, writes to a global lens X (for G = L.get) by
touched_set_of_le_compl with a hypothesis X.footprint ≤ (L.footprint)ᶜ from the context
(exp_decr_write).
Equations
- GaudisCrypt.tacticExp_decr = Lean.ParserDescr.node `GaudisCrypt.tacticExp_decr 1024 (Lean.ParserDescr.nonReservedSymbol "exp_decr" false)