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
@[simp]
theorem
Vector3.cons_fz
{α : Type u_1}
{n : ℕ}
(a : α)
(v : Vector3 α n)
:
Vector3.cons a v Fin2.fz = a
@[simp]
theorem
Vector3.cons_fs
{α : Type u_1}
{n : ℕ}
(a : α)
(v : Vector3 α n)
(i : Fin2 n)
:
Vector3.cons a v i.fs = v i
@[reducible, inline]
Construct a vector from a function on Fin2
.
Equations
- Vector3.ofFn f = f
Instances For
theorem
Vector3.cons_head_tail
{α : Type u_1}
{n : ℕ}
(v : Vector3 α (n + 1))
:
Vector3.cons v.head v.tail = v
def
Vector3.consElim
{α : Type u_1}
{n : ℕ}
{C : Vector3 α (n + 1) → Sort u}
(H : (a : α) → (t : Vector3 α n) → C (Vector3.cons a t))
(v : Vector3 α (n + 1))
:
C v
Recursion principle for a nonempty vector.
Equations
- Vector3.consElim H v = ⋯.mpr (H v.head v.tail)
Instances For
@[simp]
theorem
Vector3.consElim_cons
{α : Type u_1}
{n : ℕ}
{C : Vector3 α (n + 1) → Sort u_2}
{H : (a : α) → (t : Vector3 α n) → C (Vector3.cons a t)}
{a : α}
{t : Vector3 α n}
:
Vector3.consElim H (Vector3.cons a t) = H a t
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 (Vector3.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
@[simp]
theorem
Vector3.recOn_nil
{α : Type u_1}
{C : {n : ℕ} → Vector3 α n → Sort u_2}
{H0 : C []}
{Hs : {n : ℕ} → (a : α) → (w : Vector3 α n) → C w → C (Vector3.cons a w)}
:
[].recOn H0 Hs = H0
@[simp]
theorem
Vector3.recOn_cons
{α : Type u_1}
{C : {n : ℕ} → Vector3 α n → Sort u_2}
{H0 : C []}
{Hs : {n : ℕ} → (a : α) → (w : Vector3 α n) → C w → C (Vector3.cons a w)}
{n : ℕ}
{a : α}
{v : Vector3 α n}
:
(Vector3.cons a v).recOn H0 Hs = Hs a v (v.recOn H0 Hs)
@[simp]
theorem
Vector3.append_cons
{α : Type u_1}
{m n : ℕ}
(a : α)
(v : Vector3 α m)
(w : Vector3 α n)
:
(Vector3.cons a v).append w = Vector3.cons a (v.append w)
Insert a
into v
at index i
.
Equations
- Vector3.insert a v i j = Vector3.cons a v (i.insertPerm j)
Instances For
@[simp]
theorem
Vector3.insert_fz
{α : Type u_1}
{n : ℕ}
(a : α)
(v : Vector3 α n)
:
Vector3.insert a v Fin2.fz = Vector3.cons a v
@[simp]
theorem
Vector3.insert_fs
{α : Type u_1}
{n : ℕ}
(a b : α)
(v : Vector3 α n)
(i : Fin2 (n + 1))
:
Vector3.insert a (Vector3.cons b v) i.fs = Vector3.cons b (Vector3.insert a v i)
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