Commit 417b011
ArghDA M3: Flying-Logic reasoning graph — demote-only verdict propagation (#33)
## What & why
The **headline capability** of the "Flying Logic for provers/solvers"
epic, built on the M1 `Backend` trait (merged #32). A new `src/reason/`
layer *wraps* (does not replace) the DAG: the `DagDocument` is embedded
verbatim, and on top go a per-node `Verdict`, `And`/`Or` edge juncts,
and a memoised, cycle-safe, **demote-only** propagation fold.
## The honesty invariant (enforced end-to-end)
A node's effective verdict can only be **lowered** by its dependencies,
never manufactured:
- **lint-clean + no typecheck = `Unknown`**, never green. Only a real
prover exit-0 makes `Proven`.
- Only `Proven` is green; `Admitted`/`Postulated` are amber.
- Because the fold is demote-only over `And` import edges, **structural
amber infects downstream** — anything that transitively imports a
`postulate` (or `missing-safe` / escape-hatch) module is itself capped.
Visible *before any prover runs*.
- `Or` groups are forgiving (one green route keeps a goal up). Import
cycles degrade to `Error` and terminate. Staleness (closure-hash-changed
`Proven` → `Unknown`) is applied pre-fold so it propagates. `wired`
marks the CRT-root-reachable cone.
## Changes
- `src/reason/mod.rs`: `Junct`, `ReasonNode`
(`self_verdict`/`effective`/`verdict_evidence`/`soundness`/`wired`),
`ReasonEdge`, `ReasonDocument` (`version:"0.1"`, embedded `dag`,
`crt_roots`); the rank/demote/promote lattice; lint→verdict caps; the
propagation fold.
- `arghda reason <path> [--check]`: `--check` runs the backend per node
for **real** exit-code verdicts; default is structure+lint-derived (all
`unknown` on a clean tree, honestly).
- `STATE.a2ml` records M3 = 100%.
## Verified (ran, not inferred)
- `cargo test` → **81 passing, 0 failed** (61 lib + 20 integration; +9
reason unit tests covering demote / downstream-amber-infection /
Or-forgiveness / cycle-termination / wiring /
clean-but-unchecked→Unknown, +6 reason integration).
- `cargo clippy -D warnings` clean · `cargo fmt --check` clean ·
`check-spdx.sh` OK.
- **Dogfood** — `arghda reason tests/fixtures/wellformed --check` ran
real `agda` typechecks → the whole cone `proven` + `wired`.
### A bug dogfooding caught (and I fixed)
The first `--check` dogfood showed **every node `wired=false`** with
`crt_roots=['tests.fixtures.wellformed.All']`. The CLI's
`discover_roots` yields include-root-*relative* paths, which a stray
`include_root.join` double-prefixed — so the CRT-root ids never matched
the node ids. The unit/integration tests missed it because they passed
*absolute* roots (where the join is a silent no-op). Fixed to match the
orphan-module rule's convention (paths go straight to `module_name_of`),
plus a regression test that exercises the `discover_roots` path.
Re-dogfooded green.
## Next (all unblocked by the stable trait)
M4 Idris2 · M5 SMT (Z3/CVC5) · M2 Cubical-Agda · M3 follow-on (feed real
verdicts + staleness from a workspace `proven/` state so `reason` lights
the cone without `--check`).
---
_Generated by [Claude
Code](https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 75eac52 commit 417b011
5 files changed
Lines changed: 809 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | 81 | | |
65 | 82 | | |
| |||
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
90 | | - | |
91 | | - | |
| 107 | + | |
92 | 108 | | |
93 | 109 | | |
94 | 110 | | |
| 111 | + | |
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
| |||
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
108 | 126 | | |
109 | 127 | | |
110 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
86 | 111 | | |
87 | 112 | | |
88 | 113 | | |
| |||
144 | 169 | | |
145 | 170 | | |
146 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
147 | 185 | | |
148 | 186 | | |
149 | 187 | | |
| |||
354 | 392 | | |
355 | 393 | | |
356 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
357 | 434 | | |
358 | 435 | | |
359 | 436 | | |
| |||
0 commit comments