coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "jonikelee AT gmail.com" <jonikelee AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] typeclass substructure question
- Date: Wed, 20 May 2020 14:49:06 -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-qk1-f177.google.com
- Ironport-phdr: 9a23:KQB+nB3XC1YDYQRQsmDT+DRfVm0co7zxezQtwd8ZseMWKPad9pjvdHbS+e9qxAeQG9mCtrQd07ud6vq+EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe9bL9oMRm6sQHcusYLjYd8K6s61wfErGZPd+lK321jOEidnwz75se+/Z5j9zpftvc8/MNeUqv0Yro1Q6VAADspL2466svrtQLeTQSU/XsTTn8WkhtTDAfb6hzxQ4r8vTH7tup53ymaINH2QLUpUjms86tnVBnlgzoBOjUk8m/Yl9ZwgbpVrhyhuRJx3o3aboaaO/Vica3QZs8aSGhbU8pNTSFNHp2wYo0SBOQBJ+ZYqIz9qkMAoRu8AgmsAuLvyjxWiX/yw6I1zf8sEQ7D3AM6HtIOtG7Yo8nyNKcXX+y+0a7FzTfEb/NQ2Df965bHchQ/rv6SRr9wfs/RxlMuFwPBlFmftYvlPzaM2+kLrmOU4PZuW/i1hG47twF+vCKvxsE0h4XUho8byl/J+DtlzIspJdC1SkB2bMKrHZdMtyyWKoV4Tt8mTmxpuCg3yaMLtYKncSUX1pgqxQLSZuGJfoWI7BzuUvuaLzRghH99Zr6zmxK//VKjx+D8TMW4zkhGojRfntXRtH0A1QTf5taGR/dh40us3CuD2gTP5exBLk05lLbXJ4Ikz7IujZUTv1nMEyrol0rqkaCbdkAp9far5uTpbLXro5GcOJFqhQ7gN6kjldKwDOUlPQUIQmOV4/6z1Kf58k38WLhKjuM5kq3esJ3CIMQUvK+5AwtM3oY66BazEi6q0NoFkXQFLl9JYh2Hj4/uO1HBJPD3E+2zjEirkDdu3/zGP7vhDYvRLnXbjrvtYbJw51RfxQcz19xT+YxYBq8bLP7uWEL8tsTUDhojPAy1x+bnBs991oQbWW+XAK+ZN6XSsV6L5u0xJ+mDepEatS3yK/gg/fHujHs5lUUBcqmu2JsbcGq4Eeh+I0WFfXrshc8MHnsNvgonVeDllFmCUSNIaHupRKI95jQ7CJq8AovZR4CthqaB3CahEZFMaGBGEAPELXC9fIKdHvwIdSi6I8l7kzVCW6LyZZUm0ETktgj8yrlqKufZ0iIdvJPnktNy4qebwRM18z13AsCQ3kmCSmh1miUDQDpgj/M3mlB01lrWifswuPdfD9EGv6oYADd/DobVyqlBM/63XwvAetmTT1P/G4epBDgwSpQ6xNpcOh8gSeXntQjK2m+RO5FQl7GPA8ZqoKfV3ny0PsUkjnifi/ZngF4hTc9Cc2ahg/wnrlSBN8vyi0yc0p2SW+EExieUrTWMyGOPuAdTVwsiCag=
I have an Ordered class:
Class Ordered (A : Set) :=
{
lt : A -> A -> Prop;
lt_strict :> StrictOrder lt
}.
and I want to declare a class that Ordered based on keys, like:
Class KeyOrdered (A K : Set)(OK : Ordered K) :=
{
getkey : A -> K
}.
but I also want to arrange things so that every "KeyOrdered A K OK" is
also considered "Ordered A", and to do so using the obvious ordering of
A's based on their keys via getkey: "a1 < a2" iff "lt (getkey a1)
(getkey a2)". I can add "Ordered A" as s substructure, like this:
Class KeyOrdered (A K : Set)(OK : Ordered K) :=
{
getkey : A -> K;
OA :> Ordered A
}.
but that places the obligation on each instance of KeyOrdered to
demonstrate that it is Ordered A. How do I remove this obligation with
a single general mapping?
Is it sufficient to leave out the "OA :> Ordered A", and instead
define an instance like this?:
Instance KOO(A Key : Set)(OK : Ordered K)(KO : KeyOrdered A K OK)
: Ordered A.
If I add this instance (which is easy to fully define), will every
"KeyOrdered A K OK" be considered an "Ordered A"?
- [Coq-Club] typeclass substructure question, jonikelee AT gmail.com, 05/20/2020
- Re: [Coq-Club] typeclass substructure question, Jason Gross, 05/20/2020
- Re: [Coq-Club] typeclass substructure question, jonikelee AT gmail.com, 05/20/2020
- Re: [Coq-Club] typeclass substructure question, Jason Gross, 05/20/2020
Archive powered by MHonArc 2.6.19+.