perf(Algebra/Ring): faster Ring.toAddGroupWithOne instance#38017
perf(Algebra/Ring): faster Ring.toAddGroupWithOne instance#38017kbuzzard wants to merge 7 commits intoleanprover-community:masterfrom
Conversation
PR summary 9f9c40f019
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Algebra.Ring.Defs | 92 | 93 | +1 (+1.09%) |
| Mathlib.Algebra.Field.Defs | 95 | 96 | +1 (+1.05%) |
Import changes for all files
| Files | Import difference |
|---|---|
46 filesMathlib.Algebra.ContinuedFractions.Basic Mathlib.Algebra.EuclideanDomain.Defs Mathlib.Algebra.EuclideanDomain.Field Mathlib.Algebra.EuclideanDomain.Int Mathlib.Algebra.Field.Defs Mathlib.Algebra.Field.Equiv Mathlib.Algebra.Field.IsField Mathlib.Algebra.Field.MinimalAxioms Mathlib.Algebra.Homology.Embedding.Basic Mathlib.Algebra.Module.Defs Mathlib.Algebra.Module.MinimalAxioms Mathlib.Algebra.Module.Prod Mathlib.Algebra.Order.Hom.Basic Mathlib.Algebra.Order.Module.Synonym Mathlib.Algebra.Order.Ring.Idempotent Mathlib.Algebra.Order.Ring.Synonym Mathlib.Algebra.Order.Ring.Unbundled.Rat Mathlib.Algebra.Ring.Action.Rat Mathlib.Algebra.Ring.Centralizer Mathlib.Algebra.Ring.Defs Mathlib.Algebra.Ring.Divisibility.Basic Mathlib.Algebra.Ring.Ext Mathlib.Algebra.Ring.GrindInstances Mathlib.Algebra.Ring.Hom.InjSurj Mathlib.Algebra.Ring.Idempotent Mathlib.Algebra.Ring.InjSurj Mathlib.Algebra.Ring.Int.Defs Mathlib.Algebra.Ring.Invertible Mathlib.Algebra.Ring.MinimalAxioms Mathlib.Algebra.Ring.Nat Mathlib.Algebra.Ring.PUnit Mathlib.Algebra.Ring.Regular Mathlib.Algebra.Ring.Semiconj Mathlib.Algebra.Ring.WithZero Mathlib.Algebra.Tropical.Basic Mathlib.Data.Int.Cast.Field Mathlib.Data.Int.LeastGreatest Mathlib.Data.Int.NatAbs Mathlib.Data.Nat.Cast.WithTop Mathlib.Data.Nat.WithBot Mathlib.GroupTheory.GroupAction.Ring Mathlib.RingTheory.LocalRing.Defs Mathlib.SetTheory.Lists Mathlib.Tactic.NormNum.Core Mathlib.Tactic.NormNum.Parity Mathlib.Tactic.NormNum.Result |
1 |
Declarations diff
+ AddGroupWithOne.toAddGroup'
+ AddGroupWithOne.toAddMonoidWithOne'
+ AddGroupWithOne.toSubNegMonoid
+ NonUnitalCommRing.toNonUnitalNonAssocCommRing'
+ Ring.toAddCommGroup'
+ Ring.toAddGroupWithOne'
+ instance (priority := 100) Field.toSemifield [Field K] : Semifield K
- instance (priority := 100) Field.toSemifield [Field K] : Semifield K := { ‹Field K› with }
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.
No changes to technical debt.
You can run this locally as
./scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
!radar |
|
Benchmark results for 9a7e8db against 00dbc4e are in. There are significant results. @kbuzzard
No significant changes detected. |
| /-- A `Ring` is a `Semiring` with negation making it an additive group. -/ | ||
| class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R | ||
|
|
||
| attribute [-instance] Ring.toAddGroupWithOne |
There was a problem hiding this comment.
This only disables it for this file / section, it doesn't propagate to downstream files.
| @@ -145,6 +145,13 @@ class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α, | |||
| /-- A `Ring` is a `Semiring` with negation making it an additive group. -/ | |||
| class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R | |||
There was a problem hiding this comment.
You might have better luck with
| class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R | |
| class Ring (R : Type u) extends Semiring R, AddCommGroupWithOne R |
and removing your other changes in this file.
An attempt to manually make
Ring.toAddGroupWithOnea fast instance.#mathlib4 > instance unfolding phenomenon @ 💬