ArghDA M6 follow-on: lake-env import resolution (M6 → 100%)#47
Merged
Conversation
The Lean `#print axioms` audit now reaches IMPORTED files, not just import-free ones. When a `lakefile.lean`/`lakefile.toml` is found at or above the file, both the elaboration and the audit run via `lake env lean` (cwd = the lake root), injecting the project's LEAN_PATH so project-local imports resolve. - `lake_root(file, include_root)` — the nearest ancestor with a lakefile, else None (bare-`lean` fallback). - `run_lean(file, lake_root)` — `lake env lean <file>` under a lake project (cwd = root), falling back to bare `lean` when there's no lakefile or `lake` itself is absent. Both `check_file` and `axiom_audit` route through it. - The audit copy stays in a clean temp dir: LEAN_PATH entries are absolute, so imports resolve regardless of the copy's location (ground-truthed). Assumes the project is already built — arghda checks proofs, it does not run `lake build` (a deliberate scope line, not a gap). With no lakefile the behaviour is unchanged (core + import-free files via bare `lean`). Verification (actually run): cargo fmt --check, clippy -D warnings, cargo test (168 pass, +1 `lake_root` unit), check-spdx.sh — all green. Dogfooded vs real Lean 4.13.0 + Lake 5.0.0 on a built lake project: the importing file `Demo.lean` (imports Demo.Basic) → proven (an unresolved-import error before this change); the leaf → proven; negative control (the same file copied OUTSIDE the lake project) → error, confirming the fix is the lake-env resolution specifically. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7
hyperpolymath
marked this pull request as ready for review
July 1, 2026 13:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Lean
#print axiomsaudit now reaches imported files, not just import-free ones — closing the last M6 follow-on (M6 → 100%).When a
lakefile.lean/lakefile.tomlis found at or above the file, both the elaboration and the audit run vialake env lean(cwd = the lake root), injecting the project'sLEAN_PATHso project-local imports resolve.How
lake_root(file, include_root)— the nearest ancestor directory with a lakefile, elseNone(bare-leanfallback).run_lean(file, lake_root)—lake env lean <file>under a lake project (cwd = root), falling back to bareleanwhen there's no lakefile orlakeitself is absent. Bothcheck_fileandaxiom_auditroute through it.LEAN_PATHentries are absolute, so imports resolve regardless of the copy's location (ground-truthed).Assumes the project is already built — arghda checks proofs, it does not run
lake build(a deliberate scope line, not a gap). With no lakefile the behaviour is unchanged (core + import-free files via barelean).Verification (actually run)
cargo fmt --check— cleancargo clippy --all-targets -- -D warnings— cleancargo test— 168 pass (+1lake_rootunit)bash scripts/check-spdx.sh .— OKDogfooded vs real Lean 4.13.0 + Lake 5.0.0 on a built lake project:
Demo.lean(importsDemo.Basic), inside the built lake projectprovenDemo/Basic.lean(leaf, no imports)provenprovenerror(negative control — confirms the fix is the lake-env resolution)Scope
M6 complete. The remaining climb: M4 (Idris2 totality-hole/
partiallint), M7 (real Echidna client — pending confirmation its API exists).🤖 Generated with Claude Code
https://claude.ai/code/session_012MpYSh6Wy8YMBH2E3qVyT7
Generated by Claude Code