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.Algebra.AffineMonoid.UniqueSums |
| 4 | import Mathlib.Algebra.MvPolynomial.NoZeroDivisors |
| 5 | import Mathlib.FieldTheory.PurelyInseparable.Exponent |
| 6 | import Mathlib.RingTheory.PiTensorProduct |
| 7 | import Mathlib.RingTheory.PicardGroup |
| 8 | public import Lib.GaloisRep.Main.Defs |
| 9 | public import Lib.General.LinearAlgebra.MatrixPolynomials |
| 10 | |
| 11 | /-! |
| 12 | # Free cocharacter weights force rank n and identify killing polynomials |
| 13 | |
| 14 | A Galois representation that is only known to be killed, for most Frobenius elements (the filter |
| 15 | `New.mostFrobenii`), by monic polynomials of degree `n` is shown to have rank `n`, given that the |
| 16 | span of its image contains the diagonal matrices and that a one-parameter torus with `n` free |
| 17 | weights (`New.HasNoSmallRelations`) lies in the Zariski closure of a conjugate of the image of every |
| 18 | neighbourhood of `1`. |
| 19 | |
| 20 | * `New.powMinor y m a`: a minor of order `m` of the matrix whose column `j < m` lists the entries of |
| 21 | `y ^ j`. Over a field all of them vanish exactly when `1, y, …, y ^ (m - 1)` are linearly |
| 22 | dependent. |
| 23 | * `New.exists_factor_charpoly`: over an integrally closed domain, if these minors all vanish, a |
| 24 | factor of degree less than `m` of the characteristic polynomial of `y` kills `y`. |
| 25 | * `New.HasNoSmallRelations.inv_scalar_on_blocks`: if these minors vanish, with `m ≤ n + 1` and `c` |
| 26 | surjective, for `diagonal (T ∘ e ∘ c) * x` over the Laurent polynomials, then `n < m` and on each |
| 27 | fibre of `c` the block of `x⁻¹` is a scalar matrix. |
| 28 | * `New.card_eq_and_charpoly_eq`: the rank is `n` and the polynomials are the characteristic |
| 29 | polynomials. |
| 30 | |
| 31 | Notions from other files: |
| 32 | * `New.Ω`: the field `Ω` is an algebraic closure of `ℚ`: it has characteristic zero, is |
| 33 | algebraically closed and is algebraic over `ℚ`. |
| 34 | * `New.HasNoSmallRelations e`: for `e : Fin n → ℤ`, distinct exponent vectors `α` of the same total |
| 35 | degree at most `(n + 1) ^ 2` have distinct weights `∑ i, α i * e i`. |
| 36 | * `New.FrobeniusDatum E`: a place of degree one of `E` with a Frobenius element `frob` above it. |
| 37 | * `New.mostFrobenii E`: the filter of sets of such data that, inside every nonempty open set of |
| 38 | `Gal(Ω/E)`, contain all data at almost all places whose Frobenius lies in a smaller nonempty open |
| 39 | set. |
| 40 | * `T i`: the monomial of degree `i` in the Laurent polynomials `k[T;T⁻¹]`. |
| 41 | |
| 42 | ## Relation to the literature |
| 43 | |
| 44 | Known result: Rank n and characteristic polynomials from Frobenius polynomial relations. Let a |
| 45 | continuous representation have image spanning the diagonal matrices, and let monic degree-n |
| 46 | polynomials kill it at most Frobenius elements. If a cocharacter with free (very different) |
| 47 | exponents constrains it, then its rank is n and the polynomials are its characteristic polynomials |
| 48 | at most Frobenius elements. This is one step inside the known construction of Galois representations |
| 49 | for definite unitary groups. In the literature, Frobenius polynomial relations on a dense set |
| 50 | determine a representation when the n-dimensional one is known and large. Related work: |
| 51 | Boston–Lenstra–Ribet 1991; Nekovář, Eichler–Shimura relations and semisimplicity, 2018; |
| 52 | Fayad–Nekovář 2019; Harris–Taylor 2001, VII.1.8. |
| 53 | |
| 54 | See also `Lib.GaloisRep.Main.OddRank`. |
| 55 | -/ |
| 56 | |
| 57 | @[expose] public section |
| 58 | |
| 59 | namespace New |
| 60 | |
| 61 | open Matrix MvPolynomial Polynomial Finset Algebra Fintype Submodule Function ConjAct |
| 62 | LaurentPolynomial Fin Filter |
| 63 | |
| 64 | variable {k K N R S A : Type} [NormedField k] [Fintype N] [DecidableEq N] [CommRing R] [CommRing S] |
| 65 | {m n : ℕ} {e : Fin n → ℤ} |
| 66 | (y : Matrix N N R) [NormedField K] [NormedAlgebra K k] [CommRing A] [Algebra A R] [Algebra A S] |
| 67 | |
| 68 | /-- The minor of order `m`, at the rows `a 0, …, a (m - 1)`, of the matrix with rows indexed by |
| 69 | `N × N` whose column `j < m` lists the entries of the square matrix `y ^ j`: its entry at `(i, j)` |
| 70 | is the entry of `y ^ j` at the place `a i`. -/ |
| 71 | noncomputable abbrev powMinor (m : ℕ) (a : Fin m → N × N) : R := |
| 72 | (of (flip (fun j : Fin m ↦ uncurry (y ^ j.val)) ∘ a)).det |
| 73 | |
| 74 | /-- An algebra map `φ` takes `powMinor y m a` to `powMinor (φ.mapMatrix y) m a`. -/ |
| 75 | @[simp] |
| 76 | lemma map_powMinor (a : Fin m → N × N) (φ : R →ₐ[A] S) : |
| 77 | φ (powMinor y m a) = powMinor (φ.mapMatrix y) m a := by |
| 78 | have h_pow (j : ℕ) : y.map φ ^ j = (y ^ j).map φ := (map_pow φ.mapMatrix y j).symm |
| 79 | rw [powMinor, powMinor, φ.map_det] |
| 80 | congr 1 |
| 81 | ext i j |
| 82 | simp [h_pow, flip, uncurry] |
| 83 | |
| 84 | /-- Let `y` be a square matrix over an integrally closed domain `R`. If all minors `powMinor y m a` |
| 85 | of its first `m` powers vanish, then `y.charpoly = p * q` with `p` of degree less than `m` and |
| 86 | `p(y) = 0`. -/ |
| 87 | lemma exists_factor_charpoly [IsDomain R] [IsIntegrallyClosed R] |
| 88 | (h_minor : ∀ a : Fin m → N × N, powMinor y m a = 0) : |
| 89 | ∃ p q : R[X], y.charpoly = p * q ∧ p.natDegree < m ∧ p.aeval y = 0 := by |
| 90 | -- Over the fraction field the first `m` powers of `y` are dependent. |
| 91 | let F : Type := FractionRing R |
| 92 | let z : Matrix N N F := (ofId R F).mapMatrix y |
| 93 | have h_lt : (minpoly F z).natDegree < m := by |
| 94 | by_contra! h_le |
| 95 | have hz_minor (a : Fin m → N × N) : powMinor z m a = 0 := by |
| 96 | rw [← map_powMinor y a (ofId R F), h_minor a, map_zero] |
| 97 | have h_pow : LinearIndependent F fun j : Fin m ↦ z ^ (j : ℕ) := |
| 98 | (linearIndependent_pow z).comp (castLE h_le) (castLE_injective h_le) |
| 99 | exact det_eval_eq_zero_iff_not_linearIndependent.mp hz_minor |
| 100 | (h_pow.of_comp (LinearEquiv.curry (R := F) (M := F) (V := N) (V₂ := N)).toLinearMap) |
| 101 | -- By Gauss's lemma the minimal polynomial comes from a monic factor `p` of `y.charpoly`. |
| 102 | have h_monic : (minpoly F z).Monic := minpoly.monic z.isIntegral |
| 103 | have h_dvd : minpoly F z ∣ y.charpoly.map (algebraMap R F) := |
| 104 | z.minpoly_dvd_charpoly.trans (charpoly_map y (algebraMap R F)).dvd |
| 105 | have h_lifts : minpoly F z ∈ lifts (algebraMap R F) := by |
| 106 | obtain ⟨g, hg⟩ := IsIntegrallyClosed.eq_map_mul_C_of_dvd F y.charpoly_monic h_dvd |
| 107 | exact (mem_lifts _).mpr ⟨g, by simpa [h_monic.leadingCoeff] using hg⟩ |
| 108 | obtain ⟨p, hp, hp_deg, hp_monic⟩ := lifts_and_natDegree_eq_and_monic h_lifts h_monic |
| 109 | obtain ⟨q, hq⟩ : p ∣ y.charpoly := |
| 110 | (map_dvd_map (algebraMap R F) (IsFractionRing.injective R F) hp_monic).mp (by rwa [hp]) |
| 111 | -- The image of `p(y)` over `F` is `p(z)`, a value of the minimal polynomial of `z`. |
| 112 | have hz_root : (ofId R F).mapMatrix (p.aeval y) = 0 := by |
| 113 | rw [← aeval_algHom_apply, ← Polynomial.aeval_map_algebraMap F, hp, minpoly.aeval] |
| 114 | exact ⟨p, q, hq, by lia, Matrix.map_injective (IsFractionRing.injective R F) |
| 115 | (by simpa [ofId] using hz_root)⟩ |
| 116 | |
| 117 | /-- Let `c : N → Fin n` and let `x` be a matrix over `k`. Each minor `powMinor` of order `m` of |
| 118 | the product of the diagonal matrix with entries `X (c a)` and `x`, over the polynomials in the |
| 119 | variables `X i`, is homogeneous of degree `∑ i : Fin m, i`. -/ |
| 120 | private lemma isHomogeneous_powMinor_diagonal_X_mul (c : N → Fin n) (x : Matrix N N k) |
| 121 | (a : Fin m → N × N) : |
| 122 | (powMinor (diagonal (X ∘ c) * x.map MvPolynomial.C) m a).IsHomogeneous |
| 123 | (∑ i : Fin m, (i : ℕ)) := by |
| 124 | set y : Matrix N N (MvPolynomial (Fin n) k) := diagonal (X ∘ c) * x.map MvPolynomial.C |
| 125 | -- Each entry of `y ^ j` is homogeneous of degree `j`. |
| 126 | have hy (j : ℕ) : ∀ a b : N, ((y ^ j) a b).IsHomogeneous j := by |
| 127 | induction j with |
| 128 | | zero => simp [← totalDegree_zero_iff_isHomogeneous, Matrix.one_apply, apply_ite] |
| 129 | | succ j ih => |
| 130 | simp_all [y, pow_add, Matrix.mul_apply, diagonal, mul_comm (X _), isHomogeneous_C_mul_X, |
| 131 | IsHomogeneous.mul, IsHomogeneous.sum] |
| 132 | -- In the Leibniz formula each product `∏ i, (y ^ i) (a (σ i))` has degree `∑ i, i`. |
| 133 | rw [powMinor, det_apply'] |
| 134 | refine IsHomogeneous.sum (h := fun σ _ ↦ ?_) |
| 135 | rw [← map_intCast (MvPolynomial.C : k →+* MvPolynomial (Fin n) k)] |
| 136 | exact (IsHomogeneous.prod (h := fun (i : Fin m) _ ↦ hy i (a (σ i)).fst (a (σ i)).snd)).C_mul _ |
| 137 | |
| 138 | /-- Let the weights `e : Fin n → ℤ` be free (`HasNoSmallRelations e`: distinct exponent vectors of |
| 139 | one total degree at most `(n + 1) ^ 2` have distinct weights `∑ i, α i * e i`), let `c : N → Fin n`, |
| 140 | let `x` be an invertible matrix over `k` and let `m ≤ n + 1`. If all minors `powMinor` of order `m` |
| 141 | of the product of the diagonal matrix with entries `T (e (c a))` and `x` over `k[T;T⁻¹]` vanish, |
| 142 | then so do those of the product of the diagonal matrix with entries `X (c a)` and `x` over the |
| 143 | polynomials in the variables `X i`. -/ |
| 144 | private lemma powMinor_diagonal_X_mul_eq_zero {c : N → Fin n} (he : HasNoSmallRelations e) |
| 145 | {x : GL N k} (hm_le : m ≤ n + 1) |
| 146 | (h_vanish : ∀ a : Fin m → N × N, |
| 147 | powMinor (diagonal (T ∘ e ∘ c) * (x : Matrix N N k).map LaurentPolynomial.C) m a = 0) |
| 148 | (a : Fin m → N × N) : |
| 149 | powMinor (diagonal (X ∘ c) * (x : Matrix N N k).map MvPolynomial.C) m a = 0 := by |
| 150 | set y : Matrix N N (MvPolynomial (Fin n) k) := |
| 151 | diagonal (X ∘ c) * (x : Matrix N N k).map MvPolynomial.C |
| 152 | -- The substitution `X i ↦ T (e i)` sends the minor to zero. |
| 153 | let ψ : MvPolynomial (Fin n) k →ₐ[k] k[T;T⁻¹] := |
| 154 | AddMonoidAlgebra.mapDomainAlgHom k k (Finsupp.weight e) |
| 155 | have hψ_X (i : Fin n) : ψ (X i) = T (e i) := by |
| 156 | simp [ψ, MvPolynomial.X, ← MvPolynomial.single_eq_monomial, Finsupp.weight_single] |
| 157 | have h_subst : ψ.mapMatrix y = |
| 158 | diagonal (T ∘ e ∘ c) * (x : Matrix N N k).map LaurentPolynomial.C := by |
| 159 | ext i j |
| 160 | simp [y, hψ_X, LaurentPolynomial.algebraMap_apply] |
| 161 | have h_zero : ψ (powMinor y m a) = 0 := by rw [map_powMinor, h_subst, h_vanish a] |
| 162 | -- The monomials of the minor have one degree `≤ (n + 1) ^ 2`, so by freeness the substitution |
| 163 | -- keeps them apart. |
| 164 | have h_deg : ∑ i : Fin m, (i : ℕ) ≤ (n + 1) ^ 2 := by |
| 165 | grw [isLt, ← hm_le] |
| 166 | simp [sq] |
| 167 | have h_inj : Set.InjOn (Finsupp.weight e) (powMinor y m a).support := |
| 168 | (he (∑ i : Fin m, (i : ℕ)) h_deg).mono |
| 169 | ((homogeneousSubmodule_eq_finsupp_supported (Fin n) k (∑ i : Fin m, (i : ℕ))).le |
| 170 | (isHomogeneous_powMinor_diagonal_X_mul c x a)) |
| 171 | -- As `ψ` is injective on the monomials of the minor, the minor is zero. |
| 172 | have h_support : (ψ (powMinor y m a)).coeff.support = |
| 173 | (powMinor y m a).support.image (Finsupp.weight e) := |
| 174 | Finsupp.mapDomain_support_of_injOn _ h_inj |
| 175 | rw [h_zero] at h_support |
| 176 | simpa using h_support.symm |
| 177 | |
| 178 | /-- Let the weights `e : Fin n → ℤ` be free (`HasNoSmallRelations e`: distinct exponent vectors of |
| 179 | one total degree at most `(n + 1) ^ 2` have distinct weights `∑ i, α i * e i`), let `c : N → Fin n` |
| 180 | be onto, let `x` be an invertible matrix over `k`, let `m ≤ n + 1`, and let `y` be the product, over |
| 181 | the Laurent polynomials `k[T;T⁻¹]`, of the diagonal matrix with entries `T (e (c a))` and `x`. |
| 182 | Suppose every `powMinor y m a` vanishes, where `powMinor y m a` is the `m × m` minor at rows |
| 183 | `a 0, …, a (m - 1)` of the matrix with rows indexed by `N × N` whose column `j < m` lists the |
| 184 | entries of `y ^ j`. Then `n < m`, and for `a ≠ b` with `c a = c b` the inverse `x⁻¹` has entry `0` |
| 185 | at `(a, b)` and equal entries at `(a, a)` and `(b, b)`. -/ |
| 186 | lemma HasNoSmallRelations.inv_scalar_on_blocks {c : N → Fin n} (he : HasNoSmallRelations e) |
| 187 | (hc : Surjective c) {x : GL N k} (hm_le : m ≤ n + 1) |
| 188 | (h_vanish : ∀ a : Fin m → N × N, |
| 189 | powMinor (diagonal (T ∘ e ∘ c) * (x : Matrix N N k).map LaurentPolynomial.C) m a = 0) : |
| 190 | n < m ∧ |
| 191 | ∀ {a b : N}, c a = c b → a ≠ b → x⁻¹ a b = 0 ∧ x⁻¹ a a = x⁻¹ b b := by |
| 192 | -- Replace `T (e i)` by variables `X i`. The minors still vanish, so a factor `p` of the |
| 193 | -- characteristic polynomial of the resulting matrix `y` has degree `< m` and kills `y`. |
| 194 | -- Its constant term is divisible by every `X i`, which forces the degree `n` and the monomial |
| 195 | -- `∏ i, X i`; the coefficient of this monomial in `p(y) x⁻¹ = 0` gives the entries of `x⁻¹`. |
| 196 | let y : Matrix N N (MvPolynomial (Fin n) k) := |
| 197 | diagonal (X ∘ c) * (x : Matrix N N k).map MvPolynomial.C |
| 198 | obtain ⟨p, q, hq, hp_deg, hp_root⟩ := |
| 199 | exists_factor_charpoly y (powMinor_diagonal_X_mul_eq_zero he hm_le h_vanish) |
| 200 | -- As `det y ≠ 0`, the constant term of `p` contains a monomial `α`. |
| 201 | have h_det : y.det ≠ 0 := by simpa [y, prod_eq_zero_iff] using (x.map _).det_ne_zero |
| 202 | obtain ⟨hp_const, hq_const⟩ : p.coeff 0 ≠ 0 ∧ q.coeff 0 ≠ 0 := by |
| 203 | simpa [det_eq_sign_charpoly_coeff, hq] using h_det |
| 204 | obtain ⟨α, hα⟩ := ne_zero_iff.mp hp_const |
| 205 | -- In its own variable and the `X i` together, `y.charpoly` has total degree at most `card N`, |
| 206 | -- its degree in its own variable. |
| 207 | have h_total : ((optionEquivLeft k (Fin n)).symm y.charpoly).totalDegree ≤ card N := by |
| 208 | -- In the Leibniz formula each of the `card N` factors has total degree at most one. |
| 209 | suffices h : MvPolynomial.totalDegree (∑ σ : Equiv.Perm N, Equiv.Perm.sign σ • ∏ i : N, |
| 210 | ((if σ i = i then MvPolynomial.X none else 0) - |
| 211 | MvPolynomial.X (some (c (σ i))) * |
| 212 | MvPolynomial.C ((x : Matrix N N k) (σ i) i))) ≤ card N by |
| 213 | simpa [charpoly, det_apply, y, charmatrix, diagonal_apply, apply_ite] using h |
| 214 | grw (transparency := .default) [totalDegree_finsetSum, totalDegree_smul_le, |
| 215 | totalDegree_finsetProd, totalDegree_sub, totalDegree_mul] |
| 216 | simp [ite_apply, apply_ite] |
| 217 | set Φ : (MvPolynomial (Fin n) k)[X] ≃ₐ[k] MvPolynomial (Option (Fin n)) k := |
| 218 | (optionEquivLeft k (Fin n)).symm with hΦ |
| 219 | have hp_ne : Φ p ≠ 0 := by aesop |
| 220 | have hq_ne : Φ q ≠ 0 := by aesop |
| 221 | -- Total degrees add, that of `α` is at most that of `p`, and that of `q` is at least |
| 222 | -- `q.natDegree`; so `α` has degree at most `p.natDegree`. |
| 223 | have hα_p : ∑ i, α i ≤ (Φ p).totalDegree := calc |
| 224 | ∑ i, α i ≤ (p.coeff 0).totalDegree := by |
| 225 | simpa [α.sum_fintype] using le_totalDegree (mem_support_iff.mpr hα) |
| 226 | _ ≤ (Φ p).totalDegree := by |
| 227 | simpa [hΦ] using totalDegree_coeff_optionEquivLeft_le (p := Φ p) (i := 0) |
| 228 | have hq_le : q.natDegree ≤ (Φ q).totalDegree := by |
| 229 | simpa [hΦ, ← natDegree_optionEquivLeft] using degreeOf_le_totalDegree (Φ q) none |
| 230 | have hα_le : ∑ i, α i ≤ p.natDegree := by |
| 231 | have h_add : (Φ p).totalDegree + (Φ q).totalDegree ≤ p.natDegree + q.natDegree := by |
| 232 | rw [← totalDegree_mul_of_isDomain hp_ne hq_ne, ← map_mul, ← hq] |
| 233 | grw [h_total, ← y.charpoly_natDegree_eq_dim, hq, natDegree_mul_le] |
| 234 | lia |
| 235 | -- Write `0 = p(y) = y * (r(y) * y + p₁) + p₀` with `r = p.divX.divX`. Row `a` of `y` is |
| 236 | -- divisible by `X (c a)`, so `p₀` is, and every variable occurs in `α`. |
| 237 | have hp_split : p = Polynomial.X * (p.divX.divX * Polynomial.X + Polynomial.C (p.divX.coeff 0)) + |
| 238 | Polynomial.C (p.coeff 0) := by rw [p.divX.divX_mul_X_add, p.X_mul_divX_add] |
| 239 | have hα_pos : 1 ≤ ⇑α := by |
| 240 | refine hc.forall.mpr fun a ↦ Nat.pos_of_ne_zero fun hα_zero ↦ hα ?_ |
| 241 | -- If `α` missed the variable `X (c a)`, only `p₀` would contribute to the coefficient of `α`. |
| 242 | have h_coeff : ((p.aeval y) a a).coeff α = 0 := by simp [hp_root] |
| 243 | rw [hp_split] at h_coeff |
| 244 | simpa [y, algebraMap, comp_def, mul_assoc, coeff_X_mul', hα_zero] using h_coeff |
| 245 | -- Now `n ≤ ∑ i, α i ≤ p.natDegree < m ≤ n + 1`, so each variable occurs once. |
| 246 | have h_card : n ≤ ∑ i, α i := by simpa using sum_mono hα_pos |
| 247 | have hα_one : ⇑α = 1 := by |
| 248 | by_contra h_ne |
| 249 | have : n < ∑ i, α i := by simpa using sum_strictMono (hα_pos.lt_of_ne' h_ne) |
| 250 | lia |
| 251 | refine ⟨by lia, fun {a b} hab hne ↦ ?_⟩ |
| 252 | -- The entry `(a, b)` of `y * r(y) * y * x⁻¹` is divisible by `X (c a) * X (c b)`, so it does not |
| 253 | -- contain `α` if `c a = c b`; the term `y * p₁ * x⁻¹` is diagonal and depends only on `c a`; |
| 254 | -- the last term is `p₀ * x⁻¹`, and `α` occurs in `p₀`. |
| 255 | have h_entry (a b : N) : ((p.aeval y * (x : Matrix N N k)⁻¹.map MvPolynomial.C : |
| 256 | Matrix N N (MvPolynomial (Fin n) k)) a b).coeff α = 0 := by simp [hp_root] |
| 257 | rw [hp_split] at h_entry |
| 258 | -- Two passes normalize the coefficient equation (they use `mul_assoc` in opposite directions); |
| 259 | -- its normal form is unreadable, so the three entries used are stated just below. |
| 260 | simp [y, add_mul, mul_add, algebraMap, map_add, comp_def, mul_assoc, coeff_X_mul'] at h_entry |
| 261 | simp [← mul_assoc, coeff_mul_X', mul_comm (p.coeff _), hα_one] at h_entry |
| 262 | have h_ab : (x : Matrix N N k)⁻¹ a b = 0 ∨ (p.coeff 0).coeff α = 0 := by |
| 263 | simpa [hab, hne] using h_entry a b |
| 264 | have h_diag (a' : N) (ha' : c a' = c b) : (MvPolynomial.X (c b) * p.coeff 1).coeff α + |
| 265 | (x : Matrix N N k)⁻¹ a' a' * (p.coeff 0).coeff α = 0 := by |
| 266 | simpa [ha'] using h_entry a' a' |
| 267 | rw [Matrix.coe_units_inv] |
| 268 | exact ⟨h_ab.resolve_right hα, |
| 269 | mul_right_cancel₀ hα (by linear_combination h_diag a hab - h_diag b rfl)⟩ |
| 270 | |
| 271 | /-- Let the weights `e : Fin n → ℤ` be free, let `c : N → Fin n` be onto, let `x` be an invertible |
| 272 | matrix over `k`. If all minors `powMinor` of order `m` of the product of the |
| 273 | diagonal matrix with entries `T (e (c a))` and `x` over `k[T;T⁻¹]` vanish, then `n < m`. -/ |
| 274 | private lemma HasNoSmallRelations.lt_of_powMinor_eq_zero {c : N → Fin n} |
| 275 | (he : HasNoSmallRelations e) (hc : Surjective c) {x : GL N k} |
| 276 | (h_vanish : ∀ a : Fin m → N × N, |
| 277 | powMinor (diagonal (T ∘ e ∘ c) * (x : Matrix N N k).map LaurentPolynomial.C) m a = 0) : |
| 278 | n < m := by |
| 279 | by_cases hm_le : m ≤ n + 1 |
| 280 | · exact (he.inv_scalar_on_blocks hc hm_le h_vanish).left |
| 281 | · exact (Nat.le_succ n).trans_lt (lt_of_not_ge hm_le) |
| 282 | |
| 283 | /-- Let the weights `e : Fin n → ℤ` be free, let `c : N → Fin n` be onto, let `x` be an invertible |
| 284 | matrix over `k` and let `m ≤ n + 1`. If all minors `powMinor` of order `m` of the product of the |
| 285 | diagonal matrix with entries `T (e (c a))` and `x` over `k[T;T⁻¹]` vanish, then for `a ≠ b` with |
| 286 | `c a = c b` the inverse `x⁻¹` has entry `0` at `(a, b)` and equal entries at `(a, a)` and `(b, b)`. |
| 287 | -/ |
| 288 | private lemma HasNoSmallRelations.inv_apply_eq_zero_and_eq_of_powMinor_eq_zero {c : N → Fin n} |
| 289 | (he : HasNoSmallRelations e) (hc : Surjective c) {x : GL N k} (hm_le : m ≤ n + 1) |
| 290 | (h_vanish : ∀ a : Fin m → N × N, |
| 291 | powMinor (diagonal (T ∘ e ∘ c) * (x : Matrix N N k).map LaurentPolynomial.C) m a = 0) |
| 292 | {a b : N} (hab : c a = c b) (hne : a ≠ b) : x⁻¹ a b = 0 ∧ x⁻¹ a a = x⁻¹ b b := |
| 293 | (he.inv_scalar_on_blocks hc hm_le h_vanish).2 hab hne |
| 294 | |
| 295 | /-- If a nonzero polynomial `p` of degree less than `m` kills the matrix `M` over `K`, then all |
| 296 | minors `powMinor (φ M) m a` vanish, for any `K`-algebra map `φ` into the matrices over `k`. -/ |
| 297 | private lemma powMinor_eq_zero_of_aeval_eq_zero (φ : Matrix N N K →ₐ[K] Matrix N N k) |
| 298 | {M : Matrix N N K} {p : K[X]} (hp : p ≠ 0) (h_root : p.aeval M = 0) |
| 299 | (h_deg : p.natDegree < m) : powMinor (φ M) m = 0 := by |
| 300 | -- The coefficients of `p` give a relation among the first `m` powers of `φ M`. |
| 301 | have h_sum : ∑ i : Fin m, p.coeff i • φ M ^ (i : ℕ) = 0 := by |
| 302 | rw [Fin.sum_univ_eq_sum_range (fun i ↦ p.coeff i • φ M ^ i), ← aeval_eq_sum_range' h_deg, |
| 303 | aeval_algHom_apply, h_root, map_zero] |
| 304 | have h_dep : ¬LinearIndependent K fun i : Fin m ↦ uncurry (φ M ^ (i : ℕ)) := by |
| 305 | refine not_linearIndependent_iff.mpr |
| 306 | ⟨fun i ↦ p.coeff i, funext fun ⟨a, b⟩ ↦ ?_, ⟨p.natDegree, h_deg⟩, by simpa using hp⟩ |
| 307 | simpa [uncurry, Matrix.sum_apply] using congrFun₂ h_sum a b |
| 308 | exact funext (det_eval_eq_zero_iff_not_linearIndependent.mpr fun h_ind ↦ |
| 309 | h_dep (h_ind.restrict_scalars' K)) |
| 310 | |
| 311 | /-- Let `N` have `n ≥ 1` elements and let a monic polynomial `P` of degree `n` kill the matrix `M` |
| 312 | over `K`. If some minor `powMinor (φ M) n a` is nonzero, for a `K`-algebra map `φ` into the |
| 313 | matrices over `k`, then `P` is the characteristic polynomial of `M`: otherwise `M.charpoly - P` |
| 314 | would be a nonzero polynomial of degree less than `n` that kills `M`. -/ |
| 315 | private lemma charpoly_eq_of_powMinor_ne_zero [NeZero n] (φ : Matrix N N K →ₐ[K] Matrix N N k) |
| 316 | (hN : card N = n) {M : Matrix N N K} {P : K[X]} (h_root : P.aeval M = 0) |
| 317 | (h_monic : P.IsMonicOfDegree n) (h_minor : powMinor (φ M) n ≠ 0) : M.charpoly = P := by |
| 318 | have h_char : M.charpoly.IsMonicOfDegree n := |
| 319 | ⟨by rw [charpoly_natDegree_eq_dim, hN], charpoly_monic M⟩ |
| 320 | by_contra hne |
| 321 | have h_sub_root : (M.charpoly - P).aeval M = 0 := by simp [h_root, aeval_self_charpoly] |
| 322 | exact h_minor (powMinor_eq_zero_of_aeval_eq_zero φ (sub_ne_zero.mpr hne) h_sub_root |
| 323 | (h_char.natDegree_sub_lt NeZero.out h_monic)) |
| 324 | |
| 325 | /-- Free weights `e : Fin n → ℤ` are pairwise distinct: apply freeness to the exponent vectors of |
| 326 | degree one. -/ |
| 327 | private lemma HasNoSmallRelations.injective (he : HasNoSmallRelations e) : e.Injective := by |
| 328 | intro i j h_eq |
| 329 | have h_deg (i : Fin n) : Finsupp.single i 1 ∈ {α : Fin n →₀ ℕ | Finsupp.degree α = 1} := by simp |
| 330 | exact Finsupp.single_left_injective one_ne_zero |
| 331 | (he 1 (Nat.one_le_pow 2 (n + 1) n.succ_pos) (h_deg i) (h_deg j) |
| 332 | (by simpa [Finsupp.weight_single] using h_eq)) |
| 333 | |
| 334 | /-- Let `e : Fin n → ℤ` be injective, `κ : N → ℤ` and `l : Fin n → N` with `κ (l i) = e i`. If all |
| 335 | minors of order `n + 1` of the first `n + 1` powers of the diagonal matrix with entries `T (κ j)` |
| 336 | vanish, then every `κ j` is one of the `e i`: otherwise the minor at the diagonal places |
| 337 | `j, l 0, …, l (n - 1)` would be a Vandermonde determinant of distinct monomials. -/ |
| 338 | private lemma exists_eq_of_powMinor_diagonal_eq_zero (he_inj : e.Injective) {κ : N → ℤ} |
| 339 | {l : Fin n → N} (hl : ∀ i : Fin n, κ (l i) = e i) |
| 340 | (h_minor : ∀ a : Fin (n + 1) → N × N, |
| 341 | powMinor (diagonal (T ∘ κ) : Matrix N N k[T;T⁻¹]) (n + 1) a = 0) |
| 342 | (j : N) : ∃ i : Fin n, e i = κ j := by |
| 343 | let a : Fin (n + 1) → N := cons j l |
| 344 | obtain ⟨i, i', h_T_eq, h_ne⟩ : ∃ i i', (T (κ (a i)) : k[T;T⁻¹]) = T (κ (a i')) ∧ i ≠ i' := by |
| 345 | apply det_vandermonde_eq_zero_iff.mp |
| 346 | simpa [powMinor, diagonal_pow, flip_def, uncurry, vandermonde, comp_def] using |
| 347 | h_minor (Function.diag ∘ a) |
| 348 | -- `T` is unfolded to compare monomials; `single_eq_C_mul_T` would fold it back, a loop. |
| 349 | have hκ_eq : κ (a i) = κ (a i') := by |
| 350 | simpa [T, AddMonoidAlgebra.single_inj, -single_eq_C_mul_T] using h_T_eq |
| 351 | -- The equal weights are at `j` and some `l i`, or at two `l i`, which `e` injective rules out. |
| 352 | have h_not_inj : ¬Injective (cons (κ j) e : Fin (n + 1) → ℤ) := by |
| 353 | rw [← show κ ∘ l = e from funext hl, ← comp_cons] |
| 354 | exact fun h_inj ↦ h_ne (h_inj hκ_eq) |
| 355 | simpa [cons_injective_iff, he_inj] using h_not_inj |
| 356 | |
| 357 | /-- Let `Q` be an invertible matrix over `k`, let `φ` send a matrix `M` over `K` to `Q * M * Q⁻¹` |
| 358 | over `k`, and let the `K`-subspace `V` contain every diagonal matrix. Then the matrices `φ x`, |
| 359 | `x ∈ V`, do not all have entry `0` at `(a, b)` and equal entries at `(a, a)` and `(b, b)`: for the |
| 360 | diagonal units `Eₜₜ` this would make each `Q a t * Q⁻¹ t a` zero, while their sum over `t` is |
| 361 | `1`. -/ |
| 362 | private lemma not_forall_conj_entries_of_diagonal_mem (Q : GL N k) |
| 363 | {φ : Matrix N N K →ₐ[K] Matrix N N k} |
| 364 | (hφ : ∀ M : Matrix N N K, |
| 365 | φ M = (Q : Matrix N N k) * (M.map (algebraMap K k) * (Q : Matrix N N k)⁻¹)) |
| 366 | {V : Submodule K (Matrix N N K)} (h_diag : ∀ v : N → K, diagonal v ∈ V) (a b : N) : |
| 367 | ¬∀ x ∈ V, φ x a b = 0 ∧ φ x a a = φ x b b := by |
| 368 | intro h_block |
| 369 | have h_unit (t : N) : Q a t * (Q : Matrix N N k)⁻¹ t a = 0 := by |
| 370 | obtain ⟨h_off, h_diag_eq⟩ := h_block (diagonal (Pi.single t 1)) (h_diag (Pi.single t 1)) |
| 371 | have h_off' : (Q : Matrix N N k) a t = 0 ∨ (Q : Matrix N N k)⁻¹ t b = 0 := by |
| 372 | simpa [hφ, Matrix.mul_apply, diagonal, apply_ite, Pi.single_apply] using h_off |
| 373 | have h_diag' : (Q : Matrix N N k) a t * (Q : Matrix N N k)⁻¹ t a = |
| 374 | (Q : Matrix N N k) b t * (Q : Matrix N N k)⁻¹ t b := by |
| 375 | simpa [hφ, Matrix.mul_apply, diagonal, apply_ite, Pi.single_apply] using h_diag_eq |
| 376 | rcases h_off' with h_Q | h_Qinv |
| 377 | · rw [h_Q, zero_mul] |
| 378 | · rw [h_diag', h_Qinv, mul_zero] |
| 379 | simpa [Matrix.mul_apply, h_unit] using congrFun₂ Q.val_inv a a |
| 380 | |
| 381 | /-- Let `E` be a number field inside `Ω` (`EmbeddedNumberField E`), and let `p` be a property of the |
| 382 | elements of `Gal(Ω/E)`. If every nonempty open set `V` contains a nonempty open set on which `p` |
| 383 | holds, then `p` holds at the Frobenius elements of most Frobenius data. -/ |
| 384 | private lemma eventually_mostFrobenii_of_open {E : Type} [Field E] [EmbeddedNumberField E] |
| 385 | {p : Gal(Ω/E) → Prop} |
| 386 | (h : ∀ V : Set Gal(Ω/E), IsOpen V → V.Nonempty → |
| 387 | ∃ O ⊆ V, IsOpen O ∧ O.Nonempty ∧ ∀ g ∈ O, p g) : |
| 388 | ∀ᶠ y : FrobeniusDatum E in mostFrobenii E, p y.frob := by |
| 389 | intro V hV hV_ne |
| 390 | obtain ⟨O, hOV, hO, hO_ne, h_O⟩ := h V hV hV_ne |
| 391 | refine ⟨O, hOV, hO, hO_ne, .of_forall ?_⟩ |
| 392 | rintro - - s - - - hs_O |
| 393 | exact h_O s hs_O |
| 394 | |
| 395 | /-- Let `e : Fin n → ℤ` be injective and let every `e i` be a value of `κ : N → ℤ`. If all minors |
| 396 | of order `n + 1` of the powers of `diagonal (T ∘ κ)` vanish, then `κ = e ∘ c` for an onto `c`. -/ |
| 397 | private lemma exists_surjective_comp_eq_of_powMinor_diagonal_eq_zero (he_inj : e.Injective) |
| 398 | {κ : N → ℤ} (hκ : ∀ i : Fin n, e i ∈ Set.range κ) |
| 399 | (h_minor : ∀ a : Fin (n + 1) → N × N, |
| 400 | powMinor (diagonal (T ∘ κ) : Matrix N N k[T;T⁻¹]) (n + 1) a = 0) : |
| 401 | ∃ c : N → Fin n, Surjective c ∧ e ∘ c = κ := by |
| 402 | choose l hl using hκ |
| 403 | choose c hc using exists_eq_of_powMinor_diagonal_eq_zero he_inj hl h_minor |
| 404 | exact ⟨c, fun i ↦ ⟨l i, he_inj ((hc (l i)).trans (hl i))⟩, funext hc⟩ |
| 405 | |
| 406 | /-- Let `E` be a number field inside `Ω`, a fixed algebraic closure of `ℚ`, let `r` be a continuous |
| 407 | representation of `Gal(Ω/E)` on `K ^ N`, and let `k` be a normed field over `K`. Suppose: |
| 408 | * the span of the image of `r` contains every diagonal matrix; |
| 409 | * for most Frobenius data `v` (the filter `mostFrobenii E`) the polynomial `P v` is monic of degree |
| 410 | `n ≥ 1` and kills `r v.frob`; |
| 411 | * the free integers `e i` (`HasNoSmallRelations e`: distinct exponent vectors of one total degree at |
| 412 | most `(n + 1) ^ 2` have distinct weights) all occur among the integers `κ j`; |
| 413 | * for an invertible matrix `Q` over `k`, every polynomial in the entries that vanishes at `Q * r g` |
| 414 | for all `g` near `1` also vanishes at `diagonal (T ∘ κ) * Q` over `k[T;T⁻¹]`. |
| 415 | |
| 416 | Then `N` has `n` elements and `P v` is the characteristic polynomial of `r v.frob` for most |
| 417 | Frobenius data `v`. -/ |
| 418 | lemma card_eq_and_charpoly_eq [NeZero n] {E : Type} [Field E] [NumberField E] [Algebra E Ω] |
| 419 | (r : Gal(Ω/E) →* GL N K) (hr : Continuous r) |
| 420 | (h_span : ∀ v : N → K, diagonal v ∈ span K (Set.range fun g : Gal(Ω/E) ↦ (r g : Matrix N N K))) |
| 421 | {P : FrobeniusDatum E → K[X]} |
| 422 | (hP : ∀ᶠ v : FrobeniusDatum E in mostFrobenii E, |
| 423 | (P v).aeval (r v.frob : Matrix N N K) = 0 ∧ (P v).IsMonicOfDegree n) |
| 424 | (Q : GL N k) (κ : N → ℤ) (he : HasNoSmallRelations e) (hκ : ∀ i : Fin n, e i ∈ Set.range κ) |
| 425 | (h_torus : ∀ h : MvPolynomial (N × N) k, |
| 426 | (∀ᶠ g : Gal(Ω/E) in nhds 1, |
| 427 | h.aeval ((Q : Matrix N N k) * (r g : Matrix N N K).map (algebraMap K k)).uncurry = 0) → |
| 428 | h.aeval (diagonal (T ∘ κ) * (Q : Matrix N N k).map LaurentPolynomial.C).uncurry = 0) : |
| 429 | Fintype.card N = n ∧ |
| 430 | ∀ᶠ v : FrobeniusDatum E in mostFrobenii E, (r v.frob : Matrix N N K).charpoly = P v := by |
| 431 | -- Work with the conjugate `φ (r g) = Q * r g * Q⁻¹` over `k` and the minors of its powers. |
| 432 | let φ : Matrix N N K →ₐ[K] Matrix N N k := |
| 433 | (MulSemiringAction.toAlgHom K (Matrix N N k) (toConjAct Q)).comp (ofId K k).mapMatrix |
| 434 | have h_φ (M : Matrix N N K) : |
| 435 | φ M = (Q : Matrix N N k) * (M.map (algebraMap K k) * (Q : Matrix N N k)⁻¹) := by |
| 436 | simp [φ, units_smul_def, mul_assoc, ofId] |
| 437 | let ρ (g : Gal(Ω/E)) : GL N k := Units.map φ (r g) |
| 438 | have h_closed (m : ℕ) : IsClosed {g : Gal(Ω/E) | powMinor (φ (r g)) m = 0} := by |
| 439 | refine isClosed_eq ?_ continuous_zero |
| 440 | simp only [h_φ] |
| 441 | fun_prop [flip] |
| 442 | -- Minors that vanish near `x` vanish on the translate of the torus: apply `h_torus` to the |
| 443 | -- polynomial `Y ↦ powMinor (Y * Q⁻¹ * ρ x) m a`. |
| 444 | have h_near {m : ℕ} (x : Gal(Ω/E)) (h : ∀ᶠ g : Gal(Ω/E) in nhds x, powMinor (φ (r g)) m = 0) |
| 445 | (a : Fin m → N × N) : |
| 446 | powMinor (diagonal (T ∘ κ) * (ρ x : Matrix N N k).map LaurentPolynomial.C) m a = 0 := by |
| 447 | set M : Matrix N N (MvPolynomial (N × N) k) := |
| 448 | mvPolynomialX N N k * ((Q⁻¹ * ρ x : GL N k) : Matrix N N k).map MvPolynomial.C |
| 449 | rw [← map_mul_right_nhds_one x, eventually_map] at h |
| 450 | have h_poly : (powMinor M m a).aeval |
| 451 | (diagonal (T ∘ κ) * (Q : Matrix N N k).map LaurentPolynomial.C).uncurry = 0 := |
| 452 | h_torus (powMinor M m a) <| h.mono fun g hg ↦ by |
| 453 | have h_eval (A : Matrix N N k) : |
| 454 | (mvPolynomialX N N k).map (MvPolynomial.eval A.uncurry) = A := |
| 455 | mvPolynomialX_map_eval₂ (RingHom.id k) A |
| 456 | simpa [M, φ, ρ, h_eval, units_smul_def, mul_assoc, ofId, comp_def] using congrFun hg a |
| 457 | simp only [M, map_powMinor, AlgHom.mapMatrix_apply, Matrix.map_mul, Matrix.map_map, comp_def, |
| 458 | MvPolynomial.aeval_C] at h_poly |
| 459 | let B := diagonal (T ∘ κ) * (Q : Matrix N N k).map LaurentPolynomial.C |
| 460 | have h_eval : (mvPolynomialX N N k).map (MvPolynomial.aeval B.uncurry) = B := |
| 461 | mvPolynomialX_map_eval₂ (algebraMap k k[T;T⁻¹]) B |
| 462 | let C := ((Q⁻¹ * ρ x : GL N k) : Matrix N N k).map LaurentPolynomial.C |
| 463 | have h_minor : powMinor (B * C) m a = 0 := |
| 464 | (congrArg (fun X ↦ powMinor (X * C) m a) h_eval).symm.trans h_poly |
| 465 | simpa [B, C, mul_assoc, ← Matrix.map_mul] using h_minor |
| 466 | -- The minors of order `n + 1` vanish at most Frobenius elements, hence everywhere. |
| 467 | have h_all (g : Gal(Ω/E)) : powMinor (φ (r g)) (n + 1) = 0 := by |
| 468 | refine (h_closed (n + 1)).closure_subset (dense_of_mostFrobenii (hP.mono ?_) g) |
| 469 | intro v ⟨h_root, h_monic⟩ |
| 470 | have h_deg : (P v).natDegree < n + 1 := by simp [h_monic.natDegree_eq] |
| 471 | exact powMinor_eq_zero_of_aeval_eq_zero φ h_monic.ne_zero h_root h_deg |
| 472 | have h_top (x : Gal(Ω/E)) : ∀ a : Fin (n + 1) → N × N, |
| 473 | powMinor (diagonal (T ∘ κ) * (ρ x : Matrix N N k).map LaurentPolynomial.C) (n + 1) a = 0 := |
| 474 | h_near x (.of_forall h_all) |
| 475 | -- The weights `κ` are exactly the `e i`: write `κ = e ∘ c` with `c` onto. |
| 476 | obtain ⟨c, hc_surj, rfl⟩ := exists_surjective_comp_eq_of_powMinor_diagonal_eq_zero |
| 477 | (HasNoSmallRelations.injective he) hκ fun a ↦ by simpa [ρ] using h_top 1 a |
| 478 | -- If `c a = c b` with `a ≠ b`, then by |
| 479 | -- `HasNoSmallRelations.inv_apply_eq_zero_and_eq_of_powMinor_eq_zero` all `φ (r g)`, and so all |
| 480 | -- elements of their span, have entry `0` at `(a, b)` and equal entries at `(a, a)`, `(b, b)`. |
| 481 | have hc_inj : Injective c := by |
| 482 | intro a b hab |
| 483 | by_contra hne |
| 484 | refine not_forall_conj_entries_of_diagonal_mem Q h_φ h_span a b fun x hx ↦ ?_ |
| 485 | refine span_induction (p := fun x _ ↦ φ x a b = 0 ∧ φ x a a = φ x b b) ?_ ?_ ?_ ?_ hx |
| 486 | · rintro _ ⟨g, rfl⟩ |
| 487 | simpa [ρ] using |
| 488 | he.inv_apply_eq_zero_and_eq_of_powMinor_eq_zero hc_surj le_rfl (h_top g⁻¹) hab hne |
| 489 | all_goals simp +contextual |
| 490 | have hN : card N = n := by simpa using card_of_bijective ⟨hc_inj, hc_surj⟩ |
| 491 | -- The minors of order `n` do not all vanish on a nonempty open set `V`, since |
| 492 | -- `HasNoSmallRelations.lt_of_powMinor_eq_zero` would give `n < n`; so `V` meets the open set |
| 493 | -- where they do not. |
| 494 | have h_most : ∀ᶠ v : FrobeniusDatum E in mostFrobenii E, powMinor (φ (r v.frob)) n ≠ 0 := by |
| 495 | refine eventually_mostFrobenii_of_open (p := fun g ↦ powMinor (φ (r g)) n ≠ 0) ?_ |
| 496 | rintro V hV ⟨x, hx⟩ |
| 497 | set Z : Set Gal(Ω/E) := {g | powMinor (φ (r g)) n = 0} |
| 498 | have hV_not_sub : ¬V ⊆ Z := fun h_sub ↦ lt_irrefl n <| he.lt_of_powMinor_eq_zero hc_surj |
| 499 | (h_near x (mem_nhds_iff.mpr ⟨V, h_sub, hV, hx⟩)) |
| 500 | exact ⟨V \ Z, Set.sdiff_subset, hV.sdiff (h_closed n), Set.sdiff_nonempty.mpr hV_not_sub, |
| 501 | fun _ ⟨_, hg_Z⟩ ↦ hg_Z⟩ |
| 502 | refine ⟨hN, ?_⟩ |
| 503 | filter_upwards [hP, h_most] with v ⟨h_root, h_monic⟩ hv |
| 504 | exact charpoly_eq_of_powMinor_ne_zero φ hN h_root h_monic hv |
| 505 | |
| 506 | end New |