Skip to content

perf(Analysis/Normed/Group): lower instance priorities#37962

Open
JovanGerb wants to merge 9 commits intoleanprover-community:masterfrom
JovanGerb:Jovan-NormedGroup-prio
Open

perf(Analysis/Normed/Group): lower instance priorities#37962
JovanGerb wants to merge 9 commits intoleanprover-community:masterfrom
JovanGerb:Jovan-NormedGroup-prio

Conversation

@JovanGerb
Copy link
Copy Markdown
Contributor

@JovanGerb JovanGerb commented Apr 12, 2026

This is an attempt to improve performance by lowering the priority of some normed instances.

The idea is that when looking for algebraic instances, searching in the Normed hierarchy is likely to be expensive and not useful.


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

PR summary 3d8100bbc6

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Analysis.Complex.Isometry 1981 1982 +1 (+0.05%)
Import changes for all files
Files Import difference
Mathlib.Analysis.Complex.Isometry 1

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/pr_summary/declarations_diff.sh <optional_commit>

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

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


Decrease in tech debt: (relative, absolute) = (2.00, 0.00)
Current number Change Type
6751 -2 backward.isDefEq.respectTransparency

Current commit 3a213a7faf
Reference commit 3d8100bbc6

You can run this locally as

./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 added the t-analysis Analysis (normed *, calculus) label Apr 12, 2026
@JovanGerb JovanGerb added the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 12, 2026
@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 12, 2026

Benchmark results for 588a6c1 against 3d8100b are in. Significant changes detected! @JovanGerb

  • build//instructions: -948.1G (-0.55%)

Large changes (10✅, 1🟥)

  • build/module/Mathlib.Analysis.CStarAlgebra.Matrix//instructions: -22.1G (-15.66%)
  • 🟥 build/module/Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas//instructions: +12.8G (+11.67%)
  • build/module/Mathlib.Analysis.Normed.Lp.lpSpace//instructions: -49.9G (-24.28%)
  • build/module/Mathlib.Analysis.Normed.Module.PiTensorProduct.InjectiveSeminorm//instructions: -19.3G (-18.65%)
  • build/module/Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar//instructions: -9.3G (-37.50%)
  • build/module/Mathlib.FieldTheory.Galois.Profinite//instructions: -9.0G (-12.79%)
  • build/module/Mathlib.Geometry.Manifold.Riemannian.Basic//instructions: -19.2G (-27.19%)
  • build/module/Mathlib.MeasureTheory.Function.SimpleFuncDenseLp//instructions: -16.8G (-18.95%)
  • build/module/Mathlib.MeasureTheory.Integral.IntervalIntegral.TrapezoidalRule//instructions: -17.5G (-28.35%)
  • build/module/Mathlib.NumberTheory.NumberField.Ideal.Basic//instructions: -23.0G (-63.41%)
  • build/module/Mathlib.NumberTheory.NumberField.Units.Regulator//instructions: -12.5G (-25.06%)

Medium changes (66✅, 14🟥)

Too many entries to display here. View the full report on radar instead.

Small changes (163✅, 69🟥)

Too many entries to display here. View the full report on radar instead.

@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 13, 2026
@JovanGerb JovanGerb added the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 13, 2026
@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 13, 2026

Benchmark results for 877ba14 against 3d8100b are in. Significant changes detected! @JovanGerb

  • build//instructions: -876.6G (-0.50%)

Large changes (9✅, 1🟥)

  • 🟥 build/module/Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas//instructions: +13.4G (+12.23%)
  • build/module/Mathlib.Analysis.Normed.Lp.lpSpace//instructions: -49.3G (-24.01%)
  • build/module/Mathlib.Analysis.Normed.Module.PiTensorProduct.InjectiveSeminorm//instructions: -19.3G (-18.70%)
  • build/module/Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar//instructions: -9.4G (-37.69%)
  • build/module/Mathlib.FieldTheory.Galois.Profinite//instructions: -9.4G (-13.36%)
  • build/module/Mathlib.Geometry.Manifold.Riemannian.Basic//instructions: -19.2G (-27.19%)
  • build/module/Mathlib.MeasureTheory.Function.SimpleFuncDenseLp//instructions: -16.7G (-18.84%)
  • build/module/Mathlib.MeasureTheory.Integral.IntervalIntegral.TrapezoidalRule//instructions: -18.0G (-29.13%)
  • build/module/Mathlib.NumberTheory.NumberField.Ideal.Basic//instructions: -23.1G (-63.50%)
  • build/module/Mathlib.NumberTheory.NumberField.Units.Regulator//instructions: -12.5G (-25.07%)

Medium changes (65✅, 15🟥)

Too many entries to display here. View the full report on radar instead.

Small changes (154✅, 77🟥)

Too many entries to display here. View the full report on radar instead.

@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 13, 2026
@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 13, 2026

Benchmark results for 53446cc against 3d8100b are in. Significant changes detected! @JovanGerb

  • build//instructions: -931.8G (-0.54%)

