2015-01-13 22:38:25 +00:00
|
|
|
|
import data.vector
|
|
|
|
|
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-01-13 22:38:25 +00:00
|
|
|
|
match unzip v with
|
|
|
|
|
(va, vb) := (a :: va, b :: vb)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
example : unzip ((1, 20) :: (2, 30) :: nil) = (1 :: 2 :: nil, 20 :: 30 :: nil) :=
|
|
|
|
|
rfl
|