AFTD Auto-Formalizing Theoretical Domains

power_residue_char

def

For natural numbers p and r and units g and x of (ZMod p)ˣ, power_residue_char p r g x is defined as the discrete logarithm discrete_log g x reduced modulo r in ZMod r.

Statement

noncomputable def power_residue_char (p r : ℕ) (g x : (ZMod p)ˣ) : ZMod r
Defined in
arXiv:2611.22205 Section 3
Verified
20 Nov 2026
Axioms
none listed
Built on 1
  • discrete_logFor an element x and base g in a monoid M, discrete_log g x is the minimal natural number m such that g ^ m = x, or 0 if no such m exists.

Read back from the Lean

The function power_residue_char takes natural numbers p and r, and units g and x of ZMod p, and returns an element of ZMod r defined as the discrete logarithm of x with base g coerced to ZMod r. Specifically, if there exists a natural number m such that g^m = x, it returns the least such m modulo r; if no such m exists, it returns 0 modulo r.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Power-residue character χ(x) = ind_g(x) mod r on units modulo p. -/
noncomputable def power_residue_char (p r : ℕ) (g x : (ZMod p)ˣ) : ZMod r := (discrete_log g x : ZMod r)
See it in the graphDiscuss this resultChallenge it