Alternate definition of Vector in terms of Fin2 #
This file provides a scope Vector3 which overrides the [a, b, c] notation to create a Vector3
instead of a List.
The :: notation is also overloaded by this file to mean Vector3.cons.
@[implicit_reducible]
@[match_pattern]
The empty vector
Instances For
@[match_pattern]
The vector cons operation
Instances For
Unexpander for Vector3.nil
Instances For
Unexpander for Vector3.cons
Instances For
The vector cons operation
Instances For
@[simp]
@[simp]
@[reducible, inline]
Get the ith element of a vector
Instances For
Get the head of a nonempty vector.
Instances For
Get the tail of a nonempty vector.
Instances For
Eliminator for an empty vector.
Instances For
Append two vectors
Instances For
@[simp]
@[simp]
@[simp]
@[simp]
def
Vector3.insert
{α : Type u_1}
{n : ℕ}
(a : α)
(v : Vector3 α n)
(i : Fin2 (n + 1))
:
Vector3 α (n + 1)
Insert a into v at index i.
Instances For
@[simp]
theorem
exists_vector_succ
{α : Type u_1}
{n : ℕ}
(f : Vector3 α n.succ → Prop)
:
Exists f ↔ ∃ (x : α) (v : Vector3 α n), f (Vector3.cons x v)
theorem
vectorEx_iff_exists
{α : Type u_1}
{n : ℕ}
(f : Vector3 α n → Prop)
:
VectorEx n f ↔ Exists f
VectorAllP p v is equivalent to ∀ i, p (v i), but unfolds directly to a conjunction,
i.e. VectorAllP p [0, 1, 2] = p 0 ∧ p 1 ∧ p 2.
Instances For
@[simp]
@[simp]
@[simp]
theorem
vectorAllP_cons
{α : Type u_1}
{n : ℕ}
(p : α → Prop)
(x : α)
(v : Vector3 α n)
:
VectorAllP p (Vector3.cons x v) ↔ p x ∧ VectorAllP p v
theorem
vectorAllP_iff_forall
{α : Type u_1}
{n : ℕ}
(p : α → Prop)
(v : Vector3 α n)
:
VectorAllP p v ↔ ∀ (i : Fin2 n), p (v i)
theorem
VectorAllP.imp
{α : Type u_1}
{n : ℕ}
{p q : α → Prop}
(h : ∀ (x : α), p x → q x)
{v : Vector3 α n}
(al : VectorAllP p v)
:
VectorAllP q v