Skip to content

feat(Analysis/Polynomial): add Sturm's theorem for real polynomials - #42558

Open
AMcRoberts wants to merge 3 commits into
leanprover-community:masterfrom
AMcRoberts:sturm-abstract
Open

feat(Analysis/Polynomial): add Sturm's theorem for real polynomials#42558
AMcRoberts wants to merge 3 commits into
leanprover-community:masterfrom
AMcRoberts:sturm-abstract

Conversation

@AMcRoberts

Copy link
Copy Markdown

We introduce Sturm sequences for real polynomials and prove Sturm's theorem:
the number of sign variations of the sequence decreases by exactly the
number of distinct roots crossed on a half-open interval. The development
follows the structure of Manuel Eberl's AFP entry A Formalisation of
Sturm's Theorem
(2014); see the module's own ## References section.

A follow-up PR adds CertifiedSturmChain, instantiating this theorem from
an exact Euclidean/pseudo-remainder-sequence certificate.

We introduce Sturm sequences for real polynomials and prove Sturm's
theorem: the number of sign variations of the sequence decreases by
exactly the number of distinct roots crossed on a half-open interval.
The development follows the structure of Manuel Eberl's AFP entry
*A Formalisation of Sturm's Theorem* (2014); see the module's own
References section.
@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

PR summary df3f4a5620

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Analysis.Polynomial.Sturm (new file) 1673

Declarations diff (regex)

+ IsQuasiSturmSequence
+ IsQuasiSturmSequence.tail
+ IsSturmSequence
+ IsSturmSequence.count_roots_between
+ IsSturmSequence.count_roots_between_empty
+ IsSturmSequence.exists_left_drop
+ IsSturmSequence.p_zero
+ constant_of_eventually_locally_constant_Icc
+ destutter'_append
+ eventually_ne_zero_nhdsWithin
+ exists_delta_of_eventually_nhdsWithin_compl
+ finite_exists_min
+ getLastD_congr
+ ne_zero_of_sign_eq
+ signList_eventually_eq
+ signList_eventually_eq'
+ sign_eval_eventually_eq
+ splitSturmVariations
+ splitSturmVariationsTotal
+ splitSturmVariationsTotalAt
+ splitSturmVariationsTotalAt_eq
+ splitSturmVariationsTotalAt_eventually_const
+ splitSturmVariationsTotalAt_self
+ sturmVariations
+ sturmVariations_core_triple
+ sturmVariations_distrib
+ sturmVariations_eventually_const
+ sturmVariations_eventually_const_of_all_ne
+ sturmVariations_nil
+ sturmVariations_pair_eventually_eq
+ sturmVariations_singleton
+ sturmVariations_sturm_triple

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit df3f4a5).

  • +47 new declarations
  • −0 removed declarations
+Polynomial.IsQuasiSturmSequence
+Polynomial.IsQuasiSturmSequence.casesOn
+Polynomial.IsQuasiSturmSequence.last_sign_const
+Polynomial.IsQuasiSturmSequence.mk
+Polynomial.IsQuasiSturmSequence.ne_nil
+Polynomial.IsQuasiSturmSequence.rec
+Polynomial.IsQuasiSturmSequence.recOn
+Polynomial.IsQuasiSturmSequence.signs
+Polynomial.IsQuasiSturmSequence.tail
+Polynomial.IsSturmSequence
+Polynomial.IsSturmSequence.casesOn
+Polynomial.IsSturmSequence.count_roots_between
+Polynomial.IsSturmSequence.count_roots_between_empty
+Polynomial.IsSturmSequence.deriv_sign
+Polynomial.IsSturmSequence.exists_left_drop
+Polynomial.IsSturmSequence.head_eq_p
+Polynomial.IsSturmSequence.length_ge_two
+Polynomial.IsSturmSequence.mk
+Polynomial.IsSturmSequence.p_zero
+Polynomial.IsSturmSequence.rec
+Polynomial.IsSturmSequence.recOn
+Polynomial.IsSturmSequence.squarefree_pair
+Polynomial.IsSturmSequence.toIsQuasiSturmSequence
+Polynomial.constant_of_eventually_locally_constant_Icc
+Polynomial.eventually_ne_zero_nhdsWithin
+Polynomial.exists_delta_of_eventually_nhdsWithin_compl
+Polynomial.ne_zero_of_sign_eq
+Polynomial.signList_eventually_eq
+Polynomial.signList_eventually_eq'
+Polynomial.sign_eval_eventually_eq
+Polynomial.splitSturmVariations
+Polynomial.splitSturmVariations.eq_def
+Polynomial.splitSturmVariations.induct
+Polynomial.splitSturmVariationsTotal
+Polynomial.splitSturmVariationsTotalAt
+Polynomial.splitSturmVariationsTotalAt_eq
+Polynomial.splitSturmVariationsTotalAt_eventually_const
+Polynomial.splitSturmVariationsTotalAt_self
+Polynomial.sturmVariations
+Polynomial.sturmVariations_core_triple
+Polynomial.sturmVariations_distrib
+Polynomial.sturmVariations_eventually_const
+Polynomial.sturmVariations_eventually_const_of_all_ne
+Polynomial.sturmVariations_nil
+Polynomial.sturmVariations_pair_eventually_eq
+Polynomial.sturmVariations_singleton
+Polynomial.sturmVariations_sturm_triple

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5050 1 exposed public sections

Current commit df3f4a5620
Reference commit 87adeaebd3

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@github-actions github-actions Bot added the t-analysis Analysis (normed *, calculus) label Aug 8, 2026
@AMcRoberts AMcRoberts changed the title feat(Analysis/Polynomial): Sturm's theorem for real polynomials feat(Analysis/Polynomial): add Sturm's theorem for real polynomials Aug 8, 2026
…rd_msgs)

Three real CI failures found and fixed:
- PR title had a capitalized subject; mathlib's title linter requires
  a lowercase first word.
- references.bib's new eberl2014sturm entry was in the wrong
  alphabetical position (bibtool's canonical sort wants it before
  Echenique2005, not after EinsiedlerWard2017) and left a stray blank
  line; applied the exact diff CI's own bibtool check computed.
- MathlibTest/Sturm.lean used bare #check without #guard_msgs, so its
  info-level output was flagged as an unexpected build failure; wrapped
  each #check with #guard_msgs and the exact expected output.
AMcRoberts added a commit to AMcRoberts/mathlib4 that referenced this pull request Aug 8, 2026
CertifiedSturmChain packages the algebraic data a Euclidean or
pseudo-remainder-sequence construction naturally produces (a
positive-scaled recurrence at each step, a nonzero-constant Bezout
identity between p and its derivative, and a nonzero-constant
terminal element) and proves it satisfies IsSturmSequence, so a
concrete PRS chain can drive Sturm's root-count theorem directly.

This development was produced independently from the classical
sources cited in the module's own References section, without
consulting the formalisation cited by the abstract theorem this
depends on (leanprover-community#42558).
Two stray blank lines (before Eisenbud1995 and before perfect1969matroid)
had crept back in from upstream drift; bibtool's canonical pass removes
them again.
@tb65536

tb65536 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Hi! Can you clarify if AI was used to help create this PR at all? This will help us to review appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants