EasyCrypt's PRP/PRF switching lemma (theories/crypto/prp_prf/Strong_RP_RF.eca) #
The abstract theory's types D, K and operators uD, dK, q are section variables (with
their axioms as hypotheses where used), so a clone is an application. Only what ported
developments use is here: ARP, DBounder and the statement of Conclusion.
The PRPi clone (clone import RP as PRPi with op dD <- uD rename "RP" as "PRPi") is
PRP.RP.RP D uD. Module variables (PRPi.m, ARP.coll …) are parameters: a clone of this theory
declares its own global_vars and passes them.
Distinguishers are EasyCrypt-like modules #
(Exception E2 of the SHA-3 port is a theorem here.)
O.f, O.fi out of the oracles O.
Equations
Instances For
Every Distinguisher is representable over f and fi
(Module.representable_of_firstOrder).
A Distinguisher is EasyCrypt-like as soon as it has finitely many globals.
clone import RP as PRPi with op dD <- uD rename "RP" as "PRPi", with its module variables
PRPi.m, PRPi.mi passed by the clone.
Equations
- GaudisCrypt.EC.Strong_RP_RF.PRPi.PRPi D uD m mi = GaudisCrypt.EC.PRP.RP.RP D uD m mi
Instances For
ARP's module variables coll, m, mi are parameters (see PRP.lean).
@[simp]: ARP.init = Module.proc ARP.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of ARP.f.procedure with a tuple holeArgs of procedures: the body of proc f as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [ARP.f.procedure.apply_simp]).
The body of proc init of module ARP, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see ARP.init.procedure.apply_simp) rather than run. Use ARP.init for this procedure as a module.
Equations
- GaudisCrypt.EC.Strong_RP_RF.ARP.init.procedure D uD coll m mi = proc () : Unit { m <- GaudisCrypt.EC.FMap.empty; mi <- GaudisCrypt.EC.FMap.empty; coll <- false; return () }
Instances For
proc f of module ARP as a module: Module.proc ARP.f.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — ARP.f.apply_simp says exactly that.
Equations
- GaudisCrypt.EC.Strong_RP_RF.ARP.f D uD coll m mi = GaudisCrypt.Module.proc (GaudisCrypt.EC.Strong_RP_RF.ARP.f.procedure D uD coll m mi)
Instances For
The body of proc fi of module ARP, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see ARP.fi.procedure.apply_simp) rather than run. Use ARP.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of ARP.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [ARP.init.procedure.apply_simp]).
The body of proc f of module ARP, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see ARP.f.procedure.apply_simp) rather than run. Use ARP.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: ARP.f = Module.proc ARP.f.procedure — true by definition, proc f using no module parameter and so having no holes to fill.
proc init of module ARP as a module: Module.proc ARP.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — ARP.init.apply_simp says exactly that.
Equations
- GaudisCrypt.EC.Strong_RP_RF.ARP.init D uD coll m mi = GaudisCrypt.Module.proc (GaudisCrypt.EC.Strong_RP_RF.ARP.init.procedure D uD coll m mi)
Instances For
@[simp]: ARP.fi = Module.proc ARP.fi.procedure — true by definition, proc fi using no module parameter and so having no holes to fill.
Instantiating the holes of ARP.fi.procedure with a tuple holeArgs of procedures: the body of proc fi as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [ARP.fi.procedure.apply_simp]).
The module declared by module ARP: the record of its procedures ARP.init, ARP.f, ARP.fi.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no ARP.apply_simp to apply it with.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc fi of module ARP as a module: Module.proc ARP.fi.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — ARP.fi.apply_simp says exactly that.
Equations
- GaudisCrypt.EC.Strong_RP_RF.ARP.fi D uD coll m mi = GaudisCrypt.Module.proc (GaudisCrypt.EC.Strong_RP_RF.ARP.fi.procedure D uD coll m mi)
Instances For
To factor out the difficult step, the PRP is parameterized by a procedure that samples its
output (EC's Sample_t), with two instantiations.
The module type declared by moduletype Sample_t, with fields sample: the type Module Sample_t.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Sample_t.mk, read a single field off one with the accessors Sample_t.sample, and get the whole record back with Sample_t.structure.
Equations
Instances For
@[simp]: Sample_t.mk (Sample_t.structure m) = m — rebuilding a module from its own fields gives that module back.
The ModuleTypeRep underlying Sample_t, the module type declared by moduletype Sample_t: the right-nested product of its 1 field types, in declaration order.
Sample_t is by definition Module Sample_t.typeRep.
Equations
Instances For
The record of the fields of a module of type Sample_t: the fields sample, one per moduletype field, each of that field's own module type.
Sample_t.mk turns such a record into a Sample_t, Sample_t.structure turns a Sample_t back into one.
Instances For
The field sample of a module of type Sample_t: the projection onto component 0 of the right-nested tuple Sample_t.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Sample_t.sample.mk_simp reads this field back off a module built by Sample_t.mk; Sample_t.sample.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named X, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Equations
- GaudisCrypt.EC.Strong_RP_RF.Sample_t.sample D theModule✝ = theModule✝
Instances For
Builds a module of type Sample_t from the record Sample_t.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Sample_t.structure (Sample_t.mk_destruct, Sample_t.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Sample_t.sample.mk_simp.
Equations
- GaudisCrypt.EC.Strong_RP_RF.Sample_t.mk D theRecord✝ = theRecord✝.sample
Instances For
The record of a module's fields: Sample_t.structure m is Sample_t.Structure.mk applied to Sample_t.sample of m.
Inverse of Sample_t.mk (Sample_t.mk_destruct, Sample_t.destruct_mk).
Equations
- GaudisCrypt.EC.Strong_RP_RF.Sample_t.structure D theModule✝ = { sample := GaudisCrypt.EC.Strong_RP_RF.Sample_t.sample D theModule✝ }
Instances For
@[simp]: Sample_t.structure (Sample_t.mk r) = r — destructing a module built from a record gives that record back.
The IsModule Sample_t instance: Sample_t is a module type, with representation Sample_t.typeRep.
It is what lets the name Sample_t stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Sample_t.typeRep would do on its own but Sample_t, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.Strong_RP_RF.instIsModuleSample_t D = { moduleTypeRep := GaudisCrypt.EC.Strong_RP_RF.Sample_t.typeRep D, isModule := ⋯ }
What is derivable about the accessor Sample_t.sample, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Sample_t.sample.utilities.accessorModule : Sample_t →ₘ …— the accessor as a module, a projection being a module morphism;Sample_t.sample.utilities.apply_simp—Module.app Sample_t.sample.utilities.accessorModule m = Sample_t.sample m: applying that module is the accessor;Sample_t.sample.utilities.expression_eq— the same at the level of expressions:(Sample_t.sample m).expression = (Sample_t.sample.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: reading the field sample back off a module built from a record — Sample_t.sample (Sample_t.mk r) = r.sample.
It is what carries the right-hand side of an X.apply_simp (which is an Sample_t.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.sample.apply_simp.
proc sample of module Direct as a module: Module.proc Direct.sample.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Direct.sample.apply_simp says exactly that.
Equations
Instances For
The module declared by module Direct: the record of its procedures Direct.sample.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Direct.apply_simp to apply it with.
Equations
Instances For
@[simp]: Direct.sample = Module.proc Direct.sample.procedure — true by definition, proc sample using no module parameter and so having no holes to fill.
The body of proc sample of module Direct, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see Direct.sample.procedure.apply_simp) rather than run. Use Direct.sample for this procedure as a module.
Equations
- GaudisCrypt.EC.Strong_RP_RF.Direct.sample.procedure D uD = proc (X : D → Prop) : D { var r : D; r <$ GaudisCrypt.EC.dexcepted uD §X; return §r }
Instances For
Instantiating the holes of Direct.sample.procedure with a tuple holeArgs of procedures: the body of proc sample as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [Direct.sample.procedure.apply_simp]).
proc sample of module Indirect as a module: Module.proc Indirect.sample.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Indirect.sample.apply_simp says exactly that.
Equations
Instances For
@[simp]: Indirect.sample = Module.proc Indirect.sample.procedure — true by definition, proc sample using no module parameter and so having no holes to fill.
The module declared by module Indirect: the record of its procedures Indirect.sample.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Indirect.apply_simp to apply it with.
Equations
Instances For
Instantiating the holes of Indirect.sample.procedure with a tuple holeArgs of procedures: the body of proc sample as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [Indirect.sample.procedure.apply_simp]).
The body of proc sample of module Indirect, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see Indirect.sample.procedure.apply_simp) rather than run. Use Indirect.sample for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying PRPi'.f to the parameters proc f uses (S) is Module.proc (PRPi'.f.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
Instantiating the holes of PRPi'.fi.procedure with a tuple holeArgs of procedures: the body of proc fi as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRPi'.fi.procedure.apply_simp]).
The module declared by module PRPi', abstracted over its single parameter S, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.
Applied to such a tuple it is the record of its procedures PRPi'.init, PRPi'.f, PRPi'.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma PRPi'.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of PRPi'.f.procedure with a tuple holeArgs of procedures: the body of proc f as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRPi'.f.procedure.apply_simp]).
proc fi of module PRPi' as a module, abstracted over the module parameters it uses (S, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma PRPi'.fi.apply_simp, which fills the holes of PRPi'.fi.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying PRPi' to a tuple of its single parameter S — the record of its procedures PRPi'.init, PRPi'.f, PRPi'.fi, each applied to the parameters it uses.
This is the lemma that unfolds a module use: simp rewrites with it, then with the field lemmas of the module type (N.f.mk_simp) to get at the one procedure the goal is about, and then with PRPi'.init.apply_simp, PRPi'.f.apply_simp, PRPi'.fi.apply_simp to fill that procedure's holes.
Instantiating the holes of PRPi'.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRPi'.init.procedure.apply_simp]).
@[simp]: PRPi'.init = Module.proc PRPi'.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
The body of proc fi of module PRPi', as a procedure of its own: the one call it makes to a module parameter (S) is its single hole.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRPi'.fi.procedure.apply_simp) rather than run. Use PRPi'.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc f of module PRPi', as a procedure of its own: the one call it makes to a module parameter (S) is its single hole.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRPi'.f.procedure.apply_simp) rather than run. Use PRPi'.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc f of module PRPi' as a module, abstracted over the module parameters it uses (S, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma PRPi'.f.apply_simp, which fills the holes of PRPi'.f.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying PRPi'.fi to the parameters proc fi uses (S) is Module.proc (PRPi'.fi.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
The body of proc init of module PRPi', as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRPi'.init.procedure.apply_simp) rather than run. Use PRPi'.init for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc init of module PRPi' as a module: Module.proc PRPi'.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — PRPi'.init.apply_simp says exactly that.
Equations
- GaudisCrypt.EC.Strong_RP_RF.PRPi'.init D uD PRPi_m PRPi_mi = GaudisCrypt.Module.proc (GaudisCrypt.EC.Strong_RP_RF.PRPi'.init.procedure D uD PRPi_m PRPi_mi)
Instances For
EC's lossless lemmas (notin_supportIP, excepted_lossless, Indirect_ll,
PRPi'_Indirect_f_ll, PRPi'_Indirect_fi_ll): only excepted_lossless is used downstream
(ConcreteF); uD's fullness (uD_full) is part of EC's axiom uD_uf_fu.
lemma excepted_lossless (m : (D,D) fmap): uD \ rng m is lossless when m misses a key.
The section Upto, with declare module D <: Distinguisher {-PRPi, -ARP} #
The local module's variable PRP_indirect_bad.bad is the lens parameter
PRP_indirect_bad_bad (exception E6 of the SHA-3 port).
@[simp]: PRP_indirect_bad.sample = Module.proc PRP_indirect_bad.sample.procedure — true by definition, proc sample using no module parameter and so having no holes to fill.
proc sample of module PRP_indirect_bad as a module: Module.proc PRP_indirect_bad.sample.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — PRP_indirect_bad.sample.apply_simp says exactly that.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module PRP_indirect_bad: the record of its procedures PRP_indirect_bad.init, PRP_indirect_bad.sample, PRP_indirect_bad.f, PRP_indirect_bad.fi.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no PRP_indirect_bad.apply_simp to apply it with.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: PRP_indirect_bad.f = Module.proc PRP_indirect_bad.f.procedure — true by definition, proc f using no module parameter and so having no holes to fill.
Instantiating the holes of PRP_indirect_bad.sample.procedure with a tuple holeArgs of procedures: the body of proc sample as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRP_indirect_bad.sample.procedure.apply_simp]).
The body of proc f of module PRP_indirect_bad, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRP_indirect_bad.f.procedure.apply_simp) rather than run. Use PRP_indirect_bad.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc init of module PRP_indirect_bad, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRP_indirect_bad.init.procedure.apply_simp) rather than run. Use PRP_indirect_bad.init for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc fi of module PRP_indirect_bad as a module: Module.proc PRP_indirect_bad.fi.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — PRP_indirect_bad.fi.apply_simp says exactly that.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc f of module PRP_indirect_bad as a module: Module.proc PRP_indirect_bad.f.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — PRP_indirect_bad.f.apply_simp says exactly that.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc init of module PRP_indirect_bad as a module: Module.proc PRP_indirect_bad.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — PRP_indirect_bad.init.apply_simp says exactly that.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of PRP_indirect_bad.fi.procedure with a tuple holeArgs of procedures: the body of proc fi as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRP_indirect_bad.fi.procedure.apply_simp]).
@[simp]: PRP_indirect_bad.init = Module.proc PRP_indirect_bad.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of PRP_indirect_bad.f.procedure with a tuple holeArgs of procedures: the body of proc f as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRP_indirect_bad.f.procedure.apply_simp]).
The body of proc fi of module PRP_indirect_bad, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRP_indirect_bad.fi.procedure.apply_simp) rather than run. Use PRP_indirect_bad.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of PRP_indirect_bad.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [PRP_indirect_bad.init.procedure.apply_simp]).
The body of proc sample of module PRP_indirect_bad, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see PRP_indirect_bad.sample.procedure.apply_simp) rather than run. Use PRP_indirect_bad.sample for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: PRP_indirect_bad.fi = Module.proc PRP_indirect_bad.fi.procedure — true by definition, proc fi using no module parameter and so having no holes to fill.
PRP_indirect_bad at the module type PRP.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The f bullet of EC's call (_: ARP.coll, !PRP_indirect_bad.bad{1} /\\ ={m,mi}(PRPi,ARP), (PRP_indirect_bad.bad{1} <=> ARP.coll{2})) in pr_PRPi'_Indirect_ARP (EC's proc; if; inline *; swap{1} 1; seq 1 4 …; sp; if{1}): before the bad event ARP.coll, the oracles agree; the bad
event comes with PRP_indirect_bad.bad (excepted_lossless for the resampling).
The fi bullet of that call, as PRP_indirect_bad_f_ARP_f.
EC's PRP_indirect_bad.bad ==> PRP_indirect_bad.bad for f (the left oracle keeps invQ
once ARP.coll holds).
PRP_indirect_bad_f_bad for fi.
ARP.f keeps ARP.coll and invQ (EC's move=> &1; proc; if; auto).
ARP_f_coll for fi.
ARP.f is lossless.
ARP.fi is lossless.
PRP_indirect_bad.f is lossless (EC: seq 2: (X = rng PRPi.m /\\ x \\notin PRPi.m) …,
excepted_lossless).
PRP_indirect_bad.fi is lossless.
The f oracle of EC's PRPi'_Indirect_eq (inline *; sim): PRPi'(Indirect).f and
PRP_indirect_bad.f agree, the states equal except on PRP_indirect_bad.bad.
The fi oracle of EC's PRPi'_Indirect_eq.
The byequiv of EC's local lemma PRPi'_Indirect_eq (proc; inline *; sim): the distinguisher
called with the two oracles, the states equal except on PRP_indirect_bad.bad
(prhlProc_abstract_call_equal_outside_module).
The byequiv: PRP_indirect_bad.bad of EC's pr_PRPi'_Indirect_ARP: EC's
call (_: ARP.coll, !PRP_indirect_bad.bad{1} /\\ ={m,mi}(PRPi,ARP), (PRP_indirect_bad.bad{1} <=> ARP.coll{2})) (prhlProc_abstract_call_upto_module, the oracle state
of both sides as one lens, ={glob D} framed syntactically: prhlProc_upto_of_writesKeep;
D lossless with both oracles by D_ll, exception E11), then inline *; auto.
EC's local lemma PRPi'_Indirect_eq &m.
EC's pr_PRPi'_Indirect_ARP, for a distinguisher whose globals are in a region G outside the
oracles' variables, lossless with oracles outside G (G = glob D is EC's statement; a region
lets PartialConclusion apply it to DBounder(D), whose glob is not D's).
EC's lemma pr_PRPi'_Indirect_ARP &m, for declare module D <: Distinguisher {-PRPi, -ARP}
with the axiom D_ll (the restriction stated against glob D, exception E7; the module
variables are lens parameters, disjoint, exception E8).
DBounder.FBounder's module variable c is a parameter (see PRP.lean).
Instantiating the holes of DBounder.FBounder.fi.procedure with a tuple holeArgs of procedures: the body of proc fi as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [DBounder.FBounder.fi.procedure.apply_simp]).
The body of proc fi of module DBounder.FBounder, as a procedure of its own: the one call it makes to a module parameter (F) is its single hole.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see DBounder.FBounder.fi.procedure.apply_simp) rather than run. Use DBounder.FBounder.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DBounder.FBounder.f to the parameters proc f uses (F) is Module.proc (DBounder.FBounder.f.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
The module declared by module DBounder.FBounder, abstracted over its single parameter F, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.
Applied to such a tuple it is the record of its procedures DBounder.FBounder.f, DBounder.FBounder.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DBounder.FBounder.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc fi of module DBounder.FBounder as a module, abstracted over the module parameters it uses (F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma DBounder.FBounder.fi.apply_simp, which fills the holes of DBounder.FBounder.fi.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of DBounder.FBounder.f.procedure with a tuple holeArgs of procedures: the body of proc f as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [DBounder.FBounder.f.procedure.apply_simp]).
proc f of module DBounder.FBounder as a module, abstracted over the module parameters it uses (F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma DBounder.FBounder.f.apply_simp, which fills the holes of DBounder.FBounder.f.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DBounder.FBounder.fi to the parameters proc fi uses (F) is Module.proc (DBounder.FBounder.fi.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
@[simp]: applying DBounder.FBounder to a tuple of its single parameter F — the record of its procedures DBounder.FBounder.f, DBounder.FBounder.fi, each applied to the parameters it uses.
This is the lemma that unfolds a module use: simp rewrites with it, then with the field lemmas of the module type (N.f.mk_simp) to get at the one procedure the goal is about, and then with DBounder.FBounder.f.apply_simp, DBounder.FBounder.fi.apply_simp to fill that procedure's holes.
The body of proc f of module DBounder.FBounder, as a procedure of its own: the one call it makes to a module parameter (F) is its single hole.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see DBounder.FBounder.f.procedure.apply_simp) rather than run. Use DBounder.FBounder.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DBounder to a tuple of its single parameter F — the record of its procedures DBounder.distinguish, each applied to the parameters it uses.
This is the lemma that unfolds a module use: simp rewrites with it, then with the field lemmas of the module type (N.f.mk_simp) to get at the one procedure the goal is about, and then with DBounder.distinguish.apply_simp to fill that procedure's holes.
The module declared by module DBounder, abstracted over its single parameter F, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the anonymous product of the procedures' own types, the declaration naming no module type.
Applied to such a tuple it is the record of its procedures DBounder.distinguish, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DBounder.apply_simp says.
Equations
- GaudisCrypt.EC.Strong_RP_RF.DBounder D q c Dist = ((GaudisCrypt.EC.Strong_RP_RF.DBounder.distinguish D q c Dist).expression.app (GaudisCrypt.ModuleExpression.var 0)).abs.toModule ⋯
Instances For
Instantiating the holes of DBounder.distinguish.procedure with a tuple holeArgs of procedures: the body of proc distinguish as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [DBounder.distinguish.procedure.apply_simp]).
The body of proc distinguish of module DBounder, as a procedure of its own: the one call it makes to a module parameter (F) is its single hole.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see DBounder.distinguish.procedure.apply_simp) rather than run. Use DBounder.distinguish for this procedure as a module.
Equations
- GaudisCrypt.EC.Strong_RP_RF.DBounder.distinguish.procedure D q c Dist = proc () uses (_hole0 : () → Bool) : Bool { var b : Bool; c <- 0; b <- call _hole0 (); return §b }
Instances For
proc distinguish of module DBounder as a module, abstracted over the module parameters it uses (F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma DBounder.distinguish.apply_simp, which fills the holes of DBounder.distinguish.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DBounder.distinguish to the parameters proc distinguish uses (F) is Module.proc (DBounder.distinguish.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
DBounder(D) touches D's variables and its counter.
DBounder.FBounder touches its counter only.
DBounder.FBounder(O).f is lossless if O.f is (EC: proc; sp; if; wp; call O_f_ll).
DBounder(D) is lossless with O if D is with DBounder.FBounder(O) (EC's
call (D_ll (<: DBounder(D,O).FBounder) _ _) in PartialConclusion).
The section CollisionProbability #
With declare module D <: Distinguisher {-ARP, -DBounder}.
EC's local module FEL(D) (DBounder with EC's invariant built into its oracles) is not
ported: the potential below carries the invariant (see IND_ARP_DBounder_potential).
A uniform draw lands in the range of m with probability at most |dom m| · μ.
The potential of EC's fel 2 in pr_PRFi_collision, on (c, ARP.m, ARP.mi, ARP.coll): 1
once
ARP.coll, the bound still to pay for the queries from c on while |dom ARP.m|, |dom ARP.mi| ≤ c (EC's invariant), ⊤ otherwise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The step of EC's fel 2, at a query x of f from the potential's state
(c, m, mi, coll): the potential does not increase in expectation.
The oracle premise of EC's fel 2 for f: a query of DBounder(ARP).f does not increase
the potential in expectation (collPotential_step, EC's rnd (rng ARP.m) and mu_mem_le).
The oracle premise for fi.
EC's fel 2 FEL.c (fun x, x%r * mu uD (pred1 witness)) q ARP.coll … in pr_PRFi_collision, as
a
supermartingale over the distinguisher (Module.ewp_app_le). The potential is ⊤ off EC's
invariant card (fdom ARP.m) <= c /\\ card (fdom ARP.mi) <= c, so it applies to
IND(ARP, DBounder(D)) directly: EC's two haves through c <= q and the local module FEL
(which restates DBounder with that invariant) are not needed.
EC's lemma pr_PRFi_collision &m, for declare module D <: Distinguisher {-ARP, -DBounder}
(EC's D_ll is not needed; q of either sign, EC's ge0_q not needed either).
PartialConclusion with D's losslessness over a region G containing D and outside the
module variables (exception E14 of the SHA-3 port), G inside the glob of a finitely supported
GF (for the fresh choice of the section Upto's local variable).
EC's lemma PartialConclusion (D <: Distinguisher {-PRPi, -ARP, -DBounder}) &m. The section
Upto's local variable PRP_indirect_bad.bad is chosen fresh (exception E6), outside glob D
too; pr_PRPi'_Indirect_ARP is applied to DBounder(D) at the region glob D ⊔ DBounder.c.
The section PRPi_PRPi'_Indirect #
local clone include Dexcepted.TwoStepSampling with type i <- unit, type t <- D, op dt _ <- uD
is dexcepted_indirect (Lib/EC/Dexcepted.lean).
EC's equiv eq_Direct_Indirect : Direct.sample ~ Indirect.sample : ={X} ==> ={res} (of the
section PRPi_PRPi'_Indirect; here before it, as PRPi' follows), with ={glob} kept (EC's call
rule frames it; uD lossless, EC's dD_ll of the TwoStepSampling clone). The right side's
run is a sampling from uD \ X (dexcepted_indirect), coupled by the identity
(equiv_rnd_run).
The first half of EC's transitivity PRPi'(Direct).f in eq_PRPi_PRPi'_f_Indirect:
PRPi.f ~ PRPi'(Direct).f (EC's proc; inline *; if; auto).
The second half: PRPi'(Direct).f ~ PRPi'(Indirect).f (EC's proc; if; wp; call eq_Direct_Indirect).
eq_PRPi_PRPi'_f_Direct for fi.
EC's local equiv eq_PRPi_PRPi'_f_Indirect : PRPi.f ~ PRPi'(Indirect).f : ={x, PRPi.m, PRPi.mi} ==> ={res, PRPi.m, PRPi.mi}, at equal states (the invariant of the abstract
call below), by EC's transitivity PRPi'(Direct).f (prhlProc.trans).
EC's local equiv eq_PRPi_PRPi'_fi_Indirect, as eq_PRPi_PRPi'_f_Indirect.
The byequiv of EC's pr_PRPi_PRPi'_Indirect: IND(PRPi, D) ~ IND(PRPi'(Indirect), D), by
EC's call (_: ={PRPi.m, PRPi.mi}) (prhlProc_abstract_call_equal_outside_module with I
equality; [Countable D] for the rule, exception E8).
EC's pr_PRPi_PRPi'_Indirect &m, for declare module D <: Distinguisher {-PRPi}.
Conclusion with D's losslessness over a region G containing D and outside the module
variables (exception E14 of the SHA-3 port), G inside the glob of a finitely supported GF.
EC's Conclusion, for D <: Distinguisher {-PRPi, -ARP, -DBounder}, under the theory's
axiom uD_uf_fu (uD uniform, lossless and full). mu uD (pred1 witness) is the probability of
default. The restriction is stated against glob D (exception E7); the module variables are lens
parameters, disjoint and finitely supported (exceptions E6, E8; a clone with global_vars
discharges these); D's representation is a theorem (Distinguisher.ecModule).