Skip to content

[Merged by Bors] - chore(Algebra): use IsMulCommutative to spell Std.Commutative (· * ·)#37448

Closed
SnirBroshi wants to merge 18 commits intoleanprover-community:masterfrom
SnirBroshi:chore/algebra/std-commutative-to-is-mul-commutative
Closed

[Merged by Bors] - chore(Algebra): use IsMulCommutative to spell Std.Commutative (· * ·)#37448
SnirBroshi wants to merge 18 commits intoleanprover-community:masterfrom
SnirBroshi:chore/algebra/std-commutative-to-is-mul-commutative

Conversation

@SnirBroshi
Copy link
Copy Markdown
Collaborator

and use IsAddCommutative to spell Std.Commutative (· + ·).

Also makes Is{Mul/Add}Commutative.is_comm instances so that core lemmas (or grind) can synthesize Std.Commutative.


Hopefully this is useful since #36549 was merged.

Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

PR summary 5d32f3eac7

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ IsAddCyclic.commutative
+ IsCyclic.isMulCommutative
+ instance (priority := low) (M) [MulOne M] [IsMulCommutative M] :
+ isMulCommutative_iff_isLieAbelian
- instance (priority := low) (M) [MulOne M] [Std.Commutative (α := M) (· * ·)] :
- instance [Group G] (H : Subgroup G) [IsCyclic H] : IsMulCommutative H

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 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-group-theory Group theory label Mar 31, 2026
@SnirBroshi
Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 1, 2026

Benchmark results for 6d77e2a against d4d96de are in. There are no significant changes. @SnirBroshi

  • 🟥 build//instructions: +36.5G (+0.02%)

Medium changes (1🟥)

  • 🟥 build/module/Mathlib.GroupTheory.SchurZassenhaus//instructions: +3.9G (+24.41%)

Small changes (5🟥)

  • 🟥 build/module/Mathlib.Data.ZMod.QuotientGroup//instructions: +1.0G (+5.81%)
  • 🟥 build/module/Mathlib.GroupTheory.Focal//instructions: +2.5G (+15.07%)
  • 🟥 build/module/Mathlib.GroupTheory.Schreier//instructions: +917.7M (+6.14%)
  • 🟥 build/module/Mathlib.RepresentationTheory.AlgebraRepresentation.Basic//instructions: +915.0M (+10.59%)
  • 🟥 build/module/Mathlib.Topology.Algebra.StarSubalgebra//instructions: +3.0G (+13.32%)

obtain ⟨b', hb'⟩ := is_surj b
simp only [← ha', ← hb', ← map_mul]
rw [is_comm.comm]
rw [is_comm.is_comm.comm]
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 not use mul_comm' here (and everywhere else)?

Copy link
Copy Markdown
Collaborator Author

@SnirBroshi SnirBroshi Apr 1, 2026

Choose a reason for hiding this comment

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

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)

@j-loreaux j-loreaux added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 1, 2026
@SnirBroshi
Copy link
Copy Markdown
Collaborator Author

Just testing the abbrev version, I'm interested in seeing the performance

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 1, 2026

Benchmark results for 0c2121f against d4d96de are in. There are no significant changes. @SnirBroshi

  • 🟥 build//instructions: +39.3G (+0.02%)

Medium changes (2🟥)

  • 🟥 build/module/Mathlib.GroupTheory.SchurZassenhaus//instructions: +5.3G (+32.73%)
  • 🟥 build/module/Mathlib.RepresentationTheory.AlgebraRepresentation.Basic//instructions: +2.2G (+25.15%)

Small changes (1✅, 6🟥)

  • 🟥 build/module/Mathlib.Algebra.Star.Subalgebra//instructions: +2.6G (+4.09%)
  • build/module/Mathlib.CategoryTheory.Limits.Types.Coequalizers//instructions: -373.4M (-5.81%)
  • 🟥 build/module/Mathlib.Data.ZMod.QuotientGroup//instructions: +1.7G (+9.71%)
  • 🟥 build/module/Mathlib.GroupTheory.Focal//instructions: +3.1G (+18.84%)
  • 🟥 build/module/Mathlib.GroupTheory.Schreier//instructions: +1.1G (+7.35%)
  • 🟥 build/module/Mathlib.Lean.Meta.Basic//instructions: +143.6M (+3.70%)
  • 🟥 build/module/Mathlib.Topology.Algebra.StarSubalgebra//instructions: +4.8G (+21.58%)

@SnirBroshi
Copy link
Copy Markdown
Collaborator Author

Hmm switching to abbrev seems to have basically the same performance, maybe we don't have enough Std.Commutative instances to see the issue?
In any case I reverted back to a one-field class.

@SnirBroshi SnirBroshi removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 1, 2026
@SnirBroshi SnirBroshi requested a review from j-loreaux April 1, 2026 11:29
@tb65536
Copy link
Copy Markdown
Contributor

tb65536 commented Apr 6, 2026

!radar

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 6, 2026

Benchmark results for 7292add against d4d96de are in. There are no significant changes. @tb65536

  • 🟥 build//instructions: +42.3G (+0.02%)

Medium changes (2🟥)

  • 🟥 build/module/Mathlib.GroupTheory.Focal//instructions: +2.2G (+13.08%)
  • 🟥 build/module/Mathlib.GroupTheory.SchurZassenhaus//instructions: +3.8G (+23.93%)

Small changes (4🟥)

  • 🟥 build/module/Mathlib.Data.ZMod.QuotientGroup//instructions: +1.0G (+5.80%)
  • 🟥 build/module/Mathlib.GroupTheory.Schreier//instructions: +815.8M (+5.46%)
  • 🟥 build/module/Mathlib.RepresentationTheory.AlgebraRepresentation.Basic//instructions: +857.1M (+9.92%)
  • 🟥 build/module/Mathlib.Topology.Algebra.StarSubalgebra//instructions: +2.5G (+11.35%)

@leanprover-radar
Copy link
Copy Markdown

Benchmark results for c687a3d against de14307 are in. Significant changes detected! @tb65536

  • 🟥 main exited with code 1

No significant changes detected.

@SnirBroshi
Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar
Copy link
Copy Markdown

Benchmark results for c687a3d against de14307 are in. Significant changes detected! @SnirBroshi

  • 🟥 main exited with code 1

No significant changes detected.

@SnirBroshi
Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 7, 2026

Benchmark results for 98005e1 against 5d32f3e are in. There are no significant changes. @SnirBroshi

  • 🟥 build//instructions: +17.2G (+0.01%)

Medium changes (2🟥)

  • 🟥 build/module/Mathlib.GroupTheory.Focal//instructions: +2.1G (+12.93%)
  • 🟥 build/module/Mathlib.GroupTheory.SchurZassenhaus//instructions: +3.6G (+22.63%)

Small changes (1✅, 4🟥)

  • 🟥 build/module/Mathlib.Algebra.Module.Torsion.Free//instructions: +669.6M (+6.07%)
  • 🟥 build/module/Mathlib.Analysis.InnerProductSpace.Harmonic.Basic//instructions: +437.0M (+3.26%)
  • 🟥 build/module/Mathlib.GroupTheory.Schreier//instructions: +665.7M (+4.57%)
  • 🟥 build/module/Mathlib.RepresentationTheory.AlgebraRepresentation.Basic//instructions: +809.1M (+9.52%)
  • build/module/Mathlib.Tactic.Linarith//instructions: -264.9M (-5.85%)

@SnirBroshi SnirBroshi requested review from tb65536 and removed request for tb65536 April 7, 2026 23:46
Copy link
Copy Markdown
Contributor

@tb65536 tb65536 left a comment

Choose a reason for hiding this comment

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

Thanks!

maintainer merge

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

🚀 Pull request has been placed on the maintainer queue by tb65536.

@mathlib-triage mathlib-triage bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Apr 8, 2026
@SnirBroshi
Copy link
Copy Markdown
Collaborator Author

Oh sorry, I thought we never add deprecations to instances, even explicitly named ones. Added!

@SnirBroshi SnirBroshi requested a review from adomani April 9, 2026 02:26
Copy link
Copy Markdown
Contributor

@adomani adomani left a comment

Choose a reason for hiding this comment

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

Thanks!

Regarding the deprecations, I am probably being overcareful, but when you are proving that a group is commutative, you are more likely to call on an instance explicitly inside a proof. In such situations, the deprecations are helpful.

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Apr 9, 2026
… ·)` (#37448)

and use `IsAddCommutative` to spell `Std.Commutative (· + ·)`.

Also makes `Is{Mul/Add}Commutative.is_comm` instances so that core lemmas (or `grind`) can synthesize `Std.Commutative`.
@mathlib-triage mathlib-triage bot added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Apr 9, 2026
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 9, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(Algebra): use IsMulCommutative to spell Std.Commutative (· * ·) [Merged by Bors] - chore(Algebra): use IsMulCommutative to spell Std.Commutative (· * ·) Apr 9, 2026
@mathlib-bors mathlib-bors bot closed this Apr 9, 2026
SnirBroshi added a commit to SnirBroshi/mathlib4 that referenced this pull request Apr 9, 2026
Comment on lines +696 to +698
@[deprecated inferInstance (since := "2026-04-09")]
instance IsQuadraticExtension.isMulCommutative_galoisGroup : IsMulCommutative Gal(K/F) :=
inferInstance
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oops, sorry, #37822

mathlib-bors bot pushed a commit that referenced this pull request Apr 9, 2026
xroblot pushed a commit to xroblot/mathlib4 that referenced this pull request Apr 10, 2026
… ·)` (leanprover-community#37448)

and use `IsAddCommutative` to spell `Std.Commutative (· + ·)`.

Also makes `Is{Mul/Add}Commutative.is_comm` instances so that core lemmas (or `grind`) can synthesize `Std.Commutative`.
xroblot pushed a commit to xroblot/mathlib4 that referenced this pull request Apr 10, 2026
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. t-group-theory Group theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants