Documentation

GaudisCrypt.Logic.FelInner

EasyCrypt's fel over a procedure the oracles call #

fel cntr step q bad [M : pre] inv?

EC's fel names, between brackets, the procedures whose calls may set the failure event bad. They need not be the adversary's oracles: Gcol.eca's Pr_col names Gcol.sample_c, which the oracles S.f, S.fi, M.f call. EC then checks the rest of the oracles' code syntactically: it must not touch the counter and bad other than through the named procedures.

Here (phoareStmt_fel_inner): the named procedure has EC's premises (FelProc, as FelOracle with pre a condition on all the globals — it may read what the oracles write), from which its calls do not increase fel's potential (FelProc.ewp_le); every oracle satisfies the syntactic check StmtWithHoles.ExpDecr for that potential (its writes keep the view of the counter, bad and inv; its calls are to the named procedure or check again), which exp_decr discharges.

structure GaudisCrypt.FelProc {Ω : Type} (L : Lens Ω VariableAssignment) (cntr : Ω → ℤ) (step : ℤ → ENNReal) (q : ℤ) (bad inv : Ω → Prop) {sig : ProcedureSignature} (pre : VariableAssignment → Prop) (p : Procedure sig) :

EC's premises of fel for a procedure p named in [p : pre], over the view L.get of the globals; pre a condition on the globals themselves (FelOracle with pre read through L).

Instances For
    theorem GaudisCrypt.FelProc.ewp_le {Ω : Type} {L : Lens Ω VariableAssignment} {cntr : Ω → ℤ} {step : ℤ → ENNReal} {q : ℤ} {bad inv : Ω → Prop} {sig : ProcedureSignature} {pre : VariableAssignment → Prop} {p : Procedure sig} (h : FelProc L cntr step q bad inv pre p) (a : sig.ParamType) (g : VariableAssignment) :
    p.ewp a (fun (x : sig.ret) (g' : VariableAssignment) => felPotential cntr step q bad inv (L.get g')) g ≤ felPotential cntr step q bad inv (L.get g)

    The step of the potential for a procedure named in fel's brackets: its calls do not increase felPotential in expectation (as FelOracle.ewp_le).

    theorem GaudisCrypt.Module.fel_expDecr {Ω : Type} {L : Lens Ω VariableAssignment} {cntr : Ω → ℤ} {step : ℤ → ENNReal} {q : ℤ} {bad inv : Ω → Prop} {T : Type 1} [IsModule T] {sig : ProcedureSignature} {holes : HoleSigs} (D : Arr T (Proc sig)) (ext : T → holes.Instantiation) (hD : Representable D ext) (hdisj : FVP.fvP D ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (O : T) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig'), StmtWithHoles.ExpDecr (fun (g : VariableAssignment) => L.get g) (felPotential cntr step q bad inv) ((ext O).lookup n).body) (a : sig.ParamType) (g : VariableAssignment) (hi : inv (L.get g)) (hb : ¬bad (L.get g)) :
    (app D O).procedure.ewp a (fun (x : sig.ret) (g' : VariableAssignment) => indicatorE (bad (L.get g'))) g ≤ ∑ i ∈ Finset.Ico (cntr (L.get g)) q, step i

    EC's fel with the bad event set in procedures the oracles call: D applied to oracles whose bodies pass the syntactic check ExpDecr for fel's potential, started where inv holds and bad does not, ends in bad with probability at most ∑_{i ∈ [cntr, q)} step i.

    theorem GaudisCrypt.phoareStmt_fel_inner {Ω : Type} {L : Lens Ω VariableAssignment} {cntr : Ω → ℤ} {step : ℤ → ENNReal} {q : ℤ} {bad inv : Ω → Prop} {T : Type 1} [IsModule T] {sig : ProcedureSignature} {holes : HoleSigs} (D : Module.Arr T (Module.Proc sig)) (ext : T → holes.Instantiation) (hD : Module.Representable D ext) (hdisj : FVP.fvP D ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (O : T) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig'), StmtWithHoles.ExpDecr (fun (g : VariableAssignment) => L.get g) (felPotential cntr step q bad inv) ((ext O).lookup n).body) {A : ProgramState → Prop} {s₀ : Stmt} {x : Setter sig.ret ProgramState} {e : Getter sig.ParamType ProgramState} {r : ENNReal} {E : ProgramState → ENNReal} (hx : ∀ (v : sig.ret) (τ : ProgramState), L.get (x.set v τ).globals = L.get τ.globals) (hE : ∀ (τ : ProgramState), E τ ≤ indicatorE (bad (L.get τ.globals))) (hinit : hoare[ A CurrentState.state ==> inv §L ∧ ¬bad §L ∧ cntr §L = 0 ] { stmt s₀; }) (hsum : ∑ i ∈ Finset.Ico 0 q, step i ≤ r) :
    phoareStmt A (GaudiProg[ stmt s₀; x <- call (Module.app D O).procedure (§e); ]) E LE.le fun (x : ProgramState) => r

    EC's fel … [M : pre] on a statement, M a procedure the oracles call: as phoareStmt_fel, the oracles checked syntactically (ExpDecr, with M's step FelProc.ewp_le for its calls), the event E at most bad.

    theorem GaudisCrypt.indicatorE_le_felPotential {Ω : Type} {cntr : Ω → ℤ} {step : ℤ → ENNReal} {q : ℤ} {bad inv : Ω → Prop} (s : Ω) :
    indicatorE (bad s) ≤ felPotential cntr step q bad inv s

    The bad event is below fel's potential.

    theorem GaudisCrypt.phoareStmt_fel_inner_rest {Ω : Type} {L : Lens Ω VariableAssignment} {cntr : Ω → ℤ} {step : ℤ → ENNReal} {q : ℤ} {bad inv : Ω → Prop} {T : Type 1} [IsModule T] {sig : ProcedureSignature} {holes : HoleSigs} (D : Module.Arr T (Module.Proc sig)) (ext : T → holes.Instantiation) (hD : Module.Representable D ext) (hdisj : FVP.fvP D ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (O : T) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig'), StmtWithHoles.ExpDecr (fun (g : VariableAssignment) => L.get g) (felPotential cntr step q bad inv) ((ext O).lookup n).body) {A : ProgramState → Prop} {s₀ s₁ : Stmt} {x : Setter sig.ret ProgramState} {e : Getter sig.ParamType ProgramState} {r : ENNReal} {E : ProgramState → ENNReal} (hx : ∀ (v : sig.ret) (τ : ProgramState), L.get (x.set v τ).globals = L.get τ.globals) (hrest : StmtWithHoles.ExpDecr (fun (g : VariableAssignment) => L.get g) (felPotential cntr step q bad inv) s₁) (hE : ∀ (τ : ProgramState), E τ ≤ indicatorE (bad (L.get τ.globals))) (hinit : hoare[ A CurrentState.state ==> inv §L ∧ ¬bad §L ∧ cntr §L = 0 ] { stmt s₀; }) (hsum : ∑ i ∈ Finset.Ico 0 q, step i ≤ r) :
    phoareStmt A (GaudiProg[ stmt s₀; x <- call (Module.app D O).procedure (§e); stmt s₁; ]) E LE.le fun (x : ProgramState) => r

    EC's fel … [M : pre] on a statement with code after the adversary: as phoareStmt_fel_inner, the code s₁ after the call checked like the oracles (ExpDecr: EC's Gext.distinguish resamples after D, through ReSample.f).

    theorem GaudisCrypt.indicatorE_mono {P Q : Prop} (h : P → Q) :

    indicatorE is monotone.

    A write ∀ v σ, L.get (x.set v σ).globals = L.get σ.globals to a global X outside the view L (x its lift to the program state), the disjointness by fp_disjoint (exp_decr_write takes it from a hypothesis).

    Equations
    Instances For

      expDecrSplit (Logic/ExpectationFrame.lean) for fel: a call's step lemma is also looked for at default transparency when none matches reducibly (a named procedure reached through an oracle record, Iter(ReSample)'s Orcl.f (Orcl.mk {f := ReSample.f})).

      For each statement on the right spine of s (through the lets of the locals): whether it calls an applied module (Module.app), the adversary's call.

      EC's fel cntr step q bad [M : pre, …] inv with procedures M that the oracles call (see the module docstring); inv may be left out (EC's true).

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