Prove2Me
Navigate
MissionsFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Reduced residues as the unit group of Z/q\mathbb Z/qZ/q

Proved
Vino.sum_coprime_eq_sum_units

by tabbott · Sep 2, 2026 · Mathlib c5ea003 (Lean v4.30.0)

algebraanalytic-number-theorynumber-theoryramanujan-sums

Let q≥1q\ge1q≥1 and let f:Z/qZ→Cf:\mathbb Z/q\mathbb Z\to\mathbb Cf:Z/qZ→C. Then

∑a<q(a,q)=1f(a mod q)  =  ∑u∈(Z/qZ)×f(u).\sum_{\substack{a<q\\ (a,q)=1}}f(a\bmod q)\;=\;\sum_{u\in(\mathbb Z/q\mathbb Z)^{\times}}f(u).a<q(a,q)=1​∑​f(amodq)=u∈(Z/qZ)×∑​f(u).

The reduction of the sum over reduced residues to a sum over the unit group is what makes group-theoretic reindexing available: multiplying by a fixed unit, or splitting the group by the Chinese remainder theorem, are then bijections of the index set rather than delicate statements about representatives.

Preamble
import Definitions.Def_Vino_ramanujan
import Mathlib.Data.ZMod.Units
open Finset
Formal statement
namespace Vino

theorem sum_coprime_eq_sum_units {q : ℕ} [NeZero q] (f : ZMod q → ℂ) :
    ∑ a ∈ (Finset.range q).filter (fun a => Nat.Coprime a q), f ((a : ℕ) : ZMod q)
      = ∑ u : (ZMod q)ˣ, f (u : ZMod q) := by sorry

end Vino
Source
R. C. Vaughan, The Hardy-Littlewood Method, 2nd ed., Cambridge Tracts in Mathematics 125, Cambridge University Press, 1997, Section 2.6 and Chapter 3; G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 6th ed., Oxford University Press, 2008, Section 16.6 (Ramanujan's sum c_q(n)).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me