The eager abstract-call rule for modules (EasyCrypt's eager proc on D(O)) #
eager_call (Logic/EagerProc.lean) is EasyCrypt's eager proc for a procedure with holes: it
needs the procedure's own steps to swap with the block (SwapLoc) and each hole call to be eager.
Here the first condition comes from footprints, as EasyCrypt's comes from its syntactic check
that the block and the adversary share no variables.
swapLoc_of_confinedP: steps confined to a regionRswap with a block confined to a region outsideR(transferBy_refl_of_inFootprint_compl, step by step).inFootprint_zoom_globalL: a block on the globals confined to a lensXis, zoomed to procedure states, confined toglobalL.chain X.eager_call_module: EasyCrypt'seager procfor a moduleD : Module.Arr T (procmod …)that is representable overextand disjoint fromX, for a blockSconfined toX: each oracle procedure ofext O₁eager against that ofext O₂makesD(O₁)eager againstD(O₂). At equality invariants; EasyCrypt's invariantIis added by a self-coupling (ProgramDenotation.eagerR_of_self_right).
theorem
GaudisCrypt.swapLoc_of_confinedP
{holes : HoleSigs}
{F R : Footprint ProgramState}
{SL : ProgramDenotation ProgramState Unit}
(hSL : SL.inFootprint F)
(hR : R ≤ Fᶜ)
(A : StmtWithHoles holes)
:
Lib.RO.Instantiate.ConfinedP R A → SwapLoc SL A
Confined steps swap with a block outside their region: ConfinedP gives SwapLoc.
theorem
GaudisCrypt.inFootprint_zoom_globalL
{Ω : Type}
{X : Lens Ω VariableAssignment}
{S : ProgramDenotation VariableAssignment Unit}
(hS : S.inFootprint X.footprint)
:
A block on the globals confined to X, zoomed to procedure states.
theorem
GaudisCrypt.eager_call_module
{Ω : Type}
(X : Lens Ω VariableAssignment)
{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 ≤ X.footprintᶜ)
(hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType)
(S : ProgramDenotation VariableAssignment Unit)
(hS : S.inFootprint X.footprint)
(O₁ O₂ : T)
(horacle :
∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType),
S.eagerR S (fun (σ₁ σ₂ : VariableAssignment) => σ₁ = σ₂) (procedureDenotation ((ext O₁).lookup n) a)
(procedureDenotation ((ext O₂).lookup n) a) fun (u v : sig'.ret × VariableAssignment) => u = v)
(a : sig.ParamType)
:
S.eagerR S (fun (σ₁ σ₂ : VariableAssignment) => σ₁ = σ₂) (procedureDenotation (Module.app D O₁).procedure a)
(procedureDenotation (Module.app D O₂).procedure a) fun (u v : sig.ret × VariableAssignment) => u = v
EasyCrypt's eager proc for an abstract module (equality invariants): a block S
confined to X, and a representable module D disjoint from X, whose oracle procedures are
eager (ext O₁ against ext O₂), make D(O₁) eager against D(O₂).