Routines that many programs need (a mean, a gap penalty, the
Lennard-Jones potential, the minimum image convention) were rewritten
and re-verified each time, and there was no way to open one and see
exactly what it does. They now live in pplus-library, pinned here as
the submodule library/, and a program brings them in with USE.
- USE module / USE module.Routine (pseudo-study resolveUses): each
routine is studied once in its own file (its own USE lines resolved
the same way, cycles refused) and handed to the checker as a library
routine; unknown-library, unknown-routine, library-clash, use-place.
- A run steps over a library routine (one step at the call, one at the
return, none of its lines); a broken contract is reported at the call,
naming the routine. The prover uses its REQUIRE and ENSURE at the
call and does not prove it again; it is not a unit of the program.
- pseudo-to-mojo writes each library routine the program calls once,
dependencies first, labeled as coming from the library.
- src/library: the registry USE reads, generated from library/
(scripts/library.mjs emit), so the site needs no files at run time.
- scripts/library.mjs check: every routine at every level: structure,
cases, prover, fuzzer, generated Mojo, each reference implementation
(CPython; cc at -O0 and -O2; core's Mojo interpreter; the pinned
compiler's stored answer) held to the pseudo's results, and the Dafny
proof with the pinned Dafny. Writes library/status.json and STATUS.md.
scripts/library_godbolt.py stores the compiler's answers (network).
- pixi tasks library-check, library-emit, library-verify-mojo,
library-harness; CI checks out the submodule and runs library-check.
- Tests: tests/library.test.mjs, corpus 53-library; docs/library.md and
a library section in trust.md.
Gate: 332 pass; library-check: no failing check (16 routines; the Mojo
references are unverified until library-verify-mojo runs on the network).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgvbRdoEheAHqsRmr2WuKZ
Pseudo could say what a procedure computes only up to INTEGER and FLOAT,
so it could not state what a Mojo or Python program with Int32, UInt8 or
Float32 values will compute, and it had no words for rounding itself.
- lang/parse: INT8..INT64, UINT8..UINT64, FLOAT32, FLOAT64 as types
(INTEGER or FLOAT with a width, so every "whole number" rule accepts
them); conversions written as Mojo writes them, INT32(X), FLOAT32(X);
1_000_000, 0xFF and 0b1010 literals; a type name as an argument
(MAX_VALUE(INT8)); the USE line (USE IEEE now, library modules next).
- check: widths and precisions never mix silently (mixed-width,
mixed-precision); a literal takes the type of the sized value beside
it, as in Mojo, and one that does not fit is an error before any run
(literal-range); typing for every new built-in.
- interp: a sized result, store, parameter, RETURN or conversion that
does not fit stops the run (kind overflow), WRAP(X, T) wraps on
purpose; FLOAT32 results are rounded to single precision; USE IEEE
lets NaN and infinities flow.
- numeric.js: exact helpers: FMA rounded once, EXACT(X) with every digit
a FLOAT holds, ULP and NEXT_AFTER for both precisions, bit operations
in two's complement.
- Built-ins: ASIN ACOS ATAN SINH COSH TANH HYPOT POW CBRT EXPM1 LOG1P E
TRUNC SIGN COPYSIGN CLAMP FMA IS_NAN IS_INF IS_FINITE INF NAN ULP
NEXT_AFTER IS_CLOSE EXACT MAX_VALUE MIN_VALUE EPSILON GCD LCM BIT_AND
BIT_OR BIT_XOR BIT_NOT SHIFT_LEFT SHIFT_RIGHT WRAP. They stay usable
as names (a variable E, a FUNCTION GCD): the program's own wins.
- vcgen: an overflow obligation on every sized result, then the range
as a fact (also for sized parameters and loop-cut variables); FLOAT32
arithmetic as its own uninterpreted functions, constants rounded
exactly, TOFLOAT32(v) otherwise; argument obligations for SQRT, the
logarithms, ASIN/ACOS, LOG1P, CLAMP and the shifts; nothing proved
under USE IEEE.
- testing: the fuzzer tries the edges of a sized type and generates
FLOAT32 values.
- pseudo-to-mojo: Int8..Float32, conversions, the new built-ins through
std.math (each name in the harvested index), a note where Mojo wraps.
- Tests: numeric.test.mjs; corpus 49-52; prover fixtures int8-overflow,
float32-store, ieee-nan; the reference documents every new form.
Gate: 324 pass (core). New Mojo uses std.math names the interpreter has
not been verified on (listed in sync-mojo's KNOWN_GAPS); they need
pixi run mojo-verify on the network before the interpreter runs them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgvbRdoEheAHqsRmr2WuKZ