🏛️ Atlas✒️Formalizations.NumberTheory.NumberField.InvariantOrders.Saturation view on GitHub ↗8 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.GroupTheory.SpecificGroups.Cyclicpublic import Mathlib.GroupTheory.OrderOfElementpublic import Mathlib.GroupTheory.Indexpublic import Mathlib.Data.ZMod.Basicpublic import Mathlib.Data.Fin.VecNotationpublic import Mathlib.Data.Nat.Prime.Intpublic import Mathlib.Tactic.Abelpublic import Mathlib.Tactic.Ringpublic import Mathlib.Tactic.FieldSimppublic import Mathlib.Tactic.Linarithpublic import Mathlib.Tactic.FinCases /-!# Saturation of `ℤ + ℤα + ℤα²` and cyclicity of `M/ℤ[α]` Model: a quartic field `K = ℚ(α)` is identified with `ℚ⁴` through the basis `1, α, α², α³`, so`ℤ[α]` is `ℤ⁴` (`Louboutin.Z4`), and for `x ∈ V₂ = ℚ + ℚα + ℚα²` multiplication by `α` is`Louboutin.shift`. An order `M ⊇ ℤ[α]` is an additive subgroup containing `ℤ⁴`, closed under`shift` on `V₂`, of finite index over `ℤ[α]`. Neither `d₁ = 1` nor the Galois structure is used. ## Main results * `Louboutin.saturated_iff_cyclic`: `L = ℤ + ℤα + ℤα²` is saturated in `M` (`M ∩ V₂ ⊆ ℤ⁴`) iff  `M/ℤ[α]` is cyclic. ## 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 open Finset /-- `ℤ⁴` inside `ℚ⁴` (`= ℤ[α]` in the power basis). -/def Z4 : AddSubgroup (Fin 4 → ℚ) where  carrier := {x | ∀ i, ∃ n : ℤ, (n : ℚ) = x i}  zero_mem' := fun i => ⟨0, by simp⟩  add_mem' := by    intro a b ha hb i    obtain ⟨m, hm⟩ := ha i    obtain ⟨n, hn⟩ := hb i    exact ⟨m + n, by simp [hm, hn]⟩  neg_mem' := by    intro a ha i    obtain ⟨m, hm⟩ := ha i    exact ⟨-m, by simp [hm]⟩ theorem mem_Z4 {x : Fin 4 → ℚ} : x ∈ Z4 ↔ ∀ i, ∃ n : ℤ, (n : ℚ) = x i := Iff.rfl /-- Multiplication by `α` on `V₂ = {x | x 3 = 0}`. -/def shift (x : Fin 4 → ℚ) : Fin 4 → ℚ := ![0, x 0, x 1, x 2] /-- `L = ℤ + ℤα + ℤα²` is saturated in `M`: `M ∩ V₂ ⊆ ℤ⁴`. -/def Saturated (M : AddSubgroup (Fin 4 → ℚ)) : Prop := ∀ x ∈ M, x 3 = 0 → x ∈ Z4 /-- A finite cyclic group does not contain two independent elements of `p`-torsion. -/theorem not_cyclic_of_indep {G : Type*} [AddCommGroup G] [Fintype G] [IsAddCyclic G]    {p : ℕ} (hp : p.Prime) {a b : G} (ha : p • a = 0) (hb : p • b = 0)    (hind : ∀ e f : ℤ, e • a + f • b = 0 → (p : ℤ) ∣ e ∧ (p : ℤ) ∣ f) : False := by  classical  have hle := IsAddCyclic.card_nsmul_eq_zero_le (α := G) hp.pos  let F : Fin p × Fin p → G := fun ef => ((ef.1 : ℕ) : ℤ) • a + ((ef.2 : ℕ) : ℤ) • b  have hmod : ∀ u v : Fin p, (p : ℤ) ∣ ((u : ℕ) : ℤ) - ((v : ℕ) : ℤ) → u = v := by    intro u v h    have h0 := Int.eq_zero_of_abs_lt_dvd h (by      have := u.2; have := v.2      rw [abs_lt]; constructor <;> omega)    exact Fin.ext (by omega)  have hinj : Function.Injective F := by    rintro ⟨e, f⟩ ⟨e', f'⟩ h    simp only [F] at h    have h2 : (((e : ℕ) : ℤ) - ((e' : ℕ) : ℤ)) • a + (((f : ℕ) : ℤ) - ((f' : ℕ) : ℤ)) • b = 0 := by      rw [sub_smul, sub_smul, ← sub_eq_zero.mpr h]; abel    obtain ⟨h3, h4⟩ := hind _ _ h2    rw [hmod e e' h3, hmod f f' h4]  have hsub : univ.image F ⊆ ({x | p • x = 0} : Finset G) := by    intro x hx    simp only [mem_image, mem_univ, true_and] at hx    obtain ⟨⟨e, f⟩, rfl⟩ := hx    simp only [mem_filter, mem_univ, true_and, F, smul_add]    rw [smul_comm p (((e : ℕ) : ℤ)) a, smul_comm p (((f : ℕ) : ℤ)) b, ha, hb]; simp  have hcard := card_le_card hsub  rw [card_image_of_injective _ hinj, card_univ, Fintype.card_prod, Fintype.card_fin] at hcard  have h2 := hp.two_le  nlinarith [hcard.trans hle] theorem dvd_of_intCast_eq_div {p : ℕ} (hp : p.Prime) {k n : ℤ} (h : (n : ℚ) = k / p) :    (p : ℤ) ∣ k := by  have hp0 : (p : ℚ) ≠ 0 := by exact_mod_cast hp.ne_zero  refine ⟨n, ?_⟩  rw [eq_div_iff hp0] at h  exact_mod_cast (by linarith : (k : ℚ) = p * n) /-- If `γ ∈ V₂`, `pγ ∈ ℤ⁴` and `γ ∉ ℤ⁴`, then `γ` and `αγ` are independent modulo `ℤ⁴`    (and modulo `p`). -/theorem indep {p : ℕ} (hp : p.Prime) {γ : Fin 4 → ℚ} (h3 : γ 3 = 0) (hpγ : p • γ ∈ Z4)    (hγ : γ ∉ Z4) (e f : ℤ) (hef : e • γ + f • shift γ ∈ Z4) : (p : ℤ) ∣ e ∧ (p : ℤ) ∣ f := by  have hp0 : (p : ℚ) ≠ 0 := by exact_mod_cast hp.ne_zero  have hpZ : Prime (p : ℤ) := Nat.prime_iff_prime_int.mp hp  choose c hc using hpγ  have hγc : ∀ i, γ i = c i / p := by    intro i; rw [hc i]; simp [nsmul_eq_mul]; field_simp  have hnd : ¬ ∀ i, (p : ℤ) ∣ c i := by    intro hall; apply hγ; intro i    obtain ⟨k, hk⟩ := hall i    exact ⟨k, by rw [hγc i, hk]; push_cast; field_simp⟩  have hc3 : c 3 = 0 := by    have := hc 3; simp [h3] at this; exact_mod_cast this  have coord : ∀ i, ∃ n : ℤ, (n : ℚ) = e * γ i + f * shift γ i := by    intro i; obtain ⟨n, hn⟩ := hef i; exact ⟨n, by simpa using hn⟩  obtain ⟨n0, h0⟩ := coord 0  obtain ⟨n1, h1⟩ := coord 1  obtain ⟨n2, h2⟩ := coord 2  obtain ⟨n3, h3'⟩ := coord 3  simp only [shift, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two,    Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons] at h0 h1 h2 h3'  have d0 : (p : ℤ) ∣ e * c 0 := dvd_of_intCast_eq_div hp (n := n0) (by    rw [h0, hγc]; push_cast; ring)  have d1 : (p : ℤ) ∣ e * c 1 + f * c 0 := dvd_of_intCast_eq_div hp (n := n1) (by    rw [h1, hγc, hγc]; push_cast; ring)  have d2 : (p : ℤ) ∣ e * c 2 + f * c 1 := dvd_of_intCast_eq_div hp (n := n2) (by    rw [h2, hγc, hγc]; push_cast; ring)  have d3 : (p : ℤ) ∣ f * c 2 := dvd_of_intCast_eq_div hp (n := n3) (by    rw [h3', h3, hγc]; push_cast; ring)  by_cases hc2 : (p : ℤ) ∣ c 2  · by_cases hc1 : (p : ℤ) ∣ c 1    · have hc0 : ¬ (p : ℤ) ∣ c 0 := by        intro hc0; apply hnd; intro i        fin_cases i        · exact hc0        · exact hc1        · exact hc2        · simp [hc3]      have he : (p : ℤ) ∣ e := (hpZ.dvd_or_dvd d0).resolve_right hc0      have hf : (p : ℤ) ∣ f * c 0 := by        have := dvd_sub d1 (dvd_mul_of_dvd_right hc1 e); simpa using this      exact ⟨he, (hpZ.dvd_or_dvd hf).resolve_right hc0⟩    · have hf1 : (p : ℤ) ∣ f * c 1 := by        have := dvd_sub d2 (dvd_mul_of_dvd_right hc2 e); simpa using this      have hf : (p : ℤ) ∣ f := (hpZ.dvd_or_dvd hf1).resolve_right hc1      have he1 : (p : ℤ) ∣ e * c 1 := by        have := dvd_sub d1 (dvd_mul_of_dvd_left hf (c 0)); simpa using this      exact ⟨(hpZ.dvd_or_dvd he1).resolve_right hc1, hf⟩  · have hf : (p : ℤ) ∣ f := (hpZ.dvd_or_dvd d3).resolve_right hc2    have he2 : (p : ℤ) ∣ e * c 2 := by      have := dvd_sub d2 (dvd_mul_of_dvd_left hf (c 1)); simpa using this    exact ⟨(hpZ.dvd_or_dvd he2).resolve_right hc2, hf⟩ variable (M : AddSubgroup (Fin 4 → ℚ)) /-- e₃ = α³ ∈ ℤ⁴. -/theorem e3_mem : (Pi.single 3 (1 : ℚ) : Fin 4 → ℚ) ∈ Z4 := by  intro i; fin_cases i  · exact ⟨0, by simp⟩  · exact ⟨0, by simp⟩  · exact ⟨0, by simp⟩  · exact ⟨1, by simp⟩ /-- (ii) ⇒ (iv): saturated ⇒ `M/ℤ[α]` cyclic (it embeds in `ZMod N`, `N` the index). -/theorem cyclic_of_saturated (hZ : Z4 ≤ M) [hfi : (Z4.addSubgroupOf M).FiniteIndex]    (hsat : Saturated M) : IsAddCyclic (M ⧸ Z4.addSubgroupOf M) := by  set N := (Z4.addSubgroupOf M).index with hNdef  have hN : N ≠ 0 := hfi.index_ne_zero  have hNq : (N : ℚ) ≠ 0 := by exact_mod_cast hN  have hNx : ∀ x : M, ∃ k : ℤ, (k : ℚ) = N * (x : Fin 4 → ℚ) 3 := by    intro x    have := (Z4.addSubgroupOf M).nsmul_index_mem x    rw [AddSubgroup.mem_addSubgroupOf] at this    obtain ⟨k, hk⟩ := this 3    exact ⟨k, by rw [hk]; simp [nsmul_eq_mul, hNdef]⟩  let g : M →+ ZMod N :=    { toFun := fun x => (((N : ℚ) * (x : Fin 4 → ℚ) 3).num : ZMod N)      map_zero' := by simp      map_add' := by        intro x y        obtain ⟨k, hk⟩ := hNx x        obtain ⟨l, hl⟩ := hNx y        have hs : (N : ℚ) * ((x + y : M) : Fin 4 → ℚ) 3 = ((k + l : ℤ) : ℚ) := by          push_cast; rw [hk, hl]; simp [mul_add]        show (((N : ℚ) * ((x + y : M) : Fin 4 → ℚ) 3).num : ZMod N) = _        rw [hs, ← hk, ← hl, Rat.num_intCast, Rat.num_intCast, Rat.num_intCast]        push_cast; ring }  have hker : Z4.addSubgroupOf M ≤ g.ker := by    intro x hx    rw [AddSubgroup.mem_addSubgroupOf] at hx    obtain ⟨j, hj⟩ := hx 3    rw [AddMonoidHom.mem_ker]    show (((N : ℚ) * (x : Fin 4 → ℚ) 3).num : ZMod N) = 0    rw [← hj, show (N : ℚ) * (j : ℚ) = ((N * j : ℤ) : ℚ) by push_cast; ring, Rat.num_intCast]    push_cast; simp  let φ := QuotientAddGroup.lift (Z4.addSubgroupOf M) g hker  have hinj : Function.Injective φ := by    rw [injective_iff_map_eq_zero]    intro q hq    induction q using QuotientAddGroup.induction_on with    | H x =>      rw [QuotientAddGroup.lift_mk] at hq      obtain ⟨k, hk⟩ := hNx x      have hq' : (((N : ℚ) * (x : Fin 4 → ℚ) 3).num : ZMod N) = 0 := hq      rw [← hk, Rat.num_intCast, ZMod.intCast_zmod_eq_zero_iff_dvd] at hq'      obtain ⟨j, hj⟩ := hq'      have hx3 : (x : Fin 4 → ℚ) 3 = j := by        apply mul_left_cancel₀ hNq; rw [← hk, hj]; push_cast; ring      set y : Fin 4 → ℚ := (x : Fin 4 → ℚ) - j • (Pi.single 3 (1 : ℚ) : Fin 4 → ℚ) with hy      have hyM : y ∈ M := M.sub_mem x.2 (M.zsmul_mem (hZ e3_mem) j)      have hy3 : y 3 = 0 := by simp [hy, hx3]      have hyZ := hsat y hyM hy3      rw [QuotientAddGroup.eq_zero_iff, AddSubgroup.mem_addSubgroupOf]      have : (x : Fin 4 → ℚ) = y + j • (Pi.single 3 (1 : ℚ) : Fin 4 → ℚ) := by simp [hy]      rw [this]      exact Z4.add_mem hyZ (Z4.zsmul_mem e3_mem j)  exact isAddCyclic_of_injective φ hinj /-- (iv) ⇒ (ii): `M/ℤ[α]` cyclic ⇒ saturated. Uses closure under `α` on `V₂`. -/theorem saturated_of_cyclic (hsh : ∀ x ∈ M, x 3 = 0 → shift x ∈ M)    [(Z4.addSubgroupOf M).FiniteIndex] (hcyc : IsAddCyclic (M ⧸ Z4.addSubgroupOf M)) :    Saturated M := by  classical  intro x hx hx3  by_contra hxZ  have : Fintype (M ⧸ Z4.addSubgroupOf M) := Fintype.ofFinite _  let mk : M → M ⧸ Z4.addSubgroupOf M := QuotientAddGroup.mk  have mk_eq_zero : ∀ z : M, mk z = 0 ↔ (z : Fin 4 → ℚ) ∈ Z4 := by    intro z; rw [QuotientAddGroup.eq_zero_iff, AddSubgroup.mem_addSubgroupOf]  set xb := mk ⟨x, hx⟩ with hxb  have hxb0 : xb ≠ 0 := fun h => hxZ ((mk_eq_zero _).mp h)  set o := addOrderOf xb  have ho0 : 0 < o := addOrderOf_pos xb  have ho1 : o ≠ 1 := fun h => hxb0 (AddMonoid.addOrderOf_eq_one_iff.mp h)  obtain ⟨p, hp, hpo⟩ := Nat.exists_prime_and_dvd ho1  obtain ⟨r, hr⟩ := hpo  have hr0 : 0 < r := by    rcases Nat.eq_zero_or_pos r with h | h    · rw [h] at hr; omega    · exact h  set γ : Fin 4 → ℚ := r • x with hγ  have hγM : γ ∈ M := M.nsmul_mem hx r  have hγ3 : γ 3 = 0 := by simp [hγ, hx3]  have hpγ : p • γ ∈ Z4 := by    have : mk ⟨p • γ, M.nsmul_mem hγM p⟩ = o • xb := by      rw [hr, hxb, ← QuotientAddGroup.mk_nsmul]; congr 1; ext1; simp [hγ, mul_smul]    exact (mk_eq_zero _).mp (this.trans (addOrderOf_nsmul_eq_zero xb))  have hγZ : γ ∉ Z4 := by    intro h    have h0 : r • xb = 0 := by      rw [hxb, ← QuotientAddGroup.mk_nsmul]; exact (mk_eq_zero _).mpr h    have := addOrderOf_dvd_of_nsmul_eq_zero h0    have hle : o ≤ r := Nat.le_of_dvd hr0 this    have := hp.two_le    rw [hr] at hle; nlinarith  have hshM : shift γ ∈ M := hsh γ hγM hγ3  have hpsh : p • shift γ ∈ Z4 := by    intro i    obtain ⟨c0, h0⟩ := hpγ 0    obtain ⟨c1, h1⟩ := hpγ 1    obtain ⟨c2, h2⟩ := hpγ 2    fin_cases i    · exact ⟨0, by simp [shift]⟩    · exact ⟨c0, by simpa [shift] using h0⟩    · exact ⟨c1, by simpa [shift] using h1⟩    · exact ⟨c2, by simpa [shift] using h2⟩  apply not_cyclic_of_indep (G := M ⧸ Z4.addSubgroupOf M) hp    (a := mk ⟨γ, hγM⟩) (b := mk ⟨shift γ, hshM⟩)  · rw [← QuotientAddGroup.mk_nsmul, mk_eq_zero]; exact hpγ  · rw [← QuotientAddGroup.mk_nsmul, mk_eq_zero]; exact hpsh  · intro e f hef    rw [← QuotientAddGroup.mk_zsmul, ← QuotientAddGroup.mk_zsmul, ← QuotientAddGroup.mk_add,      mk_eq_zero] at hef    exact indep hp hγ3 hpγ hγZ e f hef /-- (ii) ⇔ (iv) for every order `M ⊇ ℤ[α]` of rank 4. -/theorem saturated_iff_cyclic (hZ : Z4 ≤ M) (hsh : ∀ x ∈ M, x 3 = 0 → shift x ∈ M)    [(Z4.addSubgroupOf M).FiniteIndex] :    Saturated M ↔ IsAddCyclic (M ⧸ Z4.addSubgroupOf M) :=  ⟨cyclic_of_saturated M hZ, saturated_of_cyclic M hsh⟩ end Louboutin