Skip to Content.
Sympa Menu

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

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Feature Request: Sealed definitions


Chronological Thread 
  • From: Ralf Jung <jung AT mpi-sws.org>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Feature Request: Sealed definitions
  • Date: Wed, 24 Feb 2016 13:52:35 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jung AT mpi-sws.org; spf=Pass smtp.mailfrom=jung AT mpi-sws.org; spf=None smtp.helo=postmaster AT hera.mpi-klsb.mpg.de
  • Ironport-phdr: 9a23:SlUe2RORcFDiI3LAfEsl6mtUPXoX/o7sNwtQ0KIMzox0KP7yrarrMEGX3/hxlliBBdydsKIbzbeG+Py6EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35vxirD5p8ebSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/JHBK79ZuEzSaFSJDUgKWE8osPx5jfZSg7a3HIYXC00jxxHS1zH8Rf1dpLps27hqfE73zOVa56lBYsoUCivuv84ACTjjz0KYmY0

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