← All papers
First page of StatClaim: Study Designs as Types, Protocols as Programs and Statistical Claims as Proof Obligations

StatClaim: Study Designs as Types, Protocols as Programs and Statistical Claims as Proof Obligations

Supun Manathunga

stat.CO Nov 23, 2026 · v1 cs.PL
Lean is the verification backend: generated proof obligations for Type I error, familywise error, power and coverage claims are proved and checked in Lean.
Statistical guarantees depend on the compatibility of a study's model, hypotheses, sampling plan and analysis. StatClaim is a declarative domain-specific language for encoding research protocols and statistical analysis plans as programs built from objects whose types encode their statistical roles within the study design. The compiler checks type compatibility and applies contracts to check additional requirements on the values and relationships of these objects. When verification is requested, StatClaim's backend constructs and checks proofs of supported statistical claims using Lean under stated assumptions. These claims concern Type I error, familywise error, power and interval coverage, including supported combinations of analyses and procedures with planned stopping rules. Reports distinguish formally proved, conditional, cited and author-declared guarantees and provide replayable certificates for verified claims. The same specification supports sample-size searches, power calculations and interval-precision assessment using exact calculations, analytical approximations or reproducible simulation. A command-line interface, editor integration and graphical block editor use a shared compiler and execution layer. Validation reproduces 102 optimal and minimax two-stage designs from Simon's published tables and verifies their error and power bounds in Lean. A clinical trial case study illustrates partial encoding of a published analysis plan using cited methods and conditional proofs. The open-source implementation includes runnable tutorials and examples for specifying and checking study designs before outcomes are collected.

A statistical analysis can be computed correctly yet still be unjustified for a given study design. Examples are familywise error under multiple endpoints, or guarantees under adaptive stopping rules. Researchers need to check that models, hypotheses, sampling plans and analyses are compatible before data collection.

StatClaim is a declarative DSL in which study components are typed objects and compatibility contracts are checked by a compiler. On verification requests, a backend generates Lean statements and proofs for supported claims (Type I error, familywise error, power, interval coverage) and emits replayable certificates (Proof.lean, .olean, certificate.json). Evidence is graded as proved, conditional, cited or declared. The system also offers a CLI, an LSP editor integration and a block editor.

Validation reproduces all 102 optimal and minimax two-stage designs from Simon's published tables and checks their error and power bounds in Lean. A COPD clinical trial case study partially encodes a published analysis plan using cited methods and conditional composition proofs.

CheckEntriesBasis
Error and power targets met102/102Exact calculation
Error and power bounds checked in Lean102/102Formal proof
Bounded search returns the tabulated design102/102Calculation
clinfun returns the tabulated design102/102Comparison
Printed early-stopping probability agrees98/102Comparison
Simon two-stage design validation