goldbach-spectral-bridge
Li and Liu's GRH + S ⇒ Goldbach in Lean, checked against the paper by Comparator: clean it up together, and settle S
| 1 | module |
| 2 | |
| 3 | public import ConditionalGoldbach.Proofs.Characters |
| 4 | |
| 5 | public section |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | noncomputable section |
| 9 | open scoped BigOperators ComplexConjugate Topology ContDiff |
| 10 | open MeasureTheory Filter Set Complex |
| 11 | namespace ConditionalGoldbach |
| 12 | attribute [local instance] Classical.propDecidable |
| 13 | |
| 14 | lemma full_character_selector {N : ℕ} [NeZero N] (n m : ℕ) : |
| 15 | (N.totient:ℂ)⁻¹ * ∑ χ : Character N, χ n*conj (χ m) = |
| 16 | if Nat.Coprime (n*m) N then (if (n:ZMod N)=m then 1 else 0) else 0 := by |
| 17 | have hφ : (N.totient:ℂ)≠0 := by exact_mod_cast (NeZero.ne N.totient) |
| 18 | by_cases hc : Nat.Coprime (n*m) N |
| 19 | · have hm := (Nat.coprime_mul_iff_left.mp hc).2 |
| 20 | rw [full_character_orthogonality _ _ ((ZMod.isUnit_iff_coprime m N).mpr hm),ite_eq_left hc] |
| 21 | split_ifs <;> simp [hφ] |
| 22 | · rw [ite_eq_right hc] |
| 23 | suffices (∑ χ : Character N, χ n*conj (χ m))=0 by rw [this,mul_zero] |
| 24 | apply Finset.sum_eq_zero |
| 25 | intro χ _ |
| 26 | have hh : ¬Nat.Coprime n N ∨ ¬Nat.Coprime m N := by simpa only [Nat.coprime_mul_iff_left,not_and_or] using hc |
| 27 | rcases hh with hn|hm |
| 28 | · have hz : χ (n:ZMod N)=0 := MulChar.map_nonunit χ (by simpa [ZMod.isUnit_iff_coprime] using hn) |
| 29 | simp [hz] |
| 30 | · have hz : χ (m:ZMod N)=0 := MulChar.map_nonunit χ (by simpa [ZMod.isUnit_iff_coprime] using hm) |
| 31 | simp [hz] |
| 32 | |
| 33 | lemma full_character_quadratic (N : ℕ) [NeZero N] (s : Finset ℕ) (c : ℕ → ℝ) : |
| 34 | (N.totient:ℝ)⁻¹ * ∑ χ : Character N, ‖∑ n ∈ s, (c n:ℂ)*χ n‖^2 = |
| 35 | ∑ n ∈ s, ∑ m ∈ s, c n*c m * |
| 36 | (if Nat.Coprime (n*m) N then (if (n:ZMod N)=m then (1:ℝ) else 0) else 0) := by |
| 37 | apply Complex.ofReal_injective |
| 38 | simp only [Complex.ofReal_mul,Complex.ofReal_inv,Complex.ofReal_natCast,Complex.ofReal_sum] |
| 39 | simp_rw [character_sum_norm_sq_complex] |
| 40 | rw [Finset.sum_comm] |
| 41 | simp_rw [Finset.sum_comm (s := Finset.univ) (t := s),Finset.mul_sum] |
| 42 | apply Finset.sum_congr rfl |
| 43 | intro n _ |
| 44 | apply Finset.sum_congr rfl |
| 45 | intro m _ |
| 46 | calc |
| 47 | (∑ χ : Character N, (N.totient:ℂ)⁻¹*((c n:ℂ)*c m*(χ n*conj (χ m)))) = |
| 48 | (c n:ℂ)*c m*((N.totient:ℂ)⁻¹*∑ χ : Character N, χ n*conj (χ m)) := by |
| 49 | simp only [Finset.mul_sum] |
| 50 | apply Finset.sum_congr rfl |
| 51 | intro χ _ |
| 52 | ring |
| 53 | _ = _ := by rw [full_character_selector]; split_ifs <;> norm_num |
| 54 | |
| 55 | lemma finite_full_projection (N : ℕ) [NeZero N] (c : ℕ → ℝ) (h0 : c 0=0) (hN : c N=0) : |
| 56 | (N.totient:ℝ)⁻¹ * ∑ χ : Character N, ‖∑ n ∈ Finset.range (N+1), (c n:ℂ)*χ n‖^2 = |
| 57 | ∑ n ∈ Finset.range (N+1), if Nat.Coprime n N then c n^2 else 0 := by |
| 58 | rw [full_character_quadratic] |
| 59 | apply Finset.sum_congr rfl |
| 60 | intro n hn |
| 61 | have hnn : n≤N := by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hn |
| 62 | have he (m : ℕ) (hm : m∈Finset.range (N+1)) : |
| 63 | c n*c m*(if Nat.Coprime (n*m) N then (if (n:ZMod N)=m then (1:ℝ) else 0) else 0)= |
| 64 | if n=m then (if Nat.Coprime n N then c n^2 else 0) else 0 := by |
| 65 | by_cases hcn : c n=0 |
| 66 | · simp [hcn] |
| 67 | by_cases hcm : c m=0 |
| 68 | · by_cases hnm : n=m |
| 69 | · subst m; exact (hcn hcm).elim |
| 70 | · simp [hcm,hnm] |
| 71 | have hn0 : 0<n := Nat.pos_of_ne_zero (by intro hz; subst n; exact hcn h0) |
| 72 | have hm0 : 0 < m := Nat.pos_of_ne_zero (by intro hz; subst m; exact hcm h0) |
| 73 | have hnN : n<N := lt_of_le_of_ne hnn (by intro hz; subst n; exact hcn hN) |
| 74 | have hmN : m<N := by |
| 75 | have hh : m≤N := by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hm |
| 76 | exact lt_of_le_of_ne hh (by intro hz; subst m; exact hcm hN) |
| 77 | simp only [(residue_diagonals (NeZero.pos N) hn0 hnN hm0 hmN).1] |
| 78 | by_cases hnm : n=m |
| 79 | · subst m |
| 80 | simp only [ite_true,Nat.coprime_mul_iff_left,and_self] |
| 81 | split_ifs <;> simp [pow_two] |
| 82 | · simp [hnm] |
| 83 | rw [Finset.sum_congr rfl he,Finset.sum_ite_eq,ite_eq_left hn] |
| 84 | |
| 85 | lemma signed_character_energy (N : ℕ) [NeZero N] (v : Character N → ℝ) : |
| 86 | (∑ χ : Character N, (χ (-1)).re*v χ) = ∑ χ : Character N, v χ - 2*∑ χ ∈ oddCharacters N, v χ := by |
| 87 | rw [oddCharacters,Finset.sum_filter,Finset.mul_sum,← Finset.sum_sub_distrib] |
| 88 | apply Finset.sum_congr rfl |
| 89 | intro χ _ |
| 90 | rcases χ.even_or_odd with he|ho |
| 91 | · have hnot : χ (-1)≠-1 := he.not_odd |
| 92 | have hv : χ (-1)=1 := he |
| 93 | norm_num [hv] |
| 94 | · have hv : χ (-1)=-1 := ho |
| 95 | simp [hv] |
| 96 | ring |
| 97 | |
| 98 | end ConditionalGoldbach |
