Matrix and vector notation #
This file includes simp
lemmas for applying operations in Data.Matrix.Basic
to values built out
of the matrix notation ![a, b] = vecCons a (vecCons b vecEmpty)
defined in
Data.Fin.VecNotation
.
This also provides the new notation !![a, b; c, d] = Matrix.of ![![a, b], ![c, d]]
.
This notation also works for empty matrices; !![,,,] : Matrix (Fin 0) (Fin 3)
and
!![;;;] : Matrix (Fin 3) (Fin 0)
.
Implementation notes #
The simp
lemmas require that one of the arguments is of the form vecCons _ _
.
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 #
This file provide notation !![a, b; c, d]
for matrices, which corresponds to
Matrix.of ![![a, b], ![c, d]]
.
TODO: until we implement a Lean.PrettyPrinter.Unexpander
for Matrix.of
, the pretty-printer will
not show !!
notation, instead showing the version with of ![![...]]
.
Examples #
Examples of usage can be found in the test/matrix.lean
file.
Matrices can be reflected whenever their entries can. We insert a Matrix.of
to
prevent immediate decay to a function.
Equations
- One or more equations did not get rendered due to their size.
Notation for m×n matrices, aka Matrix (Fin m) (Fin n) α
.
For instance:
!![a, b, c; d, e, f]
is the matrix with two rows and three columns, of typeMatrix (Fin 2) (Fin 3) α
!![a, b, c]
is a row vector of typeMatrix (Fin 1) (Fin 3) α
(see alsoMatrix.row
).!![a; b; c]
is a column vector of typeMatrix (Fin 3) (Fin 1) α
(see alsoMatrix.col
).
This notation implements some special cases:
![,,]
, withn
,
s, is a term of typeMatrix (Fin 0) (Fin n) α
![;;]
, withm
;
s, is a term of typeMatrix (Fin m) (Fin 0) α
![]
is the 0×0 matrix
Note that vector notation is provided elsewhere (by Matrix.vecNotation
) as ![a, b, c]
.
Under the hood, !![a, b, c; d, e, f]
is syntax for Matrix.of ![![a, b, c], ![d, e, f]]
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Notation for m×n matrices, aka Matrix (Fin m) (Fin n) α
.
For instance:
!![a, b, c; d, e, f]
is the matrix with two rows and three columns, of typeMatrix (Fin 2) (Fin 3) α
!![a, b, c]
is a row vector of typeMatrix (Fin 1) (Fin 3) α
(see alsoMatrix.row
).!![a; b; c]
is a column vector of typeMatrix (Fin 3) (Fin 1) α
(see alsoMatrix.col
).
This notation implements some special cases:
![,,]
, withn
,
s, is a term of typeMatrix (Fin 0) (Fin n) α
![;;]
, withm
;
s, is a term of typeMatrix (Fin m) (Fin 0) α
![]
is the 0×0 matrix
Note that vector notation is provided elsewhere (by Matrix.vecNotation
) as ![a, b, c]
.
Under the hood, !![a, b, c; d, e, f]
is syntax for Matrix.of ![![a, b, c], ![d, e, f]]
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Notation for m×n matrices, aka Matrix (Fin m) (Fin n) α
.
For instance:
!![a, b, c; d, e, f]
is the matrix with two rows and three columns, of typeMatrix (Fin 2) (Fin 3) α
!![a, b, c]
is a row vector of typeMatrix (Fin 1) (Fin 3) α
(see alsoMatrix.row
).!![a; b; c]
is a column vector of typeMatrix (Fin 3) (Fin 1) α
(see alsoMatrix.col
).
This notation implements some special cases:
![,,]
, withn
,
s, is a term of typeMatrix (Fin 0) (Fin n) α
![;;]
, withm
;
s, is a term of typeMatrix (Fin m) (Fin 0) α
![]
is the 0×0 matrix
Note that vector notation is provided elsewhere (by Matrix.vecNotation
) as ![a, b, c]
.
Under the hood, !![a, b, c; d, e, f]
is syntax for Matrix.of ![![a, b, c], ![d, e, f]]
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Updating a row then removing it is the same as removing it.
Updating a column then removing it is the same as removing it.