Matrix and vector notation
This file defines notation for vectors and matrices. Given a b c d : α
,
the notation allows us to write ![a, b, c, d] : fin 4 → α
.
Nesting vectors gives a matrix, so ![![a, b], ![c, d]] : matrix (fin 2) (fin 2) α
.
This file includes simp
lemmas for applying operations in
data.matrix.basic
to values built out of this notation.
Main definitions
vec_empty
is the empty vector (or0
byn
matrix)![]
vec_cons
prepends an entry to a vector, so![a, b]
isvec_cons a (vec_cons b vec_empty)
Implementation notes
The simp
lemmas require that one of the arguments is of the form vec_cons _ _
.
This ensures simp
works with entries only when (some) entries are already given.
In other words, this notation will only appear in the output of simp
if it
already appears in the input.
Notations
The main new notation is ![a, b]
, which gets expanded to vec_cons a (vec_cons b vec_empty)
.
![]
is the vector with no entries.
Equations
vec_cons h t
prepends an entry h
to a vector t
.
The inverse functions are vec_head
and vec_tail
.
The notation ![a, b, ...]
expands to vec_cons a (vec_cons b ...)
.
Equations
- matrix.vec_cons h t = fin.cons h t
vec_head v
gives the first entry of the vector v
Equations
- matrix.vec_head v = v 0
vec_tail v
gives a vector consisting of all entries of v
except the first
Equations
- matrix.vec_tail v = v ∘ fin.succ
![a, b, ...] 1
is equal to b
.
The simplifier needs a special lemma for length ≥ 2
, in addition to
cons_val_succ
, because 1 : fin 1 = 0 : fin 1
.