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 15:40:10 +0000
- Authentication-results: mail2-smtp-roc.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-ua0-f174.google.com
- Ironport-phdr: 9a23:xRGHdxVMVWDMxvGEONAh6ZsxNjzV8LGtZVwlr6E/grcLSJyIuqrYYxaAt8tkgFKBZ4jH8fUM07OQ6PG8HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjSwbLd9IRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W7YhMx/jqJVrhyiqRJi3YDbfJqYO+Bicq7HZ94WWXZNU8RXWidcAo28dYwPD+8ZMOhcson9o1oOogGjDgSxGuzvzj9JiWX13a09zeQuCxzN0QsiH9ITtHTbt9T1NKEJXu2uw6nIyC/Mb/JS2Tvn9IfIdRUhrOiKULltf8TRzkwvGBnEjlWWsYHlPjWV1v4Ms2eB9eZgW/ivhmg6oA9yujii3tkghpXNi44PyV3J9T91zJgoKdC6UkJ3fNypHZRWuiqHLYV5WNkiTHttuCsiyr0Jp5q7fC8SxZQi3RHfaviHf5GV4h35SOqdODl4iG9ndb+wnRqy/k+gyurzVsmwzllGtDZKkt7JtnwV1hzT7NaISudl80u/xTqC0xrf5+JELEwui6bXNpwszqQtmpcRvknPBir2l1/3jK+SeEUk4O+o6+H/b7Xku5+cM5R7igD4Mqs1gcG/DuE4PRIPX2if4+izyLrj/UjhTLVQkvI2irXZsIzdJckDuqG5BBZV3p8/5Ba7Ejepy88VnWIHLVJAYBKIlZLlO1DIIPDiDPewmU6gkDlxx6OOArq0CZLUa3PHjb3JfLBn6kcaxhBg48pY4sd2F7UAKbrZV0vgvd/fEBZxZw6px+zmDt9V2YYXWGbJCaicZvCB+WSU7/4idrHfLLQevyzwfqAo
Jason, Gaëtan,
Thank you for replies!So I want to keep an interface of the module clean and concise. For example, when the module is printed, I don't want it to show all the aux stuff.
Opaque typing is ok for hiding aux lemmas, because I still can use (apply) main theorems to prove something outside of the module. But what hits me is that it's not possible to use functions. The module becomes totally useless.
--
Kind regards, Julia
чт, 27 апр. 2017 г. в 11:12, Gaetan Gilbert <gaetan.gilbert AT ens-lyon.fr>:
What do you mean by hiding? Is "Local Definition"/"Local Lemma" enough?
(https://coq.inria.fr/distrib/current/refman/Reference-Manual003.html#hevea_command10)
Gaëtan Gilbert
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.
>
> 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.