coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Julia Belyakova <julbinb AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Opaque module typing with exposing function defs
- Date: Thu, 27 Apr 2017 11:45:08 +0000
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=julbinb AT gmail.com; spf=Pass smtp.mailfrom=julbinb AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk0-f48.google.com
- Ironport-phdr: 9a23:DwRXjB3AIhB/cVDasmDT+DRfVm0co7zxezQtwd8ZseweLfad9pjvdHbS+e9qxAeQG96Kt7Qc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q89pDXbAhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLnhykHODw5/m/ZicJ+kbxVrw66qhNl34LZepuYOOZicq7fe94RWGpPXtxWVyxEGo6ya5YPD+4APelCsoLwukUBrR++BAa2B+PvzSFIiWXr1qA90eQhDAXG0xchH9IIq3vZt9r1NKIIXuC0yKnE1ynMb/RT2Trk7oXDbxMvoemUUL5ubcbczVMjGgDFg1mKt4DpIj2Y2v4CvmWY6edrSPihhHQ9qw5rpzii3scshZfNhoIS0l3E8D92wIcxJdGhVk57YsKoHIJetyyVNIZ6WMwiQ2ZvuCY1zr0Jp4S3czQNyJQi3xLfavqHfJaU4h/7SuqdPTN1iGhmdb+/nRq+71Wsx+PmWsS701tGti9FncPNtnAJ2RzT8M+HSv5l80ejxDaP0xvc6uBCIU8vjqfbJJshzaQxlpoXq0jMAij2mEDugK+Makok4vSo6/jgYrj+upCcMJZ0hhjiPaQqh8ywGv81MhMOXmie4eSzzqfv/Uz/QLVQj/05iLPVsJ7AJZdTmqnsCAhMl40n9hyXDjG80d1ek2NUAkhCfUelkozoMhnkLfTpBPS4nV3kxDV2w/rHOLfJDZDEL3yFm7DkK+Uuo3VAwRY+mIgMr6lfDasMdar+
Hello Ralf,
I use an aux private function to implement a public one, so this solution does not work in this case.
--
Kind regards, Julia
чт, 27 апр. 2017 г., 3:25 Ralf Jung <jung AT mpi-sws.org>:
Hi,
On 27.04.2017 03:03, Julia Belyakova wrote:
> Thank you for reply!
>
> Are there other ways to hide some parts of a module except for opaque
> typing? I am primarily interested in hiding auxiliary lemmas.
Doesn't the following, proposed in the previous mail by Istvan, do
exactly that?
> Module MAddition : Addition
> with Definition t := nat
> with Definition add := fun x y => x + y.
> Definition t := nat.
> Definition add x y := x + y.
> Definition priv_id (x : t) := x.
> End MAddition.
Of course, the annoying part is that addition is defined twice. This is
something I have also encountered when I do hiding via modules: Many of
the things that *are* exported have to be duplicated.
; Ralf
>
> It seems to me strange though that one cannot actually _use_ functions
> from the opaque-typed module.
>
> --
> Kind regards,
> Julia
>
>
> ср, 26 апр. 2017 г., 17:10 ikdc <ikdc AT mit.edu <mailto:ikdc AT mit.edu>>:
>
> On 04/26/2017 04:57 PM, Julia Belyakova wrote:
> > Dear Coq users,
> >
> > I guess it's a stupid question, but...
> >
> > I want to define a module with certain parts being hidden. For this I
> > define a module type and then use opaque typing for the module.
> And the
> > problem is that now I cannot compute functions of the module, their
> > definitions are not accessible.
> >
> > Please, find a simple example below.
> >
> > Module Type Addition.
> > Parameter t : Type.
> > Parameter add : t -> t -> t.
> > End Addition.
> >
> > Module MAddition : Addition with Definition t := nat.
> > Definition t := nat.
> > Definition add x y := x + y. (* I want this to be available *)
> > Definition priv_id (x : t) := x. (* This must be hidden *)
> > End MAddition.
> >
> > (* priv_id is not available as desired *)
> > (* Compute (MAddition.priv_id 4). *)
> > (* add is available, but the call does not reduce to 7 *)
> > Compute (MAddition.add 3 4).
> >
>
>
> If I understand correctly, I don't think you can do this. The fact that
> the module type is opaque means that any program which uses a module
> with that type must behave the same way; in particular it may not unfold
> the definitions hidden by the module type. You could of course do this:
>
>
> Module MAddition : Addition
> with Definition t := nat
> with Definition add := fun x y => x + y.
> Definition t := nat.
> Definition add x y := x + y.
> Definition priv_id (x : t) := x.
> End MAddition.
>
>
> But if you want to be able to compute through [add], then perhaps the
> module type "Addition" isn't actually the interface you want to be using
> in the first place.
>
> I don't know very much about the module system, so someone please
> correct me if this is wrong.
>
> --
> Istvan Chung
>
- [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/26/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, ikdc, 04/26/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Ralf Jung, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Jason Gross, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Jason Gross, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Jason Gross, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Jason Gross, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Jason Gross, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Gaetan Gilbert, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Pierre Courtieu, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Ralf Jung, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, Julia Belyakova, 04/27/2017
- Re: [Coq-Club] Opaque module typing with exposing function defs, ikdc, 04/26/2017
Archive powered by MHonArc 2.6.18.