Documentation

Mathlib.Data.List.Intervals

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 #

def List.Ico (n m : ) :

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.

Equations
theorem List.Ico.zero_bot (n : ) :
Ico 0 n = range n
@[simp]
theorem List.Ico.length (n m : ) :
(Ico n m).length = m - n
theorem List.Ico.pairwise_lt (n m : ) :
Pairwise (fun (x1 x2 : ) => x1 < x2) (Ico n m)
theorem List.Ico.nodup (n m : ) :
(Ico n m).Nodup
@[simp]
theorem List.Ico.mem {n m l : } :
l Ico n m n l l < m
theorem List.Ico.eq_nil_of_le {n m : } (h : m n) :
Ico n m = []
theorem List.Ico.map_add (n m k : ) :
map (fun (x : ) => k + x) (Ico n m) = Ico (n + k) (m + k)
theorem List.Ico.map_sub (n m k : ) (h₁ : k n) :
map (fun (x : ) => x - k) (Ico n m) = Ico (n - k) (m - k)
@[simp]
theorem List.Ico.self_empty {n : } :
Ico n n = []
@[simp]
theorem List.Ico.eq_empty_iff {n m : } :
Ico n m = [] m n
theorem List.Ico.append_consecutive {n m l : } (hnm : n m) (hml : m l) :
Ico n m ++ Ico m l = Ico n l
@[simp]
theorem List.Ico.inter_consecutive (n m l : ) :
Ico n m Ico m l = []
@[simp]
theorem List.Ico.bagInter_consecutive (n m l : ) :
(Ico n m).bagInter (Ico m l) = []
@[simp]
theorem List.Ico.succ_singleton {n : } :
Ico n (n + 1) = [n]
theorem List.Ico.succ_top {n m : } (h : n m) :
Ico n (m + 1) = Ico n m ++ [m]
theorem List.Ico.eq_cons {n m : } (h : n < m) :
Ico n m = n :: Ico (n + 1) m
@[simp]
theorem List.Ico.pred_singleton {m : } (h : 0 < m) :
Ico (m - 1) m = [m - 1]
theorem List.Ico.chain'_succ (n m : ) :
Chain' (fun (a b : ) => b = a.succ) (Ico n m)
theorem List.Ico.notMem_top {n m : } :
¬m Ico n m
@[deprecated List.Ico.notMem_top (since := "2025-05-23")]
theorem List.Ico.not_mem_top {n m : } :
¬m Ico n m

Alias of List.Ico.notMem_top.

theorem List.Ico.filter_lt_of_top_le {n m l : } (hml : m l) :
filter (fun (x : ) => decide (x < l)) (Ico n m) = Ico n m
theorem List.Ico.filter_lt_of_le_bot {n m l : } (hln : l n) :
filter (fun (x : ) => decide (x < l)) (Ico n m) = []
theorem List.Ico.filter_lt_of_ge {n m l : } (hlm : l m) :
filter (fun (x : ) => decide (x < l)) (Ico n m) = Ico n l
@[simp]
theorem List.Ico.filter_lt (n m l : ) :
filter (fun (x : ) => decide (x < l)) (Ico n m) = Ico n (min m l)
theorem List.Ico.filter_le_of_le_bot {n m l : } (hln : l n) :
filter (fun (x : ) => decide (l x)) (Ico n m) = Ico n m
theorem List.Ico.filter_le_of_top_le {n m l : } (hml : m l) :
filter (fun (x : ) => decide (l x)) (Ico n m) = []
theorem List.Ico.filter_le_of_le {n m l : } (hnl : n l) :
filter (fun (x : ) => decide (l x)) (Ico n m) = Ico l m
@[simp]
theorem List.Ico.filter_le (n m l : ) :
filter (fun (x : ) => decide (l x)) (Ico n m) = Ico (max n l) m
theorem List.Ico.filter_lt_of_succ_bot {n m : } (hnm : n < m) :
filter (fun (x : ) => decide (x < n + 1)) (Ico n m) = [n]
@[simp]
theorem List.Ico.filter_le_of_bot {n m : } (hnm : n < m) :
filter (fun (x : ) => decide (x n)) (Ico n m) = [n]
theorem List.Ico.trichotomy (n a b : ) :
n < a b n n Ico a b

For any natural numbers n, a, and b, one of the following holds:

  1. n < a
  2. n ≥ b
  3. n ∈ Ico a b