Skip to content

[Merged by Bors] - chore: reinstate field_simp proofs - #28917

Closed
grunweg wants to merge 1 commit into
leanprover-community:masterfrom
grunweg:fieldsimp-reinstate
Closed

grunweg wants to merge 1 commit into
leanprover-community:masterfrom
grunweg:fieldsimp-reinstate

Conversation

@grunweg

@grunweg grunweg commented Aug 25, 2025 •

Copy link
Copy Markdown
Contributor

All these proofs were originally by field_simp, but were squeezed for performance.
After the rewrite in #28658, field_simp is no longer slow in pathological cases. Closes #15486.


Open in Gitpod

@grunweg

grunweg commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

I'm really curious to see the performance impact of this PR, though it's hard to measure two PRs combined.

@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Aug 25, 2025
@github-actions

github-actions Bot commented Aug 25, 2025 •

Copy link
Copy Markdown

PR summary d60062a692

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/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).

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Aug 25, 2025
@grunweg

grunweg commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

The CI failure doesn't make any sense (and is network-related, it seems). Let me retry.

@grunweg

grunweg commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-bot

Copy link
Copy Markdown

Here are the benchmark results for commit 98eda67.
There were significant changes against commit a3660d1:

  Benchmark                                                     Metric          Change
  ====================================================================================
+ ~Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula       instructions    -15.1%
+ ~Mathlib.AlgebraicGeometry.EllipticCurve.Jacobian.Formula     instructions    -14.2%
+ ~Mathlib.AlgebraicGeometry.EllipticCurve.Projective.Formula   instructions     -6.1%
- ~Mathlib.Tactic.FieldSimp                                     instructions   1211.8%

@github-actions

Copy link
Copy Markdown
File Instructions %
build -14.516⬝10⁹ (+0.00%)
lint -2.325⬝10⁹ (-0.03%)
Mathlib.Tactic.FieldSimp +74.694⬝10⁹ (+1211.82%)
2 files, Instructions +3.0⬝10⁹
File Instructions %
Mathlib.Analysis.NormedSpace.HomeomorphBall +3.807⬝10⁹ (+25.73%)
Mathlib.Analysis.CStarAlgebra.ApproximateUnit +3.104⬝10⁹ (+1.69%)
3 files, Instructions +2.0⬝10⁹
File Instructions %
Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex +2.938⬝10⁹ (+12.33%)
Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn +2.622⬝10⁹ (+4.92%)
Mathlib.Analysis.Polynomial.CauchyBound +2.72⬝10⁹ (+12.59%)
11 files, Instructions +1.0⬝10⁹
File Instructions %
Mathlib.Geometry.Euclidean.Sphere.Ptolemy +1.904⬝10⁹ (+23.61%)
Mathlib.Analysis.Calculus.Rademacher +1.832⬝10⁹ (+2.84%)
Mathlib.Analysis.Calculus.Taylor +1.758⬝10⁹ (+3.69%)
Mathlib.Analysis.InnerProductSpace.Rayleigh +1.526⬝10⁹ (+4.33%)
Mathlib.Analysis.Analytic.ConvergenceRadius +1.511⬝10⁹ (+1.43%)
Mathlib.NumberTheory.Bernoulli +1.494⬝10⁹ (+2.94%)
Mathlib.Analysis.SpecialFunctions.Complex.Arg +1.374⬝10⁹ (+2.86%)
Mathlib.Analysis.Analytic.IsolatedZeros +1.361⬝10⁹ (+1.90%)
Mathlib.Analysis.SpecialFunctions.Integrals.Basic +1.353⬝10⁹ (+2.20%)
Mathlib.Geometry.Euclidean.Triangle +1.266⬝10⁹ (+3.75%)
Mathlib.NumberTheory.LSeries.AbstractFuncEq +1.4⬝10⁹ (+2.01%)
17 files, Instructions -2.0⬝10⁹
File Instructions %
Mathlib.Algebra.ArithmeticGeometric -1.98⬝10⁹ (-6.64%)
Mathlib.Analysis.PSeries -1.135⬝10⁹ (-2.17%)
Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls -1.205⬝10⁹ (-2.05%)
Mathlib.Probability.Moments.SubGaussian -1.297⬝10⁹ (-2.05%)
Mathlib.Analysis.Convex.SpecificFunctions.Deriv -1.308⬝10⁹ (-7.32%)
Mathlib.Geometry.Euclidean.Circumcenter -1.352⬝10⁹ (-1.92%)
Mathlib.FieldTheory.Differential.Basic -1.394⬝10⁹ (-4.43%)
Mathlib.RingTheory.Valuation.ValuationRing -1.516⬝10⁹ (-4.67%)
Mathlib.Analysis.Normed.Algebra.Exponential -1.520⬝10⁹ (-2.68%)
Mathlib.Combinatorics.Enumerative.Catalan -1.527⬝10⁹ (-7.44%)
Mathlib.NumberTheory.DiophantineApproximation.Basic -1.531⬝10⁹ (-4.15%)
Mathlib.Combinatorics.Derangements.Exponential -1.618⬝10⁹ (-18.98%)
Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform -1.635⬝10⁹ (-2.20%)
Mathlib.NumberTheory.ModularForms.JacobiTheta.TwoVariable -1.715⬝10⁹ (-2.36%)
Mathlib.Algebra.Polynomial.HasseDeriv -1.872⬝10⁹ (-10.28%)
Mathlib.MeasureTheory.Measure.LevyProkhorovMetric -1.891⬝10⁹ (-4.12%)
Mathlib.Analysis.Convex.Between -1.951⬝10⁹ (-2.45%)
3 files, Instructions -3.0⬝10⁹
File Instructions %
Mathlib.Analysis.SpecialFunctions.Trigonometric.Cotangent -2.24⬝10⁹ (-4.67%)
Mathlib.MeasureTheory.Measure.Tilted -2.89⬝10⁹ (-6.52%)
Mathlib.Analysis.Calculus.LogDeriv -2.742⬝10⁹ (-15.50%)
4 files, Instructions -4.0⬝10⁹
File Instructions %
Mathlib.Algebra.QuadraticDiscriminant -3.30⬝10⁹ (-15.42%)
Mathlib.Analysis.Analytic.Basic -3.40⬝10⁹ (-1.50%)
Mathlib.AlgebraicGeometry.EllipticCurve.NormalForms -3.462⬝10⁹ (-7.78%)
Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating -3.851⬝10⁹ (-21.93%)
3 files, Instructions -5.0⬝10⁹
File Instructions %
Mathlib.Probability.Distributions.Gaussian.Real -4.76⬝10⁹ (-7.38%)
Mathlib.Analysis.Convex.Visible -4.253⬝10⁹ (-7.05%)
Mathlib.Analysis.Calculus.Deriv.Inv -4.367⬝10⁹ (-11.13%)
4 files, Instructions -6.0⬝10⁹
File Instructions %
Mathlib.NumberTheory.NumberField.Discriminant.Basic -5.177⬝10⁹ (-4.11%)
Mathlib.Analysis.SpecialFunctions.Gamma.Deligne -5.203⬝10⁹ (-17.47%)
Mathlib.NumberTheory.ZetaValues -5.518⬝10⁹ (-12.88%)
Mathlib.Analysis.InnerProductSpace.Basic -5.934⬝10⁹ (-6.28%)
File Instructions %
Mathlib.Analysis.SpecialFunctions.Stirling -6.169⬝10⁹ (-14.92%)
Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd -8.447⬝10⁹ (-16.99%)
Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula -15.147⬝10⁹ (-15.06%)
Mathlib.AlgebraicGeometry.EllipticCurve.Projective.Formula -16.152⬝10⁹ (-6.09%)
Mathlib.AlgebraicGeometry.EllipticCurve.Jacobian.Formula -19.974⬝10⁹ (-14.23%)
CI run Lakeprof report

