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.Vector.Mem

15 declarations. Mathlib docs · Source

Theorems about membership of elements in vectors

This file contains theorems for membership in a v.toList for a vector v. Having the length available in the type allows some of the lemmas to be simpler and more general than the original version for lists. In particular we can avoid some assumptions about types being Inhabited, and make more general statements about head and tail.

theorem List.Vector.get_mem E0 #

∀ {α : Type u_1} {n : ℕ} (i : Fin n) (v : List.Vector α n), v.get i ∈ v.toList

theorem List.Vector.mem_iff_get E0 #

∀ {α : Type u_1} {n : ℕ} (a : α) (v : List.Vector α n), a ∈ v.toList ↔ ∃ i, v.get i = a

theorem List.Vector.notMem_nil E1 #

∀ {α : Type u_1} (a : α), a ∉ List.Vector.nil.toList

theorem List.Vector.notMem_zero E1 #

∀ {α : Type u_1} (a : α) (v : List.Vector α 0), a ∉ v.toList

theorem List.Vector.mem_cons_iff E0 #

∀ {α : Type u_1} {n : ℕ} (a a' : α) (v : List.Vector α n), a' ∈ (a ::ᵥ v).toList ↔ a' = a ∨ a' ∈ v.toList

theorem List.Vector.mem_succ_iff E0 #

∀ {α : Type u_1} {n : ℕ} (a : α) (v : List.Vector α (n + 1)), a ∈ v.toList ↔ a = v.head ∨ a ∈ v.tail.toList

theorem List.Vector.mem_cons_self E0 #

∀ {α : Type u_1} {n : ℕ} (a : α) (v : List.Vector α n), a ∈ (a ::ᵥ v).toList

theorem List.Vector.head_mem E0 #

∀ {α : Type u_1} {n : ℕ} (v : List.Vector α (n + 1)), v.head ∈ v.toList

theorem List.Vector.mem_cons_of_mem E0 #

∀ {α : Type u_1} {n : ℕ} (a a' : α) (v : List.Vector α n), a' ∈ v.toList → a' ∈ (a ::ᵥ v).toList

theorem List.Vector.mem_of_mem_tail E0 #

∀ {α : Type u_1} {n : ℕ} (a : α) (v : List.Vector α n), a ∈ v.tail.toList → a ∈ v.toList

theorem List.Vector.head_pmap E0 #

∀ {α : Type u_1} {β : Type u_2} {n : ℕ} {p : α → Prop} (f : (a : α) → p a → β) (v : List.Vector α (n + 1))
  (hp : ∀ x ∈ v.toList, p x), (List.Vector.pmap f v hp).head = f v.head ⋯

theorem List.Vector.tail_pmap E0 #

∀ {α : Type u_1} {β : Type u_2} {n : ℕ} {p : α → Prop} (f : (a : α) → p a → β) (v : List.Vector α (n + 1))
  (hp : ∀ x ∈ v.toList, p x), (List.Vector.pmap f v hp).tail = List.Vector.pmap f v.tail ⋯

theorem List.Vector.mem_map_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {n : ℕ} (b : β) (v : List.Vector α n) (f : α → β),
  b ∈ (List.Vector.map f v).toList ↔ ∃ a ∈ v.toList, f a = b

theorem List.Vector.notMem_map_zero E1 #

∀ {α : Type u_1} {β : Type u_2} (b : β) (v : List.Vector α 0) (f : α → β), b ∉ (List.Vector.map f v).toList

theorem List.Vector.mem_map_succ_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {n : ℕ} (b : β) (v : List.Vector α (n + 1)) (f : α → β),
  b ∈ (List.Vector.map f v).toList ↔ f v.head = b ∨ ∃ a ∈ v.tail.toList, f a = b