Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] "Cannot satisfy constraint" error using subset types

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] "Cannot satisfy constraint" error using subset types


Chronological Thread 
  • From: Klaus Ostermann <klaus.ostermann AT uni-tuebingen.de>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] "Cannot satisfy constraint" error using subset types
  • Date: Tue, 2 May 2017 12:47:58 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=klaus.ostermann AT uni-tuebingen.de; spf=None smtp.mailfrom=klaus.ostermann AT uni-tuebingen.de; spf=None smtp.helo=postmaster AT mx03.uni-tuebingen.de
  • Ironport-phdr: 9a23:8q6U0xDteNfNaZCpkT3vUyQJP3N1i/DPJgcQr6AfoPdwSPv8r8bcNUDSrc9gkEXOFd2CrakV16yO6+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fdbghMizexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Xymp4aV2Rx/ykCoJKiA38G/XhMJzgqxUrh2uqB5jzIPPeo6ZKOBzc7nBcd4UR2dMWNtaWSxbAoO7aosCF+8PPeJCoIngvFsFsAKwBRKwBOzx0D9Ig2X53as80+88FgzG3wggEMgTsHTPttn1M7wSUfyrw6nSyDXMdfVW2THm5YjVdBAhoOiAXa5tccXP0kYvFgXFjlqOpozjJT+ay/oCvnGd4uF9Vuyvk3Yqpxx/rzWg3MsglJPFi4IPxlza6Cl0zp45KcC2RUN0e9KoDoFcuzyEO4dsX88vQ31ktSAnwbMco5G7ZjIFyJE/yh7fdfOHd4+I7wrmVOeePTt1imhpeK+5hxaz6ESg1vD8Wdev31ZLqCpFncfDtnYX2xPO9MeLUvp9/kG/1jaTzw3f9+9JLE8umabFMZIswqQ8moQOvUnNBiP2nV/5jK6SdkUq4Oio7OHnb63lpp+YLYB0lxr+Pr4pmsykHeQ3LBIOX22B9uS60r3u5lD5QLNLjvEvjqnZrY7VKt8apq6/DA9azIAj5wyiADi4yNgYh2UILEpZeBKbiIjkI03BIPfhDfumn1uslCpryOvdM736ApTNK2DDn637cbZ87U5c0gszwspF65JaELFSaM70D0T2rZnTCgIzGw2y2efuTttnha0EXmfaIauQLbialkSU6/gqKu+KLNsWvD/gML4i/OLjl3own1k1YK+omIcKZXq5GPtrJQOVbCy/0Z86DW4Ws19mH6TRg1qYXGsLag==

Hi Matthieu,

I've been able to fix the error.

Amazingly, the error message became much better when I inserted a type annotation
for "fds", even though the type I annotated was exactly the one that was also inferred.
The cause of the error was indeed that a cast with eq_rect was missing.

In my naive understanding of Coq, my expecation was that inserting a type annotation that
Coq can infer does not change the behavior of the compiler, but that seems to be wrong.

In any case, an error message of the form "term has type X while it is expected to have type X"
is rather puzzling. Maybe there should be a Coq FAQ with advice like "if you get a cryptic
error message, try to annotate all types in your definition and see if that improves the situation ;-)

Thanks for the suggestions from you and everyone else who replied!

Klaus


Am 02/05/17 um 12:26 schrieb Matthieu Sozeau:
Hi,

  The constraint it cannot solve is a conversion constraint while x1 is only a propositional equality, Coq is hence unable to use it during conversion. You probably need to rewrite with that x1 equality before you can typecheck your term, but we'd need a bit more context to tell you how. What's the term you're trying to typecheck precisely?

Best,
-- Matthieu

On Sat, Apr 29, 2017 at 12:04 AM Klaus Ostermann <klaus.ostermann AT uni-tuebingen.de> wrote:
I'm stuck at a strange error message where I can't find anything about
on this mailing list or the documentation.

It looks something like this:

Error:
In environment
...
fds : id -> id -> {n : nat & eqn n}
...
x1 : projT1 (fds f c) = length tys1
x2 : projT2 (fds f c) = {| e_xtor := c; e_xtor_tyargs := cv; e_body :=
term |}
The term "fds" has type "id -> id -> {n : nat & eqn n}"
while it is expected to have type "id -> id -> {n : nat & eqn n}" (cannot
satisfy constraint
"eqn (length tys1)" == "(fun n : nat => eqn n) (projT1 (fds f c))").

The types that it wants to be identical are identical, and they are also
identical
if all implicit arguments, universe levels etc. are printed. "eqn" is a
dependent
type that expects a "nat".

The constraint it cannot satisfy follows from equation x1, but Coq doesn't
seem to be able to use that assumption.

I'm rather clueless what to do about this error. Any suggestions?

Klaus






Archive powered by MHonArc 2.6.18.

Top of Page