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(data/list/basic): add filter/remove_all length properties #10409
base: master
Are you sure you want to change the base?
feat(data/list/basic): add filter/remove_all length properties #10409
Conversation
A note for other reviewers: CI is not running correctly here because this is running from a fork. Can someone else advise @rgreenblatt on what to do next? |
src/data/list/basic.lean
Outdated
@[simp] theorem length_filter_lt_of_mem {a : α} (l : list α) : | ||
a ∈ l → ¬p a → (filter p l).length < l.length := | ||
begin | ||
induction l; | ||
simp, | ||
intros h_in hpa, |
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.
@[simp] theorem length_filter_lt_of_mem {a : α} (l : list α) : | |
a ∈ l → ¬p a → (filter p l).length < l.length := | |
begin | |
induction l; | |
simp, | |
intros h_in hpa, | |
@[simp] theorem length_filter_lt_of_mem {a : α} (l : list α) (ha : a ∈ l) (hpa : ¬p a) : (filter p l).length < l.length := | |
begin | |
induction l; | |
simp, |
It's usually better to put hypotheses before the colon when possible.
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.
Sure, done.
I assume that mem_filter_of_mem
(and a few other theorems) use implications like this for syntax convenience from pattern matching? Or is there some other reason?
Not sure if these are the right names for these theorem. Also, maybe these proofs could be cleaned up?