Definitions/Def_NumberTheory_DedekindSum.lean
Dedekind sums and the rational sawtooth function
Two root-level definitions over \mathbb{Q} are made here. First, dedekindSaw : ℚ → ℚ is the sawtooth function ((x)): it is 0 when Int.fract x = 0, that is when x is an integer, and \operatorname{fract}(x) - \tfrac12 = x - \lfloor x\rfloor - \tfrac12 otherwise. The accompanying lemmas record the basic properties in this spelling: the two unfolding rules according to whether the fractional part vanishes; vanishing at integer and natural-number arguments and in particular at 0 and 1; vanishing at 1/2; invariance under translation by an integer or a natural number, on either side; oddness, ((-x)) = -((x)); the strict bound |((x))| < \tfrac12 (note that this holds also at integers, where the value is 0); and the evaluation ((r/k)) = r/k - \tfrac12 for natural numbers 0 < r < k.
Second, dedekindSum h k is defined for h \in \mathbb{Z} and k \in \mathbb{N} as the finite sum
s(h,k) = \sum_{r=0}^{k-1} \left(\!\left(\frac{r}{k}\right)\!\right)\left(\!\left(\frac{hr}{k}\right)\!\right),
the index r running over Finset.range k. No coprimality condition on h and k is built into the definition, the first argument is an arbitrary integer, and k = 0 gives the empty sum. The lemmas proved here are the elementary ones: s(h,0) = 0, s(h,1) = 0 and s(0,k) = 0; oddness in the first argument, s(-h,k) = -s(h,k); periodicity s(h + mk, k) = s(h,k) for every m \in \mathbb{Z}; and the normal form
s(h,k) = \sum_{r=1}^{k-1}\left(\frac{r}{k} - \frac12\right)\left(\!\left(\frac{hr}{k}\right)\!\right),
in which the vanishing r = 0 term has been dropped and the first sawtooth factor evaluated. Everything is purely algebraic over \mathbb{Q}; no analysis enters.
Relation to Mathlib
Mathlib has no sawtooth function or Dedekind sums; these are the project's own definitions, phrased in terms of Mathlib's Int.fract on \mathbb{Q}.
Where it is used
This module provides the definitions on which the further properties of Dedekind sums proved in the modules importing it rest — the reciprocity law for coprime positive arguments, the integrality of 6k\,s(h,k), the closed form for s(1,k), and invariance under replacing h by an inverse modulo k.
References
- H. Rademacher and E. Grosswald, Dedekind Sums, Carus Mathematical Monographs 16, Mathematical Association of America, 1972
- T. M. Apostol, Modular Functions and Dirichlet Series in Number Theory, Graduate Texts in Mathematics 41, Springer, 1976, Chapter 3
References are suggested automatically and have not been individually verified.
English text generated automatically from the Lean source; the Lean statement is authoritative.
- 115 lines
- 21 declarations
- used in the statements of 28 theorems and imported by 31 proofs
- imports 0 definition modules
Source file: Definitions/Def_NumberTheory_DedekindSum.lean
Declarations
- def
dedekindSaw - theorem
dedekindSaw_of_fract_eq_zero - theorem
dedekindSaw_of_fract_ne_zero - theorem
dedekindSaw_intCast - theorem
dedekindSaw_natCast - theorem
dedekindSaw_zero - theorem
dedekindSaw_one - theorem
dedekindSaw_add_intCast - theorem
dedekindSaw_intCast_add - theorem
dedekindSaw_add_natCast - theorem
dedekindSaw_neg - theorem
abs_dedekindSaw_lt_half - theorem
dedekindSaw_half - theorem
dedekindSaw_natCast_div - def
dedekindSum - theorem
dedekindSum_zero_right - theorem
dedekindSum_one_right - theorem
dedekindSum_zero_left - theorem
dedekindSum_neg - theorem
dedekindSum_add_mul - theorem
dedekindSum_eq_sum_Ico
Source
import Mathlib.Data.Rat.Floor ↗ import Mathlib.Algebra.BigOperators.Group.Finset.Basic ↗ import Mathlib.Algebra.Order.BigOperators.Group.LocallyFinite ↗ import Mathlib.Order.Interval.Finset.Nat ↗ import Mathlib.Tactic.FieldSimp ↗ import Mathlib.Tactic.Ring ↗ import Mathlib.Tactic.Linarith ↗ set_option autoImplicit false def dedekindSaw (x : ℚ) : ℚ := if Int.fract x = 0 then 0 else Int.fract x - 1 / 2 theorem dedekindSaw_of_fract_eq_zero {x : ℚ} (h : Int.fract x = 0) : dedekindSaw x = 0 := if_pos h theorem dedekindSaw_of_fract_ne_zero {x : ℚ} (h : Int.fract x ≠ 0) : dedekindSaw x = Int.fract x - 1 / 2 := if_neg h theorem dedekindSaw_intCast (n : ℤ) : dedekindSaw (n : ℚ) = 0 := dedekindSaw_of_fract_eq_zero (Int.fract_intCast n) theorem dedekindSaw_natCast (n : ℕ) : dedekindSaw (n : ℚ) = 0 := by rw [← Int.cast_natCast]; exact dedekindSaw_intCast (n : ℤ) theorem dedekindSaw_zero : dedekindSaw 0 = 0 := by rw [← Int.cast_zero]; exact dedekindSaw_intCast 0 theorem dedekindSaw_one : dedekindSaw 1 = 0 := by rw [← Int.cast_one]; exact dedekindSaw_intCast 1 theorem dedekindSaw_add_intCast (x : ℚ) (n : ℤ) : dedekindSaw (x + n) = dedekindSaw x := by unfold dedekindSaw rw [Int.fract_add_intCast] theorem dedekindSaw_intCast_add (n : ℤ) (x : ℚ) : dedekindSaw ((n : ℚ) + x) = dedekindSaw x := by rw [add_comm, dedekindSaw_add_intCast] theorem dedekindSaw_add_natCast (x : ℚ) (n : ℕ) : dedekindSaw (x + n) = dedekindSaw x := by rw [← Int.cast_natCast]; exact dedekindSaw_add_intCast x (n : ℤ) theorem dedekindSaw_neg (x : ℚ) : dedekindSaw (-x) = -dedekindSaw x := by unfold dedekindSaw by_cases h : Int.fract x = 0 · rw [if_pos h, if_pos (Int.fract_neg_eq_zero.2 h), neg_zero] · rw [if_neg h, if_neg fun h' => h (Int.fract_neg_eq_zero.1 h'), Int.fract_neg h] ring theorem abs_dedekindSaw_lt_half (x : ℚ) : |dedekindSaw x| < 1 / 2 := by unfold dedekindSaw by_cases h : Int.fract x = 0 · rw [if_pos h, abs_zero] exact one_half_pos · have h0 : 0 < Int.fract x := lt_of_le_of_ne (Int.fract_nonneg x) (Ne.symm h) have h1 : Int.fract x < 1 := Int.fract_lt_one x rw [if_neg h, abs_lt] constructor <;> linarith theorem dedekindSaw_half : dedekindSaw (1 / 2) = 0 := by have hfr : Int.fract (1 / 2 : ℚ) = 1 / 2 := Int.fract_eq_self.2 ⟨one_half_pos.le, one_half_lt_one⟩ rw [dedekindSaw_of_fract_ne_zero (by rw [hfr]; exact one_half_pos.ne'), hfr, sub_self] theorem dedekindSaw_natCast_div {r k : ℕ} (h0 : 0 < r) (hrk : r < k) : dedekindSaw ((r : ℚ) / k) = (r : ℚ) / k - 1 / 2 := by have hk : (0 : ℚ) < k := by exact_mod_cast h0.trans hrk have hpos : (0 : ℚ) < (r : ℚ) / k := div_pos (by exact_mod_cast h0) hk have hlt : (r : ℚ) / k < 1 := (div_lt_one hk).2 (by exact_mod_cast hrk) have hfr : Int.fract ((r : ℚ) / k) = (r : ℚ) / k := Int.fract_eq_self.2 ⟨hpos.le, hlt⟩ rw [dedekindSaw_of_fract_ne_zero (by rw [hfr]; exact hpos.ne'), hfr] def dedekindSum (h : ℤ) (k : ℕ) : ℚ := ∑ r ∈ Finset.range k, dedekindSaw ((r : ℚ) / k) * dedekindSaw ((h : ℚ) * r / k) theorem dedekindSum_zero_right (h : ℤ) : dedekindSum h 0 = 0 := by simp [dedekindSum] theorem dedekindSum_one_right (h : ℤ) : dedekindSum h 1 = 0 := by simp [dedekindSum, dedekindSaw_zero] theorem dedekindSum_zero_left (k : ℕ) : dedekindSum 0 k = 0 := by simp [dedekindSum, dedekindSaw_zero] theorem dedekindSum_neg (h : ℤ) (k : ℕ) : dedekindSum (-h) k = -dedekindSum h k := by unfold dedekindSum rw [← Finset.sum_neg_distrib] refine Finset.sum_congr rfl fun r _ => ?_ rw [Int.cast_neg, neg_mul, neg_div, dedekindSaw_neg] ring theorem dedekindSum_add_mul (h m : ℤ) (k : ℕ) : dedekindSum (h + m * k) k = dedekindSum h k := by rcases Nat.eq_zero_or_pos k with rfl | hk · rw [dedekindSum_zero_right, dedekindSum_zero_right] unfold dedekindSum refine Finset.sum_congr rfl fun r _ => ?_ have hk0 : (k : ℚ) ≠ 0 := Nat.cast_ne_zero.2 hk.ne' have key : ((h + m * k : ℤ) : ℚ) * r / k = (h : ℚ) * r / k + ((m * r : ℤ) : ℚ) := by push_cast field_simp rw [key, dedekindSaw_add_intCast] theorem dedekindSum_eq_sum_Ico (h : ℤ) (k : ℕ) : dedekindSum h k = ∑ r ∈ Finset.Ico 1 k, ((r : ℚ) / k - 1 / 2) * dedekindSaw ((h : ℚ) * r / k) := by rcases Nat.eq_zero_or_pos k with rfl | hk · rw [dedekindSum_zero_right] simp unfold dedekindSum rw [Finset.range_eq_Ico, Finset.sum_eq_sum_Ico_succ_bot hk, zero_add] simp only [Nat.cast_zero, zero_div, dedekindSaw_zero, zero_mul, zero_add] refine Finset.sum_congr rfl fun r hr => ?_ obtain ⟨h1, h2⟩ := Finset.mem_Ico.1 hr rw [dedekindSaw_natCast_div h1 h2]
Statements phrased using this module (28)
- Γ₀(ℓ)-invariance of the sharp eta quotient
ModularCurve.sharpUnitInvariant6 below · depth 14 - `SharpUnitNecessary` at primes ℓnot≡ 1 (mod 12)
ModularCurve.sharpUnitNecessary_of_prime16 below · depth 15 - Dedekind's η transformation law for c>0
ModularForm.eta_specialLinearGroup_smul4 below · depth 15 - Rademacher's congruence for Φ at level ℓ
rademacher_phi_level_congruence0 below · depth 15 - Sharp unit necessity at levels ℓ ≡ 13 (mod 60)
ModularCurve.sharpUnitNecessary_of_mod_sixty_eq_thirteen10 below · depth 16 - Necessity of n∣ m at levels ℓ≡ 37(mod 60)
ModularCurve.sharpUnitNecessary_of_mod_sixty_eq_thirtySeven10 below · depth 16 - Eta-quotient necessity for all levels ℓ≡ 11 (mod 12)
ModularCurve.sharpUnitNecessary_of_mod_twelve_eq_eleven10 below · depth 16 - W-η necessity for levels ℓ ≡ 5 (mod 12)
ModularCurve.sharpUnitNecessary_of_mod_twelve_eq_five10 below · depth 16 - Eta-unit necessity for all levels ℓ≡ 7(mod 12)
ModularCurve.sharpUnitNecessary_of_mod_twelve_eq_seven10 below · depth 16 - Divisibility by the Eisenstein numerator from one Γ₀(ℓ) witness
ModularCurve.sharpUnitNecessary_of_witness8 below · depth 16 - Dedekind's η transformation law in logarithmic form
ModularForm.logEta_specialLinearGroup_smul7 below · depth 16 - Dedekind-sum phase identity at levels ≡ 109 (mod 120)
rademacher_phi_level_witness_mod_oneTwenty_eq_oneHundredNine3 below · depth 16 - Dedekind-sum phase witness at levels ≡ 61 (mod 120)
rademacher_phi_level_witness_mod_oneTwenty_eq_sixtyOne4 below · depth 16 - Rademacher's Φ under an ST^q-step
rademacher_phi_step0 below · depth 16 - Eisenstein numerator divides m z₀ for eta-quotient roots
ModularCurve.eisensteinNumerator_dvd_mul_of_witness8 below · depth 17 - Dedekind's reciprocity law for s(h,k)+s(k,h)
dedekindSum_add_dedekindSum0 below · depth 17 - Dedekind's congruence modulo 8 for 12k s(h,k)
dedekindSum_jacobiSym_mod_eight2 below · depth 17 - Oddness of the Dedekind sum: s(k-1,k)=-s(1,k)
dedekindSum_natCast_sub_one0 below · depth 17 - Invariance of s(h,k) under inversion modulo k
dedekindSum_of_mul_modEq_one0 below · depth 17 - Closed form s(1,k)=(k-1)(k-2)/(12k)
dedekindSum_one_left0 below · depth 17 - Dedekind-sum witness for levels ℓ ≡ 11 (mod 12)
rademacher_phi_level_witness_eleven0 below · depth 17 - Rademacher Φ witness for ℓ≡ 5(mod 12)
rademacher_phi_level_witness_five0 below · depth 17 - A Dedekind-sum phase identity at levels ≡ 49 (mod 120)
rademacher_phi_level_witness_mod_oneTwenty_eq_fortyNine3 below · depth 17 - Dedekind-sum witness identity at levels ≡ 1 (mod 120)
rademacher_phi_level_witness_mod_oneTwenty_eq_one2 below · depth 17 - Rademacher Φ witness for ℓ≡ 13(mod 60)
rademacher_phi_level_witness_mod_sixty_eq_thirteen0 below · depth 17 - Dedekind-sum level witness for ℓ ≡ 37 (mod 60)
rademacher_phi_level_witness_mod_sixty_eq_thirtySeven0 below · depth 17 - Dedekind-sum witness for levels ℓ≡ 7(mod 12)
rademacher_phi_level_witness_seven0 below · depth 17 - Integrality of 6k s(h,k) for Dedekind sums
exists_intCast_eq_six_mul_dedekindSum0 below · depth 18