The padded block sponge construction (EasyCrypt proof/BlockSponge.ec) #
The sponge on blocks: absorb a valid block list, squeeze n blocks. Its ideal functionality is
the infinite random oracle BIRO.IRO on valid block lists, and its simulator is the squeezeless
sponge's (Gconcl.S) through Last.
Translation notes (see notes/SHA3/README.md):
clone include Indifferentiability with type p <- block * capacity, type f_in <- block list * int, type f_out <- block list rename … "Indif" as "Experiment" …is the abbreviations below.op parsewith its axiomsformatK,parseK,parse_nilis the parameter classParams(overSLCommon.Params).- A procedure whose EasyCrypt parameters
(bl, nb)are the module type's single parameter (f_in = block list * int) takes that pair,x, and names its components. module Sim (F) = Gconcl.S(Last(F))is the composite functorModule.comp Gconcl.S Last.Last : SLCommon.DFUNCTIONALITYhas, in EasyCrypt, also an emptyinitoutside its type: hereLasthas the type'sfalone, andLast.initis a module of its own.DRestr(D)(F)(P)takesDas a Lean parameter, as inSLCommon.
Indifferentiability: `clone include Indifferentiability with type p <- block * capacity, #
type f_in <- block list * int, type f_out <- block list rename [module] "Indif" as "Experiment" [module] "GReal" as "RealIndif" [module] "GIdeal" as "IdealIndif"`
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
EC's subtyping PRIMITIVE <: DPRIMITIVE (its f, fi).
Equations
- One or more equations did not get rendered due to their size.
EC's subtyping FUNCTIONALITY <: DFUNCTIONALITY (its f).
Equations
- One or more equations did not get rendered due to their size.
The ideal functionality: `clone import IRO as BIRO with type from <- block list, #
type to <- block, op valid <- valid_block, op dto <- bdistr`
op valid <- valid_block, as a test.
Instances For
Equations
Instances For
The clone's module variable BIRO.IRO.mp.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Validity and parsing/formatting of functionality queries #
Equations
Instances For
EasyCrypt's abstract op parse : block list -> (block list * int) with its axioms
formatK, parseK, parse_nil.
- parse : List Common.block → List Common.block × ℤ
Instances
Instances For
Restrictions #
The counter for the functionality counts the number of times the underlying primitive is called inside the functionality: the number of blocks of the input message plus the number of additional blocks the squeezing phase has to output.
EC's C.c.
Equations
- GaudisCrypt.SHA3.BlockSponge.C.c = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.BlockSponge.C.c" ℤ)
Instances For
Instantiating the holes of C.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 [C.init.procedure.apply_simp]).
The body of proc init of module C, 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 C.init.procedure.apply_simp) rather than run. Use C.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.BlockSponge.C.init.procedure = proc () : Unit { GaudisCrypt.SHA3.BlockSponge.C.c <- 0; return () }
Instances For
proc init of module C as a module: Module.proc C.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — C.init.apply_simp says exactly that.
Equations
Instances For
The module declared by module C: the record of its procedures C.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 C.apply_simp to apply it with.
Instances For
@[simp]: C.init = Module.proc C.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of FC.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 [FC.init.procedure.apply_simp]).
@[simp]: FC.init = Module.proc FC.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of FC.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 [FC.f.procedure.apply_simp]).
proc f of module FC 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 FC.f.apply_simp, which fills the holes of FC.f.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc init of module FC as a module: Module.proc FC.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — FC.init.apply_simp says exactly that.
Equations
Instances For
@[simp]: applying FC.f to the parameters proc f uses (F) is Module.proc (FC.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 FC, 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 FC.init.procedure.apply_simp) rather than run. Use FC.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.BlockSponge.FC.init.procedure = proc () : Unit { skip; return () }
Instances For
The body of proc f of module FC, 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 FC.f.procedure.apply_simp) rather than run. Use FC.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying FC to a tuple of its single parameter F — the record of its procedures FC.init, FC.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 FC.init.apply_simp, FC.f.apply_simp to fill that procedure's holes.
The module declared by module FC, 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 FC.init, FC.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FC.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc fi of module PC, 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 PC.fi.procedure.apply_simp) rather than run. Use PC.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: PC.init = Module.proc PC.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of PC.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 [PC.fi.procedure.apply_simp]).
The module declared by module PC, 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 PC.init, PC.f, PC.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma PC.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying PC.f to the parameters proc f uses (P) is Module.proc (PC.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]: applying PC to a tuple of its single parameter P — the record of its procedures PC.init, PC.f, PC.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 PC.init.apply_simp, PC.f.apply_simp, PC.fi.apply_simp to fill that procedure's holes.
Instantiating the holes of PC.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 [PC.init.procedure.apply_simp]).
proc init of module PC as a module: Module.proc PC.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — PC.init.apply_simp says exactly that.
Equations
Instances For
proc fi of module PC 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 PC.fi.apply_simp, which fills the holes of PC.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 init of module PC, 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 PC.init.procedure.apply_simp) rather than run. Use PC.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.BlockSponge.PC.init.procedure = proc () : Unit { skip; return () }
Instances For
The body of proc f of module PC, 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 PC.f.procedure.apply_simp) rather than run. Use PC.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 PC.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 [PC.f.procedure.apply_simp]).
@[simp]: applying PC.fi to the parameters proc fi uses (P) is Module.proc (PC.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.
proc f of module PC 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 PC.f.apply_simp, which fills the holes of PC.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 DRestr.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 [DRestr.distinguish.procedure.apply_simp]).
The module declared by module DRestr, 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 DRestr.distinguish, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DRestr.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc distinguish of module DRestr, as a procedure of its own: the one call it makes to a module parameter (F, 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 DRestr.distinguish.procedure.apply_simp) rather than run. Use DRestr.distinguish for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DRestr.distinguish to the parameters proc distinguish uses (F, P) is Module.proc (DRestr.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.
@[simp]: applying DRestr to a tuple of its 2 parameters F, P — the record of its procedures DRestr.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 DRestr.distinguish.apply_simp to fill that procedure's holes.
proc distinguish of module DRestr as a module, abstracted over the module parameters it uses (F, P, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma DRestr.distinguish.apply_simp, which fills the holes of DRestr.distinguish.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The simulator #
@[simp]: Last.init.init = Module.proc Last.init.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
The body of proc init of module Last.init, 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 Last.init.init.procedure.apply_simp) rather than run. Use Last.init.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.BlockSponge.Last.init.init.procedure = proc () : Unit { skip; return () }
Instances For
proc init of module Last.init as a module: Module.proc Last.init.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Last.init.init.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of Last.init.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 [Last.init.init.procedure.apply_simp]).
The module declared by module Last.init: the record of its procedures Last.init.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 Last.init.apply_simp to apply it with.
Instances For
Instantiating the holes of Last.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 [Last.f.procedure.apply_simp]).
@[simp]: applying Last to a tuple of its single parameter F — the record of its procedures Last.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 Last.f.apply_simp to fill that procedure's holes.
The module declared by module Last, 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 Last.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Last.apply_simp says.
Equations
Instances For
@[simp]: applying Last.f to the parameters proc f uses (F) is Module.proc (Last.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 Last 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 Last.f.apply_simp, which fills the holes of Last.f.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 f of module Last, 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 Last.f.procedure.apply_simp) rather than run. Use Last.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
module (Sim : SIMULATOR) (F : DFUNCTIONALITY) = Gconcl.S(Last(F)).
Equations
Instances For
The sponge construction #
The module declared by module Sponge, 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 Sponge.init, Sponge.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Sponge.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc init of module Sponge as a module: Module.proc Sponge.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Sponge.init.apply_simp says exactly that.
Equations
Instances For
@[simp]: applying Sponge to a tuple of its single parameter P — the record of its procedures Sponge.init, Sponge.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 Sponge.init.apply_simp, Sponge.f.apply_simp to fill that procedure's holes.
@[simp]: applying Sponge.f to the parameters proc f uses (P) is Module.proc (Sponge.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 Sponge 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 Sponge.f.apply_simp, which fills the holes of Sponge.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 Sponge.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 [Sponge.f.procedure.apply_simp]).
The body of proc init of module Sponge, 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 Sponge.init.procedure.apply_simp) rather than run. Use Sponge.init for this procedure as a module.
Equations
- GaudisCrypt.SHA3.BlockSponge.Sponge.init.procedure = proc () : Unit { skip; return () }
Instances For
The body of proc f of module Sponge, 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 Sponge.f.procedure.apply_simp) rather than run. Use Sponge.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 Sponge.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 [Sponge.init.procedure.apply_simp]).
@[simp]: Sponge.init = Module.proc Sponge.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.