Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RealRooted.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,7 @@ public import RealRooted.VeroneseSectionPair.HermiteBiehler
public import RealRooted.Wagner
public import RealRooted.Wagner.LeftSum
public import RealRooted.Wagner.NonpositiveRoots
public import RealRooted.Wagner.ThreeStateRecurrence
public import RealRooted.WagnerRightSum
public import RealRooted.WagnerRightSum.Sign
public import RealRooted.WagnerX
Expand Down
1 change: 1 addition & 0 deletions RealRooted/Production.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,7 @@ public import RealRooted.VeroneseSectionPair.HermiteBiehler
public import RealRooted.Wagner
public import RealRooted.Wagner.LeftSum
public import RealRooted.Wagner.NonpositiveRoots
public import RealRooted.Wagner.ThreeStateRecurrence
public import RealRooted.WagnerRightSum
public import RealRooted.WagnerRightSum.Sign
public import RealRooted.WagnerX
Expand Down
167 changes: 167 additions & 0 deletions RealRooted/Wagner/ThreeStateRecurrence.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
module

public import RealRooted.Recurrence.CubicTransition
import RealRooted.OperatorMatrix.Directed

/-!
# A three-state Wagner-cone recurrence

We prove preservation of `C ≼ B`, `C ≼ F`, and `B ≼ F` under
`B⁺ = B + F`, `C⁺ = C + w (B + F)`, and `F⁺ = F + X (C + w B)`.
Here `≼` is the zero-aware weak oriented relation `Interl`, and every state is
PF: it has nonnegative coefficients and splits with nonpositive roots.
Every nonzero state consequently has positive leading coefficient. Shared and
repeated roots are allowed; no assertion of distinct roots is made.

The recurrence comes from nesting-free marked matchings with positive mark
weights (unpublished manuscript, section "Theorem: no nested arcs"). We formalize
only the recurrence and its invariant, independently of that combinatorial model.
-/

@[expose] public section

open Polynomial

namespace RealRooted
namespace Wagner

/-- A positive weighted step preserves the three-state cone and interlaces
consecutive return states, including when some input states vanish. -/
theorem isOrderedPFTriple_threeState_step {F B C : ℝ[X]} (h : IsOrderedPFTriple C B F)
{w : ℝ} (hw : 0 < w) :
IsOrderedPFTriple (C + Polynomial.C w * (B + F)) (B + F)
(F + X * (C + Polynomial.C w * B)) ∧
Interl F (F + X * (C + Polynomial.C w * B)) := by
rcases h with ⟨hC, hB, hF, hCB, hCF, hBF⟩
let D := B + F
let K := C + Polynomial.C w * B
have hD : IsPFPolynomial D := hB.add_of_interl hF hBF
have hwB := hB.const_mul hw
have hwF := hF.const_mul hw
have hK : IsPFPolynomial K :=
hC.add_of_interl hwB (hCB.C_mul_right_of_nonneg hw.le)
have hKB : Interl K B :=
interl_add_left_of_common_right_of_nonneg hCB
(hB.interl_self.C_mul_left_of_nonneg hw.le)
hC.hasNonnegCoeffs hwB.hasNonnegCoeffs
have hKF : Interl K F :=
interl_add_left_of_common_right_of_nonneg hCF
(hBF.C_mul_left_of_nonneg hw.le)
hC.hasNonnegCoeffs hwB.hasNonnegCoeffs
have hKD : Interl K D :=
interl_add_right_of_common_left_of_nonneg hKB hKF
hB.hasNonnegCoeffs hF.hasNonnegCoeffs
have hDF : Interl D F :=
interl_add_left_of_common_right_of_nonneg hBF hF.interl_self
hB.hasNonnegCoeffs hF.hasNonnegCoeffs
have hCD : Interl C D :=
interl_add_right_of_common_left_of_nonneg hCB hCF
hB.hasNonnegCoeffs hF.hasNonnegCoeffs
have hnextC : IsPFPolynomial (C + Polynomial.C w * D) :=
hC.add_of_interl (hD.const_mul hw) (hCD.C_mul_right_of_nonneg hw.le)
have hnextCD : Interl (C + Polynomial.C w * D) D :=
interl_add_left_of_common_right_of_nonneg hCD
(hD.interl_self.C_mul_left_of_nonneg hw.le)
hC.hasNonnegCoeffs (hD.const_mul hw).hasNonnegCoeffs
have hnextCF : Interl (C + Polynomial.C w * D) F :=
interl_add_left_of_common_right_of_nonneg hCF
(hDF.C_mul_left_of_nonneg hw.le)
hC.hasNonnegCoeffs (hD.const_mul hw).hasNonnegCoeffs
have hform : C + Polynomial.C w * D = K + Polynomial.C w * F := by
dsimp [D, K]
ring
have hKnextC : Interl K (C + Polynomial.C w * D) := by
rw [hform]
exact interl_add_right_of_common_left_of_nonneg hK.interl_self
(hKF.C_mul_right_of_nonneg hw.le) hK.hasNonnegCoeffs hwF.hasNonnegCoeffs
have hDXK : Interl D (X * K) :=
interl_mul_X_of_interl hKD hK.hasNonnegCoeffs hD.hasNonnegCoeffs
have hnextCXK : Interl (C + Polynomial.C w * D) (X * K) :=
interl_mul_X_of_interl hKnextC hK.hasNonnegCoeffs hnextC.hasNonnegCoeffs
have hFXK : Interl F (X * K) :=
interl_mul_X_of_interl hKF hK.hasNonnegCoeffs hF.hasNonnegCoeffs
have hnextF := hF.add_of_interl hK.X_mul hFXK
refine ⟨⟨hnextC, hD, hnextF, hnextCD, ?_, ?_⟩, ?_⟩
· exact interl_add_right_of_common_left_of_nonneg hnextCF hnextCXK
hF.hasNonnegCoeffs hK.X_mul.hasNonnegCoeffs
· exact interl_add_right_of_common_left_of_nonneg hDF hDXK
hF.hasNonnegCoeffs hK.X_mul.hasNonnegCoeffs
· exact interl_add_right_of_common_left_of_nonneg hF.interl_self hFXK
hF.hasNonnegCoeffs hK.X_mul.hasNonnegCoeffs

