-
Notifications
You must be signed in to change notification settings - Fork 299
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(Ico): initial implementation of intervals in nat [WIP] #496
feat(Ico): initial implementation of intervals in nat [WIP] #496
Conversation
edcfeac
to
8decb5d
Compare
f174016
to
533299e
Compare
(Note: I didn't try the proof myself) I would suggest to prove first more general rules about Then we can proof: n <= l <= m ->
(Ico n m).filter (λ x, x < l) =
(Ico n l).filter (λ x, x < l) ++ (Ico l m).filter (λ x, x < l) =
(Ico n l).filter (λ x, x < l) |
src/data/list/basic.lean
Outdated
@@ -4038,7 +4038,14 @@ by dsimp [Ico]; simp [nat.add_sub_cancel_left] | |||
theorem pred_singleton {m : ℕ} (h : m > 0) : Ico (m-1) m = [m-1] := | |||
by dsimp [Ico]; rw nat.sub_sub_self h; simp | |||
|
|||
-- Someone put me out of my misery (no human suffering should be needed to prove this): | |||
theorem gt_nil {n m : ℕ} (h : n > m) : Ico n m = [] := |
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.
this holds more general for n >= m
, also I would call it eq_nil_of_le
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.
Fixed, thanks.
Thanks for this. As it turned out I independently realised this was the way to go, and implemented this approach last night. |
Some initial attempts at defining
Ico
(interval, closed-open), innat
, as a list, multiset, and finset.There are many more lemmas to prove about these intervals (and the corresponding ones in
int
), but these are all I need so far for my "reindexingfinset.sum
" lemmas and tactics.(And I think this stuff will be useful whatever our eventual design for big operators looks like.)
Please feel free to criticize, hack, or add to this branch!