2015-01-06 00:52:30 +00:00
|
|
|
|
import data.vector data.prod
|
|
|
|
|
open nat vector prod
|
|
|
|
|
|
|
|
|
|
variables {A B : Type}
|
|
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
|
definition unzip : Π {n}, vector (A × B) n → vector A n × vector B n
|
|
|
|
|
| unzip nil := (nil, nil)
|
|
|
|
|
| unzip ((a, b) :: t) := (a :: pr₁ (unzip t), b :: pr₂ (unzip t))
|
2015-01-06 00:52:30 +00:00
|
|
|
|
|
|
|
|
|
theorem unzip_nil : unzip nil = (@nil A, @nil B) :=
|
|
|
|
|
rfl
|
|
|
|
|
|
|
|
|
|
theorem unzip_cons {n : nat} (a : A) (b : B) (t : vector (A × B) n) :
|
|
|
|
|
unzip ((a, b) :: t) = (a :: pr₁ (unzip t), b :: pr₂ (unzip t)) :=
|
|
|
|
|
rfl
|