Skip to content

feat(Algebra.GroupWithZero): generalize SMulZeroClass to MonoidWithZero and lift MulDistribMulAction to nonZeroDivisors#40604

Open
xroblot wants to merge 8 commits into
leanprover-community:masterfrom
xroblot:feat/MulDistribMulAction-smul-zero
Open

feat(Algebra.GroupWithZero): generalize SMulZeroClass to MonoidWithZero and lift MulDistribMulAction to nonZeroDivisors#40604
xroblot wants to merge 8 commits into
leanprover-community:masterfrom
xroblot:feat/MulDistribMulAction-smul-zero

Conversation

@xroblot

@xroblot xroblot commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Generalize the instance SMulZeroClass α β under [Group α] [GroupWithZero β] [MulDistribMulAction α β]to [Group α] [MonoidWithZero β] [MulDistribMulAction α β].

From an action [Group G] [MonoidWithZero M] [MulDistribMulAction G M], use this instance to construct an action on the nonzero divisors of 'M'.

No diamond: there is no general instance giving an action on a submonoid as a target (that would need the submonoid to be invariant, which isn't automatic), so defining the action on nonZeroDivisors should not clash with anything .

🤖 This PR was extracted from the SKW project by Claude.

…tance from GroupWithZero to MonoidWithZero

The existing instance `SMulZeroClass α β` under `[Group α] [GroupWithZero β] [MulDistribMulAction α β]`
is generalized: `GroupWithZero β` is weakened to `MonoidWithZero β`. The proof that `g • 0 = 0`
uses only `smul_mul'`, `smul_inv_smul` (group invertibility of `α`), `zero_mul`, and `mul_zero`,
so it does not require the invertibility of nonzero elements of `β`.
@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

PR summary 61072572b3

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ MulDistribMulAction.instSMulZeroClass
+ instMulActionNonZeroDivisors
+ instMulDistribMulActionNonZeroDivisors
+ instSMulNonZeroDivisors
+ nonZeroDivisors.val_smul
+ smul_mem_nonZeroDivisors
+ smul_mem_nonZeroDivisorsLeft
+ smul_mem_nonZeroDivisorsRight
- instance : SMulZeroClass α β

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 6107257).

  • +8 new declarations
  • −1 removed declarations
+MulDistribMulAction.instSMulZeroClass
+instMulActionNonZeroDivisors
+instMulDistribMulActionNonZeroDivisors
+instSMulNonZeroDivisors
-instSMulZeroClass
+nonZeroDivisors.val_smul
+smul_mem_nonZeroDivisors
+smul_mem_nonZeroDivisorsLeft
+smul_mem_nonZeroDivisorsRight

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 61072572b3
Reference commit e780b56e92

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/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-algebra Algebra (groups, rings, fields, etc) label Jun 14, 2026
@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@xroblot xroblot added the WIP Work in progress label Jun 14, 2026
…ds zero to zero; lift to nonZeroDivisors

- Generalize the `SMulZeroClass α β` instance in `GroupWithZero.Action.Defs` from
  `[GroupWithZero β]` to `[MonoidWithZero β]`: the proof uses only `smul_mul'`,
  `smul_inv_smul`, and `mul_zero`, with no need for invertibility in `β`.
- Add `smul_mem_nonZeroDivisorsLeft/Right`, `smul_mem_nonZeroDivisors`, and instances
  `SMul G M₀⁰`, `MulAction G M₀⁰`, `MulDistribMulAction G M₀⁰` in `NonZeroDivisors`.
@xroblot xroblot changed the title feat(Algebra.GroupWithZero.Action.Defs): generalize SMulZeroClass instance to MonoidWithZero feat(Algebra.GroupWithZero): generalize SMulZeroClass to MonoidWithZero and lift MulDistribMulAction to nonZeroDivisors Jun 14, 2026
xroblot added 3 commits June 18, 2026 17:33
The generalized `MulDistribMulAction.instSMulZeroClass` now provides `smul_zero`
for `(ConjAct Rˣ) R`, so `units_smul_def` is no longer needed there.
@xroblot xroblot added WIP Work in progress and removed WIP Work in progress labels Jun 19, 2026
@xroblot xroblot removed the WIP Work in progress label Jun 21, 2026
@themathqueen

Copy link
Copy Markdown
Collaborator

!radar

@leanprover-radar

leanprover-radar commented Jul 23, 2026

Copy link
Copy Markdown

Benchmark results for 6107257 against e780b56 are in. No significant results found. @themathqueen

  • build//instructions: -22.9G (-0.02%)

Medium changes (1🟥)

  • 🟥 build/module/Mathlib.RingTheory.Invariant.Profinite//instructions: +5.1G (+4.94%)

Small changes (1🟥)

  • 🟥 build/module/Mathlib.Algebra.GroupWithZero.NonZeroDivisors//instructions: +1.5G (+9.10%)

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

Labels

t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants