refactor(core): the kernel and its proofs become modules, one file per sweep unit

kernel.rs is now kernel/: mod.rs keeps the laws and re-exports entries
(the old file, unchanged) plus one file per kernel-sweep unit (U1 fx, U2
round, U3 allocate, U4 total, U5 schedule, U6 ratio, U7 payroll, U8
control). proofs.rs is proofs/: mod.rs holds the original 63 harnesses and
each unit gets a file of its own. tests/kernel_bridge.rs is now
tests/kernel_bridge/main.rs plus one file per unit; Cargo still builds the
single test target named kernel_bridge.

`_kani` now scans proofs/mod.rs and proofs/*.rs and passes the fully
qualified name each file gives its harness (Kani's --exact matches only a
fully qualified name), so a harness resolves wherever it lives. It fails
when kani_slow names no harness, or when two harnesses share a name and
would make the slow list ambiguous; `just prove-list` prints every harness
with its module path and set, showing the slow list resolved without
running it.

Nothing moves in the books: the same 53 fast Kani harnesses and 118 Lean
theorems verify, and the same 1096 tests pass (27 in the bridge).

Docs: verification.md gains the kernel-sweep policy (each unit writes
docs/proofs/<unit>.md; the integrator folds the notes into
verification.md and Audit.lean in one edit per batch), and the file
references in AGENTS.md, testing.md, architecture.md, oracle.md and
spec/rules.md follow the new paths.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-08 11:30:47 -07:00
1 parent 66d9b7ac54
commit 0cf013b578
36 files changed
+368 -108

No files matched your search

+4 -4
View File
@@ -42,7 +42,7 @@ later). The reference points:
read its docs, never copy its code. This repo is MIT OR Apache-2.0.
Never disassemble or copy from proprietary software.
6. **Accounting laws are proved, not just tested.** Arithmetic that money
flows through lives in `kernel.rs` and carries Kani proofs; the laws
flows through lives in `kernel/` and carries Kani proofs; the laws
it serves carry Lean proofs. `just prove` stays green. See
"Formal methods" below.
@@ -104,11 +104,11 @@ So the bar, for every agent, every change:
carry a `SOURCE:` line. Never write a spec from what the code happens
to do, or from what you remember; find the document, or ask.
1. **Money arithmetic goes in `kernel.rs`, generic over `Amount`.** If
1. **Money arithmetic goes in `kernel/`, generic over `Amount`.** If
you write a sum, a sign flip, a split, or a rounding plug anywhere
else, move it into the kernel. The engine calls the kernel. It never
gets a second copy.
2. **Every kernel function gets a Kani harness** in `src/proofs.rs`, on
2. **Every kernel function gets a Kani harness** in `src/proofs/`, on
fixed arrays (no symbolic-length `Vec` growth, no `copy_from_slice`),
with a `kani::cover!` showing the interesting case is reached.
3. **Every new law gets a Lean theorem** in `verify/lean`. Laws about
@@ -116,7 +116,7 @@ So the bar, for every agent, every change:
`Ledger` command is a new `Step` constructor, with its preservation
proof. No `sorry`, ever; `Audit.lean` lists every headline theorem.
4. **Every kernel instantiation gets a bridge property** in
`tests/kernel_bridge.rs`, so what Kani proved on `i64` holds on
`tests/kernel_bridge/`, so what Kani proved on `i64` holds on
`Decimal`.
5. **A failing proof is a finding, not an obstacle.** Get the
counterexample, replay it natively, and decide on evidence: bug in