From d7ffaf12be05478311dffe7ba43393df2e939047 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 6 Nov 2026 16:05:27 -0600 Subject: [PATCH 1/2] Add lean-verify skill: Lean 4 + Mathlib safety proofs through the lean MCP --- AGENTS.md | 3 +- README.md | 1 + skills/lean-verify/SKILL.md | 145 ++++++++++++++++++++++++++++++++++ skills/omega-harness/SKILL.md | 6 ++ 4 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 skills/lean-verify/SKILL.md diff --git a/AGENTS.md b/AGENTS.md index 3ee7f89..cf91db8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ Agent skills for working in Omega and the AIEN repositories: the checks that cat repeat, written as guidance an agent loads before acting. It is documentation and procedure, not a compiler, a runtime, a gate, or evidence that any claim is true. -Seven skills live under `skills//SKILL.md` in the Agent Skills layout (frontmatter `name` and +Eight skills live under `skills//SKILL.md` in the Agent Skills layout (frontmatter `name` and `description`, then the body): | Path | Covers | @@ -20,6 +20,7 @@ Seven skills live under `skills//SKILL.md` in the Agent Skills layout (fro | `skills/aien-repositories/SKILL.md` | Mission, plan authority, task to repository routing, status discipline, known source drift | | `skills/crumb-protocol/SKILL.md` | Directory coordination: crumbs, locks, committed-crumb freshness, `CRUMB-VERIFY` and `crumb-doctor` | | `skills/wolfram-math/SKILL.md` | Mandatory Wolfram for every computation, its MCP setup, verification calls and failure handling | +| `skills/lean-verify/SKILL.md` | Lean 4 + Mathlib proofs of safety invariants over an explicit model, the `lean` MCP setup and pins, `sorry`/axiom checks, the model-to-system link | `examples/` holds the tested programs: each `NAME.om` with `NAME.expect` (and `NAME.stdout` when it prints), one per trap and error code plus the common mistakes. `examples/gate.sh OMC` checks the diff --git a/README.md b/README.md index 4164c7e..7b97e88 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Skills can't make agents flawless. What these do is turn the mistakes agents kee | [`aien-repositories`](skills/aien-repositories/SKILL.md) | What AIEN builds, who decides what, and which repository owns a task | | [`crumb-protocol`](skills/crumb-protocol/SKILL.md) | Directory coordination: read and respect crumbs, claim and release locks, keep committed crumbs fresh, answer `CRUMB-VERIFY` and `crumb-doctor` | | [`wolfram-math`](skills/wolfram-math/SKILL.md) | Mandatory Wolfram for every computation: MCP setup an agent can do alone, verification calls, failure handling | +| [`lean-verify`](skills/lean-verify/SKILL.md) | Machine-checked Lean 4 + Mathlib proofs of safety invariants over an explicit model through the `lean` MCP: when to use Lean versus Wolfram, the model-to-system link, no `sorry` or extra axioms | The skills use the Agent Skills layout (`skills//SKILL.md` with `name` and `description` frontmatter), so any agent that reads that layout picks them up. diff --git a/skills/lean-verify/SKILL.md b/skills/lean-verify/SKILL.md new file mode 100644 index 0000000..b5f9516 --- /dev/null +++ b/skills/lean-verify/SKILL.md @@ -0,0 +1,145 @@ +--- +name: lean-verify +description: Machine-checked proofs with Lean 4 + Mathlib through the `lean` MCP server on the Spark. Use to prove a safety invariant (core disjointness, disk floor, lease exclusion, queue bounds, protocol/state-machine properties) about an explicit model, and to check that a proof has no sorry and no extra axioms. +--- + +# Lean 4 verification (`lean` MCP) + +Lean is a verification oracle, the same class as the pinned compiler or `fsck.vfat`: it checks a claim, it does not run in the product path. + +## Pins (checked 2026-11-06) + +| Component | Version | Where | +|---|---|---| +| elan | 4.2.4 (227caca13 2026-08-25) | Spark `~/.elan/bin` | +| Lean toolchain | `leanprover/lean4:v4.35.0` | `~/workspace/lean-verify/lean-toolchain` | +| Mathlib | `v4.35.0` (commit `56a005855ea17e0b0958f73ec801ae140b0a1679`), prebuilt oleans from `lake exe cache get` | `~/workspace/lean-verify/lake-manifest.json` | +| MCP server | `lean-lsp-mcp==0.33.0` (MIT, github.com/oOo0oOo/lean-lsp-mcp tag `v0.33.0` = `ed8aa4b9`), `leanclient==0.13.2`, `mcp==2.2.0` | venv `~/workspace/lean-verify/.mcp-venv`, full list in `.mcp-venv-freeze.txt` | + +Project: Spark `~/workspace/lean-verify` (lake, library `LeanVerify`, local git history). Worked examples: `LeanVerify/Check.lean`, `LeanVerify/CoreAssign.lean`, `LeanVerify/SkillExamples.lean`; sorry negative control: `Controls/SorryControl.lean` (deliberately not in the library). + +The server runs on the Spark over ssh stdio, pinned to cores 0–1 with `nice -n 10`. The four remote search tools (`lean_leansearch`, `lean_loogle`, `lean_leanfinder`, `lean_hammer_premise`) are disabled with `LEAN_MCP_DISABLED_TOOLS`, so `tools/list` returns 18 tools, all local. The full smoke test (below) passed inside `bwrap --unshare-net`, where `curl https://pypi.org` fails, so it needs no network. Search Mathlib with `lean_local_search` (ripgrep) instead. + +`mcp.json` entry (Mac `~/.omp/agent/mcp.json`): + +```json +"lean": { + "type": "stdio", + "command": "ssh", + "args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "spark", "env", "PATH=/home/drakestapleton/.elan/bin:/usr/local/bin:/usr/bin:/bin", "LEAN_PROJECT_PATH=/home/drakestapleton/workspace/lean-verify", "LEAN_LOG_LEVEL=ERROR", "LEAN_MCP_DISABLED_TOOLS=lean_leansearch,lean_loogle,lean_leanfinder,lean_hammer_premise", "taskset", "-c", "0,1", "nice", "-n", "10", "/home/drakestapleton/workspace/lean-verify/.mcp-venv/bin/lean-lsp-mcp", "--transport", "stdio"], + "timeout": 300000 +} +``` + +## Lean or Wolfram? + +| Question | Tool | +|---|---| +| Compute a number, solve, simplify, integrate, convert units, check an identity numerically or symbolically | Wolfram (mandatory, `wolfram-math`) | +| "This property holds for **every** state / input / interleaving of the model" | Lean | +| "These finite sets never overlap", "this arithmetic bound always holds", "two holders can never both own the lease", "the queue never exceeds N" | Lean | +| A proof someone else must be able to re-check mechanically, with an explicit axiom list | Lean | + +Wolfram answers *what is the value*; Lean answers *is this statement true for all cases, with a kernel-checked proof*. Use Wolfram to get a constant, then Lean to prove the invariant that uses it. + +## Tools + +Enabled on the `lean` server (names as `tools/list` returns them; in omp they follow the `mcp___` pattern of the other servers, e.g. `mcp__lean_lean_run_code`): + +- `lean_run_code` `{code}` — check a self-contained snippet (it needs its own `import`s). The usual entry point. Returns `{success, timed_out, diagnostics[]}`. +- `lean_verify` `{file_path, theorem_name}` — axiom check plus source scan for one theorem in a project file. `file_path` is absolute (`/home/drakestapleton/workspace/lean-verify/...`). Returns `{axioms, trust, non_standard_axioms, warnings}` with `trust` one of `standard`, `incomplete` (sorry), `native`, `custom`. +- `lean_diagnostic_messages` — errors/warnings/infos of a project file. +- `lean_goal`, `lean_term_goal` — proof state at a position. +- `lean_multi_attempt` — try several tactics at one position. +- `lean_hover_info`, `lean_completions`, `lean_declaration_file`, `lean_references`, `lean_file_outline`, `lean_local_search`, `lean_code_actions`, `lean_profile_proof`, `lean_minimal_hypotheses`, `lean_get_widgets`, `lean_get_widget_source`, `lean_build`. + +The first call starts `lake serve` and loads Mathlib oleans (about 3–8 s measured). Prefer `import Mathlib.` over `import Mathlib` to keep it fast. + +Observed results (2026-11-06 smoke test): + +| Snippet | `lean_run_code` | Meaning | +|---|---|---| +| `theorem t : (2:Nat)+2=4 := rfl` + `#print axioms t` | `success: true`, info `'t' does not depend on any axioms` | proved | +| `theorem f : (2:Nat)+2=5 := rfl` | `success: false`, error `Not a definitional equality` | refuted | +| `theorem s : (2:Nat)+2=4 := sorry` | **`success: true`**, warning category `sorry`, `'s' depends on axioms: [sorryAx]` | NOT proved | + +`success: true` therefore does **not** mean proved. A theorem is proved only if `success` is true, no diagnostic has category `sorry`, and its axioms are within the standard three. `lean_verify` on a sorry theorem returned `trust: "incomplete"`, `axioms: ["sorryAx"]`. + +## How to state a safety invariant + +1. **Write the model explicitly.** Name every set, constant and transition. Finite, concrete data (`Finset Nat`, `Fin n`) can be decided by the kernel with `by decide`. +2. **State the property as a theorem over the model**, never as a comment. +3. **Write a negative control**: a deliberately broken model and a theorem proving the property *fails* for it. A property that also "holds" for the broken model is vacuous. +4. **Print the axioms** of every theorem. + +```lean +import Mathlib.Data.Finset.Basic +import Mathlib.Order.Disjoint + +-- Core-assignment disjointness (finite, decidable) +def lanes : Fin 3 → Finset Nat + | 0 => {4, 5} | 1 => {6} | 2 => {8, 9} +def reserved : Finset Nat := {3, 7, 15} +theorem lanes_disjoint : ∀ i j, i ≠ j → Disjoint (lanes i) (lanes j) := by decide +theorem no_reserved : ∀ i, Disjoint (lanes i) reserved := by decide + +-- Disk floor arithmetic: a write of w GiB is admitted only if it keeps ≥ floor free +def admit (free w floor : Nat) : Bool := decide (w + floor ≤ free) +theorem floor_kept (free w floor : Nat) (h : admit free w floor = true) : + floor ≤ free - w := by + simp [admit] at h; omega + +-- Lease mutual exclusion: once held, acquire by anyone leaves the holder unchanged +structure St where holder : Option Nat +def acquire (s : St) (p : Nat) : St := if s.holder = none then ⟨some p⟩ else s +def release (s : St) (p : Nat) : St := if s.holder = some p then ⟨none⟩ else s +theorem acquire_excl (s : St) (p q : Nat) (h : s.holder = some q) : + (acquire s p).holder = some q := by simp [acquire, h] +theorem release_other (s : St) (p q : Nat) (h : s.holder = some q) (hpq : p ≠ q) : + (release s p).holder = some q := by simp [release, h, Ne.symm hpq] + +-- Bounded queue capacity: push never exceeds cap +def push (cap : Nat) (q : List Nat) (x : Nat) : List Nat := + if q.length < cap then q ++ [x] else q +theorem push_bounded (cap : Nat) (q : List Nat) (x : Nat) (h : q.length ≤ cap) : + (push cap q x).length ≤ cap := by + unfold push + split + · simp; omega + · exact h + +#print axioms lanes_disjoint -- [propext, Classical.choice, Quot.sound] +#print axioms floor_kept -- [propext, Quot.sound] +#print axioms push_bounded -- [propext, Quot.sound] +``` + +These examples compile as `LeanVerify/SkillExamples.lean` in the project (`lake build` passes). The full worked example is `LeanVerify/CoreAssign.lean`: eight lane sets, `no_reserved` (none uses 3, 7 or 15), `overlap_6_7` (`{0,1} ∩ {1,2} = {1}`), `disjoint_except_6_7` (every other pair is disjoint) and a negative control from a live `taskset -cp` readout. + +For a state machine, prove the invariant is preserved by every transition (`inv s → inv (step s e)`) and holds initially; that gives it for every reachable state by induction. + +## A theorem proves the MODEL, not the running system + +Every Lean result must state its **model-to-system link**: which file, config, `taskset -cp` readout, unit file or source function the model was taken from, at which revision or time, and how that was checked to match (read back, generated, or hand-copied). Without that link the claim is about the model only. Label it that way. Example: "PROVED for the 8-set model copied from Drake's message 2026-11-06; live `taskset -cp` shows `aien-serve-http` on 2-4, which is NOT in the model and violates it." A proof never upgrades a status beyond what `omega-communication` allows. It is evidence about a design. It does not qualify hardware or a deployment. + +## Forbidden: `sorry`, extra axioms, native evaluation + +- `sorry` (axiom `sorryAx`) means *not proved*. Lean reports `declaration uses 'sorry'` as a **warning** and `lean_run_code` still returns `success: true`, so "no errors" is not enough. Always check the axioms. +- An elaboration error also turns the declaration into `sorryAx` (`lake build` showed `depends on axioms: [sorryAx]` for a theorem whose proof failed), which is another reason to read the axiom list rather than trust a partial log. +- Run `#print axioms ` (or `lean_verify`). The only acceptable set is a subset of `[propext, Classical.choice, Quot.sound]`. "does not depend on any axioms" is best. +- `native_decide` (axioms `Lean.ofReduceBool` / `Lean.trustCompiler` / `*._native.native_decide.ax*`) trusts the compiler rather than the kernel. Use `decide` or `decide +kernel`. +- A new `axiom` declaration, `unsafe`, `@[implemented_by]` or `@[extern]` in a proof file is forbidden. +- Report the verdict with the axiom list: `PROVED (axioms: [propext]) model=` or `FAILED: `. + +## Running outside MCP + +```bash +ssh spark 'cd ~/workspace/lean-verify && PATH=$HOME/.elan/bin:$PATH taskset -c 0,1 nice -n 10 lake env lean LeanVerify/CoreAssign.lean' +``` + +Put new proofs under `LeanVerify/` and import them from `LeanVerify.lean` so `lake build` checks them all. + +## Repair + +- Server does not start: `ssh spark ~/workspace/lean-verify/.mcp-venv/bin/lean-lsp-mcp --version` must print `lean-lsp-mcp 0.33.0`. Reinstall the pinned set with `python3 -m venv .mcp-venv && .mcp-venv/bin/pip install -r .mcp-venv-freeze.txt` (network needed once). +- `unknown module Mathlib...` or `environment does not contain`: wrong or missing import (for example `Finset.card` needs `Mathlib.Data.Finset.Card`), or oleans missing. For the latter run `lake exe cache get` (network, once) then `lake build` in the project, on cores 0–1. +- Upgrading Lean or Mathlib: change `lean-toolchain` and the mathlib `rev` together to the same `v4.x.y` tag, `lake update`, `lake exe cache get`, `lake build`, rerun the smoke test (initialize, `tools/list`, the three snippets above), and update the pins table. diff --git a/skills/omega-harness/SKILL.md b/skills/omega-harness/SKILL.md index 948121f..ac073fd 100644 --- a/skills/omega-harness/SKILL.md +++ b/skills/omega-harness/SKILL.md @@ -48,6 +48,12 @@ it carries the rule, the MCP setup that any agent can perform without a human, t calls, and the failure handling. A session whose Wolfram tools are not mounted is not math-capable: say so and stop rather than estimating. +A claim that a property holds for **every** case of a finite model (core sets disjoint, a disk floor +kept, one lease holder, a bounded queue) is proved in Lean 4, not argued. Read +`skills/lean-verify/SKILL.md`: it carries the `lean` MCP setup and pins, the rule that a theorem +proves the model and must name its link to the running system, and the ban on `sorry` and +non-standard axioms (`#print axioms`). Wolfram computes values; Lean proves statements about them. + ## NL1R host-only experiment boundaries (2026-10-28) The training experiment belongs to `aien-dev/aien-train`; independent From e9841fbc4c60f353979cee380b164a38aaef6bb8 Mon Sep 17 00:00:00 2001 From: LeanMcp Date: Fri, 6 Nov 2026 16:10:57 -0600 Subject: [PATCH 2/2] lean-verify: list in aien-repositories and AUDIT_SCOPE; drop private paths from the public skill --- AUDIT_SCOPE.md | 10 +++++++++- skills/aien-repositories/SKILL.md | 2 +- skills/lean-verify/SKILL.md | 10 +++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md index 7c9828f..c299cd2 100644 --- a/AUDIT_SCOPE.md +++ b/AUDIT_SCOPE.md @@ -8,7 +8,7 @@ this document. ## What this repository is Agent skills for working in Omega (the `.om` language of AienOS) and in the AIEN repositories. -Six skills live under `skills//SKILL.md` in the Agent Skills layout, and +Eight skills live under `skills//SKILL.md` in the Agent Skills layout, and `skills/omega-encoding/examples/` holds two runnable `.om` programs. AGENTS.md states that the repository is documentation and procedure, not a compiler, a runtime, a gate, or evidence that any claim is true. Nothing here ships as executable code; the examples are teaching material compiled @@ -51,6 +51,10 @@ Cannot check here: repository detail beyond what it marks as private, and no private paths. 6. `README.md` "Install" and "Check the examples yourself", and `AGENTS.md` "Omega pins". These are commands an operator copies. They clone public repositories and run a committed binary. +7. `skills/lean-verify/SKILL.md` "Pins" and "Repair". They tell an agent to add an ssh-stdio MCP + entry that runs `lean-lsp-mcp` on the Spark and, when repairing, to `pip install` the pinned set + into a project venv. Check that the pins are exact, that no global install or credential is + asked for, and that `sorry`/axiom checks cannot be read as proof. There is no `.github/workflows/` directory in this repository. @@ -64,6 +68,8 @@ There is no `.github/workflows/` directory in this repository. - Trusted: the committed compiler `seed/out/omc` in `aien-dev/omega-mv` at the pin recorded in `skills/omega-encoding/SKILL.md` section 0, identified by sha256. - External: the hosted Wolfram MCP endpoint named in `skills/wolfram-math/SKILL.md`. +- External: the Lean toolchain, Mathlib and `lean-lsp-mcp` (PyPI) at the pins in + `skills/lean-verify/SKILL.md`, fetched once at install time; the server runs without network. ## Threat model summary @@ -130,6 +136,8 @@ pin before trusting the result. - No lockfile, no vendored code, no package dependencies. - The examples depend on `aien-dev/omega-mv` (cloned at run time) and a Linux AArch64 host. - `skills/wolfram-math/SKILL.md` relies on the hosted Wolfram MCP endpoint for agents' arithmetic. +- `skills/lean-verify/SKILL.md` relies on Lean `v4.35.0`, Mathlib `v4.35.0` and `lean-lsp-mcp` + 0.33.0 as a verification oracle; none of them ships in this repository. - No GitHub Actions. ## Evidence diff --git a/skills/aien-repositories/SKILL.md b/skills/aien-repositories/SKILL.md index 6609a1f..91e403e 100644 --- a/skills/aien-repositories/SKILL.md +++ b/skills/aien-repositories/SKILL.md @@ -157,7 +157,7 @@ For memory, do not route to an archived repo just because its name sounds right. - Connected coordination repos (created 2026-10-27, parent `aien-dev/synapse@099a980`; PENDING until their first PRs merge): [synapse-claims](https://github.com/aien-dev/synapse-claims) (append-only, hash-chained, Ed25519-signed lease ledger: who holds which repo, branch, path, PR or outside target), [synapse-map](https://github.com/aien-dev/synapse-map) (org repo graph from root `.crumb` `extensions.map.parent`, `where` routing, `new` connected-repo scaffold, `check`), [synapse-pulse](https://github.com/aien-dev/synapse-pulse) (reconciles leases against GitHub through the gh guard and live sessions; one `COORD-DRIFT:` watchdog line), [synapse-mcp](https://github.com/aien-dev/synapse-mcp) (MCP stdio server that executes those CLIs) and [synapse-board](https://github.com/aien-dev/synapse-board) (generated human board, tailnet-only page). Route lease, routing and board changes there, not into synapse itself. The connected-repo rule: new components go in a new repo whose root crumb names its parent, and the parent README lists it under "Connected repos". - [spark-connector](https://github.com/aien-dev/spark-connector): volunteer-verification connector; enrollment is not blanket permission to execute hardware or change trust anchors. - [agent-archive](https://github.com/aien-dev/agent-archive): conversation provenance. A transcript retains what an agent said, not proof the claim was true. Never export private transcript content by default. -- [omega-harness](https://github.com/aien-dev/omega-harness): the agent skill guides themselves (`omega-harness`, `omega-encoding`, `omega-communication`, `crumb-protocol`, `wolfram-math`, and this `aien-repositories`). Guidance, not a compiler or a gate. Whichever agent makes a change updates the matching skill in the same piece of work, or opens an issue naming what is stale. Site-editing and aien-math working skills are kept as operator-local managed skills, not in this repository; the public rules they depend on are recorded here. +- [omega-harness](https://github.com/aien-dev/omega-harness): the agent skill guides themselves (`omega-harness`, `omega-encoding`, `omega-communication`, `writing-omega`, `crumb-protocol`, `wolfram-math`, `lean-verify`, and this `aien-repositories`). Guidance, not a compiler or a gate. Whichever agent makes a change updates the matching skill in the same piece of work, or opens an issue naming what is stale. Site-editing and aien-math working skills are kept as operator-local managed skills, not in this repository; the public rules they depend on are recorded here. ### User-facing and supporting projects diff --git a/skills/lean-verify/SKILL.md b/skills/lean-verify/SKILL.md index b5f9516..1f522ee 100644 --- a/skills/lean-verify/SKILL.md +++ b/skills/lean-verify/SKILL.md @@ -20,13 +20,13 @@ Project: Spark `~/workspace/lean-verify` (lake, library `LeanVerify`, local git The server runs on the Spark over ssh stdio, pinned to cores 0–1 with `nice -n 10`. The four remote search tools (`lean_leansearch`, `lean_loogle`, `lean_leanfinder`, `lean_hammer_premise`) are disabled with `LEAN_MCP_DISABLED_TOOLS`, so `tools/list` returns 18 tools, all local. The full smoke test (below) passed inside `bwrap --unshare-net`, where `curl https://pypi.org` fails, so it needs no network. Search Mathlib with `lean_local_search` (ripgrep) instead. -`mcp.json` entry (Mac `~/.omp/agent/mcp.json`): +`mcp.json` entry (Mac `~/.omp/agent/mcp.json`). `` is your ssh alias for the Spark and `` is the absolute home directory of the remote account. ssh does not expand `~` inside `env` arguments, so write the absolute path: ```json "lean": { "type": "stdio", "command": "ssh", - "args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "spark", "env", "PATH=/home/drakestapleton/.elan/bin:/usr/local/bin:/usr/bin:/bin", "LEAN_PROJECT_PATH=/home/drakestapleton/workspace/lean-verify", "LEAN_LOG_LEVEL=ERROR", "LEAN_MCP_DISABLED_TOOLS=lean_leansearch,lean_loogle,lean_leanfinder,lean_hammer_premise", "taskset", "-c", "0,1", "nice", "-n", "10", "/home/drakestapleton/workspace/lean-verify/.mcp-venv/bin/lean-lsp-mcp", "--transport", "stdio"], + "args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "", "env", "PATH=/.elan/bin:/usr/local/bin:/usr/bin:/bin", "LEAN_PROJECT_PATH=/workspace/lean-verify", "LEAN_LOG_LEVEL=ERROR", "LEAN_MCP_DISABLED_TOOLS=lean_leansearch,lean_loogle,lean_leanfinder,lean_hammer_premise", "taskset", "-c", "0,1", "nice", "-n", "10", "/workspace/lean-verify/.mcp-venv/bin/lean-lsp-mcp", "--transport", "stdio"], "timeout": 300000 } ``` @@ -47,7 +47,7 @@ Wolfram answers *what is the value*; Lean answers *is this statement true for al Enabled on the `lean` server (names as `tools/list` returns them; in omp they follow the `mcp___` pattern of the other servers, e.g. `mcp__lean_lean_run_code`): - `lean_run_code` `{code}` — check a self-contained snippet (it needs its own `import`s). The usual entry point. Returns `{success, timed_out, diagnostics[]}`. -- `lean_verify` `{file_path, theorem_name}` — axiom check plus source scan for one theorem in a project file. `file_path` is absolute (`/home/drakestapleton/workspace/lean-verify/...`). Returns `{axioms, trust, non_standard_axioms, warnings}` with `trust` one of `standard`, `incomplete` (sorry), `native`, `custom`. +- `lean_verify` `{file_path, theorem_name}` — axiom check plus source scan for one theorem in a project file. `file_path` is absolute (`/workspace/lean-verify/...`). Returns `{axioms, trust, non_standard_axioms, warnings}` with `trust` one of `standard`, `incomplete` (sorry), `native`, `custom`. - `lean_diagnostic_messages` — errors/warnings/infos of a project file. - `lean_goal`, `lean_term_goal` — proof state at a position. - `lean_multi_attempt` — try several tactics at one position. @@ -133,13 +133,13 @@ Every Lean result must state its **model-to-system link**: which file, config, ` ## Running outside MCP ```bash -ssh spark 'cd ~/workspace/lean-verify && PATH=$HOME/.elan/bin:$PATH taskset -c 0,1 nice -n 10 lake env lean LeanVerify/CoreAssign.lean' +ssh 'cd ~/workspace/lean-verify && PATH=$HOME/.elan/bin:$PATH taskset -c 0,1 nice -n 10 lake env lean LeanVerify/CoreAssign.lean' ``` Put new proofs under `LeanVerify/` and import them from `LeanVerify.lean` so `lake build` checks them all. ## Repair -- Server does not start: `ssh spark ~/workspace/lean-verify/.mcp-venv/bin/lean-lsp-mcp --version` must print `lean-lsp-mcp 0.33.0`. Reinstall the pinned set with `python3 -m venv .mcp-venv && .mcp-venv/bin/pip install -r .mcp-venv-freeze.txt` (network needed once). +- Server does not start: `ssh ~/workspace/lean-verify/.mcp-venv/bin/lean-lsp-mcp --version` must print `lean-lsp-mcp 0.33.0`. Reinstall the pinned set with `python3 -m venv .mcp-venv && .mcp-venv/bin/pip install -r .mcp-venv-freeze.txt` (network needed once). - `unknown module Mathlib...` or `environment does not contain`: wrong or missing import (for example `Finset.card` needs `Mathlib.Data.Finset.Card`), or oleans missing. For the latter run `lake exe cache get` (network, once) then `lake build` in the project, on cores 0–1. - Upgrading Lean or Mathlib: change `lean-toolchain` and the mathlib `rev` together to the same `v4.x.y` tag, `lake update`, `lake exe cache get`, `lake build`, rerun the smoke test (initialize, `tools/list`, the three snippets above), and update the pins table.