You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ArghDA M1: Backend abstraction — make the engine prover-parametric (#32)
## What & why
The keystone of the "Flying Logic for provers/solvers" epic. Every
Agda-baked seam now lives behind an object-safe `Backend` trait, so the
four-state workspace, DAG builder, content-hash invalidation and the
cycle-safe reachability walk become backend-neutral. Agda is the first
(v0.1 reference) impl; adding Idris2 / Lean4 / Z3 / CVC5 / Coq /
Isabelle / Mizar is now *an impl*, not a rewrite.
Follow-on from M0 (toolchain provisioning, merged as #31). #31 being
merged, this is a fresh PR on the same working branch.
## This is a pure refactor — the test suite is the oracle
Behaviour is unchanged, ground-truthed by running the tools (not
inferred):
- **`cargo test`** — the 64 pre-existing tests (50 lib + 14 integration)
all stay green; +2 new Agda-backend tests = **66 passing, 0 failed**.
- **`cargo clippy --all-targets --all-features -- -D warnings`** —
clean.
- **`cargo fmt --check`** — clean.
- **`scripts/check-spdx.sh .`** — `SPDX licence invariant: OK`.
- **Dogfood** — `arghda dag tests/fixtures/wellformed` emits
byte-compatible JSON (`version: "0.1"`, same nodes/edges); `arghda check
…/All.agda` ran a **real** Agda typecheck → `proven-eligible` (agda is
present from #31's provisioning).
## Changes
**New `src/prover/`:**
- `Backend` trait — `name` / `kind` / `extensions` / `safe_mode` /
`check_file` + the import-graph trio (`module_name_of` /
`module_to_path` / `direct_imports`) + `discover_roots` + `lint_rules`.
- `BackendKind { Assistant, Solver }` — the two interaction models
(typecheck-a-file vs SMT query).
- `Verdict { Proven, Refuted, Unknown, Admitted, Postulated, Error,
Unavailable }` — the common verdict both models map into. **Only
`Proven` is green; `Admitted`/`Postulated` are amber.**
- `Outcome` — superset of the old `AgdaOutcome` (raw process facts +
`kind` + `verdict`).
**Refactor:**
- `src/agda.rs` → `src/prover/agda.rs`. `Agda` is the first impl: owns
the `agda` shell-out, delegates parsing to `graph::` free fns and the
lint pack to `lint::`. Verdict is **exit-code-only** (0 → `Proven`,
ran-nonzero → `Error`, absent → `Unavailable`) — arghda never claims a
result Agda did not return; `Admitted`/`Postulated` stay lint-derived,
never manufactured from a green exit.
- `graph::build` and `dag::build` take `&dyn Backend` and use the
backend's extension filter + import parsing. **The cycle-safe
reachability walk and its `transitive_imports_terminates_on_a_cycle`
regression are untouched** — cycle safety is inherited free by every
backend.
- `main.rs` `scan`/`check`/`dag`/`resolve_roots_and_rules` route through
the backend; the `check` JSON key `agda` → `backend` (now carries `kind`
+ `verdict`).
- `STATE.a2ml` records M1 = 100%; `.gitignore` ignores `*.agdai`.
## Honesty note (owner directive + AGENTIC.a2ml)
The `Backend` module is the boundary where "never report a verdict the
tool did not emit" is enforced: `check_file` derives its verdict from
the actual exit code and degrades to `Unavailable` when the binary is
absent.
## Next (trait now stable → parallelisable)
M3 reasoning-graph (`src/reason`), M4 Idris2, M5 SMT (Z3/CVC5), M2
Cubical-Agda.
---
_Generated by [Claude
Code](https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7)_
Co-authored-by: Claude <noreply@anthropic.com>
# No active blockers. v0.1 lint set + DAG schema (arghda-spec.adoc) are
@@ -72,21 +87,24 @@ milestones = [
72
87
73
88
[critical-next-actions]
74
89
actions = [
75
-
"Flying-Logic epic M1: introduce the Backend trait (Assistant|Solver) and move agda.rs to prover/agda.rs as a PURE REFACTOR — the 50 existing tests are the oracle, they must stay green with no behaviour change. This is the keystone everything else rides on.",
76
-
"Flying-Logic epic M3: src/reason reasoning graph (And|Or juncts + demote-only cycle-safe Verdict propagation) — independent of new backends, lands the headline capability early.",
90
+
"M1 keystone DONE (Backend trait, pure refactor, 66 tests green). Next, in parallel now that the trait is stable:",
91
+
"Flying-Logic epic M3: src/reason reasoning graph (And|Or juncts + demote-only cycle-safe Verdict propagation over the common Verdict) — independent of new backends, lands the headline capability early.",
0 commit comments