Proof Runner Reference
The math-engine proof command and the image's own commands: every option, environment variable, execution stage, status and exit code.
math-engine proof
math-engine proof [NAME] [--list] [--out DIR] [--systems S1,S2] [--verify DIR] [--json]
| Option | Effect | Verification |
|---|---|---|
NAME |
run that investigation (Chapter 30) | verified in the reference environment |
--list |
list the eight investigations, then tutorials and any reader-added ones, with evidence kind (with no NAME and no --list, the same list is printed and the exit code is 2) |
verified in the reference environment |
--out DIR |
write the run to DIR (default out/proof-NAME). A non-empty DIR that is not an earlier run is refused; an earlier run there is replaced |
verified in the reference environment |
--systems |
run only these of lean, rocq, python; the status is then partial_run |
verified in reference run 3 |
--verify DIR |
check an earlier run’s files; reruns nothing; NAME may be omitted |
verified in the reference environment |
--json |
print result.json instead of the summary |
not verified |
Exit codes. 0 for any status other than run_failed and partial_run; 1
for those two, and for --verify with problems; 2 for a refused request (an
unknown name, an unknown system, a malformed contract, a non-run output
directory). checked_unpinned exits 0: a rehearsal that passed is not an
error.
Environment variables
| Variable | Default | Used for |
|---|---|---|
MATH_PROOF_LEAN |
lake env lean, run in formal/lean |
Lean checks and Lean controls |
MATH_PROOF_ROCQ |
rocq compile if rocq is on the path, else coqc |
Rocq checks and controls |
MATH_PROOF_CORE_LEAN |
lean |
core-Lean programs ({core_lean} in a contract), recorded separately |
MATHENV_IMAGE_ID |
unset | recorded as the image identifier; one of the two ways a run counts as pinned |
MATHENV_HOME |
/opt/mathenv |
where the image’s build-info.json is found; its hash is the other way |
UV_OFFLINE |
unset | with uv, never fetch packages. Required with --network none: the image runs uv sync before every command |
Each external command has a time limit of 1800 seconds.
What a run does, in order
- Load and validate the contract; record its sha256.
- Run each check in contract order:
files(hash inputs),archive(verify an imported record),leanandrocq(compile, bind, print axioms, export types),python(run the program). - Run each control.
- Record the environment: image identifier and build-manifest hash, tool versions (Lean, Rocq, core Lean, Python, SymPy), source commit, whether tracked files differed from it, and per-file comparison of the checked sources with that commit.
- Read
approvals.jsonand count valid approvals. - Decide the status (below).
- Write
result.json,notebook.md,notebook.ipynbandSHA256SUMS.
Statuses
The first row that applies decides.
| Status | When | Exit |
|---|---|---|
run_failed |
any check or control did not behave as the contract says | 1 |
partial_run |
--systems left out a system the contract uses |
1 |
checked_unpinned |
all passed, but not in the image, or not with the expected versions | 0 |
kernel_checked_correspondence_pending / _approved |
all passed, pinned; evidence kind kernel |
0 |
computed_correspondence_pending / _approved |
all passed, pinned; evidence kind computation |
0 |
historical_verified_correspondence_pending / _approved |
all passed, pinned; evidence kind historical: no kernel ran |
0 |
_approved needs at least one valid approval (Chapter 31).
The image’s own commands
The image’s entry point is mathenv. Every command first copies the mounted
book (/source, or the snapshot built into the image) to /workspace,
removing untracked files unless MATHENV_KEEP_UNTRACKED=1.
| Command | Does | Verification |
|---|---|---|
math-env proof NAME [options] |
math-engine proof NAME … --out /out/proof-NAME; not in the current image (added in d4189ac, after it was built) |
not available in the current image |
math-env proof --list |
the list; not in the current image | not available in the current image |
math-env selftest |
one line per tool, each ok |
verified in the reference environment |
math-env info |
build commit, tool versions and hashes | verified in the reference environment |
math-env (no command) |
a shell in a fresh scratch copy | not verified |
math-env CMD ARGS |
any other command, in a fresh copy (e.g. uv run --offline pytest -q …) |
verified in the reference environment |
math-env check NN, math-env list |
the earlier edition’s chapter checks (archive; Appendix C) | not verified |
math-env isabelle …, math-env sage … |
bundled tools, not used by the eight investigations | not used by the eight investigations |
Further Reading
For deeper study; not sources for the chapter’s claims.
- The Open Group. “Utility Conventions.” POSIX.1-2017, §12, 2017. link. Why read it: The standard conventions for command-line options, operands and exit statuses that the proof runner follows.
- Gregory M. Kurtzer, Vanessa Sochat, Michael W. Bauer. “Singularity: Scientific containers for mobility of compute.” PLoS ONE 12(5) (2017), e0177459. DOI. Why read it: A peer-reviewed account of reproducible scientific containers, relevant to the pinned environment that makes a run repeatable.
Next in Part IV: Chapter 33, the evidence records.