chore(Algebra): use IsMulCommutative to spell Std.Commutative (· * ·)#37448
chore(Algebra): use IsMulCommutative to spell Std.Commutative (· * ·)#37448SnirBroshi wants to merge 15 commits intoleanprover-community:masterfrom
IsMulCommutative to spell Std.Commutative (· * ·)#37448Conversation
PR summary d4d96de5f1Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| class IsAddCommutative (M : Type*) [Add M] : Prop where | ||
| is_comm : Std.Commutative (α := M) (· + ·) |
There was a problem hiding this comment.
The design here seems odd. Why nest typeclasses instead of doing something like this?
| class IsAddCommutative (M : Type*) [Add M] : Prop where | |
| is_comm : Std.Commutative (α := M) (· + ·) | |
| abbrev IsAddCommutative (M : Type*) [Add M] : Prop := | |
| Std.Commutative (α := M) (· + ·) |
There was a problem hiding this comment.
Hmm https://github.com/leanprover-community/mathlib4/pull/23773/files#r2280929588
FWIW this was the reason this class was introduced.
There was a problem hiding this comment.
Oh actually, won't this cause the same performance issues as ContravariantClass has, since TC-search will search through all Std.Commutative instances regardless of the operation?
There was a problem hiding this comment.
Yes, I believe the point is exactly that we want to avoid the performance impact of the same class being parameterized over the function.
…ff_isLieAbelian`
|
!bench |
|
Benchmark results for 6d77e2a against d4d96de are in. There are no significant changes. @SnirBroshi
Medium changes (1🟥)
Small changes (5🟥)
|
Mathlib/Algebra/Group/Hom/Defs.lean
Outdated
| obtain ⟨b', hb'⟩ := is_surj b | ||
| simp only [← ha', ← hb', ← map_mul] | ||
| rw [is_comm.comm] | ||
| rw [is_comm.is_comm.comm] |
There was a problem hiding this comment.
Can you not use mul_comm' here (and everywhere else)?
There was a problem hiding this comment.
Done except for SpecificGroups/Dihedral.lean where it can't easily infer the type,
and h'.is_comm.comm (r 1) (sr 0) seems better than mul_comm' (r (n := n + 3) 1) (sr 0)
|
Just testing the !bench |
|
Benchmark results for 0c2121f against d4d96de are in. There are no significant changes. @SnirBroshi
Medium changes (2🟥)
Small changes (1✅, 6🟥)
|
|
Hmm switching to |
and use
IsAddCommutativeto spellStd.Commutative (· + ·).Also makes
Is{Mul/Add}Commutative.is_comminstances so that core lemmas (orgrind) can synthesizeStd.Commutative.Hopefully this is useful since #36549 was merged.