Skip to content

ArghDA M6 follow-on: Lean #print axioms audit — honest Unknown→Proven#42

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/arghda-roadmap-planning-p5mu93
Jul 1, 2026
Merged

ArghDA M6 follow-on: Lean #print axioms audit — honest Unknown→Proven#42
hyperpolymath merged 1 commit into
mainfrom
claude/arghda-roadmap-planning-p5mu93

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Second refinement follow-on. A clean Lean elaboration is only Unknown on its own (sorry is a mere warning; native_decide's axiom is invisible to a bare run). check_file now runs a #print axioms audit on a clean elaboration and promotes the verdict honestly.

Mechanism (std-only — no new dependency)

  • decl_names parses auditable declarations (theorem/lemma/def/abbrev/instance), skipping leading @[..] attributes + modifiers and anonymous decls. Conservative: a missed name just isn't audited; a mis-parsed name makes lean error and the audit falls back to Unknownnever a wrong verdict.
  • axiom_audit copies the source into a fresh temp dir, appends #print axioms <name> per decl, runs lean, and — only if that copy elaborated cleanly — classifies the output. Temp dir removed after.
  • classify_axioms (ground-truthed vs Lean 4.13.0): all decls clean or only {propext, Classical.choice, Quot.sound}Proven; any sorryAxAdmitted; any other axiom (e.g. native_decide's) → Postulated.

Honest reach

Import-free files (the temp-dir copy elaborates without LEAN_PATH). Imported files can't be audited in a bare temp dir → the audit returns None → they stay Unknown until lake-env resolution (the remaining M6 follow-on).

Verified (ran, not inferred)

  • cargo test129 passing, 0 failed (+2 unit: decl_names, classify_axioms; the pre-existing lean check_file test updated to be audit-aware).
  • clippy -D warnings, fmt, SPDX clean.
  • Dogfooded real lean: rflproven-eligible; Classical.emproven-eligible (standard axioms); native_decidepostulated (the audit catches the non-standard axiom a bare elaboration hides); sorryadmitted.

Status

M6 now ~92% (remaining: lake-env for imported files). Next: M3 (workspace-fed verdicts + staleness in reason).


Generated by Claude Code

A clean Lean elaboration is only `Unknown` on its own (sorry is a mere
warning; native_decide's axiom is invisible to a bare run). `check_file`
now runs a `#print axioms` audit on a clean elaboration and promotes the
verdict honestly.

Mechanism (std-only, no new dependency):
- `decl_names` parses the auditable declarations (theorem/lemma/def/abbrev/
  instance), skipping leading `@[..]` attributes + modifiers and anonymous
  decls. Conservative: a missed name just isn't audited; a mis-parsed name
  makes `lean` error and the audit falls back to Unknown — never a wrong
  verdict.
- `axiom_audit` copies the source into a fresh temp dir, appends
  `#print axioms <name>` per decl, runs `lean`, and — only if that copy
  elaborated cleanly — classifies the output. Temp dir is removed after.
- `classify_axioms` (ground-truthed vs Lean 4.13.0): all decls clean or
  only {propext, Classical.choice, Quot.sound} → Proven; any `sorryAx` →
  Admitted; any other axiom (e.g. `native_decide`'s) → Postulated.

Honest reach: import-free files (the temp-dir copy elaborates without
LEAN_PATH). Imported files can't be audited in a bare temp dir → the audit
returns None → they stay `Unknown` until lake-env resolution (the remaining
M6 follow-on).

## Verified (ran, not inferred)

- `cargo test` → 129 passing, 0 failed (+2 unit: `decl_names`,
  `classify_axioms`; the pre-existing lean check_file test updated to be
  audit-aware).
- clippy -D warnings, fmt, SPDX clean.
- Dogfooded REAL lean: `rfl` → proven-eligible; `Classical.em` →
  proven-eligible (standard axioms); `native_decide` → **postulated** (the
  audit catches the non-standard axiom a bare elaboration hides); `sorry`
  → admitted.
- STATE.a2ml: M6 now 92% (remaining: lake-env for imported files).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7
@hyperpolymath
hyperpolymath marked this pull request as ready for review July 1, 2026 10:27
@hyperpolymath
hyperpolymath merged commit 58e2e91 into main Jul 1, 2026
3 checks passed
@hyperpolymath
hyperpolymath deleted the claude/arghda-roadmap-planning-p5mu93 branch July 1, 2026 10:27
hyperpolymath added a commit that referenced this pull request Jul 1, 2026
)

## What

The Flying-Logic reasoning graph can now source **real prover verdicts
from a four-state workspace's `proven/` state** without re-running any
tool, and demote a **stale-proven** node back to `unknown`. Honest by
construction — a verdict only ever comes from a recorded promotion, and
staleness always dominates a stale `Proven`.

This is the last of the three refinement follow-ons (M4 `.ipkg` roots
#41, M6 axiom audit #42, M3 workspace verdicts).

## How

- **`reason::workspace_verdicts(dag, proven, stale) -> (verdicts,
stale)`** — a pure mapping (no I/O, unit-testable): a node whose file
basename is in the workspace's `proven/` set → `Proven`; if that same
file is stale (content/closure hash changed since promotion) it is added
to the returned stale set, so the existing demote-only fold lowers it to
`Unknown`. Matched by file basename (documented collision caveat).
Re-exported from `lib.rs`.
- **`arghda reason <path> --workspace <ws>`** — reads the proven +
stale-proven basename sets off the workspace (`Workspace::list(Proven)`
/ `Workspace::stale_proven`) and feeds them into `workspace_verdicts`.
`--check` stays authoritative: a fresh typecheck overrides the workspace
verdict and clears staleness for that node.
- **Honest evidence strings** — `"prover: proven"` for a fresh
promotion; `"prover: proven; stale: closure hash changed"` for a demoted
stale one.

## Verification (actually run)

- `cargo fmt --check` — clean
- `cargo clippy --all-targets -- -D warnings` — clean
- `cargo test` — **130 pass** (+1 reason unit: proven lights the cone,
stale demotes)
- `bash scripts/check-spdx.sh .` — OK

**Dogfooded end-to-end** on a real workspace + Agda source tree:

- Scenario A (fresh proven leaf): `Good` → `effective: proven`
(`"prover: proven"`); un-proven root `All` → `unknown`.
- Scenario B (proven file edited on disk → stale): `Good` demoted to
`unknown` with `"prover: proven; stale: closure hash changed"`.

## Scope

Additive only. `M3` base was already 100%; this refinement wires the
reasoning graph to the triage workspace's ground truth. No change to the
`reason/0.1` JSON contract keys.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7

---
_Generated by [Claude
Code](https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7)_

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants