diff options
| author | Pierre Letouzey | 2017-03-15 03:11:23 +0100 |
|---|---|---|
| committer | Jason Gross | 2018-08-31 20:05:53 -0400 |
| commit | 24ccc118ccfb4c1223cd37bd43c9d26a77851176 (patch) | |
| tree | e5b801f21b2621686b6590af2f22ef8767b9c278 /theories/NArith | |
| parent | 006d2cd8c25dbcd787168c49e0ebfdf5dfc89c12 (diff) | |
Numeral Notation for nat
This parsing/printing method for nat should be just as fast as
the previous dedicated code. Moreover, we could now parse large
literals as nat numbers, by leaving them in a half-abstract form
such as (Nat.of_uint 123456). This form is convertible to the
closed (S (S (S ...))) form, so it shouldn't be a big deal for
compatibility, except for if some Ltac stuff relies on (S ...) to be
present after parsing. Of course, forcing the computation of
a (Nat.of_uint ....) may take a while or raise a Stack Overflow.
Diffstat (limited to 'theories/NArith')
| -rw-r--r-- | theories/NArith/BinNatDef.v | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/theories/NArith/BinNatDef.v b/theories/NArith/BinNatDef.v index 5de75537cb..8bbecf9acb 100644 --- a/theories/NArith/BinNatDef.v +++ b/theories/NArith/BinNatDef.v @@ -13,6 +13,10 @@ Require Import BinPos. Local Open Scope N_scope. +Local Notation "0" := N0. +Local Notation "1" := (Npos 1). +Local Notation "2" := (Npos 2). + (**********************************************************************) (** * Binary natural numbers, definitions of operations *) (**********************************************************************) @@ -399,3 +403,5 @@ Definition to_uint n := Definition to_int n := Decimal.Pos (to_uint n). End N. + +Numeral Notation N N.of_uint N.to_uint : N_scope. |
