Stop a run on a FLOAT that is not finite, so proofs about FLOAT hold

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
This commit is contained in:
alexmandClaude committed 2026-10-05 03:21:18 +00:00
1 parent dd1e949ea2
commit c652b86a2a
7 files changed
+58 -7

No files matched your search

+9 -2
View File
@@ -2,7 +2,9 @@
//
// 1. The regression programs in tests/prover/ each name, in a `// MUST-NOT-PROVE: <kind>@<line>`
// header, an obligation that a run of the program breaks. Each one was proved by an unsound
// rule once; the rule is fixed, and the obligation may never be proved again.
// rule once; the rule is fixed, and the obligation may never be proved again. A program whose
// fix was to the language instead (a run that now stops where it used to go on outside what a
// proof covers) names where it stops with `// RUN-STOPS: <runtime kind>@<line>`.
// 2. Across every exercise, every corpus program, every lesson solution and those regression
// programs, no obligation the prover marks proved is broken by the fuzzer (matched by kind,
// line and column) or by running the program as written (matched by kind and line).
@@ -71,7 +73,12 @@ test('regression programs: an obligation an unsound rule once proved is never pr
for (const f of files) {
const src = fs.readFileSync(path.join(PROVER_DIR, f), 'utf8');
const marks = [...src.matchAll(/^\/\/ MUST-NOT-PROVE: ([a-z-]+)@(\d+)\s*$/gm)].map((m) => ({ kind: m[1], line: Number(m[2]) }));
assert.ok(marks.length, `${f} has no MUST-NOT-PROVE line`);
const stops = [...src.matchAll(/^\/\/ RUN-STOPS: ([a-z-]+)@(\d+)\s*$/gm)].map((m) => `${m[1]}@${m[2]}`);
assert.ok(marks.length || stops.length, `${f} has no MUST-NOT-PROVE or RUN-STOPS line`);
if (stops.length) {
const run = runPseudo(studyOf(src), {});
assert.ok(run.error && stops.includes(`${run.error.kind}@${run.error.line}`), `${f}: the run should stop at ${stops.join(' or ')}, and ${run.error ? `stopped at ${run.error.kind}@${run.error.line}` : 'it finished'}`);
}
const st = studyOf(src);
assert.ok(st.ok, `${f} does not parse`);
const r = verify(st.program.program, { budgetMs: 3000 });
+10
View File
@@ -0,0 +1,10 @@
// The prover treats a FLOAT as a number: Y == Y, and X < X + 1.0 or not.
// Infinity and NaN are not numbers in that sense. A run that let 1.0E308 *
// 10.0 become infinity, and X - X become NaN, broke both claims while the
// checker proved them. Such a run now stops at the overflow instead.
// RUN-STOPS: overflow@7
DECLARE X, Y : FLOAT
X <- 1.0E308 * 10.0
Y <- X - X
ASSERT Y == Y
OUTPUT Y