From 2295d15be8689e14570425281611de7d5c4b0da7 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 9 Nov 2026 11:22:13 -0700 Subject: [PATCH] test(core): the payroll plan harness carries one employee The two-employee payroll_plan_balances timed out in CBMC: over 80 minutes at full CPU, killed with no result (sixteen symbolic figures into eight totals and check_lines). The earlier note's 297.6s figure came from a misattributed background result and is withdrawn here; the harness as committed had never verified. One employee reaches every plan line, both FICA shares on both sides, net_pay and check_lines, and verifies in 62.0s (65.6s wall). Lean's payroll_plan_balances carries the plan at its totals for any number of employees, since a run's totals are sums of the same eight figures. The bound and why are written in the harness and the note. Co-Authored-By: Muse Wonder 1.0 --- crates/ledger-core/src/proofs/payroll.rs | 19 +++++++++++-------- .../tests/kernel_bridge/payroll.rs | 2 +- docs/proofs/k-u7.md | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/crates/ledger-core/src/proofs/payroll.rs b/crates/ledger-core/src/proofs/payroll.rs index 2fc32ec8..f509fa37 100644 --- a/crates/ledger-core/src/proofs/payroll.rs +++ b/crates/ledger-core/src/proofs/payroll.rs @@ -6,7 +6,7 @@ //! //! A payroll line carries five employee deductions (federal, state, //! Social Security, Medicare, other), so the deduction arrays are fixed -//! at five. The plan harness carries two employees and the plan's eight +//! at five. The plan harness carries one employee and the plan's eight //! totals (gross, employer FICA, the five payables, net), each a kernel //! total of the two lines, in a fixed array of eight `(Side, amount)` //! lines. Amounts run to a few thousand units: the law is about the @@ -116,13 +116,19 @@ fn net_pay_nonnegative_when() { kani::cover!(deducted > 0 && net > 0, "a partial withholding"); } -/// The payroll plan balances through `check_lines`: two employees, the +/// The payroll plan balances through `check_lines`: one employee, the /// eight totals `payroll_entry_plan` posts (Dr gross, Dr employer FICA, /// Cr federal, state, Social Security, Medicare and other payables, Cr /// cash net), every total positive, debits equal to credits exactly. +/// Two employees timed out in CBMC (over 80 minutes, 2026-11-09: +/// sixteen symbolic figures into eight totals and `check_lines`); one +/// employee reaches every line, both FICA shares on both sides, and +/// the balance, and Lean's `payroll_plan_balances` carries the plan at +/// its totals for any number of employees (a run's totals are sums of +/// the same eight figures). #[kani::proof] fn payroll_plan_balances() { - let employees = [any_employee(), any_employee()]; + let employees = [any_employee()]; let gross = total(employees.iter().map(|e| e.gross)).expect("in range"); let employer = total( employees @@ -164,9 +170,6 @@ fn payroll_plan_balances() { check_lines(&plan).is_ok(), "the payroll plan is an acceptable entry" ); - kani::cover!( - employees[0].gross != employees[1].gross, - "two employees differ" - ); - kani::cover!(net > gross, "net over two employees exceeds one gross"); + kani::cover!(net < gross, "withholdings leave a smaller net"); + kani::cover!(employer > 0, "the employer share is posted"); } diff --git a/crates/ledger-core/tests/kernel_bridge/payroll.rs b/crates/ledger-core/tests/kernel_bridge/payroll.rs index f0a94cc8..c81acb3d 100644 --- a/crates/ledger-core/tests/kernel_bridge/payroll.rs +++ b/crates/ledger-core/tests/kernel_bridge/payroll.rs @@ -1,7 +1,7 @@ //! U7 bridge properties: payroll arithmetic (kernel sweep). //! //! `proofs/payroll.rs` proves `kernel::net_pay` on `i64` (five -//! deductions, a two-employee plan through `check_lines`); the engine +//! deductions, a one-employee plan through `check_lines`); the engine //! runs the same code on `Decimal`. These properties check that the two //! instantiations agree, that `Decimal` agrees with an independent exact //! `i128` reference (mantissas over a common power of ten, sharing no diff --git a/docs/proofs/k-u7.md b/docs/proofs/k-u7.md index 2fe1932a..6d345244 100644 --- a/docs/proofs/k-u7.md +++ b/docs/proofs/k-u7.md @@ -49,7 +49,7 @@ payroll use (nothing in a run rounds or splits) and were not called. On `i64`, fixed arrays, each with `kani::cover!`. A payroll line carries five employee deductions, so the deduction arrays are fixed at -five; the plan harness carries two employees and the plan's eight +five; the plan harness carries one employee and the plan's eight totals in a fixed array of eight `(Side, amount)` lines. Amounts run to a few thousand units (gross 1 to 10,000, withholdings to 1,000 or 2,000): the laws are about the shape of the subtraction and the @@ -64,7 +64,7 @@ positive). |---|---|---| | `net_pay_is_gross_less_deductions` | 45 | net equals gross less the deductions' `total`, for deductions of either sign; withholdings exceeding gross and a negative net are reached, and `i64::MAX`/`MIN` past the range are `None` (2 covers). 19.5 s verification | | `net_pay_nonnegative_when` | 45 | non-negative deductions summing to at most gross give exactly gross less their sum, never negative; a zero net and a partial withholding are reached (2 covers). 21.9 s wall, 7.0 s verification | -| `payroll_plan_balances` | 45 | two employees: the eight totals `payroll_entry_plan` posts pass `check_lines` (two or more lines, every amount positive and in range, debits equal credits); differing employees and a net over one gross are reached (2 covers). 297.6 s verification | +| `payroll_plan_balances` | 45 | one employee: the eight totals `payroll_entry_plan` posts pass `check_lines` (two or more lines, every amount positive and in range, debits equal credits); a smaller net and a posted employer share are reached (2 covers). 65.6 s wall, 62.0 s verification. Two employees timed out in CBMC (over 80 minutes, killed): sixteen symbolic figures into eight totals; one employee reaches every line and both FICA shares on both sides, and Lean carries the plan at its totals for any number of employees | Times: `cargo kani -p ledger-core --exact --harness proofs::payroll::`, the shared dev machine under `nice -n 15`,