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(data/fin): succ_above defn compares fin terms instead of values #3999

Closed
wants to merge 54 commits into from

Conversation

pechersky
Copy link
Collaborator

@pechersky pechersky commented Aug 31, 2020

fin.succ_above is redefined to use a comparison between two fin (n + 1) instead of their coerced values in nat. This should delay any "escape" from fin into nat until necessary. Lemmas are added regarding fin.succ_above. Some proofs for existing lemmas reworked for new definition and simplified. Additionally, docstrings are added for related lemmas.

New lemmas:
Comparison after embedding:
succ_above_lt_ge
succ_above_lt_gt

Injectivity lemmas:
succ_above_right_inj
succ_above_right_injective
succ_above_left_inj
succ_above_left_injective

finset lemma:
fin.univ_succ_above

prod and sum lemmas:
fin.prod_univ_succ_above


I'm working on some statements like

finset.image (fin.succ_above x) finset.univ = finset.erase finset.univ x

It seems that generalization might make the fin.prod_* lemmas generalizable over generic finset.erase prod lemmas. Is it worth it to express them in that general way? In particular, due to how fin n and fin (n + 1) are different types, rearranging indices (that use fin as the type) within those sums gets clunky. Hopefully the generalizations will ease that clunkiness.

@pechersky pechersky added the awaiting-review The author would like community review of the PR label Aug 31, 2020
@pechersky pechersky marked this pull request as ready for review August 31, 2020 19:04
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

I think your proposed generalisation is worth trying out. If it makes things smoother, that's a sign that you should definitely go that way.

src/data/fin.lean Outdated Show resolved Hide resolved
Co-authored by: Bryan Gin-ge Chen bryangingechen@gmail.com
src/data/fin.lean Outdated Show resolved Hide resolved
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Sep 2, 2020
bors bot pushed a commit that referenced this pull request Sep 2, 2020
…#3999)

`fin.succ_above` is redefined to use a comparison between two `fin (n + 1)` instead of their coerced values in `nat`. This should delay any "escape" from `fin` into `nat` until necessary. Lemmas are added regarding `fin.succ_above`. Some proofs for existing lemmas reworked for new definition and simplified. Additionally, docstrings are added for related lemmas.

New lemmas:
Comparison after embedding:
`succ_above_lt_ge`
`succ_above_lt_gt`

Injectivity lemmas:
`succ_above_right_inj`
`succ_above_right_injective`
`succ_above_left_inj`
`succ_above_left_injective`

finset lemma:
`fin.univ_succ_above`

prod and sum lemmas:
`fin.prod_univ_succ_above`



Co-authored-by: Yakov Pechersky <pechersky@users.noreply.github.com>
@bors
Copy link

bors bot commented Sep 2, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title chore(data/fin): succ_above defn compares fin terms instead of values [Merged by Bors] - chore(data/fin): succ_above defn compares fin terms instead of values Sep 2, 2020
@bors bors bot closed this Sep 2, 2020
@bors bors bot deleted the succ-above-redef branch September 2, 2020 14:54
PatrickMassot pushed a commit that referenced this pull request Sep 8, 2020
…#3999)

`fin.succ_above` is redefined to use a comparison between two `fin (n + 1)` instead of their coerced values in `nat`. This should delay any "escape" from `fin` into `nat` until necessary. Lemmas are added regarding `fin.succ_above`. Some proofs for existing lemmas reworked for new definition and simplified. Additionally, docstrings are added for related lemmas.

New lemmas:
Comparison after embedding:
`succ_above_lt_ge`
`succ_above_lt_gt`

Injectivity lemmas:
`succ_above_right_inj`
`succ_above_right_injective`
`succ_above_left_inj`
`succ_above_left_injective`

finset lemma:
`fin.univ_succ_above`

prod and sum lemmas:
`fin.prod_univ_succ_above`



Co-authored-by: Yakov Pechersky <pechersky@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants