Skip to content

[Merged by Bors] - feat(LinearMap, RingHom, FirstOrder.Language.Hom): simp lemma for composing domRestrict and codRestrict - #38693

Closed
wwylele wants to merge 5 commits into
leanprover-community:masterfrom
wwylele:domRestrict-comp-rangeRestrict
Closed

wwylele wants to merge 5 commits into
leanprover-community:masterfrom
wwylele:domRestrict-comp-rangeRestrict

Conversation

@wwylele

@wwylele wwylele commented Apr 29, 2026 •

Copy link
Copy Markdown
Collaborator

I am aware that this lemma is true for all function-like classes that has domRestrict and codRestrict. I didn't add the same for all of them, and only added the one I needed in #37295. Should we manually add this for all function classes? Or there should be some metaprogramming to generate them?

Open in Gitpod

@github-actions

github-actions Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

PR summary 6299e88801

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ domRestrict_comp_rangeRestrict
+ domRestrict_comp_rangeSRestrict
+++ domRestrict_comp_codRestrict

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.


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

@github-actions github-actions Bot added the t-algebra Algebra (groups, rings, fields, etc) label Apr 29, 2026
@eric-wieser

Copy link
Copy Markdown
Member

Should we manually add this for all function classes?

Yes please! At least, for all the ones that already have both definitions

@wwylele

wwylele commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator Author

So it turns out there aren't many types that have both domRestrict and codRestrict defined. I have found the following

  • RingHom: added the code
  • FirstOrder.Language.Hom: added the code (though I have no knowledge in model theory...)
  • LinearPMap: the type of domRestrict is different there. The type of the domain doesn't change, so there is no direct composition of domRestrict and codRestrict
  • FirstOrder.Language.PartialEquiv: similar problem as LinearPMap
  • MultilinearMap: has more complicated definition. I think it should be in its own PR

@wwylele wwylele changed the title feat(Algebra/Module): simp lemma for composing domRestrict and codRestrict feat(LinearMap, RingHom, FirstOrder.Language.Hom): simp lemma for composing domRestrict and codRestrict Apr 30, 2026

@j-loreaux j-loreaux left a comment

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.

Arguably f and p could be implicit, but I think in practice it makes more sense to leave them explicit. Thanks for splitting this out!

bors merge

@mathlib-triage mathlib-triage Bot added the ready-to-merge This PR has been sent to bors. label May 4, 2026
@j-loreaux

Copy link
Copy Markdown
Contributor

bors r-

@mathlib-bors

mathlib-bors Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Canceled.

Address comments or fix if necessary, and then someone with permission can run bors r+.

1 similar comment
@mathlib-bors

mathlib-bors Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Canceled.

Address comments or fix if necessary, and then someone with permission can run bors r+.

@mathlib-triage mathlib-triage Bot removed the ready-to-merge This PR has been sent to bors. label May 4, 2026
@j-loreaux

Copy link
Copy Markdown
Contributor

Can you please verify that this correctly simplifies rangeRestrict too? It should given that this is an abbrev, but I want to be sure, since that's the original point of this PR. If you check it locally, you can merge.

bors d+

@mathlib-bors

mathlib-bors Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

✌️ wwylele can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mathlib-triage mathlib-triage Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label May 4, 2026
@wwylele

wwylele commented May 4, 2026

Copy link
Copy Markdown
Collaborator Author

I did locally for LinearMap, but I can double check the other two when I get home

@wwylele

wwylele commented May 4, 2026

Copy link
Copy Markdown
Collaborator Author

It turns out RingHom.rangeRestrict is not an abbrev, so simp doesn't work for it directly. It also has a variant RingHom.rangeSRestrict. I have added simp lemma for them.

FirstOrder.Language.Hom doesn't have rangeRestrict.

I'll leave this open for a day and merge it if there is no other comments

Comment thread Mathlib/Algebra/Ring/Subring/Basic.lean Resolved
@eric-wieser

Copy link
Copy Markdown
Member

Otherwise looks good, thanks!

@wwylele

wwylele commented May 4, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for catching the obvious naming error 😅 Let me do another double check of everything

@eric-wieser

Copy link
Copy Markdown
Member

This looks good to me now, feel free to merge once you're convinced.

I haven't fully checked that you've covered every possible such declaration, but what matters most is getting sufficient coverage that someone who notices it is missing has an obvious pattern to follow.

@wwylele

wwylele commented May 4, 2026

Copy link
Copy Markdown
Collaborator Author

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request May 4, 2026
@mathlib-bors

mathlib-bors Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat(LinearMap, RingHom, FirstOrder.Language.Hom): simp lemma for composing domRestrict and codRestrict [Merged by Bors] - feat(LinearMap, RingHom, FirstOrder.Language.Hom): simp lemma for composing domRestrict and codRestrict May 4, 2026
@mathlib-bors mathlib-bors Bot closed this May 4, 2026
@wwylele
wwylele deleted the domRestrict-comp-rangeRestrict branch May 4, 2026 20:53
gaetanserre pushed a commit to gaetanserre/mathlib4 that referenced this pull request May 5, 2026
gasparattila pushed a commit to gasparattila/mathlib4 that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants