Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - chore: @[simp] cancel_(right|left) #6300

Closed
wants to merge 1 commit into from

Conversation

semorrison
Copy link
Contributor

@semorrison semorrison commented Aug 2, 2023

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added blocked-by-other-PR This PR depends on another PR which is still in the queue. and removed blocked-by-other-PR This PR depends on another PR which is still in the queue. labels Aug 2, 2023
@leanprover-community-mathlib4-bot
Copy link
Collaborator

This PR/issue depends on:

@semorrison
Copy link
Contributor Author

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit d63c234.
There were significant changes against commit 68a37cd:

  Benchmark                                                           Metric         Change
  =========================================================================================
- ~Mathlib.CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit   instructions     5.9%

@semorrison
Copy link
Contributor Author

One file got slower, but overall wall-clock is identical (epsilon faster), so I propose not worrying.

@semorrison semorrison added the awaiting-review The author would like community review of the PR label Aug 6, 2023
@kbuzzard
Copy link
Member

kbuzzard commented Aug 9, 2023

I don't understand: how will the simplifier find these injectivity/surjectivity assumptions?

@jcommelin
Copy link
Member

What is the motivation for this PR? Are you planning to golf some proofs in mathlib? Or some others?

@semorrison
Copy link
Contributor Author

This was motivated by @jakelev and I working on our transport tactic, where we often have Injective or Surjective in the context and would like simp_all to just close obvious goals. Adding lemmas like this are very helpful for this.

So, no, not planning on golfing specific goals, we just wanted simp_all to be more powerful when there was already an Injective hypothesis available.

Not sure I'm going to have much opportunity to work on transport in the near future, so this isn't urgent.

@ocfnash
Copy link
Contributor

ocfnash commented Aug 23, 2023

I don't understand: how will the simplifier find these injectivity/surjectivity assumptions?

These can be triggered if simp figures out the injectivity hypothesis (say) some other way. For example if we added simp to RingHom.injective (and I'd argue we should) then the changes here should ensure that RingHom.cancel_left fires when the source is a division ring.

Mostly though the huge amount of repetition in the library that this PR highlights makes me wonder if cancel_left and cancel_right could be folder into the FunLike API.

@semorrison
Copy link
Contributor Author

I don't understand: how will the simplifier find these injectivity/surjectivity assumptions?

@kbuzzard, e.g. aesop will use simp_all, so injectivity hypotheses in the local context are useful.

If you have an injectivity hypotheses h, it's also nice to just be able to write simp [h], without having to go find the names of the lemmas that use h.

@sgouezel
Copy link
Contributor

sgouezel commented Sep 5, 2023

Let's get this in. Thanks!
bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Sep 5, 2023
bors bot pushed a commit that referenced this pull request Sep 5, 2023
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@bors
Copy link

bors bot commented Sep 5, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title chore: @[simp] cancel_(right|left) [Merged by Bors] - chore: @[simp] cancel_(right|left) Sep 5, 2023
@bors bors bot closed this Sep 5, 2023
@bors bors bot deleted the cancel_simps branch September 5, 2023 10:31
ebab pushed a commit that referenced this pull request Sep 6, 2023
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
kodyvajjha pushed a commit that referenced this pull request Sep 22, 2023
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants