Lemmas for tuples fin m → α
#
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file contains alternative definitions of common operators on vectors which expand
definitionally to the expected expression when evaluated on ![]
notation.
This allows "proof by reflection", where we prove f = ![f 0, f 1]
by defining
fin_vec.eta_expand f
to be equal to the RHS definitionally, and then prove that
f = eta_expand f
.
The definitions in this file should normally not be used directly; the intent is for the
corresponding *_eq
lemmas to be used in a place where they are definitionally unfolded.
Main definitions #
Evaluate fin_vec.seq f v = ![(f 0) (v 0), (f 1) (v 1), ...]
Equations
- fin_vec.seq f v = matrix.vec_cons (f 0 (v 0)) (fin_vec.seq (matrix.vec_tail f) (matrix.vec_tail v))
- fin_vec.seq f v = matrix.vec_empty
fin_vec.map f v = ![f (v 0), f (v 1), ...]
Equations
- fin_vec.map f = fin_vec.seq (λ (i : fin m), f)
Expand v
to ![v 0, v 1, ...]
Equations
This can be use to prove
∀
with better defeq for ∀ x : fin m → α, P x
.
Equations
- fin_vec.forall P = ∀ (x : α), fin_vec.forall (λ (v : fin n → α), P (matrix.vec_cons x v))
- fin_vec.forall P = P matrix.vec_empty
∃
with better defeq for ∃ x : fin m → α, P x
.
Equations
- fin_vec.exists P = ∃ (x : α), fin_vec.exists (λ (v : fin n → α), P (matrix.vec_cons x v))
- fin_vec.exists P = P matrix.vec_empty
finset.univ.sum
with better defeq for fin
Equations
- fin_vec.sum v = fin_vec.sum (v ∘ ⇑fin.cast_succ) + v (fin.last (n + 1))
- fin_vec.sum v = v 0
- fin_vec.sum v = 0
This can be used to prove
example [add_comm_monoid α] (a : fin 3 → α) : ∑ i, a i = a 0 + a 1 + a 2 :=
(sum_eq _).symm