Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] natural numbers as a datatype and as decimal numerals

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] natural numbers as a datatype and as decimal numerals


Chronological Thread 
  • From: Gaëtan Gilbert <gaetan.gilbert AT skyskimmer.net>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] natural numbers as a datatype and as decimal numerals
  • Date: Mon, 14 May 2018 16:47:08 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gaetan.gilbert AT skyskimmer.net; spf=Pass smtp.mailfrom=gaetan.gilbert AT skyskimmer.net; spf=None smtp.helo=postmaster AT relay1-d.mail.gandi.net
  • Ironport-phdr: 9a23:jr3NQxVkwTjkFIg+W0zQ3BmfSNvV8LGtZVwlr6E/grcLSJyIuqrYbBCHt8tkgFKBZ4jH8fUM07OQ7/i7HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba98IRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W/KlMJwgqJVrhGvqRNxzIHbYp2aOvVlc6PBft4XX3ZNUtpfWiFDBI63cosBD/AGPeZdt4TzpkEBqgeiBQa2AuPg0j5Ghn7y3aIhzeshCx3G1xEnEtIBqnvbssn1O70UUeyvw6nIzDHDYOhI1jfn9IjFaQshofKMXLJrcsrRyEwvFwbbgVWKs4DlOS2a1vgUvmWd8uFuW+Wvi2s9pAFwpDii3sgsio7OhoIazlDL6z91z5oyJd29UEJ7YNikEIdOuCGeLYd5X90tTmd1syg50r0LoYC3cDUIxZg9xRPTd+aLf5WL7x/tTuqdPDN1iXx9dL6hmhq//1KsxvD8W8WqylpGsytInsTWunwT2BHe7s6KQeZn8Ei7wzaAzQXT5/lEIU8qkarbLIYswqQumZoXq0vCHjL6lFzrg6OMc0Ur4Omo6+D9brXpvJCcMZJ7igDkPqQohMO/Hfw0MgkIX2eF5eSxzKPv8VD7TblQjPA6jrPVvI3ZKMkVvKK1HgtY34g75xa6FTim0dAYnXcdLFJCfRKKl4fpNEvQL/DkF/i/hU6gkDhqx/DCJbLuHI/NLmTYnbf6frZ861VcyAkyzdBa4pJbFKsBLOj1WkDvqNzUFgU5PBCsw+b7FNV90ZsTVn6IAq+AKa/drVuI5v80LOSXf48UuDP9K+A/6PL0jH85n0Udfaiz0pcNZnC4BKcuH0LMan31x9wFDG0ivwwkTeWshkfRfyRUYiOdViEg7zcMJ4OiB4rZWsj5j7WMwC69WJJXYmpLEEykCnT5bIaFXvIBcmSUL9M3wW9MbqSoV4J0jULmjwT90bcydrOFqB1djorq0Z1O38OWkBgz8TJuCMHEjTOWTHBvnWINQjIsmqZyvR4kkwvR4e1Dm/VdUOdrybZRSA5ja8zHzP1hCNH3Xw/bONGEVAT+G4j0MXQKVts0huQ2TQN9FtGl1E2RxSeuCq5M0rDNAZU19uTT1n79JoB7xmqUjKQ=

Unimath defines a small number of notations in their Preamble.v. Any other numbers are not covered.

Notation "0" := (O) : nat_scope.
Notation "1" := (S 0) : nat_scope.
Notation "2" := (S 1) : nat_scope.
Notation "3" := (S 2) : nat_scope.
Notation "4" := (S 3) : nat_scope.
Notation "5" := (S 4) : nat_scope.
Notation "6" := (S 5) : nat_scope.
Notation "7" := (S 6) : nat_scope.
Notation "8" := (S 7) : nat_scope.
Notation "9" := (S 8) : nat_scope.
Notation "10" := (S 9) : nat_scope.
Notation "11" := (S 10) : nat_scope.
Notation "12" := (S 11) : nat_scope.
Notation "13" := (S 12) : nat_scope.
Notation "14" := (S 13) : nat_scope.
Notation "15" := (S 14) : nat_scope.
Notation "16" := (S 15) : nat_scope.
Notation "17" := (S 16) : nat_scope.
Notation "18" := (S 17) : nat_scope.
Notation "19" := (S 18) : nat_scope.
Notation "20" := (S 19) : nat_scope.
Notation "21" := (S 20) : nat_scope.
Notation "22" := (S 21) : nat_scope.
Notation "23" := (S 22) : nat_scope.
Notation "24" := (S 23) : nat_scope.
Notation "100" := (10 * 10) : nat_scope.
Notation "1000" := (10 * 100) : nat_scope.


Gaëtan Gilbert

On 14/05/2018 16:31, José Manuel Rodriguez Caballero wrote:
Gergely Buday said
in Software Foundations' first file, Basics.v, the file defines
Inductive nat : Type :=
  | O : nat
  | S : nat -> nat.
and then, magically, uses decimal numerals, 3, 5 and so on for it.


This is not the case when you work with the library UniMath. For example,

When I write "Eval compute in  2 + 2" I obtain the answer "= 4: nat". But when I write "Eval compute in  2 + 222" I obtain the answer "Error: No interpretation for numeral 222".



2018-05-14 16:24 GMT+02:00 Théo Zimmermann <theo.zimmi AT gmail.com <mailto:theo.zimmi AT gmail.com>>:

I don't think there are anything planned for strings yet but feel
free to open a feature request if you think that would be valuable ;-)

Le lun. 14 mai 2018 à 16:11, Soegtrop, Michael

<michael.soegtrop AT intel.com

<mailto:michael.soegtrop AT intel.com>>
a
écrit :

Dear Théo,____

__ __

Interesting! One question: is there also something planned for
quoted character strings? These are also somehow “magically”
converted to Coq string objects. It might be interesting to
convert strings to arbitrary objects with a parsing function
depending on scope in a similar way as numbers are converted in
the PR you mentioned. E.g. the Software Foundations
“ImpParser.v” shows how to parse strings with simple programs to
data structures. Since Menhir can generate Coq parsers (Afaik)
this might be a powerful feature. ____

____

Best regards,____

__ __

Michael____

Intel Deutschland GmbH
Registered Address: Am Campeon 10
<https://maps.google.com/?q=Am+Campeon+10&entry=gmail&source=g>-12,
85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928





Archive powered by MHonArc 2.6.18.

Top of Page