Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

| 1 | module |
| 2 | |
| 3 | import Mathlib.RingTheory.PiTensorProduct |
| 4 | import Std.Tactic.BVDecide.Normalize.BitVec |
| 5 | public import Lib.General.Algebra.AdicCompletion |
| 6 | import Lib.General.Algebra.AbsIntegrallyClosed |
| 7 | import Lib.General.Algebra.SeriesCongruences |
| 8 | import New.Reduction.Lattices.Colength |
| 9 | |
| 10 | /-! |
| 11 | # The change of directions |
| 12 | |
| 13 | This file gives matrices over the integers of `ℂ_p`, one for each place and height, that change |
| 14 | given directions. For a divisor `π` of `p`, the pairings `∑ β_a ^ p ^ e * β'_a` of new directions at |
| 15 | a place and at its partner become divisible by `π`, apart from the exempt pairs of heights, which |
| 16 | involve a marked place. The valuations of the determinants, one for each column, add up to at most |
| 17 | the deduction: `v(π)` times the sum of the numbers `New.deductionTerm`. |
| 18 | |
| 19 | ## Main definitions and results |
| 20 | |
| 21 | * `New.deductionTerm`: the term of the deduction for a place, a partner and an exponent `e`. |
| 22 | * `New.CongruenceChoice`, `New.exists_congruenceChoice_cost_eq_and_covers`: which congruences are |
| 23 | imposed for a place and a partner; a choice of cost `New.deductionTerm` covers the pairs of |
| 24 | heights that are not exempt (`New.IsExemptPair`). |
| 25 | * `New.newDirection`, `New.exists_newDirection_dvd`: integral changes of direction at each place |
| 26 | and height that make the pairings that are not exempt divisible by `π`, and whose determinants |
| 27 | cost at most the deduction. |
| 28 | |
| 29 | Notions from other files: |
| 30 | * `New.valRingCp p`: the integers of `ℂ_p`. |
| 31 | -/ |
| 32 | |
| 33 | @[expose] public section |
| 34 | |
| 35 | /-! |
| 36 | ## Changing the directions |
| 37 | |
| 38 | Finitely many congruences on the rows of one matrix are met by elimination, at the price of the |
| 39 | product of the moduli. |
| 40 | -/ |
| 41 | |
| 42 | section NullFrames |
| 43 | |
| 44 | open Finset Matrix |
| 45 | |
| 46 | /-- For finitely many linear forms with coefficient vectors `A i` and moduli `α i` over the integers |
| 47 | `valRingCp p` of `ℂ_p`, there is a square matrix `g`, with determinant dividing the product of the |
| 48 | moduli, such that `α i` divides the value of the `i`-th form on every row of `g`. -/ |
| 49 | lemma New.exists_det_dvd_prod_and_dvd_mulVec {p : ℕ} [Fact p.Prime] {ι : Type*} {m : ℕ} |
| 50 | (t : Finset ι) (A : ι → Fin m → valRingCp p) (α : ι → valRingCp p) : |
| 51 | ∃ g : Matrix (Fin m) (Fin m) (valRingCp p), |
| 52 | g.det ∣ ∏ i ∈ t, α i ∧ ∀ i ∈ t, ∀ k : Fin m, α i ∣ (g *ᵥ A i) k := by |
| 53 | -- Apply the coordinate divisibility conditions to the family of columns of `A`. |
| 54 | obtain ⟨g, hg_det, hg⟩ := colengthDvd_iInf_comap_span |
| 55 | (LinearMap.proj (R := valRingCp p) (φ := fun _ : ι ↦ valRingCp p)) α t m |
| 56 | (fun k i ↦ A i k) (fun _ ↦ Submodule.mem_top) |
| 57 | simp only [Submodule.mem_iInf] at hg |
| 58 | refine ⟨g, hg_det, fun i hi k ↦ ?_⟩ |
| 59 | simpa [mulVec, dotProduct, Ideal.mem_span_singleton] using hg k i hi |
| 60 | |
| 61 | /-- Let `π` divide `p`, and let `root x` be a `p ^ e`-th root of `x`. If `root π` divides the linear |
| 62 | form `∑ root (y' a) * β a`, then `π` divides the pairing `∑ β a ^ p ^ e * y' a`, as `p ^ e`-th |
| 63 | powers are additive modulo `p`. -/ |
| 64 | lemma New.dvd_sum_pow_mul_of_root_dvd {p : ℕ} [Fact p.Prime] {O n : Type*} [CommRing O] [Fintype n] |
| 65 | {π : O} (hπ : π ∣ (p : O)) {e : ℕ} {root : O → O} (h_root : ∀ x : O, root x ^ p ^ e = x) |
| 66 | {β y' : n → O} (h_dvd : root π ∣ ∑ a : n, root (y' a) * β a) : |
| 67 | π ∣ ∑ a : n, β a ^ p ^ e * y' a := by |
| 68 | have h_pow : π ∣ (∑ a, root (y' a) * β a) ^ p ^ e := by |
| 69 | simpa only [h_root] using pow_dvd_pow_of_dvd h_dvd (p ^ e) |
| 70 | have h_additive : π ∣ (∑ a, root (y' a) * β a) ^ p ^ e - ∑ a, β a ^ p ^ e * y' a := by |
| 71 | simpa only [mul_pow, h_root, mul_comm] using |
| 72 | dvd_sum_pow_sub_sum hπ univ (fun a ↦ root (y' a) * β a) e |
| 73 | exact (dvd_sub_right h_pow).1 h_additive |
| 74 | |
| 75 | /-- The value of the form with coefficients `∑ a, x a * y a k` on a row `u` is the pairing of `x` |
| 76 | with the combination of the vectors `y · k` given by `u`. -/ |
| 77 | lemma New.dotProduct_sum_mul {O n : Type*} [NonUnitalCommSemiring O] [Fintype n] {h : ℕ} |
| 78 | (u : Fin h → O) |
| 79 | (x : n → O) (y : n → ℕ → O) : |
| 80 | (u ⬝ᵥ fun k : Fin h ↦ ∑ a : n, x a * y a k) = |
| 81 | ∑ a : n, x a * (u ⬝ᵥ fun k : Fin h ↦ y a k) := by |
| 82 | simp only [dotProduct, mul_sum, mul_left_comm] |
| 83 | exact sum_comm |
| 84 | |
| 85 | /-- The term of the deduction, in units of `v(π)`, for a place `σ`, a partner `σ'` and an exponent |
| 86 | `e`, when `κ σ h` is the number of columns of height `h` at `σ`, counted only for `h < n'`, and |
| 87 | `ev` is the set of marked places. Let `t σ` be the number of columns of height one (`0` if `σ` is |
| 88 | marked), `r σ` the number of columns of height other than one, and `B σ` the sum of their heights, |
| 89 | that is, their number of boxes. The term is the real number |
| 90 | `min (t σ / p ^ e) (r σ' + t σ') + r σ / p ^ e + min (B σ / p ^ e) (B σ')`. -/ |
| 91 | noncomputable def New.deductionTerm {Φ : Type*} [DecidableEq Φ] (p : ℕ) (κ : Φ → ℕ → ℕ) (n' : ℕ) |
| 92 | (ev : Finset Φ) (σ σ' : Φ) (e : ℕ) : ℝ := |
| 93 | let t (σ : Φ) : ℕ := ∑ h ∈ range n', if h = 1 ∧ σ ∉ ev then κ σ h else 0 |
| 94 | let r (σ : Φ) : ℕ := ∑ h ∈ range n', if h = 1 then 0 else κ σ h |
| 95 | let B (σ : Φ) : ℕ := ∑ h ∈ range n', h * if h = 1 then 0 else κ σ h |
| 96 | min (t σ / p ^ e : ℝ) (r σ' + t σ') + r σ / p ^ e + min (B σ / p ^ e : ℝ) (B σ') |
| 97 | |
| 98 | /-- The pair of heights `h` at the place `σ` and `h'` at the place `σ'` is exempt for the set `ev` |
| 99 | of marked places: `h = 1`, and either `σ` is marked or `h' = 1` and `σ'` is marked. -/ |
| 100 | def New.IsExemptPair {Φ : Type*} (ev : Finset Φ) (σ σ' : Φ) (h h' : ℕ) : Prop := |
| 101 | h = 1 ∧ (σ ∈ ev ∨ h' = 1 ∧ σ' ∈ ev) |
| 102 | |
| 103 | /-- A choice of congruences for a place (the source) and its partner: for each height `h`, which |
| 104 | of four kinds of congruence are imposed on the rows of height `h`. -/ |
| 105 | structure New.CongruenceChoice where |
| 106 | /-- Congruences on all `h` entries of each row at the source. -/ |
| 107 | sourceEntries : ℕ → Bool |
| 108 | /-- One congruence on the pairing of each row at the source with direction `0` at the partner. -/ |
| 109 | sourcePairing : ℕ → Bool |
| 110 | /-- Congruences on all `h` entries of each row at the partner. -/ |
| 111 | partnerEntries : ℕ → Bool |
| 112 | /-- One congruence on the pairing of each row at the partner with direction `0` at the source. -/ |
| 113 | partnerPairing : ℕ → Bool |
| 114 | |
| 115 | /-- The two sides of a pairing from a place to its partner. -/ |
| 116 | inductive New.PairingSide |
| 117 | /-- The side of the place itself. -/ |
| 118 | | source |
| 119 | /-- The side of the partner. -/ |
| 120 | | partner |
| 121 | deriving DecidableEq |
| 122 | |
| 123 | namespace New.PairingSide |
| 124 | |
| 125 | instance : Fintype PairingSide where |
| 126 | elems := {source, partner} |
| 127 | complete side := by cases side <;> simp |
| 128 | |
| 129 | /-- The place of a side, for a pairing from `σ` to `σ'`. -/ |
| 130 | def place {Φ : Type*} (side : PairingSide) (σ σ' : Φ) : Φ := |
| 131 | match side with |
| 132 | | source => σ |
| 133 | | partner => σ' |
| 134 | |
| 135 | /-- For a pairing at the exponent `e`, congruences on a side are taken modulo a `p ^ r`-th root of |
| 136 | `π`, where `r` is this number: `e` at the source and `0` at the partner. -/ |
| 137 | def rootExponent (side : PairingSide) (e : ℕ) : ℕ := |
| 138 | match side with |
| 139 | | source => e |
| 140 | | partner => 0 |
| 141 | |
| 142 | lemma sum_univ {M : Type*} [AddCommMonoid M] (f : PairingSide → M) : |
| 143 | ∑ side : PairingSide, f side = f source + f partner := |
| 144 | sum_pair (by decide : source ≠ partner) |
| 145 | |
| 146 | end New.PairingSide |
| 147 | |
| 148 | namespace New.CongruenceChoice |
| 149 | |
| 150 | /-- The number of congruences on a row of height `h` at the source. -/ |
| 151 | def sourceCount (c : CongruenceChoice) (h : ℕ) : ℕ := |
| 152 | (if c.sourcePairing h then 1 else 0) + h * if c.sourceEntries h then 1 else 0 |
| 153 | |
| 154 | /-- The number of congruences on a row of height `h` at the partner. -/ |
| 155 | def partnerCount (c : CongruenceChoice) (h : ℕ) : ℕ := |
| 156 | (if c.partnerPairing h then 1 else 0) + h * if c.partnerEntries h then 1 else 0 |
| 157 | |
| 158 | /-- The number of congruences on the heights `h < N`, counted once for each of the `κ h` columns |
| 159 | at the source, with weight `1 / p ^ e`, and once for each of the `κ' h` columns at the partner. -/ |
| 160 | noncomputable def cost (c : CongruenceChoice) (p e N : ℕ) (κ κ' : ℕ → ℕ) : ℝ := |
| 161 | ∑ h ∈ range N, (c.sourceCount h * κ h / p ^ e + c.partnerCount h * κ' h : ℝ) |
| 162 | |
| 163 | /-- The pair of heights `h` at the source and `h'` at the partner is covered by one of the four |
| 164 | kinds of congruence. A congruence on a pairing counts only if the height on the other side is |
| 165 | one. -/ |
| 166 | def Covers (c : CongruenceChoice) (h h' : ℕ) : Prop := |
| 167 | c.partnerPairing h' ∧ h = 1 ∨ c.partnerEntries h' ∨ |
| 168 | c.sourcePairing h ∧ h' = 1 ∨ c.sourceEntries h |
| 169 | |
| 170 | /-- Whether a congruence is imposed on the rows of height `h` on the given side, on the pairing |
| 171 | (`none`) or on the entry `k` (`some k`). -/ |
| 172 | def imposes (c : CongruenceChoice) (h : ℕ) : PairingSide → Option (Fin h) → Bool |
| 173 | | .source, none => c.sourcePairing h |
| 174 | | .source, some _ => c.sourceEntries h |
| 175 | | .partner, none => c.partnerPairing h |
| 176 | | .partner, some _ => c.partnerEntries h |
| 177 | |
| 178 | lemma sum_imposes_source (c : CongruenceChoice) (h : ℕ) : |
| 179 | ∑ form : Option (Fin h), (if c.imposes h .source form then 1 else 0) = c.sourceCount h := |
| 180 | calc _ = (if c.sourcePairing h then 1 else 0) + |
| 181 | ∑ _k : Fin h, if c.sourceEntries h then 1 else 0 := Fintype.sum_option _ |
| 182 | _ = c.sourceCount h := by rw [sourceCount, Fin.sum_const, smul_eq_mul] |
| 183 | |
| 184 | lemma sum_imposes_partner (c : CongruenceChoice) (h : ℕ) : |
| 185 | ∑ form : Option (Fin h), (if c.imposes h .partner form then 1 else 0) = c.partnerCount h := |
| 186 | calc _ = (if c.partnerPairing h then 1 else 0) + |
| 187 | ∑ _k : Fin h, if c.partnerEntries h then 1 else 0 := Fintype.sum_option _ |
| 188 | _ = c.partnerCount h := by rw [partnerCount, Fin.sum_const, smul_eq_mul] |
| 189 | |
| 190 | end New.CongruenceChoice |
| 191 | |
| 192 | /-- For a place `σ`, a partner `σ'` and an exponent `e` there is a choice of congruences |
| 193 | (`CongruenceChoice`): for each height, whether a row at `σ`, and a row at `σ'`, gets one congruence |
| 194 | on its pairing with direction `0` at the other place, one on each entry, or both. Its `cost`, the |
| 195 | number of congruences on all columns with those at `σ` weighted by `1 / p ^ e`, equals |
| 196 | `deductionTerm`. Each pair of heights `h` at `σ` and `h'` at `σ'` that is not exempt is covered |
| 197 | (`Covers`): there are congruences on the entries of one of the two rows, or on the pairing of one of |
| 198 | them and the other height is one. -/ |
| 199 | lemma New.exists_congruenceChoice_cost_eq_and_covers {Φ : Type*} [DecidableEq Φ] (p : ℕ) |
| 200 | (κ : Φ → ℕ → ℕ) (N : ℕ) (marked : Finset Φ) (σ σ' : Φ) (e : ℕ) : |
| 201 | ∃ c : CongruenceChoice, |
| 202 | c.cost p e N (κ σ) (κ σ') = deductionTerm p κ N marked σ σ' e ∧ |
| 203 | ∀ h h' : ℕ, ¬IsExemptPair marked σ σ' h h' → c.Covers h h' := by |
| 204 | -- The choice always pays for the columns of height other than one at `σ`, and takes the cheaper |
| 205 | -- side in two comparisons. |
| 206 | let oneCols (τ : Φ) : ℕ := ∑ h ∈ range N, if h = 1 ∧ τ ∉ marked then κ τ h else 0 |
| 207 | let neOneCols (τ : Φ) : ℕ := ∑ h ∈ range N, if h = 1 then 0 else κ τ h |
| 208 | let neOneBoxes (τ : Φ) : ℕ := ∑ h ∈ range N, h * if h = 1 then 0 else κ τ h |
| 209 | have h_deduction : deductionTerm p κ N marked σ σ' e = |
| 210 | min (oneCols σ / p ^ e : ℝ) (neOneCols σ' + oneCols σ') + neOneCols σ / p ^ e + |
| 211 | min (neOneBoxes σ / p ^ e : ℝ) (neOneBoxes σ') := rfl |
| 212 | -- The first minimum decides between the entries of height one at `σ` and the pairings at `σ'`, |
| 213 | -- the second between the entries of the heights other than one at `σ` and at `σ'`. |
| 214 | let oneAtSource : Prop := (oneCols σ / p ^ e : ℝ) ≤ neOneCols σ' + oneCols σ' |
| 215 | let neOneAtSource : Prop := (neOneBoxes σ / p ^ e : ℝ) ≤ neOneBoxes σ' |
| 216 | let c : CongruenceChoice := |
| 217 | { sourceEntries h := decide (if h = 1 then σ ∉ marked ∧ oneAtSource else neOneAtSource) |
| 218 | sourcePairing h := decide (h ≠ 1) |
| 219 | partnerEntries h := decide (h ≠ 1 ∧ ¬neOneAtSource) |
| 220 | partnerPairing h := decide (¬oneAtSource ∧ (h = 1 → σ' ∉ marked)) } |
| 221 | -- The number of congruences on all columns at `σ` and at `σ'`, computed height by height. |
| 222 | have source_sum : ∑ h ∈ range N, c.sourceCount h * κ σ h = |
| 223 | (if oneAtSource then oneCols σ else 0) + neOneCols σ + |
| 224 | if neOneAtSource then neOneBoxes σ else 0 := by |
| 225 | simp only [oneCols, neOneCols, neOneBoxes, ite_sum_zero, ← sum_add_distrib] |
| 226 | refine sum_congr rfl fun h _ ↦ ?_ |
| 227 | by_cases h_one : h = 1 <;> by_cases hσ : σ ∈ marked <;> |
| 228 | simp [c, CongruenceChoice.sourceCount, h_one, hσ, add_mul] |
| 229 | have partner_sum : ∑ h ∈ range N, c.partnerCount h * κ σ' h = |
| 230 | (if oneAtSource then 0 else neOneCols σ' + oneCols σ') + |
| 231 | if neOneAtSource then 0 else neOneBoxes σ' := by |
| 232 | simp only [oneCols, neOneCols, neOneBoxes, ite_zero_sum, ← sum_add_distrib] |
| 233 | refine sum_congr rfl fun h _ ↦ ?_ |
| 234 | by_cases h_one : h = 1 <;> simp [c, CongruenceChoice.partnerCount, h_one, ite_and, add_mul] |
| 235 | refine ⟨c, ?_, fun (h h' : ℕ) not_exempt ↦ ?_⟩ |
| 236 | · have h_cost : c.cost p e N (κ σ) (κ σ') = |
| 237 | (∑ h ∈ range N, c.sourceCount h * κ σ h : ℕ) / p ^ e + |
| 238 | (∑ h ∈ range N, c.partnerCount h * κ σ' h : ℕ) := by |
| 239 | simp [CongruenceChoice.cost, sum_add_distrib, Finset.sum_div] |
| 240 | rw [h_cost, source_sum, partner_sum, h_deduction, min_def, min_def] |
| 241 | push_cast |
| 242 | -- In each case of the two minima, both sides are the same sum. |
| 243 | split_ifs <;> ring |
| 244 | · -- A height `h = 1` is covered by the first minimum, since the places concerned are not marked; |
| 245 | -- otherwise `h' = 1` is covered by the pairing at `σ`, and `h' ≠ 1` by the second minimum. |
| 246 | simp only [c, CongruenceChoice.Covers, decide_eq_true_eq] |
| 247 | grind [IsExemptPair] |
| 248 | |
| 249 | /-- The moduli of the congruences on the rows of height `h` at the place `τ`, when `c e σ` is the |
| 250 | choice of congruences for the place `σ` and its partner `pr e σ` at the exponent `e ∈ S`. They are |
| 251 | indexed by `e`, `σ`, the side of the pairing from `σ` to `pr e σ` and the form (`none` for the |
| 252 | pairing, `some k` for an entry). If `τ` is the place of that side and `c e σ` imposes the |
| 253 | congruence, the modulus is `root e` at `σ` and `root 0` at `pr e σ`; otherwise it is `1`. -/ |
| 254 | def New.congruenceModulus {O Φ : Type*} [One O] [DecidableEq Φ] (pr : ℕ → Φ → Φ) (S : Finset ℕ) |
| 255 | (root : ℕ → O) (c : ℕ → Φ → CongruenceChoice) (τ : Φ) (h : ℕ) : |
| 256 | S × Φ × PairingSide × Option (Fin h) → O := |
| 257 | fun (e, σ, side, form) ↦ |
| 258 | if side.place σ (pr e σ) = τ ∧ (c e σ).imposes h side form then root (side.rootExponent e) |
| 259 | else 1 |
| 260 | |
| 261 | /-- Let `c e σ` be a choice of congruences for each exponent `e ∈ S`, place `σ` and partner |
| 262 | `pr e σ`, let `κ τ h` be the number of columns of height `h` at the place `τ`, and let `root e` be a |
| 263 | `p ^ e`-th root of `π`. The modulus `congruenceModulus` of the congruence indexed by |
| 264 | `(e, σ, side, form)`, on the rows of height `h` at `τ`, is `root e` at the side `σ` and `root 0` at |
| 265 | the side `pr e σ`, if that side is the place `τ` and the congruence is imposed; otherwise it is `1`. |
| 266 | The product of all moduli, over all `τ` and `h < N` and once for each of the `κ τ h` columns, has |
| 267 | norm `‖π‖` raised to the sum over `e` and `σ` of the `cost` of `c e σ`: the number of congruences |
| 268 | imposed on all columns of height less than `N` at `σ`, divided by `p ^ e`, plus the number of those |
| 269 | at `pr e σ`. -/ |
| 270 | lemma New.norm_rpow_sum_cost_eq_prod_congruenceModulus {p : ℕ} [Fact p.Prime] {Φ : Type*} |
| 271 | [Fintype Φ] |
| 272 | [DecidableEq Φ] (pr : ℕ → Φ → Φ) (S : Finset ℕ) (N : ℕ) (κ : Φ → ℕ → ℕ) {π : valRingCp p} |
| 273 | {root : ℕ → valRingCp p} (h_root : ∀ e : ℕ, root e ^ p ^ e = π) |
| 274 | (c : ℕ → Φ → CongruenceChoice) : |
| 275 | ‖π‖ ^ ∑ e ∈ S, ∑ σ : Φ, (c e σ).cost p e N (κ σ) (κ (pr e σ)) = |
| 276 | ∏ τ : Φ, ∏ h : Fin N, |
| 277 | ‖∏ i : S × Φ × PairingSide × Option (Fin h), congruenceModulus pr S root c τ h i‖ ^ |
| 278 | κ τ h := by |
| 279 | have norm_root (e : ℕ) : ‖root e‖ = ‖π‖ ^ (p ^ e : ℝ)⁻¹ := by |
| 280 | rw [← h_root e, norm_pow, ← Nat.cast_pow, |
| 281 | Real.pow_rpow_inv_natCast (norm_nonneg _) (pow_ne_zero e (Fact.out : p.Prime).ne_zero)] |
| 282 | -- The number of congruences on a row of height `h` on one side of the pairing from `σ`. |
| 283 | let count (e : ℕ) (σ : Φ) (side : PairingSide) (h : ℕ) : ℕ := |
| 284 | ∑ form : Option (Fin h), if (c e σ).imposes h side form then 1 else 0 |
| 285 | -- Regroup the product of moduli by `(e, σ, side)` and height `h`, with the place `τ` innermost. |
| 286 | have h_swap : |
| 287 | ∏ τ : Φ, ∏ h : Fin N, |
| 288 | ‖∏ i : S × Φ × PairingSide × Option (Fin h), congruenceModulus pr S root c τ h i‖ ^ |
| 289 | κ τ h = |
| 290 | ∏ e : S, ∏ σ : Φ, ∏ side : PairingSide, ∏ h : Fin N, ∏ τ : Φ, |
| 291 | ∏ form : Option (Fin h), ‖congruenceModulus pr S root c τ h (e, σ, side, form)‖ ^ |
| 292 | κ τ h := by |
| 293 | simp only [norm_prod, Fintype.prod_prod_type, ← Finset.prod_pow] |
| 294 | rw [← Fintype.prod_prod_type'] |
| 295 | simp_rw [Finset.prod_comm (s := (univ : Finset (Φ × Fin N)))] |
| 296 | simp only [Fintype.prod_prod_type, |
| 297 | Finset.prod_comm (s := (univ : Finset Φ)) (t := (univ : Finset (Fin N)))] |
| 298 | -- Only the place `side.place σ (pr e σ)` has non-trivial moduli for `(e, σ, side)` at height `h`. |
| 299 | have norm_side (e : S) (σ : Φ) (side : PairingSide) (h : Fin N) : |
| 300 | ∏ τ : Φ, |
| 301 | ∏ form : Option (Fin h), ‖congruenceModulus pr S root c τ h (e, σ, side, form)‖ ^ |
| 302 | κ τ h = |
| 303 | ‖π‖ ^ ((count e σ side h * κ (side.place σ (pr e σ)) h : ℝ) / p ^ side.rootExponent e) := by |
| 304 | rw [Finset.prod_eq_single (side.place σ (pr e σ)) |
| 305 | (fun τ _ hτ ↦ by simp [congruenceModulus, Ne.symm hτ]) (by simp)] |
| 306 | simp only [congruenceModulus, true_and, ← pow_boole, norm_pow, ← pow_mul, prod_pow_eq_pow_sum, |
| 307 | ← sum_mul, count] |
| 308 | simp only [norm_root, ← Real.rpow_mul_natCast (norm_nonneg π), Nat.cast_mul, div_eq_inv_mul] |
| 309 | -- Evaluate each side at its own place and collect the exponents into `(c e σ).cost`. |
| 310 | rw [h_swap] |
| 311 | simp only [norm_side] |
| 312 | simp (disch := exact fun _ _ ↦ by positivity) only [← Real.rpow_sum_of_nonneg (norm_nonneg π), |
| 313 | ← S.sum_coe_sort] |
| 314 | congr! 3 with e _ σ |
| 315 | simp [PairingSide.sum_univ, PairingSide.place, PairingSide.rootExponent, CongruenceChoice.cost, |
| 316 | count, ← CongruenceChoice.sum_imposes_source, ← CongruenceChoice.sum_imposes_partner, |
| 317 | sum_range, sum_add_distrib] |
| 318 | |
| 319 | /-- Coordinate `a` of the new direction `k` for the place `τ` and the height `h`: the combination |
| 320 | `∑ k' : Fin h, g τ h k k' * y τ a k'` of the given directions `y τ · k'`. -/ |
| 321 | def New.newDirection {Φ n R : Type} [CommRing R] (g : Φ → ∀ h : ℕ, Matrix (Fin h) (Fin h) R) |
| 322 | (y : Φ → n → ℕ → R) (τ : Φ) (h : ℕ) (k : Fin h) (a : n) : R := |
| 323 | g τ h k ⬝ᵥ fun k' : Fin h ↦ y τ a k' |
| 324 | |
| 325 | /-- The linear forms on the rows of height `h` at the place `τ`, paired with `congruenceModulus`. |
| 326 | They are indexed by `e ∈ S`, `σ`, the side of the pairing from `σ` to `pr e σ`, and the form |
| 327 | (`none` for the pairing with direction `0` at the other place, taking `p ^ e`-th roots at the source |
| 328 | and `p ^ e`-th powers at the partner; `some l` for the `l`-th entry of the row). -/ |
| 329 | def New.congruenceForm {O Φ n : Type*} [CommRing O] [Fintype n] (p : ℕ) (pr : ℕ → Φ → Φ) |
| 330 | (S : Finset ℕ) (root : ℕ → O → O) (y : Φ → n → ℕ → O) (τ : Φ) (h : ℕ) : |
| 331 | S × Φ × PairingSide × Option (Fin h) → Fin h → O |
| 332 | | (e, σ, .source, none) => fun k ↦ ∑ a : n, root e (y (pr e σ) a 0) * y τ a k |
| 333 | | (e, σ, .partner, none) => fun k ↦ ∑ a : n, y σ a 0 ^ p ^ (e : ℕ) * y τ a k |
| 334 | | (_, _, _, some l) => Pi.single l 1 |
| 335 | |
| 336 | /-- If the rows of `g τ h` satisfy the congruences of `congruenceForm` modulo `congruenceModulus` |
| 337 | for the choices `c`, where `π ∣ p` and `root e x` is a `p ^ e`-th root of `x`, then for `e ∈ S` |
| 338 | every pair of heights `(h, h')` covered by `c e τ` gives new directions whose pairing |
| 339 | `∑ a, β a ^ p ^ e * β' a` is divisible by `π`. -/ |
| 340 | lemma New.dvd_sum_pow_mul_newDirection_of_covers {p : ℕ} [Fact p.Prime] {O Φ n : Type} [CommRing O] |
| 341 | [DecidableEq Φ] [Fintype n] {π : O} (hπ : π ∣ (p : O)) {pr : ℕ → Φ → Φ} {S : Finset ℕ} |
| 342 | {root : ℕ → O → O} (h_root : ∀ (e : ℕ) (x : O), root e x ^ p ^ e = x) |
| 343 | {c : ℕ → Φ → CongruenceChoice} {y : Φ → n → ℕ → O} |
| 344 | {g : Φ → ∀ h : ℕ, Matrix (Fin h) (Fin h) O} |
| 345 | (h_dvd : ∀ (τ : Φ) (h : ℕ) (i : S × Φ × PairingSide × Option (Fin h)) (k : Fin h), |
| 346 | congruenceModulus pr S (fun e : ℕ ↦ root e π) c τ h i ∣ |
| 347 | (g τ h *ᵥ congruenceForm p pr S root y τ h i) k) |
| 348 | {e : ℕ} (he : e ∈ S) {τ : Φ} {h : ℕ} {k : Fin h} {h' : ℕ} {k' : Fin h'} |
| 349 | (h_cov : (c e τ).Covers h h') : |
| 350 | π ∣ ∑ a : n, newDirection g y τ h k a ^ p ^ e * newDirection g y (pr e τ) h' k' a := by |
| 351 | let β : n → O := newDirection g y τ h k |
| 352 | let β' : n → O := newDirection g y (pr e τ) h' k' |
| 353 | change π ∣ ∑ a : n, β a ^ p ^ e * β' a |
| 354 | have source_dvd (form : Option (Fin h)) (h_imposed : (c e τ).imposes h .source form) : |
| 355 | root e π ∣ g τ h k ⬝ᵥ congruenceForm p pr S root y τ h (⟨e, he⟩, τ, .source, form) := by |
| 356 | simpa [congruenceModulus, PairingSide.place, PairingSide.rootExponent, h_imposed, mulVec] using |
| 357 | h_dvd τ h (⟨e, he⟩, τ, .source, form) k |
| 358 | have partner_dvd (form : Option (Fin h')) (h_imposed : (c e τ).imposes h' .partner form) : |
| 359 | π ∣ g (pr e τ) h' k' ⬝ᵥ |
| 360 | congruenceForm p pr S root y (pr e τ) h' (⟨e, he⟩, τ, .partner, form) := by |
| 361 | have h_root_zero : root 0 π = π := by simpa using h_root 0 π |
| 362 | simpa [congruenceModulus, PairingSide.place, PairingSide.rootExponent, h_imposed, h_root_zero, |
| 363 | mulVec] using h_dvd (pr e τ) h' (⟨e, he⟩, τ, .partner, form) k' |
| 364 | obtain ⟨h_imposed, rfl⟩ | h_imposed | ⟨h_imposed, rfl⟩ | h_imposed := h_cov |
| 365 | · -- `β` is a multiple of the first direction at `τ`, and `π` divides its pairing with `β'`. |
| 366 | have h_pair : π ∣ ∑ a, y τ a 0 ^ p ^ e * β' a := by |
| 367 | simpa only [congruenceForm, β', newDirection, dotProduct_sum_mul] using |
| 368 | partner_dvd none h_imposed |
| 369 | have h_factor : ∑ a, β a ^ p ^ e * β' a = |
| 370 | g τ 1 k 0 ^ p ^ e * ∑ a, y τ a 0 ^ p ^ e * β' a := by |
| 371 | simp [β, newDirection, dotProduct, mul_pow, mul_sum, mul_assoc] |
| 372 | simpa only [h_factor] using h_pair.mul_left _ |
| 373 | · -- All entries of the row at the partner are divisible by `π`, hence so is `β'`. |
| 374 | have h_entry (j : Fin h') : π ∣ g (pr e τ) h' k' j := by |
| 375 | simpa [congruenceForm] using partner_dvd (some j) h_imposed |
| 376 | have h_direction (a : n) : π ∣ β' a := by |
| 377 | simpa only [β', newDirection, dotProduct] using dvd_sum fun j _ ↦ (h_entry j).mul_right _ |
| 378 | exact dvd_sum fun a _ ↦ (h_direction a).mul_left _ |
| 379 | · -- `β'` is a multiple of the first direction at the partner, and its pairing with `β` is |
| 380 | -- divisible by `π` through one congruence modulo the root of `π`. |
| 381 | have h_form : root e π ∣ ∑ a, root e (y (pr e τ) a 0) * β a := by |
| 382 | simpa only [congruenceForm, β, newDirection, dotProduct_sum_mul] using |
| 383 | source_dvd none h_imposed |
| 384 | have h_pair : π ∣ ∑ a, β a ^ p ^ e * y (pr e τ) a 0 := |
| 385 | dvd_sum_pow_mul_of_root_dvd hπ (h_root e) h_form |
| 386 | have h_factor : ∑ a, β a ^ p ^ e * β' a = |
| 387 | g (pr e τ) 1 k' 0 * ∑ a, β a ^ p ^ e * y (pr e τ) a 0 := by |
| 388 | simp [β', newDirection, dotProduct, mul_sum, mul_left_comm] |
| 389 | simpa only [h_factor] using h_pair.mul_left _ |
| 390 | · -- All entries of the row at `τ` are divisible by the root of `π`, hence so is `β`. |
| 391 | have h_entry (j : Fin h) : root e π ∣ g τ h k j := by |
| 392 | simpa [congruenceForm] using source_dvd (some j) h_imposed |
| 393 | have h_direction (a : n) : root e π ∣ β a := by |
| 394 | simpa only [β, newDirection, dotProduct] using dvd_sum fun j _ ↦ (h_entry j).mul_right _ |
| 395 | have h_pow (a : n) : π ∣ β a ^ p ^ e := by |
| 396 | simpa only [h_root] using pow_dvd_pow_of_dvd (h_direction a) (p ^ e) |
| 397 | exact dvd_sum fun a _ ↦ (h_pow a).mul_right _ |
| 398 | |
| 399 | /-- **Changing the directions.** Let `π` divide `p` in the integers `valRingCp p` of `ℂ_p`, and let |
| 400 | `y τ a k'` be coordinate `a` of direction `k'` at the place `τ`. There are square matrices `g τ h`, |
| 401 | one for each place and height, such that the new directions `newDirection g y τ h k a = ∑ k' : Fin |
| 402 | h, g τ h k k' * y τ a k'` have two properties. First, for `e ∈ S`, the pairing |
| 403 | `∑ a, β a ^ p ^ e * β' a` of a new direction `β` of height `h` at `τ` with a new direction `β'` of |
| 404 | height `h'` at the partner `pr e τ` is divisible by `π`, unless the pair of heights is exempt. |
| 405 | Second, the determinants of the `g τ h`, one for each of the `κ τ h` columns of height `h < N`, have |
| 406 | total valuation at most `v(π)` times the sum of `deductionTerm` over `e ∈ S` and places `τ`. -/ |
| 407 | lemma New.exists_newDirection_dvd {p : ℕ} [Fact p.Prime] {Φ n : Type} [Fintype Φ] [DecidableEq Φ] |
| 408 | [Fintype n] {π : valRingCp p} (hπ : π ∣ p) (pr : ℕ → Φ → Φ) (S : Finset ℕ) (N : ℕ) |
| 409 | (κ : Φ → ℕ → ℕ) (marked : Finset Φ) (y : Φ → n → ℕ → valRingCp p) : |
| 410 | ∃ g : Φ → ∀ h : ℕ, Matrix (Fin h) (Fin h) (valRingCp p), |
| 411 | (∀ e ∈ S, ∀ (τ : Φ) (h : ℕ) (k : Fin h) (h' : ℕ) (k' : Fin h'), |
| 412 | ¬IsExemptPair marked τ (pr e τ) h h' → |
| 413 | π ∣ ∑ a : n, newDirection g y τ h k a ^ p ^ e * newDirection g y (pr e τ) h' k' a) ∧ |
| 414 | ‖(π : ℂ_[p])‖ ^ ∑ e ∈ S, ∑ τ : Φ, deductionTerm p κ N marked τ (pr e τ) e ≤ |
| 415 | ∏ τ : Φ, ∏ h : Fin N, ‖((g τ h).det : ℂ_[p])‖ ^ κ τ h := by |
| 416 | -- A pairing from `σ` to `pr e σ` is made divisible by congruences on the rows of `g`, either at |
| 417 | -- `σ` modulo a `p ^ e`-th root of `π` or at `pr e σ` modulo `π`. The forms depend on `y` only, |
| 418 | -- so all congruences on one matrix are collected and imposed together. |
| 419 | have exists_root (e : ℕ) (x : valRingCp p) : ∃ r : valRingCp p, r ^ p ^ e = x := |
| 420 | (Variety.IsAbsIntegrallyClosed.of_isIntegrallyClosedIn ℂ_[p]).exists_pow_eq (p ^ e) x |
| 421 | choose root h_root using exists_root |
| 422 | have exists_choice (e : ℕ) (σ : Φ) : ∃ c : CongruenceChoice, |
| 423 | c.cost p e N (κ σ) (κ (pr e σ)) = deductionTerm p κ N marked σ (pr e σ) e ∧ |
| 424 | ∀ h h' : ℕ, ¬IsExemptPair marked σ (pr e σ) h h' → c.Covers h h' := |
| 425 | exists_congruenceChoice_cost_eq_and_covers p κ N marked σ (pr e σ) e |
| 426 | choose c cost_eq cover using exists_choice |
| 427 | let α (τ : Φ) (h : ℕ) : S × Φ × PairingSide × Option (Fin h) → valRingCp p := |
| 428 | congruenceModulus pr S (fun e : ℕ ↦ root e π) c τ h |
| 429 | let A (τ : Φ) (h : ℕ) : S × Φ × PairingSide × Option (Fin h) → Fin h → valRingCp p := |
| 430 | congruenceForm p pr S root y τ h |
| 431 | have exists_matrix (τ : Φ) (h : ℕ) : ∃ g : Matrix (Fin h) (Fin h) (valRingCp p), |
| 432 | g.det ∣ ∏ i, α τ h i ∧ ∀ i ∈ univ, ∀ k : Fin h, α τ h i ∣ (g *ᵥ A τ h i) k := |
| 433 | exists_det_dvd_prod_and_dvd_mulVec univ (A τ h) (α τ h) |
| 434 | choose g det_dvd row_dvd using exists_matrix |
| 435 | refine ⟨g, fun e he τ h k h' k' not_exempt ↦ |
| 436 | dvd_sum_pow_mul_newDirection_of_covers hπ h_root |
| 437 | (fun τ h i k ↦ row_dvd τ h i (mem_univ _) k) he (cover e τ h h' not_exempt), ?_⟩ |
| 438 | -- The cost: `det (g τ h)` divides the product of the moduli, whose norm is known. |
| 439 | calc ‖π‖ ^ ∑ e ∈ S, ∑ τ : Φ, deductionTerm p κ N marked τ (pr e τ) e |
| 440 | = ∏ τ : Φ, ∏ h : Fin N, ‖∏ i, α τ h i‖ ^ κ τ h := by |
| 441 | simp only [← cost_eq] |
| 442 | exact norm_rpow_sum_cost_eq_prod_congruenceModulus pr S N κ (fun e : ℕ ↦ h_root e π) c |
| 443 | _ ≤ ∏ τ : Φ, ∏ h : Fin N, ‖((g τ h).det : ℂ_[p])‖ ^ κ τ h := by |
| 444 | gcongr with τ _ h |
| 445 | exact valRingCp.dvd_iff_norm_le.1 (det_dvd τ h) |
| 446 | |
| 447 | end NullFrames |