coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gaetan Gilbert <gaetan.gilbert AT ens-lyon.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Typeclass confusions
- Date: Sat, 24 Jun 2017 10:07:10 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gaetan.gilbert AT ens-lyon.fr; spf=Neutral smtp.mailfrom=gaetan.gilbert AT ens-lyon.fr; spf=None smtp.helo=postmaster AT labbe.ens-lyon.fr
- Ironport-phdr: 9a23:mGT9pxUKG+F9V4u/WR7mSPcPSUfV8LGtZVwlr6E/grcLSJyIuqrYYxGCt8tkgFKBZ4jH8fUM07OQ6PG/HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjSwbLdwIRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W/KlMJwgqJVrhGvqRNxzIHbYp2aOvVlc6PBft4XX3ZNUtpfWiFBBI63cosBD/AGPeZdt4TzpkEBogWiBQa2AuPk1z5Ghn7y3aIhzeshCx3G1xEnEtIBqnvbssn1O70UUeyvw6nIzDHDYOhI1jfn9IjFaQ4uofeXXb5pdcrQyU4vFwXfglWes4zoJjWY3fkOvWiD9+dsSO2ih3I9pwxzoDWj3Nogh4jLi44P1FzI6zt1zJ40KNGmUkJ3fMKoHIVKuy2HOIZ7QdkuT3xmtSomzLANpIS1czIQyJs9wh7Sc/yHfJaM4hLkTOuRJS13i2l+d72hnRq9706gyvblWsmw0FdKqSxFnsPCtnAXzxDT686HReVh/kq5xDqC2Bzf5vtGLE02j6bXNp8sz7wqmpYNr0jPADf6mEDsg6+XckUk9PKo6+PiYrj+qZ+TLZF7ih3kPaQogMC/DuU4MgwVUGeF4+S8yKbu8lP/QLVRl/E2lqnYsJfcJcgBqK65GRdZ0pw/5BanEzemzNMYkGEbI1JCYRKLlpTmO1XTIP/jFvq/mFStkDJzx//cJLHhA5PNLmLCkLj7Z7p95VRcm0IPyoVU4IsRAbUcKtryXFXwvZrWFEwXKQuxlsnuBcl00MsxWGaFD7WFePfduFKU7+RpLOiIboIPpB7wLeNg4+/pizk3gwlOLuGSwZILZSXgTbxdKEKDbC+0jw==
Why is the error
Error:
The term "Bool.eqb_prop" has type
"forall (a b : bool) (_ : @eq bool (Bool.eqb a b) true), @eq bool a b"
while it is expected to have type
"forall (x y : bool) (_ : @eq bool (@eqb bool ?e x y) true), @eq bool x y".
though? I don't see a nat in there.
Gaëtan Gilbert
On 24/06/2017 01:46, Emilio Jesús Gallego Arias wrote:
Hi Benjamin,
what happens is that the pre-typer tries to solve a "coercion problem"
[basically a type equality] from
forall a b : bool, Bool.eqb a b = true -> a = b
to
forall x y : ?X12, eqb x y = true -> x = y
[note the fresh type ?X12]
but indeed type class search will pick the first instance it finds, in
this case for Nat:
Debug: 1: looking for (Eq ?A) with backtracking
Debug: 1.1: exact eqNat on (Eq ?A), 0 subgoal(s)
which of course makes the coercion problem fail, and backtracking in
that part of the type inference is not powerful enough as to retry with
a different one.
I am not sure what the best solution is in this case, other than the one
you propose, as the logic is subtle [people talk from time to time of
improving the backtracking capabilities of the pretyper but I am not
sure that a brute force approach is what one would want here]
Best,
E.
[Regarding your original question, for most cases we tend to use the
class hierarchy that mathcomp provides which is implemented using
canonical structures and mixins. They seem mature and we just don't
have to worry too much about them]
- [Coq-Club] Typeclass confusions, Benjamin C. Pierce, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Emilio Jesús Gallego Arias, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Gaetan Gilbert, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Benjamin Pierce, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Emilio Jesús Gallego Arias, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Gaetan Gilbert, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Emilio Jesús Gallego Arias, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Matthieu Sozeau, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Benjamin C. Pierce, 06/25/2017
- Re: [Coq-Club] Typeclass confusions, Matthieu Sozeau, 06/25/2017
- Re: [Coq-Club] Typeclass confusions, Matthieu Sozeau, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Emilio Jesús Gallego Arias, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Gaetan Gilbert, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Gaetan Gilbert, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Emilio Jesús Gallego Arias, 06/24/2017
- Re: [Coq-Club] Typeclass confusions, Abhishek Anand, 06/24/2017
Archive powered by MHonArc 2.6.18.