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

7 declarations. Mathlib docs · Source

theorem List.mapIdxMAux'.match_1.congr_eq_1 E1 #

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

theorem List.mapIdxMAux'.match_1.congr_eq_2 E1 #

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

theorem List.mapIdx_append_one E1 #

∀ {α : Type u} {β : Type v} {f : ℕ → α → β} {l : List α} {e : α},
  List.mapIdx f (l ++ [e]) = List.mapIdx f l ++ [f l.length e]

theorem List.mapIdx_eq_ofFn E1 #

∀ {α : Type u} {β : Type v} (l : List α) (f : ℕ → α → β), List.mapIdx f l = List.ofFn fun i ↦ f (↑i) (l.get i)

theorem List.mapIdx_replicate E1 #

∀ {α : Type u} {β : Type v} (f : ℕ → α → β) (n : ℕ) (a : α),
  List.mapIdx f (List.replicate n a) = List.map (fun n ↦ f n a) (List.range n)

theorem List.mapIdxMAux'_eq_mapIdxMGo E1 #

∀ {m : Type u → Type v} [inst : Monad m] [LawfulMonad m] {α : Type u_1} (f : ℕ → α → m PUnit.{u + 1}) (as : List α)
  (arr : Array PUnit.{u + 1}), List.mapIdxMAux' f arr.size as = List.mapIdxM.go f as arr *> pure PUnit.unit

theorem List.mapIdxM'_eq_mapIdxM E1 #

∀ {m : Type u → Type v} [inst : Monad m] [LawfulMonad m] {α : Type u_1} (f : ℕ → α → m PUnit.{u + 1}) (as : List α),
  List.mapIdxM' f as = List.mapIdxM f as *> pure PUnit.unit