coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Matthieu Sozeau <mattam AT mattam.org>
- To: coq-club AT inria.fr
- Cc: Talia Ringer <tringer AT cs.washington.edu>
- Subject: Re: [Coq-Club] Plugins, type-checking, and universe constraints
- Date: Tue, 10 Apr 2018 09:41:11 +0000
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mattam AT mattam.org; spf=Pass smtp.mailfrom=matthieu.sozeau AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm0-f42.google.com
- Ironport-phdr: 9a23:c77TARY8NoyJOPlZUIdnawr/LSx+4OfEezUN459isYplN5qZoMuybnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjm58axlVAHnhzsGNz4h8WHYlMpwjL5AoBm8oxBz2pPYbJ2JOPZ7eK7WYNEUSndbXstJWCNBDIGzYYsBAeQCIOhWsZXyqkAUoheiHwShHv/jxiNKi3LwwKY00/4hEQbD3AE4GNwBqmjUrMn1NKcTT++10bTDwyjEb/JXxzjy8pXIeQ0mrPGJR71wbdbRxlMqFw7ei1Wfs5DlPy+P2eQIqWSb6PBgVe22hmMhtgp/rD+vxsI2hYnIgIIY0l/E9SRlwIY1ON23U1R3bsKjEJtVsSyRKoh4Qts6Tmxqtys20KAKtYC7cSQQy5kr2QTTZvOZf4WO/xntTvyeIS1ii3JgYL+/hwi98UynyuDkU8m7yldKri5cntjCs3ABywXf6saIR/dj5Euh1jGP1wfc6uFAP084j7bUK5kkwrIol5oTt1rMHjPulUj0g6KabFgo9vao5uj9YbjquIWQOoBqhg3mN6QhgM2/AeA2MggUWGib/Pyx1Lj58k3lXLVKjvw2nbfEsJzAPsQboa+4DBFP3YY+8Bu/ADKm384ZnXkDNl5KZBWHj43xN1HUPP/4Feu/g0irkDpz2//GOaThDozRIXjHjbfuZq1w61VcyQo21dBQ/YhYCrAHIPLpW0/+rsbUDhEjM1/8/+GyA9Jkk4gaRGinA6mDMaqUv0XbyPgoJrypbZMJuDfwNrAe4OzjhGJxzVoUYbWg2LMSYWykF/EgJF+WNym/yuwdGHsH61JtBNfhj0ePBHsKPy7rDvAMowojAYfjNr/tA4WkgbiPxiC+R8QEaWVPC1TKGnDtJdzdB6U8LRmKK8okqQQqEKC7QtZ7hxSnqBPzzvxgNOWGonRF56Km78B84qjorT939TFwCJ7AgWSETmUxgWZQAjFqhuZwpktyzlrF2q990aRV
Hi Talia,
Indeed Typing.type_of infers missing constraints, while the kernel only checks w.r.t the existing ones. You could also add the constraints explicitly if you know them using the interfaces in Evd (add_universe_constraints or add_constraints), but it’s usually simpler to just retype and infer them.
Best,
— Matthieu
Le mar. 10 avr. 2018 à 10:30, Sylvain Boulmé <Sylvain.Boulme AT univ-grenoble-alpes.fr> a écrit :
Hello Talia,
I am not sure to fully understand your problem, but here is an hint: in
a plugin, when you define a term introducing potentially new universe
constraints, you have to refresh universe constraints. A simple way to
do it in Coq 8.7 is to use the function "Typing.type_of" (you will only
need the first component of its result).
See https://github.com/coq/coq/blob/v8.7/pretyping/typing.mli
As I understand it, this should correspond to your first alternative...
Hope this helps,
Sylvain.
Le 10/04/2018 à 03:06, Talia Ringer a écrit :
> Hello,
>
> I am writing a plugin, and as part of this plugin, I occasionally need
> to type-check terms. This is usually fine, but sometimes, I get errors
> like this:
>
> The 2nd term has type "nat -> Type@{max(Foo, Bar)}"
> which should be coercible to "nat -> Type@{Baz}".
>
>
> I know what this means, but the thing is, these constraints are actually
> solvable; if I wrote the term outside of my plugin, it would type-check
> and go through. But inside of the plugin, the type-checking routine fails.
>
> I'm looking for one of two things:
>
> 1. A way to tell type-checking from within a plugin about the universe
> constraints so that it knows to solve them correctly, or
> 2. a way to tell type-checking from within a plugin to just assume all
> universe constraints go through, because this will always be true for
> me, and if it isn't, then the plugin will just fail later anyways
>
> I'm assuming #1 is the proper way to call type-checking from within a
> plugin, but I'm not sure how to do it.
>
> Best,
>
> Talia
- [Coq-Club] Plugins, type-checking, and universe constraints, Talia Ringer, 04/10/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Sylvain Boulmé, 04/10/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Matthieu Sozeau, 04/10/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Emilio Jesús Gallego Arias, 04/11/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Talia Ringer, 04/13/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Théo Zimmermann, 04/13/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Sylvain Boulmé, 04/13/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Emilio Jesús Gallego Arias, 04/13/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Talia Ringer, 04/13/2018
- Re: [Coq-Club] Plugins, type-checking, and universe constraints, Sylvain Boulmé, 04/10/2018
Archive powered by MHonArc 2.6.18.