From e0a3dd195d56cd29198ee3b3d611e0e59e706f3a Mon Sep 17 00:00:00 2001 From: Per Alexandersson Date: Mon, 23 Nov 2026 00:26:26 +0000 Subject: [PATCH] =?UTF-8?q?Ferrers=20hit=20polynomials=20are=20real-rooted?= =?UTF-8?q?=20(Haglund=E2=80=93Ono=E2=80=93Wagner)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- RealRooted.lean | 3 + .../Matrices/MonotoneColumnPermanent.lean | 27 ++- RealRooted/FerrersHit/Basic.lean | 121 +++++++++++ RealRooted/FerrersHit/Roots.lean | 202 ++++++++++++++++++ RealRooted/Production.lean | 3 + .../Transforms/BrandenE/IntegerFactors.lean | 136 ++++++++++++ docs/WORKHORSES.md | 10 +- scripts/import_architecture.json | 4 +- 8 files changed, 496 insertions(+), 10 deletions(-) create mode 100644 RealRooted/FerrersHit/Basic.lean create mode 100644 RealRooted/FerrersHit/Roots.lean create mode 100644 RealRooted/Transforms/BrandenE/IntegerFactors.lean diff --git a/RealRooted.lean b/RealRooted.lean index 0c4dba8d2..8fd858b7a 100644 --- a/RealRooted.lean +++ b/RealRooted.lean @@ -623,6 +623,8 @@ public import RealRooted.Favard.Affine.RowSign public import RealRooted.Favard.Orthogonality public import RealRooted.Favard.PathEnvelope public import RealRooted.Favard.Recurrence +public import RealRooted.FerrersHit.Basic +public import RealRooted.FerrersHit.Roots public import RealRooted.FiniteFreeAdditive public import RealRooted.FiniteFreeAdditive.HalfInteger public import RealRooted.FiniteFreeAdditive.HalfIntegerConvolution @@ -1711,6 +1713,7 @@ public import RealRooted.Transforms.BrandenE.Basic public import RealRooted.Transforms.BrandenE.BasisImage public import RealRooted.Transforms.BrandenE.Delannoy public import RealRooted.Transforms.BrandenE.EvenBinomial +public import RealRooted.Transforms.BrandenE.IntegerFactors public import RealRooted.Transforms.BrandenE.IntervalPreserver public import RealRooted.Transforms.BrandenE.Inverse public import RealRooted.Transforms.BrandenE.OrderedBell diff --git a/RealRooted/Challenges/Matrices/MonotoneColumnPermanent.lean b/RealRooted/Challenges/Matrices/MonotoneColumnPermanent.lean index a51434af6..12ea1a88c 100644 --- a/RealRooted/Challenges/Matrices/MonotoneColumnPermanent.lean +++ b/RealRooted/Challenges/Matrices/MonotoneColumnPermanent.lean @@ -1,5 +1,6 @@ module +import RealRooted.FerrersHit.Roots import RealRooted.Permanent.Basic import RealRooted.Permanent.Ferrers import RealRooted.Permanent.MonotoneColumn @@ -88,6 +89,17 @@ label = "Monotone column permanent theorem: per(zJ + A) is real-rooted for monot name = "RealRooted.Permanent.diagonalPermanent_coeff_card" module = "RealRooted.Permanent.Basic" label = "The leading coefficient of per(zJ + A) is n!" +[[definitions]] +name = "RealRooted.FerrersHit.hitPolynomial" +module = "RealRooted.FerrersHit.Basic" +label = "Standard rook-to-hit transform" + +[[theorems]] +objects = ["Hit polynomials of Ferrers boards"] +property = "real-rooted" +name = "RealRooted.FerrersHit.hitPolynomial_ne_zero_and_splits" +module = "RealRooted.FerrersHit.Roots" +label = "Ferrers hit polynomials are nonzero and real-rooted" --> @@ -114,9 +126,18 @@ deletion recurrence in terms of smaller Ferrers matrices. ## Use -For a zero-one matrix the permanent $\operatorname{per}(zJ+A)$ is a rook-type polynomial, so the -theorem contains the real-rootedness of many rook and hit polynomials. It is one of the main -applications of [real stability](rr:real-stability). +For a zero-one matrix the permanent $\operatorname{per}(zJ+A)$ is a rook-type polynomial. +The height-based rook-to-hit transform is also formalized directly: if +$0\le h_1\le\cdots\le h_n\le n$, we define $r_k$ by +$\sum_k r_k(x)_{n-k}=\prod_i(x+h_i-i+1)$ and set +$H(t)=\sum_k r_k(n-k)!(t-1)^k$. Then $H$ is nonzero and real-rooted +[@HaglundOnoWagner1999, Thm. 1]. This algebraic definition does not require a +rook-placement counting model. + +The hit-polynomial proof uses the Brändén E transform of the factorial product, +integer level crossings, and endpoint multiplicity. It is independent of the +permanent counting identities. The E image has all its roots in $[-1,0]$; +bounded reversal and a shift yield $H$. ## Proof diff --git a/RealRooted/FerrersHit/Basic.lean b/RealRooted/FerrersHit/Basic.lean new file mode 100644 index 000000000..3cfe2dd19 --- /dev/null +++ b/RealRooted/FerrersHit/Basic.lean @@ -0,0 +1,121 @@ +module + +public import RealRooted.Mathlib.RingTheory.Polynomial.Pochhammer +public import RealRooted.Transforms.BrandenE.Inverse +public import RealRooted.Mathlib.Algebra.Polynomial.Reverse +import Mathlib.Tactic +import RealRooted.Mathlib.Algebra.Polynomial.Chow + +/-! +# Ferrers rook numbers and the rook-to-hit transform + +We use the algebraic normalization of the Goldman--Joichi--White factorization: +the rook numbers are the reversed coordinates of the column-height product in +the descending-Pochhammer basis. No counting model is assumed. + +The hit transform is the one on page 2 of Haglund--Ono--Wagner, +*Theorems and conjectures involving rook polynomials with only real zeros* +(1999). Their Theorem 1 asserts real-rootedness for Ferrers boards. +-/ + +@[expose] public section + +open Polynomial +open scoped BigOperators + +namespace RealRooted.FerrersHit + +noncomputable section + +/-- Weakly increasing column heights of a board in the `n × n` square. -/ +def IsFerrers {n : ℕ} (h : Fin n → ℕ) : Prop := + Monotone h ∧ ∀ i, h i ≤ n + +/-- The Goldman--Joichi--White column-height product, indexed from zero. -/ +def factorialPolynomial {n : ℕ} (h : Fin n → ℕ) : ℝ[X] := + ∏ i, (X + C ((h i : ℝ) - (i : ℕ))) + +/-- Algebraic rook numbers, defined by the falling-factorial coordinates. +For a Ferrers board these are the standard Goldman--Joichi--White rook numbers. -/ +def rookNumber {n : ℕ} (h : Fin n → ℕ) (k : ℕ) : ℝ := + if k ≤ n then (descPochhammerBasis ℝ).repr (factorialPolynomial h) (n - k) else 0 + +/-- The standard rook-to-hit transform. -/ +def hitPolynomial {n : ℕ} (h : Fin n → ℕ) : ℝ[X] := + ∑ k ∈ Finset.range (n + 1), + C (rookNumber h k * ((n - k).factorial : ℝ)) * (X - 1) ^ k + +/-- The height product is monic of degree `n`. -/ +theorem factorialPolynomial_monic_natDegree {n : ℕ} (h : Fin n → ℕ) : + (factorialPolynomial h).Monic ∧ (factorialPolynomial h).natDegree = n := by + have hm : ∀ i : Fin n, (X + C ((h i : ℝ) - (i : ℕ))).Monic := + fun _ => monic_X_add_C _ + refine ⟨monic_prod_of_monic _ _ (fun i _ => hm i), ?_⟩ + change (∏ i, (X + C ((h i : ℝ) - (i : ℕ)))).natDegree = n + rw [natDegree_prod_of_monic _ _ (fun i _ => hm i)] + simp only [natDegree_X_add_C] + simp + +/-- The finite falling-factorial expansion of the column-height product. -/ +theorem factorialPolynomial_eq_sum {n : ℕ} (h : Fin n → ℕ) : + factorialPolynomial h = ∑ j ∈ Finset.range (n + 1), + C ((descPochhammerBasis ℝ).repr (factorialPolynomial h) j) * + descPochhammer ℝ j := by + let b := descPochhammerBasis ℝ + have hbound : ∀ j, n < j → b.repr (factorialPolynomial h) j = 0 := + natDegree_le_iff_repr_descPochhammerBasis.mp + (factorialPolynomial_monic_natDegree h).2.le + have hexp := b.linearCombination_repr (factorialPolynomial h) + rw [Finsupp.linearCombination_apply] at hexp + rw [Finsupp.sum_of_support_subset _ (s := Finset.range (n + 1))] at hexp + · simpa [b, smul_eq_C_mul] using hexp.symm + · intro j hj + have hjne := Finsupp.mem_support_iff.mp hj + simpa only [Finset.mem_range, Nat.lt_succ_iff] using + le_of_not_gt (fun hjgt => hjne (hbound j hjgt)) + · intros + simp + +/-- **Goldman--Joichi--White factorization**, with rook numbers defined by +the falling-factorial formula rather than by rook-placement bijections. -/ +theorem sum_rookNumber_descPochhammer {n : ℕ} (h : Fin n → ℕ) : + (∑ k ∈ Finset.range (n + 1), + C (rookNumber h k) * descPochhammer ℝ (n - k)) = + ∏ i, (X + C ((h i : ℝ) - (i : ℕ))) := by + rw [← factorialPolynomial, factorialPolynomial_eq_sum] + rw [← Finset.sum_range_reflect (fun j => + C ((descPochhammerBasis ℝ).repr (factorialPolynomial h) j) * + descPochhammer ℝ j) (n + 1)] + apply Finset.sum_congr rfl + intro k hk + have hk' : k ≤ n := by simpa using hk + simp [rookNumber, hk'] + +/-- Brändén's E transform of the factorial product is the factorial-weighted, +reversed rook polynomial. -/ +theorem brandenE_factorialPolynomial {n : ℕ} (h : Fin n → ℕ) : + brandenE (factorialPolynomial h) = + ∑ j ∈ Finset.range (n + 1), + C ((descPochhammerBasis ℝ).repr (factorialPolynomial h) j * + (j.factorial : ℝ)) * X ^ j := by + conv_lhs => rw [factorialPolynomial_eq_sum] + rw [brandenE_finset_sum] + apply Finset.sum_congr rfl + intro j _ + rw [brandenE_C_mul, brandenE_descPochhammer, ← mul_assoc, ← C_mul] + +/-- The hit polynomial is a shift of a bounded reversal of the E transform. -/ +theorem hitPolynomial_eq_reflect_comp {n : ℕ} (h : Fin n → ℕ) : + hitPolynomial h = + (reflect n (brandenE (factorialPolynomial h))).comp (X - 1) := by + rw [brandenE_factorialPolynomial, reflect_finset_sum_C_mul, sum_comp] + conv_rhs => rw [← Finset.sum_range_reflect] + apply Finset.sum_congr rfl + intro k hk + have hk' : k ≤ n := by simpa using hk + simp [rookNumber, hk', reflect_monomial, + revAt_le (Nat.sub_le n k), Nat.sub_sub_self hk'] + +end + +end RealRooted.FerrersHit diff --git a/RealRooted/FerrersHit/Roots.lean b/RealRooted/FerrersHit/Roots.lean new file mode 100644 index 000000000..31b23f0cb --- /dev/null +++ b/RealRooted/FerrersHit/Roots.lean @@ -0,0 +1,202 @@ +module + +public import RealRooted.FerrersHit.Basic +import RealRooted.Transforms.BrandenE.IntegerFactors +import TauCeti.Order.SuccPred.IntermediateValue +import Mathlib.Order.SuccPred.Int +import Mathlib.Tactic + +/-! +# Real-rooted hit polynomials of Ferrers boards + +This is Haglund--Ono--Wagner (1999), Theorem 1 (page 3). We use an algebraic +proof through the Goldman--Joichi--White product. Its integer parameters have +no gaps between their extrema: the first is nonnegative, the last is at most +one, and each downward step has size at most one. Tau Ceti's discrete +intermediate value theorem supplies the consecutive block. The E transform +is then rooted in `[-1, 0]`, by endpoint multiplicity. Reversal and a shift +give the standard rook-to-hit transform. +-/ + +public section + +open Polynomial +open scoped BigOperators + +namespace RealRooted.FerrersHit + +noncomputable section + +private def parameters {n : ℕ} (h : Fin n → ℕ) : Multiset ℤ := + Finset.univ.val.map fun i => (h i : ℤ) - (i : ℕ) + +private theorem mem_parameters {n : ℕ} (h : Fin n → ℕ) (c : ℤ) : + c ∈ parameters h ↔ ∃ i, (h i : ℤ) - (i : ℕ) = c := by + simp [parameters] + +private theorem integerFactorProduct_parameters {n : ℕ} (h : Fin n → ℕ) : + integerFactorProduct (parameters h) = factorialPolynomial h := by + simp [integerFactorProduct, parameters, Function.comp_def, + factorialPolynomial, Finset.prod] + +/-- A finite descending crossing of a level by the GJW parameters attains +that level: monotone heights permit downward jumps of size at most one. -/ +private theorem parameter_crossing {n : ℕ} (h : Fin n → ℕ) (hh : Monotone h) + (i j : Fin n) (hij : i ≤ j) (c : ℤ) + (hi : c ≤ (h i : ℤ) - (i : ℕ)) (hj : (h j : ℤ) - (j : ℕ) ≤ c) : + c ∈ parameters h := by + let f : ℕ → ℤ := fun k => if hk : k < n then -((h ⟨k, hk⟩ : ℤ) - k) else 0 + have hstep : ∀ k, (i : ℕ) ≤ k → k < (j : ℕ) → f (k + 1) ≤ Order.succ (f k) := by + intro k _ hk + have hk' : k < n := lt_trans hk j.isLt + have hks : k + 1 < n := by lia + have hmono := hh (show (⟨k, hk'⟩ : Fin n) ≤ ⟨k + 1, hks⟩ by simp) + have hmono' : (h ⟨k, hk'⟩ : ℤ) ≤ (h ⟨k + 1, hks⟩ : ℤ) := by + exact_mod_cast hmono + dsimp [f] + simp only [dite_eq_left hk', dite_eq_left hks] + change -((h ⟨k + 1, hks⟩ : ℤ) - (k + 1 : ℕ)) ≤ + -((h ⟨k, hk'⟩ : ℤ) - k) + 1 + push_cast + lia + obtain ⟨k, hk, heq⟩ := Nat.exists_mem_Icc_eq_of_le_succ + (f := f) (y := -c) hij hstep (by simpa [f, i.isLt] using neg_le_neg hi) + (by simpa [f, j.isLt] using neg_le_neg hj) + have hkn : k < n := lt_of_le_of_lt hk.2 j.isLt + apply (mem_parameters h c).mpr + refine ⟨⟨k, hkn⟩, ?_⟩ + simpa [f, hkn] using congrArg Neg.neg heq + +private theorem parameters_no_gaps {n : ℕ} (h : Fin n → ℕ) (hh : IsFerrers h) + (hn : n ≠ 0) (c : ℤ) + (hlo : ∃ i, (h i : ℤ) - (i : ℕ) ≤ c) + (hhi : ∃ i, c ≤ (h i : ℤ) - (i : ℕ)) : + c ∈ parameters h := by + let first : Fin n := ⟨0, Nat.pos_of_ne_zero hn⟩ + let last : Fin n := ⟨n - 1, by lia⟩ + by_cases hc : c ≤ 0 + · obtain ⟨i, hi⟩ := hlo + exact parameter_crossing h hh.1 first i + (by change (0 : ℕ) ≤ (i : ℕ); exact Nat.zero_le _) c + (by dsimp [first]; simp only [sub_zero]; lia) hi + · obtain ⟨i, hi⟩ := hhi + apply parameter_crossing h hh.1 i last (by dsimp [last]; exact_mod_cast (by lia)) c hi + have hh_last := hh.2 last + have hc' : 1 ≤ c := by lia + dsimp [last] at hh_last ⊢ + exact_mod_cast (show (h ⟨n - 1, by lia⟩ : ℤ) - (n - 1 : ℕ) ≤ c by + have hh' : (h ⟨n - 1, by lia⟩ : ℤ) ≤ (n : ℤ) := by exact_mod_cast hh_last + have hn' : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by lia + lia) + +private theorem integerFactorInterval_nodup (m b : ℕ) : + (integerFactorInterval m b).Nodup := by + rw [integerFactorInterval, Multiset.nodup_add] + refine ⟨Multiset.Nodup.map (by intro i j hij; exact_mod_cast neg_injective hij) + (Multiset.nodup_range m), + Multiset.Nodup.map (by intro i j hij; exact_mod_cast (by lia : (i : ℤ) = j)) + (Multiset.nodup_range b), ?_⟩ + rw [Multiset.disjoint_left] + intro c hc hc' + obtain ⟨i, -, rfl⟩ := Multiset.mem_map.mp hc + obtain ⟨j, -, hji⟩ := Multiset.mem_map.mp hc' + lia + +private theorem exists_parameter_block {n : ℕ} (h : Fin n → ℕ) (hh : IsFerrers h) + (hn : n ≠ 0) : + ∃ m b : ℕ, integerFactorInterval m b ≤ parameters h ∧ + ∀ c ∈ parameters h, 1 - (m : ℤ) ≤ c ∧ c ≤ b := by + classical + let s := (parameters h).toFinset + have hne : s.Nonempty := by + refine ⟨(h ⟨0, Nat.pos_of_ne_zero hn⟩ : ℤ), ?_⟩ + simpa [s, mem_parameters] using + (show ∃ i : Fin n, (h i : ℤ) - (i : ℕ) = h ⟨0, Nat.pos_of_ne_zero hn⟩ from + ⟨⟨0, Nat.pos_of_ne_zero hn⟩, by simp⟩) + let l := s.min' hne + let u := s.max' hne + have hl : l ∈ parameters h := by simpa [s, l] using s.min'_mem hne + have hu : u ∈ parameters h := by simpa [s, u] using s.max'_mem hne + have hl_one : l ≤ 1 := by + have hm : (h ⟨n - 1, by lia⟩ : ℤ) - (n - 1 : ℕ) ∈ s := by + simp only [s, Multiset.mem_toFinset, mem_parameters] + exact ⟨⟨n - 1, by lia⟩, rfl⟩ + have hmin := s.min'_le _ hm + have hb := hh.2 ⟨n - 1, by lia⟩ + have hb' : (h ⟨n - 1, by lia⟩ : ℤ) ≤ (n : ℤ) := by exact_mod_cast hb + have hn' : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by lia + dsimp [l] + lia + have hu_zero : 0 ≤ u := by + have hm : (h ⟨0, Nat.pos_of_ne_zero hn⟩ : ℤ) ∈ s := by + simp only [s, Multiset.mem_toFinset, mem_parameters] + exact ⟨⟨0, Nat.pos_of_ne_zero hn⟩, by simp⟩ + exact le_trans (by positivity) (s.le_max' _ hm) + let m := (1 - l).toNat + let b := u.toNat + have hm : (m : ℤ) = 1 - l := Int.toNat_of_nonneg (by lia) + have hb : (b : ℤ) = u := Int.toNat_of_nonneg hu_zero + refine ⟨m, b, ?_, ?_⟩ + · apply (Multiset.le_iff_subset (integerFactorInterval_nodup m b)).mpr + intro c hc + have hc_bounds : l ≤ c ∧ c ≤ u := by + rw [integerFactorInterval, Multiset.mem_add] at hc + rcases hc with hc | hc + · obtain ⟨i, hi, rfl⟩ := Multiset.mem_map.mp hc + have hi' : i < m := Multiset.mem_range.mp hi + have hi'' : (i : ℤ) < m := by exact_mod_cast hi' + constructor <;> lia + · obtain ⟨i, hi, rfl⟩ := Multiset.mem_map.mp hc + have hi' : i < b := Multiset.mem_range.mp hi + have hi'' : (i : ℤ) < b := by exact_mod_cast hi' + constructor <;> lia + apply parameters_no_gaps h hh hn c + · obtain ⟨i, hi⟩ := (mem_parameters h l).mp hl + exact ⟨i, hi.symm ▸ hc_bounds.1⟩ + · obtain ⟨i, hi⟩ := (mem_parameters h u).mp hu + exact ⟨i, hi.symm ▸ hc_bounds.2⟩ + · intro c hc + have hc' : c ∈ s := Multiset.mem_toFinset.mpr hc + have hlo := s.min'_le c hc' + have hhi := s.le_max' c hc' + constructor <;> dsimp [l, u] at * <;> lia + +/-- The E transform of the GJW product of a square Ferrers board is nonzero, +splits over the reals, and has all roots in `[-1, 0]`. -/ +theorem brandenE_factorialPolynomial_roots_mem_Icc {n : ℕ} (h : Fin n → ℕ) + (hh : IsFerrers h) : + HasPosLeadingCoeff (brandenE (factorialPolynomial h)) ∧ + (brandenE (factorialPolynomial h)).Splits ∧ + ∀ r ∈ (brandenE (factorialPolynomial h)).roots, r ∈ Set.Icc (-1 : ℝ) 0 := by + by_cases hn : n = 0 + · subst n + simpa [factorialPolynomial, integerFactorProduct] using + brandenE_integerFactorProduct_roots_mem_Icc 0 0 0 + (by simp [integerFactorInterval]) (by simp) + · obtain ⟨m, b, hblock, hbound⟩ := exists_parameter_block h hh hn + simpa [integerFactorProduct_parameters] using + brandenE_integerFactorProduct_roots_mem_Icc (parameters h) m b hblock hbound + +/-- **Haglund--Ono--Wagner, Theorem 1 (1999).** The hit polynomial, defined +by the standard rook-to-hit transform of the GJW rook numbers of a Ferrers +board in the square, is nonzero and has only real zeros. -/ +theorem hitPolynomial_ne_zero_and_splits {n : ℕ} (h : Fin n → ℕ) + (hh : IsFerrers h) : hitPolynomial h ≠ 0 ∧ (hitPolynomial h).Splits := by + obtain ⟨hlc, hs, -⟩ := brandenE_factorialPolynomial_roots_mem_Icc h hh + have hd : (brandenE (factorialPolynomial h)).natDegree ≤ n := by + change (basisTransform orderedBellPolynomial (factorialPolynomial h)).natDegree ≤ n + rw [basisTransform_natDegree_eq orderedBellPolynomial_natDegree + orderedBellPolynomial_ne_zero (factorialPolynomial_monic_natDegree h).1.ne_zero] + exact (factorialPolynomial_monic_natDegree h).2.le + rw [hitPolynomial_eq_reflect_comp] + refine ⟨?_, (hs.reflect hd).comp_X_sub_C 1⟩ + intro hz + have hz' := congrArg (fun p : ℝ[X] => p.comp (X + 1)) hz + simp only [comp_assoc, zero_comp] at hz' + have hinv : (X - 1 : ℝ[X]).comp (X + 1) = X := by simp + rw [hinv, comp_X] at hz' + exact hlc.ne_zero (reflect_eq_zero_iff.mp hz') + +end + +end RealRooted.FerrersHit diff --git a/RealRooted/Production.lean b/RealRooted/Production.lean index fccea2228..466228dd2 100644 --- a/RealRooted/Production.lean +++ b/RealRooted/Production.lean @@ -622,6 +622,8 @@ public import RealRooted.Favard.Affine.RowSign public import RealRooted.Favard.Orthogonality public import RealRooted.Favard.PathEnvelope public import RealRooted.Favard.Recurrence +public import RealRooted.FerrersHit.Basic +public import RealRooted.FerrersHit.Roots public import RealRooted.FiniteFreeAdditive public import RealRooted.FiniteFreeAdditive.HalfInteger public import RealRooted.FiniteFreeAdditive.HalfIntegerConvolution @@ -1676,6 +1678,7 @@ public import RealRooted.Transforms.BrandenE.Basic public import RealRooted.Transforms.BrandenE.BasisImage public import RealRooted.Transforms.BrandenE.Delannoy public import RealRooted.Transforms.BrandenE.EvenBinomial +public import RealRooted.Transforms.BrandenE.IntegerFactors public import RealRooted.Transforms.BrandenE.IntervalPreserver public import RealRooted.Transforms.BrandenE.Inverse public import RealRooted.Transforms.BrandenE.OrderedBell diff --git a/RealRooted/Transforms/BrandenE/IntegerFactors.lean b/RealRooted/Transforms/BrandenE/IntegerFactors.lean new file mode 100644 index 000000000..d3913fece --- /dev/null +++ b/RealRooted/Transforms/BrandenE/IntegerFactors.lean @@ -0,0 +1,136 @@ +module + +public import RealRooted.Transforms.BrandenE.Basic +import RealRooted.MaWang.EndpointTwoSided +import Mathlib.Tactic + +/-! +# E transforms of integer linear factors + +The endpoint-multiplicity criterion gives a convenient algebraic route to +Haglund--Ono--Wagner (1999), Theorem 1. A product of integer linear factors +has an E image rooted in `[-1, 0]` if it contains one copy of every factor +between its extreme parameters and the interval `[0, 1]`. + +We start with a consecutive block of factors, then insert the remaining +factors. The endpoint multiplicities make every insertion admissible. +-/ + +@[expose] public section + +open Polynomial + +namespace RealRooted + +noncomputable section + +/-- The product of the affine factors `X + c` in an integer multiset. -/ +def integerFactorProduct (s : Multiset ℤ) : ℝ[X] := + (s.map fun c : ℤ => X + C (c : ℝ)).prod + +/-- One copy of the integer parameters `1 - m, …, 0, 1, …, b`. -/ +def integerFactorInterval (m b : ℕ) : Multiset ℤ := + ((Multiset.range m).map fun i : ℕ => -(i : ℤ)) + + ((Multiset.range b).map fun i : ℕ => (i : ℤ) + 1) + +private def EndpointData (m b : ℕ) (p : ℝ[X]) : Prop := + HasPosLeadingCoeff p ∧ p.Splits ∧ + (∀ r ∈ p.roots, r ∈ Set.Icc (-1 : ℝ) 0) ∧ + p.rootMultiplicity 0 = m ∧ p.rootMultiplicity (-1) = b + +private theorem integerFactorProduct_cons (c : ℤ) (s : Multiset ℤ) : + integerFactorProduct (c ::ₘ s) = (X + C (c : ℝ)) * integerFactorProduct s := by + simp [integerFactorProduct] + +private theorem brandenE_integerFactorProduct_cons (c : ℤ) (s : Multiset ℤ) : + brandenE (integerFactorProduct (c ::ₘ s)) = + MaWang.endpointStep 1 1 (c : ℝ) (brandenE (integerFactorProduct s)) := by + rw [integerFactorProduct_cons, brandenE_mul_X_add_C] + simp [MaWang.endpointStep, add_comm] + +private theorem endpointData_one : EndpointData 0 0 1 := by + refine ⟨hasPosLeadingCoeff_one, Splits.one, ?_, ?_, ?_⟩ + · simp + · simp + · simp + +private theorem EndpointData.step {m b : ℕ} {p : ℝ[X]} + (hp : EndpointData m b p) (c : ℝ) (hlo : 0 ≤ c + m) (hhi : c ≤ 1 + b) : + EndpointData (if c + m = 0 then m + 1 else m) + (if c = 1 + b then b + 1 else b) (MaWang.endpointStep 1 1 c p) := by + obtain ⟨hlc, hs, hr, hm, hb⟩ := hp + obtain ⟨-, hlc', hs', -, hroots, hzero, hneg⟩ := + affineEndpointStep_closed (c := c) one_pos hlc hs hr + refine ⟨hlc', hs', hroots.mpr ?_, ?_, ?_⟩ + · rw [hm, hb] + exact ⟨hlo, by linarith⟩ + · simpa [hm] using hzero + · simpa [hb] using hneg + +private theorem integerFactorInterval_succ_left (m : ℕ) : + integerFactorInterval (m + 1) 0 = -(m : ℤ) ::ₘ integerFactorInterval m 0 := by + simp [integerFactorInterval, Multiset.range_succ] + +private theorem integerFactorInterval_succ_right (m b : ℕ) : + integerFactorInterval m (b + 1) = + ((b : ℤ) + 1) ::ₘ integerFactorInterval m b := by + simp [integerFactorInterval, Multiset.range_succ, Multiset.add_cons] + +private theorem endpointData_interval (m b : ℕ) : + EndpointData m b (brandenE (integerFactorProduct (integerFactorInterval m b))) := by + have hbase : ∀ m : ℕ, + EndpointData m 0 (brandenE (integerFactorProduct (integerFactorInterval m 0))) := by + intro m + induction m with + | zero => + have hEone : brandenE (1 : ℝ[X]) = 1 := by + simpa only [pow_zero, orderedBellPolynomial_zero] using + (brandenE_X_pow (R := ℝ) 0) + simpa [integerFactorInterval, integerFactorProduct, hEone] using endpointData_one + | succ m ih => + rw [integerFactorInterval_succ_left, brandenE_integerFactorProduct_cons] + have hm0 : (0 : ℝ) ≤ m := by positivity + have hne : -(m : ℝ) ≠ 1 := by linarith + simpa [hne] using ih.step (-(m : ℝ)) (by linarith) (by linarith) + induction b with + | zero => exact hbase m + | succ b ih => + rw [integerFactorInterval_succ_right, brandenE_integerFactorProduct_cons] + have hne : (1 : ℝ) + b + m ≠ 0 := by positivity + have hc : (((b : ℤ) + 1 : ℤ) : ℝ) = 1 + (b : ℝ) := by push_cast; ring + rw [hc] + simpa [hne] using ih.step (1 + (b : ℝ)) (by positivity) le_rfl + +private theorem endpointData_interval_add (m b : ℕ) (s : Multiset ℤ) + (hs : ∀ c ∈ s, 1 - (m : ℤ) ≤ c ∧ c ≤ b) : + EndpointData m b + (brandenE (integerFactorProduct (integerFactorInterval m b + s))) := by + induction s using Multiset.induction_on with + | empty => simpa using endpointData_interval m b + | @cons c s ih => + have hc := hs c (Multiset.mem_cons_self c s) + have ih' := ih fun d hd => hs d (Multiset.mem_cons_of_mem hd) + rw [Multiset.add_cons, brandenE_integerFactorProduct_cons] + have hlo : 0 < (c : ℝ) + m := by exact_mod_cast (show 0 < c + (m : ℤ) by lia) + have hhi : (c : ℝ) < 1 + b := by exact_mod_cast (show c < 1 + (b : ℤ) by lia) + simpa [ne_of_gt hlo, ne_of_lt hhi] using + ih'.step (c : ℝ) hlo.le hhi.le + +/-- An integer-factor product containing the complete consecutive block +between its extreme parameters and `[0, 1]` has an E image rooted in `[-1, 0]`. +Repeated factors are allowed. -/ +theorem brandenE_integerFactorProduct_roots_mem_Icc + (s : Multiset ℤ) (m b : ℕ) (hblock : integerFactorInterval m b ≤ s) + (hbound : ∀ c ∈ s, 1 - (m : ℤ) ≤ c ∧ c ≤ b) : + HasPosLeadingCoeff (brandenE (integerFactorProduct s)) ∧ + (brandenE (integerFactorProduct s)).Splits ∧ + ∀ r ∈ (brandenE (integerFactorProduct s)).roots, r ∈ Set.Icc (-1 : ℝ) 0 := by + obtain ⟨t, rfl⟩ := le_iff_exists_add.mp hblock + have ht : ∀ c ∈ t, 1 - (m : ℤ) ≤ c ∧ c ≤ b := + fun c hc => hbound c (Multiset.mem_add.mpr (Or.inr hc)) + obtain ⟨hlc, hs, hr, -, -⟩ := endpointData_interval_add m b t ht + exact ⟨hlc, hs, hr⟩ + +end + +end RealRooted diff --git a/docs/WORKHORSES.md b/docs/WORKHORSES.md index ed26a515f..5a06abf95 100644 --- a/docs/WORKHORSES.md +++ b/docs/WORKHORSES.md @@ -268,8 +268,8 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g | 87 | `RealRooted.hasNonnegCoeffs_C_mul` | `RealRooted.Basic.Coefficients` | | | 57 | `RealRooted.hasNonnegCoeffs_one` | `RealRooted.Basic.Coefficients` | | | 53 | `RealRooted.hasNonnegCoeffs_C` | `RealRooted.Basic.Coefficients` | | +| 50 | `RealRooted.HasNonnegCoeffs.basisTransform` | `RealRooted.BasisTransform` | A basis transform preserves coefficientwise nonnegativity when every basis element has nonnegative coefficients. | | 50 | `RealRooted.hasNonnegCoeffs_X` | `RealRooted.Basic.Coefficients` | | -| 49 | `RealRooted.HasNonnegCoeffs.basisTransform` | `RealRooted.BasisTransform` | A basis transform preserves coefficientwise nonnegativity when every basis element has nonnegative coefficients. | | 46 | `RealRooted.hasPosLeadingCoeff_C_mul` | `RealRooted.Basic.Coefficients` | | | 40 | `RealRooted.HasNonnegCoeffs.weightedSum` | `RealRooted.GarloffWagner.SchurProductPF` | | | 32 | `RealRooted.HasNonnegCoeffs.diagonalOperator` | `RealRooted.MultiplierSequence` | Nonnegative diagonal coefficients preserve nonnegative coefficients. | @@ -278,7 +278,7 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g | 27 | `RealRooted.hasNonnegCoeffs_finsetSum` | `RealRooted.Basic.Coefficients` | | | 16 | `MvPolynomial.HasNonnegCoeffs.uniqueAlgEquiv` | `RealRooted.Basic.Coefficients.Multivariate` | The unique-variable equivalence preserves coefficientwise nonnegativity. | | 16 | `RealRooted.HasNonnegCoeffs.bidiagonalOperator` | `RealRooted.MultiplierSequence.Bidiagonal` | Nonnegative bidiagonal entries preserve coefficient nonnegativity. | -| 14 | `RealRooted.hasPosLeadingCoeff_one` | `RealRooted.Basic.Coefficients` | | +| 15 | `RealRooted.hasPosLeadingCoeff_one` | `RealRooted.Basic.Coefficients` | | | 12 | `RealRooted.HasNonnegCoeffs.homogenize` | `RealRooted.Basic.Coefficients.Multivariate` | Homogenization preserves coefficientwise nonnegativity. | | 12 | `RealRooted.hasPosLeadingCoeff_add_of_natDegree_lt_left` | `RealRooted.Linear` | If the left summand has strictly larger degree and positive leading coefficient, then the sum also has positive leading coefficient. | | 11 | `RealRooted.hasPosLeadingCoeff_add_of_natDegree_lt_right` | `RealRooted.Linear` | If the right summand has strictly larger degree and positive leading coefficient, then the sum also has positive leading coefficient. | @@ -429,9 +429,9 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g | 7 | `RealRooted.div_ofNat_eq_C_mul` | `RealRooted.DerivativeRecurrence.SecondOrderODE` | Division by a numeral, as generated recurrences write `(1 / 2) * X`. | | 7 | `RealRooted.isNonnegLinearForm_one` | `RealRooted.RowThreshold` | | | 6 | `Polynomial.shiftedJacobi_differential_equation` | `RealRooted.Mathlib.RingTheory.Polynomial.Jacobi` | The shifted Jacobi differential equation `X(1-X)y'' + (α+1-(α+β+2)X)y' + n(n+α+β+1)y = 0`. | +| 6 | `RealRooted.brandenE_mul_X_add_C` | `RealRooted.Transforms.BrandenE.Basic` | Affine-factor form of `brandenE_X_mul`. | | 6 | `RealRooted.touchard_succ` | `RealRooted.Touchard` | | | 5 | `RealRooted.EulerBidiagonal.generalStep_eq_second_derivative` | `RealRooted.EulerBidiagonal.QuadraticEulerStep` | Differential form of the general Euler step. | -| 5 | `RealRooted.brandenE_mul_X_add_C` | `RealRooted.Transforms.BrandenE.Basic` | Affine-factor form of `brandenE_X_mul`. | | 4 | `Polynomial.taylor_iterate_derivative` | `RealRooted.Mathlib.Algebra.Polynomial.Taylor` | The Taylor shift commutes with iterated derivatives. | | 4 | `RealRooted.GeneralizedSnakePosets.FiniteSkewBoard.rookPolynomial_eq_nonNestingPlacements_sum` | `RealRooted.GeneralizedSnakePosets.FiniteBoard` | The rook polynomial as a sum over the named finite set of non-nesting placements. | | 4 | `RealRooted.IntervalDifferential.zigzagOperator_apply` | `RealRooted.IntervalDifferential.Basic` | | @@ -521,11 +521,11 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g | 14 | `Polynomial.basisTransform_monomial` | `RealRooted.Mathlib.Algebra.Polynomial.BasisTransform` | | | 10 | `Polynomial.basisTransform_C` | `RealRooted.Mathlib.Algebra.Polynomial.BasisTransform` | | | 9 | `Polynomial.basisTransform_C_mul_X_pow` | `RealRooted.Mathlib.Algebra.Polynomial.BasisTransform` | A scalar monomial is sent to the corresponding scalar basis element. | +| 9 | `RealRooted.brandenE_X_pow` | `RealRooted.Transforms.BrandenE.Basic` | | | 9 | `RealRooted.gammaTransform_add` | `RealRooted.GammaTransform.Basic` | | | 9 | `RealRooted.sequence_eq_of_same_lag_two_recurrence` | `RealRooted.Recurrence.Uniqueness` | Two sequences with the same first two values and lag-two recurrence agree. | | 8 | `Polynomial.X_sub_one_mul_chowS` | `RealRooted.Mathlib.Algebra.Polynomial.Chow` | The defining quotient for `chowS` is exact at every reflection bound at least the degree of the input. | | 8 | `RealRooted.BigDescents321.SmallCases.ofList_cons` | `RealRooted.CombinatorialExamples.BigDescents321.SmallCases.ListPoly` | | -| 8 | `RealRooted.brandenE_X_pow` | `RealRooted.Transforms.BrandenE.Basic` | | | 8 | `RealRooted.gammaTransform_X_mul_two` | `RealRooted.GammaTransform.Basic` | | | 8 | `RealRooted.schurSzegoComp_comm` | `RealRooted.Hadamard.Basic` | | | 8 | `RealRooted.weightedSum_ofFn` | `RealRooted.WeightedSum` | Finite-function form of `weightedSum_eq_sum_map`. | @@ -537,8 +537,8 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g | 7 | `RealRooted.CenteredEulerian.constantCoeff_cosS` | `RealRooted.CenteredEulerian.SeriesBasic` | | | 7 | `RealRooted.CenteredEulerian.constantCoeff_sinS` | `RealRooted.CenteredEulerian.SeriesBasic` | | | 7 | `RealRooted.CenteredEulerian.cosS_mul_secS` | `RealRooted.CenteredEulerian.SeriesBasic` | | +| 7 | `RealRooted.brandenE_C_mul` | `RealRooted.Transforms.BrandenE.Basic` | | | 7 | `RealRooted.exists_index_eq_of_mem_roots` | `RealRooted.Bezoutian.WronskianConverse` | | -| 7 | `RealRooted.gammaTransform_C_mul` | `RealRooted.GammaTransform.Basic` | | ## other diff --git a/scripts/import_architecture.json b/scripts/import_architecture.json index 65ceec7f8..309dfd83d 100644 --- a/scripts/import_architecture.json +++ b/scripts/import_architecture.json @@ -16,10 +16,10 @@ ], "budgets": { "RealRooted": { - "max_modules": 2422 + "max_modules": 2425 }, "RealRooted.Production": { - "max_modules": 2350 + "max_modules": 2353 }, "RealRooted.Tactic.Examples": { "max_modules": 844