Last active
August 29, 2015 14:10
-
-
Save gallais/aa0aaad9edbc9e361eb2 to your computer and use it in GitHub Desktop.
Safe Head
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inductive Vector (A : Type) : nat -> Type := | |
| nil : Vector A O | |
| cons : forall n, A -> Vector A n -> Vector A (S n). | |
Definition head (A : Type) (n : nat) (v : Vector A (S n)) : A. | |
refine ( | |
(match v in Vector _ m return m = S n -> A with | |
| nil => _ | |
| cons _ hd tl => fun _ => hd | |
end) (eq_refl (S n))). | |
inversion 1. | |
Defined. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment