🏛️ Atlas✒️Formalizations.NumberTheory.NumberField.InvariantOrders.IndexLemmas view on GitHub ↗25 theorems
/-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.Discriminant /-!# Determinant and discriminant lemmas for quartic orders (biquadratic and cyclic) Biquadratic case, in the model `V4Data O` with the determinant `D` of `Discriminant`:* `D(ω) ∈ ℤ` when the `γ`'s compose as `V₄` on every `ω_l` (true on all of `𝒪_K`), and  unconditionally for `ω ∈ A = ℤ[x₀, …, x₃]`;* `det[γ_i(∑_k m_lk αᵏ)] = Vand(γ_i α) · det(m)` with `det(m) ∈ R`, for any subring `R` of  elements fixed by the `γ_i`.Cyclic case, in a new model `C4Act` / `C4Data` (`x_k = σᵏα`, `σ` a ring endomorphism shifting theconjugates cyclically, and "`σ`-fixed ⇒ integer"):* `N, Q₂, U, Y, r ∈ ℤ` with `Q₂ = a² − 4b + 4r`, `N = a² − 2b − 2r`, `U = a³ − 4ab + 8c`,  `U² + Y² = N² Q₂`, and in every ring `S ⊇ ι` (`ι² = −1`) fed by a ring hom `O → S`:  `R₁R₃ = N`, `R₂² = Q₂`, `R₁²R₂ = U + ιY`;* two discriminant identities, in field form and in integral form. ## Main results * `Louboutin.Identidades.lem_detZ`, `Louboutin.Identidades.lem_detZ_A`.* `Louboutin.Identidades.lem_sub_core`, `Louboutin.Identidades.lem_sub_Z`.* `Louboutin.Identidades.lem_inv`.* `Louboutin.Identidades.lem_disc2`, `lem_disc2_b_ne`, `lem_disc2_b_zero`, and the integral forms  `disc2_a`, `disc2_b`, `disc2_b0`. ## 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.Identidades open Louboutin.Conj61 Louboutin.DiscV4 Matrix set_option linter.unusedSectionVars false /-! ## lem:detZ -/ section detZ variable {O : Type*} [CommRing O] [IsDomain O] [CharZero O] (M : V4Data O) /-- γ_a fixes D(ω) when the γ's compose as V4 on the ω_l (row permutation `xtPerm a`, even). -/theorem D_fixed (w : Fin 4 → O) (hw : ∀ l, w l ∈ compSub M) (a : Fin 4) :    M.ρ a (D M w) = D M w := by  rw [D, RingHom.map_det]  have hE : (M.ρ a).mapMatrix (Matrix.of fun i l => M.ρ i (w l))      = (Matrix.of fun i l => M.ρ i (w l)).submatrix (xtPerm a) id := by    ext i l    simp only [RingHom.mapMatrix_apply, Matrix.map_apply, Matrix.of_apply, Matrix.submatrix_apply,      id]    exact hw l a i  rw [hE, Matrix.det_permute, sign_xtPerm]  simp /-- **lem:detZ** (Lou20b (5.2), Thm. 5.1). If the γ's act on ω₁, …, ω₄ as the group V4    (γ_aγ_i = γ_{a xor i}; for 𝒪_K this holds for every ω), then detG(ω) ∈ ℤ. -/theorem lem_detZ (w : Fin 4 → O) (hw : ∀ l, w l ∈ compSub M) : ∃ n : ℤ, D M w = n :=  M.fix _ (by simpa [V4Data.ρ] using D_fixed M w hw 1) (by simpa [V4Data.ρ] using D_fixed M w hw 2)    (by simpa [V4Data.ρ] using D_fixed M w hw 3) /-- **lem:detZ** in the model, unconditionally, for ω₁, …, ω₄ ∈ A = ℤ[x₀, …, x₃]. -/theorem lem_detZ_A (w : Fin 4 → O) (hw : ∀ l, w l ∈ Aring M) : ∃ n : ℤ, D M w = n :=  lem_detZ M w fun l => fun a i => comp_of_mem M (hw l) a i end detZ /-! ## lem:sub -/ section sub /-- **lem:sub**, algebraic core. γ₀, …, γ₃ ring endomorphisms of K, R a subring whose elements    are fixed by every γ_i (R = ℤ or ℤ_(p) inside a number field), ω_l = Σ_k m_lk α^k with    m_lk ∈ R. Then det[γ_i(ω_l)] = Vand(γ₀α, …, γ₃α)·det(m) and det(m) ∈ R. -/theorem lem_sub_core {K : Type*} [CommRing K] (γ : Fin 4 → K →+* K) (α : K) (R : Subring K)    (hR : ∀ i, ∀ r ∈ R, γ i r = r) (m : Matrix (Fin 4) (Fin 4) K) (hm : ∀ l k, m l k ∈ R) :    (Matrix.of fun i l => γ i (∑ k : Fin 4, m l k * α ^ (k : ℕ))).det        = Vand (fun i => γ i α) * m.det ∧ m.det ∈ R := by  constructor  · have hE : (Matrix.of fun i l => γ i (∑ k : Fin 4, m l k * α ^ (k : ℕ)))        = Matrix.vandermonde (fun i => γ i α) * mᵀ := by      ext i l      simp only [Matrix.of_apply, Matrix.mul_apply, Matrix.vandermonde_apply,        Matrix.transpose_apply, map_sum, map_mul, map_pow, hR i _ (hm _ _)]      exact Finset.sum_congr rfl fun k _ => mul_comm _ _    rw [hE, Matrix.det_mul, Matrix.det_transpose, vand4]  · set m' : Matrix (Fin 4) (Fin 4) R := Matrix.of fun l k => ⟨m l k, hm l k⟩    have hm' : m = R.subtype.mapMatrix m' := by ext l k; rfl    rw [hm', ← RingHom.map_det]    exact SetLike.coe_mem _ variable {O : Type*} [CommRing O] [IsDomain O] [CharZero O] (M : V4Data O) /-- **lem:sub** for R = ℤ, in the model: ω_l = Σ_k m_lk α^k with m_lk ∈ ℤ ⇒    detG(ω) = Δ_α·det(m) ∈ Δ_α ℤ. -/theorem lem_sub_Z (m : Matrix (Fin 4) (Fin 4) ℤ) (w : Fin 4 → O)    (hw : ∀ l, w l = ∑ k : Fin 4, (m l k : O) * M.x 0 ^ (k : ℕ)) :    D M w = Vand M.x * (m.det : O) ∧ ∃ n : ℤ, D M w = Vand M.x * n :=  have h : D M w = Vand M.x * (m.det : O) := by    rw [D_comb M (Dat.vpow M) w m (fun l => by simpa [Dat.vpow] using hw l), Dat.D_vpow]  ⟨h, m.det, h⟩ end sub /-! ## The cyclic model and the polynomials of §5 -/ /-- C4 action: conjugates x₀ = α, x_k = σᵏα, σ a ring endomorphism shifting them cyclically. -/structure C4Act (O : Type*) [CommRing O] where  x : Fin 4 → O  σ : O →+* O  hσ : σ (x 0) = x 1 ∧ σ (x 1) = x 2 ∧ σ (x 2) = x 3 ∧ σ (x 3) = x 0 /-- C4 model: C4 action plus "σ-fixed ⇒ integer" (𝓞_K^Γ = ℤ). -/structure C4Data (O : Type*) [CommRing O] extends C4Act O where  fix : ∀ y, σ y = y → ∃ n : ℤ, y = n section poly variable {R : Type*} [CommRing R] (x : Fin 4 → R) /-- r = α₀α₂ + α₁α₃ (the rational root of the resolvent). -/def rr : R := x 0 * x 2 + x 1 * x 3/-- R₂ = α₀ + α₂ − α₁ − α₃. -/def R2 : R := x 0 - x 1 + x 2 - x 3/-- N = u² + v², u = α₀ − α₂, v = α₁ − α₃. -/def Nn : R := (x 0 - x 2) ^ 2 + (x 1 - x 3) ^ 2/-- Q₂ = R₂². -/def Q2 : R := R2 x ^ 2/-- Y = Im Ξ = 2uv(s − t). -/def Yy : R := 2 * (x 0 - x 2) * (x 1 - x 3) * R2 x /-- R_j = Σ_k ι^{jk} α_k. -/def Rj (ι : R) (j : ℕ) : R := ∑ k : Fin 4, ι ^ (j * (k : ℕ)) * x k theorem Rj_one (ι : R) : Rj x ι 1 = x 0 + ι * x 1 + ι ^ 2 * x 2 + ι ^ 3 * x 3 := by  simp [Rj, Fin.sum_univ_four] theorem Rj_two (ι : R) : Rj x ι 2 = x 0 + ι ^ 2 * x 1 + ι ^ 4 * x 2 + ι ^ 6 * x 3 := by  simp [Rj, Fin.sum_univ_four] theorem Rj_three (ι : R) : Rj x ι 3 = x 0 + ι ^ 3 * x 1 + ι ^ 6 * x 2 + ι ^ 9 * x 3 := by  simp [Rj, Fin.sum_univ_four] theorem Rj_zero (ι : R) : Rj x ι 0 = ea x := by  simp [Rj, Fin.sum_univ_four, ea] /-- **lem:inv**, the polynomial identities (exact expansion). -/theorem inv_poly :    Q2 x = ea x ^ 2 - 4 * eb x + 4 * rr x ∧    Nn x = ea x ^ 2 - 2 * eb x - 2 * rr x ∧    U x = ea x ^ 3 - 4 * ea x * eb x + 8 * ec x ∧    U x ^ 2 + Yy x ^ 2 = Nn x ^ 2 * Q2 x ∧    U x = R2 x * (ea x * R2 x - 4 * (x 0 * x 2 - x 1 * x 3)) := by  refine ⟨?_, ?_, rfl, ?_, ?_⟩ <;> simp only [Q2, Nn, U, Yy, R2, rr, ea, eb, ec] <;> ring /-- **lem:inv**, the identities with i: R₁R₃ = N, R₂ = α₀ + α₂ − α₁ − α₃, R₂² = Q₂,    Ξ = R₁²R₂ = U + iY. -/theorem inv_iota (ι : R) (hι : ι ^ 2 = -1) :    Rj x ι 1 * Rj x ι 3 = Nn x ∧ Rj x ι 2 = R2 x ∧ Rj x ι 2 ^ 2 = Q2 x ∧    Rj x ι 1 ^ 2 * Rj x ι 2 = U x + ι * Yy x := by  have h4 : ι ^ 4 = 1 := by linear_combination (ι ^ 2 - 1) * hι  have h3 : ι ^ 3 = -ι := by linear_combination ι * hι  have h6 : ι ^ 6 = -1 := by linear_combination (ι ^ 4 - ι ^ 2 + 1) * hι  have h9 : ι ^ 9 = ι := by linear_combination ι * (ι ^ 2 - 1) * (ι ^ 4 + 1) * hι  have e1 : Rj x ι 1 = (x 0 - x 2) + ι * (x 1 - x 3) := by    rw [Rj_one, h3, hι]; ring  have e2 : Rj x ι 2 = R2 x := by    rw [Rj_two, h4, h6, hι, R2]; ring  have e3 : Rj x ι 3 = (x 0 - x 2) - ι * (x 1 - x 3) := by    rw [Rj_three, h3, h6, h9]; ring  refine ⟨?_, e2, by rw [e2, Q2], ?_⟩  · rw [e1, e3, Nn]; linear_combination (-(x 1 - x 3) ^ 2) * hι  · rw [e1, e2, U, Yy, R2]    simp only [ea, eb, ec]    linear_combination ((x 1 - x 3) ^ 2 * (x 0 - x 1 + x 2 - x 3)) * hι theorem map_Nn {S : Type*} [CommRing S] (f : R →+* S) : Nn (f ∘ x) = f (Nn x) := by  simp [Nn, map_add, map_sub, map_pow]theorem map_Q2 {S : Type*} [CommRing S] (f : R →+* S) : Q2 (f ∘ x) = f (Q2 x) := by  simp [Q2, R2, map_add, map_sub, map_pow]theorem map_U {S : Type*} [CommRing S] (f : R →+* S) : U (f ∘ x) = f (U x) := by  simp [U, ea, eb, ec, map_add, map_sub, map_pow, map_mul, map_ofNat]theorem map_Yy {S : Type*} [CommRing S] (f : R →+* S) : Yy (f ∘ x) = f (Yy x) := by  simp [Yy, R2, map_add, map_sub, map_mul, map_ofNat] end poly /-! ## lem:inv -/ section inv variable {O : Type*} [CommRing O] [IsDomain O] [CharZero O] (M : C4Data O) theorem C4Data.int_of_fix {y : O} (h : M.σ y = y) : ∃ n : ℤ, y = n := M.fix y h /-- **lem:inv**. With a, b, c, r the integers e₁, e₂, e₃(α) and α₀α₂ + α₁α₃: N, Q₂, U, Y are    integers with Q₂ = a² − 4b + 4r, N = a² − 2b − 2r, U = a³ − 4ab + 8c, U² + Y² = N²Q₂; and in    any commutative ring S with ι² = −1 receiving O by a ring hom f (e.g. K ⊗ ℚ(i)), with    R_j = Σ_k ι^{jk} f(α_k): R₁R₃ = N, R₂² = Q₂, Ξ = R₁²R₂ = U + ιY, and    U = R₂(aR₂ − 4(α₀α₂ − α₁α₃)) with R₂ = α₀ + α₂ − α₁ − α₃. -/theorem lem_inv : ∃ a b c r n q u y : ℤ,    ea M.x = a ∧ eb M.x = b ∧ ec M.x = c ∧ rr M.x = r ∧    Nn M.x = n ∧ Q2 M.x = q ∧ U M.x = u ∧ Yy M.x = y ∧    q = a ^ 2 - 4 * b + 4 * r ∧ n = a ^ 2 - 2 * b - 2 * r ∧ u = a ^ 3 - 4 * a * b + 8 * c ∧    u ^ 2 + y ^ 2 = n ^ 2 * q ∧    U M.x = R2 M.x * (ea M.x * R2 M.x - 4 * (M.x 0 * M.x 2 - M.x 1 * M.x 3)) ∧    ∀ {S : Type*} [CommRing S] (f : O →+* S) (ι : S), ι ^ 2 = -1 →      Rj (f ∘ M.x) ι 1 * Rj (f ∘ M.x) ι 3 = n ∧ Rj (f ∘ M.x) ι 2 = f (R2 M.x) ∧      Rj (f ∘ M.x) ι 2 ^ 2 = q ∧ Rj (f ∘ M.x) ι 1 ^ 2 * Rj (f ∘ M.x) ι 2 = u + ι * y := by  obtain ⟨h0, h1, h2, h3⟩ := M.hσ  have inv : ∀ (F : (Fin 4 → O) → O), (M.σ (F M.x) = F M.x) → ∃ n : ℤ, F M.x = n :=    fun F h => M.fix _ h  obtain ⟨a, ha⟩ := inv ea (by simp only [ea, map_add, h0, h1, h2, h3]; ring)  obtain ⟨b, hb⟩ := inv eb (by simp only [eb, map_add, map_mul, h0, h1, h2, h3]; ring)  obtain ⟨c, hc⟩ := inv ec (by simp only [ec, map_add, map_mul, h0, h1, h2, h3]; ring)  obtain ⟨r, hr⟩ := inv rr (by simp only [rr, map_add, map_mul, h0, h1, h2, h3]; ring)  obtain ⟨n, hn⟩ := inv Nn (by simp only [Nn, map_add, map_sub, map_pow, h0, h1, h2, h3]; ring)  obtain ⟨q, hq⟩ := inv Q2 (by simp only [Q2, R2, map_add, map_sub, map_pow, h0, h1, h2, h3]; ring)  obtain ⟨u, hu⟩ := inv U (by    simp only [U, ea, eb, ec, map_add, map_sub, map_mul, map_pow, map_ofNat, h0, h1, h2, h3]; ring)  obtain ⟨y, hy⟩ := inv Yy (by    simp only [Yy, R2, map_add, map_sub, map_mul, map_ofNat, h0, h1, h2, h3]; ring)  obtain ⟨pq, pn, pu, pyy, pR⟩ := inv_poly M.x  refine ⟨a, b, c, r, n, q, u, y, ha, hb, hc, hr, hn, hq, hu, hy, ?_, ?_, ?_, ?_, pR, ?_⟩  · have : ((q : ℤ) : O) = ((a ^ 2 - 4 * b + 4 * r : ℤ) : O) := by      rw [← hq, pq, ha, hb, hr]; push_cast; ring    exact_mod_cast this  · have : ((n : ℤ) : O) = ((a ^ 2 - 2 * b - 2 * r : ℤ) : O) := by      rw [← hn, pn, ha, hb, hr]; push_cast; ring    exact_mod_cast this  · have : ((u : ℤ) : O) = ((a ^ 3 - 4 * a * b + 8 * c : ℤ) : O) := by      rw [← hu, pu, ha, hb, hc]; push_cast; ring    exact_mod_cast this  · have : ((u ^ 2 + y ^ 2 : ℤ) : O) = ((n ^ 2 * q : ℤ) : O) := by      push_cast; rw [← hu, ← hy, ← hn, ← hq, pyy]    exact_mod_cast this  · intro S _ f ι hι    obtain ⟨i1, i2, i3, i4⟩ := inv_iota (f ∘ M.x) ι hι    refine ⟨?_, ?_, ?_, ?_⟩    · rw [i1, map_Nn, hn, map_intCast]    · rw [i2]; simp [R2, map_add, map_sub]    · rw [i3, map_Q2, hq, map_intCast]    · rw [i4, map_U, map_Yy, hu, hy, map_intCast, map_intCast] end inv /-! ## lem:disc2 -/ section disc2 variable {O : Type*} [CommRing O] (M : C4Act O) /-- σ⁰, σ¹, σ², σ³. -/def C4Act.ρ (m : Fin 4) : O →+* O := ![RingHom.id O, M.σ, M.σ.comp M.σ, M.σ.comp (M.σ.comp M.σ)] m /-- disc(ω) = det[σᵐ(ω_l)]². -/noncomputable def C4Act.disc (w : Fin 4 → O) : O := (Matrix.of fun m l => M.ρ m (w l)).det ^ 2 /-- (1, α, σα, σ²α). -/def C4Act.w1 : Fin 4 → O := ![1, M.x 0, M.σ (M.x 0), M.σ (M.σ (M.x 0))]/-- (1, α, σα, α·σα). -/def C4Act.w2 : Fin 4 → O := ![1, M.x 0, M.σ (M.x 0), M.x 0 * M.σ (M.x 0)] theorem det_w1 : (Matrix.of fun m l => M.ρ m (M.w1 l)).det = R2 M.x * Nn M.x := by  obtain ⟨h0, h1, h2, h3⟩ := M.hσ  rw [det4]  simp [C4Act.w1, C4Act.ρ, h0, h1, h2, h3]  simp only [det4e, R2, Nn]  ring theorem det_w2 : (Matrix.of fun m l => M.ρ m (M.w2 l)).det    = (M.x 0 - M.x 2) * (M.x 1 - M.x 3) * (eb M.x - 3 * rr M.x) := by  obtain ⟨h0, h1, h2, h3⟩ := M.hσ  rw [det4]  simp [C4Act.w2, C4Act.ρ, h0, h1, h2, h3]  simp only [det4e, eb, rr]  ring /-- **lem:disc2**, first formula: disc(1, α, σα, σ²α) = N²Q₂ (any commutative ring). -/theorem disc2_a : M.disc M.w1 = Nn M.x ^ 2 * Q2 M.x := by  rw [C4Act.disc, det_w1, Q2]; ring /-- **lem:disc2**, second formula, integral form: 16Q₂·disc(1, α, σα, α·σα) = Y²(N − Q₂)². -/theorem disc2_b : 16 * Q2 M.x * M.disc M.w2 = Yy M.x ^ 2 * (Nn M.x - Q2 M.x) ^ 2 := by  rw [C4Act.disc, det_w2]; simp only [Q2, Yy, R2, Nn, eb, rr]; ring /-- **lem:disc2**, second formula, case Q₂ = 0, integral form (O a domain):    64·disc(1, α, σα, α·σα) = N²·∏_k(a − 4α_k), i.e. disc = 4N²Π_α(a/4). -/theorem disc2_b0 [IsDomain O] (hQ : Q2 M.x = 0) :    64 * M.disc M.w2 = Nn M.x ^ 2 * ∏ k : Fin 4, (ea M.x - 4 * M.x k) := by  have hR : R2 M.x = 0 := pow_eq_zero_iff (n := 2) (by norm_num) |>.mp hQ  have h3 : M.x 3 = M.x 0 - M.x 1 + M.x 2 := by    simp only [R2] at hR; linear_combination -hR  rw [C4Act.disc, det_w2]  simp only [Fin.prod_univ_four, eb, rr, Nn, ea]  rw [h3]  ring /-- Π_α(X) = ∏_k (X − α_k). -/def Pi (x : Fin 4 → O) (X : O) : O := ∏ k : Fin 4, (X - x k) /-- **lem:disc2**, second formula, Q₂ ≠ 0 (K a field of characteristic 0):    disc(1, α, σα, α·σα) = Y²(N − Q₂)²/(16Q₂). -/theorem lem_disc2_b_ne {K : Type*} [Field K] [CharZero K] (M : C4Act K) (hQ : Q2 M.x ≠ 0) :    M.disc M.w2 = Yy M.x ^ 2 * (Nn M.x - Q2 M.x) ^ 2 / (16 * Q2 M.x) := by  rw [eq_div_iff (mul_ne_zero (by norm_num) hQ)]  linear_combination disc2_b M /-- **lem:disc2**, second formula, Q₂ = 0 (K a field of characteristic 0):    disc(1, α, σα, α·σα) = 4N²Π_α(a/4). -/theorem lem_disc2_b_zero {K : Type*} [Field K] [CharZero K] (M : C4Act K) (hQ : Q2 M.x = 0) :    M.disc M.w2 = 4 * Nn M.x ^ 2 * Pi M.x (ea M.x / 4) := by  have h := disc2_b0 M hQ  simp only [Fin.prod_univ_four] at h  simp only [Pi, Fin.prod_univ_four]  linear_combination (1 / 64 : K) * h open Classical in/-- **lem:disc2** (statement of the note, K a field of characteristic 0). -/theorem lem_disc2 {K : Type*} [Field K] [CharZero K] (M : C4Act K) :    M.disc M.w1 = Nn M.x ^ 2 * Q2 M.x ∧    M.disc M.w2 = (if Q2 M.x ≠ 0 then Yy M.x ^ 2 * (Nn M.x - Q2 M.x) ^ 2 / (16 * Q2 M.x)      else 4 * Nn M.x ^ 2 * Pi M.x (ea M.x / 4)) := by  refine ⟨disc2_a M, ?_⟩  split_ifs with hQ  · exact lem_disc2_b_ne M hQ  · exact lem_disc2_b_zero M (not_not.mp hQ) end disc2  end Louboutin.Identidades