Skip to content

benchmark respectTransparency#236

Draft
datokrat wants to merge 141 commits into
nightly-testingfrom
paul/lean-pr-testing-13895-bench
Draft

benchmark respectTransparency#236
datokrat wants to merge 141 commits into
nightly-testingfrom
paul/lean-pr-testing-13895-bench

Conversation

@datokrat

@datokrat datokrat commented Jun 5, 2026

Copy link
Copy Markdown

No description provided.

leanprover-community-mathlib4-bot and others added 30 commits May 6, 2026 03:58
Lean PR leanprover/lean4#13637 splits
`@[implicit_reducible]` into `@[instance_reducible]` (TC tier) and
`@[implicit_reducible]` (implicit-arg defeq tier). `instance` auto-stamps
`.instanceReducible`, but `to_additive` calls `addInstance` directly for
the additive copy, so the auto-stamp doesn't fire on the target.

Extend `copyInstanceAttribute` to copy `.instanceReducible` in addition to
the pre-existing `.implicitReducible`. Fixes the cascade in
`Mathlib/Algebra/CharZero/Defs.lean`, `Ring/Defs.lean`, `AddTorsor/Defs.lean`,
`Homology/HasNoLoop.lean`, `Matrix/DMatrix.lean`, `Group/Basic.lean`,
`Group/WithOne/Defs.lean`, and `Order/Lattice.lean`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lean PR leanprover/lean4#13637 splits the unified
`@[implicit_reducible]` into two tiers:

* `@[instance_reducible]` — unfolds during type class search (the new
  `.instances` tier), used for declarations that participate in instance
  forwarding chains.
* `@[implicit_reducible]` — unfolds only during implicit value-argument
  defeq (the new `.implicit` tier), used for narrower cases like functor
  laws.

Most Mathlib uses of `@[implicit_reducible]` were on "reducible
non-instance" helpers (`Function.Injective.distribLattice`,
`SemilatticeSup.mk'`, `Lattice.mk'`, all of `Order/Copy.lean`,
`Denumerable.mk'`, `Set.monoid`, `CreatesLimitOf*`, etc.) that build
typeclass instances. Under the new semantics these must be tagged
`@[instance_reducible]` for type class search to unfold them.

This commit replaces all 818 `@[implicit_reducible]` annotations
(including the 110 inline `(attr := implicit_reducible ...)` forms
inside `@[to_additive]` / `@[to_dual]`) with `@[instance_reducible]`
across the library.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…Archive and tests

Complements the main migration in Mathlib/ by covering the remaining
sites in Archive/ and MathlibTest/.

* Archive/Imo/Imo2019Q2.lean
* Archive/MinimalSheffer.lean
* MathlibTest/DefEqAbuse.lean
* MathlibTest/InferInstanceAsPercent.lean (also updates the docstring
  expectations to reflect the new attribute name that `instance` now
  auto-stamps)
* MathlibTest/fast_instance.lean (same docstring update)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…le]` tier split

Adapted from Sébastien Gouëzel's MWE on Zulip [1]. Pins three claims about
the tier split introduced in lean#13637:

1. Without any extra attribute, TC search distinguishes the two
   `SGMonoidal` instances at `F ⋙ (G ⋙ H)` and `(F ⋙ G) ⋙ H`, so an
   `rfl` between their `n` fields rightfully fails.
2. Tagging `Functor.comp` `[implicit_reducible]` (the narrower
   value-defeq-only tier) does NOT corrupt the above — the
   `[implicit_reducible]` corruption Sébastien warned about is gone.
3. Tagging `Functor.comp` `[instance_reducible]` (the TC tier)
   deliberately reproduces the pre-split corruption: `rfl` succeeds even
   though the two instances are mathematically distinct. This pins the
   upper-bound semantics — if a future change accidentally narrowed
   `[instance_reducible]`, this case would notice.

[1]: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency/near/592439262

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@datokrat

datokrat commented Jun 5, 2026

Copy link
Copy Markdown
Author

!bench

@leanprover-radar

leanprover-radar commented Jun 5, 2026

Copy link
Copy Markdown

Benchmark results for ae4dd50 against 8a9ccb2 are in. There are significant results. @datokrat

  • 🟥 build//instructions: +635.0G (+0.39%)

Large changes (3✅, 2🟥)

  • build/module/Batteries.Data.BinaryHeap.Basic//instructions: -7.4G (-88.70%)
  • build/module/Mathlib.Algebra.Category.ModuleCat.Ext.Basic//instructions: -6.7G (-23.21%)
  • 🟥 build/module/Mathlib.CategoryTheory.Products.Associator//instructions: +8.0G (+32.15%)
  • build/module/Mathlib.Geometry.Manifold.WhitneyEmbedding//instructions: -14.8G (-40.81%)
  • 🟥 build/module/Mathlib.NumberTheory.NumberField.InfiniteAdeleRing//instructions: +5.4G (+30.85%)

Medium changes (12✅, 8🟥)

  • 🟥 build/module/Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences//instructions: +8.0G (+18.14%)
  • build/module/Mathlib.Algebra.Homology.DerivedCategory.Ext.MapBijective//instructions: -3.6G (-13.39%)
  • build/module/Mathlib.Algebra.Module.Torsion.PrimaryComponent//instructions: -6.2G (-8.23%)
  • build/module/Mathlib.AlgebraicGeometry.AffineTransitionLimit//instructions: -11.1G (-5.00%)
  • build/module/Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point//instructions: -4.2G (-5.15%)
  • 🟥 build/module/Mathlib.Analysis.CStarAlgebra.Extreme//instructions: +1.4G (+3.62%)
  • build/module/Mathlib.Analysis.Distribution.SchwartzSpace.Fourier//instructions: -4.0G (-5.34%)
  • build/module/Mathlib.Analysis.InnerProductSpace.l2Space//instructions: -4.2G (-7.52%)
  • 🟥 build/module/Mathlib.Analysis.Meromorphic.Order//instructions: +2.4G (+4.15%)
  • build/module/Mathlib.Analysis.Normed.Lp.lpSpace//instructions: -15.7G (-11.23%)
  • build/module/Mathlib.CategoryTheory.Comma.StructuredArrow.Functor//instructions: -4.4G (-13.63%)
  • build/module/Mathlib.CategoryTheory.Sites.SheafCohomology.Basic//instructions: -8.2G (-13.61%)
  • 🟥 build/module/Mathlib.FieldTheory.IntermediateField.Adjoin.Defs//instructions: +6.2G (+9.73%)
  • 🟥 build/module/Mathlib.FieldTheory.IntermediateField.Algebraic//instructions: +3.2G (+9.22%)
  • 🟥 build/module/Mathlib.FieldTheory.SeparableClosure//instructions: +5.2G (+5.96%)
  • 🟥 build/module/Mathlib.Geometry.Euclidean.Angle.Bisector//instructions: +2.9G (+3.34%)
  • 🟥 build/module/Mathlib.LinearAlgebra.RootSystem.GeckConstruction.Relations//instructions: +3.3G (+4.31%)
  • build/module/Mathlib.NumberTheory.NumberField.CMField//instructions: -4.5G (-6.34%)
  • build/module/Mathlib.RepresentationTheory.Coinvariants//instructions: -4.9G (-6.89%)
  • build/module/Mathlib.RingTheory.Regular.ProjectiveDimension//instructions: -2.8G (-6.20%)

Small changes (41✅, 209🟥)

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

@datokrat

datokrat commented Jun 5, 2026

Copy link
Copy Markdown
Author

!bench

@leanprover-radar

leanprover-radar commented Jun 5, 2026

Copy link
Copy Markdown

Benchmark results for bc185d9 against 8a9ccb2 are in. There are significant results. @datokrat

  • 🟥 main exited with code 1

No significant changes detected.

@datokrat

datokrat commented Jun 5, 2026

Copy link
Copy Markdown
Author

!bench

@leanprover-radar

Copy link
Copy Markdown

Benchmark results for bc185d9 against 8a9ccb2 are in. (These commits have already been benchmarked in a previous command.) There are significant results. @datokrat

  • 🟥 main exited with code 1

No significant changes detected.

@datokrat

datokrat commented Jun 5, 2026

Copy link
Copy Markdown
Author

!bench

@leanprover-radar

leanprover-radar commented Jun 5, 2026

Copy link
Copy Markdown

Benchmark results for 737aa15 against 8a9ccb2 are in. There are significant results. @datokrat

  • 🟥 build//instructions: +638.7G (+0.39%)

Large changes (3✅)

  • build/module/Batteries.Data.BinaryHeap.Basic//instructions: -7.4G (-88.57%)
  • build/module/Mathlib.Algebra.Category.ModuleCat.Ext.Basic//instructions: -6.6G (-22.64%)
  • build/module/Mathlib.Geometry.Manifold.WhitneyEmbedding//instructions: -14.8G (-40.88%)

Medium changes (11✅, 5🟥)

  • build/module/Mathlib.Algebra.Homology.DerivedCategory.Ext.MapBijective//instructions: -3.8G (-14.04%)
  • build/module/Mathlib.Algebra.Module.Torsion.PrimaryComponent//instructions: -6.6G (-8.72%)
  • build/module/Mathlib.AlgebraicGeometry.AffineTransitionLimit//instructions: -11.1G (-5.01%)
  • 🟥 build/module/Mathlib.Analysis.CStarAlgebra.Extreme//instructions: +1.5G (+3.97%)
  • build/module/Mathlib.Analysis.Distribution.SchwartzSpace.Fourier//instructions: -4.0G (-5.30%)
  • build/module/Mathlib.Analysis.InnerProductSpace.l2Space//instructions: -4.0G (-7.19%)
  • 🟥 build/module/Mathlib.Analysis.Meromorphic.Order//instructions: +2.5G (+4.23%)
  • build/module/Mathlib.Analysis.Normed.Lp.lpSpace//instructions: -15.8G (-11.32%)
  • build/module/Mathlib.CategoryTheory.Comma.StructuredArrow.Functor//instructions: -4.4G (-13.61%)
  • build/module/Mathlib.CategoryTheory.Sites.SheafCohomology.Basic//instructions: -8.3G (-13.75%)
  • 🟥 build/module/Mathlib.FieldTheory.IntermediateField.Adjoin.Defs//instructions: +6.3G (+9.90%)
  • 🟥 build/module/Mathlib.FieldTheory.IntermediateField.Algebraic//instructions: +3.2G (+9.13%)
  • 🟥 build/module/Mathlib.FieldTheory.SeparableClosure//instructions: +5.2G (+5.96%)
  • build/module/Mathlib.NumberTheory.NumberField.CMField//instructions: -4.5G (-6.23%)
  • build/module/Mathlib.RepresentationTheory.Coinvariants//instructions: -5.0G (-6.89%)
  • build/module/Mathlib.RingTheory.Regular.ProjectiveDimension//instructions: -2.8G (-6.30%)

Small changes (40✅, 159🟥)

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants