Files
marqdo-prove d8c340b6e2
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/tag/main Pipeline was successful
docs: record CI pipeline #5 and the measured binary-digest difference
- pipeline #5 validates the tag-move evidence commit and the new package-lane
  binary digest; local vs CI binary hashes differ (build path / image), so the
  beta makes no reproducible-build claim
- note that the beta tag was moved once to carry the completed evidence
2026-11-26 13:02:51 +08:00

233 lines
13 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 | see `git log` on this tree (the status file is updated in the same commit as the evidence) |
| Prove version | `0.1.0-beta.1` (beta release; see `docs/RELEASE.md`) |
| 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` |
| `check tests/fixtures/unknown.mq.md` (`a^2+b^2 ≥ 2ab`) | `unknown`, exit 1 — search exhausted, no refutation invented |
| exported bundle, then a prose-only edit in a dependency, then `replay` | `certificate.stale`, exit 1, no `verified` |
| program model mutated to `return x * x - 1` (goal `square(x) ≥ 0`) | `refuted` with a Lean-verified negation (witness `x = 0`), `scope=program_model` |
| bundle exported in one checkout, sources copied byte-identically to another absolute directory, `replay` there | `verified`, `current` — the certificate is bound to portable identities, not machine paths |
| `marqdo tool install tool-bundle/tool.json` then `marqdo prove --version` and `marqdo prove check examples/algebra.mq.md --json` | installed tool dispatches through the real CLI Tool Protocol (`api_revision 1`), version `marqdo-prove 0.1.0`, target `verified` (cache hit, ~10 s) |
Run as `cargo test --test e2e -- --ignored --test-threads=1` (requires
`MARQDO_BIN` and the fixed backend): **11 passed, 0 failed; 271.39 s before the beta version bump and 298.70 s after it (cache identity includes the tool version, so the beta run re-proved everything).**
## 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]`) | 11 passed: 271.39 s, and 298.70 s re-run after the beta version bump |
## CI evidence (beta)
The `v0.1.0-beta.1` release was pushed and executed on the real Woodpecker CI
repository (`ci.cflmy.cn`, repo id 5, commit `1a9f3a4c`):
- push pipeline **#1 success** (61 s): `fmt`, `clippy -D warnings`,
`cargo test --locked` (69 unit + 3 analysis + 11 document + 12 formula),
release build, `--version`, tool-bundle packaging.
- tag pipeline **#3 success** (86 s): same lane for tag `v0.1.0-beta.1`.
- manual contract pipeline **#4 success** (69 s): clean container cloned and
built the real `marqdo-cli`, verified `marqdo 3.0.0-rc.4`, and ran
`analysis_document` (3) and `document_contract` (11) against it.
- CI-evidence push pipeline **#5 success** (31 s, commit `44e202e9`): the
package lane prints the shipped binary digest; local and CI binaries differ
because Rust embeds the build path, so no reproducible-build claim is made.
- Gitea prerelease created for the tag; Woodpecker repository activated through
the API; CI secret injected as a repository secret (never in git).
The Lean-backed `tests/e2e.rs` suite is still executed only on the dedicated
environment recorded above; the shared CI runner does not carry the pinned
Mathlib backend. Full detail: [`docs/evidence/ci-beta-1.md`](evidence/ci-beta-1.md).
## Tool installation evidence
`scripts/package-tool.sh` assembled a bundle (`bin/marqdo-prove`, `tool.json`,
pinned `lean/` project). The real upstream CLI accepted it:
```text
$ marqdo tool install .tmp/tool-bundle/tool.json
installed tool `prove` version 0.1.0 (marqdo.prove)
$ marqdo tool list
prove 0.1.0 (marqdo.prove)
$ marqdo prove --version
marqdo-prove 0.1.0
$ marqdo prove check examples/algebra.mq.md --json
... "outcome":"verified" ... (exit 0)
```
The bundle does not ship the multi-gigabyte Lean toolchain/Mathlib build; the
installed executable finds the pinned backend through
`MARQDO_PROVE_LEAN_ROOT` / `MARQDO_PROVE_LEAN_BIN_DIR` (release packaging note,
not a hidden fallback). The clean-machine install gate (I01–I03) therefore has
partial evidence: protocol installation and dispatch were executed; a machine
without the pinned backend build fails closed with `backend.unavailable`.
## 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);
- goals outside the fixed strategy → `unknown`, exit 1, never `refuted` without a proven negation;
- `--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.