coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason Gross <jasongross9 AT gmail.com>
- To: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] coercions and universes
- Date: Mon, 2 Jun 2014 10:14:15 +0100
The coercion mechanism does not do delta/unfolding. It sees ": C", looks for a coercion to "Sortclass", finds none, and errors. It does not look for the hnf of every coercion it has, seeing if one of them is [Type]. You may be able to get around this by declaring an [Identity Coercion] between UU and Sortclass, or else declaring an identity function as a coercion from UU to Sortclass. Alternatively, you can do [c : (C : UU)] instead of [c : C], or you can make some hacky notation like saying that [x `: y] means [x : (y : UU)] or something, and use that.
-Jason
On Jun 2, 2014 9:45 AM, "Benedikt Ahrens" <benedikt.ahrens AT irit.fr> wrote:
Hello,
of the two pieces of code below, the first one is accepted whereas the second one does not typecheck; the line "Check..." fails (in Coq8.4pl3).
Could someone explain why? Is this a necessary restriction of the coercion mechanism?
Thanks a lot in advance.
Benedikt
=== 1 ===
Definition UU := Type.
Definition PointedUU := sigT (fun A : UU => A).
Definition carrier (C : PointedUU) : Type := @projT1 _ _ C.
Coercion carrier : PointedUU >-> Sortclass.
Check (fun C : PointedUU => fun c : C => c).
=========
=== 2 ===
Definition UU := Type.
Definition PointedUU := sigT (fun A : UU => A).
Definition carrier (C : PointedUU) := @projT1 _ _ C.
Coercion carrier : PointedUU >-> UU.
Check (fun C : PointedUU => fun c : C => c). (* fails *)
=========
- [Coq-Club] coercions and universes, Benedikt Ahrens, 05/29/2014
- Re: [Coq-Club] coercions and universes, Jason Gross, 06/02/2014
- Re: [Coq-Club] coercions and universes, Benedikt Ahrens, 06/02/2014
- Re: [Coq-Club] coercions and universes, Jason Gross, 06/02/2014
Archive powered by MHonArc 2.6.18.