Source/Packages

Std.Natural

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

325 lines48 declarations14.4 KiBSHA-256 4234d9ebfedf

def · lines 62–63

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.
62def naturalNonzero =
63  (lambda unrestricted value : Nat . (nat-less-than zero 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.