Intervals in ℕ #
This file defines intervals of naturals. list.Ico m n is the list of integers greater than m
and strictly less than n.
TODO #
- Define
IooandIcc, state basic lemmas about them. - Also do the versions for integers?
- One could generalise even further, defining 'locally finite partial orders', for which
set.Ico a bis[finite], and 'locally finite total orders', for which there is a list model. - Once the above is done, get rid of
data.int.range(and maybelist.range'?).
Ico n m is the list of natural numbers n ≤ x < m.
(Ico stands for "interval, closed-open".)
See also data/set/intervals.lean for set.Ico, modelling intervals in general preorders, and
multiset.Ico and finset.Ico for n ≤ x < m as a multiset or as a finset.
Equations
- list.Ico n m = list.range' n (m - n)
@[simp]
theorem
list.Ico.filter_lt
(n m l : ℕ) :
list.filter (λ (x : ℕ), x < l) (list.Ico n m) = list.Ico n (linear_order.min m l)
@[simp]
theorem
list.Ico.filter_le
(n m l : ℕ) :
list.filter (λ (x : ℕ), l ≤ x) (list.Ico n m) = list.Ico (linear_order.max n l) m
@[simp]
theorem
list.Ico.filter_le_of_bot
{n m : ℕ}
(hnm : n < m) :
list.filter (λ (x : ℕ), x ≤ n) (list.Ico n m) = [n]