Random oracles are preimage, second-preimage and collision resistant — EC-fidelity port #
(EasyCrypt proof/SecureRO.eca)
The refactor pilot of notes/SHA3/Refactor.md: EC's file transcribed one to one, its
declarations and its proofs EC's (the first port of the file is gone). The facts
EC's smt() finds on maps and bounds are Lib/EC/FMap.lean's and Lib/EC/Mu.lean's.
Translation:
- the theory's operators and axioms are the class
Params from to, whose types areoutParams: the one instance in scope (EC's clone) fixes them, sobound,sampleto, the module typesRF,Oracle,RO_Tare written without types, as in EC; - module variables are
global_vars andmodule_vars (Counter.c,RO.m,D1.m1), found disjoint by instance search;declare module A <: T {-…}is EC's declaration; - EC's paths
M(A, B).fare terms (Syntax/ModuleApplicationSyntax.lean), EC's subtyping of module types coercions (module_subtype), inserted on the arguments (A(Bounder(F))); - the proofs use EC's tactics under prefixed names:
proc,inline*,sim,auto,seq,call (: …),fel,rnd,byequiv,byphoare(notes/SHA3/Refactor.md, phase 2).
type from, to., the operators and their axioms.
EC's op sampleto, op bound, op increase_counter, op bound_counter and their axioms.
The types are outParams: a clone of the theory is an instance.
- sampleto : SubProbability «to»
- bound : ℤ
- sampleto_ll : EC.is_lossless sampleto
- sampleto_full : EC.is_full sampleto
- sampleto_fu : EC.is_funiform sampleto
- bound_counter : ℤ
Instances
clone import PROM.FullRO as RO with type in_t <- from, type out_t <- to, op dout _ <- sampleto, …: its module variable RO.m, and its module RO.
The clone's module variables RO.m, FRO.m (module_var: they take the theory's instance,
whose outParams fix their types).
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.RO.m = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.SecureRO.RO.m" (GaudisCrypt.EC.FMap «from» «to»))
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module types. Their types are the theory's (implicit, fixed by Params's outParams), so
they are written as in EC: RF, Oracle, AdvPreimage.
The module type declared by moduletype RF, with fields init, get: the type Module RF.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with RF.mk, read a single field off one with the accessors RF.init, RF.get, and get the whole record back with RF.structure.
Equations
Instances For
@[simp]: RF.structure (RF.mk r) = r — destructing a module built from a record gives that record back.
What is derivable about the accessor RF.init, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
RF.init.utilities.accessorModule : RF →ₘ …— the accessor as a module, a projection being a module morphism;RF.init.utilities.apply_simp—Module.app RF.init.utilities.accessorModule m = RF.init m: applying that module is the accessor;RF.init.utilities.expression_eq— the same at the level of expressions:(RF.init m).expression = (RF.init.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: reading the field get back off a module built from a record — RF.get (RF.mk r) = r.get.
It is what carries the right-hand side of an X.apply_simp (which is an RF.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.get.apply_simp.
The IsModule RF instance: RF is a module type, with representation RF.typeRep.
It is what lets the name RF stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module RF.typeRep would do on its own but RF, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.instIsModuleRF = { moduleTypeRep := GaudisCrypt.SHA3.Pilot.SecureRO.RF.typeRep, isModule := ⋯ }
What is derivable about the accessor RF.get, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
RF.get.utilities.accessorModule : RF →ₘ …— the accessor as a module, a projection being a module morphism;RF.get.utilities.apply_simp—Module.app RF.get.utilities.accessorModule m = RF.get m: applying that module is the accessor;RF.get.utilities.expression_eq— the same at the level of expressions:(RF.get m).expression = (RF.get.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds a module of type RF from the record RF.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of RF.structure (RF.mk_destruct, RF.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas RF.init.mk_simp, RF.get.mk_simp.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.RF.mk theRecord✝ = GaudisCrypt.Module.pair' theRecord✝.init theRecord✝.get
Instances For
@[simp]: reading the field init back off a module built from a record — RF.init (RF.mk r) = r.init.
It is what carries the right-hand side of an X.apply_simp (which is an RF.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.init.apply_simp.
The record of a module's fields: RF.structure m is RF.Structure.mk applied to RF.init, RF.get of m.
Inverse of RF.mk (RF.mk_destruct, RF.destruct_mk).
Instances For
The field init of a module of type RF: the projection onto component 0 of the right-nested tuple RF.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
RF.init.mk_simp reads this field back off a module built by RF.mk; RF.init.utilities has the accessor as a module, and the lemmas about it.
It takes no parameters (recorded in @[gaudiProcParamNames]).
Equations
- theModule✝.init = GaudisCrypt.Module.fst' theModule✝
Instances For
The record of the fields of a module of type RF: the fields init, get, one per moduletype field, each of that field's own module type.
RF.mk turns such a record into a RF, RF.structure turns a RF back into one.
Instances For
The field get of a module of type RF: the projection onto component 1 of the right-nested tuple RF.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
RF.get.mk_simp reads this field back off a module built by RF.mk; RF.get.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
- theModule✝.get = GaudisCrypt.Module.snd' theModule✝
Instances For
@[simp]: RF.mk (RF.structure m) = m — rebuilding a module from its own fields gives that module back.
The ModuleTypeRep underlying RF, the module type declared by moduletype RF: the right-nested product of its 2 field types, in declaration order.
RF is by definition Module RF.typeRep.
Equations
Instances For
What is derivable about the accessor Oracle.get, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Oracle.get.utilities.accessorModule : Oracle →ₘ …— the accessor as a module, a projection being a module morphism;Oracle.get.utilities.apply_simp—Module.app Oracle.get.utilities.accessorModule m = Oracle.get m: applying that module is the accessor;Oracle.get.utilities.expression_eq— the same at the level of expressions:(Oracle.get m).expression = (Oracle.get.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The IsModule Oracle instance: Oracle is a module type, with representation Oracle.typeRep.
It is what lets the name Oracle stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Oracle.typeRep would do on its own but Oracle, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.instIsModuleOracle = { moduleTypeRep := GaudisCrypt.SHA3.Pilot.SecureRO.Oracle.typeRep, isModule := ⋯ }
@[simp]: reading the field get back off a module built from a record — Oracle.get (Oracle.mk r) = r.get.
It is what carries the right-hand side of an X.apply_simp (which is an Oracle.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.get.apply_simp.
The field get of a module of type Oracle: the projection onto component 0 of the right-nested tuple Oracle.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Oracle.get.mk_simp reads this field back off a module built by Oracle.mk; Oracle.get.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).
Instances For
Builds a module of type Oracle from the record Oracle.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Oracle.structure (Oracle.mk_destruct, Oracle.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Oracle.get.mk_simp.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.Oracle.mk theRecord✝ = theRecord✝.get
Instances For
The ModuleTypeRep underlying Oracle, the module type declared by moduletype Oracle: the right-nested product of its 1 field types, in declaration order.
Oracle is by definition Module Oracle.typeRep.
Equations
Instances For
@[simp]: Oracle.mk (Oracle.structure m) = m — rebuilding a module from its own fields gives that module back.
The record of the fields of a module of type Oracle: the fields get, one per moduletype field, each of that field's own module type.
Oracle.mk turns such a record into a Oracle, Oracle.structure turns a Oracle back into one.
Instances For
The record of a module's fields: Oracle.structure m is Oracle.Structure.mk applied to Oracle.get of m.
Inverse of Oracle.mk (Oracle.mk_destruct, Oracle.destruct_mk).
Instances For
The module type declared by moduletype Oracle, with fields get: the type Module Oracle.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Oracle.mk, read a single field off one with the accessors Oracle.get, and get the whole record back with Oracle.structure.
Equations
Instances For
@[simp]: Oracle.structure (Oracle.mk r) = r — destructing a module built from a record gives that record back.
F.get out of the oracle F.
Instances For
EC's module type AdvPreimage (F : Oracle) = { proc guess(h : to) : from }.
Equations
Instances For
EC's module type AdvSecondPreimage (F : Oracle) = { proc guess(m : from) : from }.
Equations
Instances For
EC's module type AdvCollision (F : Oracle) = { proc guess() : from * from }.
Equations
Instances For
EC's subtyping of module types, as coercions. Each is a fun building the smaller module
in place: the coercion then unfolds to that record, which is what the module command reads a
callee like A(Bounder(F)) back from (a named coercion function it would not see through).
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.instCoeRFOracle = { coe := fun (s : GaudisCrypt.SHA3.Pilot.SecureRO.RF) => GaudisCrypt.SHA3.Pilot.SecureRO.Oracle.mk { get := s.get } }
The random oracle (PROM's RO) is an RF (its init and get).
Equations
- One or more equations did not get rendered due to their size.
The clone's RO.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.RO = GaudisCrypt.EC.PROM.FullRO.RO.asRO «from» «to» (fun (x : «from») => GaudisCrypt.SHA3.Pilot.SecureRO.sampleto) GaudisCrypt.SHA3.Pilot.SecureRO.RO.m
Instances For
The clone's lazy LRO.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.RO.LRO = GaudisCrypt.EC.PROM.FullRO.LRO «from» «to» (fun (x : «from») => GaudisCrypt.SHA3.Pilot.SecureRO.sampleto) GaudisCrypt.SHA3.Pilot.SecureRO.RO.m
Instances For
The clone's FRO.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.FRO = GaudisCrypt.EC.PROM.FullRO.FRO «from» «to» (fun (x : «from») => GaudisCrypt.SHA3.Pilot.SecureRO.sampleto) GaudisCrypt.SHA3.Pilot.SecureRO.FRO.m
Instances For
The clone's RO_LRO_D (PROM.FullRO's, at the clone's dout and module variables, its
dout_ll the theory's sampleto_ll): a distinguisher cannot tell RO from LRO. Its side
conditions, which EC checks itself, are found (ec_module, fp_disjoint).
RO at the module type RF (the coercion, written out where a name is wanted).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.Counter.c = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.SecureRO.Counter.c" ℤ)
Instances For
The body of proc init of module Counter, 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 Counter.init.procedure.apply_simp) rather than run. Use Counter.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.Counter.init.procedure = proc () : Unit { GaudisCrypt.SHA3.Pilot.SecureRO.Counter.c <- 0; return () }
Instances For
@[simp]: Counter.init = Module.proc Counter.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
The module declared by module Counter: the record of its procedures Counter.init.
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 Counter.apply_simp to apply it with.
Instances For
proc init of module Counter as a module: Module.proc Counter.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Counter.init.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of Counter.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 [Counter.init.procedure.apply_simp]).
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.Bounder.bounder = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.SecureRO.Bounder.bounder" ℤ)
Instances For
@[simp]: applying Bounder.init to the parameters proc init uses (F) is Module.proc (Bounder.init.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 Bounder.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 [Bounder.init.procedure.apply_simp]).
@[simp]: applying Bounder to a tuple of its single parameter F — the record of its procedures Bounder.init, Bounder.get, 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 Bounder.init.apply_simp, Bounder.get.apply_simp to fill that procedure's holes.
proc init of module Bounder 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 Bounder.init.apply_simp, which fills the holes of Bounder.init.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc get of module Bounder 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 Bounder.get.apply_simp, which fills the holes of Bounder.get.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Bounder.get to the parameters proc get uses (F) is Module.proc (Bounder.get.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 Bounder, 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 Bounder.init.procedure.apply_simp) rather than run. Use Bounder.init 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 Bounder.get.procedure with a tuple holeArgs of procedures: the body of proc get 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 [Bounder.get.procedure.apply_simp]).
The module declared by module Bounder, 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 Bounder.init, Bounder.get, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Bounder.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc get of module Bounder, 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 Bounder.get.procedure.apply_simp) rather than run. Use Bounder.get 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 main of module Preimage, as a procedure of its own: the 3 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 Preimage.main.procedure.apply_simp) rather than run. Use Preimage.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Preimage to a tuple of its 2 parameters A, F — the record of its procedures Preimage.main, 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 Preimage.main.apply_simp to fill that procedure's holes.
@[simp]: applying Preimage.main to the parameters proc main uses (A, F) is Module.proc (Preimage.main.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 Preimage.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [Preimage.main.procedure.apply_simp]).
The module declared by module Preimage, abstracted over its 2 parameters A, 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 Preimage.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Preimage.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module Preimage as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma Preimage.main.apply_simp, which fills the holes of Preimage.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module FEL as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma FEL.main.apply_simp, which fills the holes of FEL.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying FEL.main to the parameters proc main uses (A, F) is Module.proc (FEL.main.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 main of module FEL, as a procedure of its own: the 2 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 FEL.main.procedure.apply_simp) rather than run. Use FEL.main 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 FEL.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [FEL.main.procedure.apply_simp]).
The module declared by module FEL, abstracted over its 2 parameters A, 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 FEL.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FEL.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying FEL to a tuple of its 2 parameters A, F — the record of its procedures FEL.main, 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 FEL.main.apply_simp to fill that procedure's holes.
The body of proc main of module Preimage2, as a procedure of its own: the 2 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 Preimage2.main.procedure.apply_simp) rather than run. Use Preimage2.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module Preimage2, abstracted over its 2 parameters A, 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 Preimage2.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Preimage2.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Preimage2.main to the parameters proc main uses (A, F) is Module.proc (Preimage2.main.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 Preimage2.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [Preimage2.main.procedure.apply_simp]).
proc main of module Preimage2 as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma Preimage2.main.apply_simp, which fills the holes of Preimage2.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Preimage2 to a tuple of its 2 parameters A, F — the record of its procedures Preimage2.main, 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 Preimage2.main.apply_simp to fill that procedure's holes.
The proof of RO_is_preimage_resistant #
One proof, as EC's: EC's fel is the tactic fel (Logic/FelTactic.lean), EC's inline
specifications call (: P ==> Q) and byphoare (: P ==> _) are Logic/CallSpec.lean's.
EC's RO_is_preimage_resistant &m (h : to), its proof EC's: the have->: by byequiv
(here a calc step), then byphoare(: arg = h ==> _), proc, seq 1, its first E goal
EC's call(: true ==> rng RO.m h) with EC's fel, and the arithmetic of EC's last smt() in
the bound goal. The oracle's bullets are EC's proc; inline*; auto, then the logic EC leaves
to smt(), its FMap facts Lib/EC/FMap.lean's.
The section SecondPreimage #
The module declared by module SecondPreimage, abstracted over its 2 parameters A, 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 SecondPreimage.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma SecondPreimage.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying SecondPreimage to a tuple of its 2 parameters A, F — the record of its procedures SecondPreimage.main, 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 SecondPreimage.main.apply_simp to fill that procedure's holes.
The body of proc main of module SecondPreimage, as a procedure of its own: the 3 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 SecondPreimage.main.procedure.apply_simp) rather than run. Use SecondPreimage.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module SecondPreimage as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma SecondPreimage.main.apply_simp, which fills the holes of SecondPreimage.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying SecondPreimage.main to the parameters proc main uses (A, F) is Module.proc (SecondPreimage.main.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 SecondPreimage.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [SecondPreimage.main.procedure.apply_simp]).
The section SecondPreimage, with `declare module A <: AdvSecondPreimage {-Bounder, -RO, #
-FRO}(its local modules in the namespaceSecondPreimage`)
proc main of module FEL as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma FEL.main.apply_simp, which fills the holes of FEL.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc main of module FEL, as a procedure of its own: the 3 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 FEL.main.procedure.apply_simp) rather than run. Use FEL.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module FEL, abstracted over its 2 parameters A, 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 FEL.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FEL.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying FEL.main to the parameters proc main uses (A, F) is Module.proc (FEL.main.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 FEL.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [FEL.main.procedure.apply_simp]).
@[simp]: applying FEL to a tuple of its 2 parameters A, F — the record of its procedures FEL.main, 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 FEL.main.apply_simp to fill that procedure's holes.
EC's module variables SecondPreimage2.m2, D1.m1 of the local modules. The declared
adversary is restricted against the local modules, as EC's local modules are fresh.
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.SecondPreimage.SecondPreimage2.m2 = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.SecureRO.SecondPreimage.SecondPreimage2.m2" «from»)
Instances For
Equations
- GaudisCrypt.SHA3.Pilot.SecureRO.SecondPreimage.D1.m1 = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.SecureRO.SecondPreimage.D1.m1" «from»)
Instances For
Instantiating the holes of SecondPreimage2.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [SecondPreimage2.main.procedure.apply_simp]).
The body of proc main of module SecondPreimage2, as a procedure of its own: the 2 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 SecondPreimage2.main.procedure.apply_simp) rather than run. Use SecondPreimage2.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module SecondPreimage2 as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma SecondPreimage2.main.apply_simp, which fills the holes of SecondPreimage2.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying SecondPreimage2 to a tuple of its 2 parameters A, F — the record of its procedures SecondPreimage2.main, 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 SecondPreimage2.main.apply_simp to fill that procedure's holes.
The module declared by module SecondPreimage2, abstracted over its 2 parameters A, 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 SecondPreimage2.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma SecondPreimage2.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying SecondPreimage2.main to the parameters proc main uses (A, F) is Module.proc (SecondPreimage2.main.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 D1.distinguish to the parameters proc distinguish uses (F) is Module.proc (D1.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.
The body of proc distinguish of module D1, 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 D1.distinguish.procedure.apply_simp) rather than run. Use D1.distinguish 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 D1.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 [D1.distinguish.procedure.apply_simp]).
The module declared by module D1, 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 D1.distinguish, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma D1.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying D1 to a tuple of its single parameter F — the record of its procedures D1.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 D1.distinguish.apply_simp to fill that procedure's holes.
proc distinguish of module D1 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 D1.distinguish.apply_simp, which fills the holes of D1.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 SecondPreimage3 to a tuple of its single parameter F — the record of its procedures SecondPreimage3.main, 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 SecondPreimage3.main.apply_simp to fill that procedure's holes.
The body of proc main of module SecondPreimage3, as a procedure of its own: the 2 calls it makes to module parameters (F) are its holes, in the order the body makes them.
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 SecondPreimage3.main.procedure.apply_simp) rather than run. Use SecondPreimage3.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying SecondPreimage3.main to the parameters proc main uses (F) is Module.proc (SecondPreimage3.main.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 SecondPreimage3, 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 SecondPreimage3.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma SecondPreimage3.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of SecondPreimage3.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [SecondPreimage3.main.procedure.apply_simp]).
proc main of module SecondPreimage3 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 SecondPreimage3.main.apply_simp, which fills the holes of SecondPreimage3.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's RO_is_second_preimage_resistant &m (mess1 : from), its proof EC's: the chain of
have->: (calc steps) from RO to LRO, to SecondPreimage2, SecondPreimage3 and back to
RO (the third and fifth EC's sims, with the local modules' variables as the frame), then
byphoare(: arg = mess1 ==> _), proc, seq 1, its invariant EC's
call(: … /\ mess1 \in RO.m) and its first E goal EC's call(: arg = mess1 ==> rng (rem RO.m mess1) (oget RO.m.[mess1])) with EC's fel 2, and the arithmetic of EC's last smt() in the
bound goal.
The body of proc main of module Collision, as a procedure of its own: the 3 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 Collision.main.procedure.apply_simp) rather than run. Use Collision.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module Collision, abstracted over its 2 parameters A, 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 Collision.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Collision.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Collision to a tuple of its 2 parameters A, F — the record of its procedures Collision.main, 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 Collision.main.apply_simp to fill that procedure's holes.
Instantiating the holes of Collision.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [Collision.main.procedure.apply_simp]).
proc main of module Collision as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma Collision.main.apply_simp, which fills the holes of Collision.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Collision.main to the parameters proc main uses (A, F) is Module.proc (Collision.main.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 section Collision, with declare module A <: AdvCollision {-RO, -FRO, -Bounder} (its #
local modules in the namespace Collision)
The module declared by module FEL, abstracted over its 2 parameters A, 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 FEL.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FEL.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module FEL as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma FEL.main.apply_simp, which fills the holes of FEL.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc main of module FEL, as a procedure of its own: the 2 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 FEL.main.procedure.apply_simp) rather than run. Use FEL.main 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 FEL.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [FEL.main.procedure.apply_simp]).
@[simp]: applying FEL.main to the parameters proc main uses (A, F) is Module.proc (FEL.main.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 FEL to a tuple of its 2 parameters A, F — the record of its procedures FEL.main, 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 FEL.main.apply_simp to fill that procedure's holes.
proc main of module Collision2 as a module, abstracted over the module parameters it uses (A, F, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma Collision2.main.apply_simp, which fills the holes of Collision2.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Collision2 to a tuple of its 2 parameters A, F — the record of its procedures Collision2.main, 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 Collision2.main.apply_simp to fill that procedure's holes.
Instantiating the holes of Collision2.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [Collision2.main.procedure.apply_simp]).
The body of proc main of module Collision2, as a procedure of its own: the 2 calls it makes to module parameters (A, F) are its holes, in the order the body makes them.
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 Collision2.main.procedure.apply_simp) rather than run. Use Collision2.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module Collision2, abstracted over its 2 parameters A, 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 Collision2.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Collision2.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying Collision2.main to the parameters proc main uses (A, F) is Module.proc (Collision2.main.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.
EC's RO_is_collision_resistant &m, its proof EC's: the have->: by byequiv (a calc
step), then byphoare, proc, seq 1, its first E
goal EC's call(: true ==> collision RO.m) with EC's fel, and the arithmetic of EC's last
smt() in the bound goal.