coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason Gross <jasongross9 AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Simplification for typeclass instances
- Date: Mon, 12 Sep 2016 15:40:49 +0000
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f170.google.com
- Ironport-phdr: 9a23:ZyE4vx/rvE45nP9uRHKM819IXTAuvvDOBiVQ1KB+1OscTK2v8tzYMVDF4r011RmSDNydtaIP27Se8/i5HzdfsdDZ6DFKWacPfiFGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkImbtjyT4XVloG80/2405zVeQRBwjSnMp1oKxDjjwzKsc9erpFlMb15nhnAuXxOdP5R3ng5DV2Wlhf4oMy3+cgwoGxrp/s9+psYAu3BdKMiQOkAAQ==
Indeed, an instance is just syntactic sugar for a definition, an initial [refine] in the proof of that definition, and a hint resolve.
Michael, your tactic fails in the case where there are ambiguous instances. There is a way around this: you can construct a typeclass that takes in a list and another class and is resolved by an instance of that class not in the list. By applying this recursively, you can get the first n instances of any class.
On Mon, Sep 12, 2016, 7:36 AM Jonathan Leivent <jonikelee AT gmail.com> wrote:
On 09/12/2016 04:15 AM, Soegtrop, Michael wrote:
> Dear Jonathan, Daniel,
>
>> I don't think there is a way tactically to decide if a definition is an instance
> I thought about it once more: one issue with eauto is that it will also use local hypothesis. So these must be cleared before the test and this must be undone after the test. Below is a tactic which does this with a few test cases.
Another issue is that the typeclass_instances db can contain hints that
solve the goal with a non-instance in 1 step even if it isn't a
typeclass-typed goal. If hole refinement is used instead: just "pose (_
: T) as Hex" - if it doesn't fail, then at least we know T is a Class,
but that doesn't mean that it was filled in with an instance, again due
to typeclass_instance hints. The reason is that typeclasses are duck
types - any way you can fill in their requirements works. The
"Instance" syntax is little (nothing?) more than a normal definition
combined with a resolve hint for the typeclass_instances db.
But, maybe this is good enough - in that the required unfolding would
work for such "faked" instances as well? Because a faked instance is
just a good as a real one?
Or maybe unfolding all projections that simplify is good enough, even if
they're just projections on plain old records?
-- Jonathan
- [Coq-Club] Simplification for typeclass instances, Daniel Schepler, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jonathan Leivent, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jonathan Leivent, 09/09/2016
- RE: [Coq-Club] Simplification for typeclass instances, Soegtrop, Michael, 09/12/2016
- RE: [Coq-Club] Simplification for typeclass instances, Soegtrop, Michael, 09/12/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jonathan Leivent, 09/12/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jason Gross, 09/12/2016
- RE: [Coq-Club] Simplification for typeclass instances, Soegtrop, Michael, 09/12/2016
- RE: [Coq-Club] Simplification for typeclass instances, Soegtrop, Michael, 09/12/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jason Gross, 09/12/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jonathan Leivent, 09/12/2016
- RE: [Coq-Club] Simplification for typeclass instances, Soegtrop, Michael, 09/12/2016
- RE: [Coq-Club] Simplification for typeclass instances, Soegtrop, Michael, 09/12/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jonathan Leivent, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Gaetan Gilbert, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Daniel Schepler, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Gaetan Gilbert, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Daniel Schepler, 09/09/2016
- Re: [Coq-Club] Simplification for typeclass instances, Jonathan Leivent, 09/09/2016
Archive powered by MHonArc 2.6.18.