/-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.IndexLemmas /-!# The index and discriminant of `ℤ[conj α]` for Galois quartic integers Model `Louboutin.TeoremaB.QuartData O`, one model for both Galois groups: `O` a commutative domainof characteristic `0`, pairwise distinct conjugates `x₀ = α`, `x₁ = τα`, `x₂ = β = ρα`,`x₃ = ρτα`, ring endomorphisms `τ`, `ρ` with `τ : x₀ ↔ x₁, x₂ ↔ x₃`, `ρ : x₀ ↦ x₂, x₁ ↦ x₃` andeither `ρ : x₂ ↦ x₀, x₃ ↦ x₁` (`Γ ≅ C₂ × C₂`) or `ρ : x₂ ↦ x₁, x₃ ↦ x₀` (`Γ ≅ C₄`), and"fixed by `τ` and `ρ` ⇒ integer" on `A = ℤ[x₀, …, x₃]`. Bridges: `ofC4`, `ofV4`. The auxiliarydata (`η, n₁, n₂, s₀, s₁, …`) form `Lam M` and exist (`lam_nonempty`); the data `L`, `𝖬` form`Lam.LGH P` and exist (`exists_LGH`). ## Main results * `Louboutin.TeoremaB.Lam.lem_Lambda`: `Λ = ℤ[η]` is an order of rank 2 with `|disc Λ| = gcd(δ₁, δ₂, δ₃)`.* `Louboutin.TeoremaB.Lam.lem_B`: bases `{1, η, α, ηα}` and `{1, α, α², ω₀}`; `B = Λ[α]`; `[B : ℤ[α]] = |R'(z)| / |disc Λ|`.* `Louboutin.TeoremaB.Lam.lem_AB`: `A = B + Bβ`.* `Louboutin.TeoremaB.Lam.lem_lambda_a`, `lem_lambda_b`: the `V₄` and `C₄` cases.* `Louboutin.TeoremaB.Lam.d1`: `A ∩ (ℚ + ℚα) = ℤ + ℤα` (Louboutin's Theorem 13, proved here).* `Louboutin.TeoremaB.Lam.thm_B`: `[A : ℤ[α]] = J [A : B]` and `disc A · [A : ℤ[α]]² = D_α`.* `Louboutin.TeoremaB.Lam.LGH.thm_B_LGH`, `Louboutin.TeoremaB.Lam.LGH.d2_form`: `[A : B] = L²/H`, `[A : ℤ[α]] = J L²/H`, `disc A = D_α (H/(J L²))²`, `d₂ = LG/H`.* `Louboutin.TeoremaB.hermite`: the index lemma in `ℤ²` (Hermite form, `e G = ±H`).* `Louboutin.TeoremaB.Lam.LGH.thm_B_divisors`: with the triangular basis as hypothesis, `d₁ = 1`, `d₂ = LG/H`, `d₃ = JL/G`, `A/ℤ[α] ≅ ℤ/(LG/H) × ℤ/(JL/G)`. ## 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.TeoremaB open Louboutin.Conj61 Matrix set_option linter.unusedSectionVars false /-- The model for Section 4 of the note (both Galois groups). -/structure QuartData (O : Type*) [CommRing O] where x : Fin 4 → 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 hρ2 : (ρ (x 2) = x 0 ∧ ρ (x 3) = x 1) ∨ (ρ (x 2) = x 1 ∧ ρ (x 3) = x 0) fix : ∀ y ∈ Subring.closure (Set.range x), τ y = y → ρ y = y → ∃ n : ℤ, y = n inj : Function.Injective x namespace QuartData variable {O : Type*} [CommRing O] [IsDomain O] [CharZero O] (M : QuartData O) /-- A = ℤ[x₀, x₁, x₂, x₃] = ℤ[conj(α)]. -/def A : Subring O := Subring.closure (Set.range M.x) theorem x_mem (k : Fin 4) : M.x k ∈ M.A := Subring.subset_closure ⟨k, rfl⟩ /-- S = α + τα, Q = α·τα, and their ρ-images S' = ρS, Q' = ρQ. -/def S : O := M.x 0 + M.x 1def Q : O := M.x 0 * M.x 1def S' : O := M.x 2 + M.x 3def Q' : O := M.x 2 * M.x 3 theorem S_mem : M.S ∈ M.A := Subring.add_mem _ (M.x_mem 0) (M.x_mem 1)theorem Q_mem : M.Q ∈ M.A := Subring.mul_mem _ (M.x_mem 0) (M.x_mem 1)theorem S'_mem : M.S' ∈ M.A := Subring.add_mem _ (M.x_mem 2) (M.x_mem 3)theorem Q'_mem : M.Q' ∈ M.A := Subring.mul_mem _ (M.x_mem 2) (M.x_mem 3) theorem τS : M.τ M.S = M.S := by simp only [S, map_add, M.hτ.1, M.hτ.2.1]; ringtheorem τQ : M.τ M.Q = M.Q := by simp only [Q, map_mul, M.hτ.1, M.hτ.2.1]; ringtheorem τS' : M.τ M.S' = M.S' := by simp only [S', map_add, M.hτ.2.2.1, M.hτ.2.2.2]; ringtheorem τQ' : M.τ M.Q' = M.Q' := by simp only [Q', map_mul, M.hτ.2.2.1, M.hτ.2.2.2]; ringtheorem ρS : M.ρ M.S = M.S' := by simp only [S, S', map_add, M.hρ.1, M.hρ.2]theorem ρQ : M.ρ M.Q = M.Q' := by simp only [Q, Q', map_mul, M.hρ.1, M.hρ.2]theorem ρS' : M.ρ M.S' = M.S := by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ · simp only [S, S', map_add, h2, h3] · simp only [S, S', map_add, h2, h3]; ringtheorem ρQ' : M.ρ M.Q' = M.Q := by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ · simp only [Q, Q', map_mul, h2, h3] · simp only [Q, Q', map_mul, h2, h3]; ring /-- fixed by τ and ρ, in A ⇒ integer. -/theorem intOf {y : O} (hA : y ∈ M.A) (h1 : M.τ y = y) (h2 : M.ρ y = y) : ∃ n : ℤ, y = n := M.fix y hA h1 h2 /-- η = m₁S + m₂Q and η' = ρη = m₁S' + m₂Q'. -/def eta (m₁ m₂ : ℤ) : O := (m₁ : O) * M.S + (m₂ : O) * M.Qdef eta' (m₁ m₂ : ℤ) : O := (m₁ : O) * M.S' + (m₂ : O) * M.Q' theorem eta_mem (m₁ m₂ : ℤ) : M.eta m₁ m₂ ∈ M.A := Subring.add_mem _ (Subring.mul_mem _ (intCast_mem _ _) M.S_mem) (Subring.mul_mem _ (intCast_mem _ _) M.Q_mem)theorem eta'_mem (m₁ m₂ : ℤ) : M.eta' m₁ m₂ ∈ M.A := Subring.add_mem _ (Subring.mul_mem _ (intCast_mem _ _) M.S'_mem) (Subring.mul_mem _ (intCast_mem _ _) M.Q'_mem)theorem τeta (m₁ m₂ : ℤ) : M.τ (M.eta m₁ m₂) = M.eta m₁ m₂ := by simp only [eta, map_add, map_mul, map_intCast, M.τS, M.τQ]theorem τeta' (m₁ m₂ : ℤ) : M.τ (M.eta' m₁ m₂) = M.eta' m₁ m₂ := by simp only [eta', map_add, map_mul, map_intCast, M.τS', M.τQ']theorem ρeta (m₁ m₂ : ℤ) : M.ρ (M.eta m₁ m₂) = M.eta' m₁ m₂ := by simp only [eta, eta', map_add, map_mul, map_intCast, M.ρS, M.ρQ]theorem ρeta' (m₁ m₂ : ℤ) : M.ρ (M.eta' m₁ m₂) = M.eta m₁ m₂ := by simp only [eta, eta', map_add, map_mul, map_intCast, M.ρS', M.ρQ'] end QuartData /-! ## lem:Lambda: the data -/ open QuartData variable {O : Type*} [CommRing O] [IsDomain O] [CharZero O] /-- The integers of Section 4: a, b, c, d (Π_α = X⁴ − aX³ + bX² − cX + d), z = Q + ρQ, and the data of lem:Lambda: Λ = ℤ + ℤη with η = m₁S + m₂Q, S = s₀ + n₁η, Q = s₁ + n₂η, m₁n₁ + m₂n₂ = 1, η + ρη = t, η·ρη = ν and disc Λ = (η − ρη)² = D. -/structure Lam (M : QuartData O) where a : ℤ b : ℤ c : ℤ d : ℤ z : ℤ ha : (a : O) = M.x 0 + M.x 1 + M.x 2 + M.x 3 hb : (b : O) = M.x 0 * M.x 1 + M.x 0 * M.x 2 + M.x 0 * M.x 3 + M.x 1 * M.x 2 + M.x 1 * M.x 3 + M.x 2 * M.x 3 hc : (c : O) = M.x 0 * M.x 1 * M.x 2 + M.x 0 * M.x 1 * M.x 3 + M.x 0 * M.x 2 * M.x 3 + M.x 1 * M.x 2 * M.x 3 hd : (d : O) = M.x 0 * M.x 1 * M.x 2 * M.x 3 hz : (z : O) = M.Q + M.Q' n₁ : ℤ n₂ : ℤ m₁ : ℤ m₂ : ℤ s₀ : ℤ s₁ : ℤ t : ℤ ν : ℤ D : ℤ bez : m₁ * n₁ + m₂ * n₂ = 1 hS : M.S = s₀ + n₁ * M.eta m₁ m₂ hQ : M.Q = s₁ + n₂ * M.eta m₁ m₂ ht : M.eta m₁ m₂ + M.eta' m₁ m₂ = t hν : M.eta m₁ m₂ * M.eta' m₁ m₂ = ν hD : (M.eta m₁ m₂ - M.eta' m₁ m₂) ^ 2 = D namespace Lam variable {M : QuartData O} (P : Lam M) /-- η, ρη and θ = η − ρη. -/def η : O := M.eta P.m₁ P.m₂def η' : O := M.eta' P.m₁ P.m₂def θ : O := P.η - P.η' /-- δ₁ = a² − 4b + 4z, δ₂ = az − 2c, δ₃ = z² − 4d. -/def δ₁ : ℤ := P.a ^ 2 - 4 * P.b + 4 * P.zdef δ₂ : ℤ := P.a * P.z - 2 * P.cdef δ₃ : ℤ := P.z ^ 2 - 4 * P.d theorem hS' : M.S' = P.s₀ + P.n₁ * P.η' := by have h := congrArg M.ρ P.hS simpa only [M.ρS, map_add, map_mul, map_intCast, M.ρeta, η'] using h theorem hQ' : M.Q' = P.s₁ + P.n₂ * P.η' := by have h := congrArg M.ρ P.hQ simpa only [M.ρQ, map_add, map_mul, map_intCast, M.ρeta, η'] using h theorem DS_eq : M.S - M.S' = P.n₁ * P.θ := by rw [P.hS, P.hS']; simp only [θ, η, η']; ring theorem DQ_eq : M.Q - M.Q' = P.n₂ * P.θ := by rw [P.hQ, P.hQ']; simp only [θ, η, η']; ring theorem θ_sq : P.θ ^ 2 = P.D := P.hD theorem η_sq : P.η ^ 2 = P.t * P.η - P.ν := by rw [← P.ht, ← P.hν]; simp only [η]; ring /-- lem:Lambda, the three identities (S − ρS)² = δ₁, (S − ρS)(Q − ρQ) = δ₂, (Q − ρQ)² = δ₃. -/theorem ident : (M.S - M.S') ^ 2 = (P.δ₁ : O) ∧ (M.S - M.S') * (M.Q - M.Q') = (P.δ₂ : O) ∧ (M.Q - M.Q') ^ 2 = (P.δ₃ : O) := by simp only [δ₁, δ₂, δ₃, Int.cast_sub, Int.cast_add, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, P.ha, P.hb, P.hc, P.hd, P.hz, QuartData.S, QuartData.S', QuartData.Q, QuartData.Q'] refine ⟨by ring, by ring, by ring⟩ /-- z is a root of the cubic resolvent R(y) = y³ − by² + (ac − 4d)y − (a²d − 4bd + c²). -/theorem R_z : P.z ^ 3 - P.b * P.z ^ 2 + (P.a * P.c - 4 * P.d) * P.z - (P.a ^ 2 * P.d - 4 * P.b * P.d + P.c ^ 2) = 0 := by apply Int.cast_injective (α := O) simp only [Int.cast_sub, Int.cast_add, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, Int.cast_zero, P.ha, P.hb, P.hc, P.hd, P.hz, QuartData.Q, QuartData.Q'] ring theorem θ_ne : P.θ ≠ 0 := by intro h0 have e1 := P.DS_eq have e2 := P.DQ_eq rw [h0, mul_zero] at e1 e2 have : (M.x 0 - M.x 2) * (M.x 0 - M.x 3) = 0 := by simp only [QuartData.S, QuartData.S', QuartData.Q, QuartData.Q'] at e1 e2 linear_combination M.x 0 * e1 - e2 rcases mul_eq_zero.mp this with h | h · exact absurd (M.inj (sub_eq_zero.mp h)) (by decide) · exact absurd (M.inj (sub_eq_zero.mp h)) (by decide) theorem D_ne : P.D ≠ 0 := by intro h apply P.θ_ne have : P.θ ^ 2 = 0 := by rw [P.θ_sq, h, Int.cast_zero] exact pow_eq_zero_iff (two_ne_zero) |>.mp this theorem isCoprime : IsCoprime P.n₁ P.n₂ := ⟨P.m₁, P.m₂, P.bez⟩ theorem δ_eq : P.δ₁ = P.n₁ ^ 2 * P.D ∧ P.δ₂ = P.n₁ * P.n₂ * P.D ∧ P.δ₃ = P.n₂ ^ 2 * P.D := by obtain ⟨h1, h2, h3⟩ := P.ident rw [P.DS_eq] at h1 h2 rw [P.DQ_eq] at h2 h3 refine ⟨Int.cast_injective (α := O) ?_, Int.cast_injective (α := O) ?_, Int.cast_injective (α := O) ?_⟩ <;> push_cast <;> rw [← P.θ_sq] · rw [← h1]; ring · rw [← h2]; ring · rw [← h3]; ring end Lam theorem gcd3 (n₁ n₂ D : ℤ) (h : IsCoprime n₁ n₂) : (Int.gcd (n₁ ^ 2 * D) (Int.gcd (n₁ * n₂ * D) (n₂ ^ 2 * D)) : ℤ) = |D| := by have e1 : Int.gcd (n₁ * n₂ * D) (n₂ ^ 2 * D) = (n₂ * D).natAbs := by rw [show n₁ * n₂ * D = (n₂ * D) * n₁ by ring, show n₂ ^ 2 * D = (n₂ * D) * n₂ by ring, Int.gcd_mul_left, Int.isCoprime_iff_gcd_eq_one.mp h, mul_one] have e2 : Int.gcd (n₁ ^ 2 * D) ((n₂ * D).natAbs : ℤ) = Int.gcd (D * n₁ ^ 2) (D * n₂) := by rw [Int.gcd, Int.gcd, Int.natAbs_natCast, mul_comm D, mul_comm D] have e3 : Int.gcd (n₁ ^ 2) n₂ = 1 := Int.isCoprime_iff_gcd_eq_one.mp h.pow_left rw [e1, e2, Int.gcd_mul_left, e3, mul_one, Int.natCast_natAbs] /-- membership in A of polynomial expressions in the conjugates. -/macro "amem" : tactic => `(tactic| (repeat' first | exact QuartData.x_mem _ _ | exact intCast_mem _ _ | exact QuartData.S_mem _ | exact QuartData.Q_mem _ | exact QuartData.S'_mem _ | exact QuartData.Q'_mem _ | exact QuartData.eta_mem _ _ _ | exact QuartData.eta'_mem _ _ _ | apply Subring.add_mem | apply Subring.sub_mem | apply Subring.mul_mem | apply Subring.neg_mem | apply pow_mem)) namespace QuartData variable (M : QuartData O) /-- lem:Lambda, existence of the data: a primitive (n₁, n₂) with S − ρS = n₁θ, Q − ρQ = n₂θ. The pair is the note's: (δ₁, δ₂)/gcd(δ₁, δ₂) if δ₁ ≠ 0, (0, 1) if δ₁ = 0. -/theorem exists_lam : Nonempty (Lam M) := by obtain ⟨t0, t1, t2, t3⟩ := M.hτ obtain ⟨r0, r1⟩ := M.hρ have sym : ∀ y ∈ M.A, M.τ y = y → M.ρ y = y → ∃ n : ℤ, y = n := M.fix obtain ⟨a, ha⟩ := sym (M.x 0 + M.x 1 + M.x 2 + M.x 3) (by amem) (by simp only [map_add, t0, t1, t2, t3]; ring) (by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ <;> (simp only [map_add, r0, r1, h2, h3]; ring)) obtain ⟨b, hb⟩ := sym (M.x 0 * M.x 1 + M.x 0 * M.x 2 + M.x 0 * M.x 3 + M.x 1 * M.x 2 + M.x 1 * M.x 3 + M.x 2 * M.x 3) (by amem) (by simp only [map_add, map_mul, t0, t1, t2, t3]; ring) (by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ <;> (simp only [map_add, map_mul, r0, r1, h2, h3]; ring)) obtain ⟨c, hc⟩ := sym (M.x 0 * M.x 1 * M.x 2 + M.x 0 * M.x 1 * M.x 3 + M.x 0 * M.x 2 * M.x 3 + M.x 1 * M.x 2 * M.x 3) (by amem) (by simp only [map_add, map_mul, t0, t1, t2, t3]; ring) (by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ <;> (simp only [map_add, map_mul, r0, r1, h2, h3]; ring)) obtain ⟨d, hd⟩ := sym (M.x 0 * M.x 1 * M.x 2 * M.x 3) (by amem) (by simp only [map_mul, t0, t1, t2, t3]; ring) (by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ <;> (simp only [map_mul, r0, r1, h2, h3]; ring)) obtain ⟨z, hz⟩ := sym (M.Q + M.Q') (by amem) (by rw [map_add, M.τQ, M.τQ']) (by rw [map_add, M.ρQ, M.ρQ', add_comm]) obtain ⟨n₁, n₂, m₁, m₂, bez, prop⟩ : ∃ n₁ n₂ m₁ m₂ : ℤ, m₁ * n₁ + m₂ * n₂ = 1 ∧ (n₁ : O) * (M.Q - M.Q') = n₂ * (M.S - M.S') := by by_cases h0 : M.S - M.S' = 0 · exact ⟨0, 1, 0, 1, by ring, by rw [h0]; ring⟩ · obtain ⟨e1, he1⟩ := sym ((M.S - M.S') ^ 2) (by amem) (by rw [map_pow, map_sub, M.τS, M.τS']) (by rw [map_pow, map_sub, M.ρS, M.ρS']; ring) obtain ⟨e2, he2⟩ := sym ((M.S - M.S') * (M.Q - M.Q')) (by amem) (by rw [map_mul, map_sub, map_sub, M.τS, M.τS', M.τQ, M.τQ']) (by rw [map_mul, map_sub, map_sub, M.ρS, M.ρS', M.ρQ, M.ρQ']; ring) have he1ne : e1 ≠ 0 := by intro h apply h0 rw [h, Int.cast_zero] at he1 exact (pow_eq_zero_iff two_ne_zero).mp he1 have gpos : 0 < Int.gcd e1 e2 := Int.gcd_pos_of_ne_zero_left _ he1ne obtain ⟨u, hu⟩ := Int.gcd_dvd_left e1 e2 obtain ⟨w, hw⟩ := Int.gcd_dvd_right e1 e2 have hcop : Int.gcd u w = 1 := by have h1 : Int.gcd e1 e2 = Int.gcd (Int.gcd e1 e2 * u) (Int.gcd e1 e2 * w) := by rw [← hu, ← hw] rw [Int.gcd_mul_left, Int.natAbs_natCast] at h1 have h2 : Int.gcd e1 e2 * 1 = Int.gcd e1 e2 * Int.gcd u w := by rw [mul_one]; exact h1 exact (Nat.eq_of_mul_eq_mul_left gpos h2).symm refine ⟨u, w, Int.gcdA u w, Int.gcdB u w, ?_, ?_⟩ · have := Int.gcd_eq_gcd_ab u w rw [hcop] at this linear_combination -this · have hg : ((Int.gcd e1 e2 : ℤ) : O) ≠ 0 := by exact_mod_cast gpos.ne' apply mul_left_cancel₀ hg have key : (((Int.gcd e1 e2 : ℤ) * u : ℤ) : O) * (M.Q - M.Q') = (((Int.gcd e1 e2 : ℤ) * w : ℤ) : O) * (M.S - M.S') := by rw [← hu, ← hw, ← he1, ← he2]; ring push_cast at key ⊢ linear_combination key have hbez : (m₁ : O) * n₁ + m₂ * n₂ = 1 := by exact_mod_cast bez have hθ1 : M.S - M.S' = n₁ * (M.eta m₁ m₂ - M.eta' m₁ m₂) := by simp only [eta, eta'] linear_combination (-(M.S - M.S')) * hbez - (m₂ : O) * prop have hθ2 : M.Q - M.Q' = n₂ * (M.eta m₁ m₂ - M.eta' m₁ m₂) := by simp only [eta, eta'] linear_combination (-(M.Q - M.Q')) * hbez + (m₁ : O) * prop obtain ⟨s₀, hs₀⟩ := sym (M.S - n₁ * M.eta m₁ m₂) (by amem) (by rw [map_sub, map_mul, map_intCast, M.τS, M.τeta]) (by rw [map_sub, map_mul, map_intCast, M.ρS, M.ρeta]; linear_combination -hθ1) obtain ⟨s₁, hs₁⟩ := sym (M.Q - n₂ * M.eta m₁ m₂) (by amem) (by rw [map_sub, map_mul, map_intCast, M.τQ, M.τeta]) (by rw [map_sub, map_mul, map_intCast, M.ρQ, M.ρeta]; linear_combination -hθ2) obtain ⟨t, ht⟩ := sym (M.eta m₁ m₂ + M.eta' m₁ m₂) (by amem) (by rw [map_add, M.τeta, M.τeta']) (by rw [map_add, M.ρeta, M.ρeta', add_comm]) obtain ⟨ν, hν⟩ := sym (M.eta m₁ m₂ * M.eta' m₁ m₂) (by amem) (by rw [map_mul, M.τeta, M.τeta']) (by rw [map_mul, M.ρeta, M.ρeta', mul_comm]) obtain ⟨D, hD⟩ := sym ((M.eta m₁ m₂ - M.eta' m₁ m₂) ^ 2) (by amem) (by rw [map_pow, map_sub, M.τeta, M.τeta']) (by rw [map_pow, map_sub, M.ρeta, M.ρeta']; ring) exact ⟨⟨a, b, c, d, z, ha.symm, hb.symm, hc.symm, hd.symm, hz.symm, n₁, n₂, m₁, m₂, s₀, s₁, t, ν, D, bez, by linear_combination hs₀, by linear_combination hs₁, ht, hν, hD⟩⟩ end QuartData namespace Lam variable {M : QuartData O} (P : Lam M) /-- Λ = ℤ + ℤS + ℤQ. -/def _root_.Louboutin.TeoremaB.QuartData.Λ (M : QuartData O) : Submodule ℤ O := Submodule.span ℤ {1, M.S, M.Q} theorem hSη : M.S = P.s₀ + P.n₁ * P.η := P.hStheorem hQη : M.Q = P.s₁ + P.n₂ * P.η := P.hQ /-- lem:Lambda: Λ = ℤ + ℤη. -/theorem Λ_eq : M.Λ = Submodule.span ℤ {1, P.η} := by apply le_antisymm · apply Submodule.span_le.mpr intro y hy rcases hy with rfl | rfl | rfl · exact Submodule.subset_span (by simp) · rw [SetLike.mem_coe, Submodule.mem_span_pair] exact ⟨P.s₀, P.n₁, by rw [P.hSη]; simp [zsmul_eq_mul]⟩ · rw [SetLike.mem_coe, Submodule.mem_span_pair] exact ⟨P.s₁, P.n₂, by rw [P.hQη]; simp [zsmul_eq_mul]⟩ · apply Submodule.span_le.mpr intro y hy rcases hy with rfl | rfl · exact Submodule.subset_span (by simp) · have : P.η = P.m₁ • M.S + P.m₂ • M.Q := by simp [η, QuartData.eta, zsmul_eq_mul] rw [SetLike.mem_coe, this] exact Submodule.add_mem _ (Submodule.smul_mem _ _ (Submodule.subset_span (by simp))) (Submodule.smul_mem _ _ (Submodule.subset_span (by simp))) theorem mem_Λ {y : O} : y ∈ M.Λ ↔ ∃ p q : ℤ, y = p + q * P.η := by rw [P.Λ_eq, Submodule.mem_span_pair] constructor · rintro ⟨p, q, h⟩; exact ⟨p, q, by rw [← h]; simp [zsmul_eq_mul]⟩ · rintro ⟨p, q, h⟩; exact ⟨p, q, by rw [h]; simp [zsmul_eq_mul]⟩ include P intheorem one_mem_Λ : (1 : O) ∈ M.Λ := Submodule.subset_span (by simp)include P intheorem S_mem_Λ : M.S ∈ M.Λ := Submodule.subset_span (by simp)include P intheorem Q_mem_Λ : M.Q ∈ M.Λ := Submodule.subset_span (by simp)theorem η_mem_Λ : P.η ∈ M.Λ := P.mem_Λ.mpr ⟨0, 1, by simp⟩include P intheorem intCast_mem_Λ (n : ℤ) : (n : O) ∈ M.Λ := P.mem_Λ.mpr ⟨n, 0, by simp⟩ include P in/-- lem:Lambda: Λ is a ring (an order: ℤ[η] = ℤ + ℤη). -/theorem mul_mem_Λ {y y' : O} (hy : y ∈ M.Λ) (hy' : y' ∈ M.Λ) : y * y' ∈ M.Λ := by obtain ⟨p, q, rfl⟩ := P.mem_Λ.mp hy obtain ⟨p', q', rfl⟩ := P.mem_Λ.mp hy' refine P.mem_Λ.mpr ⟨p * p' - q * q' * P.ν, p * q' + q * p' + q * q' * P.t, ?_⟩ push_cast linear_combination (q : O) * q' * P.η_sq include P in/-- lem:Lambda: Λ ⊆ E = K^⟨τ⟩. -/theorem τ_Λ {y : O} (hy : y ∈ M.Λ) : M.τ y = y := by obtain ⟨p, q, rfl⟩ := P.mem_Λ.mp hy simp only [map_add, map_mul, map_intCast, η, M.τeta] /-- lem:Lambda: Λ has rank 2 (1, η are ℤ-independent). -/theorem linIndep_Λ : LinearIndependent ℤ ![1, P.η] := by rw [LinearIndependent.pair_iff] intro p q h simp only [zsmul_eq_mul, mul_one] at h have h' := congrArg M.ρ h simp only [map_add, map_mul, map_intCast, map_zero, η, M.ρeta] at h' have hq : (q : O) * P.θ = 0 := by simp only [θ, η', η] simp only [η] at h linear_combination h - h' have hq0 : q = 0 := by rcases mul_eq_zero.mp hq with h1 | h1 · exact_mod_cast h1 · exact absurd h1 P.θ_ne subst hq0 refine ⟨?_, rfl⟩ simpa using h end Lam /-! ## Lattices in O: the determinant D (detG with γ = 1, τ, ρ, ρτ) and indices -/ /-- The lattice spanned by a family. -/abbrev Lat4 (v : Fin 4 → O) : AddSubgroup O := (Submodule.span ℤ (Set.range v)).toAddSubgroup namespace QuartData open Module variable (M : QuartData O) /-- γ₀ = 1, γ₁ = τ, γ₂ = ρ, γ₃ = ρτ. -/def γ (i : Fin 4) : O →+* O := ![RingHom.id O, M.τ, M.ρ, M.ρ.comp 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ρ.2] /-- D(ω) = det[γ_i(ω_l)]. -/noncomputable def Dq (w : Fin 4 → O) : O := (Matrix.of fun i l => M.γ i (w l)).det theorem Dq_comb (v w : Fin 4 → O) (C : Matrix (Fin 4) (Fin 4) ℤ) (h : ∀ l, w l = ∑ k, (C l k : O) * v k) : M.Dq w = M.Dq v * (C.det : O) := by have hE : (Matrix.of fun i l => M.γ i (w l)) = (Matrix.of fun i l => M.γ i (v l)) * (C.map (Int.castRingHom O))ᵀ := by ext i l simp only [Matrix.of_apply, Matrix.mul_apply, Matrix.transpose_apply, Matrix.map_apply, h l, map_sum, map_mul, map_intCast, eq_intCast] exact Finset.sum_congr rfl fun k _ => by ring rw [Dq, Dq, hE, Matrix.det_mul, Matrix.det_transpose] congr 1 rw [show ((C.det : ℤ) : O) = Int.castRingHom O C.det from rfl, RingHom.map_det] rfl theorem linIndep_of_Dq {v : Fin 4 → O} (hv : M.Dq v ≠ 0) : LinearIndependent ℤ v := by rw [Fintype.linearIndependent_iff] intro g hg set A := Matrix.of fun i l => M.γ i (v l) with hAdef have hA : A *ᵥ (fun l => (g l : O)) = 0 := by funext i simp only [hAdef, Matrix.mulVec, dotProduct, Matrix.of_apply, Pi.zero_apply] have := congrArg (M.γ i) hg rw [map_sum, map_zero] at this rw [← this] refine Finset.sum_congr rfl fun l _ => ?_ rw [zsmul_eq_mul, map_mul, map_intCast, mul_comm] have h2 : A.det • (fun l => (g l : O)) = 0 := by have := congrArg (fun u => A.adjugate *ᵥ u) hA simp only [Matrix.mulVec_mulVec, Matrix.adjugate_mul, Matrix.mulVec_zero] at this rwa [Matrix.smul_mulVec, Matrix.one_mulVec] at this intro l have := congrFun h2 l simp only [Pi.smul_apply, smul_eq_mul, Pi.zero_apply] at this rcases mul_eq_zero.mp this with h | h · exact absurd h hv · exact_mod_cast h /-- [⟨v⟩ : ⟨w⟩] = |det C| where w = C v, and D(w) = D(v) det C. -/theorem relIndex_Dq {v w : Fin 4 → O} (hv : M.Dq v ≠ 0) (hw : M.Dq w ≠ 0) (hwv : ∀ l, w l ∈ Submodule.span ℤ (Set.range v)) : ∃ C : Matrix (Fin 4) (Fin 4) ℤ, M.Dq w = M.Dq v * (C.det : O) ∧ (Lat4 w).relIndex (Lat4 v) = C.det.natAbs := by choose c hc using fun l => (Submodule.mem_span_range_iff_exists_fun ℤ).mp (hwv l) refine ⟨Matrix.of c, M.Dq_comb v w (Matrix.of c) (fun l => by rw [← hc l]; simp [zsmul_eq_mul]), ?_⟩ have hle : Lat4 w ≤ Lat4 v := by show Submodule.span ℤ (Set.range w) ≤ Submodule.span ℤ (Set.range v) exact Submodule.span_le.mpr (Set.range_subset_iff.mpr hwv) let bv := Basis.span (M.linIndep_of_Dq hv) let bw := Basis.span (M.linIndep_of_Dq hw) let b₂ := bv.map (LinearEquiv.ofEq _ _ (Submodule.toAddSubgroup_toIntSubmodule _).symm) let b₁ := bw.map (LinearEquiv.ofEq _ _ (Submodule.toAddSubgroup_toIntSubmodule _).symm) rw [AddSubgroup.relIndex_eq_natAbs_det _ _ hle b₁ b₂, Basis.det_apply] have hT : b₂.toMatrix (fun i => (⟨b₁ i, hle (SetLike.coe_mem _)⟩ : AddSubgroup.toIntSubmodule (Lat4 v))) = (Matrix.of c)ᵀ := by ext i j rw [Basis.toMatrix_apply] have hb1 : ((b₁ j : AddSubgroup.toIntSubmodule (Lat4 w)) : O) = w j := by simp only [b₁, Basis.map_apply, LinearEquiv.coe_ofEq_apply] exact Basis.coe_span_apply _ j have hsum : (⟨b₁ j, hle (SetLike.coe_mem _)⟩ : AddSubgroup.toIntSubmodule (Lat4 v)) = LinearEquiv.ofEq _ _ (Submodule.toAddSubgroup_toIntSubmodule _).symm (∑ k, c j k • bv k) := by apply Subtype.ext simp only [LinearEquiv.coe_ofEq_apply, Submodule.coe_sum, Submodule.coe_smul, bv, Basis.coe_span_apply] rw [hb1, ← hc j] rw [hsum] simp only [b₂, Basis.map_repr, LinearEquiv.trans_apply, LinearEquiv.symm_apply_apply, Basis.repr_sum_self, Matrix.transpose_apply, Matrix.of_apply] rw [hT, Matrix.det_transpose] /-- ℤ[α] = ℤ + ℤα + ℤα² + ℤα³. -/def vpow : Fin 4 → O := ![1, M.x 0, M.x 0 ^ 2, M.x 0 ^ 3] theorem Dq_vpow : M.Dq M.vpow = Vand M.x := by rw [Dq, ← vand4] congr 1 ext i l fin_cases i <;> fin_cases l <;> simp [vpow, γ, Matrix.vandermonde_apply, M.hτ.1, M.hρ.1, M.hρ.2] theorem Vand_ne : 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) end QuartData /-! ## lem:B -/ namespace Lam variable {M : QuartData O} (P : Lam M) /-- {1, η, α, ηα}. -/def vB : Fin 4 → O := ![1, P.η, M.x 0, P.η * M.x 0]/-- ω₀ = m₁η + m₂ηα. -/def ω₀ : O := P.m₁ * P.η + P.m₂ * (P.η * M.x 0)/-- {1, α, α², ω₀}. -/def vW : Fin 4 → O := ![1, M.x 0, M.x 0 ^ 2, P.ω₀] /-- B = Λ[α] = ℤ + ℤη + ℤα + ℤηα. -/def B : Submodule ℤ O := Submodule.span ℤ (Set.range P.vB) /-- J = n₂² − s₀n₁n₂ + s₁n₁², the index [B : ℤ[α]] up to sign. -/def J : ℤ := P.n₂ ^ 2 - P.s₀ * P.n₁ * P.n₂ + P.s₁ * P.n₁ ^ 2 /-- R'(z) = 3z² − 2bz + (ac − 4d). -/def R'z : ℤ := 3 * P.z ^ 2 - 2 * P.b * P.z + (P.a * P.c - 4 * P.d) theorem α_sq : M.x 0 ^ 2 = -(P.s₁ : O) - P.n₂ * P.η + P.s₀ * M.x 0 + P.n₁ * (P.η * M.x 0) := by have h : M.x 0 ^ 2 = M.S * M.x 0 - M.Q := by simp only [QuartData.S, QuartData.Q]; ring rw [h, P.hSη, P.hQη]; ring theorem α_cube : M.x 0 ^ 3 = -((P.s₀ * P.s₁ - P.n₁ * P.n₂ * P.ν : ℤ) : O) - ((P.s₀ * P.n₂ + P.s₁ * P.n₁ + P.n₁ * P.n₂ * P.t : ℤ) : O) * P.η + ((P.s₀ ^ 2 - P.n₁ ^ 2 * P.ν - P.s₁ : ℤ) : O) * M.x 0 + ((2 * P.s₀ * P.n₁ + P.n₁ ^ 2 * P.t - P.n₂ : ℤ) : O) * (P.η * M.x 0) := by have h : M.x 0 ^ 3 = (M.S ^ 2 - M.Q) * M.x 0 - M.S * M.Q := by simp only [QuartData.S, QuartData.Q]; ring rw [P.hSη, P.hQη] at h push_cast linear_combination h + ((P.n₁ : O) ^ 2 * M.x 0 - P.n₁ * P.n₂) * P.η_sq /-- The key identity: J·disc Λ = R'(z). -/theorem J_mul_D : P.J * P.D = P.R'z := by apply Int.cast_injective (α := O) have e1 : (M.Q - M.Q') ^ 2 - M.S * (M.S - M.S') * (M.Q - M.Q') + M.Q * (M.S - M.S') ^ 2 = (P.R'z : O) := by simp only [R'z, Int.cast_add, Int.cast_sub, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, P.ha, P.hb, P.hc, P.hd, P.hz, QuartData.S, QuartData.S', QuartData.Q, QuartData.Q'] ring rw [P.DS_eq, P.DQ_eq, P.hSη, P.hQη] at e1 rw [← e1, J] push_cast rw [← P.θ_sq] ring theorem Dq_vB : M.Dq P.vB = -(P.θ ^ 2) * (M.x 0 - M.x 1) * (M.x 2 - M.x 3) := by rw [QuartData.Dq, det4] have g0 : ∀ y, M.γ 0 y = y := fun y => rfl have g1 : ∀ y, M.γ 1 y = M.τ y := fun y => rfl have g2 : ∀ y, M.γ 2 y = M.ρ y := fun y => rfl have g3 : ∀ y, M.γ 3 y = M.ρ (M.τ y) := fun y => rfl simp only [Matrix.of_apply, vB, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons, g0, g1, g2, g3, map_one, map_mul, η, M.τeta, M.ρeta, M.hτ.1, M.hρ.1, M.hρ.2] simp only [θ, η, η', det4e] ring theorem Dq_vB_ne : M.Dq P.vB ≠ 0 := by rw [P.Dq_vB] refine mul_ne_zero (mul_ne_zero (neg_ne_zero.mpr (pow_ne_zero _ P.θ_ne)) ?_) ?_ · exact sub_ne_zero.mpr (M.inj.ne (by decide)) · exact sub_ne_zero.mpr (M.inj.ne (by decide)) theorem Vand_eq : Vand M.x = M.Dq P.vB * (-(P.J : O)) := by rw [P.Dq_vB] have e : (P.J : O) * P.θ ^ 2 = P.R'z := by rw [P.θ_sq]; exact_mod_cast P.J_mul_D have e2 : Vand M.x = (M.x 0 - M.x 1) * (M.x 2 - M.x 3) * (P.R'z : O) := by simp only [Vand, R'z, Int.cast_add, Int.cast_sub, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, P.ha, P.hb, P.hc, P.hd, P.hz, QuartData.Q, QuartData.Q'] ring rw [e2, ← e]; ring theorem vpow_mem_B (l : Fin 4) : M.vpow l ∈ P.B := by rw [B, Submodule.mem_span_range_iff_exists_fun] fin_cases l · exact ⟨![1, 0, 0, 0], by simp [vB, Fin.sum_univ_four, QuartData.vpow]⟩ · exact ⟨![0, 0, 1, 0], by simp [vB, Fin.sum_univ_four, QuartData.vpow]⟩ · refine ⟨![-P.s₁, -P.n₂, P.s₀, P.n₁], ?_⟩ simp only [vB, Fin.sum_univ_four, QuartData.vpow, zsmul_eq_mul] simp rw [P.α_sq]; ring · refine ⟨![-(P.s₀ * P.s₁ - P.n₁ * P.n₂ * P.ν), -(P.s₀ * P.n₂ + P.s₁ * P.n₁ + P.n₁ * P.n₂ * P.t), P.s₀ ^ 2 - P.n₁ ^ 2 * P.ν - P.s₁, 2 * P.s₀ * P.n₁ + P.n₁ ^ 2 * P.t - P.n₂], ?_⟩ simp only [vB, Fin.sum_univ_four, QuartData.vpow, zsmul_eq_mul] simp only [Fin.isValue, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons] rw [P.α_cube]; push_cast; ring /-- lem:B, the index: [B : ℤ[α]] = |J|. -/theorem relIndex_B : (Lat4 M.vpow).relIndex (Lat4 P.vB) = P.J.natAbs := by have hw : M.Dq M.vpow ≠ 0 := by rw [M.Dq_vpow]; exact M.Vand_ne obtain ⟨C, hD, hidx⟩ := M.relIndex_Dq P.Dq_vB_ne hw P.vpow_mem_B rw [M.Dq_vpow, P.Vand_eq] at hD have hC : C.det = -P.J := by have := mul_left_cancel₀ P.Dq_vB_ne hD exact_mod_cast this.symm rw [hidx, hC, Int.natAbs_neg] /-- lem:B: J = |R'(z)|/|disc Λ|. -/theorem J_natAbs : P.J.natAbs = P.R'z.natAbs / P.D.natAbs := by rw [← P.J_mul_D, Int.natAbs_mul, Nat.mul_div_cancel _ (Int.natAbs_pos.mpr P.D_ne)] theorem bezO : (P.m₁ : O) * P.n₁ + P.m₂ * P.n₂ = 1 := by exact_mod_cast P.bez /-- the change of basis {1, η, α, ηα} → {1, α, α², ω₀} (determinant 1). -/theorem vW_comb : ∀ l, P.vW l = ∑ k, ((!![1, 0, 0, 0; 0, 0, 1, 0; -P.s₁, -P.n₂, P.s₀, P.n₁; 0, P.m₁, 0, P.m₂] : Matrix (Fin 4) (Fin 4) ℤ) l k : O) * P.vB k := by intro l fin_cases l <;> simp [vW, vB, Fin.sum_univ_four, ω₀] rw [P.α_sq]; ring theorem Dq_vW : M.Dq P.vW = M.Dq P.vB := by have hdet : (!![1, 0, 0, 0; 0, 0, 1, 0; -P.s₁, -P.n₂, P.s₀, P.n₁; 0, P.m₁, 0, P.m₂] : Matrix (Fin 4) (Fin 4) ℤ).det = 1 := by rw [det4]; simp [det4e]; linear_combination P.bez rw [M.Dq_comb P.vB P.vW _ P.vW_comb, hdet, Int.cast_one, mul_one] theorem vB_mem_W (l : Fin 4) : P.vB l ∈ Submodule.span ℤ (Set.range P.vW) := by rw [Submodule.mem_span_range_iff_exists_fun] fin_cases l · exact ⟨![1, 0, 0, 0], by simp [vW, Fin.sum_univ_four, vB]⟩ · refine ⟨![-(P.m₂ * P.s₁), P.m₂ * P.s₀, -P.m₂, P.n₁], ?_⟩ simp [vW, Fin.sum_univ_four, vB, ω₀] rw [P.α_sq] linear_combination P.η * P.bezO · exact ⟨![0, 1, 0, 0], by simp [vW, Fin.sum_univ_four, vB]⟩ · refine ⟨![P.m₁ * P.s₁, -(P.m₁ * P.s₀), P.m₁, P.n₂], ?_⟩ simp [vW, Fin.sum_univ_four, vB, ω₀] rw [P.α_sq] linear_combination P.η * M.x 0 * P.bezO theorem vW_mem_B (l : Fin 4) : P.vW l ∈ P.B := by rw [P.vW_comb l] exact Submodule.sum_mem _ fun k _ => by rw [← zsmul_eq_mul] exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨k, rfl⟩) /-- lem:B: {1, α, α², ω₀} spans B. -/theorem B_eq_W : P.B = Submodule.span ℤ (Set.range P.vW) := by apply le_antisymm · exact Submodule.span_le.mpr (Set.range_subset_iff.mpr P.vB_mem_W) · exact Submodule.span_le.mpr (Set.range_subset_iff.mpr P.vW_mem_B) /-- lem:B: {1, η, α, ηα} and {1, α, α², ω₀} are ℤ-bases of B (independent families). -/theorem linIndep_vB : LinearIndependent ℤ P.vB := M.linIndep_of_Dq P.Dq_vB_netheorem linIndep_vW : LinearIndependent ℤ P.vW := M.linIndep_of_Dq (by rw [P.Dq_vW]; exact P.Dq_vB_ne) /-- B = Λ + Λα. -/theorem mem_B {y : O} : y ∈ P.B ↔ ∃ l₁ ∈ M.Λ, ∃ l₂ ∈ M.Λ, y = l₁ + l₂ * M.x 0 := by rw [B, Submodule.mem_span_range_iff_exists_fun] constructor · rintro ⟨c, rfl⟩ refine ⟨c 0 + c 1 * P.η, P.mem_Λ.mpr ⟨c 0, c 1, rfl⟩, c 2 + c 3 * P.η, P.mem_Λ.mpr ⟨c 2, c 3, rfl⟩, ?_⟩ simp [Fin.sum_univ_four, vB, zsmul_eq_mul] ring · rintro ⟨l₁, h₁, l₂, h₂, rfl⟩ obtain ⟨p, q, rfl⟩ := P.mem_Λ.mp h₁ obtain ⟨p', q', rfl⟩ := P.mem_Λ.mp h₂ refine ⟨![p, q, p', q'], ?_⟩ simp [Fin.sum_univ_four, vB, zsmul_eq_mul] ring theorem Λ_le_B {y : O} (hy : y ∈ M.Λ) : y ∈ P.B := P.mem_B.mpr ⟨y, hy, 0, Submodule.zero_mem _, by ring⟩ theorem α_mem_B : M.x 0 ∈ P.B := P.mem_B.mpr ⟨0, Submodule.zero_mem _, 1, P.one_mem_Λ, by ring⟩ /-- lem:B: B is a ring (α² = Sα − Q with S, Q ∈ Λ). -/theorem mul_mem_B {y y' : O} (hy : y ∈ P.B) (hy' : y' ∈ P.B) : y * y' ∈ P.B := by obtain ⟨l₁, h₁, l₂, h₂, rfl⟩ := P.mem_B.mp hy obtain ⟨l₁', h₁', l₂', h₂', rfl⟩ := P.mem_B.mp hy' have hS := P.S_mem_Λ have hQ := P.Q_mem_Λ refine P.mem_B.mpr ⟨l₁ * l₁' - l₂ * l₂' * M.Q, Submodule.sub_mem _ (P.mul_mem_Λ h₁ h₁') (P.mul_mem_Λ (P.mul_mem_Λ h₂ h₂') hQ), l₁ * l₂' + l₂ * l₁' + l₂ * l₂' * M.S, Submodule.add_mem _ (Submodule.add_mem _ (P.mul_mem_Λ h₁ h₂') (P.mul_mem_Λ h₂ h₁')) (P.mul_mem_Λ (P.mul_mem_Λ h₂ h₂') hS), ?_⟩ simp only [QuartData.S, QuartData.Q] ring /-- lem:B: B = Λ[α], the smallest subring containing Λ and α. -/theorem B_le_subring (R : Subring O) (hΛ : ∀ y ∈ M.Λ, y ∈ R) (hα : M.x 0 ∈ R) {y : O} (hy : y ∈ P.B) : y ∈ R := by obtain ⟨l₁, h₁, l₂, h₂, rfl⟩ := P.mem_B.mp hy exact R.add_mem (hΛ _ h₁) (R.mul_mem (hΛ _ h₂) hα) /-! ## lem:AB -/ include P intheorem Λ_le_A {y : O} (hy : y ∈ M.Λ) : y ∈ M.A := by obtain ⟨p, q, rfl⟩ := P.mem_Λ.mp hy exact M.A.add_mem (intCast_mem _ _) (M.A.mul_mem (intCast_mem _ _) (M.eta_mem _ _)) theorem B_le_A {y : O} (hy : y ∈ P.B) : y ∈ M.A := by obtain ⟨l₁, h₁, l₂, h₂, rfl⟩ := P.mem_B.mp hy exact M.A.add_mem (P.Λ_le_A h₁) (M.A.mul_mem (P.Λ_le_A h₂) (M.x_mem 0)) /-- lem:AB: A = B + Bβ, β = ρ(α) = x₂. -/theorem lem_AB {y : O} : y ∈ M.A ↔ ∃ b₁ ∈ P.B, ∃ b₂ ∈ P.B, y = b₁ + b₂ * M.x 2 := by constructor · intro hy have hB1 : (1 : O) ∈ P.B := P.Λ_le_B P.one_mem_Λ have hBS : M.S ∈ P.B := P.Λ_le_B P.S_mem_Λ have hBQ : M.Q ∈ P.B := P.Λ_le_B P.Q_mem_Λ have hBa : (P.a : O) ∈ P.B := P.Λ_le_B (P.intCast_mem_Λ _) have hBz : (P.z : O) ∈ P.B := P.Λ_le_B (P.intCast_mem_Λ _) induction hy using Subring.closure_induction with | mem x hx => obtain ⟨k, rfl⟩ := hx fin_cases k · exact ⟨M.x 0, P.α_mem_B, 0, Submodule.zero_mem _, by show M.x 0 = M.x 0 + 0 * M.x 2; ring⟩ · refine ⟨M.S - M.x 0, Submodule.sub_mem _ hBS P.α_mem_B, 0, Submodule.zero_mem _, ?_⟩ show M.x 1 = (M.S - M.x 0) + 0 * M.x 2 simp only [QuartData.S]; ring · exact ⟨0, Submodule.zero_mem _, 1, hB1, by show M.x 2 = 0 + 1 * M.x 2; ring⟩ · refine ⟨P.a - M.S, Submodule.sub_mem _ hBa hBS, -1, Submodule.neg_mem _ hB1, ?_⟩ show M.x 3 = ((P.a : O) - M.S) + -1 * M.x 2 rw [P.ha]; simp only [QuartData.S]; ring | zero => exact ⟨0, Submodule.zero_mem _, 0, Submodule.zero_mem _, by ring⟩ | one => exact ⟨1, hB1, 0, Submodule.zero_mem _, by ring⟩ | add x y _ _ hx hy => obtain ⟨b₁, h₁, b₂, h₂, rfl⟩ := hx obtain ⟨b₁', h₁', b₂', h₂', rfl⟩ := hy exact ⟨b₁ + b₁', Submodule.add_mem _ h₁ h₁', b₂ + b₂', Submodule.add_mem _ h₂ h₂', by ring⟩ | neg x _ hx => obtain ⟨b₁, h₁, b₂, h₂, rfl⟩ := hx exact ⟨-b₁, Submodule.neg_mem _ h₁, -b₂, Submodule.neg_mem _ h₂, by ring⟩ | mul x y _ _ hx hy => obtain ⟨b₁, h₁, b₂, h₂, rfl⟩ := hx obtain ⟨b₁', h₁', b₂', h₂', rfl⟩ := hy -- β² = (a − S)β − (z − Q) have hβ : M.x 2 ^ 2 = ((P.a : O) - M.S) * M.x 2 - ((P.z : O) - M.Q) := by rw [P.ha, P.hz]; simp only [QuartData.S, QuartData.Q, QuartData.Q']; ring refine ⟨b₁ * b₁' - b₂ * b₂' * ((P.z : O) - M.Q), Submodule.sub_mem _ (P.mul_mem_B h₁ h₁') (P.mul_mem_B (P.mul_mem_B h₂ h₂') (Submodule.sub_mem _ hBz hBQ)), b₁ * b₂' + b₂ * b₁' + b₂ * b₂' * ((P.a : O) - M.S), Submodule.add_mem _ (Submodule.add_mem _ (P.mul_mem_B h₁ h₂') (P.mul_mem_B h₂ h₁')) (P.mul_mem_B (P.mul_mem_B h₂ h₂') (Submodule.sub_mem _ hBa hBS)), ?_⟩ linear_combination b₂ * b₂' * hβ · rintro ⟨b₁, h₁, b₂, h₂, rfl⟩ exact M.A.add_mem (P.B_le_A h₁) (M.A.mul_mem (P.B_le_A h₂) (M.x_mem 2)) /-! ## lem:lambda -/ /-- u = α − τα, v = ρ(u) = β − ρτα, N = a² − 2b − 2z, k = an₁ − 4n₂. -/def _root_.Louboutin.TeoremaB.QuartData.u (M : QuartData O) : O := M.x 0 - M.x 1def _root_.Louboutin.TeoremaB.QuartData.v (M : QuartData O) : O := M.x 2 - M.x 3def N : ℤ := P.a ^ 2 - 2 * P.b - 2 * P.zdef k : ℤ := P.a * P.n₁ - 4 * P.n₂ include P intheorem u_ne : M.u ≠ 0 := sub_ne_zero.mpr (M.inj.ne (by decide))include P intheorem v_ne : M.v ≠ 0 := sub_ne_zero.mpr (M.inj.ne (by decide)) theorem uv_sum : M.u ^ 2 + M.v ^ 2 = P.N := by simp only [QuartData.u, QuartData.v, N, Int.cast_sub, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, P.ha, P.hb, P.hz, QuartData.Q, QuartData.Q'] ring theorem uv_diff : M.u ^ 2 - M.v ^ 2 = P.k * P.θ := by have h : M.u ^ 2 - M.v ^ 2 = (M.S + M.S') * (M.S - M.S') - 4 * (M.Q - M.Q') := by simp only [QuartData.u, QuartData.v, QuartData.S, QuartData.S', QuartData.Q, QuartData.Q']; ring rw [h, P.DS_eq, P.DQ_eq] have ha' : M.S + M.S' = P.a := by rw [P.ha]; simp only [QuartData.S, QuartData.S']; ring rw [ha', k]; push_cast; ring theorem N_sub_kθ : (P.N : O) - P.k * P.θ = 2 * M.v ^ 2 := by rw [← P.uv_sum, ← P.uv_diff]; ring include P in/-- lem:lambda: τu = −u and τv = −v, so λ = v/u is τ-fixed (λ ∈ E). -/theorem τ_uv : M.τ M.u = -M.u ∧ M.τ M.v = -M.v := by simp only [QuartData.u, QuartData.v, map_sub, M.hτ.1, M.hτ.2.1, M.hτ.2.2.1, M.hτ.2.2.2] constructor <;> ring include P in/-- lem:lambda: β = μ + λα with λ = v/u, μ = (a − S(1 + λ))/2, cleared of denominators: 2u·β = u·a − S(u + v) + 2v·α. -/theorem β_eq : 2 * M.u * M.x 2 = M.u * P.a - M.S * (M.u + M.v) + 2 * M.v * M.x 0 := by rw [P.ha]; simp only [QuartData.u, QuartData.v, QuartData.S]; ring /-- lem:lambda (a), Γ ≅ C₂ × C₂: κ = uv is a nonzero integer, κ = z' − z'', 4κ² = N² − k² disc Λ, λ = (N − kθ)/(2κ) (as 2κv = u(N − kθ)) and 4κβ = 2κa − S(2κ + N − kθ) + 2(N − kθ)α. -/theorem lem_lambda_a (hV : M.ρ (M.x 2) = M.x 0 ∧ M.ρ (M.x 3) = M.x 1) : ∃ κ : ℤ, (κ : O) = M.u * M.v ∧ κ ≠ 0 ∧ (κ : O) = (M.x 0 * M.x 2 + M.x 1 * M.x 3) - (M.x 0 * M.x 3 + M.x 1 * M.x 2) ∧ 4 * κ ^ 2 = P.N ^ 2 - P.k ^ 2 * P.D ∧ 2 * (κ : O) * M.v = M.u * ((P.N : O) - P.k * P.θ) ∧ 4 * (κ : O) * M.x 2 = 2 * κ * P.a - M.S * (2 * κ + ((P.N : O) - P.k * P.θ)) + 2 * ((P.N : O) - P.k * P.θ) * M.x 0 := by obtain ⟨κ, hκ⟩ := M.fix (M.u * M.v) (by simp only [QuartData.u, QuartData.v]; amem) (by simp only [QuartData.u, QuartData.v, map_mul, map_sub, M.hτ.1, M.hτ.2.1, M.hτ.2.2.1, M.hτ.2.2.2]; ring) (by simp only [QuartData.u, QuartData.v, map_mul, map_sub, M.hρ.1, M.hρ.2, hV.1, hV.2]; ring) have hne : κ ≠ 0 := by rintro rfl rw [Int.cast_zero] at hκ rcases mul_eq_zero.mp hκ with h | h · exact P.u_ne h · exact P.v_ne h refine ⟨κ, hκ.symm, hne, ?_, ?_, ?_, ?_⟩ · rw [← hκ]; simp only [QuartData.u, QuartData.v]; ring · apply Int.cast_injective (α := O) push_cast rw [← hκ, ← P.θ_sq] have h1 := P.uv_sum have h2 := P.uv_diff linear_combination ((P.N : O) + M.u ^ 2 + M.v ^ 2) * h1 - ((P.k : O) * P.θ + M.u ^ 2 - M.v ^ 2) * h2 · rw [P.N_sub_kθ, ← hκ]; ring · rw [P.N_sub_kθ, ← hκ, P.ha]; simp only [QuartData.u, QuartData.v, QuartData.S]; ring /-- lem:lambda (b), Γ = ⟨σ⟩ ≅ C₄ (ρ = σ, τ = σ²): σ(uv) = −uv, σθ = −θ, h = uvθ is a nonzero integer, 4h² = disc Λ (N² − k² disc Λ), λ = (Nθ − k disc Λ)/(2h) (as 2hv = u(Nθ − k disc Λ)) and 4hβ = 2ha − S(2h + Nθ − k disc Λ) + 2(Nθ − k disc Λ)α. -/theorem lem_lambda_b (hC : M.ρ (M.x 2) = M.x 1 ∧ M.ρ (M.x 3) = M.x 0) : M.ρ (M.u * M.v) = -(M.u * M.v) ∧ M.ρ P.θ = -P.θ ∧ ∃ h : ℤ, (h : O) = M.u * M.v * P.θ ∧ h ≠ 0 ∧ 4 * h ^ 2 = P.D * (P.N ^ 2 - P.k ^ 2 * P.D) ∧ 2 * (h : O) * M.v = M.u * ((P.N : O) * P.θ - P.k * P.D) ∧ 4 * (h : O) * M.x 2 = 2 * h * P.a - M.S * (2 * h + ((P.N : O) * P.θ - P.k * P.D)) + 2 * ((P.N : O) * P.θ - P.k * P.D) * M.x 0 := by have hρuv : M.ρ (M.u * M.v) = -(M.u * M.v) := by simp only [QuartData.u, QuartData.v, map_mul, map_sub, M.hρ.1, M.hρ.2, hC.1, hC.2]; ring have hρθ : M.ρ P.θ = -P.θ := by simp only [θ, η, η', map_sub, M.ρeta, M.ρeta']; ring have hτθ : M.τ P.θ = P.θ := by simp only [θ, η, η', map_sub, M.τeta, M.τeta'] refine ⟨hρuv, hρθ, ?_⟩ have hθA : P.θ ∈ M.A := by simp only [θ, η, η']; amem obtain ⟨h, hh⟩ := M.fix (M.u * M.v * P.θ) (by simp only [QuartData.u, QuartData.v]; amem) (by rw [map_mul, hτθ]; simp only [QuartData.u, QuartData.v, map_mul, map_sub, M.hτ.1, M.hτ.2.1, M.hτ.2.2.1, M.hτ.2.2.2]; ring) (by rw [map_mul, hρuv, hρθ]; ring) have hDθ : (P.D : O) = P.θ ^ 2 := P.θ_sq.symm have hne : h ≠ 0 := by rintro rfl rw [Int.cast_zero] at hh rcases mul_eq_zero.mp hh with h1 | h1 · rcases mul_eq_zero.mp h1 with h2 | h2 · exact P.u_ne h2 · exact P.v_ne h2 · exact P.θ_ne h1 have hNk : (P.N : O) * P.θ - P.k * P.D = 2 * P.θ * M.v ^ 2 := by rw [hDθ]; linear_combination P.θ * P.N_sub_kθ refine ⟨h, hh.symm, hne, ?_, ?_, ?_⟩ · apply Int.cast_injective (α := O) push_cast rw [← hh, hDθ] have h1 := P.uv_sum have h2 := P.uv_diff linear_combination (P.θ ^ 2) * (((P.N : O) + M.u ^ 2 + M.v ^ 2) * h1 - ((P.k : O) * P.θ + M.u ^ 2 - M.v ^ 2) * h2) · rw [hNk, ← hh]; ring · rw [hNk, ← hh, P.ha]; simp only [QuartData.u, QuartData.v, QuartData.S]; ring /-! ## thm:B, assembly: indices and the discriminant of A -/ theorem θ_mem_Λ : P.θ ∈ M.Λ := by refine P.mem_Λ.mpr ⟨-P.t, 2, ?_⟩ have h := P.ht simp only [θ, η', η] at h ⊢ push_cast linear_combination -h theorem intCast_mem_B (n : ℤ) : (n : O) ∈ P.B := P.Λ_le_B (P.intCast_mem_Λ n) /-- A nonzero integer N with N·β ∈ B (N = 4κ or 4h, lem:lambda). -/theorem exists_Nβ : ∃ N : ℤ, N ≠ 0 ∧ (N : O) * M.x 2 ∈ P.B := by have hS : M.S ∈ P.B := P.Λ_le_B P.S_mem_Λ have hθ : P.θ ∈ P.B := P.Λ_le_B P.θ_mem_Λ have hα := P.α_mem_B have hI := P.intCast_mem_B have hm := fun {y y'} (h : y ∈ P.B) (h' : y' ∈ P.B) => P.mul_mem_B h h' rcases M.hρ2 with hV | hC · obtain ⟨κ, -, hne, -, -, -, hβ⟩ := P.lem_lambda_a hV refine ⟨4 * κ, mul_ne_zero (by norm_num) hne, ?_⟩ push_cast rw [hβ] have e : ∀ n : ℤ, ((n : ℤ) : O) ∈ P.B := hI refine Submodule.add_mem _ (Submodule.sub_mem _ ?_ ?_) ?_ · exact hm (hm (by exact_mod_cast e 2) (e κ)) (e P.a) · exact hm hS (Submodule.add_mem _ (hm (by exact_mod_cast e 2) (e κ)) (Submodule.sub_mem _ (e _) (hm (e _) hθ))) · exact hm (hm (by exact_mod_cast e 2) (Submodule.sub_mem _ (e _) (hm (e _) hθ))) hα · obtain ⟨-, -, h, -, hne, -, -, hβ⟩ := P.lem_lambda_b hC refine ⟨4 * h, mul_ne_zero (by norm_num) hne, ?_⟩ push_cast rw [hβ] have e : ∀ n : ℤ, ((n : ℤ) : O) ∈ P.B := hI refine Submodule.add_mem _ (Submodule.sub_mem _ ?_ ?_) ?_ · exact hm (hm (by exact_mod_cast e 2) (e h)) (e P.a) · exact hm hS (Submodule.add_mem _ (hm (by exact_mod_cast e 2) (e h)) (Submodule.sub_mem _ (hm (e _) hθ) (hm (e _) (e _)))) · exact hm (hm (by exact_mod_cast e 2) (Submodule.sub_mem _ (hm (e _) hθ) (hm (e _) (e _)))) hα /-- N·A ⊆ B for some nonzero integer N. -/theorem exists_NA : ∃ N : ℤ, N ≠ 0 ∧ ∀ y ∈ M.A, (N : O) * y ∈ P.B := by obtain ⟨N, hN, hβ⟩ := P.exists_Nβ refine ⟨N, hN, fun y hy => ?_⟩ obtain ⟨b₁, h₁, b₂, h₂, rfl⟩ := P.lem_AB.mp hy rw [show (N : O) * (b₁ + b₂ * M.x 2) = N * b₁ + b₂ * (N * M.x 2) by ring] exact Submodule.add_mem _ (P.mul_mem_B (P.intCast_mem_B N) h₁) (P.mul_mem_B h₂ hβ) theorem Zα_le_B : Lat4 M.vpow ≤ Lat4 P.vB := by show Submodule.span ℤ (Set.range M.vpow) ≤ Submodule.span ℤ (Set.range P.vB) exact Submodule.span_le.mpr (Set.range_subset_iff.mpr P.vpow_mem_B) theorem B_le_Aadd : Lat4 P.vB ≤ M.A.toAddSubgroup := fun _ hy => P.B_le_A hy /-- thm:B: [A : ℤ[α]] = J·[A : B] (with [B : ℤ[α]] = J from lem:B). -/theorem index_A : (Lat4 M.vpow).relIndex M.A.toAddSubgroup = P.J.natAbs * (Lat4 P.vB).relIndex M.A.toAddSubgroup := by rw [← P.relIndex_B, AddSubgroup.relIndex_mul_relIndex _ _ _ P.Zα_le_B P.B_le_Aadd] /-- A as a ℤ-submodule of O. -/def Asub : Submodule ℤ O := M.A.toAddSubgroup.toIntSubmodule include P inopen Module in/-- A is free of rank 4: it has a family of four elements spanning it. -/theorem exists_basis_A : ∃ b : Fin 4 → O, ∀ y, y ∈ Submodule.span ℤ (Set.range b) ↔ y ∈ M.A := by obtain ⟨N, hN, hNA⟩ := P.exists_NA have hN' : (N : O) ≠ 0 := Int.cast_ne_zero.mpr hN let f : O →ₗ[ℤ] O := LinearMap.mulLeft ℤ (N : O) have hf : Function.Injective f := fun y y' h => mul_left_cancel₀ hN' h let A' := (Asub (M := M)).map f have hle : A' ≤ Submodule.span ℤ (Set.range P.vB) := by rintro _ ⟨y, hy, rfl⟩ exact hNA y hy obtain ⟨n, bA'⟩ := Submodule.basisOfPidOfLESpan P.linIndep_vB hle let e := Submodule.equivMapOfInjective f hf (Asub (M := M)) let bA : Basis (Fin n) ℤ (Asub (M := M)) := bA'.map e.symm -- n ≤ 4 let bB := Basis.span P.linIndep_vB have : Module.Finite ℤ (Submodule.span ℤ (Set.range P.vB)) := Module.Finite.of_basis bB have : Module.Finite ℤ A' := Module.Finite.of_basis bA' have hn4 : n ≤ 4 := by have hli : LinearIndependent ℤ (Submodule.inclusion hle ∘ bA') := bA'.linearIndependent.map' _ (Submodule.ker_inclusion _ _ hle) have := hli.fintype_card_le_finrank rw [finrank_eq_card_basis bB] at this simpa using this -- 4 ≤ n have h4n : 4 ≤ n := by have hmem : ∀ i, (N : O) * M.vpow i ∈ A' := fun i => ⟨M.vpow i, (show M.vpow i ∈ M.A from P.B_le_A (P.vpow_mem_B i)), rfl⟩ let g : Fin 4 → A' := fun i => ⟨(N : O) * M.vpow i, hmem i⟩ have hvpow : LinearIndependent ℤ M.vpow := M.linIndep_of_Dq (by rw [M.Dq_vpow]; exact M.Vand_ne) have hg : LinearIndependent ℤ g := by apply LinearIndependent.of_comp A'.subtype rw [Fintype.linearIndependent_iff] intro c hc i have hc' : ∑ j, (c j * N) • M.vpow j = 0 := by rw [← hc] refine Finset.sum_congr rfl fun j _ => ?_ simp only [Function.comp_apply, Submodule.subtype_apply, g, zsmul_eq_mul] push_cast; ring have := Fintype.linearIndependent_iff.mp hvpow _ hc' i exact (mul_eq_zero.mp this).resolve_right hN have := hg.fintype_card_le_finrank rw [finrank_eq_card_basis bA'] at this simpa using this have hn : n = 4 := le_antisymm hn4 h4n subst hn refine ⟨fun i => (bA i : O), fun y => ?_⟩ constructor · intro hy have hsp : Submodule.span ℤ (Set.range fun i => (bA i : O)) ≤ Asub (M := M) := by apply Submodule.span_le.mpr rintro _ ⟨i, rfl⟩ exact (bA i).2 exact hsp hy · intro hy have h := bA.sum_repr ⟨y, hy⟩ have h' := congrArg Subtype.val h simp only [Submodule.coe_sum, Submodule.coe_smul] at h' rw [← h'] exact Submodule.sum_mem _ fun i _ => Submodule.smul_mem _ _ (Submodule.subset_span ⟨i, rfl⟩) include P in/-- thm:B, the discriminant: for every family b of four elements spanning A, D(b) ≠ 0 (so b is a ℤ-basis), [A : ℤ[α]] ≠ 0, and disc A · [A : ℤ[α]]² = D_α, with disc A = D(b)² and D_α = Vand(x)² = disc(1, α, α², α³). -/theorem disc_A (b : Fin 4 → O) (hb : ∀ y, y ∈ Submodule.span ℤ (Set.range b) ↔ y ∈ M.A) : M.Dq b ≠ 0 ∧ (Lat4 M.vpow).relIndex M.A.toAddSubgroup ≠ 0 ∧ M.Dq b ^ 2 * (((Lat4 M.vpow).relIndex M.A.toAddSubgroup : ℕ) : O) ^ 2 = Vand M.x ^ 2 := by have hmem : ∀ l, M.vpow l ∈ Submodule.span ℤ (Set.range b) := fun l => (hb _).mpr (P.B_le_A (P.vpow_mem_B l)) choose c hc using fun l => (Submodule.mem_span_range_iff_exists_fun ℤ).mp (hmem l) have hD := M.Dq_comb b M.vpow (Matrix.of c) (fun l => by rw [← hc l]; simp [zsmul_eq_mul]) have hw : M.Dq M.vpow ≠ 0 := by rw [M.Dq_vpow]; exact M.Vand_ne have hbne : M.Dq b ≠ 0 := by intro h; apply hw; rw [hD, h, zero_mul] obtain ⟨C, hDC, hidx⟩ := M.relIndex_Dq hbne hw hmem have hLat : Lat4 b = M.A.toAddSubgroup := by ext y; exact hb y rw [hLat] at hidx have hCne : C.det ≠ 0 := by intro h; apply hw; rw [hDC, h, Int.cast_zero, mul_zero] refine ⟨hbne, by rw [hidx]; exact Int.natAbs_ne_zero.mpr hCne, ?_⟩ rw [hidx, ← M.Dq_vpow, hDC] have : ((C.det.natAbs : ℕ) : O) ^ 2 = ((C.det : ℤ) : O) ^ 2 := by rw [Nat.cast_natAbs, ← Int.cast_pow, sq_abs, Int.cast_pow] rw [this]; ring end Lam /-! ## Bridges from the existing models -/ namespace QuartData /-- From the C4 model of `IdentidadesNota` (α_k = σᵏα): x = (α, σ²α, σα, σ³α), τ = σ², ρ = σ. -/def ofC4 (C : Louboutin.Identidades.C4Data O) (hinj : Function.Injective C.x) : QuartData O where x := ![C.x 0, C.x 2, C.x 1, C.x 3] τ := C.σ.comp C.σ ρ := C.σ hτ := by obtain ⟨h0, h1, h2, h3⟩ := C.hσ simp [h0, h1, h2, h3] hρ := by obtain ⟨h0, h1, h2, h3⟩ := C.hσ simp [h0, h2] hρ2 := by obtain ⟨h0, h1, h2, h3⟩ := C.hσ right simp [h1, h3] fix := fun y _ _ h2 => C.fix y h2 inj := by have he : (![C.x 0, C.x 2, C.x 1, C.x 3] : Fin 4 → O) = C.x ∘ ![0, 2, 1, 3] := by ext i; fin_cases i <;> rfl rw [he] exact hinj.comp (by decide) /-- From the V4 model of `Conj61Model` (τ = τ₁, ρ = τ₂). On A = ℤ[x] the τ's compose as V₄ (`DiscV4.comp_of_mem`), so "fixed by τ₁, τ₂ ⇒ fixed by τ₃ ⇒ integer". -/def ofV4 (V : V4Data O) : QuartData O where x := V.x τ := V.τ₁ ρ := V.τ₂ hτ := V.h₁ hρ := ⟨V.h₂.1, V.h₂.2.1⟩ hρ2 := Or.inl ⟨V.h₂.2.2.1, V.h₂.2.2.2⟩ fix := fun y hy h1 h2 => by have hc := Louboutin.DiscV4.comp_of_mem V hy 1 2 have h3 : V.τ₃ y = y := by change V.τ₁ (V.τ₂ y) = V.τ₃ y at hc rw [← hc, h2, h1] exact V.fix y h1 h2 h3 inj := V.inj end QuartData /-! ## The statements -/ namespace Lam variable {M : QuartData O} (P : Lam M) /-- **lem:Lambda** (4.1). (S − ρS)² = δ₁, (S − ρS)(Q − ρQ) = δ₂, (Q − ρQ)² = δ₃; Λ = ℤ + ℤS + ℤQ equals ℤ + ℤη = ℤ[η] (a ring, of rank 2, inside E = K^⟨τ⟩), S = s₀ + n₁η, Q = s₁ + n₂η with gcd(n₁, n₂) = 1, (δ₁, δ₂, δ₃) = (n₁², n₁n₂, n₂²)·disc Λ with disc Λ = (η − ρη)², and |disc Λ| = gcd(δ₁, δ₂, δ₃). -/theorem lem_Lambda : ((M.S - M.S') ^ 2 = (P.δ₁ : O) ∧ (M.S - M.S') * (M.Q - M.Q') = (P.δ₂ : O) ∧ (M.Q - M.Q') ^ 2 = (P.δ₃ : O)) ∧ M.Λ = Submodule.span ℤ {1, P.η} ∧ (∀ y ∈ M.Λ, ∀ y' ∈ M.Λ, y * y' ∈ M.Λ) ∧ LinearIndependent ℤ ![1, P.η] ∧ (∀ y ∈ M.Λ, M.τ y = y) ∧ M.S = P.s₀ + P.n₁ * P.η ∧ M.Q = P.s₁ + P.n₂ * P.η ∧ IsCoprime P.n₁ P.n₂ ∧ (P.η - M.ρ P.η) ^ 2 = P.D ∧ (P.δ₁ = P.n₁ ^ 2 * P.D ∧ P.δ₂ = P.n₁ * P.n₂ * P.D ∧ P.δ₃ = P.n₂ ^ 2 * P.D) ∧ (Int.gcd P.δ₁ (Int.gcd P.δ₂ P.δ₃) : ℤ) = |P.D| := by obtain ⟨e1, e2, e3⟩ := P.δ_eq refine ⟨P.ident, P.Λ_eq, fun y hy y' hy' => P.mul_mem_Λ hy hy', P.linIndep_Λ, fun y hy => P.τ_Λ hy, P.hSη, P.hQη, P.isCoprime, ?_, P.δ_eq, ?_⟩ · simp only [η, M.ρeta]; exact P.hD · rw [e1, e2, e3]; exact gcd3 _ _ _ P.isCoprime /-- **lem:B** (4.2). B = Λ[α] = Λ + Λα has the ℤ-bases {1, η, α, ηα} and {1, α, α², ω₀}, it is the smallest subring containing Λ and α, and [B : ℤ[α]] = J = |R'(z)|/|disc Λ|. -/theorem lem_B : P.B = Submodule.span ℤ (Set.range P.vW) ∧ LinearIndependent ℤ P.vB ∧ LinearIndependent ℤ P.vW ∧ (∀ y, y ∈ P.B ↔ ∃ l₁ ∈ M.Λ, ∃ l₂ ∈ M.Λ, y = l₁ + l₂ * M.x 0) ∧ (∀ y ∈ P.B, ∀ y' ∈ P.B, y * y' ∈ P.B) ∧ (∀ R : Subring O, (∀ y ∈ M.Λ, y ∈ R) → M.x 0 ∈ R → ∀ y ∈ P.B, y ∈ R) ∧ P.J * P.D = P.R'z ∧ (Lat4 M.vpow).relIndex (Lat4 P.vB) = P.R'z.natAbs / P.D.natAbs := by refine ⟨P.B_eq_W, P.linIndep_vB, P.linIndep_vW, fun y => P.mem_B, fun y hy y' hy' => P.mul_mem_B hy hy', fun R hΛ hα y hy => P.B_le_subring R hΛ hα hy, P.J_mul_D, ?_⟩ rw [P.relIndex_B, P.J_natAbs] /-- **thm:B** (Theorem C of the note), the part that closes in the model: Λ is an order of E = K^⟨τ⟩ with |disc Λ| = gcd(a² − 4b + 4z, az − 2c, z² − 4d); B = Λ[α] has [B : ℤ[α]] = J = |R'(z)|/|disc Λ|; A = B + Bβ; [A : ℤ[α]] = J·[A : B] with [A : B] finite; A has a ℤ-basis of four elements, and for every such basis b, disc A = D(b)² satisfies disc A · [A : ℤ[α]]² = D_α. -/theorem thm_B : (∀ y ∈ M.Λ, ∀ y' ∈ M.Λ, y * y' ∈ M.Λ) ∧ (∀ y ∈ M.Λ, M.τ y = y) ∧ (Int.gcd P.δ₁ (Int.gcd P.δ₂ P.δ₃) : ℤ) = |P.D| ∧ (Lat4 M.vpow).relIndex (Lat4 P.vB) = P.R'z.natAbs / P.D.natAbs ∧ (∀ y, y ∈ M.A ↔ ∃ b₁ ∈ P.B, ∃ b₂ ∈ P.B, y = b₁ + b₂ * M.x 2) ∧ (Lat4 M.vpow).relIndex M.A.toAddSubgroup = (P.R'z.natAbs / P.D.natAbs) * (Lat4 P.vB).relIndex M.A.toAddSubgroup ∧ (Lat4 P.vB).relIndex M.A.toAddSubgroup ≠ 0 ∧ (∃ b : Fin 4 → O, ∀ y, y ∈ Submodule.span ℤ (Set.range b) ↔ y ∈ M.A) ∧ (∀ b : Fin 4 → O, (∀ y, y ∈ Submodule.span ℤ (Set.range b) ↔ y ∈ M.A) → M.Dq b ^ 2 * (((Lat4 M.vpow).relIndex M.A.toAddSubgroup : ℕ) : O) ^ 2 = Vand M.x ^ 2) := by obtain ⟨b, hb⟩ := P.exists_basis_A have hne := (P.disc_A b hb).2.1 refine ⟨fun y hy y' hy' => P.mul_mem_Λ hy hy', fun y hy => P.τ_Λ hy, (P.lem_Lambda).2.2.2.2.2.2.2.2.2.2, (P.lem_B).2.2.2.2.2.2.2, fun y => P.lem_AB, ?_, ?_, ⟨b, hb⟩, fun b' hb' => (P.disc_A b' hb').2.2⟩ · rw [← P.J_natAbs]; exact P.index_A · intro h; apply hne; rw [P.index_A, h, mul_zero] end Lam /-- The data of lem:Lambda exist in every model (in particular in `ofC4 C` and `ofV4 V`). -/theorem lam_nonempty (M : QuartData O) : Nonempty (Lam M) := M.exists_lam /-! ## Lattices in ℤ²: index = gcd of the 2 × 2 minors (Hermite form of a rank-2 lattice) -/ section lattice2 /-- the 2 × 2 minor det(u | v). -/def minor2 (u v : Fin 2 → ℤ) : ℤ := u 0 * v 1 - u 1 * v 0 variable {k : ℕ} (col : Fin k → Fin 2 → ℤ) /-- the lattice spanned by the columns. -/def Lam2 : Submodule ℤ (Fin 2 → ℤ) := Submodule.span ℤ (Set.range col)/-- gcd of all 2 × 2 minors of the columns. -/def Hm : ℤ := Finset.univ.gcd (fun p : Fin k × Fin k => minor2 (col p.1) (col p.2))/-- gcd of the second coordinates. -/def Gm : ℤ := Finset.univ.gcd (fun i => col i 1) theorem minor2_sum (a b : Fin k → ℤ) : minor2 (∑ i, a i • col i) (∑ j, b j • col j) = ∑ i, ∑ j, a i * b j * minor2 (col i) (col j) := by simp only [minor2, Finset.sum_apply, Pi.smul_apply, smul_eq_mul, Finset.sum_mul_sum, ← Finset.sum_sub_distrib] refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => by ring theorem Hm_dvd_minor2 {u v : Fin 2 → ℤ} (hu : u ∈ Lam2 col) (hv : v ∈ Lam2 col) : Hm col ∣ minor2 u v := by obtain ⟨a, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp hu obtain ⟨b, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp hv rw [minor2_sum] exact Finset.dvd_sum fun i _ => Finset.dvd_sum fun j _ => Dvd.dvd.mul_left (Finset.gcd_dvd (Finset.mem_univ (i, j))) _ theorem Gm_dvd {v : Fin 2 → ℤ} (hv : v ∈ Lam2 col) : Gm col ∣ v 1 := by obtain ⟨a, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp hv simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] exact Finset.dvd_sum fun i _ => Dvd.dvd.mul_left (Finset.gcd_dvd (Finset.mem_univ i)) _ theorem col_mem (i : Fin k) : col i ∈ Lam2 col := Submodule.subset_span ⟨i, rfl⟩ theorem Gm_ne (hH : Hm col ≠ 0) : Gm col ≠ 0 := by intro hG apply hH rw [Hm, Finset.gcd_eq_zero_iff] rintro ⟨i, j⟩ - have hi : col i 1 = 0 := by have := Gm_dvd col (col_mem col i); rw [hG] at this; exact zero_dvd_iff.mp this have hj : col j 1 = 0 := by have := Gm_dvd col (col_mem col j); rw [hG] at this; exact zero_dvd_iff.mp this simp [minor2, hi, hj] theorem Hm_nonneg : 0 ≤ Hm col := Int.nonneg_of_normalize_eq_self (Finset.normalize_gcd) theorem Gm_nonneg : 0 ≤ Gm col := Int.nonneg_of_normalize_eq_self (Finset.normalize_gcd) /-- Hermite form: Λ = ℤ(e, 0) + ℤ(x, G) with G = gcd of the second coordinates and e·G = ±H (H = gcd of the 2 × 2 minors). -/theorem hermite (hH : Hm col ≠ 0) : ∃ e x : ℤ, e ≠ 0 ∧ ![e, 0] ∈ Lam2 col ∧ ![x, Gm col] ∈ Lam2 col ∧ (∀ v ∈ Lam2 col, ∃ a b : ℤ, v = a • ![e, 0] + b • ![x, Gm col]) ∧ (e * Gm col).natAbs = (Hm col).natAbs := by obtain ⟨c, hc⟩ := Finset.gcd_eq_sum_mul Finset.univ (fun i => col i 1) set w : Fin 2 → ℤ := ∑ i, c i • col i with hw have hwmem : w ∈ Lam2 col := Submodule.sum_mem _ fun i _ => Submodule.smul_mem _ _ (col_mem col i) have hw1 : w 1 = Gm col := by rw [Gm, hc, hw]; simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] exact Finset.sum_congr rfl fun i _ => by ring -- the kernel ideal {t | (t, 0) ∈ Λ} let f : ℤ →ₗ[ℤ] (Fin 2 → ℤ) := LinearMap.single ℤ (fun _ => ℤ) 0 have hf : ∀ t : ℤ, f t = ![t, 0] := by intro t; ext i; fin_cases i <;> simp [f] let I : Submodule ℤ ℤ := (Lam2 col).comap f set e := Submodule.IsPrincipal.generator I with he have hI : ∀ t, ![t, 0] ∈ Lam2 col ↔ e ∣ t := by intro t rw [← hf t, ← Submodule.mem_comap] change t ∈ I ↔ _ rw [← Submodule.IsPrincipal.span_singleton_generator I, ← he, Ideal.mem_span_singleton'] exact ⟨fun ⟨a, ha⟩ => ⟨a, by rw [← ha, mul_comm]⟩, fun ⟨a, ha⟩ => ⟨a, by rw [ha, mul_comm]⟩⟩ have hemem : ![e, 0] ∈ Lam2 col := (hI e).mpr dvd_rfl -- a nonzero element of the kernel have hne : e ≠ 0 := by intro h0 apply hH rw [Hm, Finset.gcd_eq_zero_iff] rintro ⟨i, j⟩ - have hmem : ![minor2 (col i) (col j), 0] ∈ Lam2 col := by have : ![minor2 (col i) (col j), 0] = col j 1 • col i - col i 1 • col j := by ext l; fin_cases l <;> simp [minor2] <;> ring rw [this] exact Submodule.sub_mem _ (Submodule.smul_mem _ _ (col_mem col i)) (Submodule.smul_mem _ _ (col_mem col j)) have := (hI _).mp hmem rw [h0] at this exact zero_dvd_iff.mp this have hspan : ∀ v ∈ Lam2 col, ∃ a b : ℤ, v = a • ![e, 0] + b • ![w 0, Gm col] := by intro v hv obtain ⟨r, hr⟩ := Gm_dvd col hv have hk : v - r • w ∈ Lam2 col := Submodule.sub_mem _ hv (Submodule.smul_mem _ _ hwmem) have hk' : v - r • w = ![(v - r • w) 0, 0] := by ext l; fin_cases l · rfl · simp [hr, hw1, mul_comm] rw [hk'] at hk obtain ⟨s, hs⟩ := (hI _).mp hk refine ⟨s, r, ?_⟩ ext l; fin_cases l · have h0 : v 0 - r * w 0 = e * s := by simpa using hs simp; linear_combination h0 · simp [hr]; ring have hwmem' : ![w 0, Gm col] ∈ Lam2 col := by have : ![w 0, Gm col] = w := by ext l; fin_cases l <;> simp [hw1] rw [this]; exact hwmem refine ⟨e, w 0, hne, hemem, hwmem', hspan, ?_⟩ apply Int.natAbs_eq_iff_associated.mpr apply associated_of_dvd_dvd · apply Finset.dvd_gcd rintro ⟨i, j⟩ - obtain ⟨a, b, hab⟩ := hspan _ (col_mem col i) obtain ⟨a', b', hab'⟩ := hspan _ (col_mem col j) simp only rw [hab, hab'] exact ⟨a * b' - b * a', by simp [minor2]; ring⟩ · have := Hm_dvd_minor2 col hemem hwmem' simpa [minor2] using this end lattice2 /-! ## A ∩ V₁ = ℤ + ℤα (Lou20a Thm. 13, d₁ = 1), proved in the model -/ /-- A ∩ (ℚ + ℚα) = ℤ + ℤα (Lou20a Thm. 13, d₁ = 1), in the form: m·y ∈ ℤ + ℤα with m ≠ 0 and y ∈ A ⇒ y ∈ ℤ + ℤα. -/def QuartData.D1 (M : QuartData O) : Prop := ∀ y ∈ M.A, ∀ m r s : ℤ, m ≠ 0 → (m : O) * y = r + s * M.x 0 → ∃ r' s' : ℤ, y = r' + s' * M.x 0 namespace QuartData variable (M : QuartData O) theorem τ_x_mem (k : Fin 4) : M.τ (M.x k) ∈ M.A := by fin_cases k · simpa [M.hτ.1] using M.x_mem 1 · simpa [M.hτ.2.1] using M.x_mem 0 · simpa [M.hτ.2.2.1] using M.x_mem 3 · simpa [M.hτ.2.2.2] using M.x_mem 2 theorem ρ_x_mem (k : Fin 4) : M.ρ (M.x k) ∈ M.A := by rcases M.hρ2 with ⟨h2, h3⟩ | ⟨h2, h3⟩ <;> fin_cases k · simpa [M.hρ.1] using M.x_mem 2 · simpa [M.hρ.2] using M.x_mem 3 · simpa [h2] using M.x_mem 0 · simpa [h3] using M.x_mem 1 · simpa [M.hρ.1] using M.x_mem 2 · simpa [M.hρ.2] using M.x_mem 3 · simpa [h2] using M.x_mem 1 · simpa [h3] using M.x_mem 0 theorem map_mem (f : O →+* O) (hf : ∀ k, f (M.x k) ∈ M.A) {y : O} (hy : y ∈ M.A) : f y ∈ M.A := by have hle : M.A ≤ M.A.comap f := by apply Subring.closure_le.mpr rintro _ ⟨k, rfl⟩ exact hf k exact hle hy theorem γ_mem (i : Fin 4) {y : O} (hy : y ∈ M.A) : M.γ i y ∈ M.A := by fin_cases i · exact hy · exact M.map_mem M.τ M.τ_x_mem hy · exact M.map_mem M.ρ M.ρ_x_mem hy · exact M.map_mem M.ρ M.ρ_x_mem (M.map_mem M.τ M.τ_x_mem hy) end QuartData namespace Lam variable {M : QuartData O} (P : Lam M) include P in/-- A ⊄ ℤ + pA for every prime p (A/pA ≅ 𝔽_p⁴): via a ℤ-basis b of A, b = K b with K ≡ rank one (mod p), so 1 = det K ≡ 0 (mod p). -/theorem not_le_Zp {p : ℕ} (hp : p.Prime) : ¬ ∀ y ∈ M.A, ∃ n : ℤ, ∃ w ∈ M.A, y = n + p * w := by intro hall obtain ⟨b, hb⟩ := P.exists_basis_A have hbne := (P.disc_A b hb).1 choose n w hw hnw using fun i => hall (b i) ((hb _).mp (Submodule.subset_span ⟨i, rfl⟩)) choose c hc using fun i => (Submodule.mem_span_range_iff_exists_fun ℤ).mp ((hb _).mpr (hw i)) obtain ⟨u, hu⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp ((hb 1).mpr M.A.one_mem) set K : Matrix (Fin 4) (Fin 4) ℤ := Matrix.of fun i l => n i * u l + p * c i l with hKdef have hK : ∀ i, b i = ∑ l, (K i l : O) * b l := by intro i calc b i = n i * 1 + p * w i := by rw [hnw i, mul_one] _ = n i * (∑ l, u l • b l) + p * (∑ l, c i l • b l) := by rw [hu, hc i] _ = ∑ l, (K i l : O) * b l := by simp only [hKdef, Matrix.of_apply, Finset.mul_sum, ← Finset.sum_add_distrib, zsmul_eq_mul] refine Finset.sum_congr rfl fun l _ => by push_cast; ring have hD := M.Dq_comb b b K hK have hdet : K.det = 1 := by have h' : M.Dq b * (1 - (K.det : O)) = 0 := by linear_combination hD rcases mul_eq_zero.mp h' with h | h · exact absurd h hbne · exact_mod_cast (sub_eq_zero.mp h).symm have := Fact.mk hp have hmod : ((K.det : ℤ) : ZMod p) = 0 := by rw [det4] simp only [hKdef, Matrix.of_apply, det4e] push_cast rw [ZMod.natCast_self] ring rw [hdet, Int.cast_one] at hmod exact one_ne_zero hmod include P in/-- **A ∩ (ℚ + ℚα) = ℤ + ℤα** (d₁ = 1), the argument in the proof of thm:B. -/theorem d1 : M.D1 := by -- the statement for positive naturals, by strong induction have main : ∀ n : ℕ, ∀ y ∈ M.A, ∀ r s : ℤ, 0 < n → (n : O) * y = r + s * M.x 0 → ∃ r' s' : ℤ, y = r' + s' * M.x 0 := by intro n induction n using Nat.strong_induction_on with | _ n ih => intro y hy r s hn h by_cases hn1 : n = 1 · subst hn1; exact ⟨r, s, by simpa using h⟩ obtain ⟨p, hp, n', rfl⟩ := Nat.exists_prime_and_dvd hn1 have hn' : 0 < n' := Nat.pos_of_mul_pos_left hn have hp0 : (p : O) ≠ 0 := Nat.cast_ne_zero.mpr hp.ne_zero have hy' : (n' : O) * y ∈ M.A := M.A.mul_mem (natCast_mem _ _) hy have h' : (p : O) * ((n' : O) * y) = r + s * M.x 0 := by rw [← mul_assoc, ← Nat.cast_mul]; exact h by_cases hps : (p : ℤ) ∣ s · obtain ⟨s1, rfl⟩ := hps set w := (n' : O) * y - s1 * M.x 0 with hwdef have hwA : w ∈ M.A := M.A.sub_mem hy' (M.A.mul_mem (intCast_mem _ _) (M.x_mem 0)) have hpw : (p : O) * w = r := by rw [hwdef]; push_cast at h' ⊢; linear_combination h' have hfix : ∀ f : O →+* O, f w = w := by intro f apply mul_left_cancel₀ hp0 calc (p : O) * f w = f (p * w) := by rw [map_mul, map_natCast] _ = f r := by rw [hpw] _ = r := map_intCast _ _ _ = p * w := hpw.symm obtain ⟨r1, hr1⟩ := M.fix w hwA (hfix _) (hfix _) have hlt : n' < p * n' := by have := hp.two_le nlinarith exact ih n' hlt y hy r1 s1 hn' (by linear_combination hwdef.symm.trans hr1) · exfalso have hcop : IsCoprime s (p : ℤ) := by rw [Int.isCoprime_iff_gcd_eq_one, Int.gcd_comm] have : Nat.Coprime p s.natAbs := (Nat.Prime.coprime_iff_not_dvd hp).mpr (by intro hd; apply hps; exact Int.natCast_dvd.mpr hd) simpa [Int.gcd] using this obtain ⟨s', t, hst⟩ := hcop -- α = −s'r + p(s'·n'y + tα) set w0 := (s' : O) * ((n' : O) * y) + t * M.x 0 with hw0 have hw0A : w0 ∈ M.A := M.A.add_mem (M.A.mul_mem (intCast_mem _ _) hy') (M.A.mul_mem (intCast_mem _ _) (M.x_mem 0)) have hα : M.x 0 = ((-(s' * r) : ℤ) : O) + p * w0 := by have hst' : (s' : O) * s + t * p = 1 := by exact_mod_cast hst rw [hw0]; push_cast linear_combination (-(M.x 0)) * hst' - (s' : O) * h' apply P.not_le_Zp hp intro z hz induction hz using Subring.closure_induction with | mem x hx => obtain ⟨k, rfl⟩ := hx refine ⟨-(s' * r), M.γ k w0, M.γ_mem k hw0A, ?_⟩ rw [← M.γ_x0 k, hα, map_add, map_mul, map_intCast, map_natCast] | zero => exact ⟨0, 0, M.A.zero_mem, by simp⟩ | one => exact ⟨1, 0, M.A.zero_mem, by simp⟩ | add x y _ _ hx hy => obtain ⟨a, u, hu, rfl⟩ := hx obtain ⟨a', u', hu', rfl⟩ := hy exact ⟨a + a', u + u', M.A.add_mem hu hu', by push_cast; ring⟩ | neg x _ hx => obtain ⟨a, u, hu, rfl⟩ := hx exact ⟨-a, -u, M.A.neg_mem hu, by push_cast; ring⟩ | mul x y _ _ hx hy => obtain ⟨a, u, hu, rfl⟩ := hx obtain ⟨a', u', hu', rfl⟩ := hy refine ⟨a * a', a * u' + a' * u + p * u * u', M.A.add_mem (M.A.add_mem (M.A.mul_mem (intCast_mem _ _) hu') (M.A.mul_mem (intCast_mem _ _) hu)) (M.A.mul_mem (M.A.mul_mem (natCast_mem _ _) hu) hu'), ?_⟩ push_cast; ring intro y hy m r s hm h rcases lt_or_gt_of_ne hm with hlt | hgt · refine main m.natAbs y hy (-r) (-s) (Int.natAbs_pos.mpr hm) ?_ have : ((m.natAbs : ℕ) : O) = -(m : O) := by rw [Nat.cast_natAbs, abs_of_neg hlt, Int.cast_neg] rw [this]; push_cast; linear_combination -h · refine main m.natAbs y hy r s (Int.natAbs_pos.mpr hm) ?_ have : ((m.natAbs : ℕ) : O) = (m : O) := by rw [Nat.cast_natAbs, abs_of_pos hgt] rw [this]; exact h end Lam /-! ## thm:B, second half: the integers L, G, H (Definition def:LGH) -/ namespace Lam variable {M : QuartData O} (P : Lam M) /-- Definition def:LGH: L is a common denominator of the coordinates of β, αβ, ηβ, ηαβ in the basis {1, α, α², ω₀}: L·(β·vB_j) = Σ_i C_ji·vW_i with C integral. (The note takes the least one; the formulas hold for every common denominator.) -/structure LGH where L : ℤ hL : L ≠ 0 C : Fin 4 → Fin 4 → ℤ hC : ∀ j, (L : O) * (M.x 2 * P.vB j) = ∑ i, (C j i : O) * P.vW i /-- such data exist. -/theorem exists_LGH : Nonempty P.LGH := by obtain ⟨N, hN, hβ⟩ := P.exists_Nβ have hmem : ∀ j, (N : O) * (M.x 2 * P.vB j) ∈ Submodule.span ℤ (Set.range P.vW) := by intro j rw [← P.B_eq_W, ← mul_assoc] exact P.mul_mem_B hβ (Submodule.subset_span ⟨j, rfl⟩) choose C hC using fun j => (Submodule.mem_span_range_iff_exists_fun ℤ).mp (hmem j) exact ⟨⟨N, hN, C, fun j => by rw [← hC j]; simp [zsmul_eq_mul]⟩⟩ namespace LGH variable {P} (W : P.LGH) /-- the six columns of (L·I₂ | 𝖬). -/def col : Fin 6 → Fin 2 → ℤ := ![![W.L, 0], ![0, W.L], ![W.C 0 2, W.C 0 3], ![W.C 1 2, W.C 1 3], ![W.C 2 2, W.C 2 3], ![W.C 3 2, W.C 3 3]] /-- G = gcd(L, 𝖬₂₁, …, 𝖬₂₄). -/def G : ℤ := Gm W.col/-- H = gcd of the 2 × 2 minors of (L·I₂ | 𝖬). -/def H : ℤ := Hm W.col theorem H_ne : W.H ≠ 0 := by intro h rw [H, Hm, Finset.gcd_eq_zero_iff] at h have := h ((0 : Fin 6), (1 : Fin 6)) (Finset.mem_univ _) simp [col, minor2] at this exact W.hL this /-- every vector of ⟨columns⟩ lifts to A. -/theorem lift {v : Fin 2 → ℤ} (hv : v ∈ Lam2 W.col) : ∃ y ∈ M.A, ∃ r s : ℤ, (W.L : O) * y = r + s * M.x 0 + v 0 * M.x 0 ^ 2 + v 1 * P.ω₀ := by induction hv using Submodule.span_induction with | mem x hx => obtain ⟨i, rfl⟩ := hx have hβB : ∀ j, M.x 2 * P.vB j ∈ M.A := fun j => M.A.mul_mem (M.x_mem 2) (P.B_le_A (Submodule.subset_span ⟨j, rfl⟩)) have hj : ∀ j : Fin 4, (W.L : O) * (M.x 2 * P.vB j) = W.C j 0 + W.C j 1 * M.x 0 + W.C j 2 * M.x 0 ^ 2 + W.C j 3 * P.ω₀ := by intro j; rw [W.hC j]; simp [Fin.sum_univ_four, vW] fin_cases i · exact ⟨M.x 0 ^ 2, pow_mem (M.x_mem 0) 2, 0, 0, by simp [col]⟩ · exact ⟨P.ω₀, P.B_le_A (P.vW_mem_B 3), 0, 0, by simp [col]⟩ · exact ⟨_, hβB 0, W.C 0 0, W.C 0 1, by rw [hj 0]; simp [col]⟩ · exact ⟨_, hβB 1, W.C 1 0, W.C 1 1, by rw [hj 1]; simp [col]⟩ · exact ⟨_, hβB 2, W.C 2 0, W.C 2 1, by rw [hj 2]; simp [col]⟩ · exact ⟨_, hβB 3, W.C 3 0, W.C 3 1, by rw [hj 3]; simp [col]⟩ | zero => exact ⟨0, M.A.zero_mem, 0, 0, by simp⟩ | add x y _ _ hx hy => obtain ⟨u, hu, r, s, h⟩ := hx obtain ⟨u', hu', r', s', h'⟩ := hy refine ⟨u + u', M.A.add_mem hu hu', r + r', s + s', ?_⟩ simp only [Pi.add_apply]; push_cast; linear_combination h + h' | smul a x _ hx => obtain ⟨u, hu, r, s, h⟩ := hx refine ⟨a * u, M.A.mul_mem (intCast_mem _ _) hu, a * r, a * s, ?_⟩ simp only [Pi.smul_apply, smul_eq_mul]; push_cast; linear_combination (a : O) * h /-- every element of A has (α², ω₀)-coordinates (times L) in ⟨columns⟩. -/theorem coords {y : O} (hy : y ∈ M.A) : ∃ r s : ℤ, ∃ v ∈ Lam2 W.col, (W.L : O) * y = r + s * M.x 0 + v 0 * M.x 0 ^ 2 + v 1 * P.ω₀ := by obtain ⟨b₁, h₁, b₂, h₂, rfl⟩ := P.lem_AB.mp hy rw [P.B_eq_W] at h₁ obtain ⟨d, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp h₁ obtain ⟨c, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp h₂ have hc := fun j => W.hC j simp only [Fin.sum_univ_four, vW, vB] at hc refine ⟨W.L * d 0 + ∑ j, c j * W.C j 0, W.L * d 1 + ∑ j, c j * W.C j 1, d 2 • W.col 0 + d 3 • W.col 1 + ∑ j : Fin 4, c j • W.col (j.succ.succ), ?_, ?_⟩ · refine Submodule.add_mem _ (Submodule.add_mem _ (Submodule.smul_mem _ _ (col_mem _ 0)) (Submodule.smul_mem _ _ (col_mem _ 1))) (Submodule.sum_mem _ fun j _ => Submodule.smul_mem _ _ (col_mem _ _)) · simp only [Fin.sum_univ_four, vW, vB, zsmul_eq_mul, Pi.add_apply] simp [col] have h0 := hc 0 have h1 := hc 1 have h2 := hc 2 have h3 := hc 3 simp at h0 h1 h2 h3 linear_combination (c 0 : O) * h0 + (c 1 : O) * h1 + (c 2 : O) * h2 + (c 3 : O) * h3 /-- thm:B: [A : B] = L²/H, in the form [A : B]·H = L², given A ∩ (ℚ + ℚα) = ℤ + ℤα (`D1`). -/theorem index_AB (hd1 : M.D1) : (Lat4 P.vB).relIndex M.A.toAddSubgroup * W.H.natAbs = (W.L ^ 2).natAbs := by obtain ⟨e, x, hne, hem, hxm, hspan, heg⟩ := hermite W.col W.H_ne obtain ⟨y2, hy2, r2, s2, h2⟩ := W.lift hem obtain ⟨y3, hy3, r3, s3, h3⟩ := W.lift hxm simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Int.cast_zero, zero_mul, add_zero] at h2 h3 set fam : Fin 4 → O := ![1, M.x 0, y2, y3] with hfam -- fam spans A have hfamA : ∀ y, y ∈ Submodule.span ℤ (Set.range fam) ↔ y ∈ M.A := by intro y constructor · intro hy have hle : Submodule.span ℤ (Set.range fam) ≤ Lam.Asub (M := M) := by apply Submodule.span_le.mpr rintro _ ⟨i, rfl⟩ fin_cases i · exact M.A.one_mem · exact M.x_mem 0 · exact hy2 · exact hy3 exact hle hy · intro hy obtain ⟨r, s, v, hv, hL⟩ := W.coords hy obtain ⟨a, b, rfl⟩ := hspan v hv simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Matrix.cons_val_zero, Matrix.cons_val_one, mul_zero, zero_add] at hL have hyA : y - a * y2 - b * y3 ∈ M.A := M.A.sub_mem (M.A.sub_mem hy (M.A.mul_mem (intCast_mem _ _) hy2)) (M.A.mul_mem (intCast_mem _ _) hy3) obtain ⟨r', s', hrs⟩ := hd1 _ hyA W.L (r - a * r2 - b * r3) (s - a * s2 - b * s3) W.hL (by push_cast at hL ⊢; linear_combination hL - (a : O) * h2 - (b : O) * h3) rw [Submodule.mem_span_range_iff_exists_fun] refine ⟨![r', s', a, b], ?_⟩ simp [Fin.sum_univ_four, hfam, zsmul_eq_mul] linear_combination -hrs -- determinants set K : Matrix (Fin 4) (Fin 4) ℤ := !![W.L, 0, 0, 0; 0, W.L, 0, 0; r2, s2, e, 0; r3, s3, x, Gm W.col] with hKdef have hK : ∀ l, (fun i => (W.L : O) * fam i) l = ∑ k, (K l k : O) * P.vW k := by intro l fin_cases l <;> simp [hKdef, hfam, Fin.sum_univ_four, vW] · rw [h2] · rw [h3] have hdetK : K.det = W.L * W.L * e * Gm W.col := by rw [hKdef, det4]; simp [det4e]; ring set Dg : Matrix (Fin 4) (Fin 4) ℤ := !![W.L, 0, 0, 0; 0, W.L, 0, 0; 0, 0, W.L, 0; 0, 0, 0, W.L] with hDgdef have hDg : ∀ l, (fun i => (W.L : O) * fam i) l = ∑ k, (Dg l k : O) * fam k := by intro l fin_cases l <;> simp [hDgdef, Fin.sum_univ_four] have hdetDg : Dg.det = W.L ^ 4 := by rw [hDgdef, det4]; simp [det4e]; ring have e1 := M.Dq_comb P.vW _ K hK have e2 := M.Dq_comb fam _ Dg hDg rw [hdetK] at e1 rw [hdetDg] at e2 have hvW : M.Dq P.vW ≠ 0 := by rw [P.Dq_vW]; exact P.Dq_vB_ne have hL' : (W.L : O) ≠ 0 := Int.cast_ne_zero.mpr W.hL have hfam_ne : M.Dq fam ≠ 0 := by intro h0 rw [h0, zero_mul] at e2 rw [e2] at e1 have hG : Gm W.col ≠ 0 := Gm_ne W.col W.H_ne have : ((W.L * W.L * e * Gm W.col : ℤ) : O) ≠ 0 := Int.cast_ne_zero.mpr (mul_ne_zero (mul_ne_zero (mul_ne_zero W.hL W.hL) hne) hG) exact (mul_ne_zero hvW this) e1.symm obtain ⟨C', hDC, hidx⟩ := M.relIndex_Dq hfam_ne hvW (fun l => (hfamA _).mpr (P.B_le_A (P.vW_mem_B l))) have hLatW : Lat4 P.vW = Lat4 P.vB := by show (Submodule.span ℤ (Set.range P.vW)).toAddSubgroup = (Submodule.span ℤ (Set.range P.vB)).toAddSubgroup rw [← P.B_eq_W]; rfl have hLatF : Lat4 fam = M.A.toAddSubgroup := by ext y; exact hfamA y rw [hLatW, hLatF] at hidx rw [hidx] -- L² = det C' · e · G have key : ((W.L ^ 2 : ℤ) : O) = ((C'.det * (e * Gm W.col) : ℤ) : O) := by have h := e2.symm.trans e1 rw [hDC] at h have h' : M.Dq fam * ((W.L : O) ^ 2 * (W.L ^ 2 - C'.det * (e * Gm W.col))) = 0 := by push_cast at h ⊢; linear_combination h rcases mul_eq_zero.mp h' with h0 | h0 · exact absurd h0 hfam_ne · rcases mul_eq_zero.mp h0 with h1 | h1 · exact absurd (pow_eq_zero_iff two_ne_zero |>.mp h1) hL' · simp only [Int.cast_pow, Int.cast_mul]; linear_combination h1 have key' := Int.cast_injective key rw [key', Int.natAbs_mul, heg, H] /-- **thm:B**, the formulas in L, H: [A : B] = L²/H, [A : ℤ[α]] = JL²/H and disc A = D_α (H/(JL²))² (for every ℤ-basis b of A, disc A = D(b)²), in integral form. -/theorem thm_B_LGH : 0 < W.H ∧ (Lat4 P.vB).relIndex M.A.toAddSubgroup * W.H.natAbs = (W.L ^ 2).natAbs ∧ (Lat4 P.vB).relIndex M.A.toAddSubgroup = (W.L ^ 2).natAbs / W.H.natAbs ∧ (Lat4 M.vpow).relIndex M.A.toAddSubgroup * W.H.natAbs = P.J.natAbs * (W.L ^ 2).natAbs ∧ (∀ b : Fin 4 → O, (∀ y, y ∈ Submodule.span ℤ (Set.range b) ↔ y ∈ M.A) → M.Dq b ^ 2 * ((P.J : O) * (W.L : O) ^ 2) ^ 2 = Vand M.x ^ 2 * (W.H : O) ^ 2) := by have h1 := W.index_AB P.d1 have hHpos : 0 < W.H := lt_of_le_of_ne (Hm_nonneg W.col) (Ne.symm W.H_ne) have hH0 : 0 < W.H.natAbs := Int.natAbs_pos.mpr W.H_ne have h3 : (Lat4 M.vpow).relIndex M.A.toAddSubgroup * W.H.natAbs = P.J.natAbs * (W.L ^ 2).natAbs := by rw [P.index_A, mul_assoc, h1] refine ⟨hHpos, h1, (Nat.div_eq_of_eq_mul_left hH0 h1.symm).symm, h3, fun b hb => ?_⟩ have hd := (P.disc_A b hb).2.2 have hc : (((Lat4 M.vpow).relIndex M.A.toAddSubgroup : ℕ) : O) * ((W.H.natAbs : ℕ) : O) = ((P.J.natAbs : ℕ) : O) * (((W.L ^ 2).natAbs : ℕ) : O) := by exact_mod_cast h3 have sq : ∀ n : ℤ, ((n.natAbs : ℕ) : O) ^ 2 = (n : O) ^ 2 := fun n => by rw [Nat.cast_natAbs, ← Int.cast_pow, sq_abs, Int.cast_pow] have hc2 := congrArg (· ^ 2) hc simp only [mul_pow, sq] at hc2 rw [← hd] push_cast at hc2 linear_combination -(M.Dq b) ^ 2 * hc2 /-- **thm:B**, d₂ = LG/H in basis form: there is y₂ ∈ A with A ∩ V₂ = ℤ + ℤα + ℤy₂ and α² ≡ a·y₂ (mod ℤ + ℤα) with |a|·H = |LG|; hence L₂ = ℤ + ℤα + ℤα² = ℤ + ℤα + ℤ(a y₂) has index |a| = LG/H in A ∩ V₂ (V₂ = ℚ + ℚα + ℚα²). -/theorem d2_form : ∃ y₂ ∈ M.A, ∃ a : ℤ, a.natAbs * W.H.natAbs = (W.L * W.G).natAbs ∧ (∃ r s : ℤ, M.x 0 ^ 2 = r + s * M.x 0 + a * y₂) ∧ (∀ y : O, (y ∈ M.A ∧ ∃ m c₀ c₁ c₂ : ℤ, m ≠ 0 ∧ (m : O) * y = c₀ + c₁ * M.x 0 + c₂ * M.x 0 ^ 2) ↔ ∃ p q t : ℤ, y = p + q * M.x 0 + t * y₂) := by obtain ⟨e, x, hne, hem, hxm, hspan, heg⟩ := hermite W.col W.H_ne obtain ⟨y2, hy2, r2, s2, h2⟩ := W.lift hem simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Int.cast_zero, zero_mul, add_zero] at h2 have hG : Gm W.col ≠ 0 := Gm_ne W.col W.H_ne have hd1 := P.d1 obtain ⟨a, b, hab⟩ := hspan _ (col_mem W.col 0) have hab0 := congrFun hab 0 have hab1 := congrFun hab 1 simp [col] at hab0 hab1 have hb : b = 0 := by rcases hab1 with h | h · exact h · exact absurd h hG subst hb simp at hab0 -- hab0 : W.L = a * e refine ⟨y2, hy2, a, ?_, ?_, ?_⟩ · rw [H, ← heg, G, hab0] simp only [Int.natAbs_mul]; ring · have hyA : M.x 0 ^ 2 - a * y2 ∈ M.A := M.A.sub_mem (pow_mem (M.x_mem 0) 2) (M.A.mul_mem (intCast_mem _ _) hy2) obtain ⟨r', s', hrs⟩ := hd1 _ hyA W.L (-(a * r2)) (-(a * s2)) W.hL (by have hL0 : (W.L : O) = a * e := by exact_mod_cast hab0 push_cast; linear_combination (-(a : O)) * h2 + (M.x 0) ^ 2 * hL0) exact ⟨r', s', by linear_combination hrs⟩ · intro y constructor · rintro ⟨hy, m, c₀, c₁, c₂, hm, hmy⟩ obtain ⟨r, s, v, hv, hL⟩ := W.coords hy obtain ⟨a1, b1, rfl⟩ := hspan v hv simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Matrix.cons_val_zero, Matrix.cons_val_one, mul_zero, zero_add] at hL -- the ω₀-coordinate m·b₁G vanishes (independence of {1, α, α², ω₀}) have hsum : ∑ i, (![m * r - W.L * c₀, m * s - W.L * c₁, m * (a1 * e + b1 * x) - W.L * c₂, m * (b1 * Gm W.col)] i) • P.vW i = 0 := by simp only [Fin.sum_univ_four, vW, zsmul_eq_mul] simp push_cast at hL linear_combination -(m : O) * hL + (W.L : O) * hmy have h3 := Fintype.linearIndependent_iff.mp P.linIndep_vW _ hsum 3 simp at h3 have hb1 : b1 = 0 := by rcases h3 with h | h | h · exact absurd h hm · exact h · exact absurd h hG subst hb1 have hyA : y - a1 * y2 ∈ M.A := M.A.sub_mem hy (M.A.mul_mem (intCast_mem _ _) hy2) obtain ⟨p, q, hpq⟩ := hd1 _ hyA W.L (r - a1 * r2) (s - a1 * s2) W.hL (by push_cast at hL ⊢; linear_combination hL - (a1 : O) * h2) exact ⟨p, q, a1, by linear_combination hpq⟩ · rintro ⟨p, q, t, rfl⟩ refine ⟨M.A.add_mem (M.A.add_mem (intCast_mem _ _) (M.A.mul_mem (intCast_mem _ _) (M.x_mem 0))) (M.A.mul_mem (intCast_mem _ _) hy2), W.L, W.L * p + t * r2, W.L * q + t * s2, t * e, W.hL, ?_⟩ push_cast linear_combination (t : O) * h2 end LGH /-- such L-data exist, and with them thm:B holds in full (up to the elementary divisors). -/theorem thm_B_LGH_exists : ∃ W : P.LGH, 0 < W.H ∧ (Lat4 P.vB).relIndex M.A.toAddSubgroup = (W.L ^ 2).natAbs / W.H.natAbs ∧ (Lat4 M.vpow).relIndex M.A.toAddSubgroup * W.H.natAbs = P.J.natAbs * (W.L ^ 2).natAbs := by obtain ⟨W⟩ := P.exists_LGH obtain ⟨h0, -, h2, h3, -⟩ := W.thm_B_LGH exact ⟨W, h0, h2, h3⟩ /-! ## Coordinates in the power basis (A → ℚ⁴) and the elementary divisors, with prop:triang as hypothesis (`Triang`, as in `T1Completo` and `DiscV4`) -/ section coords include P theorem linIndep_vpow : LinearIndependent ℤ M.vpow := M.linIndep_of_Dq (by rw [M.Dq_vpow]; exact M.Vand_ne) theorem sum_const (a : ℤ) (c : Fin 4 → ℤ) : ∑ k, ((a * c k : ℤ) : O) * M.vpow k = (a : O) * ∑ k, (c k : O) * M.vpow k := by rw [Finset.mul_sum]; push_cast; exact Finset.sum_congr rfl fun k _ => by ring open Classical in/-- integer coordinates in the power basis 1, α, α², α³ (0 outside ℤ[α]). -/noncomputable def cZ (z : O) : Fin 4 → ℤ := if h : z ∈ Submodule.span ℤ (Set.range M.vpow) then (Module.Basis.span P.linIndep_vpow).equivFun ⟨z, h⟩ else 0 theorem cZ_spec {z : O} (h : z ∈ Submodule.span ℤ (Set.range M.vpow)) : z = ∑ k, (P.cZ z k : O) * M.vpow k := by have e := congrArg Subtype.val ((Module.Basis.span P.linIndep_vpow).sum_equivFun ⟨z, h⟩) simp only [Submodule.coe_sum, Submodule.coe_smul, Module.Basis.span_apply] at e rw [cZ, dite_eq_left h] conv_lhs => rw [← e] simp [zsmul_eq_mul] theorem cZ_unique {z : O} (c : Fin 4 → ℤ) (hc : z = ∑ k, (c k : O) * M.vpow k) : P.cZ z = c := by have hz : z ∈ Submodule.span ℤ (Set.range M.vpow) := by rw [hc] exact Submodule.sum_mem _ fun k _ => by rw [← zsmul_eq_mul]; exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨k, rfl⟩) have h1 := P.cZ_spec hz have h0 : ∑ k, (P.cZ z k - c k) • M.vpow k = 0 := by simp only [sub_smul, Finset.sum_sub_distrib, zsmul_eq_mul] rw [← h1, ← hc, sub_self] funext k exact sub_eq_zero.mp (Fintype.linearIndependent_iff.mp P.linIndep_vpow _ h0 k) /-- I = [A : ℤ[α]]. -/noncomputable def I (_P : Lam M) : ℕ := (Lat4 M.vpow).relIndex M.A.toAddSubgroup theorem I_ne : P.I ≠ 0 := by obtain ⟨b, hb⟩ := P.exists_basis_A exact (P.disc_A b hb).2.1 theorem I_mem (y : M.A.toAddSubgroup) : (P.I : O) * y ∈ Submodule.span ℤ (Set.range M.vpow) := by have h := AddSubgroup.nsmul_relIndex_mem (Lat4 M.vpow) y.2 rw [nsmul_eq_mul] at h exact h /-- φ : A → ℚ⁴, the coordinates in the basis 1, α, α², α³. -/noncomputable def φ : M.A.toAddSubgroup →+ (Fin 4 → ℚ) where toFun y := fun k => (P.cZ ((P.I : O) * y) k : ℚ) / P.I map_zero' := by funext k have : P.cZ (0 : O) = 0 := P.cZ_unique 0 (by simp) simp [this] map_add' y y' := by funext k have h := P.cZ_unique (z := (P.I : O) * ((y + y' : M.A.toAddSubgroup) : O)) (P.cZ ((P.I : O) * y) + P.cZ ((P.I : O) * y')) (by have e1 := P.cZ_spec (P.I_mem y) have e2 := P.cZ_spec (P.I_mem y') simp only [AddSubgroup.coe_add, Pi.add_apply, Int.cast_add, add_mul, Finset.sum_add_distrib] linear_combination e1 + e2) simp only [Pi.add_apply] rw [h, Pi.add_apply, Int.cast_add, add_div] theorem φ_spec (y : M.A.toAddSubgroup) {m : ℤ} (hm : m ≠ 0) (c : Fin 4 → ℤ) (h : (m : O) * y = ∑ k, (c k : O) * M.vpow k) : P.φ y = fun k => (c k : ℚ) / m := by have e1 := P.cZ_spec (P.I_mem y) have hA := P.cZ_unique (z := (m : O) * ((P.I : O) * y)) (fun k => m * P.cZ ((P.I : O) * y) k) (by rw [P.sum_const]; linear_combination (m : O) * e1) have hB := P.cZ_unique (z := (m : O) * ((P.I : O) * y)) (fun k => (P.I : ℤ) * c k) (by rw [P.sum_const]; push_cast; linear_combination (P.I : O) * h) have hk := fun k => congrFun (hA.symm.trans hB) k funext k have hI : (P.I : ℚ) ≠ 0 := Nat.cast_ne_zero.mpr P.I_ne have hm' : (m : ℚ) ≠ 0 := Int.cast_ne_zero.mpr hm have := hk k show (P.cZ ((P.I : O) * y) k : ℚ) / P.I = c k / m rw [div_eq_div_iff hI hm'] have : ((m * P.cZ ((P.I : O) * y) k : ℤ) : ℚ) = (((P.I : ℤ) * c k : ℤ) : ℚ) := by rw [this] push_cast at this linear_combination this theorem φ_injective : Function.Injective P.φ := by rw [injective_iff_map_eq_zero] intro y hy have hc : P.cZ ((P.I : O) * y) = 0 := by funext k have := congrFun hy k change (P.cZ ((P.I : O) * y) k : ℚ) / P.I = 0 at this rw [div_eq_zero_iff] at this rcases this with h | h · exact_mod_cast h · exact absurd h (Nat.cast_ne_zero.mpr P.I_ne) have e := P.cZ_spec (P.I_mem y) rw [hc] at e simp only [Pi.zero_apply, Int.cast_zero, zero_mul, Finset.sum_const_zero] at e have hI : (P.I : O) ≠ 0 := Nat.cast_ne_zero.mpr P.I_ne apply Subtype.ext exact (mul_eq_zero.mp e).resolve_left hI theorem vsum_mem_A (c : Fin 4 → ℤ) : ∑ k, (c k : O) * M.vpow k ∈ M.A := P.B_le_A (Submodule.sum_mem _ fun k _ => by rw [← zsmul_eq_mul]; exact Submodule.smul_mem _ _ (P.vpow_mem_B k)) /-- inverse of `φ_spec`. -/theorem φ_inv (y : M.A.toAddSubgroup) {m : ℤ} (hm : m ≠ 0) (c : Fin 4 → ℤ) (h : P.φ y = fun k => (c k : ℚ) / m) : (m : O) * y = ∑ k, (c k : O) * M.vpow k := by let z : M.A.toAddSubgroup := ⟨_, P.vsum_mem_A c⟩ have hz : P.φ z = fun k => (c k : ℚ) / 1 := P.φ_spec z one_ne_zero c (by simp [z]) have hmy : P.φ (m • y) = P.φ z := by rw [map_zsmul, h, hz] funext k simp only [Pi.smul_apply, zsmul_eq_mul, div_one] field_simp have := congrArg Subtype.val (P.φ_injective hmy) simpa [z, zsmul_eq_mul] using this /-- φ(A) ⊆ ℚ⁴. -/noncomputable def MQ : AddSubgroup (Fin 4 → ℚ) := P.φ.range /-- A ≃ φ(A). -/noncomputable def φequiv : M.A.toAddSubgroup ≃+ P.MQ := AddMonoidHom.ofInjective P.φ_injective theorem map_Zα : ((Lat4 M.vpow).addSubgroupOf M.A.toAddSubgroup).map (P.φequiv : M.A.toAddSubgroup →+ P.MQ) = Louboutin.Z4.addSubgroupOf P.MQ := by ext x rw [AddSubgroup.mem_map, AddSubgroup.mem_addSubgroupOf] constructor · rintro ⟨y, hy, rfl⟩ rw [AddSubgroup.mem_addSubgroupOf] at hy obtain ⟨c, hc⟩ := (Submodule.mem_span_range_iff_exists_fun ℤ).mp hy have := P.φ_spec y one_ne_zero c (by rw [← hc]; simp [zsmul_eq_mul]) change P.φ y ∈ Louboutin.Z4 rw [this] intro i exact ⟨c i, by simp⟩ · intro hx choose c hc using hx refine ⟨P.φequiv.symm x, ?_, P.φequiv.apply_symm_apply x⟩ rw [AddSubgroup.mem_addSubgroupOf] have hφ : P.φ (P.φequiv.symm x) = fun k => (c k : ℚ) / ((1 : ℤ) : ℚ) := by have : (P.φ (P.φequiv.symm x) : Fin 4 → ℚ) = x := by rw [← AddMonoidHom.ofInjective_apply P.φ_injective] exact congrArg Subtype.val (P.φequiv.apply_symm_apply x) rw [this]; funext k; simp [hc k] have h := P.φ_inv _ one_ne_zero c hφ simp only [Int.cast_one, one_mul] at h show ((P.φequiv.symm x : M.A.toAddSubgroup) : O) ∈ Submodule.span ℤ (Set.range M.vpow) rw [h] exact Submodule.sum_mem _ fun k _ => by rw [← zsmul_eq_mul]; exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨k, rfl⟩) /-- A/ℤ[α] ≃ φ(A)/ℤ⁴. -/noncomputable def quotEquiv : (M.A.toAddSubgroup ⧸ (Lat4 M.vpow).addSubgroupOf M.A.toAddSubgroup) ≃+ (P.MQ ⧸ Louboutin.Z4.addSubgroupOf P.MQ) := QuotientAddGroup.congr _ _ P.φequiv P.map_Zα theorem index_Z4 : (Louboutin.Z4.addSubgroupOf P.MQ).index = P.I := by rw [AddSubgroup.index, ← Nat.card_congr P.quotEquiv.toEquiv] rfl theorem φ_mem (y : M.A.toAddSubgroup) : P.φ y ∈ P.MQ := ⟨y, rfl⟩ /-- prop:triang (hypothesis) forces d₁ = 1 (via `d1`). -/theorem triang_d1 (T : Louboutin.Triang P.MQ) : T.d₁ = 1 := by obtain ⟨y, hy⟩ := T.ω₁_mem have hd : ((T.d₁ : ℤ) : ℚ) ≠ 0 := by exact_mod_cast T.d₁_pos.ne' have h1 : P.φ y = fun k => ((![T.p₁₀, 1, 0, 0] : Fin 4 → ℤ) k : ℚ) / ((T.d₁ : ℤ) : ℚ) := by rw [hy]; funext k; fin_cases k <;> simp [Louboutin.omega1] have e := P.φ_inv y (by exact_mod_cast T.d₁_pos.ne') _ h1 simp [Fin.sum_univ_four, QuartData.vpow] at e obtain ⟨r', s', hrs⟩ := P.d1 y y.2 T.d₁ T.p₁₀ 1 (by exact_mod_cast T.d₁_pos.ne') (by simpa using e) have h2 : P.φ y = fun k => ((![r', s', 0, 0] : Fin 4 → ℤ) k : ℚ) / ((1 : ℤ) : ℚ) := P.φ_spec y one_ne_zero _ (by simp [Fin.sum_univ_four, QuartData.vpow, hrs]) have h3 := congrFun (h1.symm.trans h2) 1 simp at h3 -- 1/d₁ = s' have h4 : (T.d₁ : ℤ) * s' = 1 := by have hq : ((T.d₁ : ℤ) : ℚ) * s' = 1 := by push_cast; rw [← h3]; exact mul_inv_cancel₀ (by exact_mod_cast T.d₁_pos.ne') exact_mod_cast hq have := Int.eq_one_of_mul_eq_one_right (by positivity) h4 exact_mod_cast this end coords end Lam namespace Lam.LGH variable {M : QuartData O} {P : Lam M} (W : P.LGH) /-- d₂ = LG/H, with prop:triang as hypothesis. -/theorem triang_d2 (T : Louboutin.Triang P.MQ) : T.d₂ * W.H.natAbs = (W.L * W.G).natAbs := by obtain ⟨y₂, hy₂, a, haH, ⟨r, s, hα⟩, hV2⟩ := W.d2_form have hH0 : W.H.natAbs ≠ 0 := Int.natAbs_ne_zero.mpr W.H_ne have hG0 : W.G ≠ 0 := Gm_ne W.col W.H_ne have ha0 : a ≠ 0 := by rintro rfl simp at haH exact (mul_ne_zero W.hL hG0) (Int.natAbs_eq_zero.mp haH.symm) let Y2 : M.A.toAddSubgroup := ⟨y₂, hy₂⟩ -- φ(y₂) = (−r, −s, 1, 0)/a have hY2 : P.φ Y2 = fun k => ((![-r, -s, 1, 0] : Fin 4 → ℤ) k : ℚ) / a := P.φ_spec Y2 ha0 _ (by simp [Y2, Fin.sum_univ_four, QuartData.vpow]; linear_combination -hα) have hd2 : ((T.d₂ : ℤ) : ℚ) ≠ 0 := by exact_mod_cast T.d₂_pos.ne' -- d₂ ∣ a: the preimage y of ω₂ have hdvd1 : (T.d₂ : ℤ) ∣ a := by obtain ⟨y, hy⟩ := T.ω₂_mem have h1 : P.φ y = fun k => ((![T.p₂₀, T.p₂₁, 1, 0] : Fin 4 → ℤ) k : ℚ) / ((T.d₂ : ℤ) : ℚ) := by rw [hy]; funext k; fin_cases k <;> simp [Louboutin.omega2] have e := P.φ_inv y (by exact_mod_cast T.d₂_pos.ne') _ h1 simp [Fin.sum_univ_four, QuartData.vpow] at e obtain ⟨p, q, t, hpqt⟩ := (hV2 y).mp ⟨y.2, T.d₂, T.p₂₀, T.p₂₁, 1, by exact_mod_cast T.d₂_pos.ne', by simpa using e⟩ have h2 : P.φ y = fun k => ((![a * p - t * r, a * q - t * s, t, 0] : Fin 4 → ℤ) k : ℚ) / a := P.φ_spec y ha0 _ (by simp [Fin.sum_univ_four, QuartData.vpow]; rw [hpqt]; linear_combination (-(t : O)) * hα) have h3 := congrFun (h1.symm.trans h2) 2 simp at h3 have h4 : (a : ℚ) = (T.d₂ : ℚ) * t := by have hdq : (T.d₂ : ℚ) ≠ 0 := by exact_mod_cast T.d₂_pos.ne' have haq : (a : ℚ) ≠ 0 := Int.cast_ne_zero.mpr ha0 calc (a : ℚ) = T.d₂ * (a * (T.d₂ : ℚ)⁻¹) := by field_simp _ = T.d₂ * (a * (t / a)) := by rw [h3] _ = T.d₂ * t := by field_simp exact ⟨t, by exact_mod_cast h4⟩ -- a ∣ d₂: φ(y₂) ∈ φ(A) ∩ V₂ = ℤ + ℤω₁ + ℤω₂ have hdvd2 : a ∣ (T.d₂ : ℤ) := by obtain ⟨n, hn3, hn⟩ := T.inter_V2 (P.φ_mem Y2) (by rw [hY2]; simp) have h2 := congrFun hn 2 rw [T.comb_apply_two, hn3, hY2] at h2 simp at h2 have ha' : (a : ℚ) ≠ 0 := Int.cast_ne_zero.mpr ha0 have h5 : ((T.d₂ : ℤ) : ℚ) = a * n 2 := by have hdq : (T.d₂ : ℚ) ≠ 0 := by exact_mod_cast T.d₂_pos.ne' push_cast calc (T.d₂ : ℚ) = a * ((a : ℚ)⁻¹ * T.d₂) := by field_simp _ = a * ((n 2 : ℚ) / T.d₂ * T.d₂) := by rw [h2] _ = a * n 2 := by field_simp exact ⟨n 2, by exact_mod_cast h5⟩ have hab : a.natAbs = T.d₂ := by have := Int.natAbs_eq_of_dvd_dvd hdvd1 hdvd2 simpa using this.symm rw [← hab, haH, G] /-- **thm:B, elementary divisors** (prop:triang as hypothesis): d₁ = 1, d₂ = LG/H, d₃ = JL/G and A/ℤ[α] ≅ ℤ/(LG/H) × ℤ/(JL/G). -/theorem thm_B_divisors (T : Louboutin.Triang P.MQ) : T.d₁ = 1 ∧ T.d₂ = (W.L * W.G).natAbs / W.H.natAbs ∧ T.d₃ = (P.J * W.L).natAbs / W.G.natAbs ∧ Nonempty ((M.A.toAddSubgroup ⧸ (Lat4 M.vpow).addSubgroupOf M.A.toAddSubgroup) ≃+ ZMod ((W.L * W.G).natAbs / W.H.natAbs) × ZMod ((P.J * W.L).natAbs / W.G.natAbs)) := by have h1 := P.triang_d1 T have h2 := W.triang_d2 T have hH0 : 0 < W.H.natAbs := Int.natAbs_pos.mpr W.H_ne have hG0 : 0 < W.G.natAbs := Int.natAbs_pos.mpr (Gm_ne W.col W.H_ne) have hL0 : 0 < W.L.natAbs := Int.natAbs_pos.mpr W.hL have hd2 : T.d₂ = (W.L * W.G).natAbs / W.H.natAbs := (Nat.div_eq_of_eq_mul_left hH0 h2.symm).symm -- index: d₂ d₃ = I and I·H = |J| L² have hidx : T.d₂ * T.d₃ = P.I := by have := T.index_eq rw [h1, one_mul, P.index_Z4] at this exact this.symm have hI : P.I * W.H.natAbs = P.J.natAbs * (W.L ^ 2).natAbs := (W.thm_B_LGH).2.2.2.1 have h3' : T.d₃ * W.G.natAbs = (P.J * W.L).natAbs := by have e : T.d₃ * W.G.natAbs * W.L.natAbs = (P.J * W.L).natAbs * W.L.natAbs := by have e1 : T.d₂ * T.d₃ * W.H.natAbs = P.J.natAbs * (W.L ^ 2).natAbs := by rw [hidx, hI] rw [Int.natAbs_mul] at h2 simp only [Int.natAbs_mul, Int.natAbs_pow] at e1 ⊢ nlinarith [e1, h2] exact Nat.eq_of_mul_eq_mul_right hL0 e have hd3 : T.d₃ = (P.J * W.L).natAbs / W.G.natAbs := (Nat.div_eq_of_eq_mul_left hG0 h3'.symm).symm refine ⟨h1, hd2, hd3, ?_⟩ obtain ⟨e⟩ := T.quotient_equiv_T1 h1 rw [hd2, hd3] at e exact ⟨P.quotEquiv.trans e⟩ end Lam.LGH end Louboutin.TeoremaB