- document_contract: negative path coverage through the real CLI (selection, shape errors, formula unsupported/invalid, missing/external links, cycles, --unit, upstream static failure, root escape) with exit-code assertions - e2e: algebra, vector composition (declared == used), program model scope, refutation, export+replay, cache reuse, tampered payload rejection - report fixes: declared/used locator consistency, diagnostic-only exit status, unsupported vs invalid formula outcomes - clippy -D warnings and cargo fmt clean; docs/STATUS records pinned identities, executed commands, measured backend limits and known gaps
182 lines
9.9 KiB
Markdown
182 lines
9.9 KiB
Markdown
# STATUS: executed evidence for marqdo-prove
|
|
|
|
This file records what has actually been executed and observed. It is not a
|
|
plan, not a test report template, and not a release announcement. Anything not
|
|
listed here is unverified, regardless of what `docs/DEVELOPMENT.md` describes as
|
|
the target design.
|
|
|
|
## Snapshot
|
|
|
|
| Item | Value |
|
|
| --- | --- |
|
|
| Repository | `marqdo-prove` (this tree) |
|
|
| Commit at evidence time | `4e02da9` + reporting/tests working tree (see `git log`) |
|
|
| Prove version | `0.1.0` |
|
|
| Tool manifest | `tool.json`: `requires.api_revision: 1`, `requires.analysis: 3` |
|
|
| Platform | Linux x86_64, 8 vCPU, 14 GiB RAM, no network during checks |
|
|
| Rust | `rustc 1.100.0` / `cargo 1.100.0` (local toolchain) |
|
|
| Upstream CLI | Marqdo `3.0.0-rc.4` (`marqdo-cli` commit `4bbefc9`, release binary) |
|
|
| Analysis contract | `marqdo.analysis` `schema_version: 3` (the merged public Analysis boundary, ADR-0069), consumed only through `check --emit` |
|
|
|
|
## Fixed Lean backend
|
|
|
|
Pinned in `lean/lean-toolchain` and `lean/lake-manifest.json` (both committed):
|
|
|
|
| Item | Value |
|
|
| --- | --- |
|
|
| Lean toolchain | `leanprover/lean4:v4.36.0` |
|
|
| Lean binary | `Lean (version 4.36.0, x86_64-unknown-linux-gnu, commit 611c117bfaf7b7ae1cfcf246ce6fba31e8f509e9, Release)` |
|
|
| Lake | `5.0.0-src+611c117` |
|
|
| Mathlib revision | `fc4f59e577feb1a4956671bc04ac18aaaf8cd842` (`mathlib4` tag `v4.36.0`) |
|
|
| `lake-manifest.json` SHA-256 | `bb82472009ad8aba44b75c1a1095dfe290dd87319421d55039e02fe57f2e0022` |
|
|
| `marqdo-replay` binary SHA-256 | `02cbc2c8b00dbdac2c5bcf359b25a62f896372b9964f7578caca4d4346d544c1` |
|
|
| official `con-leche` SHA-256 | `a6380d68b4fb364189821dd4692569c11536de0a1e3aaefea06028c0d67bb193` |
|
|
| Mathlib oleans | fetched once with `lake exe cache get` (9117 files); no runtime download |
|
|
|
|
Backend discovery: `MARQDO_PROVE_LEAN_ROOT` (the `lean/` project) and
|
|
`MARQDO_PROVE_LEAN_BIN_DIR` (toolchain `bin`); a development checkout falls back
|
|
to `<repo>/lean` and `<repo>/.tool/lean/bin`. Missing backend or verifier is a
|
|
`backend.unavailable` engineering failure (exit 2), never silent degradation.
|
|
|
|
### Measured backend constraint (important)
|
|
|
|
Lean + Mathlib cannot run under a low `RLIMIT_AS` on this machine: 6 GiB fails
|
|
with `failed to read ... *.olean.private`, 9 GiB fails with
|
|
`failed to create thread`, 12 GiB succeeds. Prove therefore does **not** apply an
|
|
address-space rlimit; elaboration is bounded by the 30 s per-attempt wall clock,
|
|
the 300 s CPU rlimit and the overall task timeout. A true RSS/cgroup cap remains
|
|
unimplemented and is a known release gap (docs/DEVELOPMENT.md §13.1 asks for
|
|
2 GiB). This was measured, not assumed.
|
|
|
|
## Proof pipeline as executed
|
|
|
|
`marqdo prove check examples/vector.mq.md`:
|
|
|
|
1. real CLI emits Analysis revision 3 for the entry (and, per link, for each
|
|
local dependency document, through a second `check --emit`);
|
|
2. one Knowledge H2 target is selected; two dependency links resolve exactly to
|
|
the two algebra theorems; the closure is acyclic and dependency-first;
|
|
3. the goal compiles to
|
|
`∀ mqx0 mqx1 : Int, ((mqx0 ^ (2 : Nat)) + (mqx1 ^ (2 : Nat)) ≥ (0 : Int))`;
|
|
4. the bounded fixed template (`solve_by_elim` over the declared theorem
|
|
constants, then `omega`/`positivity`/`decide`/`nlinarith`) finds a proof
|
|
term; the search process exports the proof-term closure with the stock
|
|
`leanexport` tool;
|
|
5. the verifier independently (a) kernel-replays the whole closure with the
|
|
toolchain's `con-leche --verified`, (b) re-elaborates the expected
|
|
proposition from the current sources in a *separate* process without the
|
|
proof, (c) checks alpha-equivalence of the target theorem type with the
|
|
expected prop, rejects metavariables, and (d) enforces the axiom set
|
|
`propext`, `Classical.choice`, `Quot.sound`;
|
|
6. the bundle is published under
|
|
`examples/.marqdo/prove/bundles/<sha256>/manifest.json` + `proof.ndjson`;
|
|
7. the report distinguishes declared vs actually used dependencies. For the
|
|
`vector` fixture, the exported proof term genuinely references **both**
|
|
algebra theorems (not merely `positivity`).
|
|
|
|
Observed results (wall clock, warm filesystem, debug build of Prove):
|
|
|
|
| Command | Result |
|
|
| --- | --- |
|
|
| `check examples/algebra.mq.md` | 2 targets `verified`, `mathematical`, `current`, axioms ⊆ allowed; ~24 s |
|
|
| `check examples/vector.mq.md` | 1 target `verified`; 2 declared, 2 used, 0 unused; ~23 s |
|
|
| `check examples/arithmetic.mq.md` | 1 target `verified`, `scope=program_model`, real `@[expose]` model definition checked; ~24 s |
|
|
| `check tests/fixtures/false.mq.md` | 2 targets `refuted` via Lean-proven negations with concrete witnesses; exit 1; ~28 s |
|
|
| `check examples/vector.mq.md --out DIR` then `replay examples/vector.mq.md DIR` | export contains `manifest.json` + `proof.ndjson`; replay `verified`/`current`, no search, exit 0 |
|
|
| repeated `check examples/algebra.mq.md` | same content-addressed cache key; hit is replayed, not trusted, `freshness=current` |
|
|
| tampered `proof.ndjson` then `replay` | rejected with exit 2 (`certificate.invalid`), no `verified` |
|
|
|
|
Run as `cargo test --test e2e -- --ignored --test-threads=1` (requires
|
|
`MARQDO_BIN` and the fixed backend): **7 passed, 0 failed, 166.77 s**.
|
|
|
|
## Executed test suite
|
|
|
|
```sh
|
|
cargo fmt --all -- --check # passed
|
|
cargo clippy --all-targets -- -D warnings # passed, no warnings
|
|
cargo test # see counts below
|
|
```
|
|
|
|
| Suite | Result |
|
|
| --- | --- |
|
|
| library unit tests (`analysis`, `document`, `formula`, `linker`, `model`, `lean`, `certificate`) | 69 passed |
|
|
| `tests/analysis_document.rs` (real CLI, entry extraction) | 3 passed |
|
|
| `tests/formula_contract.rs` (grammar, precedence, bounds, diagnostics, rendering, evaluation) | 12 passed |
|
|
| `tests/document_contract.rs` (no-target, shape errors, unsupported/invalid formulas, missing/external links, cycles, `--unit`, upstream static failure, root escape) | 11 passed |
|
|
| `tests/e2e.rs` (Lean-backed, `#[ignore]`) | 7 passed, 166.77 s |
|
|
|
|
## Verified behaviours (with fixtures)
|
|
|
|
- no `证明依赖` heading → `no_targets`, exit 0, no proof search;
|
|
- 0/2 direct display goals → `document.goal_count`, exit 1;
|
|
- dependency list with extra text / not a plain link list → `document.dependencies_shape`;
|
|
- `\mathbb{R}` / fractions / existence → `unsupported` (`formula.unsupported`), source kept readable;
|
|
- free variables, chained comparisons, implicit multiplication, trailing tokens, oversized literals/exponents/variable counts → `formula.syntax`/`formula.free_variable`, nothing sent to Lean;
|
|
- missing link target → `link.missing`; external URL → `link.invalid`; A→B→A cycle → `link.cycle` with a concrete chain;
|
|
- `--unit` with an unknown fragment → exit 1 with `document.unit`;
|
|
- upstream CLI static error → `upstream.contract`, exit 2, no raw-Markdown fallback;
|
|
- `--root` outside the entry → `link.outside_root`, exit 2;
|
|
- program model with unsupported constructs (`/`, loops, branches, calls, non-Int params, defaults) → `model.unsupported` before any Lean search;
|
|
- `refuted` only after Lean kernel-verified `¬expected` (bounded witness candidates: 0, ±1, ±2, ±3, ±5, ±10, ≤16 trials);
|
|
- `--out` with multiple requested targets writes one self-contained bundle
|
|
directory per target under `PATH/<cache_key>/`; with one target `PATH` is the
|
|
bundle directory itself.
|
|
|
|
## Known gaps (not claimed as done)
|
|
|
|
1. **Resource isolation**: no cgroup/RSS cap; address-space rlimit disabled for
|
|
the measured reason above. Network isolation is not enforced by a sandbox
|
|
namespace — the backend cannot reach the network in the executed environment,
|
|
but that is an environmental fact, not a code guarantee.
|
|
2. **M4 release evidence**: no clean-machine installation run, no CI evidence at
|
|
a single SHA, no signed archive/digest publication, no performance P50/P95
|
|
matrix, and no `--out` cross-checkout replay on a second host.
|
|
3. **Search strength**: fixed template only. Goals outside
|
|
`solve_by_elim`+`omega`/`positivity`/`decide`/`nlinarith` yield `unknown`.
|
|
The evaluation corpus required by §13.1 (40 positive/20 false/20 negative
|
|
fixtures) is not yet assembled; the committed examples are a first subset.
|
|
4. **Conditional premises**: the whole antecedent is preserved and displayed,
|
|
but premise non-emptiness is explicitly *not* proven (reported as such).
|
|
Contradictory premises can therefore verify vacuously; there is no
|
|
satisfiability check.
|
|
5. **Program model**: only the documented straight-line `Int` subset. No claim
|
|
of runtime refinement (`runtime_verified` is not a supported status).
|
|
6. **Upstream coupling**: the local `marqdo-cli` tree at `3.0.0-rc.4` happens to
|
|
contain the merged Analysis revision 3; the document's original audit SHA
|
|
(`e6066e6`) does not. Prove accepts only revision 3 and has no compatibility
|
|
reader, as required.
|
|
7. **Replay model**: the payload is a self-contained `lean4export` closure
|
|
(project declarations plus the used Mathlib closure), replayed with
|
|
`con-leche --verified`; the bundle additionally requires the same pinned
|
|
backend to re-elaborate the expected proposition. Cross-Lean-version replay
|
|
is not supported.
|
|
8. **`--out` bundle set**: one target per bundle manifest; a multi-target
|
|
project exports one bundle per target (no combined multi-target bundle yet).
|
|
|
|
## Reproduce
|
|
|
|
```sh
|
|
# 1. upstream CLI (real, current Analysis contract)
|
|
export MARQDO_BIN=/path/to/marqdo-3.0.0-rc.4
|
|
|
|
# 2. pinned backend (one-time; needs network)
|
|
cd lean && lake update && lake exe cache get && lake build marqdo-replay && cd ..
|
|
export MARQDO_PROVE_LEAN_ROOT="$PWD/lean"
|
|
export MARQDO_PROVE_LEAN_BIN_DIR=/path/to/lean-toolchain/bin
|
|
|
|
# 3. fast suites
|
|
cargo fmt --all -- --check
|
|
cargo clippy --all-targets -- -D warnings
|
|
cargo test
|
|
|
|
# 4. real end-to-end
|
|
cargo test --test e2e -- --ignored --test-threads=1
|
|
cargo run --release -- check examples/vector.mq.md --json
|
|
```
|
|
|
|
## What this file is not
|
|
|
|
It is not a claim that the first release gates in `docs/DEVELOPMENT.md` §13–§14
|
|
are satisfied. It records the executed subset above, including the failures to
|
|
meet the full gate list.
|