The areas / V33. Data structures and computation
Mathlib.Data.List.Intervals
28 declarations. Mathlib docs · Source
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
Int.range(and maybeList.range'?).
def List.Ico E1 #
ℕ → ℕ → List ℕ
Ico n m is the list of natural numbers n ≤ x < m.
(Ico stands for "interval, closed-open".)
See also Mathlib/Order/Interval/Basic.lean for modelling intervals in general preorders, as well
as sibling definitions alongside it such as Set.Ico, Multiset.Ico and Finset.Ico
for sets, multisets and finite sets respectively.
theorem List.Ico.zero_bot E1 #
∀ (n : ℕ), List.Ico 0 n = List.range n
theorem List.Ico.length E0 #
∀ (n m : ℕ), (List.Ico n m).length = m - n
theorem List.Ico.pairwise_lt E1 #
∀ (n m : ℕ), List.Pairwise (fun x1 x2 ↦ x1 < x2) (List.Ico n m)
theorem List.Ico.nodup E1 #
∀ (n m : ℕ), (List.Ico n m).Nodup
theorem List.Ico.mem E0 #
∀ {n m l : ℕ}, l ∈ List.Ico n m ↔ n ≤ l ∧ l < m
theorem List.Ico.map_add E0 #
∀ (n m k : ℕ), List.map (fun x ↦ k + x) (List.Ico n m) = List.Ico (n + k) (m + k)
theorem List.Ico.map_sub E0 #
∀ (n m k : ℕ), k ≤ n → List.map (fun x ↦ x - k) (List.Ico n m) = List.Ico (n - k) (m - k)
theorem List.Ico.self_empty E0 #
∀ {n : ℕ}, List.Ico n n = []
theorem List.Ico.append_consecutive E1 #
∀ {n m l : ℕ}, n ≤ m → m ≤ l → List.Ico n m ++ List.Ico m l = List.Ico n l
theorem List.Ico.inter_consecutive E0 #
∀ (n m l : ℕ), List.Ico n m ∩ List.Ico m l = []
theorem List.Ico.bagInter_consecutive E0 #
∀ (n m l : ℕ), (List.Ico n m).bagInter (List.Ico m l) = []
theorem List.Ico.succ_singleton E0 #
∀ {n : ℕ}, List.Ico n (n + 1) = [n]
theorem List.Ico.succ_top E1 #
∀ {n m : ℕ}, n ≤ m → List.Ico n (m + 1) = List.Ico n m ++ [m]
theorem List.Ico.pred_singleton E0 #
∀ {m : ℕ}, 0 < m → List.Ico (m - 1) m = [m - 1]
theorem List.Ico.isChain_succ E1 #
∀ (n m : ℕ), List.IsChain (fun a b ↦ b = a.succ) (List.Ico n m)
theorem List.Ico.notMem_top E1 #
∀ {n m : ℕ}, m ∉ List.Ico n m
theorem List.Ico.filter_lt_of_top_le E1 #
∀ {n m l : ℕ}, m ≤ l → List.filter (fun x ↦ decide (x < l)) (List.Ico n m) = List.Ico n m
theorem List.Ico.filter_lt_of_le_bot E1 #
∀ {n m l : ℕ}, l ≤ n → List.filter (fun x ↦ decide (x < l)) (List.Ico n m) = []
theorem List.Ico.filter_lt_of_ge E1 #
∀ {n m l : ℕ}, l ≤ m → List.filter (fun x ↦ decide (x < l)) (List.Ico n m) = List.Ico n l
theorem List.Ico.filter_lt E0 #
∀ (n m l : ℕ), List.filter (fun x ↦ decide (x < l)) (List.Ico n m) = List.Ico n (min m l)
theorem List.Ico.filter_le_of_le_bot E1 #
∀ {n m l : ℕ}, l ≤ n → List.filter (fun x ↦ decide (l ≤ x)) (List.Ico n m) = List.Ico n m
theorem List.Ico.filter_le_of_top_le E1 #
∀ {n m l : ℕ}, m ≤ l → List.filter (fun x ↦ decide (l ≤ x)) (List.Ico n m) = []
theorem List.Ico.filter_le_of_le E1 #
∀ {n m l : ℕ}, n ≤ l → List.filter (fun x ↦ decide (l ≤ x)) (List.Ico n m) = List.Ico l m
theorem List.Ico.filter_le E0 #
∀ (n m l : ℕ), List.filter (fun x ↦ decide (l ≤ x)) (List.Ico n m) = List.Ico (max n l) m
theorem List.Ico.filter_lt_of_succ_bot E1 #
∀ {n m : ℕ}, n < m → List.filter (fun x ↦ decide (x < n + 1)) (List.Ico n m) = [n]
theorem List.Ico.filter_le_of_bot E0 #
∀ {n m : ℕ}, n < m → List.filter (fun x ↦ decide (x ≤ n)) (List.Ico n m) = [n]
theorem List.Ico.trichotomy E1 #
∀ (n a b : ℕ), n < a ∨ b ≤ n ∨ n ∈ List.Ico a b
For any natural numbers n, a, and b, one of the following holds:
- n < a
- n ≥ b
- n ∈ Ico a b