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.SplitLengths

14 declarations. Mathlib docs · Source

theorem List.splitLengths.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : List α × List α → Sort u_2) (x : List α × List α) (h_1 : (x0 x1 : List α) → motive (x0, x1))
  (x0 x1 : List α),
  x = (x0, x1) →
    (match x with
      | (x0, x1) => h_1 x0 x1) ≍
      h_1 x0 x1

theorem List.splitLengths.match_3.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : List ℕ → List α → Sort u_2) (x : List ℕ) (x_1 : List α) (h_1 : (x : List α) → motive [] x)
  (h_2 : (n : ℕ) → (ns : List ℕ) → (x : List α) → motive (n :: ns) x) (x_2 : List α),
  x = [] →
    x_1 = x_2 →
      (match x, x_1 with
        | [], x => h_1 x
        | n :: ns, x => h_2 n ns x) ≍
        h_1 x_2

theorem List.splitLengths.match_3.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : List ℕ → List α → Sort u_2) (x : List ℕ) (x_1 : List α) (h_1 : (x : List α) → motive [] x)
  (h_2 : (n : ℕ) → (ns : List ℕ) → (x : List α) → motive (n :: ns) x) (n : ℕ) (ns : List ℕ) (x_2 : List α),
  x = n :: ns →
    x_1 = x_2 →
      (match x, x_1 with
        | [], x => h_1 x
        | n :: ns, x => h_2 n ns x) ≍
        h_2 n ns x_2

def List.splitLengths E1 #

{α : Type u_1} → List ℕ → List α → List (List α)

Split a list to chunks of given lengths.

theorem List.length_splitLengths E0 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ), (sz.splitLengths l).length = sz.length

theorem List.splitLengths_nil E0 #

∀ {α : Type u_1} (l : List α), [].splitLengths l = []

theorem List.splitLengths_cons E0 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ) (n : ℕ),
  (n :: sz).splitLengths l = List.take n l :: sz.splitLengths (List.drop n l)

theorem List.take_splitLength E1 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ) (i : ℕ), List.take i (sz.splitLengths l) = (List.take i sz).splitLengths l

theorem List.length_splitLengths_getElem_le E1 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ) {i : ℕ} {hi : i < (sz.splitLengths l).length},
  (sz.splitLengths l)[i].length ≤ sz[i]

theorem List.flatten_splitLengths E1 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ), l.length ≤ sz.sum → (sz.splitLengths l).flatten = l

theorem List.map_splitLengths_length E0 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ), sz.sum ≤ l.length → List.map List.length (sz.splitLengths l) = sz

theorem List.length_splitLengths_getElem_eq E0 #

∀ {α : Type u_1} (l : List α) (sz : List ℕ) {i : ℕ} (hi : i < sz.length),
  (List.take (i + 1) sz).sum ≤ l.length → (sz.splitLengths l)[i].length = sz[i]

theorem List.splitLengths_length_getElem E1 #

∀ {α : Type u_2} (l : List α) (sz : List ℕ),
  sz.sum ≤ l.length → ∀ (i : ℕ) (hi : i < (sz.splitLengths l).length), (sz.splitLengths l)[i].length = sz[i]

theorem List.length_mem_splitLengths E1 #

∀ {α : Type u_2} (l : List α) (sz : List ℕ) (b : ℕ), (∀ n ∈ sz, n ≤ b) → ∀ l₂ ∈ sz.splitLengths l, l₂.length ≤ b