Documentation

Mathlib.Data.List.Range

Ranges of naturals as lists #

This file shows basic results about List.iota, List.range, List.range' and defines List.finRange. finRange n is the list of elements of Fin n. iota n = [n, n - 1, ..., 1] and range n = [0, ..., n - 1] are basic list constructions used for tactics. range' a b = [a, ..., a + b - 1] is there to help prove properties about them. Actual maths should use List.Ico instead.

theorem List.getElem_range'_1 {n m : ℕ} (i : ℕ) (H : i < (List.range' n m).length) :
(List.range' n m)[i] = n + i
theorem List.chain'_range_succ (r : ℕ → ℕ → Prop) (n : ℕ) :
List.Chain' r (List.range n.succ) ↔ ∀ (m : ℕ), m < n → r m m.succ
theorem List.chain_range_succ (r : ℕ → ℕ → Prop) (n a : ℕ) :
List.Chain r a (List.range n.succ) ↔ r a 0 ∧ ∀ (m : ℕ), m < n → r m m.succ
@[deprecated List.get_range']
theorem List.nthLe_range' {n m step : ℕ} (i : ℕ) (H : i < (List.range' n m step).length) :
(List.range' n m step).get ⟨i, H⟩ = n + step * i

Alias of List.get_range'.

@[deprecated List.getElem_range'_1]
theorem List.nthLe_range'_1 {n m : ℕ} (i : ℕ) (H : i < (List.range' n m).length) :
(List.range' n m)[i] = n + i

Alias of List.getElem_range'_1.

@[deprecated List.get_range]
theorem List.nthLe_range {n : ℕ} (i : ℕ) (H : i < (List.range n).length) :
(List.range n).get ⟨i, H⟩ = i

Alias of List.get_range.

From l : List ℕ, construct l.ranges : List (List ℕ) such that l.ranges.map List.length = l and l.ranges.join = range l.sum

  • Example: [1,2,3].ranges = [[0],[1,2],[3,4,5]]
Equations
Instances For
    theorem List.ranges_disjoint (l : List ℕ) :
    List.Pairwise List.Disjoint l.ranges

    The members of l.ranges are pairwise disjoint

    theorem List.ranges_length (l : List ℕ) :
    List.map List.length l.ranges = l

    The lengths of the members of l.ranges are those given by l

    @[deprecated]
    theorem List.ranges_flatten' (l : List ℕ) :
    l.ranges.flatten = List.range (Nat.sum l)

    See List.ranges_flatten for the version about List.sum.

    @[deprecated List.ranges_flatten']
    theorem List.ranges_join' (l : List ℕ) :
    l.ranges.flatten = List.range (Nat.sum l)

    Alias of List.ranges_flatten'.


    See List.ranges_flatten for the version about List.sum.

    @[deprecated]
    theorem List.mem_mem_ranges_iff_lt_natSum (l : List ℕ) {n : ℕ} :
    (∃ (s : List ℕ), s ∈ l.ranges ∧ n ∈ s) ↔ n < Nat.sum l

    Any entry of any member of l.ranges is strictly smaller than Nat.sum l. See List.mem_mem_ranges_iff_lt_sum for the version about List.sum.