Commands and vocabulary
Run repository commands from its root. The getting-started exercise shows the complete first use; contribution policy governs which evidence is required. A zero exit status means that command's stated scope passed.
| Situation | Command | Result and next step |
|---|---|---|
| Cold editor checkout | scripts/cache/ensure.sh | Attempts cache restoration; if imports are still missing, build the affected target or follow the cache guide |
| Check a complete named client | scripts/build.sh CslibFrontierTests.NPCompleteness --wfail --iofail | Builds that client and dependencies; inspect the first error before broadening the build |
| Build one domain slice without the whole library | scripts/build.sh CslibFrontierSQL --wfail --iofail | Builds only a self-contained slice library declared in lakefile.toml (CslibFrontierSQL, CslibFrontierSAT, CslibFrontierStreaming, CslibFrontierCryptoMLDSA, CslibFrontierCryptoMLKEM, CslibFrontierBooleanAnalysis); none is in defaultTargets |
| Check library changes and importing clients | scripts/check.sh --quick --no-full-fallback | Checks manuals, changed sources and transitive importing clients; inspect the reported scope. Status 3 means quick mode cannot plan the change: run focused checks and use hosted CI for full validation |
| Full local validation when explicitly requested or hosted CI is unavailable | scripts/check.sh | Runs the manuals and every locally runnable required CI step, including the six Lean gates; any failure prevents treating the run as full validation. Successful CI covering the final revision need not be repeated locally |
| Add a library module | lake exe mk_all | Regenerates the library aggregate; inspect its diff and check the affected client |
| Check aggregate completeness | lake exe mk_all --check | Fails if an aggregate is stale; regenerate it and review the change |
| Check manual links and contextual excerpts | python3 scripts/check_operator_manual.py | Reports current-source matches, broken links, source line links that no longer start a declaration or that miss the declaration of the linked file their link text names, list items directly after a paragraph line (which the PDF prints as running text), locators such as Section 5.6 inside the label of a link into sources.md (which the PDF replaces by a citation number), lines of sources.md with more than one sentence, and pages missing from the book's chapter lists; repair the affected prose, link, canonical example or list |
| Format the manual bibliography one sentence per line | python3 scripts/sources_format.py --write | Splits multi-sentence lines of manual/sources.md while keeping every word and block unchanged |
| Repoint drifted declaration line anchors in manuals | python3 scripts/check_operator_manual.py --fix-anchors | Updates drifted [Ns.name](File.lean#Ln) links whose named declaration has a unique current header before running the link check; inspect remaining ambiguous, range or prose anchor errors by hand |
| Check the manual checker | python3 scripts/test_operator_manual.py | Runs isolated positive and negative controls; failure identifies a checker regression |
| Generate an editable book | python3 scripts/build_operator_manual.py | Writes LaTeX/PDF under ignored manual/_build/; inspect changed pages before distributing |
| See isolated worktrees | scripts/worktree.sh list | Lists registered work; inspect ownership before takeover or removal |
| Queue an approved PR | python3 <trusted-helper> <PR> <approved head> --repo OWNER/NAME | Use the helper from current main; queues exactly the approved head after review holds clear and required checks pass |
| Find approved PRs that are not queued | python3 scripts/tender_report.py | Read-only. Lists PRs approved at their exact head with green checks and no live hold, those needing a human read of a hold, restack candidates, expired HOLD lines, expired review claims and released PRs (draft or ready) not yet taken over; read the PR before queueing |
| Estimate per-author improvement share (advisory proxy) | python3 scripts/tender_report.py --share | Local Git only (advisory): title-based per-author proxy of refactor/perf/style merges on origin/main over 7 days, noting authors with ≥10 merges below one in five; combines fleets on a shared account and does not check evidence; fetch first |
| Find stalled drafts, claims and change requests | python3 scripts/stale_notices.py | Dry run lists drafts idle 7 days, issue claims idle 3 days and change requests unanswered 48 hours, excluding PRs currently released to coordinators. --apply --identity <text> posts one marked notice per stall (skipping items already noticed since their last activity or within 24 hours); it never closes anything |
| Find branches that can be deleted | python3 scripts/branch_cleanup.py --delete merged | Dry run categorizes every branch and lists unprotected ones of the selected kinds (merged, closed, nopr; the last two need --older-than, default 14d). --apply deletes them, writes a JSON log and prints a restore command per branch. No-PR branches need a notice first: --notice --identity <text> writes comment file(s) (--notice-report prints the table), and --delete nopr --apply needs --notice-issue <N> |
| Remove a PR from the merge queue before pushing to it | gh api graphql -f id="$(gh pr view <PR> --json id --jq .id)" -f query='mutation($id: ID!) { dequeuePullRequest(input: {id: $id}) { mergeQueueEntry { state } } }' | GitHub declines pushes to a queued PR's branch; this (or Remove from queue on the PR page) removes it and merges nothing. Push the restack, then queue the new head under Restacks |
| Check a restacked PR | python3 scripts/check_restack.py <approved head> <new head> | Run from a checkout of current origin/main. For a PR approved while stacked, add --approved-base <lower head at approval>. Exit 0: the new head is the approved change replayed onto newer main, and the approval carries once CI passes at the new head; exit 1: review the printed diffs |
Restack a PR whose only conflicts are in generated files, references.bib or manual/sources.md | python3 scripts/restack_mechanical.py <PR> --approved-head <approved head> | Dry run: refuses a head that is not the approved change, merges origin/main with the aggregate, bibliography and sources drivers, writes the aggregates as mk_all would and runs the restack check; refuses any other conflict. Add --push to publish the merge, which happens only if the check passes and the branch has not moved; once CI passes and review holds clear, use the printed PR/head with the trusted queue helper |
The full validation sequence is maintained in AGENTS.md, and cache behavior in the cache guide. Commands above call those same scripts; they do not define an independent validation policy.
Verified command-line tools and differential tests#
Non-default [[lean_exe]] targets in lakefile.toml compile formalized
solvers, proof checkers and evaluators; build a binary first with lake build <name>.
| Tool or check | Command | Result and scope |
|---|---|---|
| Solve DIMACS CNF and emit LRAT | lake exe cdcl [options] INPUT.cnf [PROOF.lrat] | Runs the verified CDCL solver (scripts/Cdcl.lean); prints s SATISFIABLE with a model (exit 10) or s UNSATISFIABLE and optional LRAT certificate (exit 20) |
| Check a DIMACS CNF + LRAT refutation | lake exe lrat_check FORMULA.cnf PROOF.lrat | Runs CNF.checkDIMACSLRAT on text or binary LRAT (scripts/LratCheck.lean); prints s VERIFIED UNSAT (exit 0) or s REJECTED (exit 1) |
| Elaborate and kernel-check a VeriPB proof | lake exe veripb_elab [--cnf] [--emit OUT.pbp] FORMULA PROOF | Elaborates an augmented VeriPB proof and checks the resulting kernel proof (scripts/VeriPBElab.lean); exits 0 on s VERIFIED |
| Encode or check subgraph isomorphism and clique | lake exe pb_graph iso P.lad T.lad [PROOF.pbp] | Prints the labelled OPB encoding, or checks a kernel VeriPB proof (iso or clique; scripts/PBGraph.lean) |
Evaluate and simplify a Cslib.SQL query | lake exe sql_eval [--simplify] [--join-size] [INPUT.json] | Evaluates a JSON-encoded typed schema and query or expression (--batch for JSONL) through Cslib.SQL and Cslib.Streaming.joinSize (scripts/SqlEval.lean); emits deterministic JSON with exact bag multiplicities |
Differential-test Cslib.SQL against SQLite | python3 -B scripts/diff_test_sql.py --cases 300 --seed 42 | Compares .lake/build/bin/sql_eval (raw and Query.simplify outputs plus equijoin sizes) against in-memory sqlite3 on curated edge cases and seeded random queries (scripts/diff_test_sql.py) |
Differential-test cdcl and lrat_check | python3 -B scripts/diff_test_sat.py --random 60 --seed 42 | Runs .lake/build/bin/cdcl across structured and phase-transition 3-SAT families, checks every SAT model independently, feeds every UNSAT proof to .lake/build/bin/lrat_check, and checks corrupted-proof rejection (scripts/diff_test_sat.py) |
Search before adding an API#
The following read-only searches use rg (ripgrep). If it is unavailable, use editor
workspace search. After dependencies are present, search all three libraries:
rg -n 'ComputableInPolyTime' CslibFrontier CslibFrontierTests .lake/packages/cslib/Cslib
rg -n 'iterate_spec|iterateWith_spec' CslibFrontier .lake/packages/cslib/Cslib
rg -n 'yourCandidateName' CslibFrontier .lake/packages/cslib/Cslib .lake/packages/mathlib/Mathlib
A hit gives a source location to inspect, not an interchangeable theorem. Read its full statement and imports. If there are no hits, check spelling and namespace, related notions, the model routes and upstream coordination before declaring the API absent.
Vocabulary#
| Term | Meaning in the manual |
|---|---|
| Model | A specified syntax or state space, semantics and resource convention |
| Encoding | The representation of an input or output as a finite word; its length affects bounds |
| Plain computability | The public machine-existence/resource contract; tidy machine machinery stays inside proofs |
| Certificate | A Lean proof of a stated property, such as computation cost; it does not supply unrelated functional correctness |
| Program | Free syntax that can be interpreted with semantics and resource bounds; a PMF alone describes a distribution |
| Native realization | A theorem connecting a program or abstract model to the selected machine interface |
| Uniformity | A single effective construction or machine across inputs/sizes; separate per-size existence is weaker |
| Bridge | A proved translation between specified models, preserving the advertised semantics and charging its overhead |
| Contextual excerpt | Exact code from a linked complete client; imports, namespaces and preceding assumptions remain necessary |
| Validation | The checks actually run on a stated revision, with their scope and outcome |
| Independent review | Inspection by a non-author who did not design or implement the reviewed change |
| Snapshot evidence | A dated source or development observation; it does not automatically describe later revisions |
For the model-specific meaning of time, workspace, error, query cost, circuit size, advice, adversary access and other resources, use the model selection table and its linked reference chapters. Do not infer one resource convention from another's name.