2015-08-12 22:05:14 +00:00
|
|
|
|
import data.examples.vector
|
2015-01-13 22:38:25 +00:00
|
|
|
|
open nat vector prod
|
|
|
|
|
|
|
|
|
|
variables {A B : Type}
|
|
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
|
definition unzip : Π {n : nat}, vector (A × B) n → vector A n × vector B n
|
|
|
|
|
| unzip nil := (nil, nil)
|
|
|
|
|
| unzip ((a, b) :: v) :=
|
2015-10-14 01:35:16 +00:00
|
|
|
|
match unzip v with -- ERROR
|
2015-01-13 22:38:25 +00:00
|
|
|
|
(va, vb) := (a :: va, b :: vb)
|
|
|
|
|
end
|
|
|
|
|
|
2015-10-14 01:35:16 +00:00
|
|
|
|
example : unzip ((1, 20) :: (2, 30) :: nil) = ((1 :: 2 :: nil, 20 :: 30 :: nil) : vector nat 2 × vector nat 2) :=
|
2015-01-13 22:38:25 +00:00
|
|
|
|
rfl
|