diff --git a/RealRooted.lean b/RealRooted.lean index af60a8848..c5c4ea48a 100644 --- a/RealRooted.lean +++ b/RealRooted.lean @@ -32,6 +32,7 @@ public import RealRooted.Applications.EulerianVariations public import RealRooted.Applications.EulerianVariations.CyclicPathDescents public import RealRooted.Applications.EulerianVariations.TernaryRuns public import RealRooted.Applications.EulerianVariations.TernaryRuns.Recurrence +public import RealRooted.Applications.OEIS.A114123 public import RealRooted.Applications.OEIS.A132885 public import RealRooted.Applications.OEIS.A272471.Recurrence public import RealRooted.Applications.OEIS.InversePeaks @@ -486,6 +487,7 @@ public import RealRooted.DerivativeRecurrence.Degree public import RealRooted.DerivativeRecurrence.General public import RealRooted.DerivativeRecurrence.GeneralizedLaguerre public import RealRooted.DerivativeRecurrence.GeneralizedLaguerreInterlacing +public import RealRooted.DerivativeRecurrence.HalfDegree public import RealRooted.DerivativeRecurrence.Interlacing public import RealRooted.DerivativeRecurrence.LagDegree public import RealRooted.DerivativeRecurrence.Linear diff --git a/RealRooted/Applications/OEIS/A056939.lean b/RealRooted/Applications/OEIS/A056939.lean index afeaed3d1..56a4ac349 100644 --- a/RealRooted/Applications/OEIS/A056939.lean +++ b/RealRooted/Applications/OEIS/A056939.lean @@ -597,7 +597,7 @@ theorem _root_.RealRooted.Hoggatt.normalized_three_eq_baxter (n : ℕ) : /-- Strictness for the existing Baxter model: consecutive rows have no shared root. -/ theorem polynomial_isCoprime_succ (n : ℕ) : IsCoprime (polynomial n) (polynomial (n + 1)) := by - have h := Hoggatt.baxter_interlaces (Nat.succ_ne_zero n) + have h := RealRooted.Hoggatt.baxter_interlaces_and_isCoprime (Nat.succ_ne_zero n) simpa only [Hoggatt.normalized_three_eq_baxter] using h.2 end RealRooted.Applications.OEIS.A056939 diff --git a/RealRooted/Applications/OEIS/A114123.lean b/RealRooted/Applications/OEIS/A114123.lean new file mode 100644 index 000000000..536a4496c --- /dev/null +++ b/RealRooted/Applications/OEIS/A114123.lean @@ -0,0 +1,95 @@ +module + +public import RealRooted.TotalPositivity.PFRiordan + +/-! +# Pólya-frequency Riordan rows for OEIS A114123 + +The sequence-specific generating identities and root-location theorem. +-/ + +@[expose] public section + +open Polynomial RealRooted.PFRiordan + +noncomputable section + +namespace RealRooted.Applications.OEIS.A114123 + +/-- Coefficients of `(1 + z)^2 / (1 - z)`, the `K`-series for A114123. -/ +def kCoeff : ℕ → ℝ := + rationalPFCoeff 1 0 [1, 1] [1] + +/-- The A114123 `K`-series has the claimed finite rational factorization. -/ +theorem mk_kCoeff_mul_one_sub : + PowerSeries.mk kCoeff * (1 - PowerSeries.X) = + (1 + PowerSeries.X) ^ 2 := by + rw [kCoeff, mk_rationalPFCoeff] + simpa [BrandenVecchi.supersymmetricNumeratorFactor, pow_two] using + BrandenVecchi.finiteSupersymmetricSeries_mul_denominators + ([1, 1] : List ℝ) ([1] : List ℝ) + +/-- The A114123 rows, equivalently +`[z^n] (1-z) / ((1-z)^2 - X z (1+z)^2)`. -/ +def row (n : ℕ) : ℝ[X] := + rowPolynomial geometricOneCoeff kCoeff n + +/-- Exact generating-series identity +`((1-z)^2 - X z (1+z)^2) F(X,z) = 1-z` for the A114123 rows. -/ +theorem denominator_mul_rowGeneratingSeries : + (BrandenLeite.polynomialLift ((1 - PowerSeries.X) ^ 2) - + PowerSeries.C X * BrandenLeite.polynomialLift + (PowerSeries.X * (1 + PowerSeries.X) ^ 2)) * + rowGeneratingSeries geometricOneCoeff kCoeff = + BrandenLeite.polynomialLift (1 - PowerSeries.X) := by + have hd : + (1 - PowerSeries.X) ^ 2 * PowerSeries.mk geometricOneCoeff = + 1 - PowerSeries.X := by + calc + (1 - PowerSeries.X) ^ 2 * PowerSeries.mk geometricOneCoeff = + (1 - PowerSeries.X) * + (PowerSeries.mk geometricOneCoeff * (1 - PowerSeries.X)) := by ring + _ = 1 - PowerSeries.X := by rw [mk_geometricOneCoeff_mul_one_sub]; ring + have hK : + PowerSeries.X * (1 - PowerSeries.X) * + PowerSeries.mk kCoeff = + PowerSeries.X * (1 + PowerSeries.X) ^ 2 := by + calc + PowerSeries.X * (1 - PowerSeries.X) * + PowerSeries.mk kCoeff = + PowerSeries.X * + (PowerSeries.mk kCoeff * (1 - PowerSeries.X)) := by ring + _ = PowerSeries.X * (1 + PowerSeries.X) ^ 2 := by + rw [mk_kCoeff_mul_one_sub] + have hd' : + PowerSeries.mk + (fun n => PowerSeries.coeff n ((1 - PowerSeries.X) ^ 2)) * + PowerSeries.mk geometricOneCoeff = + PowerSeries.mk (fun n => PowerSeries.coeff n (1 - PowerSeries.X)) := by + simpa only [BrandenLeite.mk_coeff_eq] using hd + have hK' : + PowerSeries.X * + PowerSeries.mk (fun n => PowerSeries.coeff n (1 - PowerSeries.X)) * + PowerSeries.mk kCoeff = + PowerSeries.mk (fun n => PowerSeries.coeff n + (PowerSeries.X * (1 + PowerSeries.X) ^ 2)) := by + simpa only [BrandenLeite.mk_coeff_eq] using hK + simpa only [BrandenLeite.mk_coeff_eq] using + PFRiordan.denominator_mul_rowGeneratingSeries + (D₀ := fun n => PowerSeries.coeff n ((1 - PowerSeries.X) ^ 2)) + (L := fun n => PowerSeries.coeff n + (PowerSeries.X * (1 + PowerSeries.X) ^ 2)) + (N := fun n => PowerSeries.coeff n (1 - PowerSeries.X)) + (d := geometricOneCoeff) (K := kCoeff) hd' hK' + +/-- Every A114123 row splits and has only nonpositive roots. -/ +theorem row_splits_and_roots_nonpos (n : ℕ) : + (row n).Splits ∧ + ∀ r ∈ (row n).roots, r ≤ 0 := by + apply rowPolynomial_splits_and_roots_nonpos + · exact rationalPFCoeff_isPolyaFreqSeq + (c := 1) (by norm_num) 0 (by simp) (by simp) + · exact rationalPFCoeff_isPolyaFreqSeq + (c := 1) (by norm_num) 0 (by simp) (by simp) + +end RealRooted.Applications.OEIS.A114123 diff --git a/RealRooted/BasisTransform/AppellRigidity.lean b/RealRooted/BasisTransform/AppellRigidity.lean index 1fa0cb166..6c1c8488d 100644 --- a/RealRooted/BasisTransform/AppellRigidity.lean +++ b/RealRooted/BasisTransform/AppellRigidity.lean @@ -803,7 +803,7 @@ theorem exists_diagonalPolynomial /-- Repeated-root preservation at degree two forces the quadratic coefficient governing the first lower basis diagonal to be nonnegative. -/ -theorem two_mul_coeff_one_appellCoefficient_two_nonneg_of_shiftedPower_splits +theorem _root_.RealRooted.AppellCoefficient.two_mul_coeff_one_nonneg_of_shiftedPower_splits {P : ℕ → ℝ[X]} (hPdeg : ∀ n, (P n).natDegree = n) (hPmonic : ∀ n, (P n).Monic) (hsplits : ∀ r : ℝ, 0 ≤ r → (shiftedPowerImage P 2 r).Splits) : @@ -832,7 +832,7 @@ theorem two_mul_coeff_one_appellCoefficient_two_nonneg (hpres : ∀ p : ℝ[X], p.Splits → (∀ r ∈ p.roots, r ≤ 0) → (basisTransform P p).Splits) : 0 ≤ 2 * (appellCoefficient P 2).coeff 1 := by - exact two_mul_coeff_one_appellCoefficient_two_nonneg_of_shiftedPower_splits hPdeg hPmonic + exact RealRooted.AppellCoefficient.two_mul_coeff_one_nonneg_of_shiftedPower_splits hPdeg hPmonic fun r hr => splits_shiftedPowerImage_of_preserves hPdeg hPmonic hpres 2 hr /-- Under the explicit Appell expansion, root preservation makes the first diff --git a/RealRooted/BasisTransform/AppellTranslationRigidity.lean b/RealRooted/BasisTransform/AppellTranslationRigidity.lean index 30d717e4a..9728daf66 100644 --- a/RealRooted/BasisTransform/AppellTranslationRigidity.lean +++ b/RealRooted/BasisTransform/AppellTranslationRigidity.lean @@ -79,7 +79,7 @@ theorem eq_sum_of_isAppellExpansion_of_natDegree_le /-- An Appell expansion evaluates the associated basis transform as the locally finite differential operator with coefficients `Q`. -/ -theorem basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion +theorem _root_.RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative {P Q : ℕ → ℝ[X]} (hPQ : IsAppellExpansion P Q) (hPdeg : ∀ n, (P n).natDegree = n) (hQdeg : ∀ k, (Q k).natDegree ≤ k / 2) @@ -139,7 +139,7 @@ private theorem shiftedPowerImage_eq_of_commutes_translation /-- The canonical Appell coefficients are constant exactly when the basis transform commutes with every translation. -/ -theorem forall_appellCoefficient_natDegree_eq_zero_iff_commutes_translation +theorem _root_.RealRooted.AppellCoefficient.forall_natDegree_eq_zero_iff_commutes_translation (P : ℕ → ℝ[X]) (hPdeg : ∀ n, (P n).natDegree = n) (hQdeg : ∀ k, (appellCoefficient P k).natDegree ≤ k / 2) : (∀ k, (appellCoefficient P k).natDegree = 0) ↔ @@ -148,11 +148,11 @@ theorem forall_appellCoefficient_natDegree_eq_zero_iff_commutes_translation (basisTransform P p).comp (X + C r) := by constructor · intro hconstant r p - rw [basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + rw [RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg (p := p.comp (X + C r)) (N := p.natDegree) (by rw [← taylor_apply, natDegree_taylor]), - basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg (p := p) (N := p.natDegree) le_rfl] rw [Polynomial.sum_comp] @@ -217,11 +217,11 @@ private theorem derivative_appellCoefficient_eq_zero_of_basis_derivative induction n using Nat.strong_induction_on with | h n ih => have hexpand := - basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg (p := X ^ n) (N := n) (by simp) have hexpandDer := - basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg (p := (X ^ n).derivative) (N := n) (calc @@ -281,10 +281,10 @@ theorem forall_appellCoefficient_natDegree_eq_zero_iff_derivative · intro hconstant n have hcomm (p : ℝ[X]) : (basisTransform P p).derivative = basisTransform P p.derivative := by - rw [basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + rw [RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg (p := p) (N := p.natDegree) le_rfl, - basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg (p := p.derivative) (N := p.natDegree) ((natDegree_derivative_le (p := p)).trans (Nat.sub_le _ _))] @@ -389,7 +389,7 @@ theorem appellTranslationRigidity_equivalences have hbeta := two_mul_coeff_one_appellCoefficient_two_eq_zero_iff hPdeg hPmonic hpres exact ⟨hbeta, - hbeta.trans (forall_appellCoefficient_natDegree_eq_zero_iff_commutes_translation + hbeta.trans (RealRooted.AppellCoefficient.forall_natDegree_eq_zero_iff_commutes_translation P hPdeg (appellCoefficient_natDegree_le hPdeg hPmonic hpres)), hbeta.trans (forall_appellCoefficient_natDegree_eq_zero_iff_derivative P hPdeg (appellCoefficient_natDegree_le hPdeg hPmonic hpres))⟩ @@ -408,7 +408,7 @@ theorem basisTransform_splits_of_quadraticCoefficient_eq_zero appellCoefficient_natDegree_eq_zero_of_quadraticCoefficient_eq_zero hPdeg hPmonic hpres hbeta have hcomm := - (forall_appellCoefficient_natDegree_eq_zero_iff_commutes_translation + (RealRooted.AppellCoefficient.forall_natDegree_eq_zero_iff_commutes_translation P hPdeg (appellCoefficient_natDegree_le hPdeg hPmonic hpres)).mp hconstant obtain ⟨r, hr⟩ := exists_root_upper_bound p have hshiftSplits : (p.comp (X + C r)).Splits := hp.comp_X_add_C r diff --git a/RealRooted/BasisTransform/IntervalBasisMaps.lean b/RealRooted/BasisTransform/IntervalBasisMaps.lean index 128e96783..2cf292a9f 100644 --- a/RealRooted/BasisTransform/IntervalBasisMaps.lean +++ b/RealRooted/BasisTransform/IntervalBasisMaps.lean @@ -759,7 +759,7 @@ theorem rationalGeneratingSeries_iff_eventually_pureLag (hNdeg.trans_le (by lia)) hgen · rintro ⟨q, n₀, Q, hq, hQ0, hQdeg, hrec⟩ obtain ⟨M, hMdeg, hgen⟩ := - exists_natDegree_lt_add_and_mul_generatingSeries_eq_of_pureLag_from + RealRooted.EndpointRecurrence.exists_natDegree_lt_and_mul_generatingSeries_eq_of_pureLag P Q q n₀ hq hQ0 hQdeg.le hrec exact ⟨q, n₀, Q, M, hq, hQ0, hQdeg, hMdeg, hgen⟩ @@ -776,7 +776,7 @@ theorem le_eventualOrder_of_coprime_mul_generatingSeries_eq Q.coeff (j + 1) * P (n₀ + n + m - (j + 1))) : q ≤ m := by obtain ⟨M, -, hQgen⟩ := - exists_natDegree_lt_add_and_mul_generatingSeries_eq_of_pureLag_from + RealRooted.EndpointRecurrence.exists_natDegree_lt_and_mul_generatingSeries_eq_of_pureLag P Q m n₀ hm hQ0 hQdeg hrec rw [← hDdeg] exact (natDegree_le_of_coprime_mul_generatingSeries_eq diff --git a/RealRooted/BasisTransform/LimitingAppell.lean b/RealRooted/BasisTransform/LimitingAppell.lean index 71a4ed4fe..94d28bad0 100644 --- a/RealRooted/BasisTransform/LimitingAppell.lean +++ b/RealRooted/BasisTransform/LimitingAppell.lean @@ -184,7 +184,7 @@ private theorem rescaledBasisPower_eq_sum_scaled have hQdeg := appellCoefficient_natDegree_le hPdeg hPmonic hpres have hinputdeg : ((X + C (s ^ 2)) ^ N : ℝ[X]).natDegree ≤ N := by rw [natDegree_pow, natDegree_X_add_C, mul_one] - have hexpand := basisTransform_eq_sum_iterate_derivative_of_isAppellExpansion + have hexpand := RealRooted.IsAppellExpansion.basisTransform_eq_sum_iterate_derivative (isAppellExpansion_appellCoefficient P) hPdeg hQdeg hinputdeg rw [rescaledBasisPower] change C ((s ^ N)⁻¹) * @@ -984,7 +984,7 @@ theorem coeff_appellCoefficient_even_bounds /-- Exponential coefficient data attain equality in the second coefficient bound. -/ -theorem limitingAppellCoefficient_two_eq_half_square_of_eq_pow_div_factorial +theorem _root_.RealRooted.LimitingAppell.coeff_two_eq_half_square_of_eq_pow_div_factorial {d : ℕ → ℝ} {c : ℝ} (hd : ∀ j, d j = c ^ j / (j.factorial : ℝ)) : d 2 = d 1 ^ 2 / 2 := by rw [hd 2, hd 1] @@ -1011,7 +1011,7 @@ private theorem coeff_zero_limitingAppellPolynomial_even /-- Equality of every limiting polynomial with the Gaussian family is equivalent to exponential coefficient data. -/ -theorem forall_limitingAppellPolynomial_eq_iff_coeff_eq_pow_div_factorial +theorem _root_.RealRooted.LimitingAppell.forall_polynomial_eq_iff_coeff_eq_pow_div_factorial (d : ℕ → ℝ) (c : ℝ) : (∀ N, limitingAppellPolynomial d N = limitingAppellPolynomial (fun j => c ^ j / (j.factorial : ℝ)) N) ↔ diff --git a/RealRooted/BasisTransform/NewtonBasisPreservers.lean b/RealRooted/BasisTransform/NewtonBasisPreservers.lean index 82862f0c2..a825c751e 100644 --- a/RealRooted/BasisTransform/NewtonBasisPreservers.lean +++ b/RealRooted/BasisTransform/NewtonBasisPreservers.lean @@ -116,7 +116,7 @@ private theorem two_mul_appellCoefficient_two_nonneg_of_repeatedRootTestsUpTo {N : ℕ} {c : ℕ → ℝ} (hN : 2 ≤ N) (htest : NewtonRepeatedRootTestsUpTo N c) : 0 ≤ 2 * (appellCoefficient (newtonBasisPolynomial c) 2).coeff 1 := by - apply two_mul_coeff_one_appellCoefficient_two_nonneg_of_shiftedPower_splits + apply RealRooted.AppellCoefficient.two_mul_coeff_one_nonneg_of_shiftedPower_splits (newtonBasisPolynomial_natDegree c) (newtonBasisPolynomial_monic c) intro r hr rw [splits_shiftedPowerImage_iff] @@ -279,7 +279,7 @@ private theorem newtonBasisTransform_eq_rising_comp /-- Arithmetic-progression Newton parameters preserve real-rootedness for all inputs with only nonpositive roots. -/ -theorem NewtonParametersAffine.preservesNonposRooted {c : ℕ → ℝ} +theorem _root_.RealRooted.NewtonPreservesNonposRooted.of_parametersAffine {c : ℕ → ℝ} (hc : NewtonParametersAffine c) : NewtonPreservesNonposRooted c := by obtain ⟨h, hh, hc⟩ := hc intro p hp @@ -298,7 +298,7 @@ theorem NewtonPreservesNonposRooted.repeatedRootTests {c : ℕ → ℝ} /-- Arithmetic-progression parameters imply every repeated-root test. -/ theorem NewtonParametersAffine.repeatedRootTests {c : ℕ → ℝ} (hc : NewtonParametersAffine c) : NewtonRepeatedRootTests c := - hc.preservesNonposRooted.repeatedRootTests + (NewtonPreservesNonposRooted.of_parametersAffine hc).repeatedRootTests /-- Repeated-root tests force the Newton parameters to form a nondecreasing arithmetic progression. -/ @@ -336,7 +336,7 @@ progression Newton parameters. -/ theorem newtonPreservesNonposRooted_iff_parametersAffine (c : ℕ → ℝ) : NewtonPreservesNonposRooted c ↔ NewtonParametersAffine c := ⟨NewtonPreservesNonposRooted.parametersAffine, - NewtonParametersAffine.preservesNonposRooted⟩ + RealRooted.NewtonPreservesNonposRooted.of_parametersAffine⟩ /-- Preservation, repeated-root tests, and arithmetic-progression parameters are equivalent for a Newton basis. -/ @@ -344,7 +344,7 @@ theorem newtonBasis_preserver_equivalences (c : ℕ → ℝ) : (NewtonPreservesNonposRooted c ↔ NewtonRepeatedRootTests c) ∧ (NewtonRepeatedRootTests c ↔ NewtonParametersAffine c) := by exact ⟨⟨NewtonPreservesNonposRooted.repeatedRootTests, - fun htest => htest.parametersAffine.preservesNonposRooted⟩, + fun htest => NewtonPreservesNonposRooted.of_parametersAffine htest.parametersAffine⟩, newtonRepeatedRootTests_iff_parametersAffine c⟩ /-- The finite preservation property implies the finite repeated-root tests. -/ @@ -366,7 +366,7 @@ theorem NewtonRepeatedRootTestsUpTo.parametersAffineUpTo /-- An arithmetic progression through index `N - 1` preserves all admissible inputs of degree at most `N`. -/ -theorem NewtonParametersAffineUpTo.preservesNonposRootedUpTo +theorem _root_.RealRooted.NewtonPreservesNonposRootedUpTo.of_parametersAffineUpTo {N : ℕ} {c : ℕ → ℝ} (hc : NewtonParametersAffineUpTo N c) : NewtonPreservesNonposRootedUpTo N c := by obtain ⟨h, hh, hc⟩ := hc @@ -386,7 +386,8 @@ theorem NewtonParametersAffineUpTo.preservesNonposRootedUpTo basisTransform (newtonBasisPolynomial d) p exact basisTransform_eq_of_eq_on_support hbasis rw [htransform] - exact (show NewtonParametersAffine d from ⟨h, hh, fun j => by simp [d]⟩).preservesNonposRooted + exact NewtonPreservesNonposRooted.of_parametersAffine + (show NewtonParametersAffine d from ⟨h, hh, fun j => by simp [d]⟩) p hproots /-- Through degree `N ≥ 2`, repeated-root tests are equivalent to affine @@ -398,7 +399,7 @@ theorem newtonRepeatedRootTestsUpTo_iff_parametersAffineUpTo · intro htest exact htest.parametersAffineUpTo hN · intro haffine - exact haffine.preservesNonposRootedUpTo.repeatedRootTestsUpTo + exact (NewtonPreservesNonposRootedUpTo.of_parametersAffineUpTo haffine).repeatedRootTestsUpTo /-- Through degree `N ≥ 2`, preservation is equivalent to affine Newton parameters through index `N - 1`. -/ @@ -408,7 +409,7 @@ theorem newtonPreservesNonposRootedUpTo_iff_parametersAffineUpTo constructor · intro hpres exact hpres.repeatedRootTestsUpTo.parametersAffineUpTo hN - · exact NewtonParametersAffineUpTo.preservesNonposRootedUpTo + · exact RealRooted.NewtonPreservesNonposRootedUpTo.of_parametersAffineUpTo /-- Through degree `N ≥ 2`, preservation, repeated-root tests, and affine parameters through index `N - 1` are equivalent. -/ @@ -417,7 +418,8 @@ theorem newtonBasis_preserver_equivalencesUpTo (NewtonPreservesNonposRootedUpTo N c ↔ NewtonRepeatedRootTestsUpTo N c) ∧ (NewtonRepeatedRootTestsUpTo N c ↔ NewtonParametersAffineUpTo N c) := by exact ⟨⟨NewtonPreservesNonposRootedUpTo.repeatedRootTestsUpTo, - fun htest => (htest.parametersAffineUpTo hN).preservesNonposRootedUpTo⟩, + fun htest => NewtonPreservesNonposRootedUpTo.of_parametersAffineUpTo + (htest.parametersAffineUpTo hN)⟩, newtonRepeatedRootTestsUpTo_iff_parametersAffineUpTo hN c⟩ end RealRooted diff --git a/RealRooted/BasisTransform/OrderTwoPF.lean b/RealRooted/BasisTransform/OrderTwoPF.lean index 944690b62..7e6b113ce 100644 --- a/RealRooted/BasisTransform/OrderTwoPF.lean +++ b/RealRooted/BasisTransform/OrderTwoPF.lean @@ -701,7 +701,7 @@ theorem orderTwoBasis_isPFPolynomial_of_conditions /-- Preserving all PF polynomials is equivalent to every order-two basis row being PF. -/ -theorem basisTransform_orderTwoBasis_preserves_pf_iff_rows_pf +theorem _root_.RealRooted.OrderTwoBasis.forall_isPFPolynomial_iff_rows {a b c s : ℝ} (ha : 0 ≤ a) (hb : 0 < b) (hs : 0 ≤ s) : (∀ p : ℝ[X], IsPFPolynomial p → IsPFPolynomial (basisTransform (orderTwoBasis a b c s) p)) ↔ @@ -752,14 +752,14 @@ theorem orderTwoBasis_pf_equivalences ∀ n, 0 ≤ (orderTwoBasis a b c s n).eval 0) ∧ ((∀ n, 0 ≤ (orderTwoBasis a b c s n).eval 0) ↔ 0 ≤ a ^ 2 + 4 * c ∧ (2 * s ≥ a ∨ c ≥ s ^ 2 - a * s)) := by - exact ⟨basisTransform_orderTwoBasis_preserves_pf_iff_rows_pf ha hb hs, + exact ⟨RealRooted.OrderTwoBasis.forall_isPFPolynomial_iff_rows ha hb hs, forall_orderTwoBasis_isPFPolynomial_iff_eval_zero_nonneg ha hb hs, forall_orderTwoBasis_eval_zero_nonneg_iff ha hs⟩ /-- Restricting PF inputs to have all roots in `[-R, 0]` gives exactly the same criterion, for every nonnegative `R`. Necessity is witnessed by monomials. -/ -theorem basisTransform_orderTwoBasis_preserves_bounded_pf_iff +theorem _root_.RealRooted.OrderTwoBasis.forall_isPFPolynomial_iff_of_root_bounds {a b c s R : ℝ} (ha : 0 ≤ a) (hb : 0 < b) (hs : 0 ≤ s) (hR : 0 ≤ R) : (∀ p : ℝ[X], IsPFPolynomial p → (∀ r ∈ p.roots, -R ≤ r ∧ r ≤ 0) → @@ -784,7 +784,7 @@ theorem basisTransform_orderTwoBasis_preserves_bounded_pf_iff (forall_orderTwoBasis_eval_zero_nonneg_iff (b := b) ha hs).2 hconditions have hrows := (forall_orderTwoBasis_isPFPolynomial_iff_eval_zero_nonneg ha hb hs).2 heval - exact (basisTransform_orderTwoBasis_preserves_pf_iff_rows_pf ha hb hs).2 + exact (RealRooted.OrderTwoBasis.forall_isPFPolynomial_iff_rows ha hb hs).2 hrows p hp /-- There is no universal finite degree cap for detecting preservation. For @@ -838,7 +838,7 @@ theorem exists_orderTwoBasis_finite_cap_counterexample (N : ℕ) : (by norm_num) (by norm_num) (by norm_num) hp · intro hall have hrowsPF := - (basisTransform_orderTwoBasis_preserves_pf_iff_rows_pf + (RealRooted.OrderTwoBasis.forall_isPFPolynomial_iff_rows (a := (1 : ℝ)) (b := 1) (c := c) (s := 1) (by norm_num) (by norm_num) (by norm_num)).1 hall have heval := diff --git a/RealRooted/BasisTransform/SemigroupClassification.lean b/RealRooted/BasisTransform/SemigroupClassification.lean index ce372c6f0..edf49f746 100644 --- a/RealRooted/BasisTransform/SemigroupClassification.lean +++ b/RealRooted/BasisTransform/SemigroupClassification.lean @@ -115,7 +115,7 @@ private theorem raySemigroupTransform_shifted_square (a b t r : ℝ) : /-- The algebraic ray semigroup preserves every PF polynomial at every nonnegative time exactly when both generator parameters are nonnegative. -/ -theorem raySemigroupTransform_preservesPF_iff (a b : ℝ) : +theorem _root_.RealRooted.RaySemigroup.forall_isPFPolynomial_iff (a b : ℝ) : (∀ t, 0 ≤ t → ∀ {p : ℝ[X]}, IsPFPolynomial p → IsPFPolynomial (raySemigroupTransform a b t p)) ↔ 0 ≤ a ∧ 0 ≤ b := by @@ -412,14 +412,14 @@ theorem finiteEndomorphismLog_raySemigroupEnd_parameters (a b : ℝ) : /-- Logarithmic recognition of the PF-preserving members of the algebraic ray semigroup family. The degree-two finite logarithm already detects both generator parameters. -/ -theorem raySemigroupTransform_preservesPF_iff_finiteLog (a b : ℝ) : +theorem _root_.RealRooted.RaySemigroup.forall_isPFPolynomial_iff_finiteLog (a b : ℝ) : (∀ t, 0 ≤ t → ∀ {p : ℝ[X]}, IsPFPolynomial p → IsPFPolynomial (raySemigroupTransform a b t p)) ↔ 0 ≤ (finiteEndomorphismLog 2 (raySemigroupEnd a b 1) X).coeff 0 ∧ 0 ≤ (finiteEndomorphismLog 2 (raySemigroupEnd a b 1) (X ^ 2)).coeff 1 / 2 - (finiteEndomorphismLog 2 (raySemigroupEnd a b 1) X).coeff 0 := by - rw [raySemigroupTransform_preservesPF_iff, + rw [RealRooted.RaySemigroup.forall_isPFPolynomial_iff, finiteEndomorphismLog_raySemigroupEnd_X, finiteEndomorphismLog_raySemigroupEnd_X_sq] simp only [coeff_C_zero, coeff_C_mul, coeff_X, ite_true] diff --git a/RealRooted/BrandenLeite/LogarithmicInterlacing.lean b/RealRooted/BrandenLeite/LogarithmicInterlacing.lean index 6ddaa80e1..2e5e75082 100644 --- a/RealRooted/BrandenLeite/LogarithmicInterlacing.lean +++ b/RealRooted/BrandenLeite/LogarithmicInterlacing.lean @@ -18,7 +18,7 @@ namespace RealRooted.BrandenLeite /-- Positive-exponent PF and interlacing certificates pass to the normalized zero-exponent limit defining the logarithmic rows. Only a uniform degree bound is needed; the limit may lose degree. -/ -theorem affineLogCoeff_pf_and_interl_of_positive_powers +theorem affineLogCoeff_isPFPolynomial_and_interl_of_pos (Q B : PowerSeries ℝ) (hQ : PowerSeries.constantCoeff Q = 1) (hB : PowerSeries.constantCoeff B = 0) (hpf : ∀ a : ℝ, 0 < a → ∀ j, @@ -100,7 +100,7 @@ private theorem pf_and_interl_aux exact Nat.lt_of_not_ge hk simpa only [Polynomial.coeff_eq_zero_of_natDegree_lt hlarge] using (le_refl (0 : ℝ)) - exact affineLogCoeff_pf_and_interl_of_positive_powers + exact affineLogCoeff_isPFPolynomial_and_interl_of_pos (Q : PowerSeries ℝ) (B : PowerSeries ℝ) hQ0 hB0 (fun a ha j => (hprops a ha j).1) (fun a ha j => (hprops a ha j).2.1) @@ -140,7 +140,7 @@ end rows of positive index are PF and consecutively interlace in the oriented zero-aware relation. Degree and strict coefficient positivity are separate algebraic conclusions, not assumptions in this limit argument. -/ -theorem affineLogCoeff_factor_pf_and_interl +theorem affineLogCoeff_factor_isPFPolynomial_and_interl {ι ν : Type*} (s : Finset ι) (hs : s.Nonempty) (α : ι → ℝ) (hα : ∀ i ∈ s, 0 < α i) (t : Finset ν) (β : ν → ℝ) (hβ : ∀ j ∈ t, 0 ≤ β j) {c : ℝ} (hc : 0 < c) diff --git a/RealRooted/BrandenLeite/PositivePowerRegularization.lean b/RealRooted/BrandenLeite/PositivePowerRegularization.lean index 843df42f9..a27b0bdf6 100644 --- a/RealRooted/BrandenLeite/PositivePowerRegularization.lean +++ b/RealRooted/BrandenLeite/PositivePowerRegularization.lean @@ -26,7 +26,7 @@ namespace RealRooted.BrandenLeite /-- Translating the quotient by the compulsory factor `X` regularizes a nonzero PF numerator to one with positive first coefficient while preserving its zero constant coefficient. -/ -theorem exists_pf_coeff_one_pos_approximation +theorem exists_isPFPolynomial_coeff_one_pos_approximation (B : ℝ[X]) (hBne : B ≠ 0) (hB0 : B.coeff 0 = 0) (hBs : B.Splits) (hBnn : HasNonnegCoeffs B) : ∃ P : ℕ → ℝ[X], @@ -103,7 +103,7 @@ theorem interl_affineNegativePowerCoeff_prod_linear_succ (affineNegativePowerCoeff κ ((∏ i ∈ s, (1 - C (α i) * X) : ℝ[X]) : PowerSeries ℝ) B (n + 1)) := by obtain ⟨P, hPpf, hP0, hP1, hPlim⟩ := - exists_pf_coeff_one_pos_approximation B hBne hB0 hBs hBnn + exists_isPFPolynomial_coeff_one_pos_approximation B hBne hB0 hBs hBnn let Q : ℝ[X] := ∏ i ∈ s, (1 - C (α i) * X) have hQ0 : Q.coeff 0 = 1 := Polynomial.coeff_zero_prod_one_sub_C_mul_X s α obtain ⟨hQs, hQnn⟩ := diff --git a/RealRooted/Challenges/Combinatorial/BrandenLeite.lean b/RealRooted/Challenges/Combinatorial/BrandenLeite.lean index 9331f45dd..d4875a5e2 100644 --- a/RealRooted/Challenges/Combinatorial/BrandenLeite.lean +++ b/RealRooted/Challenges/Combinatorial/BrandenLeite.lean @@ -221,7 +221,7 @@ module = "RealRooted.BrandenLeite.LogarithmDegree" label = "Logarithmic rows have exact degree ⌊n/r⌋ and positive coefficients" [[theorems]] -name = "RealRooted.BrandenLeite.affineLogCoeff_factor_pf_and_interl" +name = "RealRooted.BrandenLeite.affineLogCoeff_factor_isPFPolynomial_and_interl" module = "RealRooted.BrandenLeite.LogarithmicInterlacing" label = "Logarithmic rows are PF polynomials and consecutive rows interlace" diff --git a/RealRooted/Challenges/Combinatorial/Hoggatt.lean b/RealRooted/Challenges/Combinatorial/Hoggatt.lean index 5ec117dc9..449fb673c 100644 --- a/RealRooted/Challenges/Combinatorial/Hoggatt.lean +++ b/RealRooted/Challenges/Combinatorial/Hoggatt.lean @@ -33,7 +33,7 @@ label = "For every m ≥ 2, consecutive Hoggatt rows strictly interlace" headline = true [[theorems]] -name = "RealRooted.Hoggatt.polynomial_pred_interlaces" +name = "RealRooted.Hoggatt.polynomial_pred_interlaces_and_isCoprime" module = "RealRooted.CombinatorialExamples.Hoggatt" label = "F(n−1,m) strictly interlaces F(n,m) for n ≥ m ≥ 2" @@ -66,7 +66,7 @@ label = "The binomial-product polynomials have simple roots for m ≥ 2" [[theorems]] objects = ["Baxter descent polynomials"] property = "interlacing" -name = "RealRooted.Hoggatt.baxter_interlaces" +name = "RealRooted.Hoggatt.baxter_interlaces_and_isCoprime" module = "RealRooted.CombinatorialExamples.Hoggatt" label = "Baxter polynomials are a strict Sturm sequence" diff --git a/RealRooted/Challenges/Interlacing/CommonInterleaver.lean b/RealRooted/Challenges/Interlacing/CommonInterleaver.lean index c65b646c6..1999ee3a1 100644 --- a/RealRooted/Challenges/Interlacing/CommonInterleaver.lean +++ b/RealRooted/Challenges/Interlacing/CommonInterleaver.lean @@ -145,7 +145,7 @@ module = "RealRooted.DegreeDropDivXPrec" label = "For g(0) = 0 and deg g = deg f + 1 with nonnegative coefficients: f ≪ g iff g/X ≪ f" [[theorems]] -name = "RealRooted.leanderTransform_preserves_compatibility" +name = "RealRooted.Compatible.leanderTransform_ordered" module = "RealRooted.Compatibility.Leander" label = "Leander: the transform preserves ordered compatibility" diff --git a/RealRooted/Challenges/Interlacing/MaWangEndpointSteps.lean b/RealRooted/Challenges/Interlacing/MaWangEndpointSteps.lean index cc8864f61..8d6d2ac07 100644 --- a/RealRooted/Challenges/Interlacing/MaWangEndpointSteps.lean +++ b/RealRooted/Challenges/Interlacing/MaWangEndpointSteps.lean @@ -87,7 +87,7 @@ module = "RealRooted.MaWang.GrowingZeroMultiplicity" label = "The PF threshold depends on the multiplicity of the root zero: 0 ≤ a + u m₀" [[theorems]] -name = "RealRooted.growingZeroFamily_pf_degree_multiplicity_interlacing" +name = "RealRooted.GrowingZeroFamily.isPFPolynomial_degree_multiplicity_interlacing" module = "RealRooted.MaWang.GrowingZeroMultiplicity" label = "The integer growing-zero family is PF and interlacing, with endpoint multiplicity at zero" diff --git a/RealRooted/Challenges/PolyaFrequency/LeftProductionMatrix.lean b/RealRooted/Challenges/PolyaFrequency/LeftProductionMatrix.lean index 1ce6f82c4..a58b92b76 100644 --- a/RealRooted/Challenges/PolyaFrequency/LeftProductionMatrix.lean +++ b/RealRooted/Challenges/PolyaFrequency/LeftProductionMatrix.lean @@ -1,6 +1,6 @@ module -import RealRooted.TotalPositivity.PFRiordan +import RealRooted.Applications.OEIS.A114123 /-! # Totally nonnegative left production matrices @@ -72,8 +72,8 @@ module = "RealRooted.TotalPositivity.PFRiordan" label = "Recurrence criterion for real roots via Pólya frequency Riordan arrays" [[theorems]] -name = "RealRooted.PFRiordan.a114123Row_splits_and_roots_nonpos" -module = "RealRooted.TotalPositivity.PFRiordan" +name = "RealRooted.Applications.OEIS.A114123.row_splits_and_roots_nonpos" +module = "RealRooted.Applications.OEIS.A114123" label = "A114123 rows split with nonpositive roots" [[theorems]] diff --git a/RealRooted/Challenges/Preservers/BasisTransformPreservers.lean b/RealRooted/Challenges/Preservers/BasisTransformPreservers.lean index 66e450fb9..e9e05bbd0 100644 --- a/RealRooted/Challenges/Preservers/BasisTransformPreservers.lean +++ b/RealRooted/Challenges/Preservers/BasisTransformPreservers.lean @@ -71,7 +71,7 @@ module = "RealRooted.BasisTransform.OrderTwoPF" label = "PF preservation for an order-two basis: four equivalent conditions" [[theorems]] -name = "RealRooted.basisTransform_orderTwoBasis_preserves_bounded_pf_iff" +name = "RealRooted.OrderTwoBasis.forall_isPFPolynomial_iff_of_root_bounds" module = "RealRooted.BasisTransform.OrderTwoPF" label = "Bounded-root PF inputs already detect the order-two criterion" @@ -81,7 +81,7 @@ module = "RealRooted.BasisTransform.OrderTwoPF" label = "No degree cap detects PF preservation for order-two bases" [[theorems]] -name = "RealRooted.raySemigroupTransform_preservesPF_iff" +name = "RealRooted.RaySemigroup.forall_isPFPolynomial_iff" module = "RealRooted.BasisTransform.SemigroupClassification" label = "The ray semigroup preserves PF polynomials exactly when a, b ≥ 0" @@ -91,7 +91,7 @@ module = "RealRooted.BasisTransform.SemigroupClassification" label = "The semigroup law T_{s+t} = T_s T_t" [[theorems]] -name = "RealRooted.raySemigroupTransform_preservesPF_iff_finiteLog" +name = "RealRooted.RaySemigroup.forall_isPFPolynomial_iff_finiteLog" module = "RealRooted.BasisTransform.SemigroupClassification" label = "The degree-two finite logarithm detects PF preservation of the semigroup" diff --git a/RealRooted/Challenges/Preservers/FiniteDegreeDifferentialTests.lean b/RealRooted/Challenges/Preservers/FiniteDegreeDifferentialTests.lean index 17f57dd7f..af6d46bd8 100644 --- a/RealRooted/Challenges/Preservers/FiniteDegreeDifferentialTests.lean +++ b/RealRooted/Challenges/Preservers/FiniteDegreeDifferentialTests.lean @@ -82,17 +82,17 @@ module = "RealRooted.FiniteFreeAdditive.FiniteDegreeOrderedTests" label = "Binomial symbols with Jensen tests (sX + 1)^r, (sX + 1)^(r-1): ordered PF images" [[theorems]] -name = "RealRooted.FiniteDegreeOrdered.binomialDifferentialRecurrence_pf_and_interl" +name = "RealRooted.IsPFPolynomial.binomialDifferentialRecurrence_and_interl" module = "RealRooted.FiniteFreeAdditive.FiniteDegreeOrderedTests" label = "A binomial differential recurrence row is PF and preceded by the leading image" [[theorems]] -name = "RealRooted.differentialRecurrence_pf_and_interl" +name = "RealRooted.differentialRecurrence_isPFPolynomial_and_interl" module = "RealRooted.FiniteFreeAdditive.FiniteDegreeTests" label = "An ordered PF pair of images gives a PF row X h(D)p + a k(D)p preceded by h(D)p" [[theorems]] -name = "RealRooted.multishiftDifferentialRecurrence_pf_and_interl" +name = "RealRooted.IsPFPolynomial.multishiftDifferentialRecurrence_and_interl" module = "RealRooted.FiniteFreeAdditive.FiniteDegreeCompanions" label = "Multishift recurrence rows are PF and preceded by the full-symbol image" @@ -112,7 +112,7 @@ module = "RealRooted.FiniteFreeAdditive.FiniteDegreeCompanionCone" label = "All-degree ordered PF preservation by (h, k) is equivalent to k being PF and k ≪ h" [[theorems]] -name = "RealRooted.evenDerivative_preservesPF_tfae" +name = "RealRooted.EvenDerivative.isPFPolynomial_tfae" module = "RealRooted.EvenDerivative.Preserver" label = "Δ_c preserves PF through degree N iff Δ_c(xᴺ) is real-rooted iff p_N is real-rooted" diff --git a/RealRooted/CombinatorialExamples/EvenBinomChebyshevTransport.lean b/RealRooted/CombinatorialExamples/EvenBinomChebyshevTransport.lean index aaa98eb30..8aa73da56 100644 --- a/RealRooted/CombinatorialExamples/EvenBinomChebyshevTransport.lean +++ b/RealRooted/CombinatorialExamples/EvenBinomChebyshevTransport.lean @@ -105,7 +105,7 @@ theorem homogenizedSubstitution_chebyshev_T_eq_evenBinomPolyReal (d : ℕ) : /-- The natural-degree cleared Mobius substitution sends a constant shift of `T d` to the corresponding alternating binomial perturbation. -/ -theorem rationalSubstitution_chebyshev_T_add_C_eq_evenBinomPolyReal_add +theorem _root_.RealRooted.Chebyshev.rationalSubstitution_T_add_C_eq (d : ℕ) (c : ℝ) : rationalSubstitution (1 + X) (1 - X) (Polynomial.Chebyshev.T ℝ d + C c) = @@ -163,7 +163,7 @@ theorem evenBinomPolyReal_add_C_mul_one_sub_X_pow_not_splits have htransport := (rationalSubstitution_splits_iff hq one_sub_X_ne_zero isCoprime_one_add_X_one_sub_X hasNonconstantRatio_one_add_X_one_sub_X).mp apply (htransport ?_).1 - rw [rationalSubstitution_chebyshev_T_add_C_eq_evenBinomPolyReal_add] + rw [RealRooted.Chebyshev.rationalSubstitution_T_add_C_eq] exact hsplit /-- In every degree at least two, all binomially bounded perturbations are diff --git a/RealRooted/CombinatorialExamples/EvenBinomPerturbation.lean b/RealRooted/CombinatorialExamples/EvenBinomPerturbation.lean index 053be5cf5..09ba7011e 100644 --- a/RealRooted/CombinatorialExamples/EvenBinomPerturbation.lean +++ b/RealRooted/CombinatorialExamples/EvenBinomPerturbation.lean @@ -464,37 +464,4 @@ theorem evenBinomPolyReal_four_add_one_sub_X_sq_not_splits · rw [discrim] nlinarith -/-- In degree two, every binomially bounded perturbation is real-rooted exactly when -`M ≤ alpha`; real-rootedness is expressed in its zero-aware form. -/ -theorem all_evenBinomPolyReal_four_add_eq_zero_or_splits_iff_le - {alpha M : ℝ} (halpha : 0 < alpha) (hM : 0 ≤ M) : - (∀ h : ℝ[X], h.natDegree ≤ 2 → - (∀ k ≤ 2, |h.coeff k| ≤ M * Nat.choose 2 k) → - C alpha * BigDescents.evenBinomPolyReal 4 + h = 0 ∨ - (C alpha * BigDescents.evenBinomPolyReal 4 + h).Splits) ↔ - M ≤ alpha := by - constructor - · intro hall - by_contra hnot - have hMalpha : alpha < M := lt_of_not_ge hnot - let h : ℝ[X] := C M * (1 - X) ^ 2 - have hdegree : h.natDegree ≤ 2 := by - dsimp [h] - compute_degree - have heq : h = C M + C (-2 * M) * X + C M * X ^ 2 := by - dsimp [h] - simp only [C_neg, C_mul, Polynomial.C_ofNat] - ring - have hcoeff : ∀ k ≤ 2, |h.coeff k| ≤ M * Nat.choose 2 k := by - intro k hk - rw [heq] - interval_cases k <;> - norm_num [coeff_add, coeff_C_mul, coeff_X_pow, abs_mul, abs_of_nonneg hM]; - nlinarith - have hsplit := (hall h hdegree hcoeff).elim (fun hz => hz ▸ Splits.zero) id - exact evenBinomPolyReal_four_add_one_sub_X_sq_not_splits halpha hMalpha hsplit - · intro hMalpha h hdegree hcoeff - exact (evenBinomPolyReal_add_isPFPolynomial_of_coeff_bound - (d := 2) (by norm_num) halpha hM hMalpha hdegree hcoeff).eq_zero_or_splits - end RealRooted diff --git a/RealRooted/CombinatorialExamples/Hoggatt.lean b/RealRooted/CombinatorialExamples/Hoggatt.lean index 40b6350fa..5904bee01 100644 --- a/RealRooted/CombinatorialExamples/Hoggatt.lean +++ b/RealRooted/CombinatorialExamples/Hoggatt.lean @@ -393,7 +393,7 @@ theorem polynomial_interlaces_and_isCoprime {n m : ℕ} (hm : 2 ≤ m) (hn : m ⟨polynomial_interlaces (by lia) hn, polynomial_isCoprime_succ hm hn⟩ /-- The indexing of the strict comparison stated in Fang–Zhang–Zhao, §2. -/ -theorem polynomial_pred_interlaces {n m : ℕ} (hm : 2 ≤ m) (hn : m ≤ n) : +theorem polynomial_pred_interlaces_and_isCoprime {n m : ℕ} (hm : 2 ≤ m) (hn : m ≤ n) : Interlaces (polynomial (n - 1) m) (polynomial n m) ∧ IsCoprime (polynomial (n - 1) m) (polynomial n m) := by simpa only [Nat.sub_add_cancel (by lia : 1 ≤ n)] using @@ -467,7 +467,7 @@ theorem normalized_interlaces_and_isCoprime {n m : ℕ} (hn : n ≠ 0) (hm : 2 exact (polynomial_isCoprime_succ hm (by lia)).not_isRoot_right hp hq /-- The Baxter specialization is a strict Sturm sequence. -/ -theorem baxter_interlaces {n : ℕ} (hn : n ≠ 0) : +theorem baxter_interlaces_and_isCoprime {n : ℕ} (hn : n ≠ 0) : Interlaces (normalized n 3) (normalized (n + 1) 3) ∧ IsCoprime (normalized n 3) (normalized (n + 1) 3) := normalized_interlaces_and_isCoprime hn (by norm_num) diff --git a/RealRooted/CombinatorialExamples/PathDerivativeImages.lean b/RealRooted/CombinatorialExamples/PathDerivativeImages.lean index 7f1ad42d1..9b1a63f9e 100644 --- a/RealRooted/CombinatorialExamples/PathDerivativeImages.lean +++ b/RealRooted/CombinatorialExamples/PathDerivativeImages.lean @@ -44,7 +44,7 @@ theorem coeff_degreeControlledDerivativeImage_succ (N c : ℝ) (f : ℝ[X]) (k : /-- A degree-controlled derivative image of a nonzero PF polynomial is PF and is preceded by its input in directed proper position. -/ -theorem IsPFPolynomial.degreeControlledDerivativeImage_isPF_and_strictInterl +theorem _root_.RealRooted.IsPFPolynomial.degreeControlledDerivativeImage_and_strictInterl {f : ℝ[X]} {N c : ℝ} (hf : IsPFPolynomial f) (hf0 : f ≠ 0) (hc : 0 ≤ c) (hN : c * f.natDegree ≤ N) : IsPFPolynomial (degreeControlledDerivativeImage N c f) ∧ @@ -180,13 +180,13 @@ def pathDerivativeImage (a b c v : ℝ) (n : ℕ) : ℝ[X] := /-- In the parameter region `b ≥ 0`, `2a ≥ c`, every path derivative image is PF and is preceded by its path row in directed proper position. -/ -theorem pathDerivativeImage_isPF_and_strictInterl +theorem pathDerivativeImage_isPFPolynomial_and_strictInterl {a b c v : ℝ} (hc : 0 ≤ c) (hb : 0 ≤ b) (hac : c ≤ 2 * a) (hv : 0 < v) (n : ℕ) : IsPFPolynomial (pathDerivativeImage a b c v n) ∧ StrictInterl (weightedPathPolynomial v n) (pathDerivativeImage a b c v n) := by have hpf := isPFPolynomial_weightedPathPolynomial v n hv - apply hpf.degreeControlledDerivativeImage_isPF_and_strictInterl + apply hpf.degreeControlledDerivativeImage_and_strictInterl · exact hpf.ne_zero_and_splits (by intro hzero have := congrArg (fun p : ℝ[X] ↦ p.coeff 0) hzero @@ -257,7 +257,7 @@ theorem forall_pathDerivativeImage_isPF_iff rw [coeff_pathDerivativeImage_even_top] at hnonneg nlinarith [pow_pos hv m] · rintro ⟨hb, hac⟩ n - exact (pathDerivativeImage_isPF_and_strictInterl hc hb hac hv n).1 + exact (pathDerivativeImage_isPFPolynomial_and_strictInterl hc hb hac hv n).1 /-- With zero edge weight, every weighted path row is the constant one. -/ @[simp] @@ -369,4 +369,8 @@ theorem eq_pathDerivativeImage_of_seeds_and_recurrence rw [hrec, pathDerivativeImage_add_four, ih (k + 3) (by lia), ih (k + 2) (by lia), ih (k + 1) (by lia), ih k (by lia)] +@[deprecated (since := "2026-11-14")] +alias pathDerivativeImage_isPF_and_strictInterl := + pathDerivativeImage_isPFPolynomial_and_strictInterl + end RealRooted diff --git a/RealRooted/Compatibility/Leander.lean b/RealRooted/Compatibility/Leander.lean index df47b1f76..71165df28 100644 --- a/RealRooted/Compatibility/Leander.lean +++ b/RealRooted/Compatibility/Leander.lean @@ -19,7 +19,7 @@ ordered compatibility conditions. No output positive-leading claim is included: for a singleton family the transform output is identically zero. -/ -theorem leanderTransform_preserves_compatibility {n : ℕ} +theorem _root_.RealRooted.Compatible.leanderTransform_ordered {n : ℕ} (f : Fin n → ℝ[X]) (hpos : ∀ h, HasPosLeadingCoeff (f h)) (hff : ∀ ⦃i j⦄, i ≤ j → Compatible (f i) (f j)) @@ -48,7 +48,7 @@ theorem leanderTransform_two_compatible (f : Fin 2 → ℝ[X]) (hXf : ∀ ⦃i j⦄, i ≤ j → Compatible (X * f i) (f j)) : Compatible (f 1) (X * f 0) ∧ Compatible (X * f 1) (X * f 0) := by - have h := leanderTransform_preserves_compatibility f hpos hff hXf + have h := RealRooted.Compatible.leanderTransform_ordered f hpos hff hXf have h01 : (0 : Fin 2) ≤ 1 := by decide simpa using And.intro (h.1 h01) (h.2 h01) diff --git a/RealRooted/DerivativeRecurrence/HalfDegree.lean b/RealRooted/DerivativeRecurrence/HalfDegree.lean new file mode 100644 index 000000000..f538601e7 --- /dev/null +++ b/RealRooted/DerivativeRecurrence/HalfDegree.lean @@ -0,0 +1,78 @@ +module + +public import RealRooted.Basic.ProperPosition +public import RealRooted.Basic.Coefficients +import RealRooted.DerivativeRecurrence.Interlacing +import RealRooted.MaWang.DerivativeStep +import RealRooted.ThreeTermRecurrence.Interlacing + +/-! +# Strict interlacing of derivative recurrences of half degree + +Two consecutive-interlacing theorems for nonnegative derivative recurrences +`Q (n + 1) = A n * (Q n)' + B n * Q n` whose degrees grow by half a degree per step. The row +tactics apply them in the `degreePattern` and `fTransform` routes. +-/ + +public section + +open Polynomial + +namespace RealRooted + +/-- Consecutive strict interlacing for a nonnegative derivative-recurrence sequence whose +degree is `(n + 1) / 2`, including the degree-zero initial row. -/ +theorem derivativeRecurrence_strictInterl_of_half_degree + {Q A B : ℕ → ℝ[X]} + (hrec : ∀ n, Q (n + 1) = A n * (Q n).derivative + B n * Q n) + (hdeg : ∀ n, (Q n).natDegree = (n + 1) / 2) + (hpos : ∀ n, 0 < (Q n).leadingCoeff) + (hnn : ∀ n, HasNonnegCoeffs (Q n)) + (hA : ∀ n r, r ≤ 0 → (A n).eval r ≤ 0) : + ∀ n, StrictInterl (Q n) (Q (n + 1)) + | 0 => + (interlaces_of_natDegree_eq_zero_of_natDegree_eq_one + (Polynomial.leadingCoeff_ne_zero.mp (hpos 0).ne') (hdeg 0) (hdeg 1)).toStrictInterl + | n + 1 => by + refine derivativeRecurrence_strictInterl_step (hrec (n + 1)) + (derivativeRecurrence_strictInterl_of_half_degree hrec hdeg hpos hnn hA n).2.1.2 + (by rw [hdeg]; grind) (hpos (n + 1)) (hpos (n + 2)) + (by rw [hdeg, hdeg]; grind) (by rw [hdeg, hdeg]; grind) ?_ + intro r hr + apply hA (n + 1) r + exact roots_nonpos_of_hasNonnegCoeffs (hnn (n + 1)) r + ((Polynomial.mem_roots + (Polynomial.leadingCoeff_ne_zero.mp (hpos (n + 1)).ne')).mpr hr) + +/-- Consecutive strict interlacing for a nonnegative derivative recurrence of +degree `n / 2`. The Ma--Wang constant-row branch handles the initial +constant-to-constant step. -/ +theorem derivativeRecurrence_strictInterl_of_floor_half_degree + {Q A B : ℕ → ℝ[X]} + (hrec : ∀ n, Q (n + 1) = A n * (Q n).derivative + B n * Q n) + (hdeg : ∀ n, (Q n).natDegree = n / 2) + (hpos : ∀ n, 0 < (Q n).leadingCoeff) + (hnn : ∀ n, HasNonnegCoeffs (Q n)) + (hA : ∀ n r, r ≤ 0 → (A n).eval r ≤ 0) : + ∀ n, StrictInterl (Q n) (Q (n + 1)) := by + have hstep (n : ℕ) (hs : (Q n).Splits) : + StrictInterl (Q n) (Q (n + 1)) := by + have hstrict := MaWang.strictInterl_derivative_of_nonpos_of_splits + (u := B n) (v := A n) hs + (by rw [add_comm, ← hrec n, hdeg, hdeg]; grind) + (by rw [add_comm, ← hrec n, hdeg, hdeg]; grind) + (by rw [add_comm, ← hrec n]; exact hpos (n + 1)) (hpos n) (by + intro r hr + apply hA n r + exact roots_nonpos_of_hasNonnegCoeffs (hnn n) r + ((Polynomial.mem_roots + (Polynomial.leadingCoeff_ne_zero.mp (hpos n).ne')).mpr hr)) + rw [add_comm, ← hrec n] at hstrict + exact hstrict + intro n + induction n with + | zero => + exact hstep 0 (Polynomial.Splits.of_natDegree_eq_zero (by rw [hdeg])) + | succ n ih => exact hstep (n + 1) ih.2.1.2 + +end RealRooted diff --git a/RealRooted/EulerianTriangles/LagTwoOperators.lean b/RealRooted/EulerianTriangles/LagTwoOperators.lean index c6196a302..c89f99ca9 100644 --- a/RealRooted/EulerianTriangles/LagTwoOperators.lean +++ b/RealRooted/EulerianTriangles/LagTwoOperators.lean @@ -244,7 +244,7 @@ private theorem simpleNegRooted_polarTheta_succ {d : ℕ} {p : ℝ[X]} mul_pos (show (0 : ℝ) < d + 1 by positivity) hp.coeff_zero_pos /-- The auxiliary operator preserves simple negative roots. -/ -theorem SimpleNegRooted.lagTwoEulerCore_preserves {d : ℕ} {p : ℝ[X]} +protected theorem SimpleNegRooted.lagTwoEulerCore {d : ℕ} {p : ℝ[X]} (hp : SimpleNegRooted p d) : SimpleNegRooted (lagTwoEulerCore d p) d := by have htheta := simpleNegRooted_thetaPlusOne hp @@ -252,7 +252,7 @@ theorem SimpleNegRooted.lagTwoEulerCore_preserves {d : ℕ} {p : ℝ[X]} | zero => have hder : (thetaPlusOne p).derivative = 0 := derivative_eq_zero.mpr htheta.natDegree_eq - have heq : lagTwoEulerCore 0 p = thetaPlusOne p := by + have heq : RealRooted.lagTwoEulerCore 0 p = thetaPlusOne p := by change polarTheta 1 (thetaPlusOne p) = thetaPlusOne p unfold polarTheta theta rw [hder] @@ -381,7 +381,7 @@ private theorem lagTwoEulerBridge_strictInterl_core {d : ℕ} {p : ℝ[X]} (hd : 2 ≤ d) (hp : SimpleNegRooted p d) : StrictInterl (lagTwoEulerBridge d p) (lagTwoEulerCore d p) := by obtain ⟨hh, hhp, hno⟩ := lagTwoEulerBridge_data hd hp - have hq := hp.lagTwoEulerCore_preserves + have hq := hp.lagTwoEulerCore have hpf : IsPFPolynomial p := IsPFPolynomial.of_realRooted_nonneg hp.nonneg hp.splits have hsignProduct : ∀ r, (lagTwoEulerBridge d p).IsRoot r → @@ -482,7 +482,7 @@ private theorem lagTwoEulerBridge_package {d : ℕ} {p : ℝ[X]} have hh : SimpleNegRooted (lagTwoEulerBridge 1 p) 0 := by rw [heq] simpa using SimpleNegRooted.one.C_mul hzero - have hq := hp.lagTwoEulerCore_preserves + have hq := hp.lagTwoEulerCore have hinter : StrictInterl (lagTwoEulerBridge 1 p) (lagTwoEulerCore 1 p) := StrictInterl.of_degree_zero_right_of_degree_one hh.pos.ne_zero hh.splits hq.pos.ne_zero hq.splits @@ -496,11 +496,11 @@ This is the main one-row operator lemma for the lag-two induction. -/ theorem SimpleNegRooted.lagTwoEulerCore_strictInterl_step {d : ℕ} {p : ℝ[X]} (hp : SimpleNegRooted p d) {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : - StrictInterl (lagTwoEulerCore d p) (lagTwoEulerStep d a b p) := by + StrictInterl (RealRooted.lagTwoEulerCore d p) (lagTwoEulerStep d a b p) := by cases d with | zero => have hpder : p.derivative = 0 := derivative_eq_zero.mpr hp.natDegree_eq - have hcore : lagTwoEulerCore 0 p = p := by + have hcore : RealRooted.lagTwoEulerCore 0 p = p := by change polarTheta 1 (thetaPlusOne p) = p simp [thetaPlusOne, polarTheta, theta, hpder] have hstep : lagTwoEulerStep 0 a b p = C a * (1 + X) * p := by @@ -523,12 +523,12 @@ theorem SimpleNegRooted.lagTwoEulerCore_strictInterl_step let D := d + 1 have hD : 0 < D := by simp [D] have hpD : SimpleNegRooted p D := by simpa [D] using hp - have hq : SimpleNegRooted (lagTwoEulerCore D p) D := - hpD.lagTwoEulerCore_preserves + have hq : SimpleNegRooted (RealRooted.lagTwoEulerCore D p) D := + hpD.lagTwoEulerCore have hpf : IsPFPolynomial p := IsPFPolynomial.of_realRooted_nonneg hpD.nonneg hpD.splits have htheta := simpleNegRooted_thetaPlusOne hpD - have hqR : StrictInterl (lagTwoEulerCore D p) (thetaPlusOne p) := by + have hqR : StrictInterl (RealRooted.lagTwoEulerCore D p) (thetaPlusOne p) := by have hshift : 2 ≤ (reciprocalShift (D + 1) (thetaPlusOne p)).natDegree := by have hcoeff : (reciprocalShift (D + 1) (thetaPlusOne p)).coeff (D + 1) ≠ 0 := by @@ -537,7 +537,7 @@ theorem SimpleNegRooted.lagTwoEulerCore_strictInterl_step exact strictInterl_polarTheta_self (thetaPlusOne_preserves_pf hpf) (by rw [htheta.natDegree_eq]; lia) hshift have hpolar := simpleNegRooted_polarTheta_succ hD hpD - have hqS : StrictInterl (lagTwoEulerCore D p) (X * polarTheta (D + 1) p) := by + have hqS : StrictInterl (RealRooted.lagTwoEulerCore D p) (X * polarTheta (D + 1) p) := by rw [lagTwoEulerCore_eq_derivative_X_mul_polarTheta] apply (derivative_interlaces_of_natDegree_ne_zero (Splits.X.mul hpolar.splits) ?_).toStrictInterl @@ -545,14 +545,14 @@ theorem SimpleNegRooted.lagTwoEulerCore_strictInterl_step hpolar.natDegree_eq] lia obtain ⟨hh, hhq⟩ := lagTwoEulerBridge_package hD hpD - have hqXh : StrictInterl (lagTwoEulerCore D p) + have hqXh : StrictInterl (RealRooted.lagTwoEulerCore D p) (X * lagTwoEulerBridge D p) := strictInterl_mul_X_of_strictInterl_of_nonneg hhq hh.nonneg hq.nonneg have hRpos : HasPosLeadingCoeff (thetaPlusOne p) := htheta.pos have hSpos : HasPosLeadingCoeff (X * polarTheta (D + 1) p) := hpolar.pos.X_mul have hXhpos : HasPosLeadingCoeff (X * lagTwoEulerBridge D p) := hh.pos.X_mul - have hsum : StrictInterl (lagTwoEulerCore D p) + have hsum : StrictInterl (RealRooted.lagTwoEulerCore D p) (weightedSum [(a, thetaPlusOne p), (a, X * polarTheta (D + 1) p), (b - a, X * lagTwoEulerBridge D p)]) := by diff --git a/RealRooted/EulerianTriangles/LagTwoRecurrence.lean b/RealRooted/EulerianTriangles/LagTwoRecurrence.lean index 1111adc79..b327f9a8b 100644 --- a/RealRooted/EulerianTriangles/LagTwoRecurrence.lean +++ b/RealRooted/EulerianTriangles/LagTwoRecurrence.lean @@ -147,7 +147,7 @@ theorem lagTwoEuler_recurrence_certificate have hrneg := ih.next.isRoot_neg hr have hderne := ih.next.simple.eval_derivative_ne_zero hr have hauxSign := ih.auxiliary.eval_mul_eval_derivative_nonneg - ih.current.lagTwoEulerCore_preserves.pos ih.next.pos hr + ih.current.lagTwoEulerCore.pos ih.next.pos hr have heval : (P (n + 2)).eval r = b (n + 2) * r * (1 - r) * (P (n + 1)).derivative.eval r + c (n + 2) * r * H.eval r := by @@ -175,8 +175,8 @@ theorem lagTwoEuler_recurrence_certificate have hHq := ih.adjacent.lagTwoEulerCore_adjacent ih.current ih.next have hqXH : StrictInterl (lagTwoEulerCore (n + 1) (P (n + 1))) (X * H) := by exact strictInterl_mul_X_of_strictInterl_of_nonneg hHq - ih.current.lagTwoEulerCore_preserves.nonneg - ih.next.lagTwoEulerCore_preserves.nonneg + ih.current.lagTwoEulerCore.nonneg + ih.next.lagTwoEulerCore.nonneg have haux : StrictInterl (lagTwoEulerCore (n + 1) (P (n + 1))) (P (n + 2)) := by have hsum : StrictInterl (lagTwoEulerCore (n + 1) (P (n + 1))) @@ -187,12 +187,12 @@ theorem lagTwoEuler_recurrence_certificate simp only [List.mem_cons, List.not_mem_nil, or_false] at hcq rcases hcq with rfl | rfl exacts [hqA, hqXH] - · exact ih.next.lagTwoEulerCore_preserves.pos + · exact ih.next.lagTwoEulerCore.pos · intro cq hcq simp only [List.mem_cons, List.not_mem_nil, or_false] at hcq rcases hcq with rfl | rfl · exact hApos - · exact ih.current.lagTwoEulerCore_preserves.pos.X_mul + · exact ih.current.lagTwoEulerCore.pos.X_mul · exact ⟨(1, A), by simp⟩ rw [hrec n] simpa [A, H, L, weightedSum, weightedSum_cons, mul_assoc] using hsum diff --git a/RealRooted/EulerianTriangles/LagTwoTriangle.lean b/RealRooted/EulerianTriangles/LagTwoTriangle.lean index 9d527d384..2b9cb1b2e 100644 --- a/RealRooted/EulerianTriangles/LagTwoTriangle.lean +++ b/RealRooted/EulerianTriangles/LagTwoTriangle.lean @@ -148,11 +148,11 @@ abbrev constantLagTwoEulerRow (m lambda : ℝ) (n : ℕ) : ℝ[X] := lagTwoEulerRow m (fun _ ↦ lambda) n /-- The `lambda = 1` shape represented by A157147--A157151. -/ -abbrev a157147To151Row (m : ℝ) (n : ℕ) : ℝ[X] := +abbrev unitLagTwoEulerRow (m : ℝ) (n : ℕ) : ℝ[X] := constantLagTwoEulerRow m 1 n /-- The A157637 specialization `lambda_n = n / 2`. -/ -abbrev a157637Row (m : ℝ) (n : ℕ) : ℝ[X] := +abbrev halfIndexLagTwoEulerRow (m : ℝ) (n : ℕ) : ℝ[X] := lagTwoEulerRow m (fun j ↦ (j : ℝ) / 2) n theorem constantLagTwoEulerRow_simpleNegRooted_and_strictInterl @@ -163,16 +163,16 @@ theorem constantLagTwoEulerRow_simpleNegRooted_and_strictInterl have h := lagTwoEulerRow_simpleNegRooted_and_strictInterl hm (fun _ ↦ hlambda) n exact ⟨h.1, h.2.1⟩ -theorem a157147To151Row_simpleNegRooted_and_strictInterl +theorem unitLagTwoEulerRow_simpleNegRooted_and_strictInterl {m : ℝ} (hm : 1 ≤ m) (n : ℕ) : - SimpleNegRooted (a157147To151Row m n) n ∧ - StrictInterl (a157147To151Row m n) (a157147To151Row m (n + 1)) := by + SimpleNegRooted (unitLagTwoEulerRow m n) n ∧ + StrictInterl (unitLagTwoEulerRow m n) (unitLagTwoEulerRow m (n + 1)) := by exact constantLagTwoEulerRow_simpleNegRooted_and_strictInterl hm (by norm_num) n -theorem a157637Row_simpleNegRooted_and_strictInterl +theorem halfIndexLagTwoEulerRow_simpleNegRooted_and_strictInterl {m : ℝ} (hm : 1 ≤ m) (n : ℕ) : - SimpleNegRooted (a157637Row m n) n ∧ - StrictInterl (a157637Row m n) (a157637Row m (n + 1)) := by + SimpleNegRooted (halfIndexLagTwoEulerRow m n) n ∧ + StrictInterl (halfIndexLagTwoEulerRow m n) (halfIndexLagTwoEulerRow m (n + 1)) := by have hnonneg : ∀ j : ℕ, 0 ≤ (j : ℝ) / 2 := by intro j; positivity have h := lagTwoEulerRow_simpleNegRooted_and_strictInterl hm hnonneg n exact ⟨h.1, h.2.1⟩ diff --git a/RealRooted/EulerianTriangles/NegativeLagCone.lean b/RealRooted/EulerianTriangles/NegativeLagCone.lean index c6325b2df..fb735754c 100644 --- a/RealRooted/EulerianTriangles/NegativeLagCone.lean +++ b/RealRooted/EulerianTriangles/NegativeLagCone.lean @@ -490,12 +490,12 @@ theorem negativeLagEulerRow_degree_pos_rooted rw [Polynomial.natDegree_C_mul hscale.ne', hcore.1] /-- The A371898 specialization of the negative-lag Euler rows. -/ -abbrev a371898Row : ℕ → ℝ[X] := +abbrev unitNegativeLagEulerRow : ℕ → ℝ[X] := negativeLagEulerRow (fun _ ↦ 1) (fun n ↦ n) -theorem a371898Row_degree_pos_rooted (n : ℕ) : - (a371898Row n).natDegree = n ∧ HasPosLeadingCoeff (a371898Row n) ∧ - IsRealRootedIn (Set.Icc (-1) 0) (a371898Row n) := by +theorem unitNegativeLagEulerRow_degree_pos_rooted (n : ℕ) : + (unitNegativeLagEulerRow n).natDegree = n ∧ HasPosLeadingCoeff (unitNegativeLagEulerRow n) ∧ + IsRealRootedIn (Set.Icc (-1) 0) (unitNegativeLagEulerRow n) := by apply negativeLagEulerRow_degree_pos_rooted · intro k hk norm_num diff --git a/RealRooted/EvenDerivative/Preserver.lean b/RealRooted/EvenDerivative/Preserver.lean index e15acc1b7..c5cf4a5b6 100644 --- a/RealRooted/EvenDerivative/Preserver.lean +++ b/RealRooted/EvenDerivative/Preserver.lean @@ -11,7 +11,7 @@ import RealRooted.ClassicalHurwitzMatrix.Stability.HermiteBiehler # Finite-degree criterion for even-derivative PF preservers For `T_c f = ∑ₖ cₖ xᵏ f^{(2k)}` with `c 0 = 1` and `cₖ ≥ 0`, and every `N`, the following are -equivalent (`evenDerivative_preservesPF_tfae`): +equivalent (`RealRooted.EvenDerivative.isPFPolynomial_tfae`): 1. `T_c` maps PF polynomials of degree at most `N` to PF polynomials; 2. the single image `T_c(uᴺ)` is real-rooted; @@ -85,7 +85,7 @@ theorem isPFPolynomial_evenDerivativeOperator_of_splits_X_pow (hc0 : c 0 = 1) (h /-- **Finite-degree criterion.** For `c 0 = 1` and `cₖ ≥ 0`, the following are equivalent: `T_c` maps PF polynomials of degree at most `N` to PF polynomials; the single image `T_c(uᴺ)` is real-rooted; the test polynomial `p_N` is real-rooted. -/ -theorem evenDerivative_preservesPF_tfae (hc0 : c 0 = 1) (hc : ∀ k, 0 ≤ c k) (N : ℕ) : +theorem EvenDerivative.isPFPolynomial_tfae (hc0 : c 0 = 1) (hc : ∀ k, 0 ≤ c k) (N : ℕ) : List.TFAE [∀ f : ℝ[X], IsPFPolynomial f → f.natDegree ≤ N → IsPFPolynomial (evenDerivativeOperator c f), (evenDerivativeOperator c (X ^ N)).Splits, diff --git a/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanionCone.lean b/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanionCone.lean index 9eb967bf6..d6d2ba709 100644 --- a/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanionCone.lean +++ b/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanionCone.lean @@ -145,7 +145,7 @@ theorem forall_differential_images_iff_isPFPolynomial_and_interl constructor · exact isPFPolynomial_and_interl_of_forall_differential_images · intro hk p hp - apply HasKreinCompanionExpansion.preservesOrderedPF hh hh0 _ hp + apply RealRooted.HasKreinCompanionExpansion.isPFPolynomial_and_interl hh hh0 _ hp exact (isPFPolynomial_and_interl_iff_hasKreinCompanionExpansion hh hh0).mp hk @@ -161,7 +161,7 @@ def HasFiniteCapCompanionCone (N : ℕ) (h k : ℝ[X]) : Prop := /-- Ordered PF preservation through a finite cap is equivalent to membership in the finite-cap companion cone. -/ -theorem preservesOrderedPFUpTo_iff_hasFiniteCapCompanionCone +theorem _root_.RealRooted.PreservesOrderedPFUpTo.iff_hasFiniteCapCompanionCone (N : ℕ) (h k : ℝ[X]) : PreservesOrderedPFUpTo N h k ↔ HasFiniteCapCompanionCone N h k := by rw [PreservesOrderedPFUpTo.iff_jensenDifferentialTests] diff --git a/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanions.lean b/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanions.lean index 0a62141de..0d66b5096 100644 --- a/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanions.lean +++ b/RealRooted/FiniteFreeAdditive/FiniteDegreeCompanions.lean @@ -124,7 +124,7 @@ private theorem kreinSummand_image_ordered /-- Every nonnegative root-deletion expansion yields ordered PF images on every PF input, including annihilated images. -/ -theorem HasKreinCompanionExpansion.preservesOrderedPF +theorem _root_.RealRooted.HasKreinCompanionExpansion.isPFPolynomial_and_interl {h k : ℝ[X]} (hh : IsPFPolynomial h) (hh0 : h ≠ 0) (hk : HasKreinCompanionExpansion h k) {p : ℝ[X]} (hp : IsPFPolynomial p) : @@ -223,7 +223,7 @@ theorem interl_nonneg_combos_of_cross /-- The determinant-condition affine row is PF and is preceded by its leading-coefficient row. -/ -theorem affineDifferentialRow_pf_and_interl +theorem affineDifferentialRow_isPFPolynomial_and_interl {h k p : ℝ[X]} (hh : IsPFPolynomial (applyAsDifferentialOperator h p)) (hk : IsPFPolynomial (applyAsDifferentialOperator k p)) @@ -331,7 +331,7 @@ theorem multishiftDifferentialSymbol_empty (N : ℕ) : /-- The empty-shift recurrence is multiplication by `X`, hence is PF and is preceded by its input. -/ -theorem emptyMultishiftRecurrence_pf_and_interl {p : ℝ[X]} +theorem emptyMultishiftRecurrence_isPFPolynomial_and_interl {p : ℝ[X]} (hp : IsPFPolynomial p) : IsPFPolynomial (X * applyAsDifferentialOperator @@ -470,7 +470,7 @@ theorem interl_multishiftJensenPolynomial_removeNth /-- The full and one-shift-deleted multishift symbols give ordered PF images through their common degree cap. -/ -theorem preservesOrderedPFUpTo_multishift_removeNth +theorem _root_.RealRooted.PreservesOrderedPFUpTo.multishiftDifferentialSymbol_removeNth {N r : ℕ} {s : Fin (r + 1) → ℝ} (hrN : r + 1 ≤ N) (hs : ∀ i, 0 ≤ s i) (i : Fin (r + 1)) : PreservesOrderedPFUpTo N (multishiftDifferentialSymbol N s) @@ -496,7 +496,7 @@ def multishiftDifferentialRecurrence (multishiftDifferentialSymbol N (Fin.removeNth i s)) p /-- The multishift recurrence is PF and is preceded by its full-symbol image. -/ -theorem multishiftDifferentialRecurrence_pf_and_interl +theorem _root_.RealRooted.IsPFPolynomial.multishiftDifferentialRecurrence_and_interl {N r : ℕ} {s a : Fin (r + 1) → ℝ} (hrN : r + 1 ≤ N) (hs : ∀ i, 0 ≤ s i) (ha : ∀ i, 0 ≤ a i) {p : ℝ[X]} (hp : IsPFPolynomial p) (hpdeg : p.natDegree ≤ N) : @@ -514,7 +514,7 @@ theorem multishiftDifferentialRecurrence_pf_and_interl Interl f (applyAsDifferentialOperator (multishiftDifferentialSymbol N (Fin.removeNth i s)) p) := by intro i - exact preservesOrderedPFUpTo_multishift_removeNth hrN hs i hp hpdeg + exact RealRooted.PreservesOrderedPFUpTo.multishiftDifferentialSymbol_removeNth hrN hs i hp hpdeg have hf : IsPFPolynomial f := (hpair 0).1 have hgpf : ∀ i, IsPFPolynomial (g i) := by intro i @@ -592,7 +592,7 @@ theorem multishiftDifferentialRecurrence_induction | succ k ih => have hmk : m ≤ m + k := by lia rw [show m + (k + 1) = (m + k) + 1 by lia, hrec (m + k) hmk] - have hout := multishiftDifferentialRecurrence_pf_and_interl + have hout := RealRooted.IsPFPolynomial.multishiftDifferentialRecurrence_and_interl (hr (m + k) hmk) (hs (m + k)) (ha (m + k)) (ih hmk).1 (ih hmk).2 refine ⟨hout.1, ?_⟩ by_cases hzero : P (m + k) = 0 diff --git a/RealRooted/FiniteFreeAdditive/FiniteDegreeOrderedTests.lean b/RealRooted/FiniteFreeAdditive/FiniteDegreeOrderedTests.lean index ef3bcd9df..b03f41d49 100644 --- a/RealRooted/FiniteFreeAdditive/FiniteDegreeOrderedTests.lean +++ b/RealRooted/FiniteFreeAdditive/FiniteDegreeOrderedTests.lean @@ -315,7 +315,7 @@ private theorem differentialPencilDegreeBoxMap_complexify /-- Ordered PF monomial tests suffice for ordered preservation throughout the degree box. -/ -theorem preservesOrderedPFUpTo_of_differentialTests +theorem _root_.RealRooted.PreservesOrderedPFUpTo.of_differentialTests {N : ℕ} {h k : ℝ[X]} (hh : IsPFPolynomial (finiteDifferentialTest N h)) (hk : IsPFPolynomial (finiteDifferentialTest N k)) @@ -370,15 +370,6 @@ theorem preservesOrderedPFUpTo_of_differentialTests exact ⟨IsPFPolynomial.zero, IsPFPolynomial.zero, interl_zero_left 0⟩ · exact pf_pair_interl_of_stablePencil hhnn hknn hstable -/-- Ordered preservation through degree `N` forces both monomial tests to be -PF and ordered. -/ -theorem differentialTests_ordered_of_preservesOrderedPFUpTo - {N : ℕ} {h k : ℝ[X]} (hpres : PreservesOrderedPFUpTo N h k) : - IsPFPolynomial (finiteDifferentialTest N h) ∧ - IsPFPolynomial (finiteDifferentialTest N k) ∧ - Interl (finiteDifferentialTest N h) (finiteDifferentialTest N k) := - finiteDifferentialTest_ordered_of_preservesOrderedPFUpTo hpres - /-- Two constant-coefficient differential operators preserve the ordered PF pair through degree `N` exactly when their images of `X ^ N` are PF and have the same order. -/ @@ -389,9 +380,9 @@ theorem _root_.RealRooted.PreservesOrderedPFUpTo.iff_differentialTests IsPFPolynomial (finiteDifferentialTest N k) ∧ Interl (finiteDifferentialTest N h) (finiteDifferentialTest N k) := by constructor - · exact differentialTests_ordered_of_preservesOrderedPFUpTo + · exact RealRooted.PreservesOrderedPFUpTo.differentialTests · rintro ⟨hh, hk, horder⟩ - exact preservesOrderedPFUpTo_of_differentialTests hh hk horder + exact RealRooted.PreservesOrderedPFUpTo.of_differentialTests hh hk horder /-- The degree-`N` Jensen polynomial of a differential symbol, normalized by falling factorials. -/ @@ -482,7 +473,7 @@ theorem jensenDifferentialTest_capNormalizedDifferentialSymbol /-- Any PF pair in reversed Jensen order gives a finite-cap companion pair after coefficientwise division by falling factorials. -/ -theorem preservesOrderedPFUpTo_capNormalizedDifferentialSymbol +theorem _root_.RealRooted.PreservesOrderedPFUpTo.capNormalizedDifferentialSymbol {N : ℕ} {q r : ℝ[X]} (hqdeg : q.natDegree ≤ N) (hrdeg : r.natDegree ≤ N) (hq : IsPFPolynomial q) (hr : IsPFPolynomial r) @@ -648,7 +639,7 @@ theorem _root_.RealRooted.PreservesOrderedPFUpTo.binomialDifferentialSymbol /-- The explicit higher-order recurrence row is PF and is preceded by its order-`r` differential image on every input in the cap. -/ -theorem binomialDifferentialRecurrence_pf_and_interl +theorem _root_.RealRooted.IsPFPolynomial.binomialDifferentialRecurrence_and_interl {N r : ℕ} {s a : ℝ} (hr : r ≠ 0) (hrN : r ≤ N) (hs : 0 ≤ s) (ha : 0 ≤ a) {p : ℝ[X]} (hp : IsPFPolynomial p) (hpdeg : p.natDegree ≤ N) : diff --git a/RealRooted/FiniteFreeAdditive/FiniteDegreeTests.lean b/RealRooted/FiniteFreeAdditive/FiniteDegreeTests.lean index e1f614161..2b3262d38 100644 --- a/RealRooted/FiniteFreeAdditive/FiniteDegreeTests.lean +++ b/RealRooted/FiniteFreeAdditive/FiniteDegreeTests.lean @@ -210,7 +210,7 @@ theorem PreservesPFUpTo.iff_finiteDifferentialTest /-- Ordered preservation through degree `N` forces the two monomial-test images to be PF and ordered. -/ -theorem finiteDifferentialTest_ordered_of_preservesOrderedPFUpTo +theorem _root_.RealRooted.PreservesOrderedPFUpTo.differentialTests {N : ℕ} {h k : ℝ[X]} (hpres : PreservesOrderedPFUpTo N h k) : IsPFPolynomial (finiteDifferentialTest N h) ∧ IsPFPolynomial (finiteDifferentialTest N k) ∧ @@ -246,7 +246,7 @@ theorem isPFPolynomial_X_mul_add_C_mul {f g : ℝ[X]} · exact IsPFPolynomial.of_realRooted_nonneg hnn hstrict.2.1.2 /-- Recurrence form of the ordered-pair step for two differential symbols. -/ -theorem differentialRecurrence_pf_and_interl {h k p : ℝ[X]} +theorem differentialRecurrence_isPFPolynomial_and_interl {h k p : ℝ[X]} (hh : IsPFPolynomial (applyAsDifferentialOperator h p)) (hk : IsPFPolynomial (applyAsDifferentialOperator k p)) (horder : Interl (applyAsDifferentialOperator h p) diff --git a/RealRooted/FiniteFreeAdditive/RootWindow.lean b/RealRooted/FiniteFreeAdditive/RootWindow.lean index b90e96064..9d6a331be 100644 --- a/RealRooted/FiniteFreeAdditive/RootWindow.lean +++ b/RealRooted/FiniteFreeAdditive/RootWindow.lean @@ -75,7 +75,7 @@ theorem finiteFreeAdditiveConvolution_C_mul_right (d : ℕ) (c : ℝ) (p q : ℝ /-- The finite-free additive weight written with a descending factorial: the factor of the differential operator expression. -/ -theorem finiteFreeAdditiveConvolutionGamma_eq_factorial_mul_descFactorial (d i l : ℕ) +theorem FiniteFreeAdditive.convolutionGamma_eq_factorial_mul_descFactorial (d i l : ℕ) (hil : i + l ≤ d) : finiteFreeAdditiveConvolutionGamma d i l = ((d - i).factorial : ℝ) / d.factorial * ((d - l).descFactorial i : ℝ) := by @@ -107,7 +107,7 @@ theorem finiteFreeAdditiveConvolution_eq_sum_iterate_derivative (d : ℕ) (p : (Finset.range_subset_range.2 (show k + 1 ≤ k + j + 1 by lia)) ?_) · refine Finset.sum_congr rfl fun i hi => ?_ have hik : i ≤ k := by simpa [Nat.lt_succ_iff] using hi - rw [finiteFreeAdditiveConvolutionGamma_eq_factorial_mul_descFactorial _ _ _ (by lia)] + rw [FiniteFreeAdditive.convolutionGamma_eq_factorial_mul_descFactorial _ _ _ (by lia)] have hdk : k + j - (k - i) = j + i := by lia rw [hdk] ring diff --git a/RealRooted/FiniteFreeAdditive/Stability.lean b/RealRooted/FiniteFreeAdditive/Stability.lean index cf2ac0be5..13d2b8661 100644 --- a/RealRooted/FiniteFreeAdditive/Stability.lean +++ b/RealRooted/FiniteFreeAdditive/Stability.lean @@ -559,7 +559,7 @@ private theorem mvRealStable_pow {σ : Type*} {P : MvPolynomial σ ℝ} /-- Coordinate convolution by a nonzero split factor preserves real stability on every degree box whose selected coordinate has degree bound `D`. The output may be zero. -/ -theorem finiteFreeAdditiveConvolutionDegreeBox_preservesRealStability +theorem BorceaBranden.PreservesRealStabilityOnDegreeBox.finiteFreeAdditiveConvolution {σ : Type*} [Finite σ] (q : σ) (D : ℕ) {g : ℝ[X]} (hg0 : g ≠ 0) (hgs : g.Splits) (hgdeg : g.natDegree ≤ D) (κ : σ → ℕ) (hκ : κ q = D) : @@ -592,7 +592,7 @@ theorem finiteFreeAdditiveConvolutionAt_realStableOrZero · simpa [κ, hi] using hpq · simp [κ, hi] let pκ : MvPolynomial.degreeOfLE σ ℝ κ := ⟨p, hpκ⟩ - exact finiteFreeAdditiveConvolutionDegreeBox_preservesRealStability + exact RealRooted.BorceaBranden.PreservesRealStabilityOnDegreeBox.finiteFreeAdditiveConvolution q D hg0 hgs hgdeg κ hκ pκ hp /-! ### Directed interlacing -/ diff --git a/RealRooted/Hermite/BesselOperatorFamily.lean b/RealRooted/Hermite/BesselOperatorFamily.lean index 1c027506c..a27df2195 100644 --- a/RealRooted/Hermite/BesselOperatorFamily.lean +++ b/RealRooted/Hermite/BesselOperatorFamily.lean @@ -125,7 +125,7 @@ theorem besselOperator_eq_zero_iff_natDegree_lt (lambda : ℝ) (r : ℕ) /-- The denominator-cleared auxiliary polynomial `sum_m f_m t^(N-m) (x*t+t^2-lambda)^m`, with `t` indexed by `none` and `x` indexed by `some ()`. -/ -def besselAuxiliary (N : ℕ) (lambda : ℝ) (f : ℝ[X]) : +def besselHomogenization (N : ℕ) (lambda : ℝ) (f : ℝ[X]) : MvPolynomial (Option Unit) ℂ := ∑ m ∈ range (N + 1), MvPolynomial.C (f.coeff m : ℂ) * MvPolynomial.X none ^ (N - m) * @@ -134,23 +134,23 @@ def besselAuxiliary (N : ℕ) (lambda : ℝ) (f : ℝ[X]) : /-- Evaluation of the finite Bessel auxiliary polynomial in its defining coefficient form. -/ -theorem eval_besselAuxiliary (N : ℕ) (lambda : ℝ) (f : ℝ[X]) +theorem eval_besselHomogenization (N : ℕ) (lambda : ℝ) (f : ℝ[X]) (z : Option Unit → ℂ) : - MvPolynomial.eval z (besselAuxiliary N lambda f) = + MvPolynomial.eval z (besselHomogenization N lambda f) = ∑ m ∈ range (N + 1), (f.coeff m : ℂ) * z none ^ (N - m) * (z (some ()) * z none + z none ^ 2 - lambda) ^ m := by - simp [besselAuxiliary] + simp [besselHomogenization] /-- Away from `t = 0`, the auxiliary polynomial equals `t^N f(x+t-lambda/t)`. -/ -theorem eval_besselAuxiliary_eq_pow_mul (N : ℕ) (lambda : ℝ) (f : ℝ[X]) +theorem eval_besselHomogenization_eq_pow_mul (N : ℕ) (lambda : ℝ) (f : ℝ[X]) (hN : f.natDegree ≤ N) (z : Option Unit → ℂ) (hz : z none ≠ 0) : - MvPolynomial.eval z (besselAuxiliary N lambda f) = + MvPolynomial.eval z (besselHomogenization N lambda f) = z none ^ N * (complexify f).eval (z (some ()) + z none - (lambda : ℂ) / z none) := by - rw [eval_besselAuxiliary, Polynomial.eval_eq_sum_range' (n := N + 1)] + rw [eval_besselHomogenization, Polynomial.eval_eq_sum_range' (n := N + 1)] · rw [Finset.mul_sum] apply sum_congr rfl intro m hm @@ -174,14 +174,14 @@ theorem eval_besselAuxiliary_eq_pow_mul (N : ℕ) (lambda : ℝ) (f : ℝ[X]) /-- For nonnegative parameter, the denominator-cleared auxiliary of a nonzero split polynomial is upper-half-plane stable. -/ -theorem mvUpperHalfPlaneStable_besselAuxiliary (N : ℕ) {lambda : ℝ} +theorem mvUpperHalfPlaneStable_besselHomogenization (N : ℕ) {lambda : ℝ} {f : ℝ[X]} (hlambda : 0 ≤ lambda) (hf : f ≠ 0) (hsplits : f.Splits) (hN : f.natDegree ≤ N) : - MvUpperHalfPlaneStable (besselAuxiliary N lambda f) := by + MvUpperHalfPlaneStable (besselHomogenization N lambda f) := by intro z hz have ht : 0 < (z none).im := hz none have ht0 : z none ≠ 0 := fun hzero => by simp [hzero] at ht - rw [eval_besselAuxiliary_eq_pow_mul N lambda f hN z ht0] + rw [eval_besselHomogenization_eq_pow_mul N lambda f hN z ht0] apply mul_ne_zero (pow_ne_zero N ht0) apply eval_complexify_ne_zero_of_splits_of_im_pos hsplits hf rw [Complex.sub_im, Complex.add_im, Complex.div_im] @@ -195,18 +195,18 @@ theorem mvUpperHalfPlaneStable_besselAuxiliary (N : ℕ) {lambda : ℝ} /-- Every distinguished-variable coefficient of a finite Bessel auxiliary is zero or upper-half-plane stable. -/ -theorem besselAuxiliary_coeff_zero_or (N r : ℕ) {lambda : ℝ} {f : ℝ[X]} +theorem mvUpperHalfPlaneStableOrZero_coeff_besselHomogenization (N r : ℕ) {lambda : ℝ} {f : ℝ[X]} (hlambda : 0 ≤ lambda) (hf : f ≠ 0) (hsplits : f.Splits) (hN : f.natDegree ≤ N) : MvUpperHalfPlaneStableOrZero ((MvPolynomial.optionEquivLeft ℂ Unit - (besselAuxiliary N lambda f)).coeff (N + r)) := + (besselHomogenization N lambda f)).coeff (N + r)) := MvUpperHalfPlaneStable.optionEquivLeft_coeff_zero_or_of_finite - (mvUpperHalfPlaneStable_besselAuxiliary N hlambda hf hsplits hN) (N + r) + (mvUpperHalfPlaneStable_besselHomogenization N hlambda hf hsplits hN) (N + r) private def besselAuxiliaryPolynomial (N : ℕ) (lambda : ℝ) (f : ℝ[X]) : Polynomial ℂ[X] := - (MvPolynomial.optionEquivLeft ℂ Unit (besselAuxiliary N lambda f)).map + (MvPolynomial.optionEquivLeft ℂ Unit (besselHomogenization N lambda f)).map (MvPolynomial.eval₂Hom C fun _ ↦ X) private theorem besselAuxiliaryPolynomial_eq (N : ℕ) (lambda : ℝ) (f : ℝ[X]) : @@ -214,7 +214,7 @@ private theorem besselAuxiliaryPolynomial_eq (N : ℕ) (lambda : ℝ) (f : ℝ[X ∑ m ∈ range (N + 1), C (C (f.coeff m : ℂ)) * X ^ (N - m) * (C X * X + X ^ 2 - C (C (lambda : ℂ))) ^ m := by - rw [besselAuxiliaryPolynomial, besselAuxiliary, map_sum, Polynomial.map_sum] + rw [besselAuxiliaryPolynomial, besselHomogenization, map_sum, Polynomial.map_sum] simp private theorem coeff_auxiliary_monomial (N m r : ℕ) (lambda : ℝ) @@ -413,11 +413,11 @@ private theorem complexBesselOperatorBound_eq_complexify (N r : ℕ) /-- The coefficient of `t^(N+r)` in the denominator-cleared auxiliary is the complexification of the finite Bessel operator. -/ -theorem besselAuxiliary_coeff (N r : ℕ) (lambda : ℝ) (f : ℝ[X]) +theorem coeff_besselHomogenization (N r : ℕ) (lambda : ℝ) (f : ℝ[X]) (hN : f.natDegree ≤ N) : (MvPolynomial.uniqueAlgEquiv ℂ Unit) ((MvPolynomial.optionEquivLeft ℂ Unit - (besselAuxiliary N lambda f)).coeff (N + r)) = + (besselHomogenization N lambda f)).coeff (N + r)) = complexify (besselOperator lambda r f) := by rw [← complexBesselOperatorBound_eq_complexify N r lambda f hN] rw [← coeff_besselAuxiliaryPolynomial_eq_bound N r lambda f hN] @@ -443,16 +443,17 @@ theorem besselOperator_eq_zero_or_isUpperHalfPlaneStable_complexify IsUpperHalfPlaneStable (complexify (besselOperator lambda r f)) := by by_cases hf0 : f = 0 · exact Or.inl (by rw [hf0, besselOperator_zero]) - have hcoeff := besselAuxiliary_coeff_zero_or f.natDegree r hlambda hf0 hf le_rfl + have hcoeff := mvUpperHalfPlaneStableOrZero_coeff_besselHomogenization + f.natDegree r hlambda hf0 hf le_rfl rcases hcoeff with hzero | hstable · left apply (Polynomial.map_eq_zero_iff (f := Complex.ofRealHom) Complex.ofReal_injective).mp change complexify (besselOperator lambda r f) = 0 - rw [← besselAuxiliary_coeff f.natDegree r lambda f le_rfl, hzero] + rw [← coeff_besselHomogenization f.natDegree r lambda f le_rfl, hzero] simp · right - rw [← besselAuxiliary_coeff f.natDegree r lambda f le_rfl] + rw [← coeff_besselHomogenization f.natDegree r lambda f le_rfl] exact isUpperHalfPlaneStable_uniqueAlgEquiv_unit hstable /-- For nonnegative parameter, every finite Bessel operator preserves real diff --git a/RealRooted/Hypergeometric/ThreeFTwo.lean b/RealRooted/Hypergeometric/ThreeFTwo.lean index 811d4fc77..d3a7faf20 100644 --- a/RealRooted/Hypergeometric/ThreeFTwo.lean +++ b/RealRooted/Hypergeometric/ThreeFTwo.lean @@ -92,7 +92,7 @@ theorem threeFTwoCoeff_eq_pochhammer (a₁ a₂ b₁ b₂ : ℝ) (n k : ℕ) : field_simp /-- Coefficients outside the terminating support vanish. -/ -theorem threeFTwoCoeff_eq_zero {n k : ℕ} (h : n < k) (a₁ a₂ b₁ b₂ : ℝ) : +theorem threeFTwoCoeff_eq_zero_of_lt {n k : ℕ} (h : n < k) (a₁ a₂ b₁ b₂ : ℝ) : threeFTwoCoeff a₁ a₂ b₁ b₂ n k = 0 := by simp [threeFTwoCoeff, Nat.choose_eq_zero_of_lt h] @@ -103,7 +103,7 @@ theorem threeFTwoCoeff_eq_zero {n k : ℕ} (h : n < k) (a₁ a₂ b₁ b₂ : by_cases hk : k < n + 1 · simp [threeFTwo, coeff_monomial, hk] · simp [threeFTwo, coeff_monomial, hk, - threeFTwoCoeff_eq_zero (show n < k by lia)] + threeFTwoCoeff_eq_zero_of_lt (show n < k by lia)] /-- The zeroth series coefficient is one for all real parameters. -/ @[simp] theorem threeFTwoCoeff_zero (a₁ a₂ b₁ b₂ : ℝ) (n : ℕ) : @@ -132,7 +132,7 @@ theorem natDegree_threeFTwo_le (a₁ a₂ b₁ b₂ : ℝ) (n : ℕ) : (threeFTwo a₁ a₂ b₁ b₂ n).natDegree ≤ n := by apply natDegree_le_iff_coeff_eq_zero.mpr intro k hk - simpa using threeFTwoCoeff_eq_zero hk a₁ a₂ b₁ b₂ + simpa using threeFTwoCoeff_eq_zero_of_lt hk a₁ a₂ b₁ b₂ /-- Alternating coefficients are strictly positive throughout the support. -/ theorem threeFTwoCoeff_alternating_pos {a₁ a₂ b₁ b₂ : ℝ} @@ -241,7 +241,7 @@ theorem monic_monicThreeFTwo {a₁ a₂ b₁ b₂ : ℝ} /-- The scalar in the monic normalization is precisely the prefactor in Lima (6.6)/(8.9), rather than a change of the polynomial variable. -/ -theorem monicThreeFTwo_eq {a₁ a₂ b₁ b₂ : ℝ} +theorem monicThreeFTwo_eq_C_mul {a₁ a₂ b₁ b₂ : ℝ} (ha₁ : 0 < a₁) (ha₂ : 0 < a₂) (hb₁ : 0 < b₁) (hb₂ : 0 < b₂) (n : ℕ) : monicThreeFTwo a₁ a₂ b₁ b₂ n = C ((-1 : ℝ) ^ n * (ascPochhammer ℝ n).eval a₁ * @@ -377,7 +377,7 @@ def production (a₁ a₂ b₁ b₂ : ℝ) (n : ℕ) : Matrix (Fin n) (Fin n) theorem monicThreeFTwo_one {a₁ a₂ b₁ b₂ : ℝ} (ha₁ : 0 < a₁) (ha₂ : 0 < a₂) (hb₁ : 0 < b₁) (hb₂ : 0 < b₂) : monicThreeFTwo a₁ a₂ b₁ b₂ 1 = (production a₁ a₂ b₁ b₂ 1).charpoly := by - rw [monicThreeFTwo_eq ha₁ ha₂ hb₁ hb₂, production, Matrix.twoBranchedProduction, + rw [monicThreeFTwo_eq_C_mul ha₁ ha₂ hb₁ hb₂, production, Matrix.twoBranchedProduction, Matrix.threeBidiagonalProduction_charpoly_one] have h₁ := ha₁.ne' have h₂ := ha₂.ne' @@ -428,7 +428,7 @@ identities required by the library's four-term recurrence identification. -/ theorem monicThreeFTwo_two {a₁ a₂ b₁ b₂ : ℝ} (ha₁ : 0 < a₁) (ha₂ : 0 < a₂) (hb₁ : 0 < b₁) (hb₂ : 0 < b₂) : monicThreeFTwo a₁ a₂ b₁ b₂ 2 = (production a₁ a₂ b₁ b₂ 2).charpoly := by - rw [monicThreeFTwo_eq ha₁ ha₂ hb₁ hb₂, production_charpoly_two _ _ hb₁ hb₂] + rw [monicThreeFTwo_eq_C_mul ha₁ ha₂ hb₁ hb₂, production_charpoly_two _ _ hb₁ hb₂] have h₁ := ha₁.ne' have h₂ := ha₂.ne' have h₃ : a₁ + 1 ≠ 0 := by positivity @@ -531,7 +531,7 @@ private theorem term_symm (a c u v : ℝ) (n k : ℕ) : private theorem coeff_monicThreeFTwo {a c b d : ℝ} (ha : 0 < a) (hc : 0 < c) (hb : 0 < b) (hd : 0 < d) (n k : ℕ) : (monicThreeFTwo a c b d n).coeff k = term a c (upperOne b n) (upperTwo d n) n k := by - rw [monicThreeFTwo_eq ha hc hb hd, coeff_C_mul, coeff_threeFTwo] + rw [monicThreeFTwo_eq_C_mul ha hc hb hd, coeff_C_mul, coeff_threeFTwo] rfl private theorem term_step {a c u v : ℝ} (ha : 0 < a) (hc : 0 < c) diff --git a/RealRooted/Interlacing/SecondOrderNecessity.lean b/RealRooted/Interlacing/SecondOrderNecessity.lean index dd16a8afb..9f5e8c4f1 100644 --- a/RealRooted/Interlacing/SecondOrderNecessity.lean +++ b/RealRooted/Interlacing/SecondOrderNecessity.lean @@ -531,7 +531,7 @@ theorem secondOrderRayPreserving_iff_upper_bound_at_index /-- A negative explicit monomial residual discriminant obstructs splitting. This API avoids unfolding the opaque discriminant abbreviation. -/ -theorem not_splits_secondOrderRayOperator_X_pow_of_explicit_discrim_neg +theorem _root_.RealRooted.SecondOrderRay.not_splits_X_pow_of_discrim_neg {a b c d f : ℝ} {m : ℕ} (hm : 1 ≤ m) (hb : b ≠ 0) (hneg : (a + d * m) ^ 2 - 4 * b * m * (c + f * (m - 1)) < 0) : ¬(secondOrderRayOperator a b c d f (X ^ m)).Splits := by @@ -569,7 +569,7 @@ theorem secondOrderRayPreserving_iff_middle_discrim_at_index constructor · intro hpres by_contra hnonneg - have hnot := not_splits_secondOrderRayOperator_X_pow_of_explicit_discrim_neg + have hnot := RealRooted.SecondOrderRay.not_splits_X_pow_of_discrim_neg hm hb.ne' (lt_of_not_ge hnonneg) have hout := hpres _ (isPFPolynomial_X_pow m) exact hnot hout.splits diff --git a/RealRooted/Jacobi/NegativeIntegerEndpoint.lean b/RealRooted/Jacobi/NegativeIntegerEndpoint.lean index 833e713dd..f80b9fd28 100644 --- a/RealRooted/Jacobi/NegativeIntegerEndpoint.lean +++ b/RealRooted/Jacobi/NegativeIntegerEndpoint.lean @@ -429,7 +429,7 @@ theorem hasSimpleRootsExcept_of_reflectedJacobiOperator_eq_zero exact endpoint_factor_jacobi_hasSimpleRootsExcept n m halpha r hrne hqr /-- Every root of a nonzero solution is `-1` or lies strictly between `-1` and `0`. -/ -theorem isRoot_eq_neg_one_or_mem_Ioo_of_reflectedJacobiOperator_eq_zero +theorem _root_.RealRooted.ReflectedJacobi.eq_neg_one_or_mem_Ioo_of_isRoot (n m : ℕ) {alpha r : ℝ} (halpha : -1 < alpha) (hmn : m ≤ n) {p : ℝ[X]} (hp : reflectedJacobiOperator n alpha (-(m : ℝ)) p = 0) (hpne : p ≠ 0) (hr : p.IsRoot r) : diff --git a/RealRooted/Jacobi/ParameterShifts.lean b/RealRooted/Jacobi/ParameterShifts.lean index 700f9703f..5b95a3a89 100644 --- a/RealRooted/Jacobi/ParameterShifts.lean +++ b/RealRooted/Jacobi/ParameterShifts.lean @@ -143,7 +143,7 @@ private theorem risingFactorial_cross_mul (a : ℝ) (k r : ℕ) : /-- Clearing the positive scalar in the upper-parameter Euler factorization: `E_(a+1) ... E_(a+r) H_n^(a+r,a+r) = (a+1)_r H_n^(a,a+r)`. -/ -theorem eulerShiftRange_diagonal_eq_C_mul_jacobiCoefficientPolynomial +theorem _root_.RealRooted.JacobiCoefficientPolynomial.eulerShiftRange_diagonal_eq_C_mul (a : ℝ) (r n : ℕ) (ha : -1 < a) : eulerShiftRange (a + 1) r (jacobiCoefficientPolynomial n (a + r) (a + r)) = @@ -196,7 +196,7 @@ theorem jacobiCoefficientPolynomial_eq_C_mul_eulerShiftRange C (risingFactorial (a + 1) r)⁻¹ * eulerShiftRange (a + 1) r (jacobiCoefficientPolynomial n (a + r) (a + r)) := by - rw [eulerShiftRange_diagonal_eq_C_mul_jacobiCoefficientPolynomial a r n ha] + rw [RealRooted.JacobiCoefficientPolynomial.eulerShiftRange_diagonal_eq_C_mul a r n ha] rw [← mul_assoc, ← C_mul] simp [(risingFactorial_pos r (by linarith : 0 < a + 1)).ne'] @@ -304,7 +304,7 @@ private theorem coeff_jacobiCoefficientPolynomial_self (a b : ℝ) (k : ℕ) : /-- An Euler-multiplier polynomial representing every row is forced at each nonnegative integer by the top coefficient of that row. -/ -theorem eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial +theorem _root_.RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div {a b : ℝ} {p : ℝ[X]} (hb : -1 < b) (h : ∀ n, jacobiCoefficientPolynomial n a b = diagonalOperator (fun k ↦ p.eval (k : ℝ)) @@ -332,9 +332,9 @@ private theorem mul_comp_X_add_C_eq_mul_of_diagonalOperator simp only [Set.mem_ofPred_eq, eval_mul, eval_add, eval_X, eval_C, eval_comp] rw [show (k : ℝ) + 1 = ((k + 1 : ℕ) : ℝ) by norm_num] rw [ - eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial + RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div hb h (k + 1), - eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial + RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div hb h k] rw [risingFactorial_succ, risingFactorial_succ] have ha0 : risingFactorial (a + 1) k ≠ 0 := @@ -422,7 +422,7 @@ theorem exists_diagonalOperator_jacobiCoefficientPolynomial_iff constructor · rintro ⟨p, hp⟩ have hpEval := - eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial + RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div hb hp 0 simp only [risingFactorial_zero, div_one] at hpEval have hp0 : p ≠ 0 := by @@ -448,7 +448,7 @@ theorem exists_diagonalOperator_jacobiCoefficientPolynomial_iff /-- Allowing a nonzero scalar depending on the row does not enlarge the class of row-independent polynomial Euler multipliers. -/ -theorem exists_rowScalar_diagonalOperator_jacobiCoefficientPolynomial_iff +theorem _root_.RealRooted.JacobiCoefficientPolynomial.exists_rowScalar_diagonalOperator_iff {a b : ℝ} (ha : -1 < a) (hb : -1 < b) : (∃ (p : ℝ[X]) (c : ℕ → ℝ), p.eval 0 ≠ 0 ∧ (∀ n, c n ≠ 0) ∧ @@ -482,7 +482,7 @@ theorem exists_rowScalar_diagonalOperator_jacobiCoefficientPolynomial_iff (exists_diagonalOperator_jacobiCoefficientPolynomial_iff ha hb).mpr hr refine ⟨p, fun _ ↦ 1, ?_, fun _ ↦ one_ne_zero, ?_⟩ · have hpEval := - eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial + RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div hb hp 0 simp only [risingFactorial_zero, div_one] at hpEval norm_num at hpEval @@ -494,7 +494,7 @@ theorem exists_rowScalar_diagonalOperator_jacobiCoefficientPolynomial_iff /-- On an integral upper-parameter shift, the normalized product of linear Euler multipliers is the unique polynomial in the Euler operator mapping every diagonal row to the shifted family. -/ -theorem diagonalOperator_jacobiCoefficientPolynomial_iff_eq_multiplierPolynomial +theorem _root_.RealRooted.JacobiCoefficientPolynomial.diagonalOperator_iff_eq_multiplierPolynomial (a : ℝ) (r : ℕ) (p : ℝ[X]) (ha : -1 < a) : (∀ n, jacobiCoefficientPolynomial n a (a + r) = diagonalOperator (fun k ↦ p.eval (k : ℝ)) @@ -525,9 +525,9 @@ theorem diagonalOperator_jacobiCoefficientPolynomial_iff_eq_multiplierPolynomial rintro x ⟨k, rfl⟩ simp only [Set.mem_ofPred_eq] rw [ - eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial + RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div hb hp k, - eval_eq_risingFactorial_div_of_diagonalOperator_jacobiCoefficientPolynomial + RealRooted.JacobiCoefficientPolynomial.eval_eq_risingFactorial_div hb hmodel k] · rintro rfl exact hmodel diff --git a/RealRooted/Laguerre/GeneralizedBell.lean b/RealRooted/Laguerre/GeneralizedBell.lean index a31be6f9a..cedf1a203 100644 --- a/RealRooted/Laguerre/GeneralizedBell.lean +++ b/RealRooted/Laguerre/GeneralizedBell.lean @@ -41,7 +41,7 @@ namespace RealRooted ∑ j ∈ Finset.range (K + 1), C (gamma j) * monicLaguerre (n - j) alpha /-- The auxiliary polynomial is monic when its leading coordinate is normalized by `γ₀ = 1`. -/ -theorem laguerreAuxiliary_monic {K : ℕ} {gamma : ℕ → ℝ} (hgamma : gamma 0 = 1) : +theorem monic_laguerrePochhammerSum {K : ℕ} {gamma : ℕ → ℝ} (hgamma : gamma 0 = 1) : (laguerrePochhammerSum K gamma).Monic := by apply monic_of_natDegree_le_of_coeff_eq_one K · rw [laguerrePochhammerSum] @@ -339,7 +339,7 @@ theorem generalizedLaguerreSum_splits_simple_roots_neg_of_auxiliary let s := alpha + (n - K : ℕ) + 1 let p := generalizedLaguerre (n - K) alpha let parameters := Q.roots.toList.map fun r ↦ s - r - have hQmonic : Q.Monic := laguerreAuxiliary_monic hgamma + have hQmonic : Q.Monic := monic_laguerrePochhammerSum hgamma have hparameters : ∀ a ∈ parameters, 0 < a := by intro a ha rcases List.mem_map.mp ha with ⟨r, hr, rfl⟩ diff --git a/RealRooted/MaWang/EndpointRecurrence.lean b/RealRooted/MaWang/EndpointRecurrence.lean index efef8cb5c..f88a7b3c1 100644 --- a/RealRooted/MaWang/EndpointRecurrence.lean +++ b/RealRooted/MaWang/EndpointRecurrence.lean @@ -185,7 +185,7 @@ theorem exists_natDegree_lt_and_mul_generatingSeries_eq_of_pureLag /-- An eventual pure-lag recurrence gives a polynomial-denominator identity; the numerator is supported before the recurrence's first output index. -/ -theorem exists_natDegree_lt_add_and_mul_generatingSeries_eq_of_pureLag_from +theorem EndpointRecurrence.exists_natDegree_lt_and_mul_generatingSeries_eq_of_pureLag {R : Type*} [CommRing R] (P : ℕ → R) (Q : R[X]) (q n₀ : ℕ) (hq : 0 < q) (hQ0 : Q.coeff 0 = 1) (hQdeg : Q.natDegree ≤ q) (hrec : ∀ n, P (n₀ + n + q) = diff --git a/RealRooted/MaWang/GrowingZeroMultiplicity.lean b/RealRooted/MaWang/GrowingZeroMultiplicity.lean index c784a57a3..713759d7b 100644 --- a/RealRooted/MaWang/GrowingZeroMultiplicity.lean +++ b/RealRooted/MaWang/GrowingZeroMultiplicity.lean @@ -362,7 +362,7 @@ private lemma affineEndpointMultiplicity_succ' (A R n : ℕ) (hR : 0 < R) : /-- For nonnegative integer `a` and positive integer `r`, the affine family is PF in every row, has degree equal to its index, has the stated zero multiplicity and leading coefficient, and consecutive rows interlace. -/ -theorem growingZeroFamily_pf_degree_multiplicity_interlacing +theorem _root_.RealRooted.GrowingZeroFamily.isPFPolynomial_degree_multiplicity_interlacing (A R : ℕ) {b c : ℝ} (hR : 0 < R) (hb : (R : ℝ) ≤ b) (hc : 0 < c) : ∀ n : ℕ, IsPFPolynomial (growingZeroFamily A R b c n) ∧ @@ -595,7 +595,7 @@ theorem growingZeroFamily_all_isPFPolynomial_iff exact ⟨A, R, hR, rfl, hrR⟩ · rintro ⟨A, R, hR, rfl, rfl⟩ exact fun n => - (growingZeroFamily_pf_degree_multiplicity_interlacing A R hR hb hc n).1 + (RealRooted.GrowingZeroFamily.isPFPolynomial_degree_multiplicity_interlacing A R hR hb hc n).1 /-- A growing-zero step with positive derivative parameter preserves simplicity away from zero and shares no negative root with its input. -/ @@ -653,7 +653,7 @@ theorem growingZeroFamily_negative_roots_simple_and_noCommon ∀ x : ℝ, x < 0 → ¬((growingZeroFamily A R b c n).IsRoot x ∧ (growingZeroFamily A R b c (n + 1)).IsRoot x) := by - have hpackage := growingZeroFamily_pf_degree_multiplicity_interlacing A R hR hb hc + have hpackage := GrowingZeroFamily.isPFPolynomial_degree_multiplicity_interlacing A R hR hb hc have hsimple : ∀ n, HasSimpleRootsExcept (growingZeroFamily A R b c n) 0 := by intro n induction n with @@ -689,4 +689,8 @@ theorem growingZeroFamily_negative_roots_simple_and_noCommon rw [← growingZeroFamily_succ] at hstep exact ⟨hsimple n, hstep.2⟩ +@[deprecated (since := "2026-11-14")] +alias growingZeroFamily_pf_degree_multiplicity_interlacing := + GrowingZeroFamily.isPFPolynomial_degree_multiplicity_interlacing + end RealRooted diff --git a/RealRooted/OperatorInterlacingUpgrade.lean b/RealRooted/OperatorInterlacingUpgrade.lean index 60b3d5d31..6432a880b 100644 --- a/RealRooted/OperatorInterlacingUpgrade.lean +++ b/RealRooted/OperatorInterlacingUpgrade.lean @@ -29,19 +29,6 @@ noncomputable section namespace RealRooted -/-- A real-linear map commutes with the finite weighted sums used in Krein -expansions. -/ -theorem LinearMap.map_weightedSum (T : ℝ[X] →ₗ[ℝ] ℝ[X]) : - ∀ l : List (ℝ × ℝ[X]), - T (weightedSum l) = - weightedSum (l.map fun ap => (ap.1, T ap.2)) - | [] => by simp - | (a, p) :: l => by - simp only [weightedSum_cons, List.map_cons, T.map_add, - LinearMap.map_weightedSum T l] - rw [show C a * p = a • p by rw [Polynomial.smul_eq_C_mul], - T.map_smul, Polynomial.smul_eq_C_mul] - /-- A linear map preserves PF Krein interlacing when every nonzero PF polynomial remains after each possible one-root deletion in the oriented order. The self-summand is included in `IsKreinSummand`. -/ @@ -291,7 +278,7 @@ theorem strictInterl_map_of_preservesPFKreinInterlacingOnDegree · exact exists_kreinSummandExpansion_nonneg_right_of_pos_natDegree hfg hfpos hgpos (Nat.pos_of_ne_zero hgdeg) obtain ⟨l, hfl, hnonneg, hsummand, hex⟩ := hexp - rw [hfl, RealRooted.LinearMap.map_weightedSum T l] + rw [hfl, RealRooted.map_weightedSum T l] apply StrictInterl.weightedSum_right_of_nonneg · intro ap hap rcases List.mem_map.mp hap with ⟨ap₀, hap₀, rfl⟩ diff --git a/RealRooted/OperatorMatrix/AffineDerivative.lean b/RealRooted/OperatorMatrix/AffineDerivative.lean index 0a2f17c3b..d60151352 100644 --- a/RealRooted/OperatorMatrix/AffineDerivative.lean +++ b/RealRooted/OperatorMatrix/AffineDerivative.lean @@ -135,7 +135,7 @@ private theorem row_cross_of_cap_two {a b A B : ℝ} (heq ▸ hout.splits) /-- At every common cap at least two, row safety is the cross inequality. -/ -theorem affineDRow_pf_through_iff {a b A B : ℝ} {N : ℕ} (hN : 2 ≤ N) +theorem affineDRow_isPFPolynomial_upTo_iff {a b A B : ℝ} {N : ℕ} (hN : 2 ≤ N) (h : 0 ≤ a ∧ 0 ≤ b ∧ 0 ≤ A ∧ 0 ≤ B) : (∀ p q : ℝ[X], IsPFPolynomial p → IsPFPolynomial q → Interl p q → p.natDegree ≤ N → q.natDegree ≤ N → @@ -148,7 +148,7 @@ theorem affineDRow_pf_through_iff {a b A B : ℝ} {N : ℕ} (hN : 2 ≤ N) exact (affineDRow_pf_anchor h hc hp hq hi).1 /-- The unrestricted affine-derivative row criterion. -/ -theorem affineDRow_pf_iff {a b A B : ℝ} +theorem affineDRow_isPFPolynomial_iff {a b A B : ℝ} (h : 0 ≤ a ∧ 0 ≤ b ∧ 0 ≤ A ∧ 0 ≤ B) : (∀ p q : ℝ[X], IsPFPolynomial p → IsPFPolynomial q → Interl p q → IsPFPolynomial (affineDRow a b A B p q)) ↔ a * B ≤ A * b := by @@ -208,11 +208,11 @@ theorem affineD_column_iff {a c A C₀ : ℝ} example : ∀ p q : ℝ[X], IsPFPolynomial p → IsPFPolynomial q → Interl p q → IsPFPolynomial (affineDRow 0 1 1 0 p q) := by - exact (affineDRow_pf_iff (by norm_num)).mpr (by norm_num) + exact (affineDRow_isPFPolynomial_iff (by norm_num)).mpr (by norm_num) example : ¬ (∀ p q : ℝ[X], IsPFPolynomial p → IsPFPolynomial q → Interl p q → IsPFPolynomial (affineDRow 1 0 0 1 p q)) := by - rw [affineDRow_pf_iff (by norm_num)] + rw [affineDRow_isPFPolynomial_iff (by norm_num)] norm_num example {p : ℝ[X]} (hp : IsPFPolynomial p) : diff --git a/RealRooted/Production.lean b/RealRooted/Production.lean index 564b42bfb..885de1cb4 100644 --- a/RealRooted/Production.lean +++ b/RealRooted/Production.lean @@ -31,6 +31,7 @@ public import RealRooted.Applications.EulerianVariations public import RealRooted.Applications.EulerianVariations.CyclicPathDescents public import RealRooted.Applications.EulerianVariations.TernaryRuns public import RealRooted.Applications.EulerianVariations.TernaryRuns.Recurrence +public import RealRooted.Applications.OEIS.A114123 public import RealRooted.Applications.OEIS.A132885 public import RealRooted.Applications.OEIS.A272471.Recurrence public import RealRooted.Applications.OEIS.InversePeaks @@ -484,6 +485,7 @@ public import RealRooted.DerivativeRecurrence.Degree public import RealRooted.DerivativeRecurrence.General public import RealRooted.DerivativeRecurrence.GeneralizedLaguerre public import RealRooted.DerivativeRecurrence.GeneralizedLaguerreInterlacing +public import RealRooted.DerivativeRecurrence.HalfDegree public import RealRooted.DerivativeRecurrence.Interlacing public import RealRooted.DerivativeRecurrence.LagWeak public import RealRooted.DerivativeRecurrence.LagDegree diff --git a/RealRooted/Recurrence/PFTripleMatrix.lean b/RealRooted/Recurrence/PFTripleMatrix.lean index 4bb9bd708..f08e61781 100644 --- a/RealRooted/Recurrence/PFTripleMatrix.lean +++ b/RealRooted/Recurrence/PFTripleMatrix.lean @@ -148,7 +148,7 @@ private lemma isOrderedPFTriple_step_of_eq_zero {l c d : ℝ} (hl : 0 ≤ l) (hc /-- **Sufficiency.** For `l > 0`, the nonnegativity conditions `a, b, d ≥ 0` and `a l ≤ c` make the matrix preserve every ordered Pólya-frequency triple, including inputs and outputs with zero coordinates. -/ -theorem preservesScaledPFTriple_of_nonneg {l a b c d : ℝ} (hl : 0 < l) (ha : 0 ≤ a) +theorem PreservesScaledPFTriple.of_nonneg {l a b c d : ℝ} (hl : 0 < l) (ha : 0 ≤ a) (hb : 0 ≤ b) (hd : 0 ≤ d) (hc : a * l ≤ c) : PreservesScaledPFTriple l a b c d := by intro p u r h rcases eq_or_ne r 0 with rfl | hr0 @@ -180,7 +180,7 @@ private lemma mul_le_mul_of_interl_affine {u v U V : ℝ} (hu : 0 < u) (hv : 0 /-- **Necessity.** If the matrix preserves every ordered Pólya-frequency triple, then `a, b, d ≥ 0` and `a l ≤ c`. -/ -theorem nonneg_of_preservesScaledPFTriple {l a b c d : ℝ} (hl : 0 < l) +theorem _root_.RealRooted.PreservesScaledPFTriple.nonneg {l a b c d : ℝ} (hl : 0 < l) (h : PreservesScaledPFTriple l a b c d) : 0 ≤ a ∧ 0 ≤ b ∧ 0 ≤ d ∧ a * l ≤ c := by have h001 : IsOrderedPFTriple (0 : ℝ[X]) 0 1 := ⟨IsPFPolynomial.zero, IsPFPolynomial.zero, IsPFPolynomial.one, @@ -234,8 +234,8 @@ theorem nonneg_of_preservesScaledPFTriple {l a b c d : ℝ} (hl : 0 < l) `a, b, d ≥ 0` and `a l ≤ c`. There are no degree or nonzero-coordinate hypotheses. -/ theorem PreservesScaledPFTriple.iff {l : ℝ} (hl : 0 < l) (a b c d : ℝ) : PreservesScaledPFTriple l a b c d ↔ 0 ≤ a ∧ 0 ≤ b ∧ 0 ≤ d ∧ a * l ≤ c := - ⟨nonneg_of_preservesScaledPFTriple hl, fun ⟨ha, hb, hd, hc⟩ ↦ - preservesScaledPFTriple_of_nonneg hl ha hb hd hc⟩ + ⟨RealRooted.PreservesScaledPFTriple.nonneg hl, fun ⟨ha, hb, hd, hc⟩ ↦ + RealRooted.PreservesScaledPFTriple.of_nonneg hl ha hb hd hc⟩ /-- **The sharp criterion.** The matrix `[[0, 0, 1], [X, 0, 1], [c X, d X, a + b X]]` preserves every ordered Pólya-frequency triple if and only if `a, b, d ≥ 0` and `a ≤ c`. @@ -290,7 +290,7 @@ theorem isOrderedPFTriple_of_recurrence_scaled {κ : ℝ} (hκ : 0 < κ) rw [div_le_iff₀ hκ] nlinarith [hq s] linarith - have hstep := preservesScaledPFTriple_of_nonneg hκ (ha s) (hb s) hdκ hc _ _ _ ih + have hstep := RealRooted.PreservesScaledPFTriple.of_nonneg hκ (ha s) (hb s) hdκ hc _ _ _ ih rw [third_order_step hκ.ne' s (hrec s)] at hstep simpa using hstep @@ -348,4 +348,7 @@ theorem interl_of_recurrence end Recurrence +@[deprecated (since := "2026-11-14")] +alias preservesScaledPFTriple_of_nonneg := PreservesScaledPFTriple.of_nonneg + end RealRooted diff --git a/RealRooted/RootLocation/CommonInterlacer.lean b/RealRooted/RootLocation/CommonInterlacer.lean index a10d2df3b..b8cb389b3 100644 --- a/RealRooted/RootLocation/CommonInterlacer.lean +++ b/RealRooted/RootLocation/CommonInterlacer.lean @@ -139,15 +139,6 @@ end Hull /-! ### Linear images of weighted sums -/ -/-- A linear map sends a weighted sum to the weighted sum of the images. -/ -theorem map_weightedSum (T : ℝ[X] →ₗ[ℝ] ℝ[X]) : - ∀ l : List (ℝ × ℝ[X]), - T (weightedSum l) = weightedSum (l.map fun ap => (ap.1, T ap.2)) - | [] => by simp - | (a, p) :: l => by - simp only [weightedSum_cons, map_add, List.map_cons, map_weightedSum T l, C_mul', - LinearMap.map_smul] - /-- Every list of nonnegative-weighted members of `fs.map T` is the image of a list over `fs`. -/ private theorem exists_preimage_list (T : ℝ[X] →ₗ[ℝ] ℝ[X]) (fs : List ℝ[X]) : ∀ l : List (ℝ × ℝ[X]), (∀ ap ∈ l, ap.2 ∈ fs.map T) → diff --git a/RealRooted/Tactic/OEIS_COVERAGE.md b/RealRooted/Tactic/OEIS_COVERAGE.md index f94ec83f6..0e9e68bc8 100644 --- a/RealRooted/Tactic/OEIS_COVERAGE.md +++ b/RealRooted/Tactic/OEIS_COVERAGE.md @@ -19,7 +19,7 @@ sequence formalization: - `fragment`: only a sign or root-window subcertificate is exercised; - `documented`: the ID is mentioned, but no executable route was associated. -Current totals: **177 IDs**; **21 formalized**, **142 shells**, **1 fragments**, and **13 documented-only**. +Current totals: **177 IDs**; **22 formalized**, **142 shells**, **1 fragments**, and **12 documented-only**. | OEIS ID | Status | Recurrence shape / test intent | Tactic route | Required certificates | Missing blocker | |---|---|---|---|---|---| @@ -98,7 +98,7 @@ Current totals: **177 IDs**; **21 formalized**, **142 shells**, **1 fragments**, | A110608 | `shell` | (, `RealRooted.derivativeRecurrence_interlaces_of_roots_le_mono_div`).
def : ℕ → ℝ[X]
+5 additional test intents | `rr_row_interlaces`, `rr_row_splits` | `via` | concrete row definition and proofs of the listed certificates | | A111006 | `shell` | A three-term recurrence with root window `[-1, 0]`: `b = X (X + 1)` ().
def : ℕ → ℝ[X]
+4 additional test intents | `rr_row_interlaces`, `rr_row_splits` | implicit/local certificates resolved by the route | concrete row definition and proofs of the listed certificates | | A112493 | `shell` | Ward-type rows: `v_n(t) = t(1 + t)` ().
def : ℕ → ℝ[X]
+4 additional test intents | `rr_row_interlaces`, `rr_row_splits` | implicit/local certificates resolved by the route | concrete row definition and proofs of the listed certificates | -| A114123 | `documented` | copied from the downstream row recurrence. | none | not recorded | executable tactic route and its certificates | +| A114123 | `formalized` | copied from the downstream row recurrence. | none | not recorded | none | | A116088 | `documented` | copied from the downstream row recurrence. | none | not recorded | executable tactic route and its certificates | | A116089 | `documented` | copied from the downstream row recurrence. | none | not recorded | executable tactic route and its certificates | | A118884 | `shell` | Periodic growth with period four and a lag of changing sign ().
def : ℕ → ℝ[X]
+3 additional test intents | `rr_row_natDegree`, `rr_row_splits` | implicit/local certificates resolved by the route | concrete row definition and proofs of the listed certificates | diff --git a/RealRooted/Tactic/ROUTES.md b/RealRooted/Tactic/ROUTES.md index 54e41f7cf..51b5774d8 100644 --- a/RealRooted/Tactic/ROUTES.md +++ b/RealRooted/Tactic/ROUTES.md @@ -37,7 +37,7 @@ side conditions, implementing modules, and regression examples. | 17 | `splitFactors` | (P n).Splits | `productSequence_splits` | | 18 | `twoStep` | Interlacing, splitting, degree, or positive leading coefficient for P (n + 2) = q * P n. | `twoStepProduct_interlaces`, `twoStepProduct_splits`, `twoStepProduct_natDegree`, `twoStepProduct_leadingCoeff_pos`, `twoStepProduct_leadingCoeff_pos_of_ne_zero` | | 19 | `nextRow` | (P n).Splits | `productSequence_interlaces`, `derivativeRecurrence_interlaces_of_eval_nonpos`, `threeTerm_interlaces_of_eval_nonpos` | -| 20 | `degreePattern` | (P n).Splits or StrictInterl (P n) (P (n + 1)). | `derivativeRecurrence_splits_of_degree_pattern_of_nonnegCoeffs`, `derivativeRecurrence_strictInterl_of_degree_pattern_of_nonnegCoeffs`, `Tactic.derivativeRecurrence_strictInterl_of_half_degree`, `Tactic.derivativeRecurrence_strictInterl_of_floor_half_degree` | +| 20 | `degreePattern` | (P n).Splits or StrictInterl (P n) (P (n + 1)). | `derivativeRecurrence_splits_of_degree_pattern_of_nonnegCoeffs`, `derivativeRecurrence_strictInterl_of_degree_pattern_of_nonnegCoeffs`, `derivativeRecurrence_strictInterl_of_half_degree`, `derivativeRecurrence_strictInterl_of_floor_half_degree` | | 21 | `reversed` | Interlaces (P n) (P (n + 1)) or (P n).Splits after reflection. | `eq_reflect_of_secondOrderDerivativeRecurrence`, `eq_reflect_of_linearRecurrence`, `interlaces_of_eq_reflect`, `splits_of_eq_reflect` | | 22 | `fTransform` | Interlaces (P n) (P (n + 1)) or (P n).Splits for f-polynomial images. | `Tactic.interlaces_fPolynomial_sequence`, `Tactic.interlaces_fPolynomial_sequence_floor`, `splits_of_eq_fPolynomial` | @@ -48,7 +48,7 @@ side conditions, implementing modules, and regression examples. | 1 | `reuse` | (P n).Splits or StrictInterl (P n) (P (n + 1)) | `Interlaces.toStrictInterl` | | 2 | `variableDelay` | StrictInterl, Interlaces, Splits, or HasNonnegCoeffs. | `strictInterl_of_fixedDelay_recurrence`, `strictInterl_of_scaled_fixedDelay_recurrence`, `hasNonnegCoeffs_of_scaled_fixedDelay_recurrence`, `strictInterl_of_constant_prefix_fixed_delay_recurrence`, `hasNonnegCoeffs_of_constant_prefix_fixed_delay_recurrence` | | 3 | `halfGrowth` | Interlaces, StrictInterl, or Splits for half-growth rows. | `derivLag_strictInterl_of_nonnegCoeffs`, `derivLag_strictInterl_of_nonnegCoeffs_half`, `threeTermHalf_ne_zero_and_splits` | -| 4 | `degreePattern` | (P n).Splits or StrictInterl (P n) (P (n + 1)). | `derivativeRecurrence_splits_of_degree_pattern_of_nonnegCoeffs`, `derivativeRecurrence_strictInterl_of_degree_pattern_of_nonnegCoeffs`, `Tactic.derivativeRecurrence_strictInterl_of_half_degree`, `Tactic.derivativeRecurrence_strictInterl_of_floor_half_degree` | +| 4 | `degreePattern` | (P n).Splits or StrictInterl (P n) (P (n + 1)). | `derivativeRecurrence_splits_of_degree_pattern_of_nonnegCoeffs`, `derivativeRecurrence_strictInterl_of_degree_pattern_of_nonnegCoeffs`, `derivativeRecurrence_strictInterl_of_half_degree`, `derivativeRecurrence_strictInterl_of_floor_half_degree` | | 5 | `interlaces` | StrictInterl (P n) (P (n + 1)) | `Interlaces.toStrictInterl` | ## `rr_row_interlaces` diff --git a/RealRooted/Tactic/Row/FTransform.lean b/RealRooted/Tactic/Row/FTransform.lean index 45ea5b32d..ab0ccb436 100644 --- a/RealRooted/Tactic/Row/FTransform.lean +++ b/RealRooted/Tactic/Row/FTransform.lean @@ -450,7 +450,7 @@ def fTransformInterlacesGoal : TacticM Unit := do withMainContext do evalTactic (← `(tactic| have $qinterl:ident : ∀ j, StrictInterl ($Q j) ($Q (j + 1)) := - derivativeRecurrence_strictInterl_of_floor_half_degree + RealRooted.derivativeRecurrence_strictInterl_of_floor_half_degree (Q := $Q) (A := fun $n:ident : ℕ => $aT) (B := fun $n:ident : ℕ => $bT) (fun j => by rw [$Q:ident]) $qdeg $qpos $qnn (by intro j r hr @@ -461,7 +461,7 @@ def fTransformInterlacesGoal : TacticM Unit := do withMainContext do evalTactic (← `(tactic| have $qinterl:ident : ∀ j, StrictInterl ($Q j) ($Q (j + 1)) := - derivativeRecurrence_strictInterl_of_half_degree + RealRooted.derivativeRecurrence_strictInterl_of_half_degree (Q := $Q) (A := fun $n:ident : ℕ => $aT) (B := fun $n:ident : ℕ => $bT) (fun j => by rw [$Q:ident]) $qdeg $qpos $qnn (by intro j r hr diff --git a/RealRooted/Tactic/Row/Frontend.lean b/RealRooted/Tactic/Row/Frontend.lean index 40cc6cad3..112cc7973 100644 --- a/RealRooted/Tactic/Row/Frontend.lean +++ b/RealRooted/Tactic/Row/Frontend.lean @@ -1159,8 +1159,8 @@ private def degreePatternStrictGoal : TacticM RowHints := do let Dt ← `(fun $m:ident : ℕ => $(← halfLawTerm c e m)) if c == 0 then let strictThm := if e == 0 then - mkIdent ``derivativeRecurrence_strictInterl_of_floor_half_degree - else mkIdent ``derivativeRecurrence_strictInterl_of_half_degree + mkIdent ``RealRooted.derivativeRecurrence_strictInterl_of_floor_half_degree + else mkIdent ``RealRooted.derivativeRecurrence_strictInterl_of_half_degree evalTactic (← `(tactic| refine $strictThm:ident (Q := $Q) (A := $A) (B := $B) $hrec ?_ ?_ ?_ ?_ $t)) diff --git a/RealRooted/Tactic/Row/HalfDegree.lean b/RealRooted/Tactic/Row/HalfDegree.lean index f809b09dd..a1a3b0dd7 100644 --- a/RealRooted/Tactic/Row/HalfDegree.lean +++ b/RealRooted/Tactic/Row/HalfDegree.lean @@ -1,78 +1,9 @@ module -public import RealRooted.Basic.ProperPosition -public import RealRooted.Basic.Coefficients -import RealRooted.DerivativeRecurrence.Interlacing -import RealRooted.MaWang.DerivativeStep -import RealRooted.ThreeTermRecurrence.Interlacing +public import RealRooted.DerivativeRecurrence.HalfDegree /-! -# Strict interlacing of derivative recurrences of half degree +# Half-degree derivative recurrence theorem facade -Two consecutive-interlacing theorems for nonnegative derivative recurrences -`Q (n + 1) = A n * (Q n)' + B n * Q n` whose degrees grow by half a degree per step. The row -tactics apply them in the `degreePattern` and `fTransform` routes. +The recurrence theorems live in `RealRooted.DerivativeRecurrence.HalfDegree`. -/ - -public section - -open Polynomial - -namespace RealRooted.Tactic - -/-- Consecutive strict interlacing for a nonnegative derivative-recurrence sequence whose -degree is `(n + 1) / 2`, including the degree-zero initial row. -/ -theorem derivativeRecurrence_strictInterl_of_half_degree - {Q A B : ℕ → ℝ[X]} - (hrec : ∀ n, Q (n + 1) = A n * (Q n).derivative + B n * Q n) - (hdeg : ∀ n, (Q n).natDegree = (n + 1) / 2) - (hpos : ∀ n, 0 < (Q n).leadingCoeff) - (hnn : ∀ n, HasNonnegCoeffs (Q n)) - (hA : ∀ n r, r ≤ 0 → (A n).eval r ≤ 0) : - ∀ n, StrictInterl (Q n) (Q (n + 1)) - | 0 => - (interlaces_of_natDegree_eq_zero_of_natDegree_eq_one - (Polynomial.leadingCoeff_ne_zero.mp (hpos 0).ne') (hdeg 0) (hdeg 1)).toStrictInterl - | n + 1 => by - refine derivativeRecurrence_strictInterl_step (hrec (n + 1)) - (derivativeRecurrence_strictInterl_of_half_degree hrec hdeg hpos hnn hA n).2.1.2 - (by rw [hdeg]; grind) (hpos (n + 1)) (hpos (n + 2)) - (by rw [hdeg, hdeg]; grind) (by rw [hdeg, hdeg]; grind) ?_ - intro r hr - apply hA (n + 1) r - exact roots_nonpos_of_hasNonnegCoeffs (hnn (n + 1)) r - ((Polynomial.mem_roots - (Polynomial.leadingCoeff_ne_zero.mp (hpos (n + 1)).ne')).mpr hr) - -/-- Consecutive strict interlacing for a nonnegative derivative recurrence of -degree `n / 2`. The Ma--Wang constant-row branch handles the initial -constant-to-constant step. -/ -theorem derivativeRecurrence_strictInterl_of_floor_half_degree - {Q A B : ℕ → ℝ[X]} - (hrec : ∀ n, Q (n + 1) = A n * (Q n).derivative + B n * Q n) - (hdeg : ∀ n, (Q n).natDegree = n / 2) - (hpos : ∀ n, 0 < (Q n).leadingCoeff) - (hnn : ∀ n, HasNonnegCoeffs (Q n)) - (hA : ∀ n r, r ≤ 0 → (A n).eval r ≤ 0) : - ∀ n, StrictInterl (Q n) (Q (n + 1)) := by - have hstep (n : ℕ) (hs : (Q n).Splits) : - StrictInterl (Q n) (Q (n + 1)) := by - have hstrict := MaWang.strictInterl_derivative_of_nonpos_of_splits - (u := B n) (v := A n) hs - (by rw [add_comm, ← hrec n, hdeg, hdeg]; grind) - (by rw [add_comm, ← hrec n, hdeg, hdeg]; grind) - (by rw [add_comm, ← hrec n]; exact hpos (n + 1)) (hpos n) (by - intro r hr - apply hA n r - exact roots_nonpos_of_hasNonnegCoeffs (hnn n) r - ((Polynomial.mem_roots - (Polynomial.leadingCoeff_ne_zero.mp (hpos n).ne')).mpr hr)) - rw [add_comm, ← hrec n] at hstrict - exact hstrict - intro n - induction n with - | zero => - exact hstep 0 (Polynomial.Splits.of_natDegree_eq_zero (by rw [hdeg])) - | succ n ih => exact hstep (n + 1) ih.2.1.2 - -end RealRooted.Tactic diff --git a/RealRooted/Tactic/Row/Routes.lean b/RealRooted/Tactic/Row/Routes.lean index 00e3dc5b8..6bd978f91 100644 --- a/RealRooted/Tactic/Row/Routes.lean +++ b/RealRooted/Tactic/Row/Routes.lean @@ -251,8 +251,8 @@ def rowRouteTable : List RowRouteInfo := [ [ `RealRooted.derivativeRecurrence_splits_of_degree_pattern_of_nonnegCoeffs, `RealRooted.derivativeRecurrence_strictInterl_of_degree_pattern_of_nonnegCoeffs, - `RealRooted.Tactic.derivativeRecurrence_strictInterl_of_half_degree, - `RealRooted.Tactic.derivativeRecurrence_strictInterl_of_floor_half_degree + `RealRooted.derivativeRecurrence_strictInterl_of_half_degree, + `RealRooted.derivativeRecurrence_strictInterl_of_floor_half_degree ] }, { name := `reversed diff --git a/RealRooted/Toeplitz/ParityStrict.lean b/RealRooted/Toeplitz/ParityStrict.lean index 4a55c3171..fab649524 100644 --- a/RealRooted/Toeplitz/ParityStrict.lean +++ b/RealRooted/Toeplitz/ParityStrict.lean @@ -44,7 +44,7 @@ variable {n : ℕ} /-- The hypotheses of the parity lift on a matrix `A`: `TP2`, decreasing columns, constant upper-triangular columns, and `A 0 0 > 0`. -/ -structure ParityHyp (A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : Prop where +structure IsParityKernel (A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : Prop where /-- Nonnegative entries and ordered `2 × 2` minors. -/ isTP2 : A.IsTP2 /-- Every column weakly decreases. -/ @@ -58,19 +58,19 @@ section UV variable {A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ} -namespace ParityHyp +namespace IsParityKernel -variable (H : ParityHyp A) +variable (H : IsParityKernel A) include H -lemma blockTP2 : (parityBlock A).IsTP2 := parityBlock_isTP2 H.isTP2 H.col +lemma isTP2_parityBlock : (parityBlock A).IsTP2 := parityBlock_isTP2 H.isTP2 H.col -lemma blockCol : +lemma parityBlock_apply_le_of_le : ∀ ⦃i k j : Fin (n + 1 + n + 1)⦄, i ≤ k → parityBlock A k j ≤ parityBlock A i j := fun _ _ _ h => parityBlock_col_le H.isTP2.nonneg H.col _ h -lemma blockRow : +lemma parityBlock_apply_eq_of_le : ∀ ⦃i j : Fin (n + 1 + n + 1)⦄, i ≤ j → parityBlock A i j = parityBlock A j j := fun _ _ h => parityBlock_row_eq H.row h @@ -78,7 +78,7 @@ lemma blockRow : lemma monic_natDegree_u (m : ℕ) : (hessenbergRow (n := n + 1 + n) (parityBlock A) m).Monic ∧ (hessenbergRow (n := n + 1 + n) (parityBlock A) m).natDegree = m := - monic_natDegree_hessenbergRow (n := n + 1 + n) (parityBlock A) H.blockRow m + monic_natDegree_hessenbergRow (n := n + 1 + n) (parityBlock A) H.parityBlock_apply_eq_of_le m /-- `V_m` is monic of degree `m`. -/ lemma monic_natDegree_v (m : ℕ) : @@ -90,15 +90,17 @@ lemma monic_natDegree_v (m : ℕ) : /-- `U_m` has only nonnegative real roots. -/ lemma isRealRootedIn_u (m : ℕ) : IsRealRootedIn (Set.Ici 0) (hessenbergRow (n := n + 1 + n) (parityBlock A) m) := - isRealRootedIn_Ici_hessenbergRow (n := n + 1 + n) H.blockTP2 H.blockCol H.blockRow m + isRealRootedIn_Ici_hessenbergRow (n := n + 1 + n) H.isTP2_parityBlock + H.parityBlock_apply_le_of_le H.parityBlock_apply_eq_of_le m /-- `V_m` has only nonnegative real roots. -/ lemma isRealRootedIn_v (m : ℕ) : IsRealRootedIn (Set.Ici 0) (PowerSeries.coeff m (parityV A)) := by rw [coeff_parityV_eq A H.row] - exact isRealRootedIn_Ici_signedComp_hessenbergVector (n := n + 1 + n) H.blockTP2 H.blockCol m _ + exact isRealRootedIn_Ici_signedComp_hessenbergVector (n := n + 1 + n) + H.isTP2_parityBlock H.parityBlock_apply_le_of_le m _ -end ParityHyp +end IsParityKernel private lemma eval_signedComp (f : ℝ[X]) (k : ℕ) (x : ℝ) : (C ((-1 : ℝ) ^ k) * f.comp (-X)).eval x = (-1) ^ k * f.eval (-x) := by @@ -109,9 +111,9 @@ private lemma isRoot_signedComp' {f : ℝ[X]} {k : ℕ} {x : ℝ} : have hne : ((-1 : ℝ) ^ k) ≠ 0 := pow_ne_zero _ (by norm_num) simp [IsRoot, hne] -namespace ParityHyp +namespace IsParityKernel -variable (H : ParityHyp A) +variable (H : IsParityKernel A) include H @@ -171,7 +173,7 @@ lemma strictInterl_u_v (m : ℕ) : StrictInterl (hessenbergRow (n := n + 1 + n) (parityBlock A) m) (PowerSeries.coeff (m + 1) (parityV A)) := by have hinv := (affineVector_invariant (n := n + 1 + n) (M := fun _ => parityBlock A) - (fun _ => H.blockTP2) (fun _ => H.blockCol) m).2 + (fun _ => H.isTP2_parityBlock) (fun _ => H.parityBlock_apply_le_of_le) m).2 rw [← hessenbergVector_eq_affineVector (n := n + 1 + n) (parityBlock A)] at hinv have h : StrictInterl (parityVector A m 0) (parityVector A (m + 1) (parityIndex n)) := List.rel_of_pairwise_cons (isInterlacingSeq_iff_pairwise.mp hinv.2) @@ -346,7 +348,7 @@ theorem parityRow_certificate (γ : ℝ) (k : ℕ) : simpa [sub_eq_add_neg] using this · simpa using h6.map (Polynomial.compRingHom (X - C γ)) -end ParityHyp +end IsParityKernel end UV @@ -387,7 +389,7 @@ theorem parityRow_certificate_of_natDegree_ne_zero : IsCoprime (parityRow A γ k) (parityRow A γ (k + 1)) | n, A, hA, hcol, hrow, hG, γ, k => by rcases (hA.nonneg 0 0).lt_or_eq with hpos | hzero - · exact (ParityHyp.mk hA hcol hrow hpos).parityRow_certificate γ k + · exact (IsParityKernel.mk hA hcol hrow hpos).parityRow_certificate γ k · -- the first column vanishes: delete it with the first row have hcol0 : ∀ i, A i 0 = 0 := fun i => le_antisymm (hzero ▸ hcol (Fin.zero_le i)) (hA.nonneg i 0) diff --git a/RealRooted/TotalPositivity/PFRiordan.lean b/RealRooted/TotalPositivity/PFRiordan.lean index f4e98f921..cd95aafc8 100644 --- a/RealRooted/TotalPositivity/PFRiordan.lean +++ b/RealRooted/TotalPositivity/PFRiordan.lean @@ -484,82 +484,6 @@ theorem mk_geometricOneCoeff_mul_one_sub : simpa [BrandenVecchi.finiteSupersymmetricSeries] using BrandenVecchi.supersymmetricDenominatorFactor_mul_one_sub 1 -/-- Coefficients of `(1 + z)^2 / (1 - z)`, the `K`-series for A114123. -/ -def a114123KCoeff : ℕ → ℝ := - rationalPFCoeff 1 0 [1, 1] [1] - -/-- The A114123 `K`-series has the claimed finite rational factorization. -/ -theorem mk_a114123KCoeff_mul_one_sub : - PowerSeries.mk a114123KCoeff * (1 - PowerSeries.X) = - (1 + PowerSeries.X) ^ 2 := by - rw [a114123KCoeff, mk_rationalPFCoeff] - simpa [BrandenVecchi.supersymmetricNumeratorFactor, pow_two] using - BrandenVecchi.finiteSupersymmetricSeries_mul_denominators - ([1, 1] : List ℝ) ([1] : List ℝ) - -/-- The A114123 rows, equivalently -`[z^n] (1-z) / ((1-z)^2 - X z (1+z)^2)`. -/ -def a114123Row (n : ℕ) : ℝ[X] := - rowPolynomial geometricOneCoeff a114123KCoeff n - -/-- Exact generating-series identity -`((1-z)^2 - X z (1+z)^2) F(X,z) = 1-z` for the A114123 rows. -/ -theorem a114123_denominator_mul_rowGeneratingSeries : - (BrandenLeite.polynomialLift ((1 - PowerSeries.X) ^ 2) - - PowerSeries.C X * BrandenLeite.polynomialLift - (PowerSeries.X * (1 + PowerSeries.X) ^ 2)) * - rowGeneratingSeries geometricOneCoeff a114123KCoeff = - BrandenLeite.polynomialLift (1 - PowerSeries.X) := by - have hd : - (1 - PowerSeries.X) ^ 2 * PowerSeries.mk geometricOneCoeff = - 1 - PowerSeries.X := by - calc - (1 - PowerSeries.X) ^ 2 * PowerSeries.mk geometricOneCoeff = - (1 - PowerSeries.X) * - (PowerSeries.mk geometricOneCoeff * (1 - PowerSeries.X)) := by ring - _ = 1 - PowerSeries.X := by rw [mk_geometricOneCoeff_mul_one_sub]; ring - have hK : - PowerSeries.X * (1 - PowerSeries.X) * - PowerSeries.mk a114123KCoeff = - PowerSeries.X * (1 + PowerSeries.X) ^ 2 := by - calc - PowerSeries.X * (1 - PowerSeries.X) * - PowerSeries.mk a114123KCoeff = - PowerSeries.X * - (PowerSeries.mk a114123KCoeff * (1 - PowerSeries.X)) := by ring - _ = PowerSeries.X * (1 + PowerSeries.X) ^ 2 := by - rw [mk_a114123KCoeff_mul_one_sub] - have hd' : - PowerSeries.mk - (fun n => PowerSeries.coeff n ((1 - PowerSeries.X) ^ 2)) * - PowerSeries.mk geometricOneCoeff = - PowerSeries.mk (fun n => PowerSeries.coeff n (1 - PowerSeries.X)) := by - simpa only [BrandenLeite.mk_coeff_eq] using hd - have hK' : - PowerSeries.X * - PowerSeries.mk (fun n => PowerSeries.coeff n (1 - PowerSeries.X)) * - PowerSeries.mk a114123KCoeff = - PowerSeries.mk (fun n => PowerSeries.coeff n - (PowerSeries.X * (1 + PowerSeries.X) ^ 2)) := by - simpa only [BrandenLeite.mk_coeff_eq] using hK - simpa only [BrandenLeite.mk_coeff_eq] using - denominator_mul_rowGeneratingSeries - (D₀ := fun n => PowerSeries.coeff n ((1 - PowerSeries.X) ^ 2)) - (L := fun n => PowerSeries.coeff n - (PowerSeries.X * (1 + PowerSeries.X) ^ 2)) - (N := fun n => PowerSeries.coeff n (1 - PowerSeries.X)) - (d := geometricOneCoeff) (K := a114123KCoeff) hd' hK' - -/-- Every A114123 row splits and has only nonpositive roots. -/ -theorem a114123Row_splits_and_roots_nonpos (n : ℕ) : - (a114123Row n).Splits ∧ - ∀ r ∈ (a114123Row n).roots, r ≤ 0 := by - apply rowPolynomial_splits_and_roots_nonpos - · exact rationalPFCoeff_isPolyaFreqSeq - (c := 1) (by norm_num) 0 (by simp) (by simp) - · exact rationalPFCoeff_isPolyaFreqSeq - (c := 1) (by norm_num) 0 (by simp) (by simp) - /-- Coefficients of `z^2 / (1 - z)`, the `K`-series for the rows `R_m(X) = ∑_j binom(m-j,2j) X^j`. -/ def evenBinomialKCoeff : ℕ → ℝ := diff --git a/RealRooted/Transforms/BrandenE/RootDomain.lean b/RealRooted/Transforms/BrandenE/RootDomain.lean index 6c92836e2..4980ee184 100644 --- a/RealRooted/Transforms/BrandenE/RootDomain.lean +++ b/RealRooted/Transforms/BrandenE/RootDomain.lean @@ -117,7 +117,7 @@ theorem isRealRootedIn_Icc_brandenE_X_sub_C_mul_X_sub_C_of_pos {r s : ℝ} (hr0 (by positivity) (pair_disc hr hs) (by nlinarith) /-- For two roots in `[L, -1)`, the `E` image of the pair is rooted in `[-1, 0]`. -/ -theorem isRealRootedIn_Icc_brandenE_X_sub_C_mul_X_sub_C_of_lt_neg_one {r s : ℝ} (hr0 : r < -1) +theorem BrandenE.isRealRootedIn_Icc_quadratic_of_lt_neg_one {r s : ℝ} (hr0 : r < -1) (hs0 : s < -1) (hr : 4 * r ^ 2 + 4 * r ≤ 1) (hs : 4 * s ^ 2 + 4 * s ≤ 1) : IsRealRootedIn (Icc (-1) 0) (brandenE ((X - C r) * (X - C s))) := by rw [brandenE_X_sub_C_mul_X_sub_C] @@ -130,7 +130,7 @@ theorem isRealRootedIn_Icc_brandenE_X_sub_C_mul_X_sub_C_of_lt_neg_one {r s : ℝ /-- For `r < -1 < 0 < s` in `[L, U]` the `E` image of `(X - r) (X - s)` is rooted in `[r, s]`; its roots lie in `(r, -1)` and `(0, s)`. -/ -theorem isRealRootedIn_Icc_brandenE_X_sub_C_mul_X_sub_C_of_lt_neg_one_of_pos {r s : ℝ} +theorem _root_.RealRooted.BrandenE.isRealRootedIn_Icc_quadratic_of_lt_neg_one_of_pos {r s : ℝ} (hr0 : r < -1) (hs0 : 0 < s) (hr : 4 * r ^ 2 + 4 * r ≤ 1) (hs : 4 * s ^ 2 + 4 * s ≤ 1) : IsRealRootedIn (Icc r s) (brandenE ((X - C r) * (X - C s))) := by rw [brandenE_X_sub_C_mul_X_sub_C] @@ -202,7 +202,7 @@ theorem exists_eq_C_mul_mul_of_isRealRootedIn_Icc {p : ℝ[X]} obtain ⟨Fn, Rn, hFRn, hFn, hRn⟩ := exists_rootPolynomial_eq_mul_of_pairs (K := K) (S := {r | r < -1 ∧ 4 * r ^ 2 + 4 * r ≤ 1}) h1 hmul (fun r hr s hs ↦ - isRealRootedIn_Icc_brandenE_X_sub_C_mul_X_sub_C_of_lt_neg_one hr.1 hs.1 hr.2 hs.2) + RealRooted.BrandenE.isRealRootedIn_Icc_quadratic_of_lt_neg_one hr.1 hs.1 hr.2 hs.2) mn (fun r hr ↦ by rw [hmn, Multiset.mem_filter] at hr exact ⟨hr.2, hroot r hr.1⟩) @@ -251,7 +251,7 @@ private theorem isRealRootedIn_Icc_brandenE_residual {A B : ℝ} {Rp Rn : ℝ[X] · rw [mul_one, brandenE_X_sub_C] exact IsRealRootedIn.X_sub_C (hm r hr) · rw [mul_comm] - exact (isRealRootedIn_Icc_brandenE_X_sub_C_mul_X_sub_C_of_lt_neg_one_of_pos hs0 hr0 + exact (RealRooted.BrandenE.isRealRootedIn_Icc_quadratic_of_lt_neg_one_of_pos hs0 hr0 (hm' s hs) (hm' r hr)).mono (Icc_subset_Icc (hm s hs).1 (hm r hr).2) /-- **Invariant intervals of the `E` transform.** For `L ≤ A ≤ -1` and `0 ≤ B ≤ U` the `E` diff --git a/RealRooted/VeroneseRecognition/Affine.lean b/RealRooted/VeroneseRecognition/Affine.lean index 7944a8c78..0b973879b 100644 --- a/RealRooted/VeroneseRecognition/Affine.lean +++ b/RealRooted/VeroneseRecognition/Affine.lean @@ -293,7 +293,7 @@ theorem affineVeroneseProductRow_orderTwo_eq_of_recurrence /-- Fibonacci-type rows with `P₀ = P₁ = 1` are affine odd sections of successive powers of `X + 1 / 2`. -/ -theorem veroneseSectionPolynomial_X_add_half_pow_comp_eq_of_fibonacci_recurrence +theorem _root_.RealRooted.VeroneseRecognition.section_X_add_half_pow_comp_eq_of_fibonacci_recurrence (P : ℕ → ℝ[X]) (hzero : P 0 = 1) (hone : P 1 = 1) (hrec : ∀ n, P (n + 2) = P (n + 1) + X * P n) (n : ℕ) : (veroneseSectionPolynomial 2 1 ((X + C (1 / 2 : ℝ)) ^ (n + 1))).comp diff --git a/RealRooted/WeightedSum.lean b/RealRooted/WeightedSum.lean index 59b583ddc..342528d0d 100644 --- a/RealRooted/WeightedSum.lean +++ b/RealRooted/WeightedSum.lean @@ -37,6 +37,15 @@ def weightedSum : List (ℝ × ℝ[X]) → ℝ[X] @[simp] lemma weightedSum_cons (a : ℝ) (p : ℝ[X]) (l : List (ℝ × ℝ[X])) : weightedSum ((a, p) :: l) = C a * p + weightedSum l := rfl +/-- A linear map sends a weighted sum to the weighted sum of the images. -/ +theorem map_weightedSum (T : ℝ[X] →ₗ[ℝ] ℝ[X]) : + ∀ l : List (ℝ × ℝ[X]), + T (weightedSum l) = weightedSum (l.map fun ap => (ap.1, T ap.2)) + | [] => by simp + | (a, p) :: l => by + simp only [weightedSum_cons, map_add, List.map_cons, map_weightedSum T l, C_mul', + LinearMap.map_smul] + /-- A weighted sum is the ordinary sum of its scalar-multiplied entries. -/ theorem weightedSum_eq_sum_map (l : List (ℝ × ℝ[X])) : weightedSum l = (l.map fun ap => C ap.1 * ap.2).sum := by diff --git a/scripts/check_declaration_names.py b/scripts/check_declaration_names.py index 809cbfa75..4b384d1fd 100644 --- a/scripts/check_declaration_names.py +++ b/scripts/check_declaration_names.py @@ -8,7 +8,10 @@ import unittest sys.dont_write_bytecode = True -from challenge_catalog import CatalogItem, load_catalog +from challenge_catalog import ( + CatalogItem, SourceDeclaration, load_catalog, source_declarations, + strip_comments_and_strings, +) ROOT = Path(__file__).resolve().parents[1] BASELINE = ROOT / "scripts/declaration_names_baseline.txt" @@ -38,7 +41,77 @@ def has_workflow_segment(name): return False -def findings(pages, family=False): +def declared_result(declaration): + """Read the explicit result after the binders, without inspecting a proof/body.""" + source = strip_comments_and_strings(declaration.source_code) + depth = 0 + for index, char in enumerate(source): + if char in "([{": + depth += 1 + elif char in ")]}": + depth -= 1 + elif char == ":" and depth == 0: + return source[index + 1:].split(":=", 1)[0].strip() + return "" + + +def preservation_predicates(declarations): + """Only explicitly Prop-valued definitions establish preservation-predicate names.""" + return { + name for name, declaration in declarations.items() + if declaration.actual_kind == "definition" + and name.rsplit(".", 1)[-1].startswith("Preserves") + and declared_result(declaration) == "Prop" + } + + +def preserves_violation(item, declarations, predicates): + """Distinguish operation closure names from literal predicates in conclusions.""" + leaf = item.name.rsplit(".", 1)[-1] + if "preserves" not in leaf.lower(): + return False + declaration = declarations.get(item.name) + if declaration is None: + return True + if item.name in predicates: + return False + if declaration.actual_kind == "theorem": + # A conclusion-named theorem may mention a literal preservation predicate, + # e.g. ncard_preservesInterlacing or preservesRealRootedOrZero_iff_.... + # Require both the complete name segment and the constant in the result; + # foo_preserves_pf and sampleOperator_preserves remain closure violations. + result_names = set(re.findall(r"[\w.]+", declared_result(declaration))) + for predicate in predicates: + constant = predicate.rsplit(".", 1)[-1] + segment = constant[0].lower() + constant[1:] + if segment not in leaf.split("_"): + continue + if any(name == predicate or name.rsplit(".", 1)[-1] == constant + for name in result_names): + return False + return True + + +def naming_declarations(pages, root): + """Load selected declarations and definitions that can own literal predicate names.""" + paths = { + root / (item.module.replace(".", "/") + ".lean" + if item.module else page.source_path) + for page in pages for item in page.items + } + for path in (root / "RealRooted").rglob("*.lean"): + if re.search(r"\b(?:def|abbrev)\s+(?:[\w.]*\.)?Preserves\w*\b", + path.read_text(encoding="utf-8")): + paths.add(path) + declarations = {} + for path in sorted(paths): + declarations.update(source_declarations(root, path)) + return declarations + + +def findings(pages, family=False, declarations=None): + declarations = declarations or {} + predicates = preservation_predicates(declarations) result = set() for page in pages: for item in page.items: @@ -56,10 +129,8 @@ def findings(pages, family=False): if len(leaf) > 60: rules.append("length") if has_workflow_segment(name): rules.append("workflow") - # Predicate namespaces are the intended home of closure lemmas and criteria. - # Their leaf names should describe the operation, even when the predicate - # itself starts with Preserves. Predicate definitions remain in the ratchet. - if "preserves" in leaf.lower(): rules.append("preserves") + if preserves_violation(item, declarations, predicates): + rules.append("preserves") if item.expected_kind == "theorem" and name.startswith("RealRooted.Challenges."): rules.append("challenges") if family and page.section == "families" and item.headline: @@ -116,7 +187,6 @@ def test_oeis_owner_exemption(self): def test_preserves_predicate_namespace(self): from types import SimpleNamespace cases = ( - ("PreservesOrderedPF", True), ("PreservesOrderedPF.mul", False), ("PreservesOrderedPF.iff_differentialTests", False), ("IsPFPolynomial.narayanaTransform", False), @@ -129,6 +199,43 @@ def test_preserves_predicate_namespace(self): page = SimpleNamespace(items=[item], source_path="Sample.lean") self.assertEqual(f"preserves\t{name}" in findings([page]), expected) + def test_preserves_semantic_role(self): + from types import SimpleNamespace + prefix = "RealRooted." + cases = ( + ("PreservesOrderedPF", "definition", + "def PreservesOrderedPF (T : ℕ → ℕ) : Prop := ∀ n, T n = n", False), + ("PreservesData", "definition", "def PreservesData : ℕ := 0", True), + ("foo_preserves_pf", "theorem", + "theorem foo_preserves_pf : PreservesOrderedPF id", True), + ("sampleOperator_preserves", "theorem", + "theorem sampleOperator_preserves : True", True), + ("ncard_preservesOrderedPF", "theorem", + "theorem ncard_preservesOrderedPF : {T | PreservesOrderedPF T}.ncard = 1", + False), + ("preservesOrderedPF_iff_eq", "theorem", + "theorem preservesOrderedPF_iff_eq : PreservesOrderedPF T ↔ T = id", + False), + ("foo_preservesOrderedPF", "theorem", + "theorem foo_preservesOrderedPF (h : PreservesOrderedPF T) : True", True), + ("preservesDataCount", "definition", + "def preservesDataCount : ℕ := 0", True), + ) + declarations = { + prefix + suffix: SourceDeclaration( + prefix + suffix, kind, "Sample.lean", 1, False, source + ) + for suffix, kind, source, _ in cases + } + for suffix, kind, _, expected in cases: + with self.subTest(suffix=suffix): + name = prefix + suffix + item = CatalogItem(name, kind, None) + page = SimpleNamespace(items=[item], source_path="Sample.lean") + self.assertEqual(f"preserves\t{name}" in findings( + [page], declarations=declarations + ), expected) + def test_workflow_segments(self): from types import SimpleNamespace positive = ( @@ -160,7 +267,8 @@ def test_workflow_segments(self): self.assertEqual(f"workflow\t{name}" in findings([page]), expected) suite = unittest.defaultTestLoader.loadTestsFromTestCase(Tests) return 0 if unittest.TextTestRunner().run(suite).wasSuccessful() else 1 - current = findings(load_catalog(ROOT), args.family) + pages = load_catalog(ROOT) + current = findings(pages, args.family, naming_declarations(pages, ROOT)) # Family findings are evaluated separately until the scheme is adopted. baseline = set(BASELINE.read_text().splitlines()) if BASELINE.exists() else set() if not args.family: diff --git a/scripts/declaration_names_baseline.txt b/scripts/declaration_names_baseline.txt index a254ac5cb..e69de29bb 100644 --- a/scripts/declaration_names_baseline.txt +++ b/scripts/declaration_names_baseline.txt @@ -1,21 +0,0 @@ -preserves RealRooted.Atomic2x2Matrix.PreservesInterlacing -preserves RealRooted.Atomic2x2Matrix.ncard_isNondegenerate_and_preservesInterlacing -preserves RealRooted.Atomic2x2Matrix.ncard_preservesInterlacing -preserves RealRooted.BorceaBranden.PreservesComplexStability -preserves RealRooted.BorceaBranden.PreservesComplexStabilityOnDegreeBox -preserves RealRooted.BorceaBranden.PreservesRealRootedUpTo -preserves RealRooted.BorceaBranden.PreservesRealStability -preserves RealRooted.BorceaBranden.PreservesRealStabilityOnDegreeBox -preserves RealRooted.OperatorMatrix.PreservesOrderedPF -preserves RealRooted.OperatorMatrix.PreservesOrderedPFPair -preserves RealRooted.PreservesCubicTransition -preserves RealRooted.PreservesInterlacingSeq0 -preserves RealRooted.PreservesOrderedPFUpTo -preserves RealRooted.PreservesPFTriple -preserves RealRooted.PreservesRealRootedOrZero -preserves RealRooted.PreservesScaledPFTriple -preserves RealRooted.basisTransform_orderTwoBasis_preserves_bounded_pf_iff -preserves RealRooted.evenDerivative_preservesPF_tfae -preserves RealRooted.leanderTransform_preserves_compatibility -preserves RealRooted.raySemigroupTransform_preservesPF_iff -preserves RealRooted.raySemigroupTransform_preservesPF_iff_finiteLog diff --git a/scripts/import_architecture.json b/scripts/import_architecture.json index 455726a49..39ca73a91 100644 --- a/scripts/import_architecture.json +++ b/scripts/import_architecture.json @@ -16,10 +16,10 @@ ], "budgets": { "RealRooted": { - "max_modules": 2245 + "max_modules": 2247 }, "RealRooted.Production": { - "max_modules": 2173 + "max_modules": 2175 }, "RealRooted.Tactic.Examples": { "max_modules": 844 diff --git a/scripts/tactic_routes.json b/scripts/tactic_routes.json index a7905c1b7..6fa02e863 100644 --- a/scripts/tactic_routes.json +++ b/scripts/tactic_routes.json @@ -300,8 +300,8 @@ "theorems": [ "RealRooted.derivativeRecurrence_splits_of_degree_pattern_of_nonnegCoeffs", "RealRooted.derivativeRecurrence_strictInterl_of_degree_pattern_of_nonnegCoeffs", - "RealRooted.Tactic.derivativeRecurrence_strictInterl_of_half_degree", - "RealRooted.Tactic.derivativeRecurrence_strictInterl_of_floor_half_degree" + "RealRooted.derivativeRecurrence_strictInterl_of_half_degree", + "RealRooted.derivativeRecurrence_strictInterl_of_floor_half_degree" ], "module": "RealRooted.Tactic.Row.Frontend", "summary": "A fitted half-degree law yields splitting or strict interlacing.",