/-- A three-state recurrence with rank-zero data `(1, 0, 0)`.
The arbitrary weights are required to be positive by the theorems below. -/
structure ThreeStateRecurrence (w : ℕ → ℝ) (F B C : ℕ → ℝ[X]) : Prop where
/-- The initial return state. -/
F_zero : F 0 = 1
/-- The initial unmarked state. -/
B_zero : B 0 = 0
/-- The initial marked state. -/
C_zero : C 0 = 0
/-- The return-state update. -/
F_succ : ∀ n, F (n + 1) = F n + X * (C n + Polynomial.C (w n) * B n)
/-- The unmarked-state update. -/
B_succ : ∀ n, B (n + 1) = B n + F n
/-- The marked-state update. -/
C_succ : ∀ n, C (n + 1) = C n + Polynomial.C (w n) * (B n + F n)

/-- A recurrence with positive weights preserves the cone from any initial rank. -/
theorem isOrderedPFTriple_of_threeState_recurrence {w : ℕ → ℝ} {F B C : ℕ → ℝ[X]}
(hw : ∀ n, 0 < w n) (h₀ : IsOrderedPFTriple (C 0) (B 0) (F 0))
(hF : ∀ n, F (n + 1) = F n + X * (C n + Polynomial.C (w n) * B n))
(hB : ∀ n, B (n + 1) = B n + F n)
(hC : ∀ n, C (n + 1) = C n + Polynomial.C (w n) * (B n + F n))
(n : ℕ) : IsOrderedPFTriple (C n) (B n) (F n) := by
induction n with
| zero => exact h₀
| succ n ih =>
rw [hF n, hB n, hC n]
exact (isOrderedPFTriple_threeState_step ih (hw n)).1

/-- Every rank of the recurrence satisfies the zero-aware interlacing invariant. -/
theorem ThreeStateRecurrence.isOrderedPFTriple {w : ℕ → ℝ} {F B C : ℕ → ℝ[X]}
(h : ThreeStateRecurrence w F B C) (hw : ∀ n, 0 < w n) (n : ℕ) :
IsOrderedPFTriple (C n) (B n) (F n) := by
apply isOrderedPFTriple_of_threeState_recurrence hw ?_ h.F_succ h.B_succ h.C_succ n
rw [h.F_zero, h.B_zero, h.C_zero]
exact ⟨IsPFPolynomial.zero, IsPFPolynomial.zero, IsPFPolynomial.one,
interl_zero_left 0, interl_zero_left 1, interl_zero_left 1⟩

