The collision event of G1 (EasyCrypt proof/smart_counter/Gcol.eca) — EC-fidelity port #
Pr_G1col bounds the probability of G1.bcol by max_size · (2 max_size / 2^c), through the
local game Gcol that counts the capacity samples. Over the old port's Handle declarations
(as SmartCounter/Handle.lean).
Translation:
- the local module
Gcolis declared here as in EC, its variablecountaglobal_var(Gcol.count); its proceduresGcol.sample_c,Gcol.M,Gcol.Sare modules of their own (EC's inner modules),Gcol Dthe game withDa Lean parameter; declare module D <: DISTINGUISHER {-C, -PF, -G1, -Gcol.sample_c}: EC's freshness of the local module forDinD's restriction (asSecureRO's local modules).
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):
clone export Handle as Handle0clones a theory without parameters: it isHandle, opened.- The local module
Gcolcallssample_cfrom its inner modulesM,S: these are the modulesGcol.sample_c,Gcol.M,Gcol.S, andGcol Dthe game (withDa Lean parameter). - The local module
Gcol's variablecountis the lens parameterGcol_countof the local declarations (Gcol.sample_c,Gcol.M,Gcol.S,Gcol,Pr_col,G1_col), fresh by hypothesis;Pr_G1coldoes not mention it (exception E6). - EasyCrypt's
2^c(anintpower,c > 0) is2 ^ c.toNat;card(anint) is the cardinality cast toℤ.
mu1 cdistr x = 1 / 2^c.
The section PROOF #
EC's Mu_mem.mu_mem for cdistr: a set of capacities has probability card S / 2^c.
A variable's footprint below a join of footprints it is a joinand of (C.footprint
unfolded).
Equations
- GaudisCrypt.SHA3.Gcol.tacticGcol_fp = Lean.ParserDescr.node `GaudisCrypt.SHA3.Gcol.tacticGcol_fp 1024 (Lean.ParserDescr.nonReservedSymbol "gcol_fp" false)
Instances For
Gap list (batch-fix later, see TRANSFER_SKILL.md §1.6):
- (GAP 1, fixed: EC's abstract
call (_: ={…} /\ inv)asks the oracles={arg} /\ inv ==> ={res} /\ inv; so does ours when it names no otherglob,={glob D}framed by the oracles' writes,prhlProc_abstract_call_module_ec.) - GAP 2: inline by name: EC's paths
G1(DRestr(D)).S.fi,Gcol.S.fido not match the old declarations' call sitesDPRIMITIVE.fi G1.S(not definitionally equal at default transparency either): the only call on each side inlined by index. - (GAP 3, fixed:
→between booleans, EC'sG1.bcol{1} => G1.bcol{2}— reads elaborated without the expected type, then coerced.) - GAP 4:
swappast a call that reads (but does not write) what the moved assignment reads: our frame needs the read variables outside the callee's whole footprint (reads and writes together); EC'sswapuses read/write sets. - (GAP 5, fixed:
glob Dthrough anif—touched_getter_get_iteinglob_simp.) - (GAP 6, fixed: EC
while's exit frames —subst_framesdrops symmetric twins.) - (GAP 7, fixed:
equiv_call (_ : ={x})on a concrete callee keeps EC's frame —Logic/ECCallEquiv.lean.) - (GAP 8, fixed:
swapof a call past a deterministicif/sequence of writes —callDetinLogic/StmtSwap.lean.) - (GAP 9, fixed:
fel … [M : pre]over a procedure the oracles call —Logic/FelInner.lean.)
EC's Gcol.count.
Equations
- GaudisCrypt.SHA3.Pilot.Gcol.Gcol.count = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.SHA3.Pilot.Gcol.Gcol.count" ℤ)
Instances For
Instantiating the holes of Gcol.sample_c.sample_c.procedure with a tuple holeArgs of procedures: the body of proc sample_c 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 [Gcol.sample_c.sample_c.procedure.apply_simp]).
proc sample_c of module Gcol.sample_c as a module: Module.proc Gcol.sample_c.sample_c.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Gcol.sample_c.sample_c.apply_simp says exactly that.
Equations
Instances For
@[simp]: Gcol.sample_c.sample_c = Module.proc Gcol.sample_c.sample_c.procedure — true by definition, proc sample_c using no module parameter and so having no holes to fill.
The body of proc sample_c of module Gcol.sample_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 Gcol.sample_c.sample_c.procedure.apply_simp) rather than run. Use Gcol.sample_c.sample_c 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 Gcol.sample_c: the record of its procedures Gcol.sample_c.sample_c.
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 Gcol.sample_c.apply_simp to apply it with.
Equations
Instances For
The body of proc f of module Gcol.M, 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 Gcol.M.f.procedure.apply_simp) rather than run. Use Gcol.M.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: Gcol.M.f = Module.proc Gcol.M.f.procedure — true by definition, proc f using no module parameter and so having no holes to fill.
proc f of module Gcol.M as a module: Module.proc Gcol.M.f.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Gcol.M.f.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of Gcol.M.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 [Gcol.M.f.procedure.apply_simp]).
The module declared by module Gcol.M: the record of its procedures Gcol.M.f.
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 Gcol.M.apply_simp to apply it with.
Instances For
Instantiating the holes of Gcol.S.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 [Gcol.S.f.procedure.apply_simp]).
The body of proc fi of module Gcol.S, 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 Gcol.S.fi.procedure.apply_simp) rather than run. Use Gcol.S.fi for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: Gcol.S.f = Module.proc Gcol.S.f.procedure — true by definition, proc f using no module parameter and so having no holes to fill.
The body of proc f of module Gcol.S, 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 Gcol.S.f.procedure.apply_simp) rather than run. Use Gcol.S.f for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: Gcol.S.fi = Module.proc Gcol.S.fi.procedure — true by definition, proc fi using no module parameter and so having no holes to fill.
The module declared by module Gcol.S: the record of its procedures Gcol.S.f, Gcol.S.fi.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Gcol.S.apply_simp to apply it with.
Equations
Instances For
proc fi of module Gcol.S as a module: Module.proc Gcol.S.fi.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Gcol.S.fi.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of Gcol.S.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 [Gcol.S.fi.procedure.apply_simp]).
proc f of module Gcol.S as a module: Module.proc Gcol.S.f.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Gcol.S.f.apply_simp says exactly that.
Equations
Instances For
@[simp]: Gcol.main = Module.proc Gcol.main.procedure — true by definition, proc main using no module parameter and so having no holes to fill.
The module declared by module Gcol: the record of its procedures Gcol.main.
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 Gcol.apply_simp to apply it with.
Instances For
proc main of module Gcol as a module: Module.proc Gcol.main.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Gcol.main.apply_simp says exactly that.
Equations
Instances For
The body of proc main of module Gcol, 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 Gcol.main.procedure.apply_simp) rather than run. Use Gcol.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 Gcol.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 [Gcol.main.procedure.apply_simp]).
EC's local equiv G1_col : G1(DRestr(D)).main ~ Gcol.main : ={glob D} ==> (G1.bcol{1} => G1.bcol{2}) /\ Gcol.count{2} <= max_size.
EC's local lemma Pr_col &m : Pr[Gcol.main()@&m : G1.bcol /\ Gcol.count <= max_size] <= max_size%r * ((2*max_size)%r / (2^c)%r).
EC's lemma Pr_G1col &m : Pr[G1(DRestr(D)).main() @ &m : G1.bcol] <= max_size%r * ((2*max_size)%r / (2^c)%r).