The footprint of concrete code that only uses locals #
FVP.fvP of a module is a syntactic over-approximation of what it touches. For a concrete
procedure whose reads and writes are all on local variables (StmtWithHoles.LocalsOnly), it is
⊥ (FVP.fvP_proc_le_of_localsOnly): such reads and writes are zooms along localL, which is
disjoint from the globals. locals_only proves LocalsOnly for a module's procedure,
unfolding it as the inliner does and closing the reads and writes of local variables by rfl.
What it cannot close is a read or write of a global.
This is what makes a concrete wrapper of abstract modules (RODist(D), …) finitely supported
when the abstract modules are.
More generally, a procedure whose reads and writes touch the globals only through a lens X
(StmtWithHoles.Within X) touches only X (FVP.fvP_proc_le_of_within): such reads and writes
are zooms along the pair of the locals and X (ProgramState.withinL X). within_lens proves
Within X as locals_only proves LocalsOnly. This is how a concrete oracle (PROM's
RRO.resample) is confined to its module variable.
A read that does not depend on the globals.
Equations
- e.LocalsOnly = ∀ (g : GaudisCrypt.VariableAssignment) (σ : GaudisCrypt.ProgramState), e.get (GaudisCrypt.ProgramState.globalL.set g σ) = e.get σ
Instances For
A write that keeps the globals and commutes with writing them.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Every read and write of the statement, its callees' included, is on the locals alone.
Equations
- GaudiProg[ skip; ].LocalsOnly = True
- GaudiProg[ x_1 <$ §e; ].LocalsOnly = (x_1.LocalsOnly ∧ e.LocalsOnly)
- (GaudisCrypt.StmtWithHoles.call' x_1 parameterNames a a_1 b r p).LocalsOnly = (x_1.LocalsOnly ∧ b.LocalsOnly ∧ r.LocalsOnly ∧ p.LocalsOnly)
- GaudiProg[ x_1 <- holecall n (§p); ].LocalsOnly = (x_1.LocalsOnly ∧ p.LocalsOnly)
- GaudiProg[ stmt s; stmt t; ].LocalsOnly = (s.LocalsOnly ∧ t.LocalsOnly)
- GaudiProg[ if (§c) { stmt t; } else { stmt e; } ].LocalsOnly = (c.LocalsOnly ∧ t.LocalsOnly ∧ e.LocalsOnly)
- GaudiProg[ while (§c) { stmt t; } ].LocalsOnly = (c.LocalsOnly ∧ t.LocalsOnly)
Instances For
A statement on the locals alone has no globals' share.
A procedure on the locals alone touches no globals.
fvP of module expressions, by the expression #
locals_only: on a goal StmtWithHoles.LocalsOnly s (or Getter.LocalsOnly,
Setter.LocalsOnly), the conditions on the single reads and writes of s, callees included;
those on local variables are closed by rfl.
Equations
- GaudisCrypt.tacticLocals_only = Lean.ParserDescr.node `GaudisCrypt.tacticLocals_only 1024 (Lean.ParserDescr.nonReservedSymbol "locals_only" false)
Instances For
The locals and X's part of the globals, as one lens.
Equations
Instances For
A read that depends on the globals only through X.
Equations
- GaudisCrypt.Getter.Within X e = ∀ (g : GaudisCrypt.VariableAssignment) (σ : GaudisCrypt.ProgramState), X.get g = X.get σ.globals → e.get { globals := g, locals := σ.locals } = e.get σ
Instances For
A write that changes the globals only through X, as a function of the locals and X.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A write of the locals alone is within any X.
A write of X itself is within X.
A write of a global Y that changes the globals only in X, as a function of X (Y a
component of a pair X, …), is within X.
Every read and write of the statement, its callees' included, touches the globals only
through X.
Equations
- One or more equations did not get rendered due to their size.
- GaudisCrypt.StmtWithHoles.Within X (GaudiProg[ skip; ]) = True
- GaudisCrypt.StmtWithHoles.Within X (GaudiProg[ x_1 <$ §e; ]) = (GaudisCrypt.Setter.Within X x_1 ∧ GaudisCrypt.Getter.Within X e)
- GaudisCrypt.StmtWithHoles.Within X (GaudiProg[ x_1 <- holecall n (§p); ]) = (GaudisCrypt.Setter.Within X x_1 ∧ GaudisCrypt.Getter.Within X p)
- GaudisCrypt.StmtWithHoles.Within X (GaudiProg[ stmt s; stmt t; ]) = (GaudisCrypt.StmtWithHoles.Within X s ∧ GaudisCrypt.StmtWithHoles.Within X t)
- GaudisCrypt.StmtWithHoles.Within X (GaudiProg[ while (§c) { stmt t; } ]) = (GaudisCrypt.Getter.Within X c ∧ GaudisCrypt.StmtWithHoles.Within X t)
Instances For
A statement within X has its globals' share in X.
A procedure within X touches only X.
A procedure within X runs confined to X.
Unfold every module procedure (Module.Proc.procedure M) in the goal, as the inliner does.
Unfold a procedure definition a return value is read off ((P …).return_val, P a definition
of a procedure, as the module command generates them), down to the return value's getter.
within_lens: on a goal StmtWithHoles.Within X s (or Getter.Within, Setter.Within), the
conditions on the single reads and writes of s, callees included. Reads and writes of local
variables, writes of X (or of a component of it, X a pair of variables) and reads of
expressions in X (or its components) and the locals are closed.
Equations
- GaudisCrypt.tacticWithin_lens = Lean.ParserDescr.node `GaudisCrypt.tacticWithin_lens 1024 (Lean.ParserDescr.nonReservedSymbol "within_lens" false)
Instances For
fp_module: the footprint of a concrete module #
Run the tactic stx on the goal g, returning the new goals.
Equations
Instances For
At a closed module c inside the module being bounded (a module applied to its Lean
arguments, a clone's module): c's own bound FVP.fvP c ≤ B_c from the bound hook (read off
c's code once per file and cached, Logic/ModuleFootprint.lean), then B_c ≤ B (each of B_c's
variables among B's, fp_sub). false, and the goal untouched, if there is no such bound or
it does not fit: the caller then unfolds c. A sub-module met several times (DSqueeze2 in
Gconcl_list.D5, FC, PC in D2 … D6) is so read once, not at each occurrence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bound L ≤ B, L a join of FVP.fvP M, evalMexpr of module expressions and procedure
footprints, through the module's expression down to its procedures, each closed by close.
atRoot: still at the module being bounded itself, before its expression is taken apart; below
it, a closed sub-module is bounded by its own bound where it has one (subBound).
fp_module X: prove FVP.fvP M ≤ B for a concrete module M (a module, or a functor of
modules: the parameters contribute nothing) whose procedures read and write the globals only
through the lens X (within_lens), with X.footprint ≤ B (by le_rfl, after splitting X's
pairs, or B = F ⊔ X.footprint). An abstract module A inside M (a Lean parameter) needs
B = FVP.fvP A ⊔ …. fp_module alone: M's procedures use locals only (locals_only), and B
is anything, ⊥ in particular. EasyCrypt reads a concrete module's globals off its code.
Equations
- One or more equations did not get rendered due to their size.