coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gaetan Gilbert <gaetan.gilbert AT ens-lyon.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Opaque module typing with exposing function defs
- Date: Thu, 27 Apr 2017 17:11:48 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gaetan.gilbert AT ens-lyon.fr; spf=Neutral smtp.mailfrom=gaetan.gilbert AT ens-lyon.fr; spf=None smtp.helo=postmaster AT labbe.ens-lyon.fr
- Ironport-phdr: 9a23:t9Z4oxARuCHf50Kp5T/2UyQJP3N1i/DPJgcQr6AfoPdwSPvzoMbcNUDSrc9gkEXOFd2CrakV16yO6+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fdbghMizexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Xymp4aV2Rx/ykCoJKiA38G/XhMJzgqxUrh2uqB5jzIDbe4yVKPlzc7nBcd8GS2dMXMBcXDFBDIOmaIsPCvIMM+dCoIbju1sBtx2+DhStCuPuzj9HnWH53bcm0+88FgzG0xYvEMwSsHvOqtX5LqgSUeGxzKbT0zrDde9W1Czj54jOaRAtuPWMXLJ3ccrX00UvGRnFg0yWpIf4MT2V0eENvHKa7+pmTe+vimgnqxtwoje13MsshJPJi4QIwV7H7SV02Js5KNKkREJhY9OpEoFcuzybOoZ0WM8uXX9ktDgixrEbvZO2cjIGxZQoyhLFafGKcpKE7g/iWeuRJzpzmWhrd6ilhxmo9Eit0u38Wdew0FZNtidFlsPDuWsW2BPN8MSIVP19/ly41TaL1wHT7edELVo6larBM5Ihw7gwmYQPsUnbAyP7l1n6gLWUe0gm4OSk9uXqb7f8qpOCKYN4lBnyMqE0lcy+BeQ4PBIOX2+e+emk273s51P2QKlQgf0wiKXZv5HaJcAAqaGnGQ9Vzp0u5Ai5Dze9ydgYmXkGLFVDeB6dgYjpIUnCIOrkAvenn1SsjDBryujaMb3mG5XBN2TMkLP8fblm8ENc0woyzdVH551OEL0BIfTzWlXwtNPCFBM5PRa0kK7bD4B20ZpbUmaSCIeYNrnTuBmG/LEBOe6JMaActSr0LbAK5vrkgGUl0QsSdKS11J1RZ3G8FPl8P22UZ2GphsYGFyEEpFxtH6TRlFSeXGsLND6JVKUm62RjBQ==
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.