/-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, Claude (AI assistant)-/module public import Formalizations.NumberTheory.NumericalSemigroup.GapBoundpublic import Mathlib.Algebra.BigOperators.Finpublic import Mathlib.Tactic.LinearCombination /-!# The defect delta = 2 does not occur at n = 4, h = 1 For a centred spectrum of four elements of a field K (char not 2, 3) with e_3 != 0 (the consequenceof trivial stabiliser h = 1), Newton's identities give M_2 = 0 => M_5 = 0 and M_3 = 3 e_3. With thegenerating rule S = <e, {0<j<e | M_j != 0}> (P3b.genSet), e >= 4 and e + 1 prime (so e != 5), M_2 =0 makes 1, 2, 5 gaps (genus >= 3), and M_2 != 0 gives genus < 2 via two_le_genus_iff; hence genus !=2. Implicit hypotheses made explicit: h = 1 => e_3 != 0 is taken as hypothesis he3 (stabiliser notformalised); finiteness of the gap set; e + 1 prime is needed to exclude e = 5, where <3,4,5> wouldhave genus 2. Not formalised: the derivation of the generating rule (Part I) and of e_3 != 0 from h= 1. ## Main results * `P3b.pow4_five_eq_zero`: Centred, M_2 = 0 implies M_5 = 0 for four elements (char != 2).* `P3b.pow4_three_eq`: Centred: M_3 = 3 e_3.* `P3b.genus_ne_two_of_four`: At n = 4, h = 1 the genus of S_T is never 2. ## References * C. Marín, *The order generated by a column of the SU(n)ₖ S-matrix is locally a numerical semigroup ring (Part II)*, Zenodo (2026), doi:10.5281/zenodo.22864267, `prop:n4`.-/ @[expose] public section open P3a namespace P3b /-- Power sum `M_k` of a 4-element spectrum. -/def pow4 {K : Type*} [Field K] (t : Fin 4 → K) (k : ℕ) : K := ∑ i, t i ^ k /-- The third elementary symmetric function of four elements. -/def esymm3 {K : Type*} [Field K] (t : Fin 4 → K) : K := t 0 * t 1 * t 2 + t 0 * t 1 * t 3 + t 0 * t 2 * t 3 + t 1 * t 2 * t 3 /-- Newton cascade: centred, `M₂ = 0 ⇒ M₅ = 0` (char `≠ 2`). -/theorem pow4_five_eq_zero {K : Type*} [Field K] (h2 : (2 : K) ≠ 0) (t : Fin 4 → K) (h1 : pow4 t 1 = 0) (hM2 : pow4 t 2 = 0) : pow4 t 5 = 0 := by simp only [pow4, Fin.sum_univ_four, pow_one] at * have : (2 : K) * (t 0 ^ 5 + t 1 ^ 5 + t 2 ^ 5 + t 3 ^ 5) = 0 := by linear_combination (2 * (t 0 ^ 4 + t 1 ^ 4 + t 2 ^ 4 + t 3 ^ 4) - (t 0 + t 1 + t 2 + t 3) * (t 0 ^ 3 + t 1 ^ 3 + t 2 ^ 3 + t 3 ^ 3) - 2 * (t 0 * t 1 * t 2 * t 3)) * h1 + ((t 0 ^ 3 + t 1 ^ 3 + t 2 ^ 3 + t 3 ^ 3) + 2 * (t 0 * t 1 * t 2 + t 0 * t 1 * t 3 + t 0 * t 2 * t 3 + t 1 * t 2 * t 3)) * hM2 exact (mul_eq_zero.mp this).resolve_left h2 /-- Centred: `M₃ = 3 e₃`. -/theorem pow4_three_eq {K : Type*} [Field K] (h2 : (2 : K) ≠ 0) (t : Fin 4 → K) (h1 : pow4 t 1 = 0) : pow4 t 3 = 3 * esymm3 t := by simp only [pow4, esymm3, Fin.sum_univ_four, pow_one] at * have : (2 : K) * ((t 0 ^ 3 + t 1 ^ 3 + t 2 ^ 3 + t 3 ^ 3) - 3 * (t 0 * t 1 * t 2 + t 0 * t 1 * t 3 + t 0 * t 2 * t 3 + t 1 * t 2 * t 3)) = 0 := by linear_combination (3 * (t 0 ^ 2 + t 1 ^ 2 + t 2 ^ 2 + t 3 ^ 2) - (t 0 + t 1 + t 2 + t 3) ^ 2) * h1 have := (mul_eq_zero.mp this).resolve_left h2 exact sub_eq_zero.mp this /-- **Proposition `prop:n4`**: at `n = 4`, `h = 1` the defect `δ = 2` does not occur. -/theorem genus_ne_two_of_four {K : Type*} [Field K] (h2 : (2 : K) ≠ 0) (h3 : (3 : K) ≠ 0) (t : Fin 4 → K) {e : ℕ} (he : 4 ≤ e) (hp : (e + 1).Prime) (h1 : pow4 t 1 = 0) (he3 : esymm3 t ≠ 0) (hfin : (gaps (genSet e (fun j => pow4 t j = 0))).Finite) : genus (genSet e (fun j => pow4 t j = 0)) ≠ 2 := by have he5 : e ≠ 5 := by rintro rfl; exact absurd hp (by decide) by_cases hM2 : pow4 t 2 = 0 · have hM5 := pow4_five_eq_zero h2 t h1 hM2 have hnot : ∀ x ∈ AddSubmonoid.closure (genSet e (fun j => pow4 t j = 0)), x ≠ 1 ∧ x ≠ 2 ∧ x ≠ 5 := by intro x hx refine closure_sub_of (fun x => x ≠ 1 ∧ x ≠ 2 ∧ x ≠ 5) (by omega) (fun x y hx hy => by omega) (fun a ha => ?_) hx rcases ha with rfl | ⟨_, _, ha⟩ · omega · refine ⟨?_, ?_, ?_⟩ <;> rintro rfl <;> contradiction have hsub : ({1, 2, 5} : Set ℕ) ⊆ gaps (genSet e (fun j => pow4 t j = 0)) := by intro x hx simp only [gaps, Set.mem_ofPred_eq] intro hc have := hnot x hc rcases hx with rfl | rfl | rfl <;> omega have : ({1, 2, 5} : Set ℕ).ncard ≤ genus (genSet e (fun j => pow4 t j = 0)) := Set.ncard_le_ncard hsub hfin have hc : ({1, 2, 5} : Set ℕ).ncard = 3 := by rw [Set.ncard_eq_toFinset_card']; rfl omega · have hM3 : pow4 t 3 ≠ 0 := by rw [pow4_three_eq h2 t h1]; exact mul_ne_zero h3 he3 have := two_le_genus_iff (V := fun j => pow4 t j = 0) he h1 hfin have hlt : ¬ 2 ≤ genus (genSet e (fun j => pow4 t j = 0)) := by rw [this]; tauto omega end P3b