merge: P4b S6, paying on terms (branch S6, 6c4480cd)

The third of the paused branches: Ledger::settle with discounts and the
processor's fee (kernel::settle, Kani settle_is_exact, Lean
settle_posts_a_document_step), books.receive_payment and books.pay_bill
with applications, books.bills_due, the agings' detail and tie-out, the
aging exports and the CPA package's aging CSVs, the handlers in
tools/settlements.rs. Twelve files conflicted with the S4.4 and S5
merges, resolved as plan 8.0.2 says: both routers; both test appends
(the shared match arm in arap_standing.rs spliced into both tests; the
shared `.unwrap()` in store.rs); the scope table at 124; one
invoices-and-bills handbook (S5's send step 1 with S6's steps 2, 3, 5
and procedures) registered once; docs/mcp-interface.md with S4.4's
create docs and S6's payment docs; S5's law renumbered 35 and S6's 36
(S1's is 34); the parity rows and sections of both. S6's wire tests
create their bills as S4.4's contract now requires (confirmed, the
vendor's number, a line account, the vendor's invoice uploaded) and live
in their own module beside S4.4's tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
swaitsandClaude Fable 5.1 committed 2026-10-28 21:26:40 -06:00
commit be58059830
45 files changed
+3949 -520

No files matched your search

+2
View File
@@ -92,6 +92,8 @@ open Wanderbooks
#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
+15
View File
@@ -221,6 +221,21 @@ theorem Step.document_unattached (B : Books) (e : List TLine) (h : Tagged B.cont
simp [hn, onAcct, hacc]
· simp [hn]
/-- **A settlement is a document step**: its entry's every control line
carries its document (a payment or a discount), so the books' rules for
any entry whose control lines are tagged cover it; no new `Step`
constructor is needed (plan P4b S6; rules.md B-42). -/
theorem settle_posts_a_document_step (B : Books) (e : List TLine)
(h : Tagged B.control e) : Step B { B with lines := B.lines ++ e } :=
Step.document B e h
/-- **A settlement never moves what is unattached** on a control account:
every control line it posts is its document's (B-42, from
`Step.document_unattached`). -/
theorem settle_unattached (B : Books) (e : List TLine) (h : Tagged B.control e) (a : Nat)
(ha : a ∈ B.control) : unattached a (B.lines ++ e) = unattached a B.lines :=
Step.document_unattached B e h a ha
/-- **A reversal moves each document by exactly the opposite of its lines
it mirrors** (B-38 INVARIANT 3), and what is unattached likewise: only
reversing a legacy hand line changes it. -/