The natural numbers, starting at zero.
This type is special-cased by both the kernel and the compiler, and overridden with an efficient
implementation. Both use a fast arbitrary-precision arithmetic library (usually
GMP); at runtime, Nat
values that are sufficiently small are unboxed.
Constructors
zero : Nat
Zero, the smallest natural number.
Using Nat.zero
explicitly should usually be avoided in favor of the literal 0
, which is the
simp normal form.
succ (n : Nat) : Nat
The successor of a natural number n
.
Using Nat.succ n
should usually be avoided in favor of n + 1
, which is the simp normal
form.