@grunweg

grunweg commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

Benchmark results are in:
Euclidean/Circumcenter gets faster, by 2 * 10⁹ instructions
Euclidean/Inversion/Basic gets very very slightly slower (probably noise)
Euclidean/Triangle gets slower, by 1 * 10⁹ instructions (but the proofs get shorter)
Overall, neutral to a bit faster (and usually shorter code). I'd take it!

@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@mathlib4-merge-conflict-bot mathlib4-merge-conflict-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 26, 2025
@hrmacbeth hrmacbeth changed the title chore: re-instate field_simp proofs chore: reinstate field_simp proofs Aug 27, 2025
@grunweg
grunweg force-pushed the fieldsimp-reinstate branch from dc4c135 to d403a90 Compare August 27, 2025 21:30
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 27, 2025
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Aug 28, 2025
@mathlib4-dependent-issues-bot

Copy link
Copy Markdown

@mathlib4-merge-conflict-bot mathlib4-merge-conflict-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 28, 2025
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@grunweg
grunweg force-pushed the fieldsimp-reinstate branch from d403a90 to 238e2ac Compare August 28, 2025 06:22
@github-actions github-actions Bot removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) large-import Automatically added label for PRs with a significant increase in transitive imports labels Aug 28, 2025
@ghost

ghost commented Aug 28, 2025

Copy link
Copy Markdown

!bench

@leanprover-bot

Copy link
Copy Markdown

Here are the benchmark results for commit 238e2ac.
There were no significant changes against commit d60062a.

@github-actions

Copy link
Copy Markdown
File Instructions %
build -3.392⬝10⁹ (+0.00%)
Mathlib.Geometry.Euclidean.Circumcenter -1.769⬝10⁹ (-2.50%)
CI run Lakeprof report

@adomani

adomani commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Thanks for following this up!

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Aug 28, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Aug 28, 2025
All these proofs were originally by `field_simp`, but were squeezed for performance.
After the rewrite in #28658, field_simp is no longer slow in pathological cases. Closes #15486.

Co-authored-by: Michael Rothgang <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title chore: reinstate field_simp proofs [Merged by Bors] - chore: reinstate field_simp proofs Aug 28, 2025
@mathlib-bors mathlib-bors Bot closed this Aug 28, 2025
FormulaRabbit81 pushed a commit to YaelDillies/mathlib4 that referenced this pull request Aug 30, 2025
All these proofs were originally by `field_simp`, but were squeezed for performance.
After the rewrite in leanprover-community#28658, field_simp is no longer slow in pathological cases. Closes leanprover-community#15486.

Co-authored-by: Michael Rothgang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking issue for slow field_simp calls replaced by simp

5 participants