Alternate definition of Vector
in terms of Fin2
#
This file provides a locale 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
.
@[match_pattern]
The empty vector
Equations
Instances For
@[match_pattern]
The vector cons operation
Equations
- Vector3.cons a v i = Fin2.cases' a v i
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The vector cons operation
Equations
- Vector3.«term_::_» = Lean.ParserDescr.trailingNode `Vector3.«term_::_» 1022 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " :: ") (Lean.ParserDescr.cat `term 0))
Instances For
@[reducible, inline]
Construct a vector from a function on Fin2
.
Equations
- Vector3.ofFn f = f
Instances For
def
Vector3.recOn
{α : Type u_1}
{C : {n : ℕ} → Vector3 α n → Sort u}
{n : ℕ}
(v : Vector3 α n)
(H0 : C [])
(Hs : {n : ℕ} → (a : α) → (w : Vector3 α n) → C w → C (cons a w))
:
C v
Recursion principle with the vector as first argument.
Equations
- v_2.recOn H0 Hs = Vector3.nilElim H0 v_2
- v_2.recOn H0 Hs = Vector3.consElim (fun (a : α) (t : Vector3 α n_2) => Hs a t (t.recOn H0 fun {n : ℕ} => Hs)) v_2
Instances For
Insert a
into v
at index i
.
Equations
- Vector3.insert a v i j = Vector3.cons a v (i.insertPerm j)
Instances For
theorem
exists_vector_succ
{α : Type u_1}
{n : ℕ}
(f : Vector3 α n.succ → Prop)
:
Exists f ↔ ∃ (x : α) (v : Vector3 α n), f (Vector3.cons x v)
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
.
Equations
Instances For
@[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