Created
August 25, 2013 21:38
-
-
Save anonymous/6336486 to your computer and use it in GitHub Desktop.
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
Require Import ZArith. | |
Inductive PrimValue := | |
| pBool (b: bool): PrimValue | |
| pZ (n: Z) : PrimValue. | |
Definition type_of (v: PrimValue): Type := | |
match v with | |
| pBool _ => bool | |
| pZ _ => Z | |
end. | |
Definition extract_value (v: PrimValue): type_of (v) := | |
match v with | |
| pBool b => b | |
| pZ i => i | |
end. | |
Definition extract_valueT (v: PrimValue) | |
(T: Type) | |
(H: type_of v = T): T. | |
intros; destruct v; simpl in *; rewrite <- H. | |
exact b. exact n. Qed. | |
Definition extract_valueT' (v: PrimValue) | |
(T: Type) | |
(H: type_of v = T) : T := | |
match v in ??? return ??? with | |
| ??? | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment