Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Coq 8.6 typeclasses behavior change

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Coq 8.6 typeclasses behavior change


Chronological Thread 
  • From: Matthieu Sozeau <mattam AT mattam.org>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Coq 8.6 typeclasses behavior change
  • Date: Wed, 16 Nov 2016 13:23:04 +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:4SgZdRM86LTlNt4TZrgl6mtUPXoX/o7sNwtQ0KIMzox0Lfj7rarrMEGX3/hxlliBBdydsKMfzbOK+Py/EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQtFiT6zbL9oMRm7ogrdu8YUjIB/Nqs/1xzFr2dSde9L321oP1WTnxj95se04pFu9jlbtuwi+cBdT6j0Zrw0QrNEAjsoNWA1/9DrugLYTQST/HscU34ZnQRODgPY8Rz1RJbxsi/9tupgxCmXOND9QL4oVTi+6apgVRnlgzoFOTEk6mHaksN/jKxZrxyhqRJxwJPabp+JO/dlZKzRYckXSHBdUspNVSFMBJ63YYsVD+oGOOZVt47zqEESrRuiBQmsBf3gyiJVjXHr2q070vouHhvb3Ac9GN8OtW7brMnpNKgIVOC416zIwi/fb/NKwzj97ZLEchc7ofGDRL99d9fax0coFwPAlFqQqIrlMiuI2ugXrmSX9fdsWfiyh2Mhtgp/oSCvy98uh4TGnI4Z107I+CVjzIs2O9G0UkF2bcCiHZBNrS+VLZF2TdknQ2xwuCY11LkGuZmjcSgP0psnxhrfZ+WJcoiN/h7vTeiRLDhmiH5/d7K/gBGy8UekyuLiTMW7zFFKri9dntnNsHACyQDT59CFR/Zy5EutxCiD2gDJ5uxHP0w4j6XWJ4A5zr41jJUTsEDDHiHsmEXxia+bbkAk9fK06+T7YrXmp4GTN5JuhgHlNaQvm9KwDv4lMgUVUGib/P6z1Lzn/UHjXLpKifg2nrHDsJ/GPcQburK5AwhN34k/7Ba/Fi6q38gcnXkaN11IYwmHjojsO1HWOv/0F/a/g1K2kDdq3f/KJLPhAo+eZkTExbzmZPN271NW4As119FWoZxOWZ8bJ/emf0btqNzZAwJxCAumzu/6QIF4358CUGenB6aFLKrX91iS6bR8cKG3eIYJtWOleLAe7Pn0gCphlA==

This is a deliberate change to avoid "wrong" instances which generate non-class goals from polluting search. 
You just need to declare the head as a class using Existing Class eq for example here, because you're really 
treating it as a class. Sorry for not updating the CHANGES yet, the refman has been updated though.

Best,
-- Matthieu

On Wed, Nov 16, 2016 at 2:15 PM Ralf Jung <jung AT mpi-sws.org> wrote:
Hi all,

while porting our development to Coq 8.6, we stumbled upon a backwards
incompatibility with respect to typeclass resolution and Extern hints.
In previous Coq versions, if applying a typeclass instance created goals
that are not typeclasses, Extern hints would still be executed:

Class Foo (x : nat).

Instance foo x : x = 2 -> Foo x.
Hint Extern 0 (_ = _) => reflexivity : typeclass_instances.

Typeclasses eauto := debug.
Check (_ : Foo 2).
(*
Debug: 1.1: apply foo on (Foo 2)
Debug: 1.1.1.1: (*external*) reflexivity on (2 = 2)

foo 2 eq_refl : Foo 2
     : Foo 2
*)

That was with Coq 8.5.  However, with 8.6, resolution fails:

(*
Debug: 1: looking for (Foo 2) without backtracking
Debug: 1: no match for (Foo 2) , 1 possibilities

?f : Foo 2
     : Foo 2
where
?f : [ |- Foo 2]
*)

Was this a deliberate change of behavior? If yes, what is the rationale?
I don't find this mentioned in the CHANGELOG.

For now, we found a work-around (make the Extern Hint apply to the shape
of the goal *before* the instance is applied). However, this is harder
to maintain because we essentially have to both write the instance, and
then write a Hint Extern matching whenever the instance matches,
applying the instance manually, and then solving the arriving goals with
tactics.

Kind regards,
Ralf



Archive powered by MHonArc 2.6.18.

Top of Page