Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Accessing Class members

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Accessing Class members


Chronological Thread 
  • From: Sosuke MORIGUCHI <chiguri.s AT gmail.com>
  • To: Coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Accessing Class members
  • Date: Wed, 13 Jan 2016 01:49:32 +0900
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=chiguri.s AT gmail.com; spf=Pass smtp.mailfrom=chiguri.s AT gmail.com; spf=None smtp.helo=postmaster AT mail-qg0-f44.google.com
  • Ironport-phdr: 9a23:InELrBRWArD27dTGikxJFLkIwtpsv+yvbD5Q0YIujvd0So/mwa64YRSN2/xhgRfzUJnB7Loc0qyN4/6mCTFLuMbJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvipduDPk4R1HKUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGfayQ6NtZrtBST8iLmp9sMbsrFzISRaFznoaSGQf1BRSVVvr9hb/C6z2qTb5u6JY/xO7EvDdbZF8DT+i7qh2Uh6ukw8IMjc49Cfcjckm3/ETmw6ouxEqm92cW4qSLvcrJq4=

It looks you cannot see the projection function "compare" (for Ops)
from your place.
How about to use "Import ZnZ." before you access or "ZnZ.compare"
instead of "compare"?

2016-01-13 0:01 GMT+09:00 Durward McDonell
<Durward.McDonell AT jhuapl.edu>:
>
> Hello.
>
> I am trying to use the ZModulo library, and having some difficulty
> accessing ops and specs. Here are some relevant bits:
>
> In CyclicAxioms.v we have
>
> Module ZnZ.
> Class Ops (t:Type) := MkOps {
> ...
> compare : t -> t -> comparison; (* e.g. *)
> ...
> }.
> (* And something similar for Specs. *)
> End ZnZ.
>
> In ZModulo.v we have
>
> Section ZModulo.
> Variable digits : positive.
> Hypothesis digits_ne_1 : digits <> 1%positive.
> ...
> (* Definitions for everything in ZnZ.Ops and ZnZ.Specs. *)
> ...
> Instance zmod_ops : ZnZ.Ops Z := ZnZ.MkOps (* Here is a list of
> previous definitions. *).
> Instance zmod_specs : ZnZ.Specs zmod_ops := ZnZ.MkSpecs (* Here is a
> list of previous definitions. *).
> End ZModulo.
>
> Module Type PositiveNotOne.
> Parameter p : positive.
> Axiom not_one : p <> 1%positive.
> End PositiveNotOne.
>
> Module ZModuloCyclicType (P:PositiveNotOne) <: CyclicType.
> Definition t := Z.
> Instance ops : ZnZ.Ops t := zmod_ops P.p.
> Instance specs : ZnZ.Specs ops := zmod_specs P.not_one.
> End ZModuloCyclicType.
>
> In foo.v, I have put (omitting scopes and imports)
>
> Module PNO : PositiveNotOne.
> Definition p := 3%positive. (* I.e., we want 3-bit numbers with
> cyclic addition. *)
> Lemma not_one : p <> 1%positive.
> Proof.
> unfold p.
> discriminate.
> Qed.
> End PNO.
>
> Module ZMCT := ZModuloCyclicType PNO.
>
> But now I cannot access, e.g., ZMCT.ops.compare (or ZMCT.ops.(compare),
> or (compare ZMCT.ops)).
> How do I do something interesting with ZMCT?
>
> --
> Durward McDonell
> durward.mcdonell AT jhuapl.edu
> 240-228-2690 (DC)
> 443-778-2690 (Balt.)
>



Archive powered by MHonArc 2.6.18.

Top of Page