docs(verification): every Ledger command, and the step of the Lean model it is

bookspec proves its laws (the trial balance, the accounting equation,
posted is forever) for every state its steps reach. The engine has 119
public commands and the model 14 steps, and nothing said which command is
which step, so "every reachable state" read wider than it was.

docs/command-steps.md is that map, command by command: 71 are the
`record` step (they change how the books are kept and no figure), 11 are
one step, 19 are several steps run as one, 17 are the doors a journal is
replayed through, and one, `renumber_account`, is no step at all.

What the map shows that was not written down before:

- A renumber changes the chart's codes and the model has no step for it.
- Four doors apply a journaled change without a check the model's step
  requires (a draft dated in a closed period, a period overlapping
  another, a reversal dated before its original). Books replayed from an
  old journal can therefore be outside the model's reachable states. The
  laws resting on distinct codes, acceptable entries and known accounts
  still hold by reading their proofs; no theorem says so yet.
- The registers (assets, schedules, recurring entries, payroll runs) have
  proved arithmetic and no model of how they change over time.
- No proof ties a Rust command to its step: bookspec's examples and the
  differential test do, and the page lists what that test does not reach.

Each closes with Lean in bookspec; the triage (P2.5) lists them.

tests/command_steps.rs keeps the map whole: a command with no row, a row
with no command, a step the model does not have, or a new command marked
as no step without being added to the pinned list fails the build.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude committed 2026-11-09 21:00:11 -07:00
1 parent ae23efe5a3
commit c09f492c46
6 files changed
+426 -5

No files matched your search

+22 -5
View File
@@ -110,9 +110,26 @@ books. The gaps are in what the gates do not see.
(`wanderbooks licenses`; the viewer has no About page yet), with a
check in the lint part that it is current. Worker, well specified.
5. **The Lean model of the books covers 14 steps; the Rust `Ledger` has
about 100 commands**, and no list maps one to the other, so "every
reachable state" covers less than it reads. First the inventory
(worker, scout), then the steps that matter (hard implementation).
119 commands**, and no list mapped one to the other, so "every
reachable state" covered less than it read. The inventory is done
(`docs/command-steps.md`, kept whole by `tests/command_steps.rs`): 71
commands are the `record` step, 11 are one step, 19 are several steps
run as one, 17 are replay doors and one is no step. What it found, each
closing with Lean in bookspec (hard implementation, then the pin moves):
- `renumber_account` is no step of the model. A `renumber` step: codes
stay distinct, and every balance is the old one under the new code.
- Four doors apply a change without a check the model's step requires
(`create_entry`, `replay_generate_recurring`, `replay_create_period`,
`replay_reverse_entry`), so books replayed from an old journal can be
outside `Reachable`. The laws that rest on distinct codes, acceptable
entries and known accounts still hold, by reading the proofs; a
`ReplayStep` relation and its theorem would make that proved.
- The registers (fixed assets, schedules, recurring entries, payroll
runs) have proved arithmetic and no step model of how they change.
- Nothing proves a Rust command is its Lean step. Two tests check it:
bookspec's examples and the differential test (`lean_model.rs`),
which does not reach a standalone period, a close with explicit
targets, a draft left unposted or an account added late. Extend it.
6. **Coverage is measured only for ledger-core and ledger-store.**
7. **Three allocation preludes are still outside the kernel**
(`try_allocate`, `allocate_cumulative`, `tax_capital::split`): they
@@ -142,5 +159,5 @@ signing (D-64); the re-audit (P10); Q-6 before P9b.
(all four done).
4. One gate at the end (`just check`, `just prove`), one push, four gates
read.
5. The command-to-step inventory, the allocation preludes, then bookspec's
examples and second implementation.
5. The steps the inventory found missing (bookspec), the allocation
preludes, then bookspec's examples and second implementation.