feat(verify): prove a write-off never takes a document below zero (P4b S7)

Ledger::write_off is a new command, so it is a new Step: Step.writeOff,
whose two lines are a tagged control line (the receivable falls) and an
untagged expense line (the deduction). Being a document step in shape, it
moves nothing unattached, so control_agrees and
Reachable.control_is_documents still hold with no new proof:
Step.writeOff_unattached states its half of that.

writeOff_within_bounds is the law the command's refusal enforces: a
write-off of at most what the document is owed, read over the date-sum
docSum ... through D (B-38 fixed that sum, not standing), leaves what is
owed through the write-off's day at or above zero. through_append lets
the write-off's own two lines be read separately.

Both are listed in Audit.lean; just prove holds (standard axioms only, no
sorry).
This commit is contained in:
swaits committed 2026-10-27 12:44:45 -06:00
1 parent d5af44b9cb
commit 62f2fb058e
2 files changed
+79 -15

No files matched your search

+2
View File
@@ -96,3 +96,5 @@ open Wanderbooks
#print axioms Documents.reverse_twice
#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