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

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.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-17
DOI
https://doi.org/10.5281/zenodo.24297375
Primary Topic
Logic, programming, and type systems
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

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

Tasuku Kobayashi
2 links
Zenodo (CERN European Organization for Nuclear Research)
Logic, programming, and type systems
preprint

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

Tasuku Kobayashi
preprint en

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.

Zenodo (CERN European Organization for Nuclear Research)
Logic, programming, and type systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon