Skip to content

[Merged by Bors] - feat(Analysis/Polynomial): the sign of a polynomial immediately to the right of a point - #44248

Closed
tomaz1502 wants to merge 9 commits into
leanprover-community:masterfrom
tomaz1502:sign_right
Closed

tomaz1502 wants to merge 9 commits into
leanprover-community:masterfrom
tomaz1502:sign_right

Conversation

@tomaz1502

@tomaz1502 tomaz1502 commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

This PR defines Polynomial.signRight x p : SignType, the sign that a real polynomial p takes
on a sufficiently small interval (x, x + ε), as the limit of sign (p.eval y) as y → x from the right, and
develops its basic API:

  • eventually_sign_eq_signRight, signRight_eq_iff: the defining property and its uniqueness;
  • signRight_eq_zero_iff: signRight x p = 0 iff p = 0;
  • signRight_mul, signRight_neg, signRight_C: signRight x is multiplicative, commutes with
    negation and agrees with SignType.sign on constants;
  • signRight_of_eval_ne_zero, signRight_of_eval_eq_zero: the computation rule
    signRight x p = sign (p.eval x) if p.eval x ≠ 0, and signRight x p = signRight x (derivative p)
    otherwise (via the mean value theorem).

This is the local invariant behind Sturm's theorem: it determines the direction in which the sign
of a Sturm sequence changes across a root, and it will be used to define the Cauchy index in the
next PR of the series.

This is the third PR of a series formalising the Sturm–Tarski theorem, following #43783
(List.signVariations) and #43954 (Polynomial.sturmSeq). Everything is stated over ℝ; the
statements hold over any real closed field, and the implementation notes record what is needed to
generalise them.

Co-authored-by: Pedro Saccomani [email protected]
Co-authored-by: Sarah Pereira [email protected]
Co-authored-by: Kim Morrison [email protected]


The original development was done manually. We used Claude (Fable 5.1) to review the code,
suggest improvements and help in the preparation of the PR.

@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 Sep 27, 2026
@github-actions

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 Zulip and join the Lean community.
Thank you again for joining our community.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

PR summary dae2036136

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Topology.Instances.Sign 866 878 +12 (+1.39%)
Import changes for all files
Files Import difference
Mathlib.Topology.Instances.Sign 12
Mathlib.Analysis.Polynomial.SignRight (new file) 2143

Declarations diff (regex)

+ IsPreconnected.sign_eq_of_continuousOn
+ eventually_sign_eq_signRight
+ exists_eventually_sign_eq
+ gcd_map
+ signRight
+ signRight_C
+ signRight_C_mul
+ signRight_X_sub_C_pow
+ signRight_add
+ signRight_derivative_mul
+ signRight_eq_iff
+ signRight_eq_of_eventually
+ signRight_eq_zero_iff
+ signRight_mod
+ signRight_mul
+ signRight_mul_self
+ signRight_ne_zero
+ signRight_neg
+ signRight_of_eval_eq_zero
+ signRight_of_eval_ne_zero
+ signRight_zero
++ eval_mod_eq_self_of_root

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 a183fe1).

  • +21 new declarations
  • −0 removed declarations
+IsPreconnected.sign_eq_of_continuousOn
+Polynomial.eval_mod_eq_self_of_root
+Polynomial.eventually_sign_eq_signRight
+Polynomial.exists_eventually_sign_eq
+Polynomial.signRight
+Polynomial.signRight_C
+Polynomial.signRight_C_mul
+Polynomial.signRight_X_sub_C_pow
+Polynomial.signRight_add
+Polynomial.signRight_derivative_mul
+Polynomial.signRight_eq_iff
+Polynomial.signRight_eq_of_eventually
+Polynomial.signRight_eq_zero_iff
+Polynomial.signRight_mod
+Polynomial.signRight_mul
+Polynomial.signRight_mul_self
+Polynomial.signRight_ne_zero
+Polynomial.signRight_neg
+Polynomial.signRight_of_eval_eq_zero
+Polynomial.signRight_of_eval_ne_zero
+Polynomial.signRight_zero

No changes to strong technical debt.
No changes to weak technical debt.

Current commit dae2036136
Reference commit 0f8a641e2e

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.py 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).

@ocfnash ocfnash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

Comment thread Mathlib/Topology/Instances/Sign.lean Resolved
@ocfnash

ocfnash commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Oct 15, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Oct 15, 2026
…e right of a point (#44248)

This PR defines `Polynomial.signRight x p : SignType`, the sign that a real polynomial `p` takes
on a sufficiently small interval `(x, x + ε)`, as the limit of `sign (p.eval y)` as `y → x` from the right, and
develops its basic API:

* `eventually_sign_eq_signRight`, `signRight_eq_iff`: the defining property and its uniqueness;
* `signRight_eq_zero_iff`: `signRight x p = 0` iff `p = 0`;
* `signRight_mul`, `signRight_neg`, `signRight_C`: `signRight x` is multiplicative, commutes with
  negation and agrees with `SignType.sign` on constants;
* `signRight_of_eval_ne_zero`, `signRight_of_eval_eq_zero`: the computation rule
  `signRight x p = sign (p.eval x)` if `p.eval x ≠ 0`, and `signRight x p = signRight x (derivative p)`
  otherwise (via the mean value theorem).

This is the local invariant behind Sturm's theorem: it determines the direction in which the sign
of a Sturm sequence changes across a root, and it will be used to define the Cauchy index in the
next PR of the series.

This is the third PR of a series formalising the Sturm–Tarski theorem, following #43783
(`List.signVariations`) and #43954 (`Polynomial.sturmSeq`). Everything is stated over `ℝ`; the
statements hold over any real closed field, and the implementation notes record what is needed to
generalise them.

Co-authored-by: Pedro Saccomani <[email protected]>
Co-authored-by: Sarah Pereira <[email protected]>
Co-authored-by: Kim Morrison <[email protected]>
Co-authored-by: Oliver Nash <[email protected]>
Co-authored-by: Oliver Nash <[email protected]>
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Oct 15, 2026
@mathlib-bors

mathlib-bors Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title feat(Analysis/Polynomial): the sign of a polynomial immediately to the right of a point [Merged by Bors] - feat(Analysis/Polynomial): the sign of a polynomial immediately to the right of a point Oct 15, 2026
@mathlib-bors mathlib-bors Bot closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants