πŸ›οΈ Atlasβœ’οΈFormalizations.AlgebraicGeometry.SegrePersistence.SegreBSR view on GitHub β†—11 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, Claude (AI assistant)-/module -- encaje: nΓΊcleo de la cota superior del Teorema 2 (qp(P^{m-1} Γ— P^3) ≀ ⌈4m/3βŒ‰) de la nota qp_bsr.public import Mathlib.Algebra.Polynomial.RuleOfSignspublic import Mathlib.LinearAlgebra.Matrix.NonsingularInversepublic import Mathlib.Data.Fintype.EquivFinpublic import Mathlib.Basic.Real.Basicpublic import Mathlib.Tactic.FinCasespublic import Mathlib.Tactic.Ring /-!# Descartes' rule and the linear algebra behind `qp(β„™^{m-1} Γ— β„™Β³) ≀ ⌈4m/3βŒ‰` This file formalizes the linear-algebra core of the upper bound in Theorem 2 ofC. MarΓ­n, *Quadratic persistence of Segre varieties and a linear gap between biquadratic SOS rankand Zarankiewicz bounds* (2026). With `b x = (1, x, xΒ³)`: any three `b x` at distinct positivenodes are independent, any six symmetric squares `b x βŠ— b x` are independent, and thecoefficients `c i j` attached to one group, or to two disjoint groups `U, V`, satisfying therelations `βˆ‘_{j ∈ S} c i j β€’ b j ∈ ℝ β€’ b i` (equation (grupo) of the note) all vanish. Everything is over `ℝ`, with arbitrary distinct positive real nodes (the note uses the integers`1, …, m`, a special case). ## Main results * `SegrePersistence.signVariations_lt_card_support`: a nonzero real polynomial has fewer sign  variations than nonzero coefficients.* `SegrePersistence.monomial_combination_eq_zero`: a combination of `k` distinct monomials  vanishing at `β‰₯ k` distinct positive nodes is zero (Descartes' rule of signs,  `Polynomial.roots_countP_pos_le_signVariations`).* `SegrePersistence.pow_linearIndependent`: the vectors `(t i ^ e j)_j`, for at most `k` distinct  positive nodes `t i` and `k` distinct exponents `e j`, are linearly independent.* `SegrePersistence.descartes_six`, `SegrePersistence.three_independent`: the instances with  exponents `{0,1,2,3,4,6}` and `{0,1,3}`.* `SegrePersistence.group_vanish`: inside one group (at most three nodes) the relations force  `c i j = 0` for `j β‰  i`.* `SegrePersistence.cross_vanish`: the key step for two disjoint groups `U, V`. ## What is not covered The identification of `π’Ÿ` with `β‹€Β²A* βŠ— β‹€Β²B*`, the factorization`D_{ij} = c_{ij} vol(b_i, b_j, Β·, Β·)` and the derivation of the relations (grupo) from the radicalconditions (hence the statement `qp ≀ ⌈4m/3βŒ‰` itself), and the lower bound of Theorem 2, are notformalized here.-/ @[expose] public section open Polynomial Finset namespace SegrePersistence /-- A nonzero real polynomial has strictly fewer sign variations than nonzero coefficients. -/theorem signVariations_lt_card_support (P : ℝ[X]) (hP : P β‰  0) :    P.signVariations < P.support.card := by  classical  have hlen : ((P.coeffList.map SignType.sign).filter (Β· β‰  0)).length = P.support.card := by    have hq : P.support = ((List.range (P.natDegree + 1)).filter        (fun i => decide (SignType.sign (P.coeff i) β‰  0))).toFinset := by      ext i      simp only [mem_support_iff, List.mem_toFinset, List.mem_filter, List.mem_range,        decide_eq_true_eq, ne_eq, sign_eq_zero_iff]      exact ⟨fun h => ⟨Nat.lt_succ_of_le (le_natDegree_of_ne_zero h), h⟩, fun h => h.2⟩    rw [hq, List.toFinset_card_of_nodup (List.nodup_range.filter _), coeffList_of_ne_zero hP,      List.map_map, List.filter_map, List.length_map, List.filter_reverse, List.length_reverse]    rfl  have hpos : 0 < P.support.card := Finset.card_pos.mpr (Polynomial.support_nonempty.mpr hP)  have h1 : P.signVariations ≀ ((P.coeffList.map SignType.sign).filter (Β· β‰  0)).length - 1 := by    unfold Polynomial.signVariations List.signVariations    exact Nat.sub_le_sub_right (List.destutter_sublist _ _).length_le 1  omega /-- **Descartes, monomial form.** A combination of distinct monomials `X ^ e j` that vanishes atat least as many distinct positive nodes as it has monomials is zero. -/theorem monomial_combination_eq_zero {ΞΉ ΞΊ : Type*} [Fintype ΞΉ] [Fintype ΞΊ]    (t : ΞΉ β†’ ℝ) (ht : Function.Injective t) (hpos : βˆ€ i, 0 < t i)    (e : ΞΊ β†’ β„•) (he : Function.Injective e) (hcard : Fintype.card ΞΊ ≀ Fintype.card ΞΉ)    (c : ΞΊ β†’ ℝ) (h : βˆ€ i, βˆ‘ j, c j * t i ^ e j = 0) : c = 0 := by  classical  set P : ℝ[X] := βˆ‘ j, C (c j) * X ^ e j with hPdef  have hcoeff : βˆ€ j, P.coeff (e j) = c j := by    intro j    rw [hPdef, finsetSum_coeff, Finset.sum_eq_single j]    Β· simp    Β· intro b _ hb      have hne : Β¬ e j = e b := fun hh => hb (he hh.symm)      simp only [coeff_C_mul_X_pow, hne, ↓reduceIte]    Β· intro hj; exact absurd (Finset.mem_univ j) hj  have heval : βˆ€ i, P.eval (t i) = 0 := by    intro i    simp [hPdef, eval_finsetSum, h i]  by_contra hc  have hP : P β‰  0 := by    intro h0; apply hc; funext j; rw [← hcoeff j, h0]; simp  have hsupp : P.support βŠ† Finset.univ.image e := by    intro n hn    rw [mem_support_iff] at hn    by_contra hn'    apply hn    rw [hPdef, finsetSum_coeff]    refine Finset.sum_eq_zero fun j _ => ?_    have hne : Β¬ n = e j := by      rintro rfl      exact hn' (Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩)    simp only [coeff_C_mul_X_pow, hne, ↓reduceIte]  have hsc : P.support.card ≀ Fintype.card ΞΊ :=    (Finset.card_le_card hsupp).trans (Finset.card_image_le.trans (by simp))  have hroots : Fintype.card ΞΉ ≀ P.roots.countP (0 < Β·) := by    rw [Multiset.countP_eq_card_filter]    calc Fintype.card ΞΉ = (Finset.univ.image t).card := by          rw [Finset.card_image_of_injective _ ht]; simp      _ ≀ (P.roots.filter (0 < Β·)).toFinset.card := by          apply Finset.card_le_card          intro x hx          obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hx          simp [Multiset.mem_toFinset, mem_roots hP, hpos i, heval i]      _ ≀ _ := Multiset.toFinset_card_le _  have h1 := roots_countP_pos_le_signVariations P  have h2 := signVariations_lt_card_support P hP  omega /-- Dual form: at most `k` distinct positive nodes and `k` distinct exponents, a combination ofthe nodes killed by every exponent is zero. -/theorem pow_dual {ΞΉ ΞΊ : Type*} [Fintype ΞΉ] [Fintype ΞΊ] [DecidableEq ΞΉ]    (t : ΞΉ β†’ ℝ) (ht : Function.Injective t) (hpos : βˆ€ i, 0 < t i)    (e : ΞΊ β†’ β„•) (he : Function.Injective e) (hcard : Fintype.card ΞΉ ≀ Fintype.card ΞΊ)    (a : ΞΉ β†’ ℝ) (h : βˆ€ j, βˆ‘ i, a i * t i ^ e j = 0) : a = 0 := by  obtain ⟨f⟩ := Function.Embedding.nonempty_of_card_le hcard  let M : Matrix ΞΉ ΞΉ ℝ := fun i i' => t i ^ e (f i')  have hinj : Function.Injective M.mulVec := by    intro x y hxy    have hd : M.mulVec (x - y) = 0 := by rw [Matrix.mulVec_sub, hxy, sub_self]    have := monomial_combination_eq_zero t ht hpos (e ∘ f) (he.comp f.injective) le_rfl (x - y)      (fun i => by        have := congrFun hd i        simp only [Matrix.mulVec, dotProduct, M, Pi.zero_apply] at this        rw [← this]        exact Finset.sum_congr rfl fun j _ => by simp [mul_comm])    exact sub_eq_zero.mp this  have hv := Matrix.vecMul_injective_iff_isUnit.mpr (Matrix.mulVec_injective_iff_isUnit.mp hinj)  apply hv  show Matrix.vecMul a M = Matrix.vecMul 0 M  rw [Matrix.zero_vecMul]  funext i'  exact h (f i') /-- **Generalized Vandermonde independence.** For at most `k` distinct positive nodes `t i` and`k` distinct exponents `e j`, the vectors `(t i ^ e j)_j` are linearly independent. -/theorem pow_linearIndependent {ΞΉ ΞΊ : Type*} [Fintype ΞΉ] [Fintype ΞΊ]    (t : ΞΉ β†’ ℝ) (ht : Function.Injective t) (hpos : βˆ€ i, 0 < t i)    (e : ΞΊ β†’ β„•) (he : Function.Injective e) (hcard : Fintype.card ΞΉ ≀ Fintype.card ΞΊ) :    LinearIndependent ℝ (fun i : ΞΉ => fun j : ΞΊ => t i ^ e j) := by  classical  rw [Fintype.linearIndependent_iff]  intro g hg i  have := pow_dual t ht hpos e he hcard g (fun j => by    have := congrFun hg j    simpa [Finset.sum_apply] using this)  exact congrFun this i /-- Finset form of `pow_dual`. -/theorem pow_dual_finset {Ξ± ΞΊ : Type*} [Fintype ΞΊ] (W : Finset Ξ±) (t : Ξ± β†’ ℝ)    (ht : Set.InjOn t W) (hpos : βˆ€ x ∈ W, 0 < t x)    (e : ΞΊ β†’ β„•) (he : Function.Injective e) (hcard : W.card ≀ Fintype.card ΞΊ)    (a : Ξ± β†’ ℝ) (h : βˆ€ j, βˆ‘ x ∈ W, a x * t x ^ e j = 0) : βˆ€ x ∈ W, a x = 0 := by  classical  have := pow_dual (ΞΉ := W) (fun x => t x) (fun x y hxy => Subtype.ext (ht x.2 y.2 hxy))    (fun x => hpos x x.2) e he (by simpa using hcard) (fun x => a x)    (fun j => by rw [Finset.sum_coe_sort W (fun x => a x * t x ^ e j)]; exact h j)  intro x hx  exact congrFun this ⟨x, hx⟩ /-- **Six symmetric monomials.** For distinct positive nodes, the vectors`(1, t, tΒ², tΒ³, t⁴, t⁢)` are linearly independent in `ℝ⁢`. -/theorem descartes_six (t : Fin 6 β†’ ℝ) (ht : Function.Injective t) (hpos : βˆ€ i, 0 < t i) :    LinearIndependent ℝ (fun i => ![1, t i, t i ^ 2, t i ^ 3, t i ^ 4, t i ^ 6]) := by  have := pow_linearIndependent t ht hpos (![0, 1, 2, 3, 4, 6] : Fin 6 β†’ β„•) (by decide) le_rfl  convert this using 1  funext i j  fin_cases j <;> simp /-- **Three monomials.** For distinct positive nodes, the vectors `(1, t, tΒ³)` are linearlyindependent in `ℝ³`. -/theorem three_independent (t : Fin 3 β†’ ℝ) (ht : Function.Injective t) (hpos : βˆ€ i, 0 < t i) :    LinearIndependent ℝ (fun i => ![1, t i, t i ^ 3]) := by  have := pow_linearIndependent t ht hpos (![0, 1, 3] : Fin 3 β†’ β„•) (by decide) le_rfl  convert this using 1  funext i j  fin_cases j <;> simp /-- The vector `b x = (1, x, xΒ³)` of the note. -/def b (x : ℝ) : Fin 3 β†’ ℝ := ![1, x, x ^ 3] /-- The symmetric square `b x βŠ— b x`, as a `3 Γ— 3` array. -/def sq (x : ℝ) : Fin 3 β†’ Fin 3 β†’ ℝ := fun p q => b x p * b x q /-- At most three distinct positive nodes: the `b x` are independent (finset form). -/theorem b_independent (S : Finset ℝ) (hpos : βˆ€ x ∈ S, 0 < x) (hS : S.card ≀ 3)    (a : ℝ β†’ ℝ) (h : βˆ‘ x ∈ S, a x β€’ b x = 0) : βˆ€ x ∈ S, a x = 0 := by  refine pow_dual_finset S id (Set.injOn_id _) hpos (![0, 1, 3] : Fin 3 β†’ β„•) (by decide)    (by simpa using hS) a fun j => ?_  have := congrFun h j  rw [Finset.sum_apply] at this  refine (Finset.sum_congr rfl fun x _ => ?_).trans this  fin_cases j <;> simp [b] /-- At most six distinct positive nodes: the `b x βŠ— b x` are independent (finset form). -/theorem sq_independent (S : Finset ℝ) (hpos : βˆ€ x ∈ S, 0 < x) (hS : S.card ≀ 6)    (a : ℝ β†’ ℝ) (h : βˆ‘ x ∈ S, a x β€’ sq x = 0) : βˆ€ x ∈ S, a x = 0 := by  refine pow_dual_finset S id (Set.injOn_id _) hpos (![0, 1, 2, 3, 4, 6] : Fin 6 β†’ β„•) (by decide)    (by simpa using hS) a fun j => ?_  have key : βˆ€ p q : Fin 3, βˆ‘ x ∈ S, a x * (b x p * b x q) = 0 := by    intro p q    have := congrFun (congrFun h p) q    rw [Finset.sum_apply, Finset.sum_apply, Pi.zero_apply, Pi.zero_apply] at this    rw [← this]    simp [sq]  fin_cases j  Β· refine (Finset.sum_congr rfl fun x _ => ?_).trans (key 0 0); congr 1; simp [b]  Β· refine (Finset.sum_congr rfl fun x _ => ?_).trans (key 0 1); congr 1  Β· refine (Finset.sum_congr rfl fun x _ => ?_).trans (key 1 1); congr 1; simp [b]; ring  Β· refine (Finset.sum_congr rfl fun x _ => ?_).trans (key 0 2); congr 1; simp [b]  Β· refine (Finset.sum_congr rfl fun x _ => ?_).trans (key 1 2); congr 1; simp [b]; ring  Β· refine (Finset.sum_congr rfl fun x _ => ?_).trans (key 2 2); congr 1; simp [b]; ring /-- **Vanishing inside a group.** If `S` has at most three distinct positive nodes and, for every`i ∈ S`, `βˆ‘_{j ∈ S} c i j β€’ b j ∈ ℝ β€’ b i`, then `c i j = 0` for `i β‰  j` in `S`. -/theorem group_vanish (S : Finset ℝ) (hpos : βˆ€ x ∈ S, 0 < x) (hS : S.card ≀ 3)    (c : ℝ β†’ ℝ β†’ ℝ) (h : βˆ€ i ∈ S, βˆƒ l : ℝ, βˆ‘ j ∈ S, c i j β€’ b j = l β€’ b i) :    βˆ€ i ∈ S, βˆ€ j ∈ S, j β‰  i β†’ c i j = 0 := by  classical  intro i hi j hj hji  obtain ⟨l, hl⟩ := h i hi  have hsum : βˆ‘ k ∈ S, (c i k - if k = i then l else 0) β€’ b k = 0 := by    simp only [sub_smul, Finset.sum_sub_distrib, ite_smul, zero_smul, Finset.sum_ite_eq' S i,      hi, ↓reduceIte, hl, sub_self]  have := b_independent S hpos hS _ hsum j hj  simpa [hji] using this /-- **The key step of Theorem 2 (upper bound).** Let `U, V` be disjoint groups of at most threedistinct positive nodes and `c i j` (for `i ∈ U`, `j ∈ V`) real coefficients such that`βˆ‘_{j ∈ V} c i j β€’ b j ∈ ℝ β€’ b i` for every `i ∈ U` and `βˆ‘_{i ∈ U} c i j β€’ b i ∈ ℝ β€’ b j` for every`j ∈ V`. Then all `c i j` vanish. -/theorem cross_vanish (U V : Finset ℝ) (hUV : Disjoint U V) (hpos : βˆ€ x ∈ U βˆͺ V, 0 < x)    (hU : U.card ≀ 3) (hV : V.card ≀ 3) (c : ℝ β†’ ℝ β†’ ℝ)    (hrow : βˆ€ i ∈ U, βˆƒ l : ℝ, βˆ‘ j ∈ V, c i j β€’ b j = l β€’ b i)    (hcol : βˆ€ j ∈ V, βˆƒ m : ℝ, βˆ‘ i ∈ U, c i j β€’ b i = m β€’ b j) :    βˆ€ i ∈ U, βˆ€ j ∈ V, c i j = 0 := by  classical  choose! l hl using hrow  choose! m hm using hcol  have hl' : βˆ€ i ∈ U, βˆ€ q, βˆ‘ j ∈ V, c i j * b j q = l i * b i q := by    intro i hi q    have := congrFun (hl i hi) q    simpa [Finset.sum_apply] using this  have hm' : βˆ€ j ∈ V, βˆ€ p, βˆ‘ i ∈ U, c i j * b i p = m j * b j p := by    intro j hj p    have := congrFun (hm j hj) p    simpa [Finset.sum_apply] using this  -- `T = βˆ‘ c i j b i βŠ— b j` written in two ways  have key : βˆ€ p q : Fin 3,      βˆ‘ i ∈ U, l i * (b i p * b i q) = βˆ‘ j ∈ V, m j * (b j p * b j q) := by    intro p q    calc βˆ‘ i ∈ U, l i * (b i p * b i q)        = βˆ‘ i ∈ U, b i p * βˆ‘ j ∈ V, c i j * b j q :=          Finset.sum_congr rfl fun i hi => by rw [hl' i hi q]; ring      _ = βˆ‘ i ∈ U, βˆ‘ j ∈ V, c i j * b i p * b j q :=          Finset.sum_congr rfl fun i _ => by            rw [Finset.mul_sum]; exact Finset.sum_congr rfl fun j _ => by ring      _ = βˆ‘ j ∈ V, βˆ‘ i ∈ U, c i j * b i p * b j q := Finset.sum_comm      _ = βˆ‘ j ∈ V, b j q * βˆ‘ i ∈ U, c i j * b i p :=          Finset.sum_congr rfl fun j _ => by            rw [Finset.mul_sum]; exact Finset.sum_congr rfl fun i _ => by ring      _ = βˆ‘ j ∈ V, m j * (b j p * b j q) :=          Finset.sum_congr rfl fun j hj => by rw [hm' j hj p]; ring  -- the at most six squares `b x βŠ— b x`, `x ∈ U βˆͺ V`, are independent  set a : ℝ β†’ ℝ := fun x => if x ∈ U then l x else -m x with ha  have hsum : βˆ‘ x ∈ U βˆͺ V, a x β€’ sq x = 0 := by    funext p q    rw [Finset.sum_apply, Finset.sum_apply, Finset.sum_union hUV]    have hU' : βˆ‘ x ∈ U, (a x β€’ sq x) p q = βˆ‘ x ∈ U, l x * (b x p * b x q) :=      Finset.sum_congr rfl fun x hx => by simp [ha, hx, sq]    have hV' : βˆ‘ x ∈ V, (a x β€’ sq x) p q = -βˆ‘ x ∈ V, m x * (b x p * b x q) := by      rw [← Finset.sum_neg_distrib]      exact Finset.sum_congr rfl fun x hx => by        simp [ha, Finset.disjoint_right.mp hUV hx, sq]    rw [hU', hV', key p q]    simp  have hcard : (U βˆͺ V).card ≀ 6 := (Finset.card_union_le U V).trans (by omega)  have hzero := sq_independent (U βˆͺ V) hpos hcard a hsum  intro i hi  have hli : l i = 0 := by    have := hzero i (Finset.mem_union_left V hi)    simpa [ha, hi] using this  have hrow0 : βˆ‘ j ∈ V, c i j β€’ b j = 0 := by rw [hl i hi, hli, zero_smul]  exact b_independent V (fun x hx => hpos x (Finset.mem_union_right U hx)) hV (c i) hrow0 end SegrePersistence