AFTD Auto-Formalizing Theoretical Domains

Schnorr.reindex

defimported Lean

For fixed $w, c \in \mathbb{Z}_q$, define the bijection $\sigma_{w,c} : \mathbb{Z}_q \xrightarrow{\;\sim\;} \mathbb{Z}_q$ by $r \mapsto r + c \cdot w$, with inverse $s \mapsto s - c \cdot w$.

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.reindex (w c : ZMod q) : ZMod q ≃ ZMod q
Defined in
TCSlib, `Schnorr.reindex`
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
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
/-- Reindexing bijection on `ZMod q`: `r ↦ r + c·w`, inverse `s ↦ s - c·w`. -/
def Schnorr.reindex (w c : ZMod q) : ZMod q ≃ ZMod q where
  toFun r := r + c * w
  invFun s := s - c * w
  left_inv := by intro r; ring
  right_inv := by intro s; ring
See it in the graphDiscuss this resultChallenge it