Large changes (10✅, 2🟥)

  • build/module/Mathlib.Analysis.CStarAlgebra.Matrix//instructions: -22.0G (-15.54%)
  • 🟥 build/module/Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas//instructions: +12.8G (+11.72%)
  • build/module/Mathlib.Analysis.Normed.Lp.lpSpace//instructions: -49.9G (-24.29%)
  • build/module/Mathlib.Analysis.Normed.Module.PiTensorProduct.InjectiveSeminorm//instructions: -19.1G (-18.52%)
  • build/module/Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar//instructions: -9.4G (-37.66%)
  • build/module/Mathlib.FieldTheory.Galois.Profinite//instructions: -9.1G (-12.83%)
  • build/module/Mathlib.Geometry.Manifold.Riemannian.Basic//instructions: -19.3G (-27.25%)
  • build/module/Mathlib.MeasureTheory.Function.SimpleFuncDenseLp//instructions: -16.8G (-18.93%)
  • build/module/Mathlib.MeasureTheory.Integral.IntervalIntegral.TrapezoidalRule//instructions: -17.4G (-28.26%)
  • build/module/Mathlib.NumberTheory.NumberField.Ideal.Basic//instructions: -23.0G (-63.45%)
  • build/module/Mathlib.NumberTheory.NumberField.Units.Regulator//instructions: -12.5G (-25.14%)
  • 🟥 build/module/Mathlib.Probability.ConditionalExpectation//instructions: +17.0G (+137.48%)

Medium changes (66✅, 15🟥)

Too many entries to display here. View the full report on radar instead.

Small changes (161✅, 67🟥)

Too many entries to display here. View the full report on radar instead.

@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 13, 2026

Benchmark results for 268a6a5 against 3d8100b are in. Significant changes detected! @JovanGerb

  • build//instructions: -940.6G (-0.54%)

Large changes (10✅, 1🟥)

  • build/module/Mathlib.Analysis.CStarAlgebra.Matrix//instructions: -22.0G (-15.56%)
  • 🟥 build/module/Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas//instructions: +12.9G (+11.75%)
  • build/module/Mathlib.Analysis.Normed.Lp.lpSpace//instructions: -50.0G (-24.32%)
  • build/module/Mathlib.Analysis.Normed.Module.PiTensorProduct.InjectiveSeminorm//instructions: -19.3G (-18.66%)
  • build/module/Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar//instructions: -9.3G (-37.27%)
  • build/module/Mathlib.FieldTheory.Galois.Profinite//instructions: -9.1G (-12.89%)
  • build/module/Mathlib.Geometry.Manifold.Riemannian.Basic//instructions: -19.2G (-27.18%)
  • build/module/Mathlib.MeasureTheory.Function.SimpleFuncDenseLp//instructions: -16.8G (-18.98%)
  • build/module/Mathlib.MeasureTheory.Integral.IntervalIntegral.TrapezoidalRule//instructions: -17.5G (-28.30%)
  • build/module/Mathlib.NumberTheory.NumberField.Ideal.Basic//instructions: -23.0G (-63.41%)
  • build/module/Mathlib.NumberTheory.NumberField.Units.Regulator//instructions: -12.4G (-24.91%)

Medium changes (66✅, 15🟥)

Too many entries to display here. View the full report on radar instead.

Small changes (165✅, 67🟥)

Too many entries to display here. View the full report on radar instead.

Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Thanks a lot for doing this; this looks great! I have a few clarification questions (and would maintainer merge otherwise/already merge some parts of it).



noncomputable section
suppress_compilation -- needed to avoid a panic!
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.

Can you minimize this? This seems worth reporting!

end basic

variable [Fintype m] [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A]
variable [Fintype m] [NonUnitalCStarAlgebra A]
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.

Is there a reason for this change? (I like it regardless; if it compiles on its own, I'm happy to splice-bot it.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, a linter suddenly told me that these hypotheses were unused.

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.

splits-bot

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.

Um, once more:
splice-bot

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.

Split PR created

Split off the changes to Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean in #37996.

variable [Fintype ι]

lemma toLp_pi (p : ℝ≥0∞) [Fact (1 ≤ p)] (hX : HasGaussianLaw (fun ω ↦ (X · ω)) P) :
lemma toLp_pi [Finite ι] (p : ℝ≥0∞) [Fact (1 ≤ p)] (hX : HasGaussianLaw (fun ω ↦ (X · ω)) P) :
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.

Thanks for the fix. I gather this is linter with the lower priority, but not now --- do you know why/ is there a deeper problem we should fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Similarly to the other change, the linter now recognized that some type class assumption was unused. This is because the synthesis order changed, so a different instance was found. This does not necessarily mean that something is wrong, though it is a bit counter intuitive.

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.

Makes sense, thanks!

@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 13, 2026
Co-authored-by: Michael Rothgang <rothgang@math.uni-bonn.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants