File: Mathlib/Data/List/Intervals.lean

full_name: List.Ico
code: /-- `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.
 -/
def Ico (n m : ℕ) : List ℕ 
goal: List ℕ

full_name: List.Ico.zero_bot
code: theorem zero_bot (n : ℕ) : Ico 0 n = range n 
goal: List.Ico 0 n = List.range n

full_name: List.Ico.length
code: @[simp]
theorem length (n m : ℕ) : length (Ico n m) = m - n 
goal: (List.Ico n m).length = m - n

full_name: List.Ico.pairwise_lt
code: theorem pairwise_lt (n m : ℕ) : Pairwise (· < ·) (Ico n m) 
goal: List.Pairwise (fun x x_1 => x < x_1) (List.Ico n m)

full_name: List.Ico.nodup
code: theorem nodup (n m : ℕ) : Nodup (Ico n m) 
goal: (List.Ico n m).Nodup

full_name: List.Ico.mem
code: @[simp]
theorem mem {n m l : ℕ} : l ∈ Ico n m ↔ n ≤ l ∧ l < m 
goal: l ∈ List.Ico n m ↔ n ≤ l ∧ l < m

full_name: List.Ico.eq_nil_of_le
code: theorem eq_nil_of_le {n m : ℕ} (h : m ≤ n) : Ico n m = [] 
goal: List.Ico n m = []

full_name: List.Ico.map_add
code: theorem map_add (n m k : ℕ) : (Ico n m).map (k + ·) = Ico (n + k) (m + k) 
goal: List.map (fun x => k + x) (List.Ico n m) = List.Ico (n + k) (m + k)

full_name: List.Ico.map_sub
code: theorem map_sub (n m k : ℕ) (h₁ : k ≤ n) :
    ((Ico n m).map fun x => x - k) = Ico (n - k) (m - k) 
goal: List.map (fun x => x - k) (List.Ico n m) = List.Ico (n - k) (m - k)

full_name: List.Ico.self_empty
code: @[simp]
theorem self_empty {n : ℕ} : Ico n n = [] 
goal: List.Ico n n = []

full_name: List.Ico.eq_empty_iff
code: @[simp]
theorem eq_empty_iff {n m : ℕ} : Ico n m = [] ↔ m ≤ n 
goal: List.Ico n m = [] ↔ m ≤ n

full_name: List.Ico.append_consecutive
code: theorem append_consecutive {n m l : ℕ} (hnm : n ≤ m) (hml : m ≤ l) :
    Ico n m ++ Ico m l = Ico n l 
goal: List.Ico n m ++ List.Ico m l = List.Ico n l

full_name: List.Ico.inter_consecutive
code: @[simp]
theorem inter_consecutive (n m l : ℕ) : Ico n m ∩ Ico m l = [] 
goal: List.Ico n m ∩ List.Ico m l = []

full_name: List.Ico.bagInter_consecutive
code: @[simp]
theorem bagInter_consecutive (n m l : Nat) :
    @List.bagInter ℕ instBEqOfDecidableEq (Ico n m) (Ico m l) = [] 
goal: (List.Ico n m).bagInter (List.Ico m l) = []

full_name: List.Ico.succ_singleton
code: @[simp]
theorem succ_singleton {n : ℕ} : Ico n (n + 1) = [n] 
goal: List.Ico n (n + 1) = [n]

full_name: List.Ico.succ_top
code: theorem succ_top {n m : ℕ} (h : n ≤ m) : Ico n (m + 1) = Ico n m ++ [m] 
goal: List.Ico n (m + 1) = List.Ico n m ++ [m]

full_name: List.Ico.eq_cons
code: theorem eq_cons {n m : ℕ} (h : n < m) : Ico n m = n :: Ico (n + 1) m 
goal: List.Ico n m = n :: List.Ico (n + 1) m

full_name: List.Ico.pred_singleton
code: @[simp]
theorem pred_singleton {m : ℕ} (h : 0 < m) : Ico (m - 1) m = [m - 1] 
goal: List.Ico (m - 1) m = [m - 1]

full_name: List.Ico.chain'_succ
code: theorem chain'_succ (n m : ℕ) : Chain' (fun a b => b = succ a) (Ico n m) 
goal: List.Chain' (fun a b => b = a.succ) (List.Ico n m)

full_name: List.Ico.not_mem_top
code: theorem not_mem_top {n m : ℕ} : m ∉ Ico n m 
goal: m ∉ List.Ico n m

full_name: List.Ico.filter_lt_of_top_le
code: theorem filter_lt_of_top_le {n m l : ℕ} (hml : m ≤ l) :
    ((Ico n m).filter fun x => x < l) = Ico n m 
goal: List.filter (fun x => decide (x < l)) (List.Ico n m) = List.Ico n m

full_name: List.Ico.filter_lt_of_le_bot
code: theorem filter_lt_of_le_bot {n m l : ℕ} (hln : l ≤ n) : ((Ico n m).filter fun x => x < l) = [] 
goal: List.filter (fun x => decide (x < l)) (List.Ico n m) = []

full_name: List.Ico.filter_lt_of_ge
code: theorem filter_lt_of_ge {n m l : ℕ} (hlm : l ≤ m) :
    ((Ico n m).filter fun x => x < l) = Ico n l 
goal: List.filter (fun x => decide (x < l)) (List.Ico n m) = List.Ico n l

full_name: List.Ico.filter_lt
code: @[simp]
theorem filter_lt (n m l : ℕ) :
    ((Ico n m).filter fun x => x < l) = Ico n (min m l) 
goal: List.filter (fun x => decide (x < l)) (List.Ico n m) = List.Ico n (min m l)

full_name: List.Ico.filter_le_of_le_bot
code: theorem filter_le_of_le_bot {n m l : ℕ} (hln : l ≤ n) :
    ((Ico n m).filter fun x => l ≤ x) = Ico n m 
goal: List.filter (fun x => decide (l ≤ x)) (List.Ico n m) = List.Ico n m

full_name: List.Ico.filter_le_of_top_le
code: theorem filter_le_of_top_le {n m l : ℕ} (hml : m ≤ l) : ((Ico n m).filter fun x => l ≤ x) = [] 
goal: List.filter (fun x => decide (l ≤ x)) (List.Ico n m) = []

full_name: List.Ico.filter_le_of_le
code: theorem filter_le_of_le {n m l : ℕ} (hnl : n ≤ l) :
    ((Ico n m).filter fun x => l ≤ x) = Ico l m 
goal: List.filter (fun x => decide (l ≤ x)) (List.Ico n m) = List.Ico l m

full_name: List.Ico.filter_le
code: @[simp]
theorem filter_le (n m l : ℕ) : ((Ico n m).filter fun x => l ≤ x) = Ico (max n l) m 
goal: List.filter (fun x => decide (l ≤ x)) (List.Ico n m) = List.Ico (max n l) m

full_name: List.Ico.filter_lt_of_succ_bot
code: theorem filter_lt_of_succ_bot {n m : ℕ} (hnm : n < m) :
    ((Ico n m).filter fun x => x < n + 1) = [n] 
goal: List.filter (fun x => decide (x < n + 1)) (List.Ico n m) = [n]

full_name: List.Ico.filter_le_of_bot
code: @[simp]
theorem filter_le_of_bot {n m : ℕ} (hnm : n < m) : ((Ico n m).filter fun x => x ≤ n) = [n] 
goal: List.filter (fun x => decide (x ≤ n)) (List.Ico n m) = [n]

full_name: List.Ico.trichotomy
code: /-- For any natural numbers n, a, and b, one of the following holds:
1. n < a
2. n ≥ b
3. n ∈ Ico a b
-/
theorem trichotomy (n a b : ℕ) : n < a ∨ b ≤ n ∨ n ∈ Ico a b 
goal: n < a ∨ b ≤ n ∨ n ∈ List.Ico a b