The syntactic frame: what a statement does not write, it keeps #
EasyCrypt frames a call's invariant syntactically. An oracle that writes none of D's variables
keeps glob D, and the oracle premise of the abstract call rule then needs only the oracle's own
relation (={arg} ∧ inv ==> ={res} ∧ inv). prhlProc_globInvF_of_confined does this from a
footprint (inFootprint), which a concrete procedure does not come with.
The syntactic route instead looks at every write of the statement, its callees' bodies included:
StmtWithHoles.WritesKeep G s says each of them keeps G of the globals. A write to a local
variable keeps the globals outright. A write to a global lens outside a region F keeps
F.touched_getter (touched_set_of_le_compl). hoareStmt_of_writesKeep turns that into a Hoare
triple by induction over the statement. prhlProc_globInvF_of_writesKeep puts it into the
oracle premise.
The tactic writes_keep reduces a WritesKeep goal to the conditions on single writes. It
unfolds module procedures as the inliner does (Flatten.unfoldProcedure), closes the writes to
local variables by rfl, and the writes to global lenses outside the region by
touched_set_of_le_compl with a hypothesis from the context.
A procedure triple from a triple about its body, run on the initial locals.
Every write of the statement, its callees' included, keeps G of the globals.
Equations
- One or more equations did not get rendered due to their size.
- GaudisCrypt.StmtWithHoles.WritesKeep G (GaudiProg[ skip; ]) = True
- GaudisCrypt.StmtWithHoles.WritesKeep G (GaudiProg[ x_1 <$ §a_1; ]) = ∀ (v : a) (σ : GaudisCrypt.ProgramState), G (x_1.set v σ).globals = G σ.globals
- GaudisCrypt.StmtWithHoles.WritesKeep G (GaudiProg[ a <- holecall n (§a_1); ]) = False
- GaudisCrypt.StmtWithHoles.WritesKeep G (GaudiProg[ stmt s; stmt t; ]) = (GaudisCrypt.StmtWithHoles.WritesKeep G s ∧ GaudisCrypt.StmtWithHoles.WritesKeep G t)
- GaudisCrypt.StmtWithHoles.WritesKeep G (GaudiProg[ while (§a) { stmt t; } ]) = GaudisCrypt.StmtWithHoles.WritesKeep G t
Instances For
The syntactic frame: a statement whose writes keep G keeps it.
A procedure whose writes keep G keeps it.
hoareProc_of_writesKeep, as the runs of the procedure.
EasyCrypt's oracle premise, by the syntactic frame: prhlProc_globInvF_of_confined for
oracles whose writes keep the content of F.
EasyCrypt's oracle premise up to bad, by the syntactic frame: the oracle premise of
prhlProc_abstract_call_upto(_module) at F, for oracles whose writes keep the content of F, from
a judgment about the L-contents (EC's call (: bad, invP, invQ) on concrete oracles, ={glob D}
framed syntactically).
Split a goal head … s (a predicate on statements defined by recursion on them, such as
StmtWithHoles.WritesKeep) down to its leaves, unfolding the procedures of modules
(Flatten.unfoldProcedure) where the statement is a callee's body.
stmtPredSplit for StmtWithHoles.WritesKeep.
Equations
- GaudisCrypt.writesKeepSplit g onStuck? = GaudisCrypt.stmtPredSplit `GaudisCrypt.StmtWithHoles.WritesKeep g 256 onStuck?
Instances For
writes_keep: on a goal StmtWithHoles.WritesKeep G s, the conditions on the single writes
of s, callees included. Writes to local variables are closed by rfl, writes to a global lens
X by touched_set_of_le_compl with a hypothesis X.footprint ≤ Fᶜ from the context.
Equations
- GaudisCrypt.tacticWrites_keep = Lean.ParserDescr.node `GaudisCrypt.tacticWrites_keep 1024 (Lean.ParserDescr.nonReservedSymbol "writes_keep" false)