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

11 declarations. Mathlib docs · Source

theorem Nat.iterate.match_1.congr_eq_2 E1 #

∀ {α : Sort u_2} (motive : ℕ → α → Sort u_1) (x : ℕ) (x_1 : α) (h_1 : (a : α) → motive 0 a)
  (h_2 : (k : ℕ) → (a : α) → motive k.succ a) (k : ℕ) (a : α),
  x = k.succ →
    x_1 = a →
      (match x, x_1 with
        | 0, a => h_1 a
        | k.succ, a => h_2 k a) ≍
        h_2 k a

theorem Nat.iterate.match_1.congr_eq_1 E1 #

∀ {α : Sort u_2} (motive : ℕ → α → Sort u_1) (x : ℕ) (x_1 : α) (h_1 : (a : α) → motive 0 a)
  (h_2 : (k : ℕ) → (a : α) → motive k.succ a) (a : α),
  x = 0 →
    x_1 = a →
      (match x, x_1 with
        | 0, a => h_1 a
        | k.succ, a => h_2 k a) ≍
        h_1 a

theorem List.length_iterate E0 #

∀ {α : Type u_1} (f : α → α) (a : α) (n : ℕ), (List.iterate f a n).length = n

theorem List.iterate_eq_nil E0 #

∀ {α : Type u_1} {f : α → α} {a : α} {n : ℕ}, List.iterate f a n = [] ↔ n = 0

theorem List.getElem?_iterate E1 #

∀ {α : Type u_1} (f : α → α) (a : α) (n i : ℕ), i < n → (List.iterate f a n)[i]? = some (f^[i] a)

theorem List.getElem_iterate E0 #

∀ {α : Type u_1} (f : α → α) (a : α) (n i : ℕ) (h : i < (List.iterate f a n).length), (List.iterate f a n)[i] = f^[i] a

theorem List.getLast_iterate E0 #

∀ {α : Type u_1} (f : α → α) (a : α) (n : ℕ) (h : List.iterate f a n ≠ []), (List.iterate f a n).getLast h = f^[n - 1] a

theorem List.mem_iterate E0 #

∀ {α : Type u_1} {f : α → α} {a : α} {n : ℕ} {b : α}, b ∈ List.iterate f a n ↔ ∃ m < n, b = f^[m] a

theorem List.range_map_iterate E0 #

∀ {α : Type u_1} (n : ℕ) (f : α → α) (a : α), List.map (fun x ↦ f^[x] a) (List.range n) = List.iterate f a n

theorem List.iterate_add E1 #

∀ {α : Type u_1} (f : α → α) (a : α) (m n : ℕ),
  List.iterate f a (m + n) = List.iterate f a m ++ List.iterate f (f^[m] a) n

theorem List.take_iterate E1 #

∀ {α : Type u_1} (f : α → α) (a : α) (m n : ℕ), List.take m (List.iterate f a n) = List.iterate f a (min m n)