Source/Packages

Std.Flag

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

38 lines4 declarations1.6 KiBSHA-256 45276ebfb85c

Complete file · line 36

Flag.alpha

Definition view
1module Std.Flag
2
3-- Nat-encoded boolean flags (zero = false, succ zero = true): not / and / or,
4-- and byte equality as a flag. Lifted VERBATIM out of Inference.Runtime by the
5-- R4b reroute (2026-09-09, tools/refactor/extract_contract.py, reconstruction
6-- proof): the SM86 sampling realization and the float32 bit-pattern contract
7-- both need exactly these, so they belong in foundation (RFC S2 standard =
8-- numbers). The `inference` prefix of the def names is the lifted identity —
9-- renaming is the later namespace chunk. Inference.Runtime imports this module
10-- and never redeclares the defs. Imports nothing; must stay that way (R6/R6b/
11-- R6c walls).
12def inferenceFlagNot =
13  (lambda unrestricted flag : Nat .
14    nat-eliminate
15      (lambda unrestricted current : Nat . Nat)
16      1
17      (lambda unrestricted predecessor : Nat . unrestricted induction : Nat . 0)
18      flag)
19
20def inferenceFlagAnd =
21  (lambda unrestricted left : Nat . unrestricted right : Nat .
22    nat-eliminate
23      (lambda unrestricted current : Nat . Nat)
24      0
25      (lambda unrestricted predecessor : Nat . unrestricted induction : Nat . right)
26      left)
27
28def inferenceFlagOr =
29  (lambda unrestricted left : Nat . unrestricted right : Nat .
30    nat-eliminate
31      (lambda unrestricted current : Nat . Nat)
32      right
33      (lambda unrestricted predecessor : Nat . unrestricted induction : Nat . 1)
34      left)
35
36def inferenceByteEqual =
37  (lambda unrestricted left : Byte . unrestricted right : Byte .
38    inferenceFlagNot (inferenceFlagOr (byte-less-than left right) (byte-less-than right left)))

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.