Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] One more deficiency of Coq?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] One more deficiency of Coq?


chronological Thread 
  • From: Victor Porton <porton AT narod.ru>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] One more deficiency of Coq?
  • Date: Tue, 15 Nov 2011 19:31:04 +0400
  • Envelope-from: porton AT yandex.ru

15.11.2011, 14:08, "Matthieu Sozeau" 
<matthieu.sozeau AT gmail.com>:
> Le 15 nov. 2011 Ã  00:07, Victor Porton a Ã©crit :
>
>> The following does not verify, because in some reason Coq does not do a 
>> coercion from Derived to Base.
>>
>> Maybe it is an intended behavior but for me it seems like a conceptual 
>> error in Coq type classes.
>
> Well, maybe you should read about typeclasses in Haskell and Coq to 
> understand why they're
> implemented like this. In case you think "base" is declared a coercion, the 
> manual will
> inform you that it is not the case, "base" is simply declared as an 
> instance, of type
> [Derived -> Base]. You can declare it as a coercion yourself if you like.

Thus I probably misunderstand the Reference Manual.

From the page 363 of Reference Manual 8.3.pl2:

Coq < Class PreOrder (A : Type) (R : relation A) :=
Coq < { PreOrder_Reflexive :> Reflexive A R ;
Coq < PreOrder_Transitive :> Transitive A R }.
The syntax :> indicates that each PreOrder can be seen as a Reflexive 
relation. So each
time a reflexive relation is needed, a preorder can be used instead. This is 
very similar to the coercion
mechanism of Structure declarations. The implementation simply declares each 
projection as an
instance.

Why this does not work as I expect, that is automatically creating coercion 
from Derived to Base?

-- 
Victor Porton - http://portonvictor.org



Archive powered by MhonArc 2.6.16.

Top of Page