Source/Packages

Std.Natural

packages/foundation/standard/src/Std/Natural.alpha

335 lines48 declarations13.5 KiBSHA-256 0a0af2339e6a

def · lines 66–67

naturalNonzero

Full file
Zero tests and ordering go through the ONE constant-time primitive the runtime offers on naturals, `nat-less-than`. A `nat-eliminate` over a natural is executed as a loop over its whole magnitude (measured 2026-09-16: asking whether the length of a 1 MiB string is zero cost 68 ms per call, about 65 ns per unit; the same question through nat-less-than costs nothing measurable), so no comparison may recurse on the value it compares. The 0/1 flag nat-less-than returns is the only thing eliminated.
66def naturalNonzero =
67  (lambda unrestricted value : Nat . nat-less-than 0 value)

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.