lean2/tests/lean/run/eq19.lean

15 lines
469 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import data.examples.vector data.prod
open nat vector prod
variables {A B : Type}
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))
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