Skip to content

chore(Algebra/*/NonUnital*): split nonassoc and assoc nonunital center instances#41741

Open
pechersky wants to merge 2 commits into
leanprover-community:masterfrom
pechersky:nonunital-subalgebra-center
Open

chore(Algebra/*/NonUnital*): split nonassoc and assoc nonunital center instances#41741
pechersky wants to merge 2 commits into
leanprover-community:masterfrom
pechersky:nonunital-subalgebra-center

Conversation

@pechersky

Copy link
Copy Markdown
Contributor

There is a diamond from how Subsemigroup.center defines mul and implies associativity and commutativity. So over a non-assoc parent type, the instance one gets differs than if you already had associativity. When/if we set up positive nat powers, there will be a diamond.

So at least prepare for that world by having the overriding instances in the "happy path" case.



Open in Gitpod

Discovered while working on #40785.
Used GPT 5.6 Terra to classify hunks from the originating PR and do the cherry-pick operations.

@pechersky pechersky requested a review from j-loreaux July 14, 2026 15:25
@pechersky pechersky added the t-algebra Algebra (groups, rings, fields, etc) label Jul 14, 2026
@github-actions github-actions Bot added the tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip label Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

PR summary 1c1ec8b97e

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ center.instNonUnitalCommRingOfNonUnitalRing
+ instNonUnitalCommSemiringOfNonUnitalSemiring
+ instance (priority := 75) center.instNonUnitalCommRing : NonUnitalCommRing (center R)
+ instance (priority := 75) center.instNonUnitalCommSemiring :
+ instance (priority := 75) center.instNonUnitalCommSemiring : NonUnitalCommSemiring (center R)
+ instance (priority := 75) instNonUnitalCommSemiring : NonUnitalCommSemiring (center R₀ A₀)
++ center.instNonUnitalCommSemiringOfNonUnitalSemiring
- center.instNonUnitalCommRing
- instNonUnitalCommSemiring
-- center.instNonUnitalCommSemiring

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 1c1ec8b).

  • +4 new declarations
  • −0 removed declarations
+NonUnitalStarSubalgebra.instNonUnitalCommSemiringOfNonUnitalSemiring
+NonUnitalSubalgebra.center.instNonUnitalCommSemiringOfNonUnitalSemiring
+NonUnitalSubring.center.instNonUnitalCommRingOfNonUnitalRing
+NonUnitalSubsemiring.center.instNonUnitalCommSemiringOfNonUnitalSemiring

Decrease in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
5616 -1 backward.isDefEq.respectTransparency
No changes to weak technical debt.

Current commit 1c1ec8b97e
Reference commit 1f165a51de

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-ring-theory Ring theory label Jul 14, 2026
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) t-ring-theory Ring theory tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant