The Schnorr proof of knowledge is a Sigma protocol (EasyCrypt examples/SchnorrPK.ec) #
EC's file, declaration by declaration and script line by line: completeness (with its losslessness), special soundness and special honest-verifier zero knowledge, all proven.
Translation (as Examples/ElGamal.lean):
clone Group.CyclicGroup as G … clone GP.FDistr as FD. clone GP.ZModE.ZModpField as ZPF.is the section's group (Lib/EC/Group.lean), the field's lemmas Mathlib's.theory SchnorrTypes: its type abbreviations (statement = group,witness = exp, …) are written out in the clone ofSigmaProtocol;R_DLis a proposition.clone import SigmaProtocol as SP with … op R = R_DL, op de = dtisclone import; the theory'sRis opened (EC'sexport SigmaProtocol).- The proofs'
(D <: SigmaTraceDistinguisher)is the binder∀ (D <: SigmaTraceDistinguisher).
Gap list (the examples' infrastructure batch; numbers as in Examples/ElGamal.lean where the
gap is the same):
- GAP 1:
stmt_split_paramsafterinline*(one assignment per parameter, as EC). - GAP 3 (closed 2026-11-15): the path
SimulateHonestVerifier(SchnorrPK, SchnorrPKAlgorithms, D).gameIdealinto a module without a module type that has several module parameters. - GAP 5 (closed 2026-11-15):
byphoare (_: h = x /\ w' = w ==> _)on a clone's game isbyphoare (: §x = h ∧ §w = w' ==> _). - GAP 6: EC's
seq 2 2 : (#pre /\ ={w0}): there is no#pre; the precondition is written out. - The last steps in the group (EC's
algebra, and the eight rewrites of special soundness) are by hand; special soundness finds the witness throughloge, where EC rewrites withexpM,expB,mulcV, ….
theory SchnorrTypes
EC's op R_DL (h : group) (w : exp) = (h = g ^ w).
Equations
Instances For
The body of proc test of module SchnorrPK, 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 SchnorrPK.test.procedure.apply_simp) rather than run. Use SchnorrPK.test for this procedure as a module.
Equations
- GaudisCrypt.Examples.SchnorrPK.SchnorrPK.test.procedure = proc (h : group, a : group) : exp { var e : exp; e <$ GaudisCrypt.EC.CyclicGroup.dt; return §e }
Instances For
Instantiating the holes of SchnorrPK.test.procedure with a tuple holeArgs of procedures: the body of proc test 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 [SchnorrPK.test.procedure.apply_simp]).
proc respond of module SchnorrPK as a module: Module.proc SchnorrPK.respond.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPK.respond.apply_simp says exactly that.
Equations
Instances For
@[simp]: SchnorrPK.test = Module.proc SchnorrPK.test.procedure — true by definition, proc test using no module parameter and so having no holes to fill.
@[simp]: SchnorrPK.commit = Module.proc SchnorrPK.commit.procedure — true by definition, proc commit using no module parameter and so having no holes to fill.
proc test of module SchnorrPK as a module: Module.proc SchnorrPK.test.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPK.test.apply_simp says exactly that.
Equations
Instances For
The body of proc verify of module SchnorrPK, 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 SchnorrPK.verify.procedure.apply_simp) rather than run. Use SchnorrPK.verify for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: SchnorrPK.verify = Module.proc SchnorrPK.verify.procedure — true by definition, proc verify using no module parameter and so having no holes to fill.
The body of proc gen of module SchnorrPK, 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 SchnorrPK.gen.procedure.apply_simp) rather than run. Use SchnorrPK.gen for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc commit of module SchnorrPK, 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 SchnorrPK.commit.procedure.apply_simp) rather than run. Use SchnorrPK.commit for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: SchnorrPK.respond = Module.proc SchnorrPK.respond.procedure — true by definition, proc respond using no module parameter and so having no holes to fill.
proc commit of module SchnorrPK as a module: Module.proc SchnorrPK.commit.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPK.commit.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of SchnorrPK.verify.procedure with a tuple holeArgs of procedures: the body of proc verify 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 [SchnorrPK.verify.procedure.apply_simp]).
The body of proc respond of module SchnorrPK, 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 SchnorrPK.respond.procedure.apply_simp) rather than run. Use SchnorrPK.respond 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 SchnorrPK.respond.procedure with a tuple holeArgs of procedures: the body of proc respond 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 [SchnorrPK.respond.procedure.apply_simp]).
proc gen of module SchnorrPK as a module: Module.proc SchnorrPK.gen.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPK.gen.apply_simp says exactly that.
Equations
Instances For
proc verify of module SchnorrPK as a module: Module.proc SchnorrPK.verify.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPK.verify.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of SchnorrPK.gen.procedure with a tuple holeArgs of procedures: the body of proc gen 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 [SchnorrPK.gen.procedure.apply_simp]).
Instantiating the holes of SchnorrPK.commit.procedure with a tuple holeArgs of procedures: the body of proc commit 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 [SchnorrPK.commit.procedure.apply_simp]).
@[simp]: SchnorrPK.gen = Module.proc SchnorrPK.gen.procedure — true by definition, proc gen using no module parameter and so having no holes to fill.
The module declared by module SchnorrPK: the record of its procedures SchnorrPK.gen, SchnorrPK.commit, SchnorrPK.test, SchnorrPK.respond, SchnorrPK.verify.
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 SchnorrPK.apply_simp to apply it with.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: SchnorrPKAlgorithms.soundness = Module.proc SchnorrPKAlgorithms.soundness.procedure — true by definition, proc soundness using no module parameter and so having no holes to fill.
Instantiating the holes of SchnorrPKAlgorithms.soundness.procedure with a tuple holeArgs of procedures: the body of proc soundness 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 [SchnorrPKAlgorithms.soundness.procedure.apply_simp]).
The body of proc soundness of module SchnorrPKAlgorithms, 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 SchnorrPKAlgorithms.soundness.procedure.apply_simp) rather than run. Use SchnorrPKAlgorithms.soundness 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 SchnorrPKAlgorithms.simulate.procedure with a tuple holeArgs of procedures: the body of proc simulate 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 [SchnorrPKAlgorithms.simulate.procedure.apply_simp]).
The module declared by module SchnorrPKAlgorithms: the record of its procedures SchnorrPKAlgorithms.soundness, SchnorrPKAlgorithms.simulate.
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 SchnorrPKAlgorithms.apply_simp to apply it with.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc simulate of module SchnorrPKAlgorithms as a module: Module.proc SchnorrPKAlgorithms.simulate.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPKAlgorithms.simulate.apply_simp says exactly that.
Equations
Instances For
The body of proc simulate of module SchnorrPKAlgorithms, 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 SchnorrPKAlgorithms.simulate.procedure.apply_simp) rather than run. Use SchnorrPKAlgorithms.simulate for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: SchnorrPKAlgorithms.simulate = Module.proc SchnorrPKAlgorithms.simulate.procedure — true by definition, proc simulate using no module parameter and so having no holes to fill.
proc soundness of module SchnorrPKAlgorithms as a module: Module.proc SchnorrPKAlgorithms.soundness.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SchnorrPKAlgorithms.soundness.apply_simp says exactly that.
Equations
Instances For
EC's lemma schnorr_proof_of_knowledge_completeness_ll: islossless Completeness(SchnorrPK).main.
EC's lemma schnorr_proof_of_knowledge_completeness h w' &m: R h w' => Pr[Completeness(SchnorrPK).main(h, w') @ &m : res] = 1%r.
EC's lemma schnorr_proof_of_knowledge_special_soundness (h: statement) msg (ch ch' r r' : exp) &m: ch <> ch' => g ^ r = msg*(h ^ ch) => g ^ r' = msg*(h ^ ch') => Pr[SpecialSoundnessExperiment(SchnorrPK, SchnorrPKAlgorithms).main(h, msg, ch, r, ch', r') @ &m : (res <> None /\ R h (oget res))] = 1%r.
EC's lemma schnorr_proof_of_knowledge_shvzk (D<: SigmaTraceDistinguisher) &m: Pr[SimulateHonestVerifier(SchnorrPK, SchnorrPKAlgorithms, D).gameIdeal() @ &m : res] = Pr[SimulateHonestVerifier(SchnorrPK, SchnorrPKAlgorithms, D).gameReal() @ &m : res].