Security games for hash functions with failing oracles (EasyCrypt proof/SecureHash.eca) — #
EC-fidelity port
Preimage, second-preimage and collision games for a construction F : OCONSTRUCTION over a
primitive P : OPRIMITIVE, against an adversary whose oracle calls are bounded by bound
(FBounder, PBounder). The file has no lemmas: SHA3OSecurity clones it.
Translation (as the pilot SecureRO's):
- the theory's operators and axioms are the class
Params from to block, whose types areoutParams (a clone is an instance), so they are written without types, as in EC; clone import OptionIndifferentiability as OIndif with …isclone(Syntax/Clone.lean);Bounder.bounderis aglobal_var; EC's pathsA(FBounder(F(P)), PBounder(P))are terms, the subtypingOPRIMITIVE <: ODPRIMITIVEa coercion on the arguments;- the games' results
m1 <> m2 /\ exists y, …are decided classically, as EC's logic is; - EC's commented-out
PROM.GenEagerclone and module typeRFare left out.
EC's type from, to, block., op sampleto, op bound, op increase_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
Instances
Equations
- GaudisCrypt.SHA3.Pilot.SecureHash.Bounder.bounder = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.SecureHash.Bounder.bounder" ℤ)
Instances For
proc init of module Bounder as a module: Module.proc Bounder.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Bounder.init.apply_simp says exactly that.
Equations
Instances For
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]).
The body of proc init of module Bounder, 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 Bounder.init.procedure.apply_simp) rather than run. Use Bounder.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.Pilot.SecureHash.Bounder.init.procedure = proc () : Unit { GaudisCrypt.SHA3.Pilot.SecureHash.Bounder.bounder <- 0; return () }
Instances For
@[simp]: Bounder.init = Module.proc Bounder.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
The module declared by module Bounder: the record of its procedures Bounder.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 Bounder.apply_simp to apply it with.
Instances For
Instantiating the holes of 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 [FBounder.f.procedure.apply_simp]).
Instantiating the holes of FBounder.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 [FBounder.init.procedure.apply_simp]).
@[simp]: applying FBounder to a tuple of its single parameter F — the record of its procedures FBounder.init, FBounder.f, 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 FBounder.init.apply_simp, FBounder.f.apply_simp to fill that procedure's holes.
The module declared by module 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 FBounder.init, FBounder.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FBounder.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc f of module 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 FBounder.f.procedure.apply_simp) rather than run. Use FBounder.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 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 FBounder.f.apply_simp, which fills the holes of 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 FBounder.init to the parameters proc init uses (F) is Module.proc (FBounder.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.
proc init of module 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 FBounder.init.apply_simp, which fills the holes of FBounder.init.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 init of module 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 FBounder.init.procedure.apply_simp) rather than run. Use FBounder.init for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying FBounder.f to the parameters proc f uses (F) is Module.proc (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.
Instantiating the holes of PBounder.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 [PBounder.init.procedure.apply_simp]).
proc f of module PBounder as a module, abstracted over the module parameters it uses (P, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma PBounder.f.apply_simp, which fills the holes of PBounder.f.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 PBounder.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 [PBounder.fi.procedure.apply_simp]).
@[simp]: applying PBounder.fi to the parameters proc fi uses (P) is Module.proc (PBounder.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 module declared by module PBounder, abstracted over its single parameter P, 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 PBounder.init, PBounder.f, PBounder.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma PBounder.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc f of module PBounder, as a procedure of its own: the one call it makes to a module parameter (P) 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 PBounder.f.procedure.apply_simp) rather than run. Use PBounder.f 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 PBounder as a module, abstracted over the module parameters it uses (P, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma PBounder.init.apply_simp, which fills the holes of PBounder.init.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 PBounder.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 [PBounder.f.procedure.apply_simp]).
@[simp]: applying PBounder.init to the parameters proc init uses (P) is Module.proc (PBounder.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.
proc fi of module PBounder as a module, abstracted over the module parameters it uses (P, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma PBounder.fi.apply_simp, which fills the holes of PBounder.fi.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 fi of module PBounder, as a procedure of its own: the one call it makes to a module parameter (P) 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 PBounder.fi.procedure.apply_simp) rather than run. Use PBounder.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying PBounder.f to the parameters proc f uses (P) is Module.proc (PBounder.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 body of proc init of module PBounder, as a procedure of its own: the one call it makes to a module parameter (P) 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 PBounder.init.procedure.apply_simp) rather than run. Use PBounder.init for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying PBounder to a tuple of its single parameter P — the record of its procedures PBounder.init, PBounder.f, PBounder.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 PBounder.init.apply_simp, PBounder.f.apply_simp, PBounder.fi.apply_simp to fill that procedure's holes.
EC's module type AdvPreimage (F : ODFUNCTIONALITY) (P : ODPRIMITIVE) = { proc guess(h : to) : from }.
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, P, 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
The body of proc main of module Preimage, as a procedure of its own: the 4 calls it makes to module parameters (A, F, P) 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 3 parameters A, F, P — 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.
The module declared by module Preimage, abstracted over its 3 parameters A, F, P, 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
@[simp]: applying Preimage.main to the parameters proc main uses (A, F, P) 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]).
Second preimage #
EC's module type AdvSecondPreimage (F : ODFUNCTIONALITY) (P : ODPRIMITIVE) = { proc guess(m : from) : from }.
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, P, 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 to a tuple of its 3 parameters A, F, P — 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.
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 module declared by module SecondPreimage, abstracted over its 3 parameters A, F, P, 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
The body of proc main of module SecondPreimage, as a procedure of its own: the 4 calls it makes to module parameters (A, F, P) 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
@[simp]: applying SecondPreimage.main to the parameters proc main uses (A, F, P) 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.
Collision #
EC's module type AdvCollision (F : ODFUNCTIONALITY) (P : ODPRIMITIVE) = { proc guess() : from * from }.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module Collision, abstracted over its 3 parameters A, F, P, 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
The body of proc main of module Collision, as a procedure of its own: the 4 calls it makes to module parameters (A, F, P) 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
@[simp]: applying Collision.main to the parameters proc main uses (A, F, P) 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.
@[simp]: applying Collision to a tuple of its 3 parameters A, F, P — 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, P, 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.