-
Notifications
You must be signed in to change notification settings - Fork 534
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: lemmas about List.tail #5360
Conversation
The number of elements satisfying a predicate in a sublist is at least the number of elements satisfying the predicate in the list, | ||
minus the difference in the lengths. | ||
-/ | ||
theorem Sublist.le_countP (s : l₁ <+ l₂) (p) : countP p l₂ - (l₂.length - l₁.length) ≤ countP p l₁ := by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe avoiding Nat.sub
, since that is the general advise, isn’t it?
theorem Sublist.le_countP (s : l₁ <+ l₂) (p) : countP p l₂ - (l₂.length - l₁.length) ≤ countP p l₁ := by | |
theorem Sublist.le_countP (s : l₁ <+ l₂) (p) : countP p l₂ + l₁.length ≤ countP p l₁ + l₂.length := by |
(This is based on a suggestion by @jcommelin on a somewhat similar lemma of mine in leanprover-community/mathlib4#15383 (comment))
But I agree that reads much less natural that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I trust in omega
for things like this.
Mathlib CI status (docs):
|
…19874) Makes `tail_reverse_eq_reverse_dropLast` a deprecated alias to [`tail_reverse`](https://github.com/leanprover/lean4/blob/938651121f3d8819109eee75722a1de087feff71/src/Init/Data/List/Lemmas.lean#L2990-L2994), which was added to core in leanprover/lean4#5360. This duplicated lemma was found by [`tryAtEachStep`](https://github.com/dwrensha/tryAtEachStep).
No description provided.