The engines had no tests of their own in the course repository; this
repository now owns them, so a change to solver.js or vcgen.js needs
something to answer to besides the end-to-end tests.
tests/engine-solver.test.mjs holds:
- a table of goals the solver must prove (transitivity, integer
tightening, case splits, congruence on positions, DIV and MOD by a
constant, lengths at least 0) and goals it must leave unknown (a false
step, FLOAT tightening, products of unknowns, rounded FLOAT addition,
different positions); one known gap, 2X == 1 not seen as impossible, is
recorded so an improvement shows up;
- 400 random linear integer formulas with DIV, MOD, if-then-else and
boolean structure; every one the solver proves is checked against all
729 assignments of X, Y, Z in [-4, 4];
- programs whose obligations must come out proved or not: a counting loop
with its invariant, an index one past the end, a division that needs a
REQUIRE, FILL and RANDINT arguments, and the int-model note.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgvbRdoEheAHqsRmr2WuKZ
The prover reasons about a FLOAT as a number: Y == Y holds, and X < Z or
X >= Z. The interpreter let 1.0E308 * 10.0 become infinity and X - X become
NaN and carried on, so a run broke claims the prover had proved
(tests/prover/float-overflow.pseudo proved ASSERT Y == Y with Y NaN).
The notation already stops on a FLOAT division by zero and on a whole number
past 2^53 - 1. It now also stops, with an 'overflow' error, when an
arithmetic result, a built-in's result or a literal is not a finite number
(finiteCheck in interp.js). Every run then stays inside what a proof covers.
Regression programs whose fix was to the language rather than to a rule now
say where the run must stop, with a RUN-STOPS header the soundness test
checks.
A unit that does FLOAT arithmetic now carries a 'float-model' note: FLOAT is
treated as a finite number, rounding is opaque, and the lab stops past about
1.8e308, while the generated Mojo goes on with inf or nan (stated for a
division by zero, the case probes/float-special has verified).
New probe mojo/probes/float-overflow.mojo asks the compiler what a Float64
product past the largest double gives; it is unverified and needs
pixi run mojo-verify-item 'probes/float-overflow' (network).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgvbRdoEheAHqsRmr2WuKZ
The prover could mark an obligation proved that a run of the same program
breaks. Two rules did it, both found with programs now in tests/prover/:
- Invariant inference (vcgen.js infer) stopped after four rounds and assumed
the candidates left even when the last round had still been dropping some.
A non-inductive guess became a fact, and a false ASSERT was proved
(houdini-cap.pseudo). Inference now runs up to eight rounds and keeps its
guesses only when a whole round leaves them unchanged.
- RAND(X) assumed 0 <= R < X for every X. For X <= 0 that fact is false
(RAND(0.0) is 0.0, RAND(-1.0) is in (-1, 0]), so the checker held a
contradiction and proved anything, even ASSERT 1 == 2 (rand-zero,
rand-negative). The fact now covers all three signs of X.
FILL and RANDINT assumed facts about their arguments that the interpreter
enforces by stopping the program, without asking whether the arguments are
allowed. A crashing call was reported as fully proved. They now raise an
obligation of a new kind, 'argument' ("Argument allowed"), mapped to the
runtime 'value' error, and their facts are guarded.
tests/prover-soundness.test.mjs is the gate: each regression program's
MUST-NOT-PROVE obligation stays unproved and is really broken by a run, and
across every exercise, corpus program, lesson solution and example, nothing
marked proved is broken by the fuzzer (kind, line, column) or by running the
program (kind, line).
In the app, a proved obligation that a generated input breaks at the same
place is now shown as broken rather than proved.
Proofs over INTEGER are about whole numbers of any size; a unit that does
integer arithmetic now carries an 'int-model' note saying so, with the lab's
2^53 - 1 limit and Mojo Int's wraparound past 2^63 - 1 (from the stored
godbolt answer for probes/int-overflow-int).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgvbRdoEheAHqsRmr2WuKZ