🏛️ Atlas✒️Formalizations.NumberTheory.NumberField.InvariantOrders.CubicParity view on GitHub ↗9 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 Mathlib.Tactic.Ringpublic import Mathlib.Tactic.LinearCombinationpublic import Mathlib.Data.ZMod.Basicpublic import Mathlib.LinearAlgebra.Matrix.Determinant.Basicpublic import Mathlib.LinearAlgebra.Matrix.Notationpublic import Mathlib.Algebra.Ring.Int.Paritypublic import Mathlib.Tactic.FinCases /-!# The parity core of Louboutin's Conjecture 4.1, and a Möbius unit lemma Let `M ∈ M₂(ℤ)` with `M³ = ε·1` (`ε = ±1`), `M ≠ ±1`, and let `F = X³ − aX²Y + bXY² − cY³` satisfy`F ∘ M = ±F`. Then `c` and `a + b` are odd, and `X³ − aX² + bX − c` has no root modulo `2`. Theproof: `det M = 1` and `tr M` is odd (Cayley–Hamilton), so `M mod 2` is one of the two elementsof order `3` of `GL₂(𝔽₂)` and permutes `ℙ¹(𝔽₂)` cyclically; `F(1, 0) = 1` forces `F` odd at`(0, 1)` and `(1, 1)` (a finite check by `decide`). Not formalized here: that the Möbius matrix of `σ` lies in `GL₂(ℤ)` when `ℤ[σα] = ℤ[α]`(Bérczes–Evertse–Győry, Lemma 6.4), which is the input of `cubic_parity`, and Dedekind'scriterion. ## Main results * `Louboutin.CubicParity.cubic_parity`, `Louboutin.CubicParity.no_root_mod_two`.* `Louboutin.CubicParity.mobius_unit`: if `β(rα + s) = pα + q` then  `(rα + s)(p − rβ) = ps − qr`, a unit if `ps − qr = ±1`. ## References * A. Bérczes, J.-H. Evertse and K. Győry, *Multiply monogenic orders*, Ann. Sc. Norm. Super. Pisa  Cl. Sci. (5) 12 (2013), 467–497.* 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.CubicParity open Matrix /-- The binary cubic form F(X, Y) = X³ − aX²Y + bXY² − cY³ = Y³ Π(X/Y), Π = X³ − aX² + bX − c. -/def Fc {R : Type*} [CommRing R] (a b c X Y : R) : R :=  X ^ 3 - a * X ^ 2 * Y + b * X * Y ^ 2 - c * Y ^ 3 /-- det M = 1 when M³ = ±1. -/theorem det_eq_one {M : Matrix (Fin 2) (Fin 2) ℤ} {ε : ℤ} (hε : ε = 1 ∨ ε = -1)    (h : M ^ 3 = ε • (1 : Matrix (Fin 2) (Fin 2) ℤ)) : M.det = 1 := by  have e := congrArg Matrix.det h  rw [Matrix.det_pow, Matrix.det_smul, Matrix.det_one, Fintype.card_fin] at e  have e1 : M.det * M.det ^ 2 = 1 := by    rcases hε with rfl | rfl <;> linear_combination e  rcases Int.eq_one_or_neg_one_of_mul_eq_one e1 with h1 | h1  · exact h1  · rw [h1] at e1; norm_num at e1 /-- tr M is odd (indeed ±1) when M³ = ±1 and M ≠ ±1 (Cayley–Hamilton with det M = 1). -/theorem trace_odd {M : Matrix (Fin 2) (Fin 2) ℤ} {ε : ℤ} (hε : ε = 1 ∨ ε = -1)    (h : M ^ 3 = ε • (1 : Matrix (Fin 2) (Fin 2) ℤ)) (h1 : M ≠ 1) (hm1 : M ≠ -1) :    Odd (M 0 0 + M 1 1) := by  have hdet := det_eq_one hε h  rw [Matrix.det_fin_two] at hdet  have e : ∀ i j, (M ^ 3) i j = (ε • (1 : Matrix (Fin 2) (Fin 2) ℤ)) i j := fun i j => by rw [h]  have e00 := e 0 0  have e01 := e 0 1  have e10 := e 1 0  have e11 := e 1 1  simp [pow_succ, Matrix.mul_apply, Fin.sum_univ_two] at e00 e01 e10 e11  set p := M 0 0  set q := M 0 1  set r := M 1 0  set s := M 1 1  -- Cayley–Hamilton: M³ = (t² − 1)M − t·1, t = p + s  have c01 : q * ((p + s) ^ 2 - 1) = 0 := by linear_combination e01 + q * hdet  have c10 : r * ((p + s) ^ 2 - 1) = 0 := by linear_combination e10 + r * hdet  have ht : (p + s) ^ 2 = 1 := by    by_contra hne    have hne' : (p + s) ^ 2 - 1 ≠ 0 := sub_ne_zero.mpr hne    have hq : q = 0 := by simpa [hne'] using c01    have hr : r = 0 := by simpa [hne'] using c10    rw [hq, hr] at hdet e00 e11    have hps : p * s = 1 := by linear_combination hdet    rcases Int.eq_one_or_neg_one_of_mul_eq_one' hps with ⟨hp, hs⟩ | ⟨hp, hs⟩    · apply h1; ext i j      fin_cases i <;> fin_cases j <;> simp <;>        first | exact hp | exact hq | exact hr | exact hs    · apply hm1; ext i j      fin_cases i <;> fin_cases j <;> simp <;>        first | exact hp | exact hq | exact hr | exact hs  have hsq : (p + s) * (p + s) = 1 := by rw [← sq]; exact ht  rcases Int.eq_one_or_neg_one_of_mul_eq_one hsq with h' | h'  · rw [h']; exact odd_one  · rw [h']; exact odd_neg_one /-- The mod-2 core: a matrix over 𝔽₂ with det 1 and trace 1 (an element of order 3 of    GL₂(𝔽₂)), fixing the cubic form F at the three points (1,0), (0,1), (1,1) of ℙ¹(𝔽₂),    forces F(0,1) = c ≠ 0 and F(1,1) ≠ 0, i.e. c = 1 and a + b = 1. -/theorem parity_mod_two : ∀ m00 m01 m10 m11 a b c : ZMod 2,    m00 * m11 - m01 * m10 = 1 → m00 + m11 = 1 →    Fc a b c m00 m10 = Fc a b c 1 0 → Fc a b c m01 m11 = Fc a b c 0 1 →    Fc a b c (m00 + m01) (m10 + m11) = Fc a b c 1 1 →    c ≠ 0 ∧ a + b ≠ 0 := by  unfold Fc; decide theorem odd_iff_zmod (n : ℤ) : Odd n ↔ (n : ZMod 2) ≠ 0 := by  rw [← Int.not_even_iff_odd, even_iff_two_dvd, ne_eq, ZMod.intCast_zmod_eq_zero_iff_dvd]; norm_num /-- **Cubic parity core of Prop. `prop:c41`** (Louboutin's Conjecture 4.1 without the BEG13    step): if M ∈ M₂(ℤ), M³ = ±1, M ≠ ±1 and F∘M = ±F for F = X³ − aX²Y + bXY² − cY³, then    c and a + b are odd. -/theorem cubic_parity {M : Matrix (Fin 2) (Fin 2) ℤ} {ε s : ℤ} (hε : ε = 1 ∨ ε = -1)    (h : M ^ 3 = ε • (1 : Matrix (Fin 2) (Fin 2) ℤ)) (h1 : M ≠ 1) (hm1 : M ≠ -1)    (hs : s = 1 ∨ s = -1) {a b c : ℤ}    (hF : ∀ X Y : ℤ, Fc a b c (M 0 0 * X + M 0 1 * Y) (M 1 0 * X + M 1 1 * Y) = s * Fc a b c X Y) :    Odd c ∧ Odd (a + b) := by  have hdet := det_eq_one hε h  rw [Matrix.det_fin_two] at hdet  have htr := (odd_iff_zmod _).mp (trace_odd hε h h1 hm1)  have hs2 : (s : ZMod 2) = 1 := by rcases hs with rfl | rfl <;> decide  have cast2 : ∀ X Y : ℤ, Fc (a : ZMod 2) b c ((M 0 0 : ZMod 2) * X + (M 0 1 : ZMod 2) * Y)      ((M 1 0 : ZMod 2) * X + (M 1 1 : ZMod 2) * Y) = Fc (a : ZMod 2) b c X Y := by    intro X Y    have := congrArg (Int.cast : ℤ → ZMod 2) (hF X Y)    simp only [Fc] at this ⊢    push_cast at this    rw [hs2, one_mul] at this    exact this  have q1 := cast2 1 0  have q2 := cast2 0 1  have q3 := cast2 1 1  have hdet2 : ((M 0 0 : ℤ) : ZMod 2) * (M 1 1 : ZMod 2) - (M 0 1 : ZMod 2) * (M 1 0 : ZMod 2) = 1 := by    have := congrArg (Int.cast : ℤ → ZMod 2) hdet    push_cast at this; exact this  push_cast at htr q1 q2 q3  simp only [mul_one, mul_zero, add_zero, zero_add] at q1 q2 q3  have htr1 : ((M 0 0 : ℤ) : ZMod 2) + (M 1 1 : ZMod 2) = 1 := by    revert htr; generalize ((M 0 0 : ℤ) : ZMod 2) + (M 1 1 : ZMod 2) = z; decide +revert  obtain ⟨hc, hab⟩ := parity_mod_two _ _ _ _ _ _ _ hdet2 htr1 q1 q2 q3  refine ⟨(odd_iff_zmod c).mpr hc, (odd_iff_zmod _).mpr ?_⟩  push_cast; exact hab /-- Corollary of `cubic_parity`: Π = X³ − aX² + bX − c has no root modulo 2    (so, being cubic, it is irreducible modulo 2). -/theorem no_root_mod_two {a b c : ℤ} (hc : Odd c) (hab : Odd (a + b)) :    ∀ x : ZMod 2, x ^ 3 - (a : ZMod 2) * x ^ 2 + (b : ZMod 2) * x - (c : ZMod 2) ≠ 0 := by  have hc' := (odd_iff_zmod c).mp hc  have hab' := (odd_iff_zmod _).mp hab  push_cast at hab'  revert hc' hab'  generalize (a : ZMod 2) = a'  generalize (b : ZMod 2) = b'  generalize (c : ZMod 2) = c'  decide +revert /-- **Möbius unit lemma** (Remark `rem:mobius`): in a commutative ring, if β(rα + s) = pα + q    then (rα + s)(p − rβ) = ps − qr. -/theorem mobius_mul {R : Type*} [CommRing R] {α β p q r s : R} (h : β * (r * α + s) = p * α + q) :    (r * α + s) * (p - r * β) = p * s - q * r := by  linear_combination (-r) * h /-- If moreover ps − qr = ±1, then rα + s is a unit (so β = (pα + q)/(rα + s) ∈ ℤ[α] when    p, q, r, s are integers and β(rα + s) = pα + q). -/theorem mobius_unit {R : Type*} [CommRing R] {α β p q r s : R} (h : β * (r * α + s) = p * α + q)    (hdet : p * s - q * r = 1 ∨ p * s - q * r = -1) : IsUnit (r * α + s) := by  have e := mobius_mul h  rcases hdet with hd | hd <;> rw [hd] at e  · exact isUnit_iff_exists_inv.mpr ⟨_, e⟩  · exact isUnit_iff_exists_inv.mpr ⟨-(p - r * β), by rw [mul_neg, e, neg_neg]⟩ /-- β itself: β = ±(pα + q)(p − rβ) when ps − qr = ±1 (the inverse of rα + s is ±(p − rβ)). -/theorem mobius_eq {R : Type*} [CommRing R] {α β p q r s ε : R} (h : β * (r * α + s) = p * α + q)    (hdet : p * s - q * r = ε) (hε : ε * ε = 1) : β = ε * ((p * α + q) * (p - r * β)) := by  have e := mobius_mul h  rw [hdet] at e  linear_combination (ε * (p - r * β)) * h - β * ε * e - β * hε end Louboutin.CubicParity