coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jonathan Leivent <jonikelee AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Coq 8.6 typeclasses behavior change
- Date: Wed, 16 Nov 2016 10:18:06 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f177.google.com
- Ironport-phdr: 9a23:FCAuRBJKh6TLoAeO3dmcpTZWNBhigK39O0sv0rFitYgXLfjxwZ3uMQTl6Ol3ixeRBMOAuqkC0rad7PuoGTRZp83e4DZaKN0EfiRGoPtVtjRoONSCB0z/IayiRA0BN+MGamVY+WqmO1NeAsf0ag6aiHSz6TkPBke3blItdaymUrLV2s+wzqW5/4DZSwROnju0J71ofzusqgCElM4QiJdiI6B57hbIvHZOZ6wCx2RuJFGemxvxzsi19Z9ntS9XvqRypIZ7TazmcvFgHvRjBzM8PjVt6Q==
After pulling in 8.6beta1, this change hit me as well.
My understanding of Matthieu's change is that the extern hints are only used by the "typeclasses eauto with somedb" variant. Even for extern hints placed in typeclass_instances. Here's an example (in 8.6beta1):
Variable A : Type.
Axiom a : A.
Class Foo := {}.
Instance foo1 (a:A) : Foo.
Hint Extern 0 A => exact a : typeclass_instances.
Goal Foo.
Fail typeclasses eauto.
typeclasses eauto with typeclass_instances.
Qed.
whereas in 8.5, that first "typeclasses eauto" would have succeeded.
IMHO the question is: what is the point to placing an extern hint in typeclass_instances vs. a different db? Perhaps the only reason to do so is because one at least wants those hints to fire at some point during refinement (as well as during "typeclasses eauto" with no mentioned db).
One can argue that top-level refinement should not be induced by an A goal (unless A is declared an Existing Class), but that is a separate argument from not allowing a sub-refinement on an A subgoal of an ongoing refinement (as with foo1:Foo above).
-- Jonathan
On 11/16/2016 08:47 AM, Matthieu Sozeau wrote:
I'm curious about the actual use cases of using such non-class premises
around, I'd be happy to hear about others. We can still go back on this
cleanup.
-- Matthieu
On Wed, Nov 16, 2016 at 2:40 PM Matthieu Sozeau
<mattam AT mattam.org>
wrote:
The goal is to be able to recognize what is and what isn't a class goal
from its type.
When doing resolution during refinement we need that information.
One can also argue that if you put Hint Extern (_ = _) => reflexivity :
typeclass_instances
in your file then you can expect Definition foo : 0 = 0 := _. to typecheck.
-- Matthieu
On Wed, Nov 16, 2016 at 2:33 PM Enrico Tassi
<enrico.tassi AT inria.fr>
wrote:
On Wed, Nov 16, 2016 at 01:23:04PM +0000, Matthieu Sozeau wrote:
This is a deliberate change to avoid "wrong" instances which generaterefman
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
has been updated though.What you propose seems a bit too drastic, Existing Class marks
Eq as class "forever". A lighter work around could be the following
Class Foo (x : nat).
Class TCPremise (P : Prop).
Instance foo x : TCPremise (x = 2) -> Foo x.
Hint Extern 0 (TCPremise (_ = _)) => reflexivity : typeclass_instances.
But frankly the use case of Ralf seems reasonable, and the contortion
above pretty ugly.
Can you explain what you mean by "wrong" instances, exactly?
Best,
--
Enrico Tassi
- [Coq-Club] Coq 8.6 typeclasses behavior change, Ralf Jung, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Enrico Tassi, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Jonathan Leivent, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Robbert Krebbers, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Enrico Tassi, 11/16/2016
- Re: [Coq-Club] Coq 8.6 typeclasses behavior change, Matthieu Sozeau, 11/16/2016
Archive powered by MHonArc 2.6.18.