coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Satrajit Roy <satrajit.roy AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT
- Date: Mon, 17 Oct 2016 15:59:18 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=satrajit.roy AT gmail.com; spf=Pass smtp.mailfrom=satrajit.roy AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f47.google.com
- Ironport-phdr: 9a23:jjtyixGLQ32IwFfEFx02Ep1GYnF86YWxBRYc798ds5kLTJ76oMiwAkXT6L1XgUPTWs2DsrQf2rCQ7vqrADdcqdbZ6TZZL8wKD0dEwewt3CUeQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2a3IyL0LW5/ISWaAFVjhK8Z6lzJVO4t1b/rM4T1LBrNrw4yBrV6kFPaqwC3mp0P1uRngq6/MCh1JFm+iVU/fkm8pgTAu3BY60kQOkAX3wdOGcv6ZizuA==
My exposure to COQ is limited; so I'm possibly not seeing something obvious.
Given the following definitions, why isn't the last one working?
Require Import Bool Arith List.
Inductive type:Set:=Nat|Bool.
Inductive tbinop:type->type->type->Set:=
|TPlus:tbinop Nat Nat Nat
|TTimes:tbinop Nat Nat Nat
|TEq:forall t, tbinop t t Bool
|Tlt:tbinop Nat Nat Bool.
Inductive texp:type->Set:=
|TNConst:nat->texp Nat
|TBConst:bool->texp Bool
|TBinop:forall t1 t2 t, tbinop t1 t1 t->texp t1->texp t2->texp t.
Definition typeDenote(t:type):Set:=
match t with
|Nat=>nat
|Bool=>bool
end.
match t with
|Nat=>nat
|Bool=>bool
end.
Definition tbinopDenote arg1 arg2 res(b:tbinop arg1 arg2 res):typeDenote arg1->typeDenote arg2->typeDenote res:=
match b with
|TPlus=>plus
|TTimes=>mult
|TEq Nat=>beq_nat
|TEq Bool=>eqb
|TLt=>leb
end.
match b with
|TPlus=>plus
|TTimes=>mult
|TEq Nat=>beq_nat
|TEq Bool=>eqb
|TLt=>leb
end.
Fixpoint texpDenote t (e:texp t):typeDenote t:=
match e with
|TNConst n=>n
|TBConst b=>b
|TBinop _ _ _ b e1 e2=>(tbinop b)(texpDenote e1)(texpDenote e2)
end.
match e with
|TNConst n=>n
|TBConst b=>b
|TBinop _ _ _ b e1 e2=>(tbinop b)(texpDenote e1)(texpDenote e2)
end.
Error:
In environment
texpDenote : forall t : type, texp t -> typeDenote t
t : type
e : texp t
n : nat
The term "n" has type "nat" while it is expected to have type
"typeDenote ?t@{t1:=Nat}".
In environment
texpDenote : forall t : type, texp t -> typeDenote t
t : type
e : texp t
n : nat
The term "n" has type "nat" while it is expected to have type
"typeDenote ?t@{t1:=Nat}".
--
Satrajit
- [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/17/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, John Wiegley, 10/17/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/17/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Dan Frumin, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Tej Chajed, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Tej Chajed, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/19/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Hugo Herbelin, 10/20/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Tej Chajed, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/18/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, Satrajit Roy, 10/17/2016
- Re: [Coq-Club] Stumped by a perfectly good looking definition in Chilpala's CPDT, John Wiegley, 10/17/2016
Archive powered by MHonArc 2.6.18.