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 TauCeti.NumberTheory.GaussSum.Basic |
| 4 | public import Lib.Adelic.Adeles.LocalFactors |
| 5 | import Lib.Adelic.Hecke.ClassSums |
| 6 | import Lib.General.Measure.HaarNormalisation |
| 7 | |
| 8 | /-! |
| 9 | # Tame local characters, integral frames and the local Gauss sum |
| 10 | |
| 11 | `F` is a ring satisfying `New.SemilocalField`, modelled on a finite product of non-archimedean local |
| 12 | fields. Its integers are `O`, of volume one, and `ϖ` is a uniformiser. `New.invOnUnits χ` is `χ⁻¹` |
| 13 | on the units of `O` and zero elsewhere. `New.TameLocalChar χ` says that on `O`, `New.invOnUnits χ` |
| 14 | is a primitive character `η` of a finite ring `R` composed with a surjection `π` from `O` onto `R` |
| 15 | with kernel `ϖ O`. The file proves basic facts on such characters, introduces integral frames, and |
| 16 | shows that the Fourier transform of `New.invOnUnits χ` over `O` is γ·χ(ϖ t) when ϖ t is an integral |
| 17 | unit and zero otherwise, for some constant γ with ‖γ‖² = 1 / card R. |
| 18 | |
| 19 | The quadratic Gauss sum that gives the product rule of the Weil representation at the finite places |
| 20 | is a different one; it is in `Lib.Weil.Construction.FiniteCocycle`. |
| 21 | |
| 22 | ## Main definitions and results |
| 23 | |
| 24 | * `New.Exchange.IntegralFrame`: an integral basis in three blocks of columns `K, I, L` with its dual |
| 25 | basis; `New.Exchange.IntegralFrame.blockRelations` lists the relations between the blocks. |
| 26 | * `New.Exchange.exists_local_gauss_sum`: the Fourier transform of the inverse of a tamely ramified |
| 27 | character χ, cut off to the units, equal to γ·χ(ϖ t) when ϖ t is an integral unit and zero |
| 28 | otherwise, for some γ with ‖γ‖² = 1 / card R. |
| 29 | * `New.Exchange.IntegralFrame.stdDatum`: the function x ↦ G(x (K I)) on integral matrices x, zero |
| 30 | elsewhere. |
| 31 | |
| 32 | Notions from other files: |
| 33 | * `New.SemilocalField`: Conditions met by a finite product of non-archimedean local fields: a |
| 34 | locally compact ring with Haar measure, compact open subring O of volume one, a topologically |
| 35 | nilpotent invertible ϖ in O, and `New.IsValuationPair O`. |
| 36 | * `New.HasIntegralConductor`: The additive character ψ is continuous and has conductor O: ψ is |
| 37 | trivial on tO exactly when t lies in O. |
| 38 | * `New.IsIntegralUnit` x: x lies in O and has an inverse in O. `New.IsIntMatrix` O M: every entry of |
| 39 | the matrix M lies in O. |
| 40 | |
| 41 | ## Relation to the literature |
| 42 | |
| 43 | Known result: Gauss sums of a character of the determinant over matrix rings. Only one-dimensional |
| 44 | ramified characters are treated, and the exact value is not computed. For matrices over a finite |
| 45 | ring, the eigen-relation, the vanishing at singular index and the modulus are proved in another file |
| 46 | (`New.Exchange.exists_matrixFourier_eq_mul_inv_det`). This file proves the scalar case |
| 47 | over the integers of a product of local fields, with the modulus. Source: T. Kondo, On Gaussian sums |
| 48 | attached to the general linear groups over finite fields, J. Math. Soc. Japan 15 (1963) 244–255; for |
| 49 | the scalar case over finite rings, E. Lamprecht, Math. Nachr. 9 (1953), see K. Conrad, Gauss and |
| 50 | Jacobi sums on finite fields and Z/mZ, §4; for the local scalar case, Tate's thesis §2.5. |
| 51 | |
| 52 | See also `Lib.Weil.MixedModel.ZeroTerm`. |
| 53 | -/ |
| 54 | |
| 55 | @[expose] public section |
| 56 | |
| 57 | /-! ## First facts on tame local characters -/ |
| 58 | |
| 59 | namespace New.TameLocalChar |
| 60 | |
| 61 | open SemilocalField |
| 62 | |
| 63 | variable {F : Type} [SemilocalField F] {χ : MulChar F ℂ} [h : TameLocalChar χ] |
| 64 | |
| 65 | /-- For a tame character χ and s in O, the function `invOnUnits χ` (χ⁻¹ on the units of O, zero |
| 66 | elsewhere) is unchanged by adding ϖ s: it is invariant under translation by ϖ O. -/ |
| 67 | lemma invOnUnits_uniformizer_mul_add {s : F} (hs : s ∈ O) (x : F) : |
| 68 | invOnUnits χ ((ϖ : Fˣ) * s + x) = invOnUnits χ x := by |
| 69 | have h_mem : ((ϖ : Fˣ) : F) * s ∈ O := mul_mem ϖ_mem hs |
| 70 | by_cases hx : x ∈ O |
| 71 | · -- On `O` the function factors through the reduction `h.reduction`, which kills `ϖ * s`. |
| 72 | have h_zero : h.reduction ⟨(ϖ : Fˣ) * s, h_mem⟩ = 0 := |
| 73 | (h.reduction_surjective_and_eq_zero_iff.right _).mpr (by simpa using hs) |
| 74 | have h_factor : ∀ z : O, invOnUnits χ (z : F) = h.resChar (h.reduction z) := |
| 75 | h.isPrimitive_resChar_and_invOnUnits_eq.right |
| 76 | calc |
| 77 | _ = h.resChar (h.reduction (⟨(ϖ : Fˣ) * s, h_mem⟩ + ⟨x, hx⟩)) := |
| 78 | h_factor (⟨(ϖ : Fˣ) * s, h_mem⟩ + ⟨x, hx⟩) |
| 79 | _ = invOnUnits χ x := by rw [map_add, h_zero, zero_add, ← h_factor] |
| 80 | · -- Off `O` both sides vanish, since `ϖ * s + x` is not in `O` either. |
| 81 | simp [invOnUnits, IsIntegralUnit, add_mem_cancel_left h_mem, hx] |
| 82 | |
| 83 | /-- A tame character χ has absolute value 1 at every unit t of O. -/ |
| 84 | lemma norm_eq_one {t : F} (ht : IsIntegralUnit t) : ‖χ t‖ = 1 := by |
| 85 | -- `(χ t)⁻¹` is the value of `h.resChar` at a unit of the finite residue ring, so a root of unity. |
| 86 | have h_inv_eq : (χ t)⁻¹ = h.resChar (h.reduction ⟨t, ht.left⟩) := by |
| 87 | rw [← h.isPrimitive_resChar_and_invOnUnits_eq.right, invOnUnits, ite_eq_left ht] |
| 88 | have h_unit : IsUnit (h.reduction ⟨t, ht.left⟩) := .map _ (isIntegralUnit_iff_isUnit.1 ht) |
| 89 | have h_ord : IsOfFinOrder (χ t)⁻¹ := by |
| 90 | rw [h_inv_eq] |
| 91 | exact h.resChar.toMonoidHom.isOfFinOrder h_unit.isOfFinOrder |
| 92 | simpa using h_ord.norm_eq_one |
| 93 | |
| 94 | /-- For a tame character χ, the function `invOnUnits χ` (χ⁻¹ on the units of O, zero elsewhere) is |
| 95 | locally constant. -/ |
| 96 | lemma isLocallyConstant_invOnUnits : IsLocallyConstant (invOnUnits χ) := by |
| 97 | -- The function is unchanged by adding an element of `ϖ * O`, a neighbourhood of zero. |
| 98 | have h_nhds : {y : F | ((ϖ⁻¹ : Fˣ) : F) * y ∈ O} ∈ nhds 0 := |
| 99 | (isOpen_O.preimage_of_continuous (f := fun y ↦ ((ϖ⁻¹ : Fˣ) : F) * y)).mem_nhds (by simp) |
| 100 | refine isLocallyConstant_of_eventually_add (.mono h_nhds fun y hy x ↦ ?_) |
| 101 | simpa [add_comm] using h.invOnUnits_uniformizer_mul_add hy x |
| 102 | |
| 103 | end New.TameLocalChar |
| 104 | |
| 105 | /-! ## Integral frames and the local Gauss sum -/ |
| 106 | |
| 107 | namespace New.Exchange |
| 108 | |
| 109 | open Matrix MeasureTheory SemilocalField Fintype |
| 110 | |
| 111 | attribute [local instance low] Fintype.ofFinite |
| 112 | |
| 113 | /-- An integral invertible matrix over F cut into column blocks (K I L), with its integral inverse |
| 114 | cut into row blocks `dualK`, `dualI`, `dualL`; the blocks K and L have `p` columns, I has `n`. -/ |
| 115 | structure IntegralFrame (F : Type*) [SemilocalField F] (m n p : Type) [Fintype m] [DecidableEq m] |
| 116 | [Fintype n] [DecidableEq n] [Fintype p] [DecidableEq p] where |
| 117 | /-- The first block of columns of the basis. -/ |
| 118 | K : Matrix m p F |
| 119 | /-- The last block of columns of the basis. -/ |
| 120 | L : Matrix m p F |
| 121 | /-- The middle block of columns of the basis. -/ |
| 122 | I : Matrix m n F |
| 123 | /-- The block of rows of the dual basis that is dual to `K`. -/ |
| 124 | dualK : Matrix p m F |
| 125 | /-- The block of rows of the dual basis that is dual to `L`. -/ |
| 126 | dualL : Matrix p m F |
| 127 | /-- The block of rows of the dual basis that is dual to `I`. -/ |
| 128 | dualI : Matrix n m F |
| 129 | /-- The matrix `P` with column blocks `K, I, L` and the matrix `Q` with row blocks |
| 130 | `dualK, dualI, dualL` have entries in `O` and are inverse to each other. -/ |
| 131 | isIntMatrix_and_mul_eq_one : |
| 132 | let P : Matrix m (p ⊕ n ⊕ p) F := fromCols K (fromCols I L) |
| 133 | let Q : Matrix (p ⊕ n ⊕ p) m F := fromRows dualK (fromRows dualI dualL) |
| 134 | IsIntMatrix O P ∧ IsIntMatrix O Q ∧ P * Q = 1 ∧ Q * P = 1 |
| 135 | |
| 136 | -- `Type _` lets each declaration fix the universe of `F`: some need `Type`, others stay general. |
| 137 | variable {F : Type _} [SemilocalField F] {m n p a : Type} [Fintype m] [DecidableEq m] [Fintype n] |
| 138 | [DecidableEq n] [Fintype p] [DecidableEq p] |
| 139 | |
| 140 | omit [DecidableEq n] [Fintype p] [DecidableEq p] in |
| 141 | /-- Selecting rows of `M` and then multiplying by `N` selects the same rows of `M * N`. -/ |
| 142 | @[simp] lemma submatrix_id_mul {c : Type*} (f : c → a) (M : Matrix a n F) (N : Matrix n p F) : |
| 143 | M.submatrix f id * N = (M * N).submatrix f id := rfl |
| 144 | |
| 145 | open scoped Classical in |
| 146 | /-- Dividing by `invOnUnits χ x` multiplies by `χ x` if `x` is a unit of `O`; otherwise it is a |
| 147 | division by zero, which gives zero. -/ |
| 148 | lemma div_invOnUnits (χ : MulChar F ℂ) (γ : ℂ) (x : F) : |
| 149 | γ / invOnUnits χ x = if IsIntegralUnit x then γ * χ x else 0 := by |
| 150 | rw [invOnUnits] |
| 151 | split_ifs <;> simp |
| 152 | |
| 153 | /-- For a primitive multiplicative character, the Gauss sum at an additive shift by `b` is |
| 154 | the original Gauss sum times `χ⁻¹ b`. For a nonunit `b`, the shifted sum vanishes. -/ |
| 155 | private lemma gaussSum_mulShift_of_isPrimitiveMulChar {R : Type*} [CommRing R] [Fintype R] |
| 156 | {χ : MulChar R ℂ} (hχ : Exchange.IsPrimitiveMulChar χ) (ψ : AddChar R ℂ) (b : R) : |
| 157 | gaussSum χ (ψ.mulShift b) = χ⁻¹ b * gaussSum χ ψ := by |
| 158 | by_cases hb : IsUnit b |
| 159 | · obtain ⟨u, rfl⟩ := hb |
| 160 | exact gaussSum_mulShift_eq χ ψ u |
| 161 | · -- A nonunit in a finite ring annihilates a nonzero element. |
| 162 | obtain ⟨x, hbx, hx⟩ : ∃ x : R, b * x = 0 ∧ x ≠ 0 := by |
| 163 | by_contra! h |
| 164 | exact hb (isLeftRegular_iff_right_eq_zero_of_mul.2 h).isUnit_of_finite |
| 165 | obtain ⟨c, hc_ne_zero, hc_ne_one⟩ := hχ x hx |
| 166 | have hc_unit : IsUnit (1 + c * x) := by |
| 167 | by_contra hc |
| 168 | exact hc_ne_zero (χ.map_nonunit hc) |
| 169 | let u : Rˣ := hc_unit.unit |
| 170 | have hu : (u : R) = 1 + c * x := hc_unit.unit_spec |
| 171 | have hbu : b * (u - 1) = 0 := by |
| 172 | rw [hu, add_sub_cancel_left, mul_left_comm b c, hbx, mul_zero] |
| 173 | rw [MulChar.gaussSum_mulShift_eq_zero_of_mul_sub_one_eq_zero χ ψ hbu |
| 174 | (by simpa [hu] using hc_ne_one), χ⁻¹.map_nonunit hb, zero_mul] |
| 175 | |
| 176 | open scoped Classical in |
| 177 | /-- For a tame character `χ` (`hχ`) and continuous additive character `ψ` (`hψ_cont`) on a semilocal |
| 178 | field `F` with integers `O` and uniformizer `ϖ`, suppose `φ` is an additive character of the |
| 179 | residue ring `hχ.ResidueRing` satisfying `φ (hχ.reduction x) = ψ (ϖ⁻¹ * x)` on `O` (`hφψ`), |
| 180 | `hχ.resChar` pulls back to `invOnUnits χ` on `O` (`hη`), and the Gauss sum of `φ.mulShift u` equals |
| 181 | `hχ.resChar⁻¹ u` times that of `φ` (`h_gaussShift`). For any `t : F` with `ϖ * t ∈ O` (`ht`) such |
| 182 | that the integral of `invOnUnits χ x * ψ (t * x)` over `O` is invariant under translation by |
| 183 | elements of `O` (`h_shift`), averaging over representatives of `hχ.ResidueRing` evaluates that |
| 184 | integral as `gaussSum hχ.resChar φ / card hχ.ResidueRing / invOnUnits χ (ϖ * t)`. -/ |
| 185 | private lemma integral_invOnUnits_mul_of_mem_O {χ : MulChar F ℂ} (hχ : TameLocalChar χ) |
| 186 | {ψ : AddChar F ℂ} (hψ_cont : Continuous ψ) {φ : AddChar hχ.ResidueRing ℂ} |
| 187 | (hφψ : ∀ x : (O : Subring F), φ (hχ.reduction x) = ψ (((ϖ⁻¹ : Fˣ) : F) * x)) |
| 188 | (hη : ∀ x : (O : Subring F), invOnUnits χ x.val = hχ.resChar (hχ.reduction x)) |
| 189 | (h_gaussShift : ∀ u : hχ.ResidueRing, |
| 190 | gaussSum hχ.resChar (φ.mulShift u) = hχ.resChar⁻¹ u * gaussSum hχ.resChar φ) |
| 191 | {t : F} (ht : (ϖ : Fˣ) * t ∈ O) |
| 192 | (h_shift : ∀ s ∈ (O : Subring F), |
| 193 | ∫ x in (O : Subring F), invOnUnits χ (s + x) * ψ (t * (s + x)) = |
| 194 | ∫ x in (O : Subring F), invOnUnits χ x * ψ (t * x)) : |
| 195 | ∫ x in (O : Subring F), invOnUnits χ x * ψ (t * x) = |
| 196 | gaussSum hχ.resChar φ / card hχ.ResidueRing / invOnUnits χ ((ϖ : Fˣ) * t) := by |
| 197 | have h_cont : Continuous (invOnUnits χ) := hχ.isLocallyConstant_invOnUnits.continuous |
| 198 | let Γ : ℂ := gaussSum hχ.resChar φ |
| 199 | let f (x : F) : ℂ := invOnUnits χ x * ψ (t * x) |
| 200 | let rep : hχ.ResidueRing → (O : Subring F) := |
| 201 | Function.surjInv hχ.reduction_surjective_and_eq_zero_iff.1 |
| 202 | let u : hχ.ResidueRing := hχ.reduction ⟨(ϖ : Fˣ) * t, ht⟩ |
| 203 | -- on `O`, the function `f` factors through `ResidueRing` |
| 204 | have h_factor (z : (O : Subring F)) : |
| 205 | f z = hχ.resChar (hχ.reduction z) * φ (u * hχ.reduction z) := by |
| 206 | simp [f, u, hη, ← map_mul, hφψ, mul_assoc] |
| 207 | have h_sum (x : (O : Subring F)) : ∑ r, f (rep r + x) = hχ.resChar⁻¹ u * Γ := by |
| 208 | -- Translation by `reduction x` permutes the residue ring. |
| 209 | calc ∑ r, f (rep r + x) = gaussSum hχ.resChar (φ.mulShift u) := |
| 210 | sum_equiv (.addRight (hχ.reduction x)) _ _ fun r ↦ by |
| 211 | simpa [gaussSum, rep, Function.surjInv_eq, AddChar.mulShift_apply] |
| 212 | using h_factor (rep r + x) |
| 213 | _ = hχ.resChar⁻¹ u * Γ := h_gaussShift u |
| 214 | have h_avg : (∫ x in (O : Subring F), f x) * card hχ.ResidueRing = hχ.resChar⁻¹ u * Γ := by |
| 215 | calc (∫ x in (O : Subring F), f x) * card hχ.ResidueRing |
| 216 | _ = ∑ r, ∫ x in (O : Subring F), f (rep r + x) := by |
| 217 | rw [mul_comm] |
| 218 | simp [f, h_shift] |
| 219 | _ = ∫ x in (O : Subring F), ∑ r, f (rep r + x) := |
| 220 | (integral_finsetSum _ fun r _ ↦ |
| 221 | ContinuousOn.integrableOn_compact isCompact_O (by fun_prop)).symm |
| 222 | _ = ∫ _ : F in (O : Subring F), hχ.resChar⁻¹ u * Γ := |
| 223 | setIntegral_congr_fun isCompact_O.measurableSet fun x hx ↦ h_sum ⟨x, hx⟩ |
| 224 | _ = hχ.resChar⁻¹ u * Γ := by simp [Set.univ_inter, volume_O, Measure.real] |
| 225 | simpa [u, hη ⟨_, ht⟩, MulChar.inv_apply_eq_inv', field] using h_avg |
| 226 | |
| 227 | open scoped Classical in |
| 228 | /-- The local Gauss sum. Let `F` be semilocal, with Haar measure giving `O` volume one. Let `χ` be |
| 229 | tame, that is, `χ⁻¹` on the units of `O` is the pullback of a primitive character of the finite |
| 230 | residue ring `R = O / ϖ`, and let `ψ` be a continuous additive character of conductor `O`, so that |
| 231 | `ψ` is trivial on `t O` exactly when `t ∈ O`. Then there is `γ` such that (a) |
| 232 | `‖γ‖ ^ 2 = (card R)⁻¹`, and (b) for every `t`, the integral over `O` of the product of |
| 233 | `invOnUnits χ x` (which is `χ⁻¹` on the units and `0` elsewhere) and `ψ (t x)` equals `γ χ(ϖ t)` |
| 234 | if `ϖ t` is a unit of `O`, and `0` otherwise. -/ |
| 235 | lemma exists_local_gauss_sum {χ : MulChar F ℂ} (hχ : TameLocalChar χ) {ψ : AddChar F ℂ} |
| 236 | (hψ : HasIntegralConductor ψ) : |
| 237 | ∃ γ : ℂ, |
| 238 | -- (a) the size of the Gauss sum |
| 239 | ‖γ‖ ^ 2 = (Nat.card hχ.ResidueRing : ℝ)⁻¹ ∧ |
| 240 | -- (b) the Fourier transform of `invOnUnits χ` on the integers |
| 241 | ∀ t : F, |
| 242 | ∫ x : F in (O : Subring F), invOnUnits χ x * ψ (t * x) = |
| 243 | if IsIntegralUnit ((ϖ : Fˣ) * t) then γ * χ ((ϖ : Fˣ) * t) else 0 := by |
| 244 | -- Averaging over representatives of `ResidueRing = O / ϖ` gives the scalar Gauss sum. |
| 245 | -- Its primitive additive character `φ` satisfies `φ (reduction x) = ψ (ϖ⁻¹ * x)`. |
| 246 | obtain ⟨hψ_cont, hψ_cond⟩ := hψ |
| 247 | obtain ⟨φ, hφ_prim, hφψ⟩ := exists_primitive_residue_addChar |
| 248 | hχ.reduction_surjective_and_eq_zero_iff hψ_cond |
| 249 | obtain ⟨h_prim, hη⟩ := hχ.isPrimitive_resChar_and_invOnUnits_eq |
| 250 | let Γ : ℂ := gaussSum hχ.resChar φ |
| 251 | have h_gaussShift := gaussSum_mulShift_of_isPrimitiveMulChar h_prim φ |
| 252 | have h_norm : ‖Γ‖ ^ 2 = card hχ.ResidueRing := by |
| 253 | dsimp [Γ] |
| 254 | rw [TauCeti.norm_gaussSum_of_forall_mulShift h_gaussShift hφ_prim, |
| 255 | Real.sq_sqrt (Nat.cast_nonneg _)] |
| 256 | refine ⟨Γ / card hχ.ResidueRing, by simpa [field] using h_norm, fun t ↦ ?_⟩ |
| 257 | let f (x : F) : ℂ := invOnUnits χ x * ψ (t * x) |
| 258 | suffices h_div : ∫ x in (O : Subring F), f x = |
| 259 | Γ / card hχ.ResidueRing / invOnUnits χ ((ϖ : Fˣ) * t) by rw [h_div, div_invOnUnits] |
| 260 | have h_shift (s : F) (hs : s ∈ O) : |
| 261 | ∫ x in (O : Subring F), f (s + x) = ∫ x in (O : Subring F), f x := |
| 262 | setIntegral_add_left_eq_self_of_mem (M := O.toAddSubgroup) f hs |
| 263 | by_cases ht : (ϖ : Fˣ) * t ∈ O |
| 264 | · exact integral_invOnUnits_mul_of_mem_O hχ hψ_cont hφψ hη h_gaussShift ht h_shift |
| 265 | · -- translating by `ϖ * s` multiplies the integral by `ψ (ϖ * t * s)`, which is not always `1` |
| 266 | have h_zero : ∫ x in (O : Subring F), f x = 0 := by |
| 267 | by_contra h_ne |
| 268 | refine ht ((hψ_cond _).1 fun s hs ↦ (mul_eq_right₀ h_ne).1 ?_) |
| 269 | simpa [f, hχ.invOnUnits_uniformizer_mul_add, hs, mul_add, ψ.map_add_eq_mul, |
| 270 | integral_const_mul, |
| 271 | mul_left_comm _ (ψ _), mul_left_comm t, mul_assoc] using h_shift _ (O.mul_mem ϖ_mem hs) |
| 272 | simp [h_zero, invOnUnits, IsIntegralUnit, ht] |
| 273 | |
| 274 | /-- The six blocks of an integral frame have entries in `O`, and each block of the dual basis |
| 275 | is a left inverse of its own block of the basis and vanishes on the other two. -/ |
| 276 | structure IntegralFrame.BlockRelations (A : IntegralFrame F m n p) : Prop where |
| 277 | /-- The block `dualL` has entries in `O`. -/ |
| 278 | isIntMatrix_dualL : IsIntMatrix O A.dualL |
| 279 | /-- The block `dualI` has entries in `O`. -/ |
| 280 | isIntMatrix_dualI : IsIntMatrix O A.dualI |
| 281 | /-- The block `K` has entries in `O`. -/ |
| 282 | isIntMatrix_K : IsIntMatrix O A.K |
| 283 | /-- The block `L` has entries in `O`. -/ |
| 284 | isIntMatrix_L : IsIntMatrix O A.L |
| 285 | /-- The block `dualK` has entries in `O`. -/ |
| 286 | isIntMatrix_dualK : IsIntMatrix O A.dualK |
| 287 | /-- The block `I` has entries in `O`. -/ |
| 288 | isIntMatrix_I : IsIntMatrix O A.I |
| 289 | /-- `dualK` is a left inverse of `K`. -/ |
| 290 | dualK_mul_K : A.dualK * A.K = 1 |
| 291 | /-- The rows of `dualI` vanish on the columns of `K`. -/ |
| 292 | dualI_mul_K : A.dualI * A.K = 0 |
| 293 | /-- The rows of `dualL` vanish on the columns of `K`. -/ |
| 294 | dualL_mul_K : A.dualL * A.K = 0 |
| 295 | /-- The rows of `dualK` vanish on the columns of `I`. -/ |
| 296 | dualK_mul_I : A.dualK * A.I = 0 |
| 297 | /-- `dualI` is a left inverse of `I`. -/ |
| 298 | dualI_mul_I : A.dualI * A.I = 1 |
| 299 | /-- The rows of `dualL` vanish on the columns of `I`. -/ |
| 300 | dualL_mul_I : A.dualL * A.I = 0 |
| 301 | /-- The rows of `dualK` vanish on the columns of `L`. -/ |
| 302 | dualK_mul_L : A.dualK * A.L = 0 |
| 303 | /-- The rows of `dualI` vanish on the columns of `L`. -/ |
| 304 | dualI_mul_L : A.dualI * A.L = 0 |
| 305 | /-- `dualL` is a left inverse of `L`. -/ |
| 306 | dualL_mul_L : A.dualL * A.L = 1 |
| 307 | |
| 308 | /-- The relations `New.Exchange.IntegralFrame.BlockRelations` hold in every integral frame: its six |
| 309 | blocks have entries in `O`, and each block of the dual basis is a left inverse of its own block |
| 310 | of the basis and vanishes on the other two. They are read off block by block from |
| 311 | `A.isIntMatrix_and_mul_eq_one`. -/ |
| 312 | lemma IntegralFrame.blockRelations (A : IntegralFrame F m n p) : A.BlockRelations := by |
| 313 | obtain ⟨hP, hQ, -, hQP⟩ := A.isIntMatrix_and_mul_eq_one |
| 314 | simp only [IsIntMatrix, Sum.forall, fromCols_apply_inl, fromCols_apply_inr, |
| 315 | fromRows_apply_inl, fromRows_apply_inr, forall_and] at hP hQ |
| 316 | have hQP' (i j : p ⊕ n ⊕ p) : |
| 317 | (fromRows A.dualK (fromRows A.dualI A.dualL) * fromCols A.K (fromCols A.I A.L)) i j = |
| 318 | (1 : Matrix (p ⊕ n ⊕ p) (p ⊕ n ⊕ p) F) i j := by rw [hQP] |
| 319 | simp only [Sum.forall, fromRows_mul, mul_fromCols, fromRows_apply_inl, fromRows_apply_inr, |
| 320 | fromCols_apply_inl, fromCols_apply_inr, Matrix.one_apply, Sum.inl.injEq, Sum.inr.injEq, |
| 321 | reduceCtorEq, ↓reduceIte, forall_and] at hQP' |
| 322 | constructor <;> |
| 323 | first |
| 324 | | exact fun i j ↦ by simp [hP, hQ] |
| 325 | | exact ext fun i j ↦ by simp [Matrix.one_apply, hQP'] |
| 326 | |
| 327 | open scoped Classical in |
| 328 | /-- For an integral frame A with blocks K, I, L and a function G on `a × (p ⊕ n)` matrices, the |
| 329 | function of an `a × m` matrix x equal to G(x·(K I)) if x has entries in O and 0 otherwise. -/ |
| 330 | noncomputable def IntegralFrame.stdDatum (A : IntegralFrame F m n p) (G : Matrix a (p ⊕ n) F → ℂ) |
| 331 | (x : Matrix a m F) : ℂ := |
| 332 | if IsIntMatrix O x then G (x * A.K.fromCols A.I) else 0 |
| 333 | |
| 334 | end New.Exchange |
| 335 | |
| 336 | /-! |
| 337 | ## Multiplicativity of the character cut off to units |
| 338 | |
| 339 | `New.invOnUnits_mul`: `New.invOnUnits χ` is multiplicative on `O`, since a product in `O` is a unit |
| 340 | exactly when both factors are. |
| 341 | -/ |
| 342 | |
| 343 | /-- For x and y in O, `invOnUnits χ (x y) = invOnUnits χ x * invOnUnits χ y`. -/ |
| 344 | lemma New.invOnUnits_mul {F : Type} [V : SemilocalField F] {χ : MulChar F ℂ} {x y : F} |
| 345 | (hx : x ∈ V.O) (hy : y ∈ V.O) : |
| 346 | invOnUnits χ (x * y) = invOnUnits χ x * invOnUnits χ y := by |
| 347 | classical |
| 348 | -- A product in `O` is a unit of `O` exactly when both factors are. |
| 349 | simp only [invOnUnits, isIntegralUnit_mul_iff hx hy, map_mul, mul_inv, ite_zero_mul_ite_zero] |