mathlib documentation

data.list.range

@[simp]
theorem list.length_range' (s n : ℕ) :

@[simp]
theorem list.mem_range' {m s n : ℕ} :
m ∈ list.range' s n ↔ s ≤ m ∧ m < s + n

theorem list.map_add_range' (a s n : ℕ) :

theorem list.map_sub_range' (a s n : ℕ) (h : a ≤ s) :
list.map (λ (x : ℕ), x - a) (list.range' s n) = list.range' (s - a) n

theorem list.chain_succ_range' (s n : ℕ) :
list.chain (λ (a b : ℕ), b = a.succ) s (list.range' (s + 1) n)

theorem list.nodup_range' (s n : ℕ) :

@[simp]
theorem list.range'_append (s m n : ℕ) :
list.range' s m ++ list.range' (s + m) n = list.range' s (n + m)

theorem list.nth_range' (s : ℕ) {m n : ℕ} (a : m < n) :
(list.range' s n).nth m = some (s + m)

theorem list.range'_concat (s n : ℕ) :
list.range' s (n + 1) = list.range' s n ++ [s + n]

@[simp]
theorem list.length_range (n : ℕ) :

theorem list.nodup_range (n : ℕ) :

@[simp]
theorem list.mem_range {m n : ℕ} :

@[simp]
theorem list.not_mem_range_self {n : ℕ} :

@[simp]
theorem list.self_mem_range_succ (n : ℕ) :
n ∈ list.range (n + 1)

theorem list.nth_range {m n : ℕ} (h : m < n) :

@[simp]
theorem list.length_iota (n : ℕ) :

theorem list.nodup_iota (n : ℕ) :

theorem list.mem_iota {m n : ℕ} :
m ∈ list.iota n ↔ 1 ≤ m ∧ m ≤ n

theorem list.reverse_range' (s n : ℕ) :
(list.range' s n).reverse = list.map (λ (i : ℕ), s + n - 1 - i) (list.range n)

def list.fin_range (n : ℕ) :
list (fin n)

All elements of fin n, from 0 to n-1.

Equations
@[simp]
theorem list.mem_fin_range {n : ℕ} (a : fin n) :

@[simp]

theorem list.prod_range_succ {α : Type u} [monoid α] (f : ℕ → α) (n : ℕ) :

theorem list.sum_range_succ {α : Type u} [add_monoid α] (f : ℕ → α) (n : ℕ) :

theorem list.prod_range_succ' {α : Type u} [monoid α] (f : ℕ → α) (n : ℕ) :
(list.map f (list.range n.succ)).prod = (f 0) * (list.map (λ (i : ℕ), f i.succ) (list.range n)).prod

A variant of prod_range_succ which pulls off the first term in the product rather than the last.

theorem list.sum_range_succ' {α : Type u} [add_monoid α] (f : ℕ → α) (n : ℕ) :
(list.map f (list.range n.succ)).sum = f 0 + (list.map (λ (i : ℕ), f i.succ) (list.range n)).sum

A variant of sum_range_succ which pulls off the first term in the sum rather than the last.

@[simp]
theorem list.enum_from_map_fst {α : Type u} (n : ℕ) (l : list α) :

@[simp]
theorem list.enum_map_fst {α : Type u} (l : list α) :

@[simp]
theorem list.nth_le_range {n : ℕ} (i : ℕ) (H : i < (list.range n).length) :
(list.range n).nth_le i H = i

theorem list.of_fn_eq_pmap {α : Type u_1} {n : ℕ} {f : fin n → α} :
list.of_fn f = list.pmap (λ (i : ℕ) (hi : i < n), f ⟨i, hi⟩) (list.range n) _

theorem list.nodup_of_fn {α : Type u_1} {n : ℕ} {f : fin n → α} (hf : function.injective f) :