The areas / V33. Data structures and computation
Mathlib.Data.Vector3
47 declarations. Mathlib docs · Source
theorem Fin2.insertPerm.match_1.congr_eq_4 E1 #
∀ (motive : (x : ℕ) → Fin2 x → Fin2 x → Sort u_1) (x : ℕ) (x_1 x_2 : Fin2 x)
(h_1 : (n : ℕ) → motive (n + 1) Fin2.fz Fin2.fz) (h_2 : (n : ℕ) → (j : Fin2 n) → motive (n + 1) Fin2.fz j.fs)
(h_3 : (a : ℕ) → (a_1 : Fin2 a.succ) → motive (a.succ + 1) a_1.fs Fin2.fz)
(h_4 : (a : ℕ) → (i : Fin2 a.succ) → (j : Fin2 (a + 1)) → motive (a.succ + 1) i.fs j.fs) (a : ℕ) (i : Fin2 a.succ)
(j : Fin2 (a + 1)),
x = a.succ + 1 →
x_1 ≍ i.fs →
x_2 ≍ j.fs →
(match x, x_1, x_2 with
| .(n + 1), Fin2.fz, Fin2.fz => h_1 n
| .(n + 1), Fin2.fz, j.fs => h_2 n j
| .(a.succ + 1), a_1.fs, Fin2.fz => h_3 a a_1
| .(a.succ + 1), i.fs, j.fs => h_4 a i j) ≍
h_4 a i j
theorem Fin2.cases'.match_1.congr_eq_1 E1 #
∀ {n : ℕ} (motive : Fin2 n.succ → Sort u_1) (x : Fin2 n.succ) (h_1 : Unit → motive Fin2.fz)
(h_2 : (n_1 : Fin2 n) → motive n_1.fs),
x = Fin2.fz →
(match x with
| Fin2.fz => h_1 ()
| n.fs => h_2 n) ≍
h_1 ()
theorem Fin2.insertPerm.match_1.congr_eq_2 E1 #
∀ (motive : (x : ℕ) → Fin2 x → Fin2 x → Sort u_1) (x : ℕ) (x_1 x_2 : Fin2 x)
(h_1 : (n : ℕ) → motive (n + 1) Fin2.fz Fin2.fz) (h_2 : (n : ℕ) → (j : Fin2 n) → motive (n + 1) Fin2.fz j.fs)
(h_3 : (a : ℕ) → (a_1 : Fin2 a.succ) → motive (a.succ + 1) a_1.fs Fin2.fz)
(h_4 : (a : ℕ) → (i : Fin2 a.succ) → (j : Fin2 (a + 1)) → motive (a.succ + 1) i.fs j.fs) (n : ℕ) (j : Fin2 n),
x = n + 1 →
x_1 ≍ Fin2.fz →
x_2 ≍ j.fs →
(match x, x_1, x_2 with
| .(n + 1), Fin2.fz, Fin2.fz => h_1 n
| .(n + 1), Fin2.fz, j.fs => h_2 n j
| .(a.succ + 1), a_1.fs, Fin2.fz => h_3 a a_1
| .(a.succ + 1), i.fs, j.fs => h_4 a i j) ≍
h_2 n j
theorem Fin2.insertPerm.match_1.congr_eq_1 E1 #
∀ (motive : (x : ℕ) → Fin2 x → Fin2 x → Sort u_1) (x : ℕ) (x_1 x_2 : Fin2 x)
(h_1 : (n : ℕ) → motive (n + 1) Fin2.fz Fin2.fz) (h_2 : (n : ℕ) → (j : Fin2 n) → motive (n + 1) Fin2.fz j.fs)
(h_3 : (a : ℕ) → (a_1 : Fin2 a.succ) → motive (a.succ + 1) a_1.fs Fin2.fz)
(h_4 : (a : ℕ) → (i : Fin2 a.succ) → (j : Fin2 (a + 1)) → motive (a.succ + 1) i.fs j.fs) (n : ℕ),
x = n + 1 →
x_1 ≍ Fin2.fz →
x_2 ≍ Fin2.fz →
(match x, x_1, x_2 with
| .(n + 1), Fin2.fz, Fin2.fz => h_1 n
| .(n + 1), Fin2.fz, j.fs => h_2 n j
| .(a.succ + 1), a_1.fs, Fin2.fz => h_3 a a_1
| .(a.succ + 1), i.fs, j.fs => h_4 a i j) ≍
h_1 n
theorem Fin2.insertPerm.match_1.congr_eq_3 E1 #
∀ (motive : (x : ℕ) → Fin2 x → Fin2 x → Sort u_1) (x : ℕ) (x_1 x_2 : Fin2 x)
(h_1 : (n : ℕ) → motive (n + 1) Fin2.fz Fin2.fz) (h_2 : (n : ℕ) → (j : Fin2 n) → motive (n + 1) Fin2.fz j.fs)
(h_3 : (a : ℕ) → (a_1 : Fin2 a.succ) → motive (a.succ + 1) a_1.fs Fin2.fz)
(h_4 : (a : ℕ) → (i : Fin2 a.succ) → (j : Fin2 (a + 1)) → motive (a.succ + 1) i.fs j.fs) (a : ℕ) (a_1 : Fin2 a.succ),
x = a.succ + 1 →
x_1 ≍ a_1.fs →
x_2 ≍ Fin2.fz →
(match x, x_1, x_2 with
| .(n + 1), Fin2.fz, Fin2.fz => h_1 n
| .(n + 1), Fin2.fz, j.fs => h_2 n j
| .(a.succ + 1), a_2.fs, Fin2.fz => h_3 a a_2
| .(a.succ + 1), i.fs, j.fs => h_4 a i j) ≍
h_3 a a_1
theorem Fin2.cases'.match_1.congr_eq_2 E1 #
∀ {n : ℕ} (motive : Fin2 n.succ → Sort u_1) (x : Fin2 n.succ) (h_1 : Unit → motive Fin2.fz)
(h_2 : (n_1 : Fin2 n) → motive n_1.fs) (n_1 : Fin2 n),
x = n_1.fs →
(match x with
| Fin2.fz => h_1 ()
| n.fs => h_2 n) ≍
h_2 n_1
def Vector3 E1 #
Type u → ℕ → Type u
Alternate definition of Vector based on Fin2.
instance instInhabitedVector3 E0 #
{α : Type u_1} → {n : ℕ} → [Inhabited α] → Inhabited (Vector3 α n)
def Vector3.nil E1 #
{α : Type u_1} → Vector3 α 0
The empty vector
def Vector3.cons E1 #
{α : Type u_1} → {n : ℕ} → α → Vector3 α n → Vector3 α (n + 1)
The vector cons operation
def Vector3.unexpandNil E1 #
Lean.PrettyPrinter.Unexpander
Unexpander for Vector3.nil
def Vector3.unexpandCons E1 #
Lean.PrettyPrinter.Unexpander
Unexpander for Vector3.cons
def Vector3.«term_::_» E1 #
Lean.TrailingParserDescr
The vector cons operation
theorem Vector3.cons_fz E0 #
∀ {α : Type u_1} {n : ℕ} (a : α) (v : Vector3 α n), Vector3.cons a v Fin2.fz = a
theorem Vector3.cons_fs E0 #
∀ {α : Type u_1} {n : ℕ} (a : α) (v : Vector3 α n) (i : Fin2 n), Vector3.cons a v i.fs = v i
abbrev Vector3.nth E1 #
{α : Type u_1} → {n : ℕ} → Fin2 n → Vector3 α n → α
Get the ith element of a vector
abbrev Vector3.ofFn E1 #
{α : Type u_1} → {n : ℕ} → (Fin2 n → α) → Vector3 α n
Construct a vector from a function on Fin2.
def Vector3.head E1 #
{α : Type u_1} → {n : ℕ} → Vector3 α (n + 1) → α
Get the head of a nonempty vector.
def Vector3.tail E1 #
{α : Type u_1} → {n : ℕ} → Vector3 α (n + 1) → Vector3 α n
Get the tail of a nonempty vector.
theorem Vector3.cons_head_tail E1 #
∀ {α : Type u_1} {n : ℕ} (v : Vector3 α (n + 1)), Vector3.cons v.head v.tail = v
def Vector3.nilElim E1 #
{α : Type u_1} → {C : Vector3 α 0 → Sort u} → C [] → (v : Vector3 α 0) → C v
Eliminator for an empty vector.
def Vector3.consElim E1 #
{α : Type u_1} →
{n : ℕ} →
{C : Vector3 α (n + 1) → Sort u} →
((a : α) → (t : Vector3 α n) → C (Vector3.cons a t)) → (v : Vector3 α (n + 1)) → C v
Recursion principle for a nonempty vector.
theorem Vector3.consElim_cons E0 #
∀ {α : 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 E1 #
{α : Type u_1} →
{C : {n : ℕ} → Vector3 α n → Sort u} →
{n : ℕ} → (v : Vector3 α n) → C [] → ({n : ℕ} → (a : α) → (w : Vector3 α n) → C w → C (Vector3.cons a w)) → C v
Recursion principle with the vector as first argument.
theorem Vector3.recOn_nil E0 #
∀ {α : 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
theorem Vector3.recOn_cons E0 #
∀ {α : 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)
def Vector3.append E1 #
{α : Type u_1} → {m n : ℕ} → Vector3 α m → Vector3 α n → Vector3 α (n + m)
Append two vectors
theorem Vector3.append_nil E0 #
∀ {α : Type u_1} {n : ℕ} (w : Vector3 α n), [].append w = w
theorem Vector3.append_cons E0 #
∀ {α : Type u_1} {m n : ℕ} (a : α) (v : Vector3 α m) (w : Vector3 α n),
(Vector3.cons a v).append w = Vector3.cons a (v.append w)
theorem Vector3.append_left E0 #
∀ {α : Type u_1} {m : ℕ} (i : Fin2 m) (v : Vector3 α m) {n : ℕ} (w : Vector3 α n), v.append w (Fin2.left n i) = v i
theorem Vector3.append_add E0 #
∀ {α : Type u_1} {m : ℕ} (v : Vector3 α m) {n : ℕ} (w : Vector3 α n) (i : Fin2 n), v.append w (i.add m) = w i
def Vector3.insert E1 #
{α : Type u_1} → {n : ℕ} → α → Vector3 α n → Fin2 (n + 1) → Vector3 α (n + 1)
Insert a into v at index i.
theorem Vector3.insert_fz E0 #
∀ {α : Type u_1} {n : ℕ} (a : α) (v : Vector3 α n), Vector3.insert a v Fin2.fz = Vector3.cons a v
theorem Vector3.insert_fs E0 #
∀ {α : 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 Vector3.append_insert E1 #
∀ {α : Type u_1} {m n : ℕ} (a : α) (t : Vector3 α m) (v : Vector3 α n) (i : Fin2 (n + 1)) (e : n + 1 + m = n + m + 1),
Vector3.insert a (t.append v) (Eq.recOn e (i.add m)) = Eq.recOn e (t.append (Vector3.insert a v i))
def VectorEx E1 #
{α : Type u_1} → (k : ℕ) → (Vector3 α k → Prop) → Prop
"Curried" exists, i.e. ∃ x₁ ... xₙ, f [x₁, ..., xₙ].
def VectorAll E1 #
{α : Type u_1} → (k : ℕ) → (Vector3 α k → Prop) → Prop
"Curried" forall, i.e. ∀ x₁ ... xₙ, f [x₁, ..., xₙ].
theorem exists_vector_zero E1 #
∀ {α : Type u_1} (f : Vector3 α 0 → Prop), Exists f ↔ f []
theorem exists_vector_succ E1 #
∀ {α : Type u_1} {n : ℕ} (f : Vector3 α n.succ → Prop), Exists f ↔ ∃ x v, f (Vector3.cons x v)
theorem vectorEx_iff_exists E1 #
∀ {α : Type u_1} {n : ℕ} (f : Vector3 α n → Prop), VectorEx n f ↔ Exists f
theorem vectorAll_iff_forall E1 #
∀ {α : Type u_1} {n : ℕ} (f : Vector3 α n → Prop), VectorAll n f ↔ ∀ (v : Vector3 α n), f v
def VectorAllP E1 #
{α : Type u_1} → {n : ℕ} → (α → Prop) → Vector3 α n → Prop
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.
theorem vectorAllP_nil E0 #
∀ {α : Type u_1} (p : α → Prop), VectorAllP p [] = True
theorem vectorAllP_singleton E0 #
∀ {α : Type u_1} (p : α → Prop) (x : α), VectorAllP p [x] = p x
theorem vectorAllP_cons E0 #
∀ {α : 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 E1 #
∀ {α : Type u_1} {n : ℕ} (p : α → Prop) (v : Vector3 α n), VectorAllP p v ↔ ∀ (i : Fin2 n), p (v i)
theorem VectorAllP.imp E1 #
∀ {α : Type u_1} {n : ℕ} {p q : α → Prop}, (∀ (x : α), p x → q x) → ∀ {v : Vector3 α n}, VectorAllP p v → VectorAllP q v