/-Copyright (c) 2026 Carles Marín. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles Marín-/module public import Formalizations.NumberTheory.NumberField.InvariantOrders.BiquadraticIdentitiespublic import Mathlib.LinearAlgebra.Matrix.Determinant.Basicpublic import Mathlib.LinearAlgebra.Vandermondepublic import Mathlib.RingTheory.Polynomial.Contentpublic import Mathlib.RingTheory.Coprime.Lemmaspublic import Mathlib.LinearAlgebra.Finsupp.LinearCombinationpublic import Mathlib.Tactic.LinearCombinationpublic import Mathlib.Tactic.FinCasespublic import Mathlib.Data.ZMod.Basic /-!# Louboutin's Conjecture 6.1 in an abstract biquadratic model Model (`Louboutin.Conj61.V4Data O`): `O` a commutative domain of characteristic `0` (think `𝓞_K`),four distinct elements `x 0, …, x 3` (the conjugates of `α = x 0`), three ring endomorphisms`τ₁, τ₂, τ₃` acting on them by the labelling `τ_i x_k = x_{i xor k}`, and `fix`: an element fixedby `τ₁, τ₂, τ₃` is an integer (for `𝓞_K` with `Gal(K/ℚ) ≅ V₄`, `𝓞_K^G = ℤ`). `Zα` is the`ℤ`-span of `1, α, α², α³` (`= ℤ[α]`, `Zα_mul_mem`); "`ℤ[α]` Galois-invariant" means that everyconjugate lies in `Zα`. The route avoids content ideals over `𝓞_K`: for each `j`, `r_j²` and `r_j ΔQ_j` are invariant,hence integers; dividing by their gcd gives `r_j = n_j ϑ_j`, `ΔQ_j = t_j ϑ_j` with `ϑ_j ∈ O`(Bézout), `Θ = ϑ₁ϑ₂ϑ₃` is an integer `θ`, and `P(X) = θ ∏(n_j X + t_j)` with a primitiveproduct (Gauss's lemma, `IsPrimitive.mul`). ## Main results * `Louboutin.Conj61.V4Data.thm2`: an integer dividing `T, U, V, W` divides every `N_jk`.* `Louboutin.Conj61.V4Data.gcd_TUVW`: `gcd(T, U, V, W) = |θ|`.* `Louboutin.Conj61.V4Data.conj61`: Conjecture 6.1, `ℤ[α]` is invariant iff `Δ = Vand` divides `T, U, V, W`.* `Louboutin.Conj61.V4Data.exists_ints`: `T, U, V, W, Δ` are integers, `Δ ≠ 0` and `Δ` is even.* `Louboutin.Conj61.V4Data.cor_weak`, `Louboutin.Conj61.V4Data.conj61_weak`: invariance iff `Δ ∣ T, U, V ± W`. ## References * S. R. Louboutin, *On the order generated by the conjugates of an algebraic integer*, in: Algebra, Logic and Number Theory, Banach Center Publ. 121 (2020), 107–124, doi:10.4064/bc121-10.* S. R. Louboutin, *When is the order generated by a cubic, quartic or quintic algebraic unit Galois invariant: three conjectures*, Czechoslovak Math. J. 70 (2020), 905–919, doi:10.21136/CMJ.2020.0019-19.* C. Marín, *Orders generated by conjugates of Galois quartic integers*, preprint (2026).-/ @[expose] public section namespace Louboutin.Conj61 open Polynomial Matrix -- generated uniform simp sets (τ-action) and section-wide model hypothesesset_option linter.unusedSimpArgs falseset_option linter.unusedSectionVars false /-! ### Determinants (Lemma 1.3) -/ section detvariable {R : Type*} [CommRing R] theorem det4 (A : Matrix (Fin 4) (Fin 4) R) : A.det = det4e (A 0 0) (A 0 1) (A 0 2) (A 0 3) (A 1 0) (A 1 1) (A 1 2) (A 1 3) (A 2 0) (A 2 1) (A 2 2) (A 2 3) (A 3 0) (A 3 1) (A 3 2) (A 3 3) := by rw [Matrix.det_succ_row_zero] simp [Fin.sum_univ_succ, Matrix.det_fin_three, Fin.succAbove, det4e, Matrix.submatrix] ring theorem vand4 (x : Fin 4 → R) : (vandermonde x).det = Vand x := by rw [det_vandermonde] simp [Fin.prod_univ_succ, Fin.prod_Ioi_succ, Vand] ring /-- **Lemma 1.3**: if column l has conjugates E i l = Σ_k c_lk x_iᵏ (c integral), then det E = Vand · det c. -/theorem det_coord (x : Fin 4 → R) (E : Matrix (Fin 4) (Fin 4) R) (c : Matrix (Fin 4) (Fin 4) ℤ) (hE : ∀ i l, E i l = ∑ k : Fin 4, (c l k : R) * x i ^ (k : ℕ)) : E.det = Vand x * ((c.det : ℤ) : R) := by have hE' : E = vandermonde x * (c.map (Int.castRingHom R))ᵀ := by ext i l rw [hE, Matrix.mul_apply] simp [vandermonde_apply, mul_comm] rw [hE', det_mul, det_transpose, vand4] congr 1 rw [show ((c.det : ℤ) : R) = Int.castRingHom R c.det from rfl, RingHom.map_det] rfl end det /-! ### Integer bookkeeping (the ℤ[X] Gauss step) -/ theorem prim_lin {n t : ℤ} (h : IsCoprime n t) : (C n * X + C t).IsPrimitive := by intro r hr rw [C_dvd_iff_dvd_coeff] at hr have h1 := hr 1 have h0 := hr 0 rw [coeff_add, coeff_C_mul_X, coeff_C] at h1 h0 simp at h1 h0 exact h.isUnit_of_dvd' h1 h0 /-- Gauss for primitive polynomials over ℤ: if g divides every coefficient of θ·∏_j (n_j X + t_j) with gcd(n_j, t_j) = 1, then g ∣ θ. -/theorem gauss3 {g θ n₁ n₂ n₃ t₁ t₂ t₃ : ℤ} (h₁ : IsCoprime n₁ t₁) (h₂ : IsCoprime n₂ t₂) (h₃ : IsCoprime n₃ t₃) (hu : g ∣ θ * (n₁ * n₂ * n₃)) (hv : g ∣ θ * (n₁ * n₂ * t₃ + n₁ * t₂ * n₃ + t₁ * n₂ * n₃)) (hw : g ∣ θ * (n₁ * t₂ * t₃ + t₁ * n₂ * t₃ + t₁ * t₂ * n₃)) (ht : g ∣ θ * (t₁ * t₂ * t₃)) : g ∣ θ := by set F : ℤ[X] := (C n₁ * X + C t₁) * (C n₂ * X + C t₂) * (C n₃ * X + C t₃) with hFdef have hF : F.IsPrimitive := ((prim_lin h₁).mul (prim_lin h₂)).mul (prim_lin h₃) have hexp : C θ * F = C (θ * (n₁ * n₂ * n₃)) * X ^ 3 + C (θ * (n₁ * n₂ * t₃ + n₁ * t₂ * n₃ + t₁ * n₂ * n₃)) * X ^ 2 + C (θ * (n₁ * t₂ * t₃ + t₁ * n₂ * t₃ + t₁ * t₂ * n₃)) * X + C (θ * (t₁ * t₂ * t₃)) := by simp only [hFdef, map_mul, map_add]; ring have hdvd : C g ∣ C θ * F := by rw [hexp] exact dvd_add (dvd_add (dvd_add ((map_dvd C hu).mul_right _) ((map_dvd C hv).mul_right _)) ((map_dvd C hw).mul_right _)) (map_dvd C ht) have := (dvd_content_iff_C_dvd).mpr hdvd rw [content_C_mul, hF.content_eq_one, mul_one] at this exact dvd_normalize_iff.mp this /-! ### The model -/ /-- V4 data: conjugates `x`, the three nontrivial automorphisms in the XOR labelling, and "invariant ⇒ integer". -/structure V4Data (O : Type*) [CommRing O] where x : Fin 4 → O τ₁ : O →+* O τ₂ : O →+* O τ₃ : O →+* O h₁ : τ₁ (x 0) = x 1 ∧ τ₁ (x 1) = x 0 ∧ τ₁ (x 2) = x 3 ∧ τ₁ (x 3) = x 2 h₂ : τ₂ (x 0) = x 2 ∧ τ₂ (x 1) = x 3 ∧ τ₂ (x 2) = x 0 ∧ τ₂ (x 3) = x 1 h₃ : τ₃ (x 0) = x 3 ∧ τ₃ (x 1) = x 2 ∧ τ₃ (x 2) = x 1 ∧ τ₃ (x 3) = x 0 fix : ∀ y, τ₁ y = y → τ₂ y = y → τ₃ y = y → ∃ n : ℤ, y = n inj : Function.Injective x namespace V4Data variable {O : Type*} [CommRing O] [IsDomain O] [CharZero O] (M : V4Data O) /-- ℤ[α] = ℤ + ℤα + ℤα² + ℤα³ inside O. -/def Zα : Submodule ℤ O := Submodule.span ℤ (Set.range fun k : Fin 4 => M.x 0 ^ (k : ℕ)) /-- the four elements of V4 as ring maps, row i = σ_i (σ_0 = id). -/def ρ (i : Fin 4) : O →+* O := ![RingHom.id O, M.τ₁, M.τ₂, M.τ₃] i theorem ρ_x0 (i : Fin 4) : M.ρ i (M.x 0) = M.x i := by fin_cases i <;> simp [ρ, M.h₁.1, M.h₂.1, M.h₃.1] /-- Saturation: O ∩ ℚ = ℤ in the form g·y = n ⇒ g ∣ n. -/theorem forall4 {P : Fin 4 → Prop} (h0 : P 0) (h1 : P 1) (h2 : P 2) (h3 : P 3) : ∀ i, P i := by intro i; fin_cases i <;> assumption include M in/-- Saturation, O ∩ ℚ = ℤ in the form n = g·y ⇒ g ∣ n (g ≠ 0). -/theorem sat {n g : ℤ} {y : O} (hg : g ≠ 0) (h : (n : O) = g * y) : g ∣ n := by have hg' : (g : O) ≠ 0 := Int.cast_ne_zero.mpr hg have inv : ∀ σ : O →+* O, σ y = y := by intro σ apply mul_left_cancel₀ hg' calc (g : O) * σ y = σ ((g : O) * y) := by rw [map_mul, map_intCast] _ = σ (n : O) := by rw [h] _ = (g : O) * y := by rw [map_intCast, h] obtain ⟨m, hm⟩ := M.fix y (inv _) (inv _) (inv _) refine ⟨m, ?_⟩ have : (n : O) = ((g * m : ℤ) : O) := by rw [h, hm]; push_cast; ring exact_mod_cast this include M in/-- If n = θ·y in O with n, θ integers, then θ ∣ n in ℤ (θ = 0 allowed). -/theorem dvd_of_eq_mul {n θ : ℤ} {y : O} (h : (n : O) = θ * y) : θ ∣ n := by rcases eq_or_ne θ 0 with rfl | hθ · have h0 : (n : O) = 0 := by rw [h]; simp have : n = 0 := by exact_mod_cast h0 simp [this] · exact M.sat hθ h theorem Vand_ne_zero : Vand M.x ≠ 0 := by have h : ∀ i j : Fin 4, i ≠ j → M.x j - M.x i ≠ 0 := fun i j hij => sub_ne_zero.mpr (M.inj.ne hij.symm) simp only [Vand] refine mul_ne_zero (mul_ne_zero (mul_ne_zero (mul_ne_zero (mul_ne_zero ?_ ?_) ?_) ?_) ?_) ?_ <;> exact h _ _ (by decide) /-! #### Integrality of the symmetric data -/ theorem ea_int : ∃ n : ℤ, ea M.x = n := M.fix _ (by simp only [ea, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [ea, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [ea, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem eb_int : ∃ n : ℤ, eb M.x = n := M.fix _ (by simp only [eb, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [eb, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [eb, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem ec_int : ∃ n : ℤ, ec M.x = n := M.fix _ (by simp only [ec, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [ec, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [ec, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem ed_int : ∃ n : ℤ, ed M.x = n := M.fix _ (by simp only [ed, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [ed, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [ed, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem z1_int : ∃ n : ℤ, z1 M.x = n := M.fix _ (by simp only [z1, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [z1, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [z1, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem z2_int : ∃ n : ℤ, z2 M.x = n := M.fix _ (by simp only [z2, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [z2, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [z2, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem z3_int : ∃ n : ℤ, z3 M.x = n := M.fix _ (by simp only [z3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [z3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [z3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) /-- Lemma 1.2 in the model: T, U, V, W and Δ = Vand are integers; Δ ≠ 0 and Δ is even. -/theorem exists_ints : ∃ t u v w δ : ℤ, T M.x = t ∧ U M.x = u ∧ V M.x = v ∧ W M.x = w ∧ Vand M.x = δ ∧ δ ≠ 0 ∧ Even δ := by obtain ⟨a, ha⟩ := M.ea_int obtain ⟨b, hb⟩ := M.eb_int obtain ⟨c, hc⟩ := M.ec_int obtain ⟨d, hd⟩ := M.ed_int obtain ⟨k1, hk1⟩ := M.z1_int obtain ⟨k2, hk2⟩ := M.z2_int obtain ⟨k3, hk3⟩ := M.z3_int obtain ⟨δ, hδ, hev⟩ := Vand_even M.x hk1 hk2 hk3 refine ⟨a ^ 2 * d - c ^ 2, a ^ 3 - 4 * a * b + 8 * c, a ^ 2 * b + 2 * a * c - 4 * b ^ 2 + 16 * d, a ^ 2 * c + 8 * a * d - 4 * b * c, δ, ?_, ?_, ?_, ?_, hδ, ?_, hev⟩ · simp only [T, ha, hc, hd]; push_cast; ring · simp only [U, ha, hb, hc]; push_cast; ring · simp only [V, ha, hb, hc, hd]; push_cast; ring · simp only [W, ha, hb, hc, hd]; push_cast; ring · rintro rfl; exact M.Vand_ne_zero (by simpa using hδ) /-! #### ℤ[α] -/ theorem pow_mem (k : Fin 4) : M.x 0 ^ (k : ℕ) ∈ M.Zα := Submodule.subset_span ⟨k, rfl⟩ theorem intmul_mem (n : ℤ) {y : O} (hy : y ∈ M.Zα) : (n : O) * y ∈ M.Zα := by rw [← zsmul_eq_mul]; exact Submodule.smul_mem _ n hy theorem one_mem : (1 : O) ∈ M.Zα := by simpa using M.pow_mem 0 theorem x0_mem : M.x 0 ∈ M.Zα := by simpa using M.pow_mem 1 theorem int_mem (n : ℤ) : (n : O) ∈ M.Zα := by simpa using M.intmul_mem n M.one_mem theorem quartic : M.x 0 ^ 4 = ea M.x * M.x 0 ^ 3 - eb M.x * M.x 0 ^ 2 + ec M.x * M.x 0 - ed M.x := by simp only [ea, eb, ec, ed]; ring theorem x0_mul_mem {y : O} (hy : y ∈ M.Zα) : M.x 0 * y ∈ M.Zα := by induction hy using Submodule.span_induction with | mem z hz => obtain ⟨k, rfl⟩ := hz by_cases hk : (k : ℕ) < 3 · have := M.pow_mem ⟨(k : ℕ) + 1, by omega⟩ simpa [pow_succ'] using this · have hk3 : (k : ℕ) = 3 := by omega simp only [hk3] rw [← pow_succ', M.quartic] obtain ⟨a, ha⟩ := M.ea_int obtain ⟨b, hb⟩ := M.eb_int obtain ⟨c, hc⟩ := M.ec_int obtain ⟨d, hd⟩ := M.ed_int rw [ha, hb, hc, hd] refine sub_mem (add_mem (sub_mem (M.intmul_mem a (M.pow_mem 3)) (M.intmul_mem b (M.pow_mem 2))) ?_) (M.int_mem d) simpa using M.intmul_mem c (M.pow_mem 1) | zero => simp | add y z _ _ hy hz => rw [mul_add]; exact add_mem hy hz | smul n y _ hy => rw [mul_smul_comm]; exact Submodule.smul_mem _ n hy /-- ℤ[α] (the span) is closed under multiplication, i.e. it is the ring ℤ[α]. -/theorem Zα_mul_mem {y z : O} (hy : y ∈ M.Zα) (hz : z ∈ M.Zα) : y * z ∈ M.Zα := by have hpow : ∀ m : ℕ, M.x 0 ^ m * y ∈ M.Zα := by intro m induction m with | zero => simpa using hy | succ m ih => rw [pow_succ', mul_assoc]; exact M.x0_mul_mem ih induction hz using Submodule.span_induction with | mem w hw => obtain ⟨k, rfl⟩ := hw rw [mul_comm]; exact hpow _ | zero => simp | add a b _ _ ha hb => rw [mul_add]; exact add_mem ha hb | smul n a _ ha => rw [mul_smul_comm]; exact Submodule.smul_mem _ n ha /-! #### Necessity (Theorem 1): invariant ⇒ Vand ∣ T, U, V, W -/ /-- D(ω) := det[σ_i(ω_l)] ∈ Vand·ℤ for ω_l ∈ ℤ[α] (Lemma 1.3 in the model). -/theorem det_mem (w : Fin 4 → O) (hw : ∀ l, w l ∈ M.Zα) : ∃ m : ℤ, (Matrix.of fun i l => M.ρ i (w l)).det = Vand M.x * m := by have hw' : ∀ l, ∃ c : Fin 4 → ℤ, ∑ k, c k • M.x 0 ^ (k : ℕ) = w l := fun l => (Submodule.mem_span_range_iff_exists_fun ℤ).mp (hw l) choose c hc using hw' refine ⟨(Matrix.of c).det, det_coord M.x _ (Matrix.of c) ?_⟩ intro i l simp only [Matrix.of_apply] rw [← hc l, map_sum] refine Finset.sum_congr rfl fun k _ => ?_ rw [zsmul_eq_mul, map_mul, map_intCast, map_pow, M.ρ_x0] /-- (6.2) in the model: D(1, α, α·τ₁α, α·τ₁α·τ₂α) = −T. -/theorem dT_eq : (Matrix.of fun i l => M.ρ i (![1, M.x 0, M.x 0 * M.x 1, M.x 0 * M.x 1 * M.x 2] l)).det = -T M.x := by rw [det4]; simp [Matrix.of_apply, ρ, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; linear_combination detT M.x /-- (6.3) in the model: D(1, α, τ₁α, τ₂α) = −U. -/theorem dU_eq : (Matrix.of fun i l => M.ρ i (![1, M.x 0, M.x 1, M.x 2] l)).det = -U M.x := by rw [det4]; simp [Matrix.of_apply, ρ, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; linear_combination detU M.x /-- Prop. 2.1(4) in the model. -/theorem dV_eq : (Matrix.of fun i l => M.ρ i (![1, M.x 0, M.x 1, M.x 0 * M.x 1 + M.x 0 * M.x 2 + M.x 1 * M.x 2] l)).det + (Matrix.of fun i l => M.ρ i (![1, M.x 0, M.x 0 * M.x 1, M.x 1 + M.x 2] l)).det = -V M.x := by rw [det4, det4]; simp [Matrix.of_apply, ρ, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; linear_combination detV M.x /-- Prop. 2.1(5) in the model. -/theorem dW_eq : (Matrix.of fun i l => M.ρ i (![1, M.x 0, M.x 1, M.x 0 * M.x 1 * M.x 2] l)).det + (Matrix.of fun i l => M.ρ i (![1, M.x 0, M.x 0 * M.x 1, M.x 0 * M.x 2 + M.x 1 * M.x 2] l)).det = -W M.x := by rw [det4, det4]; simp [Matrix.of_apply, ρ, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; linear_combination detW M.x theorem nec (hx : ∀ j, M.x j ∈ M.Zα) {t u v w δ : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) (hδ : Vand M.x = δ) : δ ∣ t ∧ δ ∣ u ∧ δ ∣ v ∧ δ ∣ w := by have m0 := M.x0_mem have m1 := hx 1 have m2 := hx 2 have m01 : M.x 0 * M.x 1 ∈ M.Zα := M.Zα_mul_mem m0 m1 have m012 : M.x 0 * M.x 1 * M.x 2 ∈ M.Zα := M.Zα_mul_mem m01 m2 have m02 : M.x 0 * M.x 2 ∈ M.Zα := M.Zα_mul_mem m0 m2 have m12 : M.x 1 * M.x 2 ∈ M.Zα := M.Zα_mul_mem m1 m2 have key : ∀ (y : O) (s : ℤ) (m : ℤ), y = (s : O) → -y = Vand M.x * m → δ ∣ s := by intro y s m hy h refine ⟨-m, ?_⟩ have : (s : O) = ((δ * -m : ℤ) : O) := by rw [← hy]; push_cast; rw [← hδ]; linear_combination -h exact_mod_cast this have key2 : ∀ (y : O) (s : ℤ) (m m' : ℤ), y = (s : O) → -y = Vand M.x * m + Vand M.x * m' → δ ∣ s := by intro y s m m' hy h exact key y s (m + m') hy (by rw [h]; push_cast; ring) refine ⟨?_, ?_, ?_, ?_⟩ · obtain ⟨m, hm⟩ := M.det_mem ![1, M.x 0, M.x 0 * M.x 1, M.x 0 * M.x 1 * M.x 2] (forall4 M.one_mem m0 m01 m012) exact key _ t m ht (by rw [← M.dT_eq, hm]) · obtain ⟨m, hm⟩ := M.det_mem ![1, M.x 0, M.x 1, M.x 2] (forall4 M.one_mem m0 m1 m2) exact key _ u m hu (by rw [← M.dU_eq, hm]) · obtain ⟨m, hm⟩ := M.det_mem ![1, M.x 0, M.x 1, M.x 0 * M.x 1 + M.x 0 * M.x 2 + M.x 1 * M.x 2] (forall4 M.one_mem m0 m1 (add_mem (add_mem m01 m02) m12)) obtain ⟨m', hm'⟩ := M.det_mem ![1, M.x 0, M.x 0 * M.x 1, M.x 1 + M.x 2] (forall4 M.one_mem m0 m01 (add_mem m1 m2)) exact key2 _ v m m' hv (by rw [← M.dV_eq, hm, hm']) · obtain ⟨m, hm⟩ := M.det_mem ![1, M.x 0, M.x 1, M.x 0 * M.x 1 * M.x 2] (forall4 M.one_mem m0 m1 m012) obtain ⟨m', hm'⟩ := M.det_mem ![1, M.x 0, M.x 0 * M.x 1, M.x 0 * M.x 2 + M.x 1 * M.x 2] (forall4 M.one_mem m0 m01 (add_mem m02 m12)) exact key2 _ w m m' hw (by rw [← M.dW_eq, hm, hm']) /-! #### Sufficiency (Theorem 2 + Cramer), via the pairs (r_j, ΔQ_j) -/ theorem sgn₁ : M.τ₁ (r1 M.x) = 1 * r1 M.x ∧ M.τ₁ (dQ1 M.x) = 1 * dQ1 M.x ∧ M.τ₁ (r2 M.x) = -1 * r2 M.x ∧ M.τ₁ (dQ2 M.x) = -1 * dQ2 M.x ∧ M.τ₁ (r3 M.x) = -1 * r3 M.x ∧ M.τ₁ (dQ3 M.x) = -1 * dQ3 M.x := by refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ <;> simp only [r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2] <;> ring theorem sgn₂ : M.τ₂ (r1 M.x) = -1 * r1 M.x ∧ M.τ₂ (dQ1 M.x) = -1 * dQ1 M.x ∧ M.τ₂ (r2 M.x) = 1 * r2 M.x ∧ M.τ₂ (dQ2 M.x) = 1 * dQ2 M.x ∧ M.τ₂ (r3 M.x) = -1 * r3 M.x ∧ M.τ₂ (dQ3 M.x) = -1 * dQ3 M.x := by refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ <;> simp only [r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2] <;> ring theorem sgn₃ : M.τ₃ (r1 M.x) = -1 * r1 M.x ∧ M.τ₃ (dQ1 M.x) = -1 * dQ1 M.x ∧ M.τ₃ (r2 M.x) = -1 * r2 M.x ∧ M.τ₃ (dQ2 M.x) = -1 * dQ2 M.x ∧ M.τ₃ (r3 M.x) = 1 * r3 M.x ∧ M.τ₃ (dQ3 M.x) = 1 * dQ3 M.x := by refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ <;> simp only [r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2] <;> ring theorem sq_fix (σ : O →+* O) {r q e : O} (he : e * e = 1) (hr : σ r = e * r) (hq : σ q = e * q) : σ (r * r) = r * r ∧ σ (r * q) = r * q := by constructor · rw [map_mul, hr]; linear_combination (r * r) * he · rw [map_mul, hr, hq]; linear_combination (r * q) * he theorem lin_sign (σ : O →+* O) {r q e : O} (u v : ℤ) (hr : σ r = e * r) (hq : σ q = e * q) : σ (u * r + v * q) = e * (u * r + v * q) := by rw [map_add, map_mul, map_mul, map_intCast, map_intCast, hr, hq]; ring /-- A pair with invariant r², rq splits as r = nϑ, q = tϑ with gcd(n, t) = 1, ϑ = ur + vq. -/theorem split_pair {r q : O} {A B : ℤ} (hA : r * r = A) (hB : r * q = B) : ∃ n t : ℤ, IsCoprime n t ∧ ∃ ϑ : O, r = n * ϑ ∧ q = t * ϑ ∧ ∃ u v : ℤ, ϑ = u * r + v * q := by rcases eq_or_ne r 0 with hr | hr · exact ⟨0, 1, isCoprime_zero_left.mpr isUnit_one, q, by simp [hr], by simp, 0, 1, by simp⟩ · have hA0 : A ≠ 0 := by rintro rfl exact hr (mul_self_eq_zero.mp (by simpa using hA)) have hcop : IsCoprime (A / (Int.gcd A B : ℤ)) (B / (Int.gcd A B : ℤ)) := Int.isCoprime_iff_gcd_eq_one.mpr (Int.gcd_ediv_gcd_ediv_gcd_of_ne_zero_left hA0) have eA : A / (Int.gcd A B : ℤ) * (Int.gcd A B : ℤ) = A := Int.ediv_mul_cancel (Int.gcd_dvd_left ..) have eB : B / (Int.gcd A B : ℤ) * (Int.gcd A B : ℤ) = B := Int.ediv_mul_cancel (Int.gcd_dvd_right ..) set h : ℤ := (Int.gcd A B : ℤ) set a' := A / h set b' := B / h have e1 : (b' : O) * (A : O) = (a' : O) * (B : O) := by have : b' * A = a' * B := by calc b' * A = b' * (a' * h) := by rw [eA] _ = a' * (b' * h) := by ring _ = a' * B := by rw [eB] exact_mod_cast this have key : (b' : O) * r = (a' : O) * q := by apply mul_left_cancel₀ hr linear_combination (b' : O) * hA - (a' : O) * hB + e1 obtain ⟨u, v, huv⟩ := hcop have huv' : (u : O) * a' + v * b' = 1 := by exact_mod_cast huv refine ⟨a', b', ⟨u, v, huv⟩, u * r + v * q, ?_, ?_, u, v, rfl⟩ · linear_combination (-r) * huv' + (v : O) * key · linear_combination (-q) * huv' - (u : O) * key theorem pair_ints {r q e₁ e₂ e₃ : O} (he₁ : e₁ * e₁ = 1) (he₂ : e₂ * e₂ = 1) (he₃ : e₃ * e₃ = 1) (h1r : M.τ₁ r = e₁ * r) (h1q : M.τ₁ q = e₁ * q) (h2r : M.τ₂ r = e₂ * r) (h2q : M.τ₂ q = e₂ * q) (h3r : M.τ₃ r = e₃ * r) (h3q : M.τ₃ q = e₃ * q) : (∃ A : ℤ, r * r = A) ∧ (∃ B : ℤ, r * q = B) := ⟨M.fix _ (sq_fix _ he₁ h1r h1q).1 (sq_fix _ he₂ h2r h2q).1 (sq_fix _ he₃ h3r h3q).1, M.fix _ (sq_fix _ he₁ h1r h1q).2 (sq_fix _ he₂ h2r h2q).2 (sq_fix _ he₃ h3r h3q).2⟩ /-- The Cramer numerators are V4-invariant, hence integers (Lemma 1.1 for N_jk). -/theorem N10_int : ∃ n : ℤ, N10 M.x = n := M.fix _ (by simp only [N10, Nc10, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N10, Nc10, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N10, Nc10, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N11_int : ∃ n : ℤ, N11 M.x = n := M.fix _ (by simp only [N11, Nc11, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N11, Nc11, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N11, Nc11, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N12_int : ∃ n : ℤ, N12 M.x = n := M.fix _ (by simp only [N12, Nc12, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N12, Nc12, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N12, Nc12, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N13_int : ∃ n : ℤ, N13 M.x = n := M.fix _ (by simp only [N13, Nc13, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N13, Nc13, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N13, Nc13, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N20_int : ∃ n : ℤ, N20 M.x = n := M.fix _ (by simp only [N20, Nc20, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N20, Nc20, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N20, Nc20, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N21_int : ∃ n : ℤ, N21 M.x = n := M.fix _ (by simp only [N21, Nc21, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N21, Nc21, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N21, Nc21, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N22_int : ∃ n : ℤ, N22 M.x = n := M.fix _ (by simp only [N22, Nc22, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N22, Nc22, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N22, Nc22, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N23_int : ∃ n : ℤ, N23 M.x = n := M.fix _ (by simp only [N23, Nc23, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N23, Nc23, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N23, Nc23, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N30_int : ∃ n : ℤ, N30 M.x = n := M.fix _ (by simp only [N30, Nc30, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N30, Nc30, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N30, Nc30, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N31_int : ∃ n : ℤ, N31 M.x = n := M.fix _ (by simp only [N31, Nc31, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N31, Nc31, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N31, Nc31, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N32_int : ∃ n : ℤ, N32 M.x = n := M.fix _ (by simp only [N32, Nc32, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N32, Nc32, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N32, Nc32, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring)theorem N33_int : ∃ n : ℤ, N33 M.x = n := M.fix _ (by simp only [N33, Nc33, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N33, Nc33, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) (by simp only [N33, Nc33, r1, r2, r3, dQ1, dQ2, dQ3, map_add, map_sub, map_mul, map_neg, map_pow, map_one, map_zero, map_ofNat, M.h₁.1, M.h₁.2.1, M.h₁.2.2.1, M.h₁.2.2.2, M.h₂.1, M.h₂.2.1, M.h₂.2.2.1, M.h₂.2.2.2, M.h₃.1, M.h₃.2.1, M.h₃.2.2.1, M.h₃.2.2.2]; ring) /-- **Theorem 2** (proof of Theorem A), unconditional: any integer g dividing T, U, V and W divides the twelve Cramer numerators N_jk (which are integers). -/theorem thm2 {g t u v w : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) (hg : g ∣ t ∧ g ∣ u ∧ g ∣ v ∧ g ∣ w) : (∃ n : ℤ, N10 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N11 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N12 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N13 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N20 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N21 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N22 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N23 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N30 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N31 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N32 M.x = n ∧ g ∣ n) ∧ (∃ n : ℤ, N33 M.x = n ∧ g ∣ n) := by obtain ⟨a1, b1, a2, b2, a3, b3⟩ := M.sgn₁ obtain ⟨c1, d1, c2, d2, c3, d3⟩ := M.sgn₂ obtain ⟨f1, g1, f2, g2, f3, g3⟩ := M.sgn₃ have p : (1 : O) * 1 = 1 := by ring have m : (-1 : O) * -1 = 1 := by ring obtain ⟨⟨A1, hA1⟩, ⟨B1, hB1⟩⟩ := M.pair_ints p m m a1 b1 c1 d1 f1 g1 obtain ⟨⟨A2, hA2⟩, ⟨B2, hB2⟩⟩ := M.pair_ints m p m a2 b2 c2 d2 f2 g2 obtain ⟨⟨A3, hA3⟩, ⟨B3, hB3⟩⟩ := M.pair_ints m m p a3 b3 c3 d3 f3 g3 obtain ⟨n1, t1, cop1, ϑ1, hr1, hq1, u1, v1, hϑ1⟩ := split_pair hA1 hB1 obtain ⟨n2, t2, cop2, ϑ2, hr2, hq2, u2, v2, hϑ2⟩ := split_pair hA2 hB2 obtain ⟨n3, t3, cop3, ϑ3, hr3, hq3, u3, v3, hϑ3⟩ := split_pair hA3 hB3 -- Θ = ϑ₁ϑ₂ϑ₃ is V4-invariant, hence an integer θ have s11 := lin_sign M.τ₁ u1 v1 a1 b1 have s12 := lin_sign M.τ₁ u2 v2 a2 b2 have s13 := lin_sign M.τ₁ u3 v3 a3 b3 have s21 := lin_sign M.τ₂ u1 v1 c1 d1 have s22 := lin_sign M.τ₂ u2 v2 c2 d2 have s23 := lin_sign M.τ₂ u3 v3 c3 d3 have s31 := lin_sign M.τ₃ u1 v1 f1 g1 have s32 := lin_sign M.τ₃ u2 v2 f2 g2 have s33 := lin_sign M.τ₃ u3 v3 f3 g3 rw [← hϑ1] at s11 s21 s31 rw [← hϑ2] at s12 s22 s32 rw [← hϑ3] at s13 s23 s33 obtain ⟨θ, hθ⟩ := M.fix (ϑ1 * ϑ2 * ϑ3) (by rw [map_mul, map_mul, s11, s12, s13]; ring) (by rw [map_mul, map_mul, s21, s22, s23]; ring) (by rw [map_mul, map_mul, s31, s32, s33]; ring) -- P = θ · ∏ (n_j X + t_j): the four coefficients have eu : (u : O) = ((θ * (n1 * n2 * n3) : ℤ) : O) := by rw [← hu, U_eq, hr1, hr2, hr3]; push_cast; rw [← hθ]; ring have ev : (v : O) = ((θ * (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) : ℤ) : O) := by rw [← hv, V_eq, hr1, hr2, hr3, hq1, hq2, hq3]; push_cast; rw [← hθ]; ring have ew : (w : O) = ((θ * (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) : ℤ) : O) := by rw [← hw, W_eq, hr1, hr2, hr3, hq1, hq2, hq3]; push_cast; rw [← hθ]; ring have et : (t : O) = ((θ * (t1 * t2 * t3) : ℤ) : O) := by rw [← ht, T_eq, hq1, hq2, hq3]; push_cast; rw [← hθ]; ring have eu' : u = θ * (n1 * n2 * n3) := by exact_mod_cast eu have ev' : v = θ * (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) := by exact_mod_cast ev have ew' : w = θ * (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) := by exact_mod_cast ew have et' : t = θ * (t1 * t2 * t3) := by exact_mod_cast et obtain ⟨hgt, hgu, hgv, hgw⟩ := hg have hgθ : g ∣ θ := gauss3 cop1 cop2 cop3 (eu' ▸ hgu) (ev' ▸ hgv) (ew' ▸ hgw) (et' ▸ hgt) -- each N_jk = θ · (element of O), and N_jk ∈ ℤ have hsc := Nc_scale M.x (n1 : O) n2 n3 t1 t2 t3 ϑ1 ϑ2 ϑ3 have fin : ∀ (Nv : O) (y : O), (∃ n : ℤ, Nv = n) → Nv = (θ : O) * y → ∃ n : ℤ, Nv = n ∧ g ∣ n := by rintro Nv y ⟨n, hn⟩ he exact ⟨n, hn, dvd_trans hgθ (M.dvd_of_eq_mul (y := y) (by rw [← hn, he]))⟩ refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ · exact fin _ (Nc10 M.x (n1 : O) n2 n3 t1 t2 t3) M.N10_int (by rw [N10, hr1, hr2, hr3, hq1, hq2, hq3, hsc.1, hθ]) · exact fin _ (Nc11 M.x (n1 : O) n2 n3 t1 t2 t3) M.N11_int (by rw [N11, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.1, hθ]) · exact fin _ (Nc12 M.x (n1 : O) n2 n3 t1 t2 t3) M.N12_int (by rw [N12, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.1, hθ]) · exact fin _ (Nc13 M.x (n1 : O) n2 n3 t1 t2 t3) M.N13_int (by rw [N13, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.1, hθ]) · exact fin _ (Nc20 M.x (n1 : O) n2 n3 t1 t2 t3) M.N20_int (by rw [N20, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.1, hθ]) · exact fin _ (Nc21 M.x (n1 : O) n2 n3 t1 t2 t3) M.N21_int (by rw [N21, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.1, hθ]) · exact fin _ (Nc22 M.x (n1 : O) n2 n3 t1 t2 t3) M.N22_int (by rw [N22, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.2.1, hθ]) · exact fin _ (Nc23 M.x (n1 : O) n2 n3 t1 t2 t3) M.N23_int (by rw [N23, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.2.2.1, hθ]) · exact fin _ (Nc30 M.x (n1 : O) n2 n3 t1 t2 t3) M.N30_int (by rw [N30, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.2.2.2.1, hθ]) · exact fin _ (Nc31 M.x (n1 : O) n2 n3 t1 t2 t3) M.N31_int (by rw [N31, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.2.2.2.2.1, hθ]) · exact fin _ (Nc32 M.x (n1 : O) n2 n3 t1 t2 t3) M.N32_int (by rw [N32, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.2.2.2.2.2.1, hθ]) · exact fin _ (Nc33 M.x (n1 : O) n2 n3 t1 t2 t3) M.N33_int (by rw [N33, hr1, hr2, hr3, hq1, hq2, hq3, hsc.2.2.2.2.2.2.2.2.2.2.2, hθ]) /-- **Θ-factorisation** (the S4 prefix of `thm2`, stated on its own): coprime pairs (n_j, t_j), elements ϑ_j ∈ O with r_j = n_j ϑ_j, ΔQ_j = t_j ϑ_j, and an integer θ = ϑ₁ϑ₂ϑ₃ with P(X) = θ·∏(n_j X + t_j): U, V, W, T are θ times the coefficients of the primitive polynomial ∏(n_j X + t_j). -/theorem theta_factor {t u v w : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) : ∃ n1 n2 n3 t1 t2 t3 θ : ℤ, IsCoprime n1 t1 ∧ IsCoprime n2 t2 ∧ IsCoprime n3 t3 ∧ (∃ ϑ1 ϑ2 ϑ3 : O, r1 M.x = n1 * ϑ1 ∧ dQ1 M.x = t1 * ϑ1 ∧ r2 M.x = n2 * ϑ2 ∧ dQ2 M.x = t2 * ϑ2 ∧ r3 M.x = n3 * ϑ3 ∧ dQ3 M.x = t3 * ϑ3 ∧ (θ : O) = ϑ1 * ϑ2 * ϑ3) ∧ u = θ * (n1 * n2 * n3) ∧ v = θ * (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) ∧ w = θ * (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) ∧ t = θ * (t1 * t2 * t3) := by obtain ⟨a1, b1, a2, b2, a3, b3⟩ := M.sgn₁ obtain ⟨c1, d1, c2, d2, c3, d3⟩ := M.sgn₂ obtain ⟨f1, g1, f2, g2, f3, g3⟩ := M.sgn₃ have p : (1 : O) * 1 = 1 := by ring have m : (-1 : O) * -1 = 1 := by ring obtain ⟨⟨A1, hA1⟩, ⟨B1, hB1⟩⟩ := M.pair_ints p m m a1 b1 c1 d1 f1 g1 obtain ⟨⟨A2, hA2⟩, ⟨B2, hB2⟩⟩ := M.pair_ints m p m a2 b2 c2 d2 f2 g2 obtain ⟨⟨A3, hA3⟩, ⟨B3, hB3⟩⟩ := M.pair_ints m m p a3 b3 c3 d3 f3 g3 obtain ⟨n1, t1, cop1, ϑ1, hr1, hq1, u1, v1, hϑ1⟩ := split_pair hA1 hB1 obtain ⟨n2, t2, cop2, ϑ2, hr2, hq2, u2, v2, hϑ2⟩ := split_pair hA2 hB2 obtain ⟨n3, t3, cop3, ϑ3, hr3, hq3, u3, v3, hϑ3⟩ := split_pair hA3 hB3 have s11 := lin_sign M.τ₁ u1 v1 a1 b1 have s12 := lin_sign M.τ₁ u2 v2 a2 b2 have s13 := lin_sign M.τ₁ u3 v3 a3 b3 have s21 := lin_sign M.τ₂ u1 v1 c1 d1 have s22 := lin_sign M.τ₂ u2 v2 c2 d2 have s23 := lin_sign M.τ₂ u3 v3 c3 d3 have s31 := lin_sign M.τ₃ u1 v1 f1 g1 have s32 := lin_sign M.τ₃ u2 v2 f2 g2 have s33 := lin_sign M.τ₃ u3 v3 f3 g3 rw [← hϑ1] at s11 s21 s31 rw [← hϑ2] at s12 s22 s32 rw [← hϑ3] at s13 s23 s33 obtain ⟨θ, hθ⟩ := M.fix (ϑ1 * ϑ2 * ϑ3) (by rw [map_mul, map_mul, s11, s12, s13]; ring) (by rw [map_mul, map_mul, s21, s22, s23]; ring) (by rw [map_mul, map_mul, s31, s32, s33]; ring) have eu : (u : O) = ((θ * (n1 * n2 * n3) : ℤ) : O) := by rw [← hu, U_eq, hr1, hr2, hr3]; push_cast; rw [← hθ]; ring have ev : (v : O) = ((θ * (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) : ℤ) : O) := by rw [← hv, V_eq, hr1, hr2, hr3, hq1, hq2, hq3]; push_cast; rw [← hθ]; ring have ew : (w : O) = ((θ * (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) : ℤ) : O) := by rw [← hw, W_eq, hr1, hr2, hr3, hq1, hq2, hq3]; push_cast; rw [← hθ]; ring have et : (t : O) = ((θ * (t1 * t2 * t3) : ℤ) : O) := by rw [← ht, T_eq, hq1, hq2, hq3]; push_cast; rw [← hθ]; ring exact ⟨n1, n2, n3, t1, t2, t3, θ, cop1, cop2, cop3, ⟨ϑ1, ϑ2, ϑ3, hr1, hq1, hr2, hq2, hr3, hq3, hθ.symm⟩, by exact_mod_cast eu, by exact_mod_cast ev, by exact_mod_cast ew, by exact_mod_cast et⟩ /-- **Content of P** (proof of Theorem A): θ = ϑ₁ϑ₂ϑ₃ (ϑ_j from `split_pair`, r_j = n_j ϑ_j, ΔQ_j = t_j ϑ_j with gcd(n_j, t_j) = 1) divides T, U, V, W, and every common divisor of T, U, V, W divides θ: θ is a gcd of (T, U, V, W). -/theorem gcd_eq_abs_theta {t u v w : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) : ∃ θ : ℤ, (θ ∣ t ∧ θ ∣ u ∧ θ ∣ v ∧ θ ∣ w) ∧ (∀ g : ℤ, g ∣ t ∧ g ∣ u ∧ g ∣ v ∧ g ∣ w → g ∣ θ) ∧ ∃ n1 n2 n3 t1 t2 t3 : ℤ, IsCoprime n1 t1 ∧ IsCoprime n2 t2 ∧ IsCoprime n3 t3 ∧ ∃ ϑ1 ϑ2 ϑ3 : O, r1 M.x = n1 * ϑ1 ∧ dQ1 M.x = t1 * ϑ1 ∧ r2 M.x = n2 * ϑ2 ∧ dQ2 M.x = t2 * ϑ2 ∧ r3 M.x = n3 * ϑ3 ∧ dQ3 M.x = t3 * ϑ3 ∧ (θ : O) = ϑ1 * ϑ2 * ϑ3 := by obtain ⟨n1, n2, n3, t1, t2, t3, θ, cop1, cop2, cop3, hϑ, eu, ev, ew, et⟩ := M.theta_factor ht hu hv hw refine ⟨θ, ⟨⟨_, et⟩, ⟨_, eu⟩, ⟨_, ev⟩, ⟨_, ew⟩⟩, ?_, n1, n2, n3, t1, t2, t3, cop1, cop2, cop3, hϑ⟩ rintro g ⟨hgt, hgu, hgv, hgw⟩ exact gauss3 cop1 cop2 cop3 (eu ▸ hgu) (ev ▸ hgv) (ew ▸ hgw) (et ▸ hgt) /-- **gcd(T, U, V, W) = |Θ|** literally: `Int.gcd (Int.gcd t u) (Int.gcd v w) = |θ|`, with θ = ϑ₁ϑ₂ϑ₃ as in `gcd_eq_abs_theta`. -/theorem gcd_TUVW {t u v w : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) : ∃ θ : ℤ, ((Int.gcd (Int.gcd t u) (Int.gcd v w) : ℕ) : ℤ) = |θ| ∧ Int.gcd (Int.gcd t u) (Int.gcd v w) = θ.natAbs ∧ ∃ n1 n2 n3 t1 t2 t3 : ℤ, IsCoprime n1 t1 ∧ IsCoprime n2 t2 ∧ IsCoprime n3 t3 ∧ ∃ ϑ1 ϑ2 ϑ3 : O, r1 M.x = n1 * ϑ1 ∧ dQ1 M.x = t1 * ϑ1 ∧ r2 M.x = n2 * ϑ2 ∧ dQ2 M.x = t2 * ϑ2 ∧ r3 M.x = n3 * ϑ3 ∧ dQ3 M.x = t3 * ϑ3 ∧ (θ : O) = ϑ1 * ϑ2 * ϑ3 := by obtain ⟨θ, ⟨dt, du, dv, dw⟩, hmax, hϑ⟩ := M.gcd_eq_abs_theta ht hu hv hw set G : ℤ := ((Int.gcd (Int.gcd t u) (Int.gcd v w) : ℕ) : ℤ) with hG have hGtu : G ∣ ((Int.gcd t u : ℕ) : ℤ) := Int.gcd_dvd_left .. have hGvw : G ∣ ((Int.gcd v w : ℕ) : ℤ) := Int.gcd_dvd_right .. have hGθ : G ∣ θ := hmax G ⟨hGtu.trans (Int.gcd_dvd_left t u), hGtu.trans (Int.gcd_dvd_right t u), hGvw.trans (Int.gcd_dvd_left v w), hGvw.trans (Int.gcd_dvd_right v w)⟩ have hθG : θ ∣ G := Int.dvd_coe_gcd (Int.dvd_coe_gcd dt du) (Int.dvd_coe_gcd dv dw) have e : G = |θ| := Int.dvd_antisymm (Int.natCast_nonneg _) (abs_nonneg θ) ((dvd_abs G θ).mpr hGθ) ((abs_dvd θ G).mpr hθG) refine ⟨θ, e, ?_, hϑ⟩ have h2 : G = ((θ.natAbs : ℕ) : ℤ) := by rw [Int.natCast_natAbs, e] exact Int.natCast_inj.mp h2 theorem mem_of_cramer {δ : ℤ} (hδ : Vand M.x = δ) {N0 N1 N2 N3 y : O} (h0 : ∃ n : ℤ, N0 = n ∧ δ ∣ n) (h1 : ∃ n : ℤ, N1 = n ∧ δ ∣ n) (h2 : ∃ n : ℤ, N2 = n ∧ δ ∣ n) (h3 : ∃ n : ℤ, N3 = n ∧ δ ∣ n) (hc : N0 + N1 * M.x 0 + N2 * M.x 0 ^ 2 + N3 * M.x 0 ^ 3 = Vand M.x * (M.x 0 + y)) : y ∈ M.Zα := by obtain ⟨_, e0, k0, rfl⟩ := h0 obtain ⟨_, e1, k1, rfl⟩ := h1 obtain ⟨_, e2, k2, rfl⟩ := h2 obtain ⟨_, e3, k3, rfl⟩ := h3 push_cast at e0 e1 e2 e3 have hV : (δ : O) ≠ 0 := hδ ▸ M.Vand_ne_zero have hy : (δ : O) * (M.x 0 + y) = δ * (k0 + k1 * M.x 0 + k2 * M.x 0 ^ 2 + k3 * M.x 0 ^ 3) := by linear_combination (-1 : O) * hc + e0 + M.x 0 * e1 + M.x 0 ^ 2 * e2 + M.x 0 ^ 3 * e3 - (M.x 0 + y) * hδ have hy' : y = (k0 : O) * M.x 0 ^ 0 + ((k1 - 1 : ℤ) : O) * M.x 0 ^ 1 + (k2 : O) * M.x 0 ^ 2 + (k3 : O) * M.x 0 ^ 3 := by have := mul_left_cancel₀ hV hy push_cast linear_combination this have pm : ∀ k : ℕ, k < 4 → M.x 0 ^ k ∈ M.Zα := fun k hk => M.pow_mem ⟨k, hk⟩ rw [hy'] exact add_mem (add_mem (add_mem (M.intmul_mem _ (pm 0 (by norm_num))) (M.intmul_mem _ (pm 1 (by norm_num)))) (M.intmul_mem _ (pm 2 (by norm_num)))) (M.intmul_mem _ (pm 3 (by norm_num))) /-- **Conjecture 6.1 (Louboutin)**, in the V4 model: ℤ[α] is Galois-invariant (contains all conjugates) iff Δ = Vand divides T, U, V and W. -/theorem conj61 {t u v w δ : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) (hδ : Vand M.x = δ) : (∀ j, M.x j ∈ M.Zα) ↔ (δ ∣ t ∧ δ ∣ u ∧ δ ∣ v ∧ δ ∣ w) := by constructor · intro hx; exact M.nec hx ht hu hv hw hδ · intro hd have H := M.thm2 ht hu hv hw hd obtain ⟨h10, h11, h12, h13, h20, h21, h22, h23, h30, h31, h32, h33⟩ := H refine forall4 M.x0_mem ?_ ?_ ?_ · exact M.mem_of_cramer hδ h10 h11 h12 h13 (cramer1 M.x).1 · exact M.mem_of_cramer hδ h20 h21 h22 h23 (cramer2 M.x).1 · exact M.mem_of_cramer hδ h30 h31 h32 h33 (cramer3 M.x).1 /-! #### Corollary `cor:weak`: Δ ∣ T, U, V ± W already forces Δ ∣ V, W Route (the note's, without g ∣ Δ): `cross_prod` at r_j = n_jϑ_j, ΔQ_j = t_jϑ_j givesθ²·d₁₂d₂₃d₃₁ = Δ·θ·n₁n₂n₃ (`theta_minors`). Write Δ = hG, θ = θ'G with gcd(h, θ') = 1; thehypothesis gives h ∣ f₃, f₀, f₂ ± f₁ (f the coefficients of the primitive ∏(n_jX + t_j)), andh ∣ d₁₂d₂₃d₃₁. If h were even, the mod-2 analysis of the three coprime pairs (`par_core`) makesd₁₂d₂₃d₃₁ odd: contradiction. So h is odd, h ∣ 2f₂, 2f₁ gives h ∣ f₂, f₁, and Δ ∣ V, W. -/ /-- mod-2 core: three nonzero pairs (n_j, t_j) over 𝔽₂ with n₁n₂n₃ = 0, t₁t₂t₃ = 0 and f₂ + f₁ = 0 are the three points of ℙ¹(𝔽₂), so every minor d_ij is nonzero. -/theorem par_core : ∀ n1 n2 n3 t1 t2 t3 : ZMod 2, ¬(n1 = 0 ∧ t1 = 0) → ¬(n2 = 0 ∧ t2 = 0) → ¬(n3 = 0 ∧ t3 = 0) → n1 * n2 * n3 = 0 → t1 * t2 * t3 = 0 → (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) + (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) = 0 → (n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3) ≠ 0 := by decide theorem two_dvd_iff_zmod (a : ℤ) : 2 ∣ a ↔ (a : ZMod 2) = 0 := by rw [ZMod.intCast_zmod_eq_zero_iff_dvd]; norm_num theorem not_both_even {n t : ℤ} (h : IsCoprime n t) : ¬((n : ZMod 2) = 0 ∧ (t : ZMod 2) = 0) := by rintro ⟨hn, ht⟩ rw [← two_dvd_iff_zmod] at hn ht have := h.isUnit_of_dvd' hn ht rw [Int.isUnit_iff] at this omega /-- Integer form of `par_core`. -/theorem par_int {n1 n2 n3 t1 t2 t3 : ℤ} (c1 : IsCoprime n1 t1) (c2 : IsCoprime n2 t2) (c3 : IsCoprime n3 t3) (h3 : 2 ∣ n1 * n2 * n3) (h0 : 2 ∣ t1 * t2 * t3) (h21 : 2 ∣ (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) + (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3)) : ¬ 2 ∣ (n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3) := by rw [two_dvd_iff_zmod] at h3 h0 h21 ⊢ push_cast at h3 h0 h21 ⊢ exact par_core _ _ _ _ _ _ (not_both_even c1) (not_both_even c2) (not_both_even c3) h3 h0 h21 /-- **Θ and the minors**: with the data of `theta_factor`, θ²·d₁₂d₂₃d₃₁ = Δ·θ·n₁n₂n₃, d_ij = n_i t_j − n_j t_i (`cross_prod` at r_j = n_jϑ_j, ΔQ_j = t_jϑ_j). -/theorem theta_minors {t u v w δ : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) (hδ : Vand M.x = δ) : ∃ n1 n2 n3 t1 t2 t3 θ : ℤ, IsCoprime n1 t1 ∧ IsCoprime n2 t2 ∧ IsCoprime n3 t3 ∧ u = θ * (n1 * n2 * n3) ∧ v = θ * (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) ∧ w = θ * (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) ∧ t = θ * (t1 * t2 * t3) ∧ θ * θ * ((n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3)) = δ * θ * (n1 * n2 * n3) := by obtain ⟨n1, n2, n3, t1, t2, t3, θ, cop1, cop2, cop3, ⟨ϑ1, ϑ2, ϑ3, hr1, hq1, hr2, hq2, hr3, hq3, hθ⟩, eu, ev, ew, et⟩ := M.theta_factor ht hu hv hw refine ⟨n1, n2, n3, t1, t2, t3, θ, cop1, cop2, cop3, eu, ev, ew, et, ?_⟩ have key := cross_prod M.x rw [hr1, hr2, hr3, hq1, hq2, hq3, hδ] at key have hO : ((θ * θ * ((n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3)) : ℤ) : O) = ((δ * θ * (n1 * n2 * n3) : ℤ) : O) := by push_cast; rw [hθ]; linear_combination key exact_mod_cast hO theorem split_gcd {δ θ : ℤ} (hδ : δ ≠ 0) : ∃ G h θ' : ℤ, G ≠ 0 ∧ IsCoprime h θ' ∧ δ = h * G ∧ θ = θ' * G := by refine ⟨(Int.gcd δ θ : ℤ), δ / (Int.gcd δ θ : ℤ), θ / (Int.gcd δ θ : ℤ), ?_, Int.isCoprime_iff_gcd_eq_one.mpr (Int.gcd_ediv_gcd_ediv_gcd_of_ne_zero_left hδ), (Int.ediv_mul_cancel (Int.gcd_dvd_left ..)).symm, (Int.ediv_mul_cancel (Int.gcd_dvd_right ..)).symm⟩ exact_mod_cast (Int.gcd_pos_of_ne_zero_left θ hδ).ne' /-- **Corollary `cor:weak`** (in the V4 model): if Δ = Vand divides T, U, V + W and V − W, then Δ divides T, U, V and W. -/theorem cor_weak {t u v w δ : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) (hδ : Vand M.x = δ) (hd : δ ∣ t ∧ δ ∣ u ∧ δ ∣ v + w ∧ δ ∣ v - w) : δ ∣ t ∧ δ ∣ u ∧ δ ∣ v ∧ δ ∣ w := by obtain ⟨dt, du, dvw, dvmw⟩ := hd refine ⟨dt, du, ?_⟩ obtain ⟨n1, n2, n3, t1, t2, t3, θ, cop1, cop2, cop3, eu, ev, ew, et, hZ⟩ := M.theta_minors ht hu hv hw hδ rcases eq_or_ne θ 0 with h0 | hθ0 · subst h0; simp [ev, ew] have hδ0 : δ ≠ 0 := by rintro rfl; exact M.Vand_ne_zero (by simpa using hδ) obtain ⟨G, h, θ', hG0, hcop, rfl, rfl⟩ := split_gcd (θ := θ) hδ0 have red : ∀ f : ℤ, h * G ∣ θ' * G * f → h ∣ f := by intro f hf have hf' : h * G ∣ (θ' * f) * G := by rw [show θ' * f * G = θ' * G * f by ring]; exact hf exact hcop.dvd_of_dvd_mul_left ((mul_dvd_mul_iff_right hG0).mp hf') have f3 := red _ (eu ▸ du) have f0 := red _ (et ▸ dt) have fp : h ∣ (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) + (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) := red _ (by rw [ev, ew, ← mul_add] at dvw; exact dvw) have fm : h ∣ (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) - (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) := red _ (by rw [ev, ew, ← mul_sub] at dvmw; exact dvmw) -- h ∣ d₁₂d₂₃d₃₁ from θ'·D = h·N have hD : h ∣ (n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3) := by have hθ'0 : θ' * G ≠ 0 := hθ0 have e : θ' * G * ((θ' * G) * ((n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3))) = θ' * G * ((h * G) * (n1 * n2 * n3)) := by linear_combination hZ have e2 := mul_left_cancel₀ hθ'0 e have e3 : θ' * ((n1 * t2 - n2 * t1) * (n2 * t3 - n3 * t2) * (n3 * t1 - n1 * t3)) = h * (n1 * n2 * n3) := by apply mul_right_cancel₀ hG0; linear_combination e2 exact hcop.dvd_of_dvd_mul_left ⟨n1 * n2 * n3, by linear_combination e3⟩ -- h is odd have hodd : Odd h := by rw [← Int.not_even_iff_odd, even_iff_two_dvd] intro h2 exact par_int cop1 cop2 cop3 (h2.trans f3) (h2.trans f0) (h2.trans fp) (h2.trans hD) obtain ⟨k, hk⟩ := hodd have half : ∀ f : ℤ, h ∣ 2 * f → h ∣ f := by intro f hf have e : f = h * f - k * (2 * f) := by rw [hk]; ring rw [e]; exact dvd_sub (dvd_mul_right h f) (dvd_mul_of_dvd_right hf k) have f2 : h ∣ n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3 := by apply half have e : 2 * (n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) = ((n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) + (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3)) + ((n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) - (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3)) := by ring rw [e]; exact dvd_add fp fm have f1 : h ∣ n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3 := by apply half have e : 2 * (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3) = ((n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) + (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3)) - ((n1 * n2 * t3 + n1 * t2 * n3 + t1 * n2 * n3) - (n1 * t2 * t3 + t1 * n2 * t3 + t1 * t2 * n3)) := by ring rw [e]; exact dvd_sub fp fm obtain ⟨m2, hm2⟩ := f2 obtain ⟨m1, hm1⟩ := f1 exact ⟨⟨θ' * m2, by rw [ev, hm2]; ring⟩, ⟨θ' * m1, by rw [ew, hm1]; ring⟩⟩ /-- **Cor. `cor:weak` + Conj. 6.1**: ℤ[α] is Galois-invariant iff Δ divides T, U, V + W and V − W (Louboutin's necessary condition, Prop. 6.1, is sufficient). -/theorem conj61_weak {t u v w δ : ℤ} (ht : T M.x = t) (hu : U M.x = u) (hv : V M.x = v) (hw : W M.x = w) (hδ : Vand M.x = δ) : (∀ j, M.x j ∈ M.Zα) ↔ (δ ∣ t ∧ δ ∣ u ∧ δ ∣ v + w ∧ δ ∣ v - w) := by rw [M.conj61 ht hu hv hw hδ] constructor · rintro ⟨a, b, c, d⟩; exact ⟨a, b, dvd_add c d, dvd_sub c d⟩ · exact M.cor_weak ht hu hv hw hδ end V4Dataend Louboutin.Conj61