Footprint disjointness from module restrictions #
EasyCrypt checks {-M}-style side conditions itself: a variable lies outside a module's globals
when the module is built from modules whose restrictions exclude it. Here such a side condition
is a goal A ≤ (FVP.fvP M)ᶜ (equivalently FVP.fvP M ≤ Aᶜ), and fp_disjoint proves it the same
way: it bounds FVP.fvP M through the module combinators (fvP_app, fvP_pair, fvP_fst, …,
unfolding definitions such as a module type's accessors and constructors) down to modules with a
restriction hypothesis FVP.fvP N ≤ Sᶜ (or a declared module Module.Declared N S,
Logic/DeclareModule.lean) in the context, and finds A among the joinands of S
(a joinand glob X, EasyCrypt's restriction against an abstract module, covers A ≤ X).
A concrete module has no restriction hypothesis: its globals are read off its code. A lemma
FVP.fvP M ≤ B tagged @[fp_bound] (proven by fp_module) bounds it; B is then a join of
variables. A variable v is outside glob D when it is outside D and D is finitely supported
(EasyCrypt's glob D is a set of variables): Footprint.varLens_le_compl_glob, with the finite
support from a hypothesis Module.ECModule D _ (or (FVP.fvP D).FinitelySupported). A
restriction between abstract modules is symmetric (Footprint.le_compl_glob_symm): M is outside
glob D when D is outside glob M.
A region R given for a module in place of its glob (Footprint.Restricted R S: R stays
outside S; Logic/DeclareModule.lean, declare module … with glob R) is read like a restriction
hypothesis R ≤ Sᶜ: a variable or an abstract module among the joinands of S is outside R.
@[fp_bound]: a bound FVP.fvP M ≤ B on a concrete module that fp_disjoint uses.
Equations
- Parser.Attr.fp_bound = Lean.ParserDescr.node `Parser.Attr.fp_bound 1024 (Lean.ParserDescr.nonReservedSymbol "fp_bound" false)
Instances For
The form fp_disjoint reduces its goal to.
A restriction hypothesis F ≤ Sᶜ, with A ≤ S, gives F ≤ Aᶜ.
A variable outside a finitely supported F is outside F.glob (EasyCrypt: glob D is the
set of D's variables).
Fresh variables outside a glob: Footprint.exists_fresh for F ⊔ G, the fresh variable
also outside glob F (it is a single variable outside F).
A region restricted against S: R, finitely supported, stays outside S. The region
given for a module in place of its glob (declare module D <: T {-…} with glob R,
Logic/DeclareModule.lean): where a lemma about a declared module D restricts other modules
against glob D (EC's forall (F <: T {-D})) and is applied to a module built from a declared
one, glob D of the application is known only from above; the lemma is stated against a region
R above D's footprint instead, which the application gives explicitly (EC's glob F(A):
glob F and glob A). fp_disjoint reads it as the hypothesis R ≤ Sᶜ.
- finite : R.FinitelySupported
Instances
Run k; on failure restore the state and return false.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply the lemma lem, its premises to be the new goals (in order).
Equations
- GaudisCrypt.FootprintSolver.applyConst g lem = do let __do_lift ← Lean.Meta.mkConstWithFreshMVarLevels lem g.apply __do_lift { allowSynthFailures := true }
Instances For
Close A ≤ S with A a joinand of S (up to reducible defeq, unfolding definitions in S
that are not joins), or A itself a join of such, or ⊥.
A restriction hypothesis as (F, S, proof of F ≤ Sᶜ): h : F ≤ Sᶜ itself, a declared
module h : Module.Declared A S (Logic/DeclareModule.lean), with F = FVP.fvP A, or a
restricted region h : Footprint.Restricted R S, with F = R.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Close F ≤ Aᶜ from a hypothesis h : F ≤ Sᶜ with A ≤ S (or a declared module's).
Equations
- One or more equations did not get rendered due to their size.
Instances For
A proof of F.FinitelySupported, from a hypothesis Module.ECModule D _ (F = FVP.fvP D)
or F.FinitelySupported.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A source of bounds FVP.fvP M ≤ B for modules M the solver has no rule for (a concrete
module, whose globals are read off its code: Logic/ModuleFootprint.lean): the proof, if any.
Equations
Instances For
The bound source of the footprints read off the code (Logic/ModuleFootprint.lean sets it),
for the solver's callers that cannot import that file (stmt_swap: a callee's footprint against
a moved assignment).
Close X ≤ Aᶜ, X a join of module footprints FVP.fvP M and variables: each M has a
restriction hypothesis, an @[fp_bound], or is bounded through the module combinators by modules
that do; each variable is outside A's modules (outside glob D by D's finite support).
Prove A ≤ (FVP.fvP M)ᶜ (or A ≤ Fᶜ for a join F of module footprints), or
FVP.fvP M ≤ Aᶜ, from the restriction hypotheses in context.
Equations
- One or more equations did not get rendered due to their size.
Instances For
fp_disjoint: close A ≤ (FVP.fvP M)ᶜ or FVP.fvP M ≤ Aᶜ (EasyCrypt's check of a memory
restriction), bounding FVP.fvP M through the module combinators by modules with a restriction
hypothesis FVP.fvP N ≤ Sᶜ in context, A (or each joinand of it) among the joinands of S.
Equations
- GaudisCrypt.tacticFp_disjoint = Lean.ParserDescr.node `GaudisCrypt.tacticFp_disjoint 1024 (Lean.ParserDescr.nonReservedSymbol "fp_disjoint" false)