Work

A Lean-verified checker for exact Wilcoxon signed-rank p-values

Year: 2026
Type: preprint
Abstract: Statistical computations should expose the connection between reported numbers and their mathematical definitions. Exact rank-test software computes finite distributions, and formal verification can link those distributions to an executable numerical decision. This study uses Lean to prove which inputs an exact Wilcoxon signed-rank checker accepts, rejects, classifies as invalid, or classifies as out of scope. The proof connects decimal integer arguments, doubled midranks, stored counts of labeled sign assignments, inclusive tails, and rational comparison over one through 100 integer differences. Lean also proves that a truncated-tail implementation returns the same outcome as the original for every argument list.. Both native binaries matched all 709 compatible outcomes from the records of an earlier frozen evaluation and all 22 dedicated CLI checks. A separate cross-check on six externally published paired datasets used SciPy’s exhaustive sign permutations as the reference. Across 54 dataset and test-setting combinations, both evaluated binaries accepted all reference ratios and rejected all halved ratios. A prospective survey then applied the checker to the outputs of eleven third-party implementations on 3,381 integer inputs fixed before execution. Five implementations agreed with the checker on every evaluated target, including tied inputs for the four whose exact method accepts them. Five returned binary64 values that it rejected, and one, measured through its three-decimal printed output, printed values above one that it rejected and in-range values that differ from the exact probability. These values arise from a doubled tail without a cap near the centre of the null distribution, from an upper tail formed by complement, from results a few units in the last place above one, and from integer arithmetic of insufficient width at the tested sizes of 40 to 60 pairs. The frozen reference computation and candidate comparison use a specified finite sign-assignment model and a relative-error budget of 10^-12.
Language: English
Subfield: Software
Open Access status: green
OpenAlex ID: W7235638186
Cites:
Cited by:
Related to: 10