Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] overloading natural number notations for user types

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] overloading natural number notations for user types


Chronological Thread 
  • From: Pierre-Marie Pédrot <pierre-marie.pedrot AT inria.fr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] overloading natural number notations for user types
  • Date: Sun, 21 Feb 2016 23:49:26 +0100

On 21/02/2016 23:31, Jason Gross wrote:
> How hard would it be to set up the syntax plugins already in Coq so that
> they registered vernaculars such as [Declare NatSyntax for nat in
> nat_scope [O S].] and similarly for notations for negative numbers,
> ascii, strings, etc?

Not that difficult, I believe. Yet, we need to rely on a meta-language
to pattern-match over terms. Ltac would fit the bill, but I personally
find this use a little bit ugly. The vernacular would probably look like:

Parameter myNat : Type.

Ltac reify_myNat n :=
match n with
(* insert a code producing a Z from a myNat here *)
end.

Declare Nat Syntax myNat reify_myNat.

PMP

Attachment: signature.asc
Description: OpenPGP digital signature




Archive powered by MHonArc 2.6.18.

Top of Page