Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions docs/status/PROOF-STATUS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ missing crate as missing from every build.
* Negative controls: a planted false lemma is rejected. A planted
`Admitted` compiles, and `Print Assumptions` reports it as an axiom.
* Receipt state: superseded on 2026-11-10 by the CI receipt below.
* CI receipt (current): Rocq 8.18.0 in the pinned Guix (`8edb9da`), same
invocation, at commit `336768958d01`, run 42896264290. The file SHA-256 is
unchanged, and `Print Assumptions` reports `absent_under_all_features`
closed under the global context.
* CI receipt (superseded on 2026-11-13): Rocq 8.18.0 in the pinned Guix
(`8edb9da`), same invocation, at commit `336768958d01`, run 42896264290.
The file SHA-256 is unchanged, and `Print Assumptions` reports
`absent_under_all_features` closed under the global context.
* CI receipt (current, 2026-11-13): the same, at main `034f215`, run
43498592499. It records the inputs manifest and an empty `(axioms)`
clause, as PROOF-POLICY §8.5.1 now requires (standards `e5a39d7`). The
file SHA-256 is unchanged.

|Lean leg
|`PROVEN`, route `re-proved`, correspondence `RECONCILED`. Receipt:
Expand All @@ -132,9 +136,13 @@ missing crate as missing from every build.
definition are rejected. A planted `sorry` compiles with a warning, and
`#print axioms` reports `sorryAx`.
* Receipt state: superseded on 2026-11-10 by the CI receipt below.
* CI receipt (current): Lean 4.29.0 in the pinned Guix (`8edb9da`), same
invocation, at commit `336768958d01`, run 42896264290. The file SHA-256 is
unchanged, and no declared theorem depends on an axiom.
* CI receipt (superseded on 2026-11-13): Lean 4.29.0 in the pinned Guix
(`8edb9da`), same invocation, at commit `336768958d01`, run 42896264290.
The file SHA-256 is unchanged, and no declared theorem depends on an axiom.
* CI receipt (current, 2026-11-13): the same, at main `034f215`, run
43498592499. It records the inputs manifest and an empty `(axioms)`
clause, as PROOF-POLICY §8.5.1 now requires (standards `e5a39d7`). The
file SHA-256 is unchanged.

|Why neither leg is transported
|Lambdapi's Rocq and Lean exports translate before elaboration and drop
Expand Down
16 changes: 16 additions & 0 deletions scripts/registry/claims-registry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// instead of fetching them (the tests use it; CI fetches).
import {readFile, writeFile, mkdir, mkdtemp, rm} from 'node:fs/promises';
import {existsSync} from 'node:fs';
import {spawnSync} from 'node:child_process';

Check failure on line 27 in scripts/registry/claims-registry.mjs

View workflow job for this annotation

GitHub Actions / Hypatia neurosymbolic scan

[hypatia] Shell execution -- validate input before passing to shell (1 occurrences, CWE-78, line 27)
import {tmpdir} from 'node:os';
import {createHash} from 'node:crypto';
import {fileURLToPath, pathToFileURL} from 'node:url';
Expand Down Expand Up @@ -59,6 +59,18 @@
const KINDS = new Set(['theorem', 'demonstration', 'assumption']);
const PWG = new Set(['PWG-1', 'PWG-2ii', 'PWG-2i', 'PWG-3', 'ungraded']);
const SHELVES = new Set(['theory', 'applied']);
// ADR 0004: a record has exactly these fields, and holds no grade, token, leg
// or flag (those are read from the receipt). The set is closed, as in
// bridges.mjs and theory.mjs: any other field is refused, never ignored.
const FIELDS = new Set(['id', 'repo', 'claim', 'kind', 'statement', 'status_doc', 'agda', 'shelf',
'source_commit', 'receipt']);
const AGDA_FIELDS = new Set(['module', 'names']);
const RECEIPT_FIELDS = new Set(['path', 'sha256']);

// Throw unless every key of `object` is in `allowed`.
const closed = (object, allowed, label, where) => {
for (const k of Object.keys(object)) if (!allowed.has(k)) throw new Error(`${label} ${k}: ${where}`);
};

// The canon reader, pinned by commit and by the digest of its file. A reader
// that is not this file is refused, so a grade never comes from an unpinned rule.
Expand Down Expand Up @@ -89,6 +101,8 @@
const seen = new Set();
for (const r of rows) {
const where = r && r.id ? r.id : JSON.stringify(r);
if (r === null || typeof r !== 'object' || Array.isArray(r)) throw new Error(`A claim record is an object: ${where}`);
closed(r, FIELDS, 'Unknown field (a record holds no grade, token, leg or flag):', where);
if (typeof r.repo !== 'string' || !/^[-\w.]+\/[-\w.]+$/.test(r.repo)) throw new Error(`Invalid repo: ${where}`);
if (typeof r.claim !== 'string' || r.claim === '') throw new Error(`Missing claim id: ${where}`);
if (r.id !== `${r.repo}#${r.claim}`) throw new Error(`id must be repo#claim: ${where}`);
Expand All @@ -102,12 +116,14 @@
if (!r.agda || typeof r.agda.module !== 'string' || !Array.isArray(r.agda.names) || r.agda.names.length === 0)
throw new Error(`A theorem names its Agda module and names: ${r.id}`);
}
if (r.agda !== null && r.agda !== undefined) closed(r.agda, AGDA_FIELDS, 'Unknown agda field', r.id);
if (r.repo === HOME && r.kind === 'theorem') {
if (!SHELVES.has(r.shelf)) throw new Error(`A home theorem is on the theory or the applied shelf: ${r.id}`);
} else if ('shelf' in r) throw new Error(`Only a home theorem names a shelf: ${r.id}`);
if (r.receipt !== null) {
if (!r.receipt || typeof r.receipt.path !== 'string' || !/^[0-9a-f]{64}$/.test(r.receipt.sha256 ?? ''))
throw new Error(`receipt is null or {path, sha256}: ${r.id}`);
closed(r.receipt, RECEIPT_FIELDS, 'Unknown receipt field', r.id);
}
if (visibility.get(r.repo) !== 'public') throw new Error(`Nonpublic or unlisted repository: ${r.id}`);
}
Expand Down
15 changes: 15 additions & 0 deletions tests/registry/claims-registry.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ test('validation fails closed', () => {
expect(() => validate([{...theorem, shelf: 'theory'}], inv)).toThrow(/Only a home theorem names a shelf/);
});

// ADR 0004: a record has exactly the listed fields and holds no grade, token,
// leg or flag. Each of these rows was accepted before validate() was closed.
test('validation is closed over the ADR 0004 field set', () => {
for (const extra of [{pwg: 'PWG-1'}, {grade: 'PWG-1'}, {token: 'proven'}, {legs: []}, {leg: 'rocq'},
{flags: ['--safe']}, {foundation_diverse: true}, {nonsense: 42}]) {
expect(() => validate([{...theorem, ...extra}], inv)).toThrow(/Unknown field/);
}
expect(() => validate([{...theorem, agda: {module: 'M', names: ['t'], pwg: 'PWG-1'}}], inv)).toThrow(/Unknown agda field/);
const receipt = {path: 'verification/receipts/x_praxis.deed', sha256: 'b'.repeat(64)};
expect(validate([{...theorem, receipt}], inv)).toHaveLength(1);
expect(() => validate([{...theorem, receipt: {...receipt, pwg: 'PWG-1'}}], inv)).toThrow(/Unknown receipt field/);
const {status_doc: _, ...missing} = theorem;
expect(() => validate([missing], inv)).toThrow(/Missing status_doc/);
});

test('only the pinned reader is loaded', async () => {
const dir = mkdtempSync(path.join(tmpdir(), 'reader-'));
mkdirSync(path.join(dir, path.dirname(READER.path)), {recursive: true});
Expand Down
Loading