Add USE and pin pplus-library: routines verified once, used by name
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
This commit is contained in:
21 files changed
+2654
-20
No files matched your search
@@ -34,6 +34,12 @@ engines-export = { cmd = "node scripts/engines-export.mjs {{ static }}", args =
|
||||
dafny-fetch = { cmd = "python scripts/dafny.py fetch", description = "Download the pinned Dafny into .tools/, checked by SHA-256 (network, once)" }
|
||||
dafny = { cmd = "python scripts/dafny.py", description = "Run the pinned Dafny with the arguments given, e.g. pixi run dafny verify file.dfy (fetches it first if missing)" }
|
||||
|
||||
# --- the library (library/, the pplus-library submodule; docs/library.md) ---
|
||||
library-check = { cmd = "node scripts/library.mjs check", depends-on = ["build"], description = "Check every library routine at every level (cases, prover, fuzzer, generated Mojo, every reference, the Dafny proof); writes library/status.json and STATUS.md" }
|
||||
library-emit = { cmd = "node scripts/library.mjs emit", depends-on = ["build"], description = "Regenerate src/library/generated.ts, the registry USE reads, from library/" }
|
||||
library-verify-mojo = { cmd = "node scripts/library.mjs mojo-sources | python scripts/library_godbolt.py", depends-on = ["build"], description = "Ask the pinned Mojo compiler about every Mojo reference of the library and store the answers (network)" }
|
||||
library-harness = { cmd = "node scripts/library.mjs harness {{ id }} {{ lang }} {{ level }}", args = ["id", "lang", "level"], depends-on = ["build"], description = "Print the program a reference implementation is run as, e.g. pixi run library-harness md.LennardJones c multiply" }
|
||||
|
||||
# --- write content ---------------------------------------------------------
|
||||
new-exercise = { cmd = "node scripts/new-exercise.mjs {{ id }}", args = ["id"], description = "Start an exercise: mojo/local/<id>.mojo and src/exercises/<id>.ts, registered in index.ts" }
|
||||
new-probe = { cmd = "node scripts/mojo/new-program.mjs probe {{ name }} \"{{ question }}\"", args = ["name", "question"], description = "Start mojo/probes/<name>.mojo: one question about the pinned compiler" }
|
||||
@@ -59,5 +65,5 @@ mojo-probes-local = { cmd = "for f in mojo/probes/*.mojo; do echo \"== $f\"; moj
|
||||
mojo-update = { depends-on = ["mojo-harvest", "mojo-verify", "mojo-status", "test"], description = "After editing mojo/pin.json: harvest, verify, status, test" }
|
||||
|
||||
# --- ship ------------------------------------------------------------------
|
||||
ci = { depends-on = ["test", "mojo-status-strict"], description = "What CI runs: every test, and no program of ours failing" }
|
||||
ci = { depends-on = ["test", "mojo-status-strict"], description = "What CI runs: every test (the library's registry up to date among them), and no program of ours failing" }
|
||||
package = { cmd = "python scripts/package.py", description = "Zip the files git tracks (and new ones it does not ignore) into package/ for sharing" }
|
||||
Reference in new issue
Block a user