Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] multiple typeclass instance question

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] multiple typeclass instance question


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] multiple typeclass instance question
  • Date: Wed, 9 Mar 2016 23:23:17 -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-f176.google.com
  • Ironport-phdr: 9a23:5EwDTxGrR38z/MJzIU2g/Z1GYnF86YWxBRYc798ds5kLTJ75pMWwAkXT6L1XgUPTWs2DsrQf27WQ4/+rBjVIyK3CmU5BWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4Ov7yUtaLyZ/niKbipNaMOk1hv3mUX/BbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv50IbaKvdKMhCLdcET4OMmYv5cStuwOQYxGI4y4+VWMfjhpBBUDh4RDkU5Ht+n/4sex82ySeMMDeQrU9WDDk5KBuHky7wBwbPiI0pTmEwvd7i7hW9Uqs



On 03/09/2016 10:37 PM, Jonathan Leivent wrote:


...
I think the length of the list could be eliminated by having a dedicated first (or highest cost) instance of A that the second hint uses to know to stop looking for more.

Like So:

Axiom A : Type.
Existing Class A.
Axiom stop : A.
Existing Instance stop | 999.
Axioms a a' b b' c c' d d' e e': A.

Class MultiA (z : list A) {x : A} := dummy : list A.

Hint Extern 0 (@MultiA ?z ?x) =>
match z with
| context [x] => fail 1
| _ => let i := eval cbv beta in(_ : @MultiA (cons x z) _) in exact i
end : typeclass_instances.

Hint Extern 0 (@MultiA ?z stop) => exact z : typeclass_instances.

Goal True.
pose (_ : MultiA nil).


-- Jonathan






Archive powered by MHonArc 2.6.18.

Top of Page