diff --git a/AGENTS.md b/AGENTS.md index 22372b80..6ff2584d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -133,7 +133,9 @@ So the bar, for every agent, every change: `verify/lean` — wanderbooks requires that package and holds no copy of it. Laws about the books over time are theorems about `Reachable` states. A new `Ledger` command is a new `Step` constructor, with its - preservation proof. No `sorry`, ever; `Audit.lean` lists every theorem. + preservation proof. No `sorry`, ever; bookspec's `lean/Audit.lean` + lists every theorem, and `just prove` audits that file from the pinned + package (wanderbooks keeps no copy of it). After landing a law in bookspec, move wanderbooks' pin to that rev in `verify/lean/lakefile.toml` and `lake-manifest.json` **and** in the crates' `Cargo.toml` (the checker and the Lean must be the same spec diff --git a/docs/proofs/README.md b/docs/proofs/README.md index 43f4700c..031f5bda 100644 --- a/docs/proofs/README.md +++ b/docs/proofs/README.md @@ -19,10 +19,13 @@ instead: Lean theorem it added; - anything the solver could not do, and what carries it instead (Lean at any size, a bridge property, an exhaustive unit test). -- **Workers do not edit `docs/verification.md` or `verify/lean/Audit.lean`.** - The integrator folds the unit notes into `verification.md`'s tables and - prose, and adds the `#print axioms` lines to `Audit.lean` in one place, - in one edit per batch, after the batch's merges. +- **Workers do not edit `docs/verification.md`.** The integrator folds + the unit notes into its tables and prose in one edit per batch, after + the batch's merges. +- **A unit's Lean theorems go into bookspec**, on the unit's bookspec + branch: the theorem in `lean/Bookspec/`, its `#print axioms` line in + bookspec's `lean/Audit.lean`. Wanderbooks keeps no audit list of its + own; `just prove` audits bookspec's, from the pinned package (D-69). - A unit's note lands in the same commit as its harnesses, so the proof and its description are never apart in history. diff --git a/docs/verification.md b/docs/verification.md index 6050cf87..715ff6b5 100644 --- a/docs/verification.md +++ b/docs/verification.md @@ -49,9 +49,10 @@ payroll, U8 control, U9 display) each get files of their own: `total`, `schedule`, `ratio`, `payroll`, `control`; `proofs/mod.rs` holds the original harnesses and each unit adds `proofs/.rs`. A unit writes its proof note in `docs/proofs/.md`; the integrator folds the -notes into this file and the `#print axioms` lines into -`verify/lean/Audit.lean` in one edit per batch. Workers do not edit this -file (see `docs/proofs/README.md`). +notes into this file in one edit per batch; a unit's Lean theorems and +their `#print axioms` lines go into bookspec (its `lean/Audit.lean`, +which `just prove` audits from the pinned package). Workers do not edit +this file (see `docs/proofs/README.md`). ## The laws diff --git a/justfile b/justfile index 013171fb..845907e9 100644 --- a/justfile +++ b/justfile @@ -74,7 +74,9 @@ prove: (_kani "fast") set -euo pipefail cd verify/lean lake build - audit=$(lake env lean Audit.lean) + # The audit is bookspec's own, from the pinned package: the laws and + # their list live once there (D-69), so no copy here can fall behind. + audit=$(lake env lean .lake/packages/bookspec/lean/Audit.lean) if grep -v -E "depends on axioms: \[(propext|Quot.sound|Classical.choice)(, (propext|Quot.sound|Classical.choice))*\]$|does not depend on any axioms" <<<"$audit"; then echo "Lean audit: a theorem rests on something beyond the standard axioms" >&2 exit 1 diff --git a/verify/lean/Audit.lean b/verify/lean/Audit.lean deleted file mode 100644 index 75ca3a4d..00000000 --- a/verify/lean/Audit.lean +++ /dev/null @@ -1,159 +0,0 @@ -import Bookspec - -/-! `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 -#print axioms accepted_reversal_iff -#print axioms accounting_equation -#print axioms balance_after_line -#print axioms trial_balance_iff -#print axioms closingEntry_net -#print axioms closingEntry_zeroes -#print axioms closingEntry_accepted -#print axioms net_closings_is_net_income -#print axioms plugLast_total -#print axioms plugLast_keeps -#print axioms runPart_telescopes -#print axioms closePart_total -#print axioms trueUp_total -#print axioms trueUp_running -#print axioms closePart_eq_trueUp -#print axioms cumulative_drift -#print axioms statement_after_close -#print axioms statement_unmoved_by_close -#print axioms Reachable.inv -#print axioms Reachable.books_net_zero -#print axioms Reachable.trial_balance -#print axioms Reachable.trial_balance_through -#print axioms Reachable.accounting_equation -#print axioms Reachable.accounting_equation_through -#print axioms Steps.extends -#print axioms Steps.frozen -#print axioms close_zeroes -#print axioms close_credits_net_income -#print axioms statements_add_up -#print axioms Apportion.ranks_perm -#print axioms Apportion.apportion_sum -#print axioms Apportion.apportion_sum_of_shortfall -#print axioms Apportion.rem_pos_of_rank_lt -#print axioms Apportion.apportion_drift -#print axioms Apportion.allocW_sum -#print axioms Apportion.allocW_drift -#print axioms Apportion.allocW_cumulative_drift -#print axioms Apportion.allocW_cumulative_total -#print axioms Step.record_changes_no_figure -#print axioms Reachable.records -#print axioms net_splits_by_flow -#print axioms applyCash_conserves -#print axioms applyCash_exhausts -#print axioms applyCash_neg -#print axioms entry_flows_sum -#print axioms flows_reversal -#print axioms constructive_nets -#print axioms constructive_neg -#print axioms constructive_sections_net -#print axioms stmt_flows_sum -#print axioms stmt_flows_reversal -#print axioms cashflow_sections_sum_to_cash_change -#print axioms secNet_cash_is_movement -#print axioms operating_reconciliation_ties -#print axioms operating_reconciliation_ties_all -#print axioms cashflow_reversal_nets -#print axioms Reachable.cashflow_foots -#print axioms Reachable.cashflow_is_change_in_cash -#print axioms reverseTarget_involutive -#print axioms capitalTarget_odd -#print axioms partyTarget_odd -#print axioms sumOver_movement_reversal -#print axioms Prorate.cum_mono -#print axioms Prorate.cum_le -#print axioms Prorate.cum_full -#print axioms Prorate.parts_telescope -#print axioms Prorate.prorate_total -#print axioms Prorate.prorate_nonneg -#print axioms Prorate.part_within_a_unit -#print axioms Prorate.roundUnit_near -#print axioms Prorate.roundUnit_scale -#print axioms Prorate.cum_near -#print axioms Prorate.cum_dvd -#print axioms Prorate.part_near -#print axioms Prorate.chargeMid_eq_cum -#print axioms Prorate.chargeLast_eq_cum -#print axioms Prorate.chargeLast_start -#print axioms Prorate.chargeLast_mono -#print axioms Prorate.kernel_parts_total -#print axioms Prorate.kernel_parts_nonneg -#print axioms Documents.control_agrees -#print axioms Documents.control_agrees_through -#print axioms Documents.Step.document_unattached -#print axioms Documents.settle_posts_a_document_step -#print axioms Documents.settle_unattached -#print axioms Documents.Step.reverse_moves -#print axioms Documents.reverse_twice -#print axioms Documents.Step.markSent_changes_no_figure -#print axioms Documents.Reachable.unattached_zero -#print axioms Documents.Reachable.control_is_documents -#print axioms Documents.Step.writeOff_unattached -#print axioms Documents.writeOff_within_bounds -#print axioms Step.discard_keeps_books -#print axioms Step.discard_drafts -#print axioms Step.discard_unblocks_close -#print axioms Deductible.roundHA_near -#print axioms Deductible.roundHA_tie_pos -#print axioms Deductible.roundHA_tie_neg -#print axioms Deductible.roundHA_neg -#print axioms Deductible.roundHA_sign -#print axioms Deductible.roundHA_scale -#print axioms Deductible.near -#print axioms Deductible.tie_away_pos -#print axioms Deductible.tie_away_neg -#print axioms Deductible.sign -#print axioms Deductible.neg -#print axioms Deductible.of_sum -#print axioms Deductible.of_perm -#print axioms Deductible.append -#print axioms Deductible.split_percent -#print axioms Deductible.per_account_differs -#print axioms Deductible.per_account_differs_mixed -#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 diff --git a/verify/lean/Wanderbooks.lean b/verify/lean/Wanderbooks.lean index 849d0e9e..a01031e1 100644 --- a/verify/lean/Wanderbooks.lean +++ b/verify/lean/Wanderbooks.lean @@ -6,7 +6,8 @@ import Bookspec The laws live once, in bookspec's Lean (`bookspec/lean/Bookspec/`, namespace `Bookspec`), and this project requires that package (D-69). This module is the local target `lake build` builds: importing it builds and checks every -law, and `Audit.lean` prints their axioms. +law, and `just prove` prints their axioms with bookspec's own +`lean/Audit.lean` (from `.lake/packages/bookspec`; no copy here). A law that changes is edited in bookspec, and this project moves its pin (`lakefile.toml`, `lake-manifest.json`) to bookspec's new rev — the same rev