mathlib documentation

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 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
theorem list.Ico.zero_bot (n : ) :
@[simp]
theorem list.Ico.length (n m : ) :
(list.Ico n m).length = m - n
theorem list.Ico.nodup (n m : ) :
@[simp]
theorem list.Ico.mem {n m l : } :
l list.Ico n m n l l < m
theorem list.Ico.eq_nil_of_le {n m : } (h : m n) :
theorem list.Ico.map_add (n m k : ) :
list.map (has_add.add k) (list.Ico n m) = list.Ico (n + k) (m + k)
theorem list.Ico.map_sub (n m k : ) (h₁ : k n) :
list.map (λ (x : ), x - k) (list.Ico n m) = list.Ico (n - k) (m - k)
@[simp]
theorem list.Ico.self_empty {n : } :
@[simp]
theorem list.Ico.eq_empty_iff {n m : } :
theorem list.Ico.append_consecutive {n m l : } (hnm : n m) (hml : m l) :
@[simp]
@[simp]
@[simp]
theorem list.Ico.succ_singleton {n : } :
list.Ico n (n + 1) = [n]
theorem list.Ico.succ_top {n m : } (h : n m) :
list.Ico n (m + 1) = list.Ico n m ++ [m]
theorem list.Ico.eq_cons {n m : } (h : n < m) :
list.Ico n m = n :: list.Ico (n + 1) m
@[simp]
theorem list.Ico.pred_singleton {m : } (h : 0 < m) :
list.Ico (m - 1) m = [m - 1]
theorem list.Ico.chain'_succ (n m : ) :
list.chain' (λ (a b : ), b = a.succ) (list.Ico n m)
@[simp]
theorem list.Ico.not_mem_top {n m : } :
theorem list.Ico.filter_lt_of_top_le {n m l : } (hml : m l) :
list.filter (λ (x : ), x < l) (list.Ico n m) = list.Ico n m
theorem list.Ico.filter_lt_of_le_bot {n m l : } (hln : l n) :
list.filter (λ (x : ), x < l) (list.Ico n m) = list.nil
theorem list.Ico.filter_lt_of_ge {n m l : } (hlm : l m) :
list.filter (λ (x : ), x < l) (list.Ico n m) = list.Ico n l
@[simp]
theorem list.Ico.filter_lt (n m l : ) :
list.filter (λ (x : ), x < l) (list.Ico n m) = list.Ico n (min m l)
theorem list.Ico.filter_le_of_le_bot {n m l : } (hln : l n) :
list.filter (λ (x : ), l x) (list.Ico n m) = list.Ico n m
theorem list.Ico.filter_le_of_top_le {n m l : } (hml : m l) :
list.filter (λ (x : ), l x) (list.Ico n m) = list.nil
theorem list.Ico.filter_le_of_le {n m l : } (hnl : n l) :
list.filter (λ (x : ), l x) (list.Ico n m) = list.Ico l m
@[simp]
theorem list.Ico.filter_le (n m l : ) :
list.filter (λ (x : ), l x) (list.Ico n m) = list.Ico (max n l) m
theorem list.Ico.filter_lt_of_succ_bot {n m : } (hnm : n < m) :
list.filter (λ (x : ), x < n + 1) (list.Ico n m) = [n]
@[simp]
theorem list.Ico.filter_le_of_bot {n m : } (hnm : n < m) :
list.filter (λ (x : ), x n) (list.Ico n m) = [n]
theorem list.Ico.trichotomy (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:

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