Commit b944e39
ArghDA M6 follow-on: lake-env import resolution (M6 → 100%) (#47)
## What
The Lean `#print axioms` audit now reaches **imported** files, not just
import-free ones — closing the last M6 follow-on (M6 → 100%).
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.
## How
- `lake_root(file, include_root)` — the nearest ancestor directory 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` — clean
- `cargo clippy --all-targets -- -D warnings` — clean
- `cargo test` — **168 pass** (+1 `lake_root` unit)
- `bash scripts/check-spdx.sh .` — OK
**Dogfooded vs real Lean 4.13.0 + Lake 5.0.0 on a built lake project:**
| file | before M6 | now |
|---|---|---|
| `Demo.lean` (imports `Demo.Basic`), inside the built lake project |
unresolved-import error | **`proven`** |
| `Demo/Basic.lean` (leaf, no imports) | `proven` | `proven` |
| same importing file copied **outside** a lake project | — | `error`
(negative control — confirms the fix is the lake-env resolution) |
## Scope
M6 complete. The remaining climb: M4 (Idris2 totality-hole/`partial`
lint), M7 (real Echidna client — pending confirmation its API exists).
🤖 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>1 parent d61ae75 commit b944e39
2 files changed
Lines changed: 101 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
117 | 133 | | |
118 | 134 | | |
119 | 135 | | |
| |||
375 | 391 | | |
376 | 392 | | |
377 | 393 | | |
378 | | - | |
| 394 | + | |
379 | 395 | | |
380 | 396 | | |
381 | 397 | | |
382 | 398 | | |
383 | 399 | | |
384 | | - | |
| 400 | + | |
385 | 401 | | |
386 | 402 | | |
387 | 403 | | |
| |||
390 | 406 | | |
391 | 407 | | |
392 | 408 | | |
393 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
394 | 412 | | |
395 | 413 | | |
396 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
74 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
84 | | - | |
85 | | - | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | | - | |
| 93 | + | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
| |||
268 | 274 | | |
269 | 275 | | |
270 | 276 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
277 | 286 | | |
278 | 287 | | |
279 | 288 | | |
| |||
295 | 304 | | |
296 | 305 | | |
297 | 306 | | |
298 | | - | |
| 307 | + | |
299 | 308 | | |
300 | | - | |
| 309 | + | |
301 | 310 | | |
302 | 311 | | |
303 | 312 | | |
| |||
312 | 321 | | |
313 | 322 | | |
314 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
315 | 357 | | |
316 | 358 | | |
317 | 359 | | |
| |||
408 | 450 | | |
409 | 451 | | |
410 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
411 | 471 | | |
412 | 472 | | |
413 | 473 | | |
| |||
0 commit comments