Documentation

GaudisCrypt.Logic.Granular

Granular regions: EasyCrypt's glob M as a lens region #

EasyCrypt's memory is a set of whole variables, and glob M is the set of variables M touches. Here the grains of the variable granularity (variableGranularity) are the variables' slots, and the granular cover of a module's footprint (Footprint.IsSubGranular.granularCover) is its glob: the slots it touches, whole. A cover is a lens region (GranularFootprint.footprint_fromLens), so a run that stays out of it leaves its content unchanged (ProgramDenotation.preserves_touched_of_fromLens) — which footprint-disjointness alone does not give (CounterExamples/FramingNeedsReset.lean). An EasyCrypt-like module has one (Footprint.FinitelySupported.isSubGranular), and a restriction against a variable carries over to the cover (Footprint.IsSubGranular.granularCover_le_compl). Evaluation: notes/SHA3/GlobGranularity.md.

A run confined to R keeps the content of a lens-derived region Q outside R.

A sub-granular footprint outside a grain has its whole granular cover outside it.

@[reducible]

EasyCrypt's memory: the grains are the slots of the variables (of nontrivial types).

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Finitely many variables cover a sub-granular footprint.

    EasyCrypt's glob of a footprint: the slots of the variables it touches, whole (its granular cover under variableGranularity); ⊤ for a footprint that no finitely many variables cover (conservative: nothing is outside it). A restriction {-Y} between abstract modules is FVP.fvP X ≤ (FVP.fvP Y).glob ᶜ (exception E7).

    Equations
    Instances For

      A footprint lies within its glob.

      Below a footprint, below its glob.

      Restrictions between abstract modules are symmetric (EasyCrypt's {-D}: no common variable): if F (finitely supported) stays outside glob G, then G stays outside glob F.

      The glob of a finitely supported footprint is a lens region.

      The one-sided frame: a run confined to R, which stays out of the glob of a finitely supported F, keeps F's content (EC's call{1} of an abstract procedure, against ={glob A}).

      Calls with a frame #

      theorem GaudisCrypt.SubProbability.satisfies_fst_of_marginal {α β : Type 1} {μ : SubProbability (α × β)} {ν : SubProbability α} (hm : (do let w ← μ pure w.1) = ν) {P : α → Prop} (hP : ν.satisfies P) :
      μ.satisfies fun (w : α × β) => P w.1

      What every outcome of the left marginal satisfies, every coupled pair satisfies on the left.

      A procedure confined to R leaves a variable X outside R alone.

      theorem GaudisCrypt.prhlStmt_seq_call_refl_frame {sig : ProcedureSignature} {p : Procedure sig} {R : Footprint VariableAssignment} (hp : ∀ (a : sig.ParamType), (procedureDenotation p a).inFootprint R) {β : Type} (X : Lens β VariableAssignment) (hX : X.footprint ≤ Rᶜ) {x₁ x₂ : Setter sig.ret ProgramState} {e₁ e₂ : Getter sig.ParamType ProgramState} {A B : ProgramState → ProgramState → Prop} {s₁ s₂ : Stmt} (hpre : prhlStmt A s₁ s₂ fun (σ₁ σ₂ : ProgramState) => e₁.get σ₁ = e₂.get σ₂ ∧ σ₁.globals = σ₂.globals ∧ ∀ (r : sig.ret) (g : VariableAssignment), X.get g = X.get σ₁.globals → B (x₁.set r (ProgramState.globalL.set g σ₁)) (x₂.set r (ProgramState.globalL.set g σ₂))) :
      prhlStmt A (StmtWithHoles.seq s₁ (Stmt.call x₁ p e₁)) (StmtWithHoles.seq s₂ (Stmt.call x₂ p e₂)) B

      Calls of the same procedure on both sides, with a frame (EC's call (_: true) where the postcondition also uses a variable the callee cannot touch): prhlStmt_seq_call_refl, the postcondition needed only for globals that keep the value of X, a variable outside the callee's footprint.