/-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.LinearAlgebra.Matrix.Gershgorinpublic import Mathlib.Data.Matrix.Basispublic import Mathlib.Data.ZMod.Defspublic import Mathlib.RingTheory.Adjoin.Basicpublic import Mathlib.Data.Rat.Cast.CharZeropublic import Mathlib.Tactic.FinCases /-!# The linear algebra behind the atoms of the size chain Linear-algebra core of the atom criterion for the `4d Γ 4d` pencil `π` of the size chain(Lemma 6.2(c)). The pencil is an atom when the coefficient matrices `π’, π£` generate thefull matrix algebra and `π£` and `π€ = π£ β 1 β π’Β²` are invertible. This file proves these threefacts for the two families used in the paper: * `π£_d = diag(3, 4, β¦, d + 2)` and the cyclic permutation matrix `π’_d` (`(π’_d)_{i, i+1} = 1`, indices mod `d`), for every `d β₯ 1`, over any field of characteristic `0`;* `π£ = diag(Ξ», Ξ» + 1)` and the swap `π’ = π’_2` (the matrices of `F^{(Ξ»)}`), over any field. That a diagonal matrix with distinct eigenvalues and the cyclic permutation matrix generate thefull matrix algebra is a classical fact (Lagrange interpolation gives the diagonal matrix units,and the cycle moves them around); it is proved here only because we did not find it in Mathlib.The invertibility of `π€_d` uses Mathlib's Gershgorin theorem (`det_ne_zero_of_sum_row_lt_diag`):`π€_d` is strictly diagonally dominant over `β`, and the statement is transferred to any field ofcharacteristic `0` through `Rat.castHom`. The step "these conditions imply that the pencil is an atom" is Cohn's Theorem 5.8.8 (in the formof HeltonβKlepβVolΔiΔ, Remark 2.6); it is not formalized here. ## Main results * `ThreeAxes.SizeChain.adjoin_cyc_diagonal_eq_top`: if `v` is injective, then `Algebra.adjoin K {cyc K d, diagonal v} = β€`.* `adjoin_cyc_diagD_eq_top`: `π’_d` and `π£_d` generate `M_d(K)` (characteristic `0`).* `det_diagD_ne_zero`, `det_matE_ne_zero`: `π£_d` and `π€_d = π£_d β 1 β π’_dΒ²` are invertible (characteristic `0`).* `adjoin_swap_diagLam_eq_top`: `π’_2` and `diag(Ξ», Ξ» + 1)` generate `M_2(K)`.* `det_diagLam_ne_zero_and_iff`: `diag(Ξ», Ξ»+1)` and `diag(Ξ», Ξ»+1) β 1 β π’_2Β²` are both invertible iff `Ξ» β {β1, 0, 1, 2}`. ## References * P. M. Cohn, *Free ideal rings and localization in general rings*, Cambridge Univ. Press, 2006, Theorem 5.8.8.* J. W. Helton, I. Klep, J. VolΔiΔ, *Factorization of noncommutative polynomials and NullstellensΓ€tze for the free algebra*, IMRN 2022, Remark 2.6.-/ @[expose] public section namespace ThreeAxes.SizeChain open Matrix /-- The cyclic permutation matrix `π’_d`: `(π’_d)_{i, i+1} = 1`, indices mod `d`. -/def cyc (K : Type*) [Zero K] [One K] (d : β) [NeZero d] : Matrix (Fin d) (Fin d) K := of fun i j => if j = i + 1 then 1 else 0 /-- `π£_d = diag(3, 4, β¦, d + 2)`. -/def diagD (K : Type*) [CommRing K] (d : β) : Matrix (Fin d) (Fin d) K := diagonal fun i => ((i : β) : K) + 3 /-- `π€_d = π£_d β 1 β π’_dΒ²`. -/def matE (K : Type*) [CommRing K] (d : β) [NeZero d] : Matrix (Fin d) (Fin d) K := diagD K d - 1 - cyc K d * cyc K d section Generation variable {K : Type*} [Field K] {n : Type*} [Fintype n] [DecidableEq n] /-- A diagonal matrix with distinct eigenvalues generates every diagonal matrix unit(Lagrange interpolation). -/theorem single_mem_adjoin_diagonal {v : n β K} (hv : Function.Injective v) (i : n) : single i i (1 : K) β Algebra.adjoin K {diagonal v} := by set S := Algebra.adjoin K {diagonal v} set c : K := β j β Finset.univ.erase i, (v i - v j) have hc : c β 0 := Finset.prod_ne_zero_iff.2 fun j hj => sub_ne_zero.2 fun h => (Finset.ne_of_mem_erase hj) (hv h).symm have hfac : β j, diagonal v - algebraMap K (Matrix n n K) (v j) β S := fun j => S.sub_mem (Algebra.subset_adjoin rfl) (S.algebraMap_mem _) have h1 : β j, diagonal v - algebraMap K (Matrix n n K) (v j) = diagonal fun k => v k - v j := by intro j ext a b by_cases hab : a = b <;> simp [algebraMap_eq_diagonal, hab] have key : β s : Finset n, (diagonal fun k => β j β s, (v k - v j)) β S := by intro s induction s using Finset.induction_on with | empty => simp [S.one_mem] | insert a s ha ih => have e : (diagonal fun k => β j β insert a s, (v k - v j)) = (diagonal v - algebraMap K (Matrix n n K) (v a)) * diagonal fun k => β j β s, (v k - v j) := by rw [h1 a, diagonal_mul_diagonal] congr 1 ext k rw [Finset.prod_insert ha] rw [e] exact S.mul_mem (hfac a) ih have hmem := key (Finset.univ.erase i) have heq : single i i (1 : K) = cβ»ΒΉ β’ diagonal fun k => β j β Finset.univ.erase i, (v k - v j) := by ext a b by_cases hab : a = b Β· subst hab by_cases hai : i = a Β· subst hai simp [c, hc] Β· have hz : β j β Finset.univ.erase i, (v a - v j) = 0 := Finset.prod_eq_zero (Finset.mem_erase.2 β¨Ne.symm hai, Finset.mem_univ aβ©) (sub_self _) simp [single, hai, hz] Β· have h0 : single i i (1 : K) a b = 0 := by simp only [single, of_apply] split_ifs with h Β· exact absurd (h.1.symm.trans h.2) hab Β· rfl rw [h0, Matrix.smul_apply, diagonal_apply_ne _ hab, smul_zero] rw [heq] exact S.smul_mem hmem _ variable {d : β} [NeZero d] open Fin.NatCast in/-- A diagonal matrix with distinct eigenvalues and the cyclic permutation matrix generate thefull matrix algebra. Classical; see the module docstring. -/theorem adjoin_cyc_diagonal_eq_top {v : Fin d β K} (hv : Function.Injective v) : Algebra.adjoin K {cyc K d, diagonal v} = β€ := by set S := Algebra.adjoin K {cyc K d, diagonal v} have hD : β i, single i i (1 : K) β S := fun i => Algebra.adjoin_mono (Set.subset_insert _ _) (single_mem_adjoin_diagonal hv i) have hC : cyc K d β S := Algebra.subset_adjoin (Set.mem_insert _ _) have hstep : β i : Fin d, single i (i + 1) (1 : K) β S := by intro i have h := S.mul_mem (S.mul_mem (hD i) hC) (hD (i + 1)) simpa [cyc] using h have hpow : β (m : β) (i : Fin d), single i (i + (m : Fin d)) (1 : K) β S := by intro m induction m with | zero => intro i; simpa using hD i | succ m ih => intro i have h := S.mul_mem (ih i) (hstep (i + (m : Fin d))) rwa [single_mul_single_same, one_mul, add_assoc, β Nat.cast_succ] at h have hall : β i j : Fin d, single i j (1 : K) β S := by intro i j have h := hpow (j - i).val i rwa [Fin.cast_val_eq_self, add_sub_cancel] at h rw [eq_top_iff] intro M _ rw [matrix_eq_sum_single M] refine S.sum_mem fun i _ => S.sum_mem fun j _ => ?_ have h := S.smul_mem (hall i j) (M i j) rwa [smul_single, smul_eq_mul, mul_one] at h end Generation /-! ### The family `π£_d = diag(3, β¦, d + 2)`, `π’_d` -/ section Family variable (K : Type*) [Field K] [CharZero K] (d : β) [NeZero d] omit [NeZero d] intheorem diagD_injective : Function.Injective fun i : Fin d => ((i : β) : K) + 3 := by intro i j h exact Fin.ext (Nat.cast_injective (add_right_cancel h)) /-- `π’_d` and `π£_d` generate `M_d(K)`. -/theorem adjoin_cyc_diagD_eq_top : Algebra.adjoin K {cyc K d, diagD K d} = β€ := adjoin_cyc_diagonal_eq_top (diagD_injective K d) omit [NeZero d] in/-- `π£_d` is invertible. -/theorem det_diagD_ne_zero : (diagD K d).det β 0 := by rw [diagD, det_diagonal] exact Finset.prod_ne_zero_iff.2 fun i _ => by exact_mod_cast Nat.succ_ne_zero (i + 2) theorem cyc_mul_cyc_apply {R : Type*} [CommRing R] (i j : Fin d) : (cyc R d * cyc R d) i j = if j = i + 1 + 1 then 1 else 0 := by rw [mul_apply, Finset.sum_eq_single (i + 1)] Β· simp [cyc] Β· intro b _ hb simp [cyc, hb] Β· simp /-- Strict diagonal dominance of `π€_d` over `β`: Mathlib's Gershgorin theorem`det_ne_zero_of_sum_row_lt_diag`. -/theorem det_matE_real_ne_zero : (matE β d).det β 0 := by refine det_ne_zero_of_sum_row_lt_diag (A := matE β d) fun k => ?_ have hoff : β j β Finset.univ.erase k, βmatE β d k jβ = if k + 1 + 1 = j then 1 else 0 := by intro j hj have hkj : k β j := (Finset.ne_of_mem_erase hj).symm simp only [matE, diagD, Matrix.sub_apply, cyc_mul_cyc_apply, diagonal_apply_ne _ hkj, one_apply_ne hkj, zero_sub] by_cases h : j = k + 1 + 1 Β· simp [h] Β· simp [h, Ne.symm h] rw [Finset.sum_congr rfl hoff, Finset.sum_ite_eq] simp only [matE, diagD, Matrix.sub_apply, cyc_mul_cyc_apply, diagonal_apply_eq, one_apply_eq, Real.norm_eq_abs] have h0 : (0 : β) β€ (k : β) := by positivity by_cases h : k = k + 1 + 1 Β· have hk : k + 1 + 1 β Finset.univ.erase k := by simp [β h] rw [ite_eq_right_of_eq_false _ _ (eq_false hk), ite_eq_left_of_eq_true _ _ (eq_true h), abs_of_pos (by linarith)] linarith Β· have hk : k + 1 + 1 β Finset.univ.erase k := by simp [Ne.symm h] rw [ite_eq_left_of_eq_true _ _ (eq_true hk), ite_eq_right_of_eq_false _ _ (eq_false h), abs_of_pos (by linarith)] linarith theorem mapMatrix_matE : (Rat.castHom K).mapMatrix (matE β d) = matE K d := by have hc : (Rat.castHom K).mapMatrix (cyc β d) = cyc K d := by ext i j by_cases h : j = i + 1 <;> simp [cyc, h] have hd : (Rat.castHom K).mapMatrix (diagD β d) = diagD K d := by ext i j by_cases hij : i = j <;> simp [diagD, hij] simp only [matE, map_sub, map_mul, map_one, hc, hd] theorem det_matE_rat_ne_zero : (matE β d).det β 0 := by intro h apply det_matE_real_ne_zero d rw [β mapMatrix_matE β d, β RingHom.map_det, h, map_zero] /-- `π€_d = π£_d β 1 β π’_dΒ²` is invertible over every field of characteristic `0`. -/theorem det_matE_ne_zero : (matE K d).det β 0 := by rw [β mapMatrix_matE, β RingHom.map_det] exact (map_ne_zero (Rat.castHom K)).2 (det_matE_rat_ne_zero d) end Family /-! ### The matrices of `F^{(Ξ»)}` -/ section Lambda variable {K : Type*} [Field K] /-- For `d = 2`, `π’_2` is the swap. -/theorem cyc_two : cyc K 2 = !![0, 1; 1, 0] := by ext i j fin_cases i <;> fin_cases j <;> simp [cyc] theorem cyc_two_mul_self : cyc K 2 * cyc K 2 = 1 := by rw [cyc_two] ext i j fin_cases i <;> fin_cases j <;> simp [mul_apply, Fin.sum_univ_two] /-- `π’_2` (the swap) and `diag(Ξ», Ξ» + 1)` generate `M_2(K)`, for every `Ξ»`. -/theorem adjoin_swap_diagLam_eq_top (l : K) : Algebra.adjoin K {cyc K 2, diagonal ![l, l + 1]} = β€ := by refine adjoin_cyc_diagonal_eq_top ?_ intro i j h fin_cases i <;> fin_cases j <;> simp_all /-- `diag(Ξ», Ξ» + 1)` and `π€ = diag(Ξ», Ξ» + 1) β 1 β π’_2Β² = diag(Ξ», Ξ» + 1) β 2` are both invertibleiff `Ξ» β {β1, 0, 1, 2}`. -/theorem det_diagLam_ne_zero_and_iff (l : K) : (diagonal ![l, l + 1]).det β 0 β§ (diagonal ![l, l + 1] - 1 - cyc K 2 * cyc K 2).det β 0 β l β -1 β§ l β 0 β§ l β 1 β§ l β 2 := by have hE : diagonal ![l, l + 1] - 1 - cyc K 2 * cyc K 2 = diagonal ![l - 2, l - 1] := by rw [cyc_two_mul_self] ext i j fin_cases i <;> fin_cases j <;> simp [one_apply] ring rw [hE, det_diagonal, det_diagonal, Fin.prod_univ_two, Fin.prod_univ_two] simp only [Matrix.cons_val_zero, Matrix.cons_val_one, mul_ne_zero_iff, sub_ne_zero, ne_eq, add_eq_zero_iff_eq_neg] tauto end Lambda end ThreeAxes.SizeChain