-
Notifications
You must be signed in to change notification settings - Fork 135
feat: add list function and lemmas #987
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
Open
chabulhwi
wants to merge
21
commits into
leanprover-community:main
Choose a base branch
from
chabulhwi:add-more-list-lemmas
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
344bd60
feat: add lemmas about lists
chabulhwi 87f4b94
feat: add more lemmas about lists
chabulhwi 02599d9
style: avoid using `@` symbol
chabulhwi f39e00a
refactor: remove implicit instances of theorem
chabulhwi 2d30498
refactor: put theorem in section
chabulhwi 6b39d44
feat: add `List.commonPrefix` and its lemmas
chabulhwi ce38099
refactor: rename and restate theorem
chabulhwi 6b7c0e4
chore: move definition to another file
chabulhwi ab8e65a
feat: add theorem `List.commonPrefix_comm`
chabulhwi 9e0d971
style: avoid using `Decidable.em` directly
chabulhwi d257184
refactor: golf proofs
chabulhwi fa83dc7
Revert "refactor: golf proofs"
chabulhwi ffbd01f
Revert "style: avoid using `Decidable.em` directly"
chabulhwi 49f306e
Revert "feat: add theorem `List.commonPrefix_comm`"
chabulhwi 0e6bfd8
Revert "chore: move definition to another file"
chabulhwi 10a0c0d
Revert "refactor: rename and restate theorem"
chabulhwi 75ec590
Revert "feat: add `List.commonPrefix` and its lemmas"
chabulhwi f3a2b95
Revert "refactor: put theorem in section"
chabulhwi 1d57ce4
Revert "refactor: remove implicit instances of theorem"
chabulhwi 7c5ef34
chore: remove theorem
chabulhwi fa178b5
Merge branch 'main' into add-more-list-lemmas
fgdorais File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,15 @@ namespace List | |||||||||||
|
|
||||||||||||
| @[deprecated (since := "2024-08-15")] alias isEmpty_iff_eq_nil := isEmpty_iff | ||||||||||||
|
|
||||||||||||
| /-! ### head and tail -/ | ||||||||||||
|
|
||||||||||||
| theorem head_cons_tail : ∀ (l : List α) (hne : l ≠ []), l.head hne :: l.tail = l | ||||||||||||
| | _::_, _ => rfl | ||||||||||||
|
|
||||||||||||
| theorem singleton_head_eq_self (l : List α) (hne : l ≠ []) (htl : l.tail = []) : | ||||||||||||
| [l.head hne] = l := by | ||||||||||||
| conv => rhs; rw [← head_cons_tail l hne, htl] | ||||||||||||
|
|
||||||||||||
| /-! ### next? -/ | ||||||||||||
|
|
||||||||||||
| @[simp] theorem next?_nil : @next? α [] = none := rfl | ||||||||||||
|
|
@@ -482,6 +491,15 @@ theorem Sublist.erase_diff_erase_sublist {a : α} : | |||||||||||
|
|
||||||||||||
| end Diff | ||||||||||||
|
|
||||||||||||
| /-! ### prefix, suffix, infix -/ | ||||||||||||
|
|
||||||||||||
| theorem singleton_prefix_cons (a) : [a] <+: a :: l := | ||||||||||||
| (prefix_cons_inj a).mpr nil_prefix | ||||||||||||
|
|
||||||||||||
| theorem ne_nil_of_not_prefix (h : ¬l₁ <+: l₂) : l₁ ≠ [] := by | ||||||||||||
| intro heq | ||||||||||||
| simp [heq, nil_prefix] at h | ||||||||||||
|
Comment on lines
+499
to
+501
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| /-! ### drop -/ | ||||||||||||
|
|
||||||||||||
| theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n) | ||||||||||||
|
|
||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.