module public import Quintic85.Cert public import Mathlib.FieldTheory.IsAlgClosed.Basic public import Mathlib.FieldTheory.Separable public import Mathlib.Tactic.ComputeDegree @[expose] public section /-! # The auxiliary quartics and their roots The lines on `X_t` are parametrised by roots of five families of quartic polynomials: * `polyInf c = c⁴ + 6c² - 3` — lines in the plane `x₃ = 0` (Yu–Zhu, proof of Thm 1.1); * `polyB t μ = μ⁴ - tμ` — the planes `x₄ = μ x₃` through `L₁` that contain extra lines; * `polyq μ c = (1-μ)c⁴ - 6(1+μ)c² - 3(1-μ)` — the four lines in such a plane; * `polyR r = r⁴ - 6r² - 3` — the first coordinate `r` of a skew line ((3.2)); * `polyQ t r u = r²u⁴ + (3+r²)u³ - t(9-r²)u - t(6-r²)` — obtained by eliminating `λ⁴` from (3.3) and (3.6); * `polyL r u λ = λ⁴ - lamVal r u` with `lamVal r u = -1 / (12 (6 - r² + (9-r²)u))` — (3.6). Over an algebraically closed field of characteristic zero each of them has exactly four roots (for the relevant parameters). The key point, "all roots are simple", is a certificate found by Magma and checked in `Quintic85.Cert`. -/ namespace Quintic85 open Polynomial Quintic85.Cert open scoped Classical variable {K : Type*} [Field K] /-- Over an algebraically closed field, a nonzero polynomial all of whose roots are simple has exactly `natDegree` distinct roots. -/ theorem card_roots_toFinset_of_simple [IsAlgClosed K] {p : K[X]} (hp : p ≠ 0) (hsimple : ∀ x, p.eval x = 0 → (derivative p).eval x ≠ 0) : p.roots.toFinset.card = p.natDegree := by have hnd : p.roots.Nodup := by rw [Multiset.nodup_iff_count_le_one] intro x rw [count_roots] by_contra hlt push Not at hlt obtain ⟨h1, h2⟩ := (one_lt_rootMultiplicity_iff_isRoot hp).mp hlt exact hsimple x h1 h2 rw [Multiset.toFinset_card_of_nodup hnd, ← (IsAlgClosed.splits p).natDegree_eq_card_roots] theorem mem_roots_toFinset_iff {p : K[X]} (hp : p ≠ 0) {x : K} : x ∈ p.roots.toFinset ↔ p.eval x = 0 := by rw [Multiset.mem_toFinset, mem_roots hp, IsRoot.def] /-! ### The five families -/ /-- `R(r) = r⁴ - 6r² - 3`. -/ noncomputable def polyR : K[X] := X ^ 4 - C 6 * X ^ 2 - C 3 /-- `c⁴ + 6c² - 3`: lines in the plane `x₃ = 0`. -/ noncomputable def polyInf : K[X] := X ^ 4 + C 6 * X ^ 2 - C 3 /-- `B(μ) = μ⁴ - tμ`. -/ noncomputable def polyB (t : K) : K[X] := X ^ 4 - C t * X /-- `q_μ(c) = (1-μ)c⁴ - 6(1+μ)c² - 3(1-μ)`. -/ noncomputable def polyq (mu : K) : K[X] := C (1 - mu) * X ^ 4 - C (6 * (1 + mu)) * X ^ 2 - C (3 * (1 - mu)) /-- `Q_r(u) = r²u⁴ + (3+r²)u³ - t(9-r²)u - t(6-r²)`. -/ noncomputable def polyQ (t r : K) : K[X] := C (r ^ 2) * X ^ 4 + C (3 + r ^ 2) * X ^ 3 - C (t * (9 - r ^ 2)) * X - C (t * (6 - r ^ 2)) /-- `λ⁴ = -1 / (12 D(r,u))`, `D(r,u) = 6 - r² + (9 - r²)u` (from (3.6)). -/ noncomputable def lamVal (r u : K) : K := -1 / (12 * (6 - r ^ 2 + (9 - r ^ 2) * u)) /-- `λ⁴ - lamVal r u`. -/ noncomputable def polyL (r u : K) : K[X] := X ^ 4 - C (lamVal r u) @[simp] theorem eval_polyR (x : K) : polyR.eval x = x ^ 4 - 6 * x ^ 2 - 3 := by simp [polyR] @[simp] theorem eval_polyInf (x : K) : polyInf.eval x = x ^ 4 + 6 * x ^ 2 - 3 := by simp [polyInf] @[simp] theorem eval_polyB (t x : K) : (polyB t).eval x = x ^ 4 - t * x := by simp [polyB] @[simp] theorem eval_polyq (mu x : K) : (polyq mu).eval x = (1 - mu) * x ^ 4 - 6 * (1 + mu) * x ^ 2 - 3 * (1 - mu) := by simp [polyq] @[simp] theorem eval_polyQ (t r x : K) : (polyQ t r).eval x = r ^ 2 * x ^ 4 + (3 + r ^ 2) * x ^ 3 - t * (9 - r ^ 2) * x - t * (6 - r ^ 2) := by simp [polyQ] @[simp] theorem eval_polyL (r u x : K) : (polyL r u).eval x = x ^ 4 - lamVal r u := by simp [polyL] theorem natDegree_polyR [CharZero K] : (polyR : K[X]).natDegree = 4 := by unfold polyR; compute_degree! theorem natDegree_polyInf [CharZero K] : (polyInf : K[X]).natDegree = 4 := by unfold polyInf; compute_degree! theorem natDegree_polyB (t : K) : (polyB t).natDegree = 4 := by unfold polyB; compute_degree! theorem natDegree_polyq {mu : K} (h : 1 - mu ≠ 0) : (polyq mu).natDegree = 4 := by unfold polyq; compute_degree! theorem natDegree_polyQ {t r : K} (h : r ≠ 0) : (polyQ t r).natDegree = 4 := by unfold polyQ; compute_degree! theorem natDegree_polyL (r u : K) : (polyL r u).natDegree = 4 := by unfold polyL; compute_degree! theorem polyR_ne_zero [CharZero K] : (polyR : K[X]) ≠ 0 := ne_zero_of_natDegree_gt (n := 0) (by rw [natDegree_polyR]; norm_num) theorem polyInf_ne_zero [CharZero K] : (polyInf : K[X]) ≠ 0 := ne_zero_of_natDegree_gt (n := 0) (by rw [natDegree_polyInf]; norm_num) theorem polyB_ne_zero (t : K) : polyB t ≠ 0 := ne_zero_of_natDegree_gt (n := 0) (by rw [natDegree_polyB]; norm_num) theorem polyq_ne_zero {mu : K} (h : 1 - mu ≠ 0) : polyq mu ≠ 0 := ne_zero_of_natDegree_gt (n := 0) (by rw [natDegree_polyq h]; norm_num) theorem polyQ_ne_zero {t r : K} (h : r ≠ 0) : polyQ t r ≠ 0 := ne_zero_of_natDegree_gt (n := 0) (by rw [natDegree_polyQ h]; norm_num) theorem polyL_ne_zero (r u : K) : polyL r u ≠ 0 := ne_zero_of_natDegree_gt (n := 0) (by rw [natDegree_polyL]; norm_num) /-! ### Derivatives -/ theorem eval_derivative_polyR (x : K) : (derivative (polyR : K[X])).eval x = 4 * x ^ 3 - 12 * x := by simp [polyR] ring theorem eval_derivative_polyInf (x : K) : (derivative (polyInf : K[X])).eval x = 4 * x ^ 3 + 12 * x := by simp [polyInf] ring theorem eval_derivative_polyB (t x : K) : (derivative (polyB t)).eval x = 4 * x ^ 3 - t := by simp only [polyB, derivative_sub, derivative_mul, derivative_X_pow, derivative_C, derivative_X, eval_sub, eval_mul, eval_pow, eval_X, eval_C, Nat.cast_ofNat, Nat.reduceSub, zero_mul, mul_one, zero_add] theorem eval_derivative_polyq (mu x : K) : (derivative (polyq mu)).eval x = 4 * (1 - mu) * x ^ 3 - 12 * (1 + mu) * x := by simp [polyq] ring theorem eval_derivative_polyQ (t r x : K) : (derivative (polyQ t r)).eval x = 4 * r ^ 2 * x ^ 3 + 3 * (3 + r ^ 2) * x ^ 2 - t * (9 - r ^ 2) := by simp only [polyQ, derivative_sub, derivative_add, derivative_mul, derivative_X_pow, derivative_C, derivative_X, eval_sub, eval_add, eval_mul, eval_pow, eval_X, eval_C, Nat.cast_ofNat, Nat.reduceSub, zero_mul, mul_one, zero_add, sub_zero] ring theorem eval_derivative_polyL (r u x : K) : (derivative (polyL r u)).eval x = 4 * x ^ 3 := by simp only [polyL, derivative_sub, derivative_X_pow, derivative_C, eval_mul, eval_pow, eval_X, eval_C, Nat.cast_ofNat, Nat.reduceSub, sub_zero] /-! ### Exactly four roots each -/ variable [CharZero K] [IsAlgClosed K] /-- `R(r) = r⁴ - 6r² - 3` has four distinct roots: the values of `r` in (3.2). -/ theorem card_roots_polyR : (polyR : K[X]).roots.toFinset.card = 4 := by rw [card_roots_toFinset_of_simple polyR_ne_zero, natDegree_polyR] intro x hx hx' rw [eval_polyR] at hx rw [eval_derivative_polyR] at hx' exact R_simple (r := x) hx hx' /-- `c⁴ + 6c² - 3` has four distinct roots: the four lines in the plane `x₃ = 0`. -/ theorem card_roots_polyInf : (polyInf : K[X]).roots.toFinset.card = 4 := by rw [card_roots_toFinset_of_simple polyInf_ne_zero, natDegree_polyInf] intro x hx hx' rw [eval_polyInf] at hx rw [eval_derivative_polyInf] at hx' exact Pinf_simple (c := x) hx hx' /-- For `t ≠ 0`, `B(μ) = μ⁴ - tμ` has four distinct roots: the planes `x₄ = μx₃` through `L₁` that contain further lines. -/ theorem card_roots_polyB {t : K} (ht : t ≠ 0) : (polyB t).roots.toFinset.card = 4 := by rw [card_roots_toFinset_of_simple (polyB_ne_zero t), natDegree_polyB] intro x hx hx' rw [eval_polyB] at hx rw [eval_derivative_polyB] at hx' have h2 := B_simple (mu := x) (t := t) hx hx' exact ht (pow_eq_zero_iff (n := 2) (by norm_num) |>.mp (by linear_combination h2)) omit [IsAlgClosed K] in /-- For a root `μ` of `B` the leading coefficient `1 - μ` of `q_μ` is nonzero (as `t ≠ 1`). -/ theorem one_sub_ne_zero_of_rootB {t mu : K} (ht : t ≠ 1) (hB : mu ^ 4 - t * mu = 0) : 1 - mu ≠ 0 := by intro h have h' := lead_q (mu := mu) (t := t) hB rw [h, zero_mul] at h' exact ht (by linear_combination h') /-- For `t ≠ 1` and a root `μ` of `B`, `q_μ` has four distinct roots: the four lines through the vertex `(0 : 0 : 1 : μ)`. -/ theorem card_roots_polyq {t mu : K} (ht : t ≠ 1) (hB : mu ^ 4 - t * mu = 0) : (polyq mu).roots.toFinset.card = 4 := by have hl := one_sub_ne_zero_of_rootB ht hB rw [card_roots_toFinset_of_simple (polyq_ne_zero hl), natDegree_polyq hl] intro x hx hx' rw [eval_polyq] at hx rw [eval_derivative_polyq] at hx' have h2 := q_simple (mu := mu) (cc := x) (t := t) hB hx hx' exact ht (by linear_combination h2) /-- The paper's "clearly exactly 16 solutions": for `t ∉ {0, 1}` and a root `r` of `R`, the quartic `Q_r(u)` has four distinct roots (a double root forces `t² = t`, `Cert.Q_simple`). -/ theorem card_roots_polyQ {t r : K} (ht0 : t ≠ 0) (ht1 : t ≠ 1) (hR : r ^ 4 - 6 * r ^ 2 - 3 = 0) : (polyQ t r).roots.toFinset.card = 4 := by have hr : r ≠ 0 := by rintro rfl norm_num at hR rw [card_roots_toFinset_of_simple (polyQ_ne_zero hr), natDegree_polyQ hr] intro x hx hx' rw [eval_polyQ] at hx rw [eval_derivative_polyQ] at hx' have h2 := Q_simple (r := r) (t := t) (u := x) hR hx hx' have h3 : t * (t - 1) = 0 := by linear_combination h2 rcases mul_eq_zero.mp h3 with h | h · exact ht0 h · exact ht1 (by linear_combination h) /-- `λ⁴ = λ₀` with `λ₀ ≠ 0` has four distinct roots `λ`. -/ theorem card_roots_polyL {r u : K} (hl : lamVal r u ≠ 0) : (polyL r u).roots.toFinset.card = 4 := by rw [card_roots_toFinset_of_simple (polyL_ne_zero r u), natDegree_polyL] intro x hx hx' rw [eval_polyL] at hx rw [eval_derivative_polyL] at hx' have hx0 : x = 0 := by have h3 : x ^ 3 = 0 := by linear_combination (1 / 4 : K) * hx' exact pow_eq_zero_iff (n := 3) (by norm_num) |>.mp h3 subst hx0 exact hl (by linear_combination -hx) end Quintic85