Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Feature Request: Sealed definitions

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Feature Request: Sealed definitions


Chronological Thread 
  • From: Jeehoon Kang <jeehoon.kang AT sf.snu.ac.kr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Feature Request: Sealed definitions
  • Date: Wed, 24 Feb 2016 22:05:37 +0900
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jeehoon.kang AT sf.snu.ac.kr; spf=None smtp.mailfrom=jeehoon.kang AT sf.snu.ac.kr; spf=None smtp.helo=postmaster AT mail-io0-f179.google.com
  • Ironport-phdr: 9a23:lPoc6xSXj+uLxSM4apo2+qQOxNpsv+yvbD5Q0YIujvd0So/mwa64YBWN2/xhgRfzUJnB7Loc0qyN4/+mBDxLvcbJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvipNuOM04U1HKUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGfayQ6NtRrtBST8iLmod5cvxtBCFQxHcyGEbVzA0nxdIBA/DpDLzWJi55in3u+p63y/cPsTwQpgvV3K56botQRSuiz1RZG1xy33elsEl1PETmxmmvREqm4M=

Did you try Opaque?  I am not sure it is what you want, but it controls the visibility of the definitions.

https://coq.inria.fr/refman/Reference-Manual008.html#hevea_command141

2016. 2. 24. 오후 9:52에 "Ralf Jung" <jung AT mpi-sws.org>님이 작성:
Hi all,

In order to prevent the Coq unifier from diverging on failing to unify
certain terms, we started sealing some of our definitions with modules.
This usually looks roughly as follows:

> Definition heap_mapsto_def `{heapG Σ} (l : loc) (v: val) : iPropG heap_lang Σ :=
>   auth_own heap_name {[ l := Excl v ]}.
> (* Perform sealing *)
> Module Type HeapMapstoSig.
>   Parameter heap_mapsto : ∀ `{heapG Σ} (l : loc) (v: val), iPropG heap_lang Σ.
>   Axiom heap_mapsto_eq : @heap_mapsto = @heap_mapsto_def.
> End HeapMapstoSig.
> Module Export HeapMapsto : HeapMapstoSig.
>   Definition heap_mapsto := @heap_mapsto_def.
>   Definition heap_mapsto_eq := Logic.eq_refl (@heap_mapsto).
> End HeapMapsto.

We copied this trick from ssreflect. I would not be surprised to hear
that other larger developments are using something similar.

So I wonder, would it be worth adding a feature to Coq where I could
write something like

Sealed Definition heap_mapsto `{heapG Σ} (l : loc) (v: val):
           iPropG heap_lang Σ :=
   auth_own heap_name {[ l := Excl v ]}.

and it would automatically add "heap_mapsto" of appropriate type, make
it as opaque as "Qed."-Lemmas (or as opaque as fields sealed via a
signature, I am not sure if there is any difference), and add a term
"heap_mapsto_eq" or "heap_mapsto_def" that proves that "heap_mapsto" is
equal to its definition?
That would significantly reduce the syntactic overhead and redundancy
associated with the trick that we have to pull off now, to get Coq to
behave. As a bonus, it should work within sections.

Kind regards,
Ralf



Archive powered by MHonArc 2.6.18.

Top of Page