/-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.RingTheory.Polynomial.CoefficientRing.StableIntervalspublic import Mathlib.Algebra.Polynomial.Divpublic import Mathlib.Algebra.Polynomial.Coeffpublic import Mathlib.Algebra.Ring.Subring.Basicpublic import Mathlib.Algebra.BigOperators.Group.Finset.Basicpublic import Mathlib.Algebra.BigOperators.Ring.Finsetpublic import Mathlib.Algebra.Field.Basicpublic import Mathlib.Tactic.Ringpublic import Mathlib.Tactic.LinearCombination /-!# Residual coefficients of `(X β 1)(X^r β 1)^N` and `(X^r β 1)^N /β (X β 1)` Over any commutative ring, for `r β₯ 3` and `N β₯ 1`:* `P = (X β 1)(X^r β 1)^N` (degree `L = N r + 1`) has `coeff P (L β 1) = β1` and `coeff P (L β 2) = 0`;* `Q = (X^r β 1)^N /β (X β 1)` (degree `L = N r β 1`, an exact quotient) has `coeff Q (L β 1) = coeff Q (L β 2) = 1`.Together with the identities `NotaPuente.lemma_5_5` this gives `Οβ β A` when `a1Β² β a2` is a unitof the subring `A`, and `Οβ β A` when `a2` is. The passage from "residue `1` modulo the radical" to "unit of the local order", and theidentification of `a1`, `a2` with the elementary symmetric functions of the roots of `P` or `Q`modulo the radical, are not formalized here. ## Main results * `NotaPuente.Residues.coeff_P`, `NotaPuente.Residues.coeff_Q`: the two top coefficients.* `NotaPuente.Residues.residue_P`, `NotaPuente.Residues.residue_Q`: `e1Β² β e2 = 1`, resp. `e2 = 1`.* `NotaPuente.Residues.mem_of_mul_eq`: `d Ο = n`, `n β A`, `d` a unit of `A` β `Ο β A`.* `NotaPuente.Residues.tau_plus_mem`, `NotaPuente.Residues.tau_minus_mem`. ## References * C. MarΓn, *Non-real orders of character values of `GL(n)`*, preprint (2026).* C. MarΓn, *The ring of character values depends only on the segment: SU(n), Sp(2m) and GL(n) at a torsion element*, Zenodo (2026), doi:10.5281/zenodo.22847476.-/ @[expose] public section namespace NotaPuente.Residues open Polynomial section Coeffs variable {R : Type*} [CommRing R] /-- Top coefficients of `(X^r - 1)^N`: for `N r < k + r`, the coefficient is `1` at `k = N r`, else `0`(i.e. `(X^r - 1)^N = X^(N r) + (terms of degree β€ N r - r)`). -/lemma coeff_pow_top {r : β} (hr : 1 β€ r) (N : β) : β k, N * r < k + r β ((X ^ r - 1 : R[X]) ^ N).coeff k = if k = N * r then 1 else 0 := by induction N with | zero => intro k _; simp [coeff_one] | succ N ih => intro k hk rw [add_one_mul] at hk β’ have hk0 : ((X ^ r - 1 : R[X]) ^ N).coeff k = 0 := by rw [ih k (by omega), ite_eq_right (by omega)] rw [pow_succ, mul_sub, mul_one, coeff_sub, coeff_mul_X_pow', hk0] by_cases hrk : r β€ k Β· rw [ite_eq_left hrk, ih (k - r) (by omega), sub_zero] exact if_congr (by omega) rfl rfl Β· rw [ite_eq_right hrk, ite_eq_right (by omega), sub_zero] lemma natDegree_pow_le' {r : β} (hr : 1 β€ r) (N : β) : ((X ^ r - 1 : R[X]) ^ N).natDegree β€ N * r := natDegree_le_iff_coeff_eq_zero.mpr fun k hk => by rw [coeff_pow_top hr N k (by omega), ite_eq_right (by omega)] /-- **Lemma 5.6 (i), case `L = N r + 1`.** For `P = (X - 1)(X^r - 1)^N`, `r β₯ 3`, `N β₯ 1`:`coeff P L = 1`, `coeff P (L-1) = -1`, `coeff P (L-2) = 0`, with `L - 1 = N r`, `L - 2 = N r - 1`.So `e1 = -coeff P (L-1) = 1`, `e2 = coeff P (L-2) = 0`. -/theorem coeff_P {r N : β} (hr : 3 β€ r) (hN : 1 β€ N) : ((X - 1) * (X ^ r - 1 : R[X]) ^ N).coeff (N * r + 1) = 1 β§ ((X - 1) * (X ^ r - 1 : R[X]) ^ N).coeff (N * r) = -1 β§ ((X - 1) * (X ^ r - 1 : R[X]) ^ N).coeff (N * r - 1) = 0 := by have hNr : 3 β€ N * r := le_trans hr (Nat.le_mul_of_pos_left r hN) obtain β¨a, haβ© : β a, N * r = a + 2 := β¨N * r - 2, by omegaβ© have F := coeff_pow_top (R := R) (r := r) (by omega) N rw [ha, show a + 2 - 1 = a + 1 by omega, sub_mul, one_mul, coeff_sub, coeff_sub, coeff_sub, coeff_X_mul, coeff_X_mul, coeff_X_mul, F (a + 2) (by omega), F (a + 1) (by omega), F (a + 3) (by omega), F a (by omega), ha] simp /-- `(X - 1) * ((X^r - 1)^N /β (X - 1)) = (X^r - 1)^N` for `N β₯ 1` (exact division). -/lemma mul_divByMonic_pow {r N : β} (hN : 1 β€ N) : (X - 1) * ((X ^ r - 1 : R[X]) ^ N /β (X - 1)) = (X ^ r - 1) ^ N := by have h := (mul_divByMonic_eq_iff_isRoot (p := (X ^ r - 1 : R[X]) ^ N) (a := 1)).mpr (by simp [IsRoot, eval_pow, zero_pow (by omega : N β 0)]) rwa [C_1] at h /-- **Lemma 5.6 (i), case `L = N r - 1`.** For `Q = (X^r - 1)^N /β (X - 1)`, `r β₯ 3`, `N β₯ 1`:`coeff Q L = 1`, `coeff Q (L-1) = 1`, `coeff Q (L-2) = 1`, with `L = N r - 1`.So `e1 = -coeff Q (L-1) = -1`, `e2 = coeff Q (L-2) = 1`. -/theorem coeff_Q {r N : β} (hr : 3 β€ r) (hN : 1 β€ N) : ((X ^ r - 1 : R[X]) ^ N /β (X - 1)).coeff (N * r - 1) = 1 β§ ((X ^ r - 1 : R[X]) ^ N /β (X - 1)).coeff (N * r - 2) = 1 β§ ((X ^ r - 1 : R[X]) ^ N /β (X - 1)).coeff (N * r - 3) = 1 := by nontriviality R have hNr : 3 β€ N * r := le_trans hr (Nat.le_mul_of_pos_left r hN) obtain β¨a, haβ© : β a, N * r = a + 3 := β¨N * r - 3, by omegaβ© set Q := (X ^ r - 1 : R[X]) ^ N /β (X - 1) with hQdef have F := coeff_pow_top (R := R) (r := r) (by omega) N have hQ := mul_divByMonic_pow (R := R) (r := r) hN rw [β hQdef] at hQ -- `coeff Q k = 0` for `k β₯ N r` have hdeg : Q.natDegree β€ a + 2 := by have h1 := natDegree_divByMonic ((X ^ r - 1 : R[X]) ^ N) (monic_X_sub_C (1 : R)) rw [natDegree_X_sub_C, C_1, β hQdef] at h1 have h2 := natDegree_pow_le' (R := R) (r := r) (by omega) N omega have hQ3 : Q.coeff (a + 3) = 0 := coeff_eq_zero_of_natDegree_lt (by omega) -- `coeff F (k+1) = coeff Q k - coeff Q (k+1)` have hrec : β k, ((X ^ r - 1 : R[X]) ^ N).coeff (k + 1) = Q.coeff k - Q.coeff (k + 1) := by intro k rw [β hQ, sub_mul, one_mul, coeff_sub, coeff_X_mul] have e3 := hrec (a + 2) have e2 := hrec (a + 1) have e1 := hrec a rw [F (a + 2 + 1) (by omega), ite_eq_left (by omega), hQ3] at e3 rw [F (a + 1 + 1) (by omega), ite_eq_right (by omega)] at e2 rw [F (a + 1) (by omega), ite_eq_right (by omega)] at e1 rw [ha, show a + 3 - 1 = a + 2 by omega, show a + 3 - 2 = a + 1 by omega, show a + 3 - 3 = a by omega] refine β¨by linear_combination -e3, by linear_combination -e3 - e2, by linear_combination -e3 - e2 - e1β© /-- **Lemma 5.6 (ii)**, case `L = N r + 1`: `e1Β² - e2 = 1`, with `e1 = -coeff P (L-1)`,`e2 = coeff P (L-2)`. -/theorem residue_P {r N : β} (hr : 3 β€ r) (hN : 1 β€ N) : (-((X - 1) * (X ^ r - 1 : R[X]) ^ N).coeff (N * r)) ^ 2 - ((X - 1) * (X ^ r - 1 : R[X]) ^ N).coeff (N * r - 1) = 1 := by obtain β¨-, h1, h2β© := coeff_P (R := R) hr hN rw [h1, h2]; ring /-- **Lemma 5.6 (ii)**, case `L = N r - 1`: `e2 = coeff Q (L-2) = 1` (and `e1Β² - e2 = 0`). -/theorem residue_Q {r N : β} (hr : 3 β€ r) (hN : 1 β€ N) : ((X ^ r - 1 : R[X]) ^ N /β (X - 1)).coeff (N * r - 3) = 1 β§ (-((X ^ r - 1 : R[X]) ^ N /β (X - 1)).coeff (N * r - 2)) ^ 2 - ((X ^ r - 1 : R[X]) ^ N /β (X - 1)).coeff (N * r - 3) = 0 := by obtain β¨-, h1, h2β© := coeff_Q (R := R) hr hN rw [h1, h2]; constructor <;> ring end Coeffs /-! ## Lemma 5.6 (iii): the algebraic step -/ /-- If `d Ο = n` with `n β A` and `d` a unit of the subring `A` (`e β A`, `e d = 1`), then `Ο β A`. -/theorem mem_of_mul_eq {S : Type*} [CommRing S] (A : Subring S) {d e Ο n : S} (he : e β A) (hed : e * d = 1) (hn : n β A) (h : d * Ο = n) : Ο β A := by have : Ο = e * n := by rw [β h, β mul_assoc, hed, one_mul] rw [this]; exact A.mul_mem he hn /-! ## Lemma 5.5 `a1`, `a2` and `lemma_5_5` are those of`Formalizations.RingTheory.Polynomial.CoefficientRing.StableIntervals` (namespace `NotaPuente`). -/ section Tau variable {K : Type*} [Field K] /-- **Lemma 5.6 (iii), `Οβ`.** If `a1, a2 β A` and `a1Β² - a2` is a unit of `A`, then`Οβ = t^(L-1) + t^(-(L-1)) β A`. -/theorem tau_plus_mem (A : Subring K) {t : K} (ht : t β 0) {L : β} (hL : 2 β€ L) (h1 : a1 t L β A) (h2 : a2 t L β A) {e : K} (he : e β A) (hu : e * (a1 t L ^ 2 - a2 t L) = 1) : t ^ ((L : β€) - 1) + t ^ (-((L : β€) - 1)) β A := by refine mem_of_mul_eq A he hu ?_ (lemma_5_5 ht hL).1 have h2' : (2 : K) * a2 t L β A := by rw [two_mul]; exact A.add_mem h2 h2 exact A.mul_mem h1 (A.sub_mem (A.add_mem A.one_mem (A.pow_mem h1 2)) h2') /-- **Lemma 5.6 (iii), `Οβ`.** If `a1, a2 β A` and `a2` is a unit of `A`, then`Οβ = t^(L+1) + t^(-(L+1)) β A`. -/theorem tau_minus_mem (A : Subring K) {t : K} (ht : t β 0) {L : β} (hL : 2 β€ L) (h1 : a1 t L β A) (h2 : a2 t L β A) {e : K} (he : e β A) (hu : e * a2 t L = 1) : t ^ ((L : β€) + 1) + t ^ (-((L : β€) + 1)) β A := by refine mem_of_mul_eq A he hu ?_ (lemma_5_5 ht hL).2 have h2' : (2 : K) * a2 t L β A := by rw [two_mul]; exact A.add_mem h2 h2 exact A.mul_mem h1 (A.sub_mem (A.sub_mem (A.pow_mem h1 2) h2') A.one_mem) end Tau end NotaPuente.Residues