/-- Consecutive return states weakly interlace in the zero-aware convention. -/
theorem ThreeStateRecurrence.interl_succ {w : ℕ → ℝ} {F B C : ℕ → ℝ[X]}
(h : ThreeStateRecurrence w F B C) (hw : ∀ n, 0 < w n) (n : ℕ) :
Interl (F n) (F (n + 1)) := by
rw [h.F_succ n]
exact (isOrderedPFTriple_threeState_step (h.isOrderedPFTriple hw n) (hw n)).2

/-- Every return state retains constant coefficient one. -/
theorem ThreeStateRecurrence.coeff_zero {w : ℕ → ℝ} {F B C : ℕ → ℝ[X]}
(h : ThreeStateRecurrence w F B C) (n : ℕ) : (F n).coeff 0 = 1 := by
induction n with
| zero => simp [h.F_zero]
| succ n ih => simp [h.F_succ n, ih]

/-- Return states are nonzero, so their interlacing is also expressed by `StrictInterl`.
Despite its name, this predicate allows shared and repeated roots. -/
theorem ThreeStateRecurrence.strictInterl_succ {w : ℕ → ℝ} {F B C : ℕ → ℝ[X]}
(h : ThreeStateRecurrence w F B C) (hw : ∀ n, 0 < w n) (n : ℕ) :
StrictInterl (F n) (F (n + 1)) := by
have hne (k : ℕ) : F k ≠ 0 := by
intro hk
have := h.coeff_zero k
simp [hk] at this
exact (h.interl_succ hw n).toStrictInterl_of_ne (hne n) (hne (n + 1))

/-- Every return state splits with nonpositive roots and positive leading coefficient. -/
theorem ThreeStateRecurrence.splits_roots_nonpos_posLeadingCoeff
{w : ℕ → ℝ} {F B C : ℕ → ℝ[X]}
(h : ThreeStateRecurrence w F B C) (hw : ∀ n, 0 < w n) (n : ℕ) :
(F n).Splits ∧ (∀ r ∈ (F n).roots, r ≤ 0) ∧ HasPosLeadingCoeff (F n) := by
have hp := (h.isOrderedPFTriple hw n).2.2.1
refine ⟨hp.splits, hp.roots_nonpos, hp.hasNonnegCoeffs.pos_leadingCoeff ?_⟩
intro hn
have := h.coeff_zero n
simp [hn] at this

end Wagner
end RealRooted
24 changes: 12 additions & 12 deletions docs/WORKHORSES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g
| uses | theorem | module | doc |
|---:|---|---|---|
| 72 | `RealRooted.StrictInterl.refl` | `RealRooted.Basic.ProperPosition` | A nonzero real-rooted polynomial is in same-degree proper position with itself. |
| 59 | `RealRooted.Interl.toStrictInterl_of_ne` | `RealRooted.Basic.ProperPosition` | |
| 60 | `RealRooted.Interl.toStrictInterl_of_ne` | `RealRooted.Basic.ProperPosition` | |
| 42 | `RealRooted.strictInterl_mul_X_of_strictInterl_of_nonneg` | `RealRooted.WagnerX.NonnegativeRoots` | Nonnegative-coefficients form of Wagner (3): if `f ≪ g` and both polynomials have nonnegative coefficients, then `g ≪ X * f`. |
| 34 | `RealRooted.StrictInterl.C_mul_left` | `RealRooted.Basic.ProperPosition` | Multiplying the left polynomial in a proper-position relation by a nonzero real scalar preserves proper position. |
| 33 | `RealRooted.StrictInterl.C_mul_right` | `RealRooted.Basic.ProperPosition` | Multiplying the right polynomial in a proper-position relation by a nonzero real scalar preserves proper position. |
Expand Down Expand Up @@ -47,18 +47,18 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g
|---:|---|---|---|
| 101 | `RealRooted.StrictInterl.toInterlaces` | `RealRooted.Basic.ProperPosition` | |
| 64 | `RealRooted.StrictInterl.toInterl` | `RealRooted.Basic.ProperPosition` | |
| 49 | `RealRooted.interl_zero_left` | `RealRooted.Basic.ProperPosition` | |
| 50 | `RealRooted.interl_zero_left` | `RealRooted.Basic.ProperPosition` | |
| 46 | `RealRooted.interlaces_one_linear` | `RealRooted.Linear` | |
| 45 | `RealRooted.interl_zero_right` | `RealRooted.Basic.ProperPosition` | |
| 43 | `RealRooted.derivative_interlaces_of_natDegree_ne_zero` | `RealRooted.Derivative.Interlacing` | **Derivative interlacing**: the derivative of a nonconstant real-rooted polynomial `f` interlaces `f`. |
| 37 | `RealRooted.Interl.refl` | `RealRooted.Basic.ProperPosition` | A polynomial that splits whenever it is nonzero is zero-aware interlacing with itself. |
| 29 | `RealRooted.Interl.C_mul_right_of_nonneg` | `RealRooted.Basic.ProperPosition` | Multiplying the right polynomial in a zero-aware interlacing relation by a nonnegative scalar preserves the relation. |
| 27 | `RealRooted.Interl.C_mul_left_of_nonneg` | `RealRooted.Basic.ProperPosition` | Multiplying the left polynomial in a zero-aware interlacing relation by a nonnegative scalar preserves the relation. |
| 26 | `RealRooted.IsPFPolynomial.interl_self` | `RealRooted.PFPolynomial` | A PF polynomial is in zero-aware proper position with itself. |
| 30 | `RealRooted.Interl.C_mul_right_of_nonneg` | `RealRooted.Basic.ProperPosition` | Multiplying the right polynomial in a zero-aware interlacing relation by a nonnegative scalar preserves the relation. |
| 28 | `RealRooted.Interl.C_mul_left_of_nonneg` | `RealRooted.Basic.ProperPosition` | Multiplying the left polynomial in a zero-aware interlacing relation by a nonnegative scalar preserves the relation. |
| 27 | `RealRooted.IsPFPolynomial.interl_self` | `RealRooted.PFPolynomial` | A PF polynomial is in zero-aware proper position with itself. |
| 23 | `RealRooted.isInterlacingSeq0_iff_pairwise` | `RealRooted.InterlacingSequenceBasic` | `IsInterlacingSeq0` is exactly pairwise `Interl`. |
| 21 | `RealRooted.interl_add_right_of_common_left_of_nonneg` | `RealRooted.PFPolynomial` | Fixed-left cone closure in the two-summand form used downstream: if a polynomial is a common left interleaver for two nonnegative-coefficient summands, it is also a common left interleaver for their s |
| 21 | `RealRooted.interl_mul_X_of_interl` | `RealRooted.WagnerX.NonnegativeRoots` | Zero-aware Wagner (3): if `f ≪₀ g` and both polynomials have nonnegative coefficients, then `g ≪₀ X * f`. |
| 19 | `RealRooted.interl_add_left_of_common_right_of_nonneg` | `RealRooted.PFPolynomial` | Fixed-right cone closure in the two-summand form used downstream: if two nonnegative-coefficient summands have a common right interleaver, their sum has that same right interleaver. |
| 22 | `RealRooted.interl_add_right_of_common_left_of_nonneg` | `RealRooted.PFPolynomial` | Fixed-left cone closure in the two-summand form used downstream: if a polynomial is a common left interleaver for two nonnegative-coefficient summands, it is also a common left interleaver for their s |
| 22 | `RealRooted.interl_mul_X_of_interl` | `RealRooted.WagnerX.NonnegativeRoots` | Zero-aware Wagner (3): if `f ≪₀ g` and both polynomials have nonnegative coefficients, then `g ≪₀ X * f`. |
| 20 | `RealRooted.interl_add_left_of_common_right_of_nonneg` | `RealRooted.PFPolynomial` | Fixed-right cone closure in the two-summand form used downstream: if two nonnegative-coefficient summands have a common right interleaver, their sum has that same right interleaver. |
| 18 | `RealRooted.interlaces_derivative_of_pos_natDegree` | `RealRooted.Derivative.Interlacing` | The derivative of any nonconstant positive-leading real-rooted polynomial interlaces the original polynomial, including the degree-one boundary case. |
| 11 | `RealRooted.interl_of_pf_coeff_tendsto_of_natDegree_le` | `RealRooted.PFPolynomial.Closure` | Uniformly bounded-degree coefficientwise limits preserve zero-aware interlacing for Pólya-frequency polynomial pairs. |
| 10 | `RealRooted.Interl.finsetSum_left_of_nonneg` | `RealRooted.PosCombo` | Left cone for `Interl` over finite sums of nonnegative-coefficient polynomials. |
Expand Down Expand Up @@ -137,8 +137,8 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g
|---:|---|---|---|
| 79 | `RealRooted.IsPFPolynomial.of_realRooted_nonneg` | `RealRooted.PFPolynomial` | A split polynomial with nonnegative coefficients is PF. |
| 43 | `RealRooted.IsPFPolynomial.of_nonnegCoeffs_eq_zero_or_splits` | `RealRooted.PFPolynomial` | Construct a PF polynomial from nonnegative coefficients and a zero-or-splits certificate. |
| 41 | `RealRooted.IsPFPolynomial.zero` | `RealRooted.PFPolynomial` | The zero polynomial is PF. |
| 32 | `RealRooted.IsPFPolynomial.one` | `RealRooted.PFPolynomial` | The constant polynomial `1` is PF. |
| 42 | `RealRooted.IsPFPolynomial.zero` | `RealRooted.PFPolynomial` | The zero polynomial is PF. |
| 33 | `RealRooted.IsPFPolynomial.one` | `RealRooted.PFPolynomial` | The constant polynomial `1` is PF. |
| 27 | `RealRooted.isPFPolynomial_X_add_C` | `RealRooted.PFPolynomial` | The polynomial `X + C a` is PF when `a` is nonnegative. |
| 21 | `RealRooted.IsPFPolynomial.of_C_nonneg` | `RealRooted.PFPolynomial` | A nonnegative constant polynomial is PF. |
| 15 | `RealRooted.IsPFPolynomial.of_coeff_tendsto` | `RealRooted.PFPolynomial.Closure` | Coefficientwise limits of Pólya-frequency polynomials are Pólya-frequency. |
Expand All @@ -148,7 +148,7 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g
| 11 | `RealRooted.IsPolyaFreqSeq.natCauchyConvolution` | `RealRooted.PolyaFrequencyConvolution.Basic` | Pólya-frequency sequences are closed under Cauchy convolution. |
| 10 | `RealRooted.polarTheta_preserves_pf` | `RealRooted.EulerOperator` | The polar-theta operator `N - theta` preserves the polynomial PF cone for polynomials of degree at most `N`. |
| 10 | `RealRooted.theta_preserves_pf` | `RealRooted.EulerOperator` | `theta` preserves the polynomial PF cone. |
| 8 | `RealRooted.IsPFPolynomial.add_of_interl` | `RealRooted.OperatorMatrix.Directed` | The sum of an interlacing PF pair is PF. |
| 9 | `RealRooted.IsPFPolynomial.add_of_interl` | `RealRooted.OperatorMatrix.Directed` | The sum of an interlacing PF pair is PF. |
| 8 | `RealRooted.isPFPolynomial_jensenPolynomial_of_PFMultiplierSequence` | `RealRooted.MultiplierSequence.Infinite` | Every Jensen polynomial of a PF multiplier sequence is PF. |
| 8 | `RealRooted.isPFPolynomial_jensenPolynomial_of_finitePFMultiplierSequence` | `RealRooted.MultiplierSequence` | The easy PF direction: a finite PF multiplier sequence has a PF Jensen polynomial. |
| 7 | `RealRooted.IsPFMultiplierSequence.diagonalOperator_isPF` | `RealRooted.MultiplierSequence.Infinite` | |
Expand Down Expand Up @@ -236,7 +236,7 @@ Counts are lexical estimates: distinctive leaves count unqualified references; g
| uses | theorem | module | doc |
|---:|---|---|---|
| 92 | `RealRooted.roots_nonpos_of_hasNonnegCoeffs` | `RealRooted.Basic.Coefficients` | A real polynomial with nonnegative coefficients has no positive real roots. |
| 45 | `RealRooted.IsPFPolynomial.roots_nonpos` | `RealRooted.PFPolynomial` | |
| 46 | `RealRooted.IsPFPolynomial.roots_nonpos` | `RealRooted.PFPolynomial` | |
| 20 | `RealRooted.hasNonnegCoeffs_iff_pos_leadingCoeff_and_roots_nonpos` | `RealRooted.WagnerX.NonnegativeRoots` | |
| 17 | `RealRooted.roots_neg_of_hasNonnegCoeffs_of_coeff_zero_ne` | `RealRooted.Basic.Coefficients` | A nonnegative-coefficient polynomial with nonzero constant coefficient has strictly negative roots. |
| 15 | `RealRooted.StrictInterl.roots_le_of_right` | `RealRooted.Basic.ProperPosition` | Every root of the left-hand polynomial is bounded by any common upper bound for the roots of the right-hand polynomial in a `StrictInterl` witness. |
Expand Down
4 changes: 2 additions & 2 deletions scripts/import_architecture.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
],
"budgets": {
"RealRooted": {
"max_modules": 2425
"max_modules": 2426
},
"RealRooted.Production": {
"max_modules": 2353
"max_modules": 2354
},
"RealRooted.Tactic.Examples": {
"max_modules": 844
Expand Down
Loading