Skip to content

refactor: make several definitions take concrete morphism classes - #43596

Open
grunweg wants to merge 4 commits into
leanprover-community:masterfrom
grunweg:concrete-classes3
Open

refactor: make several definitions take concrete morphism classes#43596
grunweg wants to merge 4 commits into
leanprover-community:masterfrom
grunweg:concrete-classes3

Conversation

@grunweg

@grunweg grunweg commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Specifically, this PR changes NonUnitalSubring.{map,comap,equivMapOfInjective} as well as NonUnitalSubsemiring.{map,comap,srangeRestrict,sofLeftInverse'},
and adapts all theorems about them to take in a concrete morphism also.

Since this removes all uses of a bundled morphism class, we also remove the assocated variable lines
and align them with standard mathlib style.

This follows the general patterns established in #31365:

we should restrict definitions to explicit morphisms, instead of morphism classes in order to avoid proliferating definitions.
Given a definition Bar that takes FooHom as an argument, a theorem whose statement involves Bar should only ever be written for FooHoms and never FooHomClasses. Indeed in the latter case, the statement would require the coercion from the morphism class to the morphism, thereby making it less general.


Found by the linter in #43405.

Open in Gitpod

@grunweg grunweg added the WIP Work in progress label Sep 8, 2026
@github-actions github-actions Bot added the t-ring-theory Ring theory label Sep 8, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR summary d1b1b6fdd8

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

++-- map_center_eq
+--+ comap_center_le_center
+--+ map_center_le_center
-+-+ coe_comap
-+-+ comap
-+-+ comap_inf
-+-+ map
-+-+ map_inf
-+-+ map_sup
-+-+ mem_comap
--++ coe_equivMapOfInjective_apply
--++ coe_map
--++ comap_iInf
--++ equivMapOfInjective
--++ gc_map_comap
--++ map_iInf
--++ map_iSup
--++ map_le_iff_le_comap
--++ mem_map

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 b0ea9ac).

  • +0 new declarations
  • −8 removed declarations
-NonUnitalAlgHom.equalizer.congr_simp
-NonUnitalAlgHom.range.congr_simp
-NonUnitalRingHom.srange.congr_simp
-NonUnitalSubalgebra.map.congr_simp
-NonUnitalSubring.comap.congr_simp
-NonUnitalSubring.map.congr_simp
-NonUnitalSubsemiring.comap.congr_simp
-NonUnitalSubsemiring.map.congr_simp

No changes to strong technical debt.
No changes to weak technical debt.

Current commit d1b1b6fdd8
Reference commit d83c546b24

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.py 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).

@grunweg grunweg removed the WIP Work in progress label Sep 9, 2026
@grunweg grunweg changed the title chore: continue #43579 refactor: make several definitions take concrete morphism classes Sep 9, 2026
@grunweg
grunweg marked this pull request as ready for review September 9, 2026 08:50
@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Sep 9, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

@github-actions github-actions Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-ring-theory Ring theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant