Top-level proof of SHA-3 security (EasyCrypt proof/SHA3Security.ec) — EC-fidelity port #
All of SHA3Security.ec: the file's modules, the clone S of IndifRO_is_secure, and the
sections Preimage (Sponge_preimage_resistant), SecondPreimage
(Sponge_second_preimage_resistant), Collision (Sponge_coll_resistant), SHA3_Collision
(SHA3_coll_resistant).
Translation:
- the file-level type
f_out, the operatorssize_out,sigma,dout,to_list,of_listand their axioms are the first port's classSHA3Security.Params;doutE1is the first port's; clone import IndifRO_is_secure as S with …iscloneover the pilotIndifRO_is_secure(Syntax/Clone.lean), itsrealizes the clone'sproof *. The clone's module types (Indiff0.FUNCTIONALITY, …) are the pilot's; the sponge's (CONSTRUCTION,DPRIMITIVE, …) are the first port's, which EC'sSponge,Perm,Simulatorare declared at. A module of a first-port module type is one of the pilot's with the same procedures, by definition (CSetSize(Sponge)is anIndiff0.CONSTRUCTION,PermanIndiff0.PRIMITIVE);CSetSize(F)(P),FSetSize(F)aliasinitandDSetSize(D)(F)(P)isD(DFSetSize(F), P): EC's aliases (proc f = c;, since 2026-11-20; before, wrapped in a call, exception E5);CSetSize'sFandDSetSize'sDare Lean parameters;SimSetSize(S)(F) = S(FGetSize(F))isModule.comp S FGetSize;- the sections' local lemmas about values (
invm_dom_rng,invmC',invmC,useful) are the first port's (SHA3Security.Preimage.*). EC states and proves them, and the localequiv_sponge_perm,equiv_ro_iro, again in each section, word for word: here once, inPreimage, and opened inSecondPreimageandCollision. - EC's theory
Program(Sample,LoopSnoc,Sample_LoopSnoc_eq) is not ported as modules: the first port hasLoopSnoc.sampleand its run (LoopSnoc.sample_denotation). EC's twotransitivitysteps ofequiv_ro_iro, throughSample.sampleand throughLoopSnoc.sample, are one step throughLoopSnoc.sample, with the lemmadout_LoopSnocas its first leg (as in exception E12: a sampling against the call ofLoopSnoc.sample, by the first port's ruleprhlStmt_seq_sample_run_map_right; the only lemma of the file not in EC's script).
Gap list (batch-fix later, see TRANSFER_SKILL.md §1.6):
- GAP 1 (closed 2026-11-17):
inline*opensPerm.fbehind the first port's views. - GAP 2 (closed 2026-11-21): the closers split
={sa, sc}atx <- (sa, sc)into components and did not put the pair's equation back;ec_prepdoes now (pair_ext_hyps). - GAP 3: EC's path
inline FC(Sponge(Perm)).fdoes not elaborate over the first port's views: by index. (FInit(F).getisF.f, EC's alias, since 2026-11-20; before, a call inlined first, exception E5.) EC's lists of procedures to inline in front of an adversary's call arerepeat stmt_inline{i} 0(the calls before the abstract one, by call site). - GAP 4 (closed 2026-11-21): the exit goal of a one-sided
whiledid not frame a variable that only the invariant reads (a conjunct was added to EC's invariant); its frame now has it. - GAP 6: the clone's games apply
CSetSize(Sponge),SimSetSize(Simulator)at the clone's module types, whereinlineand the lemmas stated at the sponge's types do not see them: rewritten right afterprocbyCSetSize_Sponge_Perm_init,CSetSize_Sponge_Perm_f,SimSetSize_init_eq(they hold byrfl). - GAP 7 (closed 2026-11-21): after
spthrough a game's initializations,DPre.handglob Aare equal in the two memories by the memories' equation, which was taken out by hand;ec_progressreads it off now (mem_eq_read). - GAP 8 (closed 2026-11-21):
conseq (: _ ==> Q)in front of the adversary's call did not keepDPre.h, which neither the adversary nor its oracles write (EC's does); its frame now keeps a global across a declared adversary's call by the oracles' writes (Stmt.Keeps.call_app_writes). - GAP 5 (closed 2026-11-21): the strict
autoran out of recursion depth (its closingsimp_all) on a goal with quantified invariant conjuncts over a map being set; a closing attempt that hits a runtime limit now leaves the goal, as EC'sautodoes.
Declarations of the first port #
Definitions and plain lemmas of the first port of this file (2026-10/11) that the proofs below use; its program-logic proofs are gone.
The first port's translation notes (some mention declarations that went with its proofs):
- The file-level abstract type
f_out, operatorssize_out,sigma,dout,to_list,of_listand their axioms are the parameter classParams(asCommon.Params). clone import IndifRO_is_secure as S with …is the namespaceSof abbreviations, opened. The clone declares its module variables (S.SRO.RO.RO.m…); itsrealizes areS.axioms.CSetSize(F)(P),FSetSize(F)aliasinitand are applied to module parameters, asDSetSize(D)(F)(P) = D(DFSetSize(F), P)aliasesdistinguish: EC's aliases (proc f = c;).SimSetSize(S)(F) = S(FGetSize(F))isModule.comp S FGetSize.- The sections' local lemmas, repeated in each section, go into namespaces named after the sections
(
Preimage.invmC…). Theirclone import Program as Prog(Prog2,Prog3) areDList.Programatbool,dbool. declare axiom A_llis the hypothesis_A_ll(S.D_ll).
EasyCrypt's file-level abstract type and operators, with their axioms: op size_out with
size_out_gt0, op sigma with sigma_gt0, type f_out, op dout with dout_ll, dout_fu,
dout_full, op to_list, op of_list with spec_dout, spec2_dout, to_list_inj, to_listK
and dout_equal_dlist.
- size_out : ℤ
- sigma : ℤ
- f_out : Type
- dout : SubProbability f_out
- dout_ll : EC.is_lossless dout
- dout_fu : EC.is_funiform dout
- dout_full : EC.is_full dout
- to_list_inj : Function.Injective to_list
Instances
Instances For
Instances For
Instances For
Instances For
Instances For
The bound of SHA3Indiff, (limit ^ 2 - limit)%r / (2 ^ (r + c + 1))%r + (4 * limit ^ 2)%r / (2 ^ c)%r, the clone's bound.
Instances For
The section's ops same_ro, same_ro2: the map of SRO.RO.RO agrees with that of
BIRO.IRO on the first size_out bits.
Equations
- One or more equations did not get rendered due to their size.
Instances For
of_list inverts to_list on lists of length size_out (spec2_dout, to_listK).
dout is dlist dbool size_out read back by of_list (dout_equal_dlist, to_listK).
The real side of the sections' first have #
GReal(CSetSize(Sponge), Perm, D(A)) against RealIndif(Sponge, Perm, DRestr(DSetSize(D(A)))): the
two games differ in Cntr.c (written on the right only); EC's invariant ={glob SRO.Counter, glob Perm} /\ invm Perm.m{1} Perm.mi{1} /\ ={c}(SRO.Counter, Cntr) is the states equal outside
realL with realI on its contents (the adversary is outside realL).
Sponge has no globals. Not an EC lemma.
The sections' side conditions: adversaries, distinguishers, the simulator #
Simulator touches its maps and Gconcl_list.BIRO2.IRO.mp. Not an EC lemma.
The section Preimage, with declare module A <: SRO.AdvPreimage {…, -DPre} and #
declare axiom A_ll (its local declarations in the namespace Preimage)
clone import Program as Prog with type t <- bool, op d <- dbool.
Equations
Instances For
The section SecondPreimage, with `declare module A <: SRO.AdvSecondPreimage #
{…, -D2Pre}anddeclare axiom A_ll(its local declarations in the namespace
`SecondPreimage`)
clone import Program as Prog2 with type t <- bool, op d <- dbool.
Equations
Instances For
The section Collision, with declare module A <: SRO.AdvCollision {…} and #
declare axiom A_ll (its local declarations in the namespace Collision)
clone import Program as Prog3 with type t <- bool, op d <- dbool.
Equations
Instances For
Instantiating the holes of SHA3.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 [SHA3.init.procedure.apply_simp]).
@[simp]: applying SHA3 to a tuple of its single parameter P — the record of its procedures SHA3.init, SHA3.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 SHA3.init.apply_simp, SHA3.f.apply_simp to fill that procedure's holes.
proc f of module SHA3 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 SHA3.f.apply_simp, which fills the holes of SHA3.f.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module SHA3, abstracted over its single parameter 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 SHA3.init, SHA3.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma SHA3.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: SHA3.init = Module.proc SHA3.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of SHA3.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 [SHA3.f.procedure.apply_simp]).
The body of proc f of module SHA3, 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 SHA3.f.procedure.apply_simp) rather than run. Use SHA3.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 SHA3 as a module: Module.proc SHA3.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SHA3.init.apply_simp says exactly that.
Equations
Instances For
@[simp]: applying SHA3.f to the parameters proc f uses (P) is Module.proc (SHA3.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 SHA3, 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 SHA3.init.procedure.apply_simp) rather than run. Use SHA3.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.Pilot.SHA3Security.SHA3.init.procedure = proc () : Unit { skip; return () }
Instances For
clone import IndifRO_is_secure as S with … (EC l. 80–100) #
The file's modules (EC l. 62–123) #
@[simp]: applying CSetSize to a tuple of its single parameter P — the record of its procedures CSetSize.init, CSetSize.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 CSetSize.init.apply_simp, CSetSize.f.apply_simp to fill that procedure's holes.
proc init = …; of module CSetSize: an alias, EasyCrypt's proc init = M.g — the callee itself, as a module abstracted over the module parameters it uses (P, in declaration order). It has no CSetSize.init.procedure: applied with the @[simp] lemma CSetSize.init.apply_simp, it is the callee.
Equations
Instances For
@[simp]: applying CSetSize.f to the parameters proc f uses (P) is Module.proc (CSetSize.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.
@[simp]: the alias CSetSize.init, applied to the parameters its callee uses (P), is its callee, as written in the declaration.
proc f of module CSetSize 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 CSetSize.f.apply_simp, which fills the holes of CSetSize.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 CSetSize.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 [CSetSize.f.procedure.apply_simp]).
The body of proc f of module CSetSize, 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 CSetSize.f.procedure.apply_simp) rather than run. Use CSetSize.f 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 CSetSize, 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 CSetSize.init, CSetSize.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma CSetSize.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc init = …; of module FSetSize: an alias, EasyCrypt's proc init = M.g — the callee itself, as a module abstracted over the module parameters it uses (F, in declaration order). It has no FSetSize.init.procedure: applied with the @[simp] lemma FSetSize.init.apply_simp, it is the callee.
Equations
Instances For
The module declared by module FSetSize, 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 FSetSize.init, FSetSize.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FSetSize.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 FSetSize, 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 FSetSize.f.procedure.apply_simp) rather than run. Use FSetSize.f 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 FSetSize.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 [FSetSize.f.procedure.apply_simp]).
@[simp]: applying FSetSize to a tuple of its single parameter F — the record of its procedures FSetSize.init, FSetSize.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 FSetSize.init.apply_simp, FSetSize.f.apply_simp to fill that procedure's holes.
@[simp]: applying FSetSize.f to the parameters proc f uses (F) is Module.proc (FSetSize.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.
proc f of module FSetSize 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 FSetSize.f.apply_simp, which fills the holes of FSetSize.f.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: the alias FSetSize.init, applied to the parameters its callee uses (F), is its callee, as written in the declaration.
Instantiating the holes of FGetSize.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 [FGetSize.f.procedure.apply_simp]).
proc f of module FGetSize 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 FGetSize.f.apply_simp, which fills the holes of FGetSize.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 FGetSize to a tuple of its single parameter F — the record of its procedures FGetSize.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 FGetSize.f.apply_simp to fill that procedure's holes.
@[simp]: applying FGetSize.f to the parameters proc f uses (F) is Module.proc (FGetSize.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 FGetSize, 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 FGetSize.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FGetSize.apply_simp says.
Equations
Instances For
The body of proc f of module FGetSize, 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 FGetSize.f.procedure.apply_simp) rather than run. Use FGetSize.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's module SimSetSize (S : SIMULATOR) (F : Indiff0.DFUNCTIONALITY) = S(FGetSize(F)).
Equations
Instances For
Instantiating the holes of DFSetSize.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 [DFSetSize.f.procedure.apply_simp]).
@[simp]: applying DFSetSize.f to the parameters proc f uses (F) is Module.proc (DFSetSize.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 DFSetSize, 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 DFSetSize.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DFSetSize.apply_simp says.
Equations
Instances For
The body of proc f of module DFSetSize, 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 DFSetSize.f.procedure.apply_simp) rather than run. Use DFSetSize.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DFSetSize to a tuple of its single parameter F — the record of its procedures DFSetSize.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 DFSetSize.f.apply_simp to fill that procedure's holes.
proc f of module DFSetSize 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 DFSetSize.f.apply_simp, which fills the holes of DFSetSize.f.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The globals of the file's modules, and the modules under the clone's module types #
EC reads a concrete module's globals off its code, and a module of a sponge module type is one
of the clone's. Here the bounds are stated (@[fp_bound], Module.GlobBound at the clone's
module types: what the clone's lemmas ask), and the modules that the clone's games apply at its
types are the file's by equations that hold by definition (GAP 6).
@[simp]: applying DSetSize to a tuple of its 2 parameters F, P — the record of its procedures DSetSize.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 DSetSize.distinguish.apply_simp to fill that procedure's holes.
proc distinguish = …; of module DSetSize: an alias, EasyCrypt's proc distinguish = M.g — the callee itself, as a module abstracted over the module parameters it uses (F, P, in declaration order). It has no DSetSize.distinguish.procedure: applied with the @[simp] lemma DSetSize.distinguish.apply_simp, it is the callee.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module DSetSize, abstracted over its 2 parameters 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 DSetSize.distinguish, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DSetSize.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: the alias DSetSize.distinguish, applied to the parameters its callee uses (F, P), is its callee, as written in the declaration.
DSetSize(DPre(A)) touches A's variables, SRO.Counter.c, SRO.Bounder.bounder and
DPre.h (EC reads the globals off the code).
DSetSize(D2Pre(A)) touches A's variables, SRO.Counter.c, SRO.Bounder.bounder and
D2Pre.m2 (EC reads the globals off the code).
EC's glob DSetSize(D2Pre(A)): glob A (the region given for A), SRO.Counter.c,
SRO.Bounder.bounder and D2Pre.m2.
DSetSize(DColl(A)) touches A's variables, SRO.Counter.c and SRO.Bounder.bounder (EC
reads the globals off the code).
EC's glob DSetSize(DColl(A)): glob A (the region given for A), SRO.Counter.c and
SRO.Bounder.bounder.
EC's glob DSetSize(DPre(A)): glob A (the region given for A), SRO.Counter.c,
SRO.Bounder.bounder and DPre.h.
CSetSize(Sponge) has no globals (EC reads it off the code), at the clone's module type.
FGetSize has no globals.
Perm touches Perm.m, Perm.mi, at the clone's module type (Perm is an
Indiff0.PRIMITIVE by definition).
SimSetSize(Simulator) touches Simulator's maps and Gconcl_list.BIRO2.IRO.mp (EC reads
it off the code), at the clone's module type.
SimSetSize(Simulator, F).init is Simulator.init: the simulator is the first port's
module, which proc does not open behind the clone's accessor (GAP 6).
CSetSize(Sponge) applied to Perm at the clone's module types (in Indiff0.GReal) is
CSetSize(Sponge, Perm) at the sponge's, by definition: init.
Section Preimage (EC l. 125–475) #
EC's local equiv equiv_sponge_perm c m : FInit(CSetSize(Sponge, Perm)).get ~ FInit(DFSetSize(FC(Sponge(Perm)))).get : ={arg, glob Perm} /\ invm Perm.m{1} Perm.mi{1} /\ Cntr.c{2} = c /\ arg{2} = m /\ (Cntr.c + ((size arg + 1) %/ Common.r + 1) + max ((size_out + Common.r - 1) %/ Common.r - 1) 0 <= limit){2} ==> ={res, glob Perm} /\ invm Perm.m{1} Perm.mi{1} /\ Cntr.c{2} = c + ((size m + 1) %/ Common.r + 1) + max ((size_out + Common.r - 1) %/ Common.r - 1) 0.
(EC's c is c': c is the capacity.)
EC's Sample_LoopSnoc_eq (theory Program) under rnd to_list (fun x => oget (of_list x)):
sampling dout is running LoopSnoc.sample(size_out) and reading the list back. EC's module
Sample is not ported (the first port has LoopSnoc and its run, LoopSnoc.sample_denotation):
EC's two transitivity steps of equiv_ro_iro through Sample.sample and LoopSnoc.sample
are one, with this as its first leg, proved by the first port's rule.
EC's local equiv equiv_ro_iro c m : FInit(RO).get ~ FInit(DFSetSize(FC(BIRO.IRO))).get : ={arg} /\ m = x{2} /\ Cntr.c{2} = c /\ (Cntr.c + ((size arg + 1) %/ Common.r + 1) + max ((size_out + Common.r - 1) %/ Common.r - 1) 0 <= limit){2} /\ same_ro SRO.RO.RO.m{1} BIRO.IRO.mp{2} ==> ={res} /\ same_ro SRO.RO.RO.m{1} BIRO.IRO.mp{2} /\ Cntr.c{2} = c + ((size m + 1) %/ Common.r + 1) + max ((size_out + Common.r - 1) %/ Common.r - 1) 0.
(EC's c is c'.)
EC's lemma Sponge_preimage_resistant &m ha : (DPre.h{m} = ha) => Pr[SRO.Preimage(A, FM(CSetSize(Sponge), Perm)).main(ha) @ &m : res] <= (limit ^ 2 - limit)%r / (2 ^ (r + c + 1))%r + (4 * limit ^ 2)%r / (2 ^ c)%r + (sigma + 1)%r / (2%r ^ size_out).
Section SecondPreimage (EC l. 479–865) #
EC's lemma Sponge_second_preimage_resistant &m mess : (D2Pre.m2{m} = mess) => Pr[SRO.SecondPreimage(A, FM(CSetSize(Sponge), Perm)).main(mess) @ &m : res] <= (limit ^ 2 - limit)%r / (2 ^ (r + c + 1))%r + (4 * limit ^ 2)%r / (2 ^ c)%r + (sigma + 1)%r / (2%r ^ size_out).
Section Collision (EC l. 869–1239) #
EC's lemma Sponge_coll_resistant &m : Pr[SRO.Collision(A, FM(CSetSize(Sponge), Perm)).main() @ &m : res] <= (limit ^ 2 - limit)%r / (2 ^ (r + c + 1))%r + (4 * limit ^ 2)%r / (2 ^ c)%r + (sigma * (sigma - 1) + 2)%r / 2%r / (2%r ^ size_out).
The modules X, AdvCollisionSHA3, and section SHA3_Collision (EC l. 1241–1274) #
The body of proc get of module X, 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 X.get.procedure.apply_simp) rather than run. Use X.get 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 X, 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 X.get, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma X.apply_simp says.
Equations
Instances For
proc get of module X 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 X.get.apply_simp, which fills the holes of X.get.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 X.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 [X.get.procedure.apply_simp]).
@[simp]: applying X.get to the parameters proc get uses (F) is Module.proc (X.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.
@[simp]: applying X to a tuple of its single parameter F — the record of its procedures X.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 X.get.apply_simp to fill that procedure's holes.
The module declared by module AdvCollisionSHA3, 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 AdvCollisionSHA3.guess, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma AdvCollisionSHA3.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of AdvCollisionSHA3.guess.procedure with a tuple holeArgs of procedures: the body of proc guess 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 [AdvCollisionSHA3.guess.procedure.apply_simp]).
proc guess of module AdvCollisionSHA3 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 AdvCollisionSHA3.guess.apply_simp, which fills the holes of AdvCollisionSHA3.guess.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying AdvCollisionSHA3 to a tuple of its single parameter F — the record of its procedures AdvCollisionSHA3.guess, 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 AdvCollisionSHA3.guess.apply_simp to fill that procedure's holes.
The body of proc guess of module AdvCollisionSHA3, 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 AdvCollisionSHA3.guess.procedure.apply_simp) rather than run. Use AdvCollisionSHA3.guess for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying AdvCollisionSHA3.guess to the parameters proc guess uses (F) is Module.proc (AdvCollisionSHA3.guess.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.
AdvCollisionSHA3(A) touches A's variables only (EC reads the globals off the code).
EC's glob AdvCollisionSHA3(A): glob A.
EC's lemma SHA3_coll_resistant &m : Pr[SRO.Collision(AdvCollisionSHA3(A), FM(CSetSize(Sponge), Perm)).main() @ &m : res] <= (limit ^ 2 - limit)%r / (2 ^ (r + c + 1))%r + (4 * limit ^ 2)%r / (2 ^ c)%r + (sigma * (sigma - 1) + 2)%r / 2%r / (2%r ^ size_out).