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 | public import Mathlib.Algebra.DualNumber |
| 4 | public import Mathlib.RingTheory.MvPolynomial.IrreducibleQuadratic |
| 5 | public import Mathlib.RingTheory.Nullstellensatz |
| 6 | import Mathlib.Algebra.Module.StablyFree.Basic |
| 7 | import Mathlib.Data.Finset.Finsupp |
| 8 | import Mathlib.Data.Finsupp.PWO |
| 9 | import Mathlib.FieldTheory.PurelyInseparable.Exponent |
| 10 | import Mathlib.LinearAlgebra.Dimension.OrzechProperty |
| 11 | import Mathlib.RingTheory.Coalgebra.IsFrobenius |
| 12 | import Mathlib.RingTheory.Etale.Weakly |
| 13 | import Mathlib.RingTheory.Finiteness.ModuleFinitePresentation |
| 14 | public import Mathlib.RingTheory.Henselian |
| 15 | import Mathlib.RingTheory.MvPolynomial.Ideal |
| 16 | import Mathlib.RingTheory.SimpleRing.Principal |
| 17 | import Mathlib.RingTheory.TotallySplit |
| 18 | import Mathlib.RingTheory.Unramified.LocalStructure |
| 19 | import TauCeti.RingTheory.Henselian.Section |
| 20 | public import Lib.Cohomology.Etale.Basic |
| 21 | |
| 22 | /-! |
| 23 | # Multivariate polynomials: cost of vanishing, homogenization, Nullstellensatz, Hensel |
| 24 | |
| 25 | This file collects lemmas on polynomials in several variables and on algebras of finite type. They |
| 26 | cover generation by products of polynomials in two sets of variables, the cost of monomials of |
| 27 | polynomials that vanish to high order, and homogenization along a linear form. |
| 28 | |
| 29 | ## Main definitions and results |
| 30 | |
| 31 | * `New.exists_le_weight_of_mem_vanishingIdeal_pow`: a nonzero polynomial that vanishes to order `d` |
| 32 | at enough suitable points has a monomial of cost at least `d`. |
| 33 | * `New.exists_isHomogeneous_sub_one_dvd_sub` replaces a polynomial `P` of total degree at most `N` |
| 34 | by a form `G`, homogeneous of degree `N`, congruent to `P` modulo `F - 1` for a given linear form |
| 35 | `F`. So `G` and `P` have the same value at every point where `F` equals `1` |
| 36 | (`New.exists_homogenization`); points are `R`-algebra maps `φ` out of the polynomial ring, with |
| 37 | values in algebras in `Type`. |
| 38 | * `New.nullstellensatz_exists_le_ker`: the weak Nullstellensatz for an algebra of finite type, with |
| 39 | points written as `k`-algebra homomorphisms `A → k`. |
| 40 | * `New.exists_mem_colon_of_tangent`: a criterion for an ideal to cut out a section of an affine |
| 41 | scheme of finite type near a point. Tangent vectors at a `k`-valued point `o` along the fibre are |
| 42 | the `V`-algebra maps to the dual numbers `k[ε]` that reduce to `o`. |
| 43 | * `New.Variety.multivariate_hensel` solves systems `x i = p i (x)` over a Henselian local ring |
| 44 | when all coefficients of the `p i` lie in the maximal ideal. The solution lifts the origin of |
| 45 | the closed fibre of the equations after inverting their Jacobian. |
| 46 | |
| 47 | ## Relation to the literature |
| 48 | |
| 49 | All results are known. `New.exists_le_weight_of_mem_vanishingIdeal_pow` is a form of the |
| 50 | Combinatorial Nullstellensatz with multiplicity, over any field. Each variable u has a positive |
| 51 | integer κ(u) and the weight 1/κ(u). In place of a grid it uses a set of at least ∏κ(u) points at |
| 52 | which each u^κ(u) agrees with a polynomial of lower weighted degree. A nonzero polynomial vanishing |
| 53 | to order d at all these points then has a monomial of weighted degree at least d. Source: Alon, |
| 54 | Combinatorial Nullstellensatz (1999); Ball–Serra, Punctured combinatorial Nullstellensätze (2009). |
| 55 | -/ |
| 56 | |
| 57 | @[expose] public section |
| 58 | |
| 59 | /-! ## Polynomials in two covering sets of variables -/ |
| 60 | |
| 61 | section PolynomialSpan |
| 62 | |
| 63 | open MvPolynomial Set |
| 64 | |
| 65 | /-- If the ranges of `p` and `q` cover the set of variables `ι`, every polynomial over a commutative |
| 66 | semiring `R` is a sum of products of a polynomial in the variables `p k` and one in the variables |
| 67 | `q k`. -/ |
| 68 | lemma New.mem_rename_range_mul {R ι κ κ' : Type*} [CommSemiring R] (p : κ → ι) (q : κ' → ι) |
| 69 | (h_cover : ∀ i : ι, i ∈ range p ∪ range q) (P : MvPolynomial ι R) : |
| 70 | P ∈ (rename p).range.toSubmodule * (rename (R := R) q).range.toSubmodule := by |
| 71 | -- The product of the two subalgebras is the subalgebra generated by all the `X (p k)` and |
| 72 | -- `X (q k)`; by `h_cover` these are all the variables. |
| 73 | have h_vars : range (X ∘ p) ∪ range (X ∘ q) = range (X : ι → MvPolynomial ι R) := by |
| 74 | rw [range_comp, range_comp, ← image_union, eq_univ_of_forall h_cover, image_univ] |
| 75 | simp only [rename_eq_aeval, aeval_range, ← Algebra.adjoin_union_coe_submodule, h_vars, |
| 76 | adjoin_range_X, Subalgebra.mem_toSubmodule, Algebra.mem_top] |
| 77 | |
| 78 | end PolynomialSpan |
| 79 | |
| 80 | /-! |
| 81 | ## Vanishing to order d and the cost of monomials |
| 82 | |
| 83 | Each variable `u` has the cost `1/κ_u`, and a monomial costs the sum of the costs of its variables. |
| 84 | -/ |
| 85 | |
| 86 | section ZerosCostDegree |
| 87 | |
| 88 | open MvPolynomial Finset Finsupp Submodule Ideal |
| 89 | |
| 90 | /-- If `p` vanishes to order `d` at the point `w`, then after translating `w` to the origin the |
| 91 | coefficients of `p` of degree below `d` are zero. -/ |
| 92 | lemma New.coeff_translate_eq_zero_of_mem_vanishingIdeal_pow {K ι : Type} [Field K] |
| 93 | {w : ι → K} {d : ℕ} {p : MvPolynomial ι K} (hp : p ∈ vanishingIdeal K {w} ^ d) {γ : ι →₀ ℕ} |
| 94 | (hγ : γ.degree < d) : (aeval (X + C ∘ w) p).coeff γ = 0 := by |
| 95 | let T : MvPolynomial ι K →ₐ[K] MvPolynomial ι K := aeval (X + C ∘ w) |
| 96 | have h_origin : vanishingIdeal K {w} ≤ (idealOfVars ι K).comap T := fun q hq ↦ by |
| 97 | have h_const : constantCoeff (T q) = 0 := by simpa [T, map_aeval] using hq |
| 98 | rw [Ideal.mem_comap, ← pow_one (idealOfVars ι K), mem_pow_idealOfVars_iff'] |
| 99 | simpa [degree_eq_zero_iff, ← constantCoeff_eq] using h_const |
| 100 | have h_mem : T p ∈ idealOfVars ι K ^ d := le_comap_pow T d (pow_right_mono h_origin d hp) |
| 101 | exact (mem_pow_idealOfVars_iff' d _).1 h_mem γ hγ |
| 102 | |
| 103 | /-- If the polynomials `φ u` vanish at the point `w`, the product `∏ φ u ^ γ u` vanishes at `w` to |
| 104 | every order `d ≤ |γ|`. -/ |
| 105 | lemma New.bind₁_monomial_mem_vanishingIdeal_pow {K ι : Type} [Field K] {w : ι → K} |
| 106 | {φ : ι → MvPolynomial ι K} (hφ : ∀ u : ι, eval w (φ u) = 0) {d : ℕ} {γ : ι →₀ ℕ} |
| 107 | (hγ : d ≤ γ.degree) : aeval (R := K) φ (monomial γ 1) ∈ vanishingIdeal K {w} ^ d := by |
| 108 | classical |
| 109 | have h_vars : idealOfVars ι K ≤ (vanishingIdeal K {w}).comap (aeval (R := K) φ) := by |
| 110 | simp [Ideal.span_le, hφ, Set.range_subset_iff, aeval_X] |
| 111 | have h_mem : monomial γ 1 ∈ idealOfVars ι K ^ d := (mem_pow_idealOfVars_iff d _).2 (by simpa) |
| 112 | exact le_comap_pow _ d (pow_right_mono h_vars d h_mem) |
| 113 | |
| 114 | /-- Chinese remainder theorem for jets: at finitely many distinct points `z t`, the coefficients |
| 115 | of degree below `d` after translation to the origin can be prescribed arbitrarily. -/ |
| 116 | lemma New.exists_forall_coeff_translate_eq {K ι S : Type} [Field K] [Fintype S] |
| 117 | {z : S → ι → K} (hz_inj : z.Injective) {d : ℕ} {Γ : Finset (ι →₀ ℕ)} |
| 118 | (hΓ : ∀ γ ∈ Γ, γ.degree < d) (y : S × Γ → K) : |
| 119 | ∃ p : MvPolynomial ι K, ∀ (t : S) (γ : Γ), (aeval (X + C ∘ z t) p).coeff γ = y (t, γ) := by |
| 120 | classical |
| 121 | have h_ideal_inj : Function.Injective fun w : ι → K ↦ vanishingIdeal K {w} := fun w w' h_eq ↦ by |
| 122 | funext u |
| 123 | simpa [sub_eq_zero] using h_eq.ge (show X u - C (w' u) ∈ vanishingIdeal K {w'} by simp) |
| 124 | have h_coprime : Pairwise (Function.onFun IsCoprime fun t : S ↦ vanishingIdeal K {z t} ^ d) := |
| 125 | fun t t' h_ne ↦ .pow (isCoprime_of_isMaximal ((h_ideal_inj.comp hz_inj).ne h_ne)) |
| 126 | -- The polynomial `q t` has the prescribed jet at `z t`. |
| 127 | let q (t : S) : MvPolynomial ι K := aeval (X + C ∘ (-z t)) (∑ γ : Γ, monomial γ (y (t, γ))) |
| 128 | obtain ⟨p, hp⟩ := exists_forall_sub_mem_ideal h_coprime q |
| 129 | refine ⟨p, fun t γ ↦ ?_⟩ |
| 130 | have h_jet : (aeval (X + C ∘ z t) (p - q t)).coeff γ = 0 := |
| 131 | New.coeff_translate_eq_zero_of_mem_vanishingIdeal_pow (hp t) (hΓ γ γ.property) |
| 132 | simpa [q, comp_aeval_apply, coeff_sum, sub_eq_zero, aeval_X, aeval_X_left] using h_jet |
| 133 | |
| 134 | /-- A submodule that contains the monomials occurring in `p` contains `p`. -/ |
| 135 | lemma New.mem_of_forall_monomial_mem {K ι : Type} [Field K] {N : Submodule K (MvPolynomial ι K)} |
| 136 | {p : MvPolynomial ι K} (h_monomial : ∀ α ∈ p.support, monomial α 1 ∈ N) : p ∈ N := by |
| 137 | rw [p.as_sum] |
| 138 | exact N.sum_mem fun α hα ↦ by simpa [smul_monomial] using N.smul_mem _ (h_monomial α hα) |
| 139 | |
| 140 | /-- Comparing exponents by a monotone real function is well founded (Dickson's lemma). -/ |
| 141 | lemma New.wellFounded_lt_of_monotone_finsupp {ι : Type} [Fintype ι] {c : (ι →₀ ℕ) → ℝ} |
| 142 | (hc : Monotone c) : WellFounded fun α β : ι →₀ ℕ ↦ c α < c β := by |
| 143 | let e : (fun α β : ι →₀ ℕ ↦ α ≤ β) →r fun α β : ι →₀ ℕ ↦ c α ≤ c β := ⟨id, fun h_le ↦ hc h_le⟩ |
| 144 | have h_wqo : WellQuasiOrdered fun α β : ι →₀ ℕ ↦ c α ≤ c β := |
| 145 | wellQuasiOrdered_le.of_surjective e Function.surjective_id |
| 146 | simpa only [lt_iff_le_not_ge] using h_wqo.wellFounded |
| 147 | |
| 148 | /-- Division by the polynomials `ψ u = X u ^ κ u - g u`, where the variable `u` costs `1 / κ u` and |
| 149 | the monomials of `g u` cost less than `1`. If a submodule `N` contains the products |
| 150 | `X ^ α * ψ ^ γ` with `α < κ` and `|γ| + cost α ≤ r`, then it contains all the products with |
| 151 | `|γ| + cost α ≤ r`. -/ |
| 152 | lemma New.monomial_mul_bind₁_mem_of_weight_le {K ι : Type} [Field K] [Fintype ι] {κ : ι → ℕ} |
| 153 | (hκ : ∀ u : ι, 0 < κ u) {g : ι → MvPolynomial ι K} |
| 154 | (hg : ∀ u : ι, ∀ α ∈ (g u).support, weight (fun u : ι ↦ (κ u : ℝ))⁻¹ α < 1) |
| 155 | {N : Submodule K (MvPolynomial ι K)} {r : ℝ} |
| 156 | (hN : ∀ α γ : ι →₀ ℕ, (∀ u : ι, α u < κ u) → |
| 157 | γ.degree + weight (fun u : ι ↦ (κ u : ℝ))⁻¹ α ≤ r → |
| 158 | monomial α 1 * aeval (R := K) (fun u : ι ↦ X u ^ κ u - g u) (monomial γ 1) ∈ N) |
| 159 | (α γ : ι →₀ ℕ) (h_le : γ.degree + weight (fun u : ι ↦ (κ u : ℝ))⁻¹ α ≤ r) : |
| 160 | monomial α 1 * aeval (R := K) (fun u : ι ↦ X u ^ κ u - g u) (monomial γ 1) ∈ N := by |
| 161 | set cost : (ι →₀ ℕ) →+ ℝ := weight (fun u : ι ↦ (κ u : ℝ))⁻¹ with h_cost |
| 162 | have h_mono : Monotone cost := fun α β h_exp ↦ by |
| 163 | simp only [h_cost, weight_eq_sum, Pi.inv_apply] |
| 164 | gcongr with u |
| 165 | exact h_exp u |
| 166 | let b (α γ : ι →₀ ℕ) : MvPolynomial ι K := |
| 167 | monomial α 1 * aeval (R := K) (fun u : ι ↦ X u ^ κ u - g u) (monomial γ 1) |
| 168 | change b α γ ∈ N |
| 169 | induction α using (New.wellFounded_lt_of_monotone_finsupp h_mono).induction generalizing γ with |
| 170 | | _ α ih => ?_ |
| 171 | by_cases! hα : ∀ u : ι, α u < κ u |
| 172 | · exact hN α γ hα h_le |
| 173 | -- Otherwise `X ^ α = X ^ β * X u ^ κ u`, and `X u ^ κ u = ψ u + g u` lowers the cost. |
| 174 | obtain ⟨u, hu : κ u ≤ α u⟩ := hα |
| 175 | obtain ⟨β, rfl⟩ : ∃ β : ι →₀ ℕ, α = single u (κ u) + β := exists_add_of_le (single_le_iff.2 hu) |
| 176 | have cost_eq : cost (single u (κ u) + β) = 1 + cost β := by simp [h_cost, weight, hκ, ne_of_gt] |
| 177 | have h_split : b (single u (κ u) + β) γ = b β (single u 1 + γ) + g u * b β γ := by |
| 178 | simp only [b, monomial_single_add, map_mul, pow_one, aeval_X] |
| 179 | ring |
| 180 | rw [cost_eq] at ih h_le |
| 181 | rw [h_split] |
| 182 | refine add_mem (ih β (by simp) _ (by simpa [add_assoc, add_comm, add_left_comm] using h_le)) ?_ |
| 183 | suffices g u ∈ N.comap (LinearMap.mulRight K (b β γ)) by simpa |
| 184 | refine New.mem_of_forall_monomial_mem fun δ hδ ↦ ?_ |
| 185 | have h_lt : cost (δ + β) < 1 + cost β := by simpa using hg u δ hδ |
| 186 | simpa [b, ← mul_assoc] using ih (δ + β) h_lt γ (by linarith) |
| 187 | |
| 188 | /-- Combinatorial Nullstellensatz with multiplicity. Give the variable `u` the cost `1 / κ u`; the |
| 189 | cost of a monomial is its `weight`. Take at least `∏ κ u` distinct points `z t` at which each |
| 190 | `X u ^ κ u` agrees with a polynomial `g u` whose monomials cost less than `1`. Then every `f ≠ 0` |
| 191 | that vanishes to order `d` at these points has a monomial of cost at least `d`. -/ |
| 192 | theorem New.exists_le_weight_of_mem_vanishingIdeal_pow {K ι S : Type} [Field K] [Fintype ι] |
| 193 | [Fintype S] (κ : ι → ℕ) (hκ : ∀ u : ι, 0 < κ u) (z : S → ι → K) (hz_inj : z.Injective) |
| 194 | (h_card : ∏ u : ι, κ u ≤ Fintype.card S) (g : ι → MvPolynomial ι K) |
| 195 | (hg_cost : ∀ u : ι, ∀ α ∈ (g u).support, weight (fun u : ι ↦ (κ u : ℝ))⁻¹ α < 1) |
| 196 | (hg_eval : ∀ (u : ι) (t : S), eval (z t) (g u) = z t u ^ κ u) |
| 197 | (d : ℕ) (f : MvPolynomial ι K) (hf_ne : f ≠ 0) (hf : ∀ t : S, f ∈ vanishingIdeal K {z t} ^ d) : |
| 198 | ∃ α ∈ f.support, (d : ℝ) ≤ weight (fun u : ι ↦ (κ u : ℝ))⁻¹ α := by |
| 199 | classical |
| 200 | -- Put `ψ u = X u ^ κ u - g u`, which vanishes at the points. The products `X ^ α * ψ ^ γ` with |
| 201 | -- `α < κ`, `|γ| < d` span modulo the kernel of the jet map `J` and are at most as many as the |
| 202 | -- jets, so they are independent modulo that kernel. A polynomial of cost below `d` lies in their |
| 203 | -- span; if its jets vanish, it is zero. |
| 204 | obtain ⟨Γ, hΓ⟩ : ∃ Γ : Finset (ι →₀ ℕ), ∀ γ : ι →₀ ℕ, γ ∈ Γ ↔ γ.degree < d := |
| 205 | ⟨(finite_of_degree_lt d).toFinset, fun γ ↦ Set.Finite.mem_toFinset _⟩ |
| 206 | -- The jets of order below `d` at the points: the low coefficients after translation. |
| 207 | let J : MvPolynomial ι K →ₗ[K] (S × Γ → K) := |
| 208 | LinearMap.pi fun (t, γ) ↦ lcoeff K γ ∘ₗ (aeval (X + C ∘ z t)).toLinearMap |
| 209 | have mem_ker {p : MvPolynomial ι K} (hp : ∀ t : S, p ∈ vanishingIdeal K {z t} ^ d) : p ∈ J.ker := |
| 210 | LinearMap.mem_ker.2 <| funext fun (t, γ) ↦ |
| 211 | New.coeff_translate_eq_zero_of_mem_vanishingIdeal_pow (hp t) ((hΓ γ).1 γ.property) |
| 212 | have J_surj : Function.Surjective J := fun y ↦ |
| 213 | (New.exists_forall_coeff_translate_eq hz_inj (fun γ ↦ (hΓ γ).1) y).imp |
| 214 | fun p hp ↦ funext fun (t, γ) ↦ hp t γ |
| 215 | -- The products `b α γ = X ^ α * ψ ^ γ`; they vanish to order `|γ|` at the points. |
| 216 | let b (α γ : ι →₀ ℕ) : MvPolynomial ι K := |
| 217 | monomial α 1 * aeval (R := K) (fun u : ι ↦ X u ^ κ u - g u) (monomial γ 1) |
| 218 | let v : univ.finsupp (range ∘ κ) × Γ → MvPolynomial ι K := fun (α, γ) ↦ b α γ |
| 219 | have b_span (α γ : ι →₀ ℕ) (hα : ∀ u : ι, α u < κ u) (hγ : γ.degree < d) : |
| 220 | b α γ ∈ span K (Set.range v) := |
| 221 | subset_span ⟨(⟨α, by simpa [mem_finsupp_iff]⟩, ⟨γ, (hΓ γ).2 hγ⟩), rfl⟩ |
| 222 | have b_ker (α γ : ι →₀ ℕ) (hγ : d ≤ γ.degree) : b α γ ∈ J.ker := |
| 223 | mem_ker fun t ↦ mul_mem_left _ _ |
| 224 | (New.bind₁_monomial_mem_vanishingIdeal_pow (fun u ↦ by simp [hg_eval]) hγ) |
| 225 | -- By division, every polynomial lies in the span of the `v x` modulo the kernel of `J`. |
| 226 | have mem_sup (p : MvPolynomial ι K) : p ∈ span K (Set.range v) ⊔ J.ker := by |
| 227 | refine New.mem_of_forall_monomial_mem fun α _ ↦ ?_ |
| 228 | suffices b α 0 ∈ span K (Set.range v) ⊔ J.ker by simpa [b] |
| 229 | refine New.monomial_mul_bind₁_mem_of_weight_le hκ hg_cost (fun β γ hβ _ ↦ ?_) α 0 le_rfl |
| 230 | obtain hγ | hγ := lt_or_ge γ.degree d |
| 231 | · exact mem_sup_left (b_span β γ hβ hγ) |
| 232 | · exact mem_sup_right (b_ker β γ hγ) |
| 233 | have h_span : ⊤ ≤ span K (Set.range (J ∘ v)) := fun y _ ↦ by |
| 234 | obtain ⟨p, rfl⟩ := J_surj y |
| 235 | simpa only [Set.range_comp, span_image, ← Submodule.mem_comap, Submodule.comap_map_eq] |
| 236 | using mem_sup p |
| 237 | have h_indep : LinearIndependent K (J ∘ v) := |
| 238 | linearIndependent_of_top_le_span_of_card_le_finrank h_span |
| 239 | (by simpa using Nat.mul_le_mul_right Γ.card h_card) |
| 240 | -- If all monomials of `f` cost less than `d`, division stays in the span of the `v x`. |
| 241 | by_contra! h_low |
| 242 | have hf_span : f ∈ span K (Set.range v) := New.mem_of_forall_monomial_mem fun α hα ↦ by |
| 243 | suffices b α 0 ∈ span K (Set.range v) by simpa [b] |
| 244 | refine New.monomial_mul_bind₁_mem_of_weight_le hκ hg_cost (fun β γ hβ h_le ↦ ?_) α 0 le_rfl |
| 245 | have h_nonneg : 0 ≤ weight (fun u : ι ↦ (κ u : ℝ))⁻¹ β := by |
| 246 | simp only [weight_eq_sum, Pi.inv_apply] |
| 247 | positivity |
| 248 | simp only [map_zero, Nat.cast_zero, zero_add] at h_le |
| 249 | have h_degree : (γ.degree : ℝ) < d := by linarith [h_low α hα] |
| 250 | exact b_span β γ hβ (Nat.cast_lt.1 h_degree) |
| 251 | exact hf_ne ((range_ker_disjoint h_indep).le_bot ⟨hf_span, mem_ker hf⟩) |
| 252 | |
| 253 | end ZerosCostDegree |
| 254 | |
| 255 | /-! ## Homogenization with respect to a linear form -/ |
| 256 | |
| 257 | section Homogenization |
| 258 | |
| 259 | open MvPolynomial |
| 260 | |
| 261 | /-- Homogenization by a linear form `F`: a polynomial `P` of total degree at most `N` is congruent |
| 262 | modulo `F - 1` to a homogeneous polynomial `G` of degree `N`. -/ |
| 263 | lemma New.exists_isHomogeneous_sub_one_dvd_sub {ι R : Type*} {N : ℕ} [CommRing R] |
| 264 | {F : MvPolynomial ι R} (hF : F.IsHomogeneous 1) (P : MvPolynomial ι R) |
| 265 | (hP : P.totalDegree ≤ N) : |
| 266 | ∃ G : MvPolynomial ι R, G.IsHomogeneous N ∧ F - 1 ∣ G - P := by |
| 267 | -- Multiply the homogeneous component of degree `n` of `P` by `F ^ (N - n)` and add up. |
| 268 | let G : MvPolynomial ι R := |
| 269 | ∑ n ∈ .range (P.totalDegree + 1), F ^ (N - n) * homogeneousComponent n P |
| 270 | refine ⟨G, IsHomogeneous.sum _ _ N fun n hn ↦ ?_, ?_⟩ |
| 271 | · have h_le : n ≤ N := (Finset.mem_range_succ_iff.1 hn).trans hP |
| 272 | simpa [h_le] using (hF.pow (N - n)).mul (P.homogeneousComponent_isHomogeneous n) |
| 273 | · have h_sub : G - P = |
| 274 | ∑ n ∈ .range (P.totalDegree + 1), (F ^ (N - n) - 1) * homogeneousComponent n P := by |
| 275 | simp only [G, sub_mul, one_mul, Finset.sum_sub_distrib, sum_homogeneousComponent] |
| 276 | rw [h_sub] |
| 277 | exact Finset.dvd_sum fun n _ ↦ (sub_one_dvd_pow_sub_one F (N - n)).mul_right _ |
| 278 | |
| 279 | /-- Homogenization by a linear form `F`: for a polynomial `P` over `R` of total degree at most `N` |
| 280 | there is a homogeneous `G` of degree `N` with `φ G = φ P` for every `R`-algebra map `φ` to an |
| 281 | algebra in `Type` (universe zero) with `φ F = 1`. -/ |
| 282 | lemma New.exists_homogenization {ι R : Type*} {N : ℕ} [CommRing R] {F : MvPolynomial ι R} |
| 283 | (hF : F.IsHomogeneous 1) (P : MvPolynomial ι R) (hP : P.totalDegree ≤ N) : |
| 284 | ∃ G : MvPolynomial ι R, G.IsHomogeneous N ∧ |
| 285 | ∀ {A : Type} [CommRing A] [Algebra R A] (φ : MvPolynomial ι R →ₐ[R] A), |
| 286 | φ F = 1 → φ G = φ P := by |
| 287 | obtain ⟨G, hG, h_dvd⟩ := New.exists_isHomogeneous_sub_one_dvd_sub hF P hP |
| 288 | exact ⟨G, hG, fun φ hφ ↦ by simpa [hφ, sub_eq_zero] using map_dvd φ h_dvd⟩ |
| 289 | |
| 290 | end Homogenization |
| 291 | |
| 292 | /-! ## The weak Nullstellensatz for finite type algebras -/ |
| 293 | |
| 294 | section Nullstellensatz |
| 295 | |
| 296 | open Algebra Ideal Quotient |
| 297 | |
| 298 | /-- Nullstellensatz: in an algebra `A` of finite type over an algebraically closed field `k`, |
| 299 | every proper ideal lies in the kernel of some `k`-algebra homomorphism `A → k`. -/ |
| 300 | lemma New.nullstellensatz_exists_le_ker {k A : Type*} [Field k] [IsAlgClosed k] [CommRing A] |
| 301 | [Algebra k A] [FiniteType k A] {J : Ideal A} (hJ : J ≠ ⊤) : |
| 302 | ∃ φ : A →ₐ[k] k, J ≤ RingHom.ker φ := by |
| 303 | -- The quotient by a maximal ideal `m ⊇ J` is a field, finite over `k` (Zariski's lemma), so it |
| 304 | -- embeds into the algebraically closed field `k`. |
| 305 | obtain ⟨m, hm : m.IsMaximal, hJm : J ≤ m⟩ := J.exists_le_maximal hJ |
| 306 | let : Field (A ⧸ m) := Quotient.field m |
| 307 | have : Module.Finite k (A ⧸ m) := finite_of_finite_type_of_isJacobsonRing k (A ⧸ m) |
| 308 | exact ⟨IsAlgClosed.lift.comp (mkₐ k m), fun a ha ↦ by simp [eq_zero_iff_mem.2 (hJm ha)]⟩ |
| 309 | |
| 310 | end Nullstellensatz |
| 311 | |
| 312 | /-! ## Nakayama's lemma in tangent form -/ |
| 313 | |
| 314 | section TangentNakayama |
| 315 | |
| 316 | open DualNumber Module RingHom Algebra FinitePresentation Ideal Quotient TrivSqZeroExt |
| 317 | |
| 318 | /-- Let `x : S → V` be a section of a finite type `V`-algebra and `I` an ideal of `S`. If the |
| 319 | prime `P` contains the colon ideal `I.colon (ker x)`, then the image of `ker x` in `S ⧸ I` has a |
| 320 | non-zero linear map to the residue field of `P`. -/ |
| 321 | private lemma exists_linearMap_residueField_ne_zero_of_colon_le {V S : Type*} [CommRing V] |
| 322 | [CommRing S] [Algebra V S] [FiniteType V S] {x : S →ₐ[V] V} {I : Ideal S} |
| 323 | {P : PrimeSpectrum S} (h_le : I.colon (ker x) ≤ P.asIdeal) : |
| 324 | ∃ l : Submodule.map I.mkQ (ker x) →ₗ[S] P.asIdeal.ResidueField, l ≠ 0 := by |
| 325 | algebraize [x.toRingHom] |
| 326 | -- `V` is finitely presented over `S` via `x`, so `ker x` is finitely generated |
| 327 | have : Algebra.FinitePresentation S V := of_restrict_scalars_finitePresentation V S V |
| 328 | have : Module.Finite S (ker x) := |
| 329 | .of_fg (ker_fG_of_surjective (ofId S V) fun v ↦ ⟨algebraMap V S v, x.commutes v⟩) |
| 330 | have hP : P ∈ support S (Submodule.map I.mkQ (ker x)) := |
| 331 | mem_support_iff_of_finite.2 (I.annihilator_map_mkQ_eq_colon.trans_le h_le) |
| 332 | -- the fibre `κ(P) ⊗ (ker x ⧸ I)` is a non-zero vector space, so its dual is non-zero |
| 333 | have h_fibre := (mem_support_iff_nontrivial_residueField_tensorProduct P).1 hP |
| 334 | have : Nontrivial (Submodule.map I.mkQ (ker x) →ₗ[S] P.asIdeal.ResidueField) := |
| 335 | (LinearMap.liftBaseChangeEquiv _).nontrivial_congr.2 ((nontrivial_dual_iff _).2 h_fibre) |
| 336 | exact exists_ne 0 |
| 337 | |
| 338 | /-- Nakayama's lemma in tangent form. Let `x : S → V` be a section of a finite type `V`-algebra, |
| 339 | `o : S → k` the field-valued point on it given by `V → k`, and `I ⊆ ker x` an ideal. If every |
| 340 | lift `w` of `o` to the dual numbers `k[ε]` that kills `I` has zero `ε`-part (no nonzero tangent |
| 341 | vector along the fibre kills `I`), then `I` generates `ker x` near `o`: some `b` with `o b ≠ 0` |
| 342 | has `b * ker x ⊆ I`. -/ |
| 343 | lemma New.exists_mem_colon_of_tangent {V S k : Type*} [CommRing V] [CommRing S] [Algebra V S] |
| 344 | [FiniteType V S] [Field k] [Algebra V k] {x : S →ₐ[V] V} {o : S →ₐ[V] k} |
| 345 | (ho : (ofId V k).comp x = o) {I : Ideal S} (hI : I ≤ ker x) |
| 346 | (h_tan : ∀ w : S →ₐ[V] k[ε], (∀ s : S, (w s).fst = o s) → I ≤ ker w → ∀ s : S, (w s).snd = 0) : |
| 347 | ∃ b ∈ I.colon (ker x), o b ≠ 0 := by |
| 348 | -- Otherwise the point `P` under `o` is in the support of the finite module `M = ker x / I`, so |
| 349 | -- `M` has a non-zero functional `l` with values in the residue field of `P`. Composed with the |
| 350 | -- projection `a ↦ a - x a` onto `ker x`, it is a tangent vector at `o` that kills `I`; by |
| 351 | -- `h_tan` it vanishes, so `l = 0`. |
| 352 | let P : PrimeSpectrum S := PrimeSpectrum.comap o.toRingHom ⊥ |
| 353 | let M : Submodule S (S ⧸ I) := Submodule.map I.mkQ (ker x) |
| 354 | by_contra! h_colon |
| 355 | have h_le : I.colon (ker x) ≤ P.asIdeal := h_colon |
| 356 | obtain ⟨l, hl⟩ : ∃ l : M →ₗ[S] P.asIdeal.ResidueField, l ≠ 0 := |
| 357 | exists_linearMap_residueField_ne_zero_of_colon_le (x := x) h_le |
| 358 | -- `ϖ a` is the class in `M` of the projection `a - x a` of `a` onto `ker x` |
| 359 | let ϖ (a : S) : M := ⟨I.mkQ (a - ofId V S (x a)), Submodule.mem_map_of_mem (by simp)⟩ |
| 360 | have ϖ_add (s t : S) : ϖ (s + t) = ϖ s + ϖ t := by simp [ϖ, sub_add_sub_comm] |
| 361 | have ϖ_const (r : V) : ϖ (algebraMap V S r) = 0 := by simp [ϖ, ← ZeroMemClass.zero_def] |
| 362 | have ϖ_mul (s t : S) : ϖ (s * t) = s • ϖ t + algebraMap V S (x t) • ϖ s := by |
| 363 | have h_leibniz : s * t - algebraMap V S (x (s * t)) = |
| 364 | s * (t - algebraMap V S (x t)) + algebraMap V S (x t) * (s - algebraMap V S (x s)) := by |
| 365 | simp only [map_mul] |
| 366 | ring |
| 367 | ext |
| 368 | simp only [ϖ, h_leibniz, Submodule.coe_add, Submodule.coe_smul, ← map_smul, ← map_add, |
| 369 | smul_eq_mul, ofId_apply] |
| 370 | let κ : P.asIdeal.ResidueField →+* k := |
| 371 | ResidueField.lift P.asIdeal o.toRingHom le_rfl fun s ↦ .mk0 (o s) |
| 372 | let D (s : S) : k := κ (l (ϖ s)) |
| 373 | have D_mul (s t : S) : D (s * t) = o s * D t + o t * D s := by |
| 374 | have κ_smul (a : S) (c : P.asIdeal.ResidueField) : κ (a • c) = o a * κ c := by |
| 375 | simp [smul_def, κ] |
| 376 | have o_proj : o (algebraMap V S (x t)) = o t := by simp [← ho] |
| 377 | simp only [D, ϖ_mul, map_add, map_smul, κ_smul, o_proj] |
| 378 | -- the tangent vector `s ↦ o s + D s ε`; it is multiplicative by the Leibniz rule `D_mul` |
| 379 | let w : S →ₐ[V] k[ε] := |
| 380 | { toFun s := inl (o s) + inr (D s) |
| 381 | map_one' := by simp [D, ϖ, ← ZeroMemClass.zero_def] |
| 382 | map_mul' s t := by simp [D_mul, TrivSqZeroExt.ext_iff, mul_comm (o t)] |
| 383 | map_zero' := by simp [D, ϖ, ← ZeroMemClass.zero_def] |
| 384 | map_add' s t := by simp [D, ϖ_add, TrivSqZeroExt.ext_iff] |
| 385 | commutes' r := by simp [D, ϖ_const, algebraMap_eq_inl'] } |
| 386 | have w_ker : I ≤ ker w := fun s hs ↦ by |
| 387 | simp [w, D, ϖ, ← ho, mem_ker.1 (hI hs), eq_zero_iff_mem.2 hs, ← ZeroMemClass.zero_def] |
| 388 | have D_zero (s : S) : D s = 0 := by simpa [w] using h_tan w (by simp [w]) w_ker s |
| 389 | -- on `ker x` the map `ϖ` is the projection onto `M`, and `κ` is injective |
| 390 | refine hl (LinearMap.ext ?_) |
| 391 | rintro ⟨_, q, hq, rfl⟩ |
| 392 | simpa [D, ϖ, mem_ker.1 hq] using D_zero q |
| 393 | |
| 394 | end TangentNakayama |
| 395 | |
| 396 | /-! ## Hensel's lemma in several variables -/ |
| 397 | |
| 398 | section MultivariateHensel |
| 399 | |
| 400 | open IsLocalization.Away IsLocalRing MvPolynomial Algebra Localization PreSubmersivePresentation |
| 401 | |
| 402 | /-- An absolutely integrally closed local domain is Henselian, since every residual root |
| 403 | of a monic polynomial lifts to the domain. -/ |
| 404 | lemma New.Variety.IsAbsIntegrallyClosedLocal.henselianLocalRing {A : Type*} [CommRing A] |
| 405 | [IsAbsIntegrallyClosedLocal A] : HenselianLocalRing A where |
| 406 | is_henselian f hf a₀ ha _ := by |
| 407 | have h_root : f.eval₂ (residue A) (residue A a₀) = 0 := by |
| 408 | rw [Polynomial.eval₂_at_apply] |
| 409 | exact Ideal.Quotient.eq_zero_iff_mem.mpr ha |
| 410 | obtain ⟨a, ha_root, ha_residue⟩ := IsAbsIntegrallyClosed.exists_root_map_eq hf h_root |
| 411 | exact ⟨a, ha_root, Ideal.Quotient.eq.mp ha_residue⟩ |
| 412 | |
| 413 | /-- Hensel's lemma in several variables. Over a Henselian local ring `A`, if the polynomials |
| 414 | `p i` in finitely many variables have all their coefficients in the maximal ideal, the system |
| 415 | `x i = p i (x)` has a solution. -/ |
| 416 | lemma New.Variety.multivariate_hensel {A : Type*} [CommRing A] [HenselianLocalRing A] |
| 417 | {ι : Type} [Fintype ι] {p : ι → MvPolynomial ι A} |
| 418 | (hp : ∀ (i : ι) (m : ι →₀ ℕ), (p i).coeff m ∈ maximalIdeal A) : |
| 419 | ∃ x : ι → A, ∀ i : ι, x i = aeval x (p i) := by |
| 420 | classical |
| 421 | -- The algebra `A[X] / (X - p)` with the Jacobian inverted is étale over `A`. |
| 422 | let Q := MvPolynomial ι A ⧸ Ideal.span (Set.range (X - p)) |
| 423 | let Z : PreSubmersivePresentation A Q ι ι := |
| 424 | PreSubmersivePresentation.naive (v := X - p) _ Function.injective_id |
| 425 | let L : PreSubmersivePresentation Q (Away Z.jacobian) Unit Unit := localizationAway _ Z.jacobian |
| 426 | have hL : IsUnit (L.comp Z).jacobian := by |
| 427 | simp [L, smul_def, algebraMap_isUnit (S := Away Z.jacobian) Z.jacobian] |
| 428 | have : Algebra.IsStandardSmoothOfRelativeDimension 0 A (Away Z.jacobian) := |
| 429 | SubmersivePresentation.isStandardSmoothOfRelativeDimension ⟨L.comp Z, hL⟩ (tsub_self _) |
| 430 | -- The origin of the closed fibre is a point of it: there `p` vanishes and the Jacobian is `1`. |
| 431 | let origin : MvPolynomial ι A →ₐ[A] ResidueField A := aeval 0 |
| 432 | have origin_eq_zero {q : MvPolynomial ι A} (hq : q.coeff 0 ∈ maximalIdeal A) : origin q = 0 := by |
| 433 | simpa [origin, constantCoeff_eq] using hq |
| 434 | have hker : Ideal.span (Set.range (X - p)) ≤ RingHom.ker origin := |
| 435 | Ideal.span_le.2 (Set.range_subset_iff.2 fun i ↦ origin_eq_zero (by simpa using hp i 0)) |
| 436 | have hjac : origin.mapMatrix Z.jacobiMatrix = 1 := by |
| 437 | ext i j |
| 438 | have h_deriv : origin (pderiv i (p j)) = 0 := |
| 439 | origin_eq_zero (by simpa [coeff_pderiv] using hp j _) |
| 440 | have h_entry : Z.jacobiMatrix i j = pderiv i (X j - p j) := jacobiMatrix_apply Z i j |
| 441 | simp [h_entry, h_deriv, Matrix.one_apply, Pi.single_apply, eq_comm] |
| 442 | have hunit : IsUnit (Ideal.Quotient.liftₐ _ origin hker Z.jacobian) := by |
| 443 | rw [Z.jacobian_eq_jacobiMatrix_det] |
| 444 | change IsUnit (origin Z.jacobiMatrix.det) |
| 445 | simp [origin.map_det, hjac] |
| 446 | let π : Away Z.jacobian →ₐ[A] ResidueField A := liftAlgHom Z.jacobian hunit |
| 447 | -- Lift the closed-fibre point over the Henselian pair and restrict to the equations. |
| 448 | have : Algebra.Etale A (Away Z.jacobian) := |
| 449 | Algebra.Etale.iff_isStandardSmoothOfRelativeDimension_zero.mpr inferInstance |
| 450 | obtain ⟨τ, -⟩ := (TauCeti.HenselianRing.comp_bijective (maximalIdeal A)).surjective π |
| 451 | let σ : Q →ₐ[A] A := τ.comp (algHom A Q (Away Z.jacobian)) |
| 452 | refine ⟨fun i ↦ σ (Z.val i), fun i ↦ ?_⟩ |
| 453 | have h_rel : aeval Z.val (X i - p i) = 0 := Z.aeval_val_relation i |
| 454 | have h_val : Z.val i = aeval Z.val (p i) := by rwa [map_sub, aeval_X, sub_eq_zero] at h_rel |
| 455 | rw [← comp_aeval_apply, ← h_val] |
| 456 | |
| 457 | end MultivariateHensel |