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(List/rotate): migrate to get, new lemmas, golf #12171

Closed
wants to merge 5 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Apr 16, 2024

  • Add List.Nodup.rotate_congr_iff, List.cyclicPermutations_ne_nil,
    List.head?_cyclicPermutations, List.head_cyclicPermutations,
    List.cyclicPermutations_injective, List.cyclicPermutations_inj.
  • Change List.nthLe_cyclicPermutations to
    List.get_cyclicPermutations. While the old lemma wasn't deprecated
    during port, the definition List.nthLe was,
    so I think that we can drop the lemma without a deprecation period.

Open in Gitpod

The goal is to drop `nth_le_tails` and `nth_le_inits` soon.
- Add `List.Nodup.rotate_congr_iff`, `List.cyclicPermutations_ne_nil`,
  `List.head?_cyclicPermutations`, `List.head_cyclicPermutations`,
  `List.cyclicPermutations_injective`, `List.cyclicPermutations_inj`.
- Change `List.nthLe_cyclicPermutations` to
  `List.get_cyclicPermutations`. While the old lemma wasn't deprecated
  during port, the definition `List.nthLe` was,
  so I think that we can drop the lemma without a deprecation period.
@urkud urkud added the awaiting-review The author would like community review of the PR label Apr 16, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the blocked-by-other-PR This PR depends on another PR which is still in the queue. label Apr 16, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the blocked-by-other-PR This PR depends on another PR which is still in the queue. label Apr 17, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

This PR/issue depends on:

Copy link
Collaborator

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Thank you for doing this!

I verified that all existing lemmas are kept (sometimes moved); only changes are for nthLe -> in theorem statements. I did not scrutinize the new proofs carefully; they broadly look nicer than the old ones.

While there's no agreed policy on deprecations yet, not deprecating these lemmas for a while seems fine to me.

simp [dropLast_eq_take, cyclicPermutations_of_ne_nil _ h, nthLe_take',
rotate_eq_drop_append_take hn.le]
#align list.nth_le_cyclic_permutations List.nthLe_cyclicPermutations
theorem cyclicPermutations_ne_nil : ∀ l : List α, cyclicPermutations l ≠ []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can l : List α be moved left of the colon?

Copy link
Member Author

@urkud urkud Apr 24, 2024

Choose a reason for hiding this comment

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

Why? This will make pattern matching a bit less convenient for no obvious (to me) gain.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you want to move it, then please push to this branch. Otherwise, just merge it, please.

bors d=grunweg

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is a fair point. (I was trying to understand why "hypothesis left of colon" was not followed - sounds like you have a good reason. Thanks for educating me!)

@grunweg grunweg added the tech debt tracking cross-cutting technical debt label Apr 23, 2024
Copy link
Member

@fpvandoorn fpvandoorn 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 d+

@mathlib-bors
Copy link

mathlib-bors bot commented Apr 23, 2024

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

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added delegated and removed awaiting-review The author would like community review of the PR labels Apr 23, 2024
@mathlib-bors
Copy link

mathlib-bors bot commented Apr 24, 2024

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

@grunweg
Copy link
Collaborator

grunweg commented Apr 24, 2024

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Apr 24, 2024
- Add `List.Nodup.rotate_congr_iff`, `List.cyclicPermutations_ne_nil`,
  `List.head?_cyclicPermutations`, `List.head_cyclicPermutations`,
  `List.cyclicPermutations_injective`, `List.cyclicPermutations_inj`.
- Change `List.nthLe_cyclicPermutations` to
  `List.get_cyclicPermutations`. While the old lemma wasn't deprecated
  during port, the definition `List.nthLe` was,
  so I think that we can drop the lemma without a deprecation period.
@mathlib-bors
Copy link

mathlib-bors bot commented Apr 24, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(List/rotate): migrate to get, new lemmas, golf [Merged by Bors] - feat(List/rotate): migrate to get, new lemmas, golf Apr 24, 2024
@mathlib-bors mathlib-bors bot closed this Apr 24, 2024
@mathlib-bors mathlib-bors bot deleted the YK-list-rotate branch April 24, 2024 13:41
Jun2M pushed a commit that referenced this pull request Apr 24, 2024
- Add `List.Nodup.rotate_congr_iff`, `List.cyclicPermutations_ne_nil`,
  `List.head?_cyclicPermutations`, `List.head_cyclicPermutations`,
  `List.cyclicPermutations_injective`, `List.cyclicPermutations_inj`.
- Change `List.nthLe_cyclicPermutations` to
  `List.get_cyclicPermutations`. While the old lemma wasn't deprecated
  during port, the definition `List.nthLe` was,
  so I think that we can drop the lemma without a deprecation period.
callesonne pushed a commit that referenced this pull request May 16, 2024
- Add `List.Nodup.rotate_congr_iff`, `List.cyclicPermutations_ne_nil`,
  `List.head?_cyclicPermutations`, `List.head_cyclicPermutations`,
  `List.cyclicPermutations_injective`, `List.cyclicPermutations_inj`.
- Change `List.nthLe_cyclicPermutations` to
  `List.get_cyclicPermutations`. While the old lemma wasn't deprecated
  during port, the definition `List.nthLe` was,
  so I think that we can drop the lemma without a deprecation period.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated tech debt tracking cross-cutting technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants