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
.
@[simp]
theorem
Mathlib.Vector.get_mem
{α : Type u_1}
{n : ℕ}
(i : Fin n)
(v : Mathlib.Vector α n)
:
v.get i ∈ v.toList
@[simp]
theorem
Mathlib.Vector.head_mem
{α : Type u_1}
{n : ℕ}
(v : Mathlib.Vector α (n + 1))
:
v.head ∈ v.toList
theorem
Mathlib.Vector.mem_cons_of_mem
{α : Type u_1}
{n : ℕ}
(a a' : α)
(v : Mathlib.Vector α n)
(ha' : a' ∈ v.toList)
:
theorem
Mathlib.Vector.mem_of_mem_tail
{α : Type u_1}
{n : ℕ}
(a : α)
(v : Mathlib.Vector α n)
(ha : a ∈ v.tail.toList)
:
a ∈ v.toList
theorem
Mathlib.Vector.mem_map_iff
{α : Type u_1}
{β : Type u_2}
{n : ℕ}
(b : β)
(v : Mathlib.Vector α n)
(f : α → β)
:
b ∈ (Mathlib.Vector.map f v).toList ↔ ∃ a ∈ v.toList, f a = b
theorem
Mathlib.Vector.not_mem_map_zero
{α : Type u_1}
{β : Type u_2}
(b : β)
(v : Mathlib.Vector α 0)
(f : α → β)
:
b ∉ (Mathlib.Vector.map f v).toList
theorem
Mathlib.Vector.mem_map_succ_iff
{α : Type u_1}
{β : Type u_2}
{n : ℕ}
(b : β)
(v : Mathlib.Vector α (n + 1))
(f : α → β)
: