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

feat: add list function and lemmas #987

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

chabulhwi
Copy link
Contributor

@chabulhwi chabulhwi commented Oct 14, 2024

These are 'leftover' lemmas I created while trying to prove
String.splitOn_of_valid. See
#743.

Co-authored-by: François G. Dorais [email protected]


I split this pull request in two: #993 and #994.

@chabulhwi chabulhwi marked this pull request as draft October 14, 2024 09:19
@chabulhwi chabulhwi force-pushed the add-more-list-lemmas branch 2 times, most recently from f9d2745 to 20de1c3 Compare October 14, 2024 09:26
@chabulhwi chabulhwi marked this pull request as ready for review October 14, 2024 09:26
@chabulhwi chabulhwi changed the title Add more list lemmas feat: add more list lemmas Oct 14, 2024
@chabulhwi
Copy link
Contributor Author

awaiting-review

@github-actions github-actions bot added the awaiting-review This PR is ready for review; the author thinks it is ready to be merged. label Oct 14, 2024
chabulhwi and others added 7 commits October 16, 2024 01:28
I need these lemmas to prove `String.splitOn_of_valid`.
These are 'leftover' lemmas I created while trying to prove
`String.splitOn_of_valid`. See
leanprover-community#743.
Using the `@` symbol is a bit old-fashioned.

Co-authored-by: François G. Dorais <[email protected]>
The function `List.commonPrefix` returns the longest common prefix of
two lists.
* Remove the "_exists" part from the theorem's name.
* Remove the existential quantifiers from the theorem's statement and
  add new hypotheses.
@chabulhwi chabulhwi force-pushed the add-more-list-lemmas branch from df77496 to ce38099 Compare October 15, 2024 16:29
chabulhwi

This comment was marked as duplicate.

@chabulhwi chabulhwi requested a review from fgdorais October 15, 2024 17:02
Move `List.commonPrefix` to `Batteries.Data.List.Basic`.
@chabulhwi chabulhwi changed the title feat: add more list lemmas feat: add more list function and lemmas Oct 15, 2024
@chabulhwi chabulhwi changed the title feat: add more list function and lemmas feat: add list function and lemmas Oct 15, 2024
@chabulhwi chabulhwi force-pushed the add-more-list-lemmas branch from 2152acb to 7311737 Compare October 16, 2024 03:38
@chabulhwi chabulhwi force-pushed the add-more-list-lemmas branch from 6ed7df8 to b794e10 Compare October 16, 2024 03:42
chabulhwi and others added 3 commits October 16, 2024 12:48
This theorem will simplify the proof of the theorem
`List.commonPrefix_prefix_right`.

Co-authored-by: Kyle Miller <[email protected]>
Co-authored-by: Kyle Miller <[email protected]>
@chabulhwi chabulhwi force-pushed the add-more-list-lemmas branch from b794e10 to d257184 Compare October 16, 2024 03:48
@fgdorais
Copy link
Collaborator

The commonPrefix addition is good but let's move it to a separate PR.

@chabulhwi
Copy link
Contributor Author

chabulhwi commented Oct 16, 2024

I split this pull request in two: #993 and #994.

@chabulhwi chabulhwi closed this Oct 16, 2024
@fgdorais
Copy link
Collaborator

fgdorais commented Oct 16, 2024

Don't close this one! We want to keep the review history for the other parts. Just delete the parts that are moved to the other PR.

@chabulhwi
Copy link
Contributor Author

chabulhwi commented Oct 16, 2024

@fgdorais Shall I close #993? I didn't want to modify the commit history of this PR, so I opened the second version of it.

@fgdorais
Copy link
Collaborator

fgdorais commented Oct 16, 2024

Yes. Thank you!

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Oct 21, 2024
Comment on lines +499 to +501
theorem ne_nil_of_not_prefix (h : ¬l₁ <+: l₂) : l₁ ≠ [] := by
intro heq
simp [heq, nil_prefix] at h
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
theorem ne_nil_of_not_prefix (h : ¬l₁ <+: l₂) : l₁ ≠ [] := by
intro heq
simp [heq, nil_prefix] at h
theorem ne_nil_of_not_prefix : ¬l₁ <+: l₂ → l₁ ≠ [] := by
apply mt; intro h; simp [h]

@fgdorais fgdorais added awaiting-author Waiting for PR author to address issues and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Oct 29, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. and removed merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author Waiting for PR author to address issues merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants