coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Mwyann <mwyann AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] Dependant Match Example
- Date: Tue, 21 Jun 2016 10:24:59 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mwyann AT gmail.com; spf=Pass smtp.mailfrom=mwyann AT gmail.com; spf=None smtp.helo=postmaster AT mail-lb0-f174.google.com
- Ironport-phdr: 9a23:JKgPmR9Pvv900v9uRHKM819IXTAuvvDOBiVQ1KB90eIcTK2v8tzYMVDF4r011RmSDdSduqwP0rGN+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U3pr8jrvps7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cY6Lod8JtLVry/dKAlR5RZCi4nOiY7/p7Frx7GGC6Q93IaVC1ClwVZCg7DxB7/V5b19CD9s7wui2GhIcTqQOVsCnyZ5KBxRUqwhQ==
Hello,
I’m trying to make this example work (found at http://disi.unitn.it/~zunino/teaching/formalTechniques/dependentMatch.html):
Inductive color : Set := white | black .
Definition match_as_0 (P : color -> Prop) (Hw : P white) (Hb : P black)
(f : color -> color) : P (f white) :=
match f white with
| white => Hw (* : P white *)
| black => Hb (* : P black *)
end
.
I can’t find a way to make this definition work, there’s no example and I don’t see how to make it output something. Can someone help me out? Here is what I tried:
(* color -> Prop *)
Definition f0 (c: color) : Prop :=
match c with
| white => True
| black => False
end.
(* color -> color *)
Definition f1 (c: color) : color :=
match c with
| white => black
| black => white
end.
Check match_as_0 f0 (f0 white) (f0 black) f1.
Last Check raises an error, saying “The term "f0 white" has type "Prop" while it is expected to have type "f0 white".”
Thanks in advance.
Yann
- [Coq-Club] Dependant Match Example, Mwyann, 06/21/2016
- RE: [Coq-Club] Dependant Match Example, Soegtrop, Michael, 06/21/2016
- Re: [Coq-Club] Dependant Match Example, Mwyann, 06/21/2016
- Re: [Coq-Club] Dependant Match Example, Adam Chlipala, 06/21/2016
- RE: [Coq-Club] Dependant Match Example, Soegtrop, Michael, 06/21/2016
- Re: [Coq-Club] Dependant Match Example, Mwyann, 06/21/2016
- RE: [Coq-Club] Dependant Match Example, Soegtrop, Michael, 06/21/2016
Archive powered by MHonArc 2.6.18.