Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Debugging Universe Inconsistencies

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Debugging Universe Inconsistencies


Chronological Thread 
  • From: Jan-Oliver Kaiser <janno AT mpi-sws.org>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Debugging Universe Inconsistencies
  • Date: Thu, 6 Sep 2018 13:55:19 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=janno AT mpi-sws.org; spf=Pass smtp.mailfrom=janno AT mpi-sws.org; spf=None smtp.helo=postmaster AT jupiter.mpi-klsb.mpg.de
  • Autocrypt: addr=janno AT mpi-sws.org; prefer-encrypt=mutual; keydata= xsBNBFNx+loBCAC52t5xTWGjj9DMTCyTP3vL0cLh63ZNGTD7Ut5F3zVEyA1wlCRziuDVg+4b 7U7UBd2GpE4tY0YzRMlQElFP7XpkkEXC+JY+Vnor+4GyHvvbvRLKaB6mbQTsZ5R7I0O1gOy4 yCvljA9NrnFUI4f2HIZyOnjjgXlGjs4JgYCes/hgfvCLmtWq7Gve9xtEGq4IEKw9qz07Homh ExBDCwx8nfVphUnnt+PosxJuO/7rFN2v6wdL8PeQFMUsm9MADpNssuvSI+XC0QO0cK45g1zb ZTpaAzc3dXTjYjZm5tLo6ChWI8QpZRCfJUztaLIWiPd2NZLyr5OoM6HnUaj5vJZrEa4ZABEB AAHNJUphbi1PbGl2ZXIgS2Fpc2VyIDxqYW5ub0BtcGktc3dzLm9yZz7CwH0EEwEIACcFAlYF am0CGyMFCQlmAYAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQWS0XeAYhTVyKXwf9EMDw f8rjZUSO29LYZgPdyneLkJ0oo/a0d59JRBap1BOkcXl3u0O78Ent74oZGra6ApAhNnfSmR6O pCaeTi/ePKslaHlw+PXZkpRtP7CCf3J0HTaTFjhA6NiTqBCO5hWEnzqpPukWKPacEhhAkW7S mrvWQiCsACiuISLyfp9S2q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WQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfbF/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbDVwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlSgHLSY0/nzJhMx+jKxVoxyvqBJwzIHWfI6bO+Fzfr/ecN4AWWZNQshcWi5HD4ihb4UPFe0BPeNAoof5vVQOqwKyCxCoBOPu1D9HmGX21rA/3es7EAHGxxIvH8gTu3nTrtX6LqESUeayzKTTyDXDd/JW1S7m6InGaRAtu/aMXah/ccfIz0QkCgDLjk2IpID4MT6Y0v4Bv3Wf4uZ6Vu+iinQrpxxxrzS328shhI3EipgIxl3A7yl13YU4KNKiREN5Z9OvDYFeuDuAN4RsR8MvW2Fotzg+yr0BoZO7fjUKyIwmxx7DdfOHaZKE4hf7VOaQODt4h3ZleKmkiBqo9Eig0uL8WtOp31lUtiZFk9/MuW4R1xHL98SKRP9w8l281TuLzQze6eBJLVopmafbM5Ihx6Q/lpsXsUTNBC/2n0D2gbeUdko+/Oio7ePnb67jpp+ENo94kxr+M6o1msClBuQ4KAcOU3CB+eugzL3j4VH5QLJSg/IqlanZqYnWKtgfpq6kGABYyZ0j6ha6Dze+ytsUh3gHLFRfeBKGlYflIV/OIOqrRcu41l+riXJgw+3MFrznGJTEaHbZw5n7erMoyUdajS03zM5S/dp3A7AaLei7Dk34strfJhohMkmv3P2hD89ygNBNEVmTC7OUZfuB+WSD4fgidrHVNd0l/Q3lIv1g3MbAyHowmFsTZ66shMBFbWi5W+95OAOee3W+245dQ1dPhRI3SanRsHPHSSRaPi3gWro9oyokE8ShF4iRHtnw0ozE5z+yG9htXk4DCl2IFi21JYeZQ/YQZTjUJ9dg1z8ATrLnTpcukx2j5lf3
  • Openpgp: preference=signencrypt

Hey Christian,

You can print entire modules using [Print] or [Print Module] in case of ambiguities. With [Set Printing Universes] enabled you can at least search for particular universes quickly within a module. (There's one annoying thing here which is that submodules are not automatically expanded. Maybe there is an option for that that I don't know?)

Apart from that, [Set Printing Universes] should *sometimes* show the full universe cycle when an inconsistency occurs, but it depends very much on the particular error that appears.

Regarding the actual inconsistency: One quick way of eliminating a particular egregious class of inconsistencies is to look for partial applications of template-polymorphic types (such as datatypes from the standard library). These partial applications restrict all future uses of the partially-applied type and can very easily lead to hard-to-find inconsistencies. An example would be a type classes such as [FMap] with an instance [FMap list]. Together with another definition that mixes [FMap] and [list] and introduces the opposite universe constraint of the [FMap] instance for [list], this can lead to inconsistencies.

If you do find any such partial applications, try to see if the universe cycle includes any of the relevant universes. Or, equivalently, start with the universes in the cycle—attainable by massaging the failing definition with explicit universes until you get the right *kind* of universe error—and see if any of them are related to the standard library or your own template-polymorphic inductive types and work backwards from there to find partial applications of such types.

Sadly even this process can take a long time.

Best,
Janno


On 9/6/18 1:01 PM, Christian Doczkal wrote:
Hello,

I already had used "Set Printing Universes". As far as I can tell, the
only thing "Set Printing Universes" does is cause "Print/Check term." to
print the universe levels of all occurrences of "Type" occurring in a
particular definition as well as the constraints enforced by a
particular definition.

I have a constraint system with thousands of constraints arising from
hundreds of definitions and I would like to know which constraints
contribute to the inconsistency and which definitions/lemmas give rise
to a given constraint.

For instance, Print Universes might mention
"Coq.Relations.Relation_Definitions.1" which I could correctly guess is
the first argument of "relation":

relation =
fun A : Type@{Coq.Relations.Relation_Definitions.1} => A -> A -> Prop
: Type@{Coq.Relations.Relation_Definitions.1} ->
Type@{max(Coq.Relations.Relation_Definitions.1,Set+1)}

But its not always that easy to guess the definitions introducing a
particular universe index and even harder to guess which definition or
lemma enforces a given constraint.

Best,
Christian


On 05/09/18 20:42, Gaëtan Gilbert wrote:
1) yes

2) and 3)
if you enable printing of universes (Set Printing Universes. in
coqtop/proof general/etc, some GUI toggle in coqide) universe
inconsistencies should print that information

Gaëtan Gilbert

On 05/09/2018 17:57, Christian Doczkal wrote:
Hello everyone,

We have a large development where we have generic structures and some
concrete instances for them. One of these is for relations (X -> Y ->
Prop) with (X,Y : Set).

Now I was trying to generalize this to all instances with (X,Y : Type).
This leads to a universe inconsistency thousands of lines down the road.
I would hope that this is merely a problem of making certain things
universe polymorphic, but I don't manage to come up with a minimal
example reproducing the problem.

At first, I only got the rather uninformative "Universe Inconsistency"
error when trying to load two separately compiled parts of the library.

With some trial and error I got to the point where I have statement that
type checks before the generalized instances are imported and fails to
type check afterwards. This gives me an Error of the form:

"... cannot ensure that "Type@{foo.2}" is a subtype of Type@{bar.3}"

I can use "Print Universes" before and after the Import, but that yields
thousands of constraints and even the diff is not too enlightening.

If I understand the universe mechanism and the error message correctly,
this actually means that assuming "foo.2 <= bar.3" is inconsistent with
the current collection of universe constraints. So here are some
questions:

1) Is my understanding correct?

2) If yes, is there a way to obtain a minimal (or at least sufficiently
small) subset of the current collection of constraints, proving that
"foo.2 <= bar.3" cannot be consistently added.

3) What other things can I do to shed some light onto what is happening?

Any help would be appreciated.

Best,
Christian




Archive powered by MHonArc 2.6.18.

Top of Page