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

20 declarations. Mathlib docs · Source

theorem List.reduceOption_cons_of_some E0 #

∀ {α : Type u_1} (x : α) (l : List (Option α)), (some x :: l).reduceOption = x :: l.reduceOption

theorem List.reduceOption_cons_of_none E0 #

∀ {α : Type u_1} (l : List (Option α)), (none :: l).reduceOption = l.reduceOption

theorem List.reduceOption_nil E0 #

∀ {α : Type u_1}, [].reduceOption = []

theorem List.reduceOption_map E0 #

∀ {α : Type u_1} {β : Type u_2} {l : List (Option α)} {f : α → β},
  (List.map (Option.map f) l).reduceOption = List.map f l.reduceOption

theorem List.reduceOption_append E1 #

∀ {α : Type u_1} (l l' : List (Option α)), (l ++ l').reduceOption = l.reduceOption ++ l'.reduceOption

theorem List.reduceOption_replicate_none E0 #

∀ {α : Type u_1} {n : ℕ}, (List.replicate n none).reduceOption = []

theorem List.reduceOption_eq_nil_iff E0 #

∀ {α : Type u_1} (l : List (Option α)), l.reduceOption = [] ↔ ∃ n, l = List.replicate n none

theorem List.reduceOption_eq_singleton_iff E0 #

∀ {α : Type u_1} (l : List (Option α)) (a : α),
  l.reduceOption = [a] ↔ ∃ m n, l = List.replicate m none ++ some a :: List.replicate n none

theorem List.reduceOption_eq_append_iff E0 #

∀ {α : Type u_1} (l : List (Option α)) (l'₁ l'₂ : List α),
  l.reduceOption = l'₁ ++ l'₂ ↔ ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.reduceOption = l'₁ ∧ l₂.reduceOption = l'₂

theorem List.reduceOption_eq_concat_iff E0 #

∀ {α : Type u_1} (l : List (Option α)) (l' : List α) (a : α),
  l.reduceOption = l'.concat a ↔ ∃ l₁ l₂, l = l₁ ++ some a :: l₂ ∧ l₁.reduceOption = l' ∧ l₂.reduceOption = []

theorem List.reduceOption_length_eq E0 #

∀ {α : Type u_1} {l : List (Option α)}, l.reduceOption.length = (List.filter Option.isSome l).length

theorem List.length_eq_reduceOption_length_add_filter_none E1 #

∀ {α : Type u_1} {l : List (Option α)}, l.length = l.reduceOption.length + (List.filter Option.isNone l).length

theorem List.reduceOption_length_le E1 #

∀ {α : Type u_1} (l : List (Option α)), l.reduceOption.length ≤ l.length

theorem List.reduceOption_length_eq_iff E0 #

∀ {α : Type u_1} {l : List (Option α)}, l.reduceOption.length = l.length ↔ ∀ x ∈ l, x.isSome = true

theorem List.reduceOption_length_lt_iff E0 #

∀ {α : Type u_1} {l : List (Option α)}, l.reduceOption.length < l.length ↔ none ∈ l

theorem List.reduceOption_singleton E1 #

∀ {α : Type u_1} (x : Option α), [x].reduceOption = x.toList

theorem List.reduceOption_concat E1 #

∀ {α : Type u_1} (l : List (Option α)) (x : Option α), (l.concat x).reduceOption = l.reduceOption ++ x.toList

theorem List.reduceOption_concat_of_some E1 #

∀ {α : Type u_1} (l : List (Option α)) (x : α), (l.concat (some x)).reduceOption = l.reduceOption.concat x

theorem List.reduceOption_mem_iff E0 #

∀ {α : Type u_1} {l : List (Option α)} {x : α}, x ∈ l.reduceOption ↔ some x ∈ l

theorem List.reduceOption_getElem?_iff E0 #

∀ {α : Type u_1} {l : List (Option α)} {x : α}, (∃ i, l[i]? = some (some x)) ↔ ∃ i, l.reduceOption[i]? = some x