build(lean): verify/lean requires bookspec's Lean; the laws live once

D-69 puts the accounting laws in one place: bookspec's Lean, namespace
`Bookspec`. L-F1 landed there every file of `verify/lean/Wanderbooks/`.
Before deleting the copies, each was checked: comments stripped, namespace
normalised, blank lines dropped, and diffed against its bookspec peer --
all ten are identical (Basic, Entry, Statements, Closing, Ledger,
Apportion, Parties, Prorate, Deductible, Documents). There is nothing
wanderbooks-only left to keep.

So `verify/lean/lakefile.toml` now `[[require]]`s bookspec as a git
dependency at 77e046334eea29e082b53bbe907017d9ffef5a0a -- the same rev
`crates/ledger-core/Cargo.toml` pins the Rust checker to -- with
`subDir = "lean"`. The generated `lake-manifest.json` is committed, because
Lake builds from it and it must not float.

`Wanderbooks.lean` is now a thin local target that imports `Bookspec`:
`lake build` builds and checks the whole law set, and the file says where
a law is edited and how wanderbooks picks it up (move the pin). The
duplicated modules and the `Wanderbooks/` directory are gone.

`Audit.lean` imports `Bookspec` and audits all 151 theorems (the 118
headline laws plus the 33 named laws in `Laws.lean` that cite them) --
the whole set bookspec itself audits. `just prove` still checks standard
axioms only; its summary now says "theorems", since the set is more than
headline ones.

The new `tests/bookspec/pin.rs` reads the rev out of the lakefile, the
manifest, and both crates' Cargo.toml, and fails unless all four name the
same repository at the same commit, and bookspec's `lean/` package. Without
it the Lean laws and the Rust checker could silently be different spec
versions.

Verified: `lake build` from a clean `.lake` (fetches and builds in 7 s);
`just prove` 871 s (Kani 53 harnesses, then 151 theorems, standard axioms
only); `cargo test -p ledger-core --test bookspec pin`; `cargo fmt --check`;
`cargo clippy -p ledger-core --tests -D warnings`.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-08 11:35:07 -07:00
1 parent 7a3860de73
commit e431791bbc
18 files changed
+231 -3815

No files matched your search

+39 -6
View File
@@ -1,11 +1,11 @@
import Wanderbooks
import Bookspec
/-! `just prove` runs this file: each headline theorem's axioms are printed,
and must be only Lean's standard three (`propext`, `Quot.sound`,
`Classical.choice`) or fewer. No `sorryAx`, nothing assumed. -/
open Wanderbooks
/-! `just prove` runs this file: each theorem's axioms are printed, and must
be only Lean's standard three (`propext`, `Quot.sound`, `Classical.choice`)
or fewer. No `sorryAx`, nothing assumed. The theorems are bookspec's: the
118 headline laws and the 33 named laws that cite them (D-69). -/
open Bookspec
#print axioms Accepted.net_zero
#print axioms sum_movements
#print axioms movement_with_reversal
@@ -124,3 +124,36 @@ open Wanderbooks
#print axioms Deductible.tie_example
#print axioms Deductible.scale_books
#print axioms Deductible.scale_percents
#print axioms law_debits_equal_credits
#print axioms law_accounting_equation
#print axioms law_trial_balance
#print axioms law_net_income_articulates
#print axioms law_cash_flow_is_change_in_cash
#print axioms law_acceptance_is_arithmetic
#print axioms law_accepted_entry_nets_to_zero
#print axioms law_movements_partition_the_net
#print axioms law_reversal_accepted_iff
#print axioms law_reversal_cancels
#print axioms law_normal_side
#print axioms law_trial_balance_is_complete
#print axioms law_period_statements_add_up
#print axioms law_invariant_holds
#print axioms law_posted_is_forever
#print axioms law_closed_periods_frozen
#print axioms law_record_changes_no_figure
#print axioms law_closing_entry_zeroes
#print axioms law_allocation_sums_to_the_whole
#print axioms law_member_run_telescopes
#print axioms law_cumulative_close_hands_out_its_net
#print axioms law_bounded_drift
#print axioms law_capital_unmoved_by_close
#print axioms law_reversal_is_the_exact_opposite
#print axioms law_proration_parts_sum_to_the_total
#print axioms law_proration_part_is_near
#print axioms law_proration_charge_never_falls
#print axioms law_control_account_is_its_documents
#print axioms law_send_changes_no_figure
#print axioms law_settlement_is_a_document_step
#print axioms law_write_off_within_bounds
#print axioms law_discard_moves_no_figure
#print axioms law_deductible_rounds_once