Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Simplification for typeclass instances

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Simplification for typeclass instances


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Simplification for typeclass instances
  • Date: Mon, 12 Sep 2016 10:35:39 -0400
  • 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-qt0-f170.google.com
  • Ironport-phdr: 9a23:DSwZ1xyKhDPfBgfXCy+O+j09IxM/srCxBDY+r6Qd0u0SIJqq85mqBkHD//Il1AaPBtSCrawUwLWK++C4ACpbvsbH6ChDOLV3FDY7yuwu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9dazJHdvZiN3y3OSv8bXSZR9JjXyze+BcNhKz+CfWsMAKgYJkYoI8ywXEpGcAL+ZRw2JrKFaekj7z486x+Nho9CEG6KFpzNJJTaivJ/dwdrdfFjlza20=



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




Archive powered by MHonArc 2.6.18.

Top of Page