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] - feat: Better lemmas for transferring finite sums along equivalences #9237

Closed
wants to merge 14 commits into from

Conversation

YaelDillies
Copy link
Collaborator

@YaelDillies YaelDillies commented Dec 23, 2023

Lemmas around this were a mess, throth in terms of names, statement and location. This PR standardises everything to be in Algebra.BigOperators.Basic and changes the lemmas to take in InjOn and SurjOn assumptions where possible (and where impossible make sure the hypotheses are taken in the correct order) and moves the equality of functions hypothesis last.

Also add a few lemmas that help fix downstream uses by golfing.

From LeanAPAP and LeanCamCombi


Open in Gitpod

Lemmas around this were a mess, throth in terms of names, statement and location. This PR standardises everything to be in `Algebra.BigOperators.Basic` and changes the lemmas to take in `InjOn` and `SurjOn` assumptions where possible (and where impossible make sure the hypotheses are taken in the correct order) and moves the equality of functions hypothesis last.

Also add a few lemma that help fix downstream uses by golfing.
@YaelDillies YaelDillies added awaiting-review The author would like community review of the PR t-algebra Algebra (groups, rings, fields etc) awaiting-CI labels Dec 23, 2023
Mathlib/Algebra/BigOperators/Basic.lean Outdated Show resolved Hide resolved
Mathlib/Algebra/BigOperators/Basic.lean Outdated Show resolved Hide resolved
YaelDillies and others added 4 commits December 23, 2023 11:53
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
#align finset.equiv.sum_comp_finset Finset.Equiv.sum_comp_finset
-- TODO: Backport arguments changes to `card_congr` and `prod_bij`
@[to_additive]
lemma prod_nbij (i : ι → κ) (hi : ∀ a ∈ s, i a ∈ t) (i_inj : (s : Set ι).InjOn i)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the n in nbij stand for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-dependent. Bhavik came up with this name, we both don't like it. Do you have any suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to go with prod_bij'. And just explain the difference in the docstrings using cross-refs. "See foo_bar for a (non)dependent variant."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prod_bij' already exists! It's the version which takes in two functions that are inverse to each other on the finsets.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha... arguably the name of that lemma should be closer to equiv than to bij. But maybe that's out of scope for this PR.

So let's go for nbij for now. But please explain the name in the docstrings.

@jcommelin
Copy link
Member

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit a7371c4.
The entire run failed.
Found no significant differences.

@YaelDillies
Copy link
Collaborator Author

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 2089370.
There were significant changes against commit 7a302eb:

  Benchmark                        Metric         Change
  ======================================================
- ~Mathlib.Probability.StrongLaw   instructions    10.3%

@YaelDillies
Copy link
Collaborator Author

Probability.StrongLaw basically proves the same lemma about swapping sums three times and I've fixed everything by sticking in a lot of aesop calls. I will try to find a generalisation of sum_Ico_Ico_comm that works for all three applications, but I'm willing to call that out of scope for this PR.

@jcommelin
Copy link
Member

bors d+

@mathlib-bors
Copy link

mathlib-bors bot commented Dec 27, 2023

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

@github-actions github-actions bot added delegated and removed awaiting-review The author would like community review of the PR labels Dec 27, 2023
@YaelDillies
Copy link
Collaborator Author

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Dec 27, 2023
…9237)

Lemmas around this were a mess, throth in terms of names, statement and location. This PR standardises everything to be in `Algebra.BigOperators.Basic` and changes the lemmas to take in `InjOn` and `SurjOn` assumptions where possible (and where impossible make sure the hypotheses are taken in the correct order) and moves the equality of functions hypothesis last.

Also add a few lemmas that help fix downstream uses by golfing.

From LeanAPAP and LeanCamCombi
@mathlib-bors
Copy link

mathlib-bors bot commented Dec 27, 2023

Build failed (retrying...):

@mathlib-bors
Copy link

mathlib-bors bot commented Dec 27, 2023

Canceled.

@YaelDillies
Copy link
Collaborator Author

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Dec 27, 2023
…9237)

Lemmas around this were a mess, throth in terms of names, statement and location. This PR standardises everything to be in `Algebra.BigOperators.Basic` and changes the lemmas to take in `InjOn` and `SurjOn` assumptions where possible (and where impossible make sure the hypotheses are taken in the correct order) and moves the equality of functions hypothesis last.

Also add a few lemmas that help fix downstream uses by golfing.

From LeanAPAP and LeanCamCombi
@mathlib-bors
Copy link

mathlib-bors bot commented Dec 27, 2023

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: Better lemmas for transferring finite sums along equivalences [Merged by Bors] - feat: Better lemmas for transferring finite sums along equivalences Dec 27, 2023
@mathlib-bors mathlib-bors bot closed this Dec 27, 2023
@mathlib-bors mathlib-bors bot deleted the sum_bij branch December 27, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated t-algebra Algebra (groups, rings, fields etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants