The abstract call rule (EasyCrypt's call (: inv) for an adversary with oracles) #
An adversary run against two instantiations of its oracles couples with itself as EasyCrypt's
abstract call rule says (equivF_abs_spec, src/phl/ecPhlFun.ml):
equiv[ O₁.o ~ O₂.o : ={arg} ∧ inv ==> ={res} ∧ inv ] (for every oracle o the adversary may call)
──────────────────────────────────────────────────────────────────────────────────────
equiv[ D(O₁) ~ D(O₂) : ={arg} ∧ ={glob D} ∧ inv ==> ={res} ∧ ={glob D} ∧ inv ]
The invariant inv reads only the oracles' state: a lens L that the adversary is disjoint from
(EasyCrypt's D <: T {-O}; EasyCrypt also rejects an inv that mentions glob D). Globals
outside glob D and L are unconstrained, as in EasyCrypt.
={glob} is agreement on a region F (globInvF): everything the adversary may touch, and
possibly more, but disjoint from L. There are three forms.
- Procedures with holes (
prhlProc_abstract_call). The adversary isA : ProcedureWithHoles holes sig, its holes are the oracle procedures it may call, andF = FVP.fvP_proc A, so={glob}isFVP.glob A. - Modules (
prhlProc_abstract_call_module). The adversary is a moduleD : Module.Arr T (procmod …), as EasyCrypt declares it, andF = FVP.fvP D. It comes with a hypothesisD.Representable ext: applied to any oraclesO,Dbehaves like a procedure with holes filled withext O, the procedures EasyCrypt letsDcall (itsOI.allowed). In EasyCrypt this holds by construction; in Gaudí it is the gap recorded as exception E2 of the SHA-3 port. - Any region (
prhlProc_abstract_callF), which the other two instantiate.
The proof is the oracle-agnostic machinery of Lib/RO/ROCouplingEquiv.lean
(instantiate_of_fvP_gen), with two ingredients.
footprintCompat_globInvF: the adversary's own steps preserve the invariant.={glob}is carried by the orbit self-coupling andinvby the per-run preservation of theL-content. It generalizesfootprintCompat_PGlobfrom equal random-oracle tables.hhole_of_prhl2: the per-oracle specifications give the per-call coupling. It generalizesro_hhole_prhl.
The oracle premises carry ={glob} along, as EasyCrypt's do when an oracle can use D. For
oracles confined to L, prhlProc_globInvF_of_confined removes it, as EasyCrypt does.
glob_set_of_le_compl rewrites ={glob} through a write that the region cannot see.
The invariant and the adversary's own steps #
The abstract call invariant ={glob} ∧ inv. ={glob} is agreement on the region F, and
inv reads the oracle region L.
Equations
- GaudisCrypt.globInvF L F I g₁ g₂ = (F.touched_getter.get g₁ = F.touched_getter.get g₂ ∧ I (L.get g₁) (L.get g₂))
Instances For
globInvF at the footprint of a procedure with holes: ={glob A} ∧ inv.
Equations
- GaudisCrypt.globInv L A I = GaudisCrypt.globInvF L (GaudisCrypt.FVP.fvP_proc A) I
Instances For
An adversary disjoint from the global lens L is disjoint from it as a procedure (L lifted
through globalL). This is fvP_proc_le_roLift_compl for an arbitrary lens.
A write through a lens X outside the region F leaves F's content unchanged.
A write through a lens X that A cannot see leaves glob A unchanged.
The global steps outside F, lifted to procedure states (fixing the locals).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The adversary's own steps preserve the call invariant. Every program confined to what
A may touch self-couples from globInvF-related states, for any region F that contains A's
footprint and is disjoint from L. It generalizes footprintCompat_PGlob from equal
random-oracle tables to any inv on the L-content. It runs the orbit self-coupling
(prhl2_self_of_orbit) and re-attaches inv through the coupling's marginals: neither side's run
changes its L-content.
The oracle side #
The hole coupling from per-oracle specifications: calls of the two instantiations of an
oracle couple under liftRel P when the oracle procedures do under P. This generalizes
ro_hhole_prhl from the random oracle to any pair of instantiations.
A run confined to the lens L only rewrites the L-content: every final state is
L.set v σ for some v.
Oracles confined to L keep the F-content of a region F disjoint from L: an
L-confined run changes only the L-content.
EasyCrypt's oracle premise. For oracles confined to L, the oracle premise of the rule
follows from ={arg} ∧ inv ==> ={res} ∧ inv alone: ={glob} survives because the oracles cannot
see it.
prhlProc_globInvF_of_confined at the footprint of a procedure with holes.
The rule #
The abstract call rule, on denotations, for any region F that contains A's footprint
and is disjoint from the oracle region L.
The abstract call rule, as a prhlProc judgment, for any region F that contains A's
footprint and is disjoint from the oracle region L.
The abstract call rule for a procedure with holes (={glob} is FVP.glob A).
Modules #
EasyCrypt declares an adversary as a module of a functor type, declare module D <: T. The rule
applies to such a module through a representation: a procedure with holes p that D, applied
to any oracles O, behaves like when filled with ext O. ext picks the oracle procedures D
may call (EasyCrypt's OI.allowed). In EasyCrypt every module is such code by construction; in
Gaudí the module language is more general, and the representation is a hypothesis
(Module.Representable) until a representation lemma is proven.
D applied to oracles O behaves like p filled with ext O, and p touches nothing that
D does not.
- denote (O : T) (a : sig.ParamType) : procedureDenotation (app D O).procedure a = procedureDenotation (p.instantiate (ext O)) a
Instances For
D is represented by some procedure with holes, its oracles chosen by ext.
Equations
- GaudisCrypt.Module.Representable D ext = ∃ (p : GaudisCrypt.ProcedureWithHoles holes sig), GaudisCrypt.Module.RepresentedBy D ext p
Instances For
D is an EasyCrypt-like module: representable, its oracles chosen by ext
(Module.Representable), and with finitely many global variables
(Footprint.FinitelySupported, which fresh variables need: Footprint.exists_fresh). The
hypothesis a ported EasyCrypt statement puts on an abstract module (declare module D).
Equations
Instances For
The abstract call rule for a module (EasyCrypt's declare module D <: T {-O}, then
call (: inv)). ={glob D} is agreement on FVP.fvP D, everything D may touch.
prhlProc_abstract_call_module at a region F containing glob D (instead of FVP.fvP D
itself): the invariant ={F} ∧ I is the same across nested abstract calls (a distinguisher whose
oracles are a simulator's procedures, F covering both).
Representability of concrete functor modules #
fvP only grows when a procedure's holes are filled: a hole node contributes the write of the
result and the read of the arguments, and the call that replaces it contributes those and more.
So a functor module D whose application reduces to p.instantiate (ext O) (what the module
command's apply_simp lemmas state) is represented by p. The footprint half goes through one
oracle O₀ with an empty footprint:
fvP_proc p ≤ fvP_proc (p.instantiate (ext O₀)) = fvP (D O₀) ≤ fvP D ⊔ fvP O₀ = fvP D.
Reducing the empty footprint through a lens gives the empty footprint.
A procedure-typed module is the module of its procedure.
A module's procedure stays within the module's footprint (FVP.fvP), on every argument:
what {-M}-style restrictions on M are about.
A functor module that applies to p.instantiate (ext O) is represented by p, given one
oracle module O₀ with an empty footprint (to bound p's footprint by D's).