2015-01-05 01:57:25 +00:00
|
|
|
import data.vector
|
|
|
|
open nat vector
|
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
definition diag {A : Type} : Π {n}, vector (vector A n) n → vector A n
|
|
|
|
| diag nil := nil
|
|
|
|
| diag ((a :: va) :: vs) := a :: diag (map tail vs)
|
2015-01-05 01:57:25 +00:00
|
|
|
|
|
|
|
theorem diag_nil (A : Type) : diag (@nil (vector A 0)) = nil :=
|
|
|
|
rfl
|
|
|
|
|
|
|
|
theorem diag_succ {A : Type} {n : nat} (a : A) (va : vector A n) (vs : vector (vector A (succ n)) n) :
|
|
|
|
diag ((a :: va) :: vs) = a :: diag (map tail vs) :=
|
|
|
|
rfl
|