The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.List.Range

9 declarations. Mathlib docs · Source

theorem List.ranges.match_1.congr_eq_1 E1 #

∀ (motive : List ℕ → Sort u_1) (x : List ℕ) (h_1 : Unit → motive []) (h_2 : (a : ℕ) → (l : List ℕ) → motive (a :: l)),
  x = [] →
    (match x with
      | [] => h_1 ()
      | a :: l => h_2 a l) ≍
      h_1 ()

theorem List.ranges.match_1.congr_eq_2 E1 #

∀ (motive : List ℕ → Sort u_1) (x : List ℕ) (h_1 : Unit → motive []) (h_2 : (a : ℕ) → (l : List ℕ) → motive (a :: l))
  (a : ℕ) (l : List ℕ),
  x = a :: l →
    (match x with
      | [] => h_1 ()
      | a :: l => h_2 a l) ≍
      h_2 a l

theorem List.getElem_range'_1 E1 #

∀ {n m : ℕ} (i : ℕ) (H : i < (List.range' n m).length), (List.range' n m)[i] = n + i

theorem List.isChain_range E1 #

∀ (r : ℕ → ℕ → Prop) (n : ℕ), List.IsChain r (List.range n) ↔ ∀ m < n - 1, r m m.succ

theorem List.isChain_range_succ E1 #

∀ (r : ℕ → ℕ → Prop) (n : ℕ), List.IsChain r (List.range n.succ) ↔ ∀ m < n, r m m.succ

theorem List.isChain_cons_range_succ E1 #

∀ (r : ℕ → ℕ → Prop) (n a : ℕ), List.IsChain r (a :: List.range n.succ) ↔ r a 0 ∧ ∀ m < n, r m m.succ

def List.ranges E1 #

List ℕ → List (List ℕ)

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]]

theorem List.ranges_disjoint E1 #

∀ (l : List ℕ), List.Pairwise List.Disjoint l.ranges

The members of l.ranges are pairwise disjoint

theorem List.ranges_length E1 #

∀ (l : List ℕ), List.map List.length l.ranges = l

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