A proof report says when the clock stopped it
Test / gate (push) Canceled after 0s

The Prove tab gives each routine 3 seconds on the clock, and on a slow
or busy machine that runs out before the proof does: claims stay open
with nothing to say why. Now the prover marks a unit it ran out of time
on (timedOut, and an out-of-time note), checkProperties says when the
clock cut its inputs short, and ProofReport.clock carries the budget and
the routines it stopped, so a caller can offer more time.
This commit is contained in:
alexm committed 2026-11-13 06:55:11 -05:00
1 parent b10a5c87a3
commit 38e6e2cdd2
9 files changed
+40 -11

No files matched your search

+10
View File
@@ -97,10 +97,20 @@ test('the time on the clock is the caller\'s: run out, it leaves a subroutine pa
const src = fs.readFileSync(new URL('../library/pseudo/programs/19-max-subarray.pseudo', import.meta.url), 'utf8');
const whole = provePseudo(studyOf(src), NO_CLOCK);
assert.deepEqual(whole.counts, { proved: 6, broken: 0, open: 0, total: 6 });
assert.deepEqual(whole.clock, { budgetMs: Infinity, stopped: [] });
assert.ok(whole.units.every((u) => !u.timedOut && !u.notes.some((n) => /ran out of time/.test(n))));
// a clock that has already run out (what 3 seconds were on CI's runner): the subroutine with the loop is partial
const cut = provePseudo(studyOf(src), { budgetMs: -1 });
assert.equal(cut.units.find((u) => u.name === 'MAX_SUBARRAY').partial, true);
assert.ok(cut.counts.proved < 6 && cut.counts.broken === 0, JSON.stringify(cut.counts));
// and the report says it was the clock: which routines, with what budget, and a note on each
assert.equal(cut.clock.budgetMs, -1);
assert.ok(cut.clock.stopped.includes('MAX_SUBARRAY'), JSON.stringify(cut.clock));
const stopped = cut.units.find((u) => u.name === 'MAX_SUBARRAY');
assert.equal(stopped.timedOut, true);
assert.equal(stopped.notes.filter((n) => /ran out of time.*open, not disproved/.test(n)).length, 1);
// left out, the clock is the Prove tab's (whether it is reached is the machine's, and not asserted)
assert.equal(provePseudo(studyOf(src)).clock.budgetMs, 3000);
// a Workspace hands its own on, and proves again when it changes
const ws = new Workspace({ sources: { pseudo: src }, lang: 'pseudo' });
ws.proofBudgetMs = -1;