AFTD Auto-Formalizing Theoretical Domains

Schnorr.simulate

defimported Lean

The zero-knowledge simulator, given public key $\mathit{pk}$, challenge $c$, and a fresh response $s$, outputs the transcript $(g^s \cdot (\mathit{pk}^c)^{-1},\; c,\; s)$. The commitment is chosen so that the transcript is accepting without using the witness.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
variable {G : Type*} [CommGroup G] in
variable {q : ℕ} [Fact q.Prime] in
variable (g : G) in
def Schnorr.simulate (pk : G) (c s : ZMod q) : Transcript G q
Defined in
TCSlib, `Schnorr.simulate`
Lean proof
By Hydroxyi (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Built on 1
  • Schnorr.TranscriptA Schnorr transcript is a triple $(a, c, s) \in G \times \mathbb{Z}_q \times \mathbb{Z}_q$, where $a$ is the prover's commitment (an…
Used by 1
  • Schnorr.schnorr_hvzkHonest-verifier zero knowledge of the Schnorr protocol. Let $G$ be a commutative group, let $q$ be prime, and let $g \in G$ be an element…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
variable {G : Type*} [CommGroup G] in
variable {q : ℕ} [Fact q.Prime] in
variable (g : G) in
/-- Simulator transcript for challenge `c` and fresh response `s`, setting `a := g^s · (pk^c)⁻¹`. Does not use the witness. -/
def Schnorr.simulate (pk : G) (c s : ZMod q) : Transcript G q :=
  (g ^ s.val * (pk ^ c.val)⁻¹, c, s)
See it in the graphDiscuss this resultChallenge it