FloatLib: Verified Floating-Point Arithmetic in Lean
Robert Joseph George, Will Adkisson, Anima Anandkumar
Abstract
We present FloatLib, a verified arbitrary-precision floating-point arithmetic library in Lean 4 that combines broad format coverage, machine-checked correctness, and efficient certified execution. To our knowledge, FloatLib is the first Lean library to unify IEEE binary and decimal arithmetic, arbitrary-width posits, P3109, and user-defined formats and rounding rules behind interchangeable certified software backends. Every certified backend is proved equal to a complete encoded specification, preserving signed zeros and exceptional values, while numerical theorems connect execution to real rounding, error bounds, and exactness. FloatLib combines exhaustive certified tables for small formats with verified word and limb kernels based on guard-and-sticky invariants and independently checked quotient candidates. Its posit development additionally proves standard rounding thresholds and exact quire accumulation within capacity for arbitrary widths. Across matched workloads, FloatLib achieves speedups of up to 1.46x over FLoPS and 116x over Universal, while remaining slower in some regimes such as binary arithmetic against MPFR. Independent conformance testing includes more than 102 million TestFloat evaluations with zero differences under the tested relation. We release the library, proofs, benchmarks, evaluation data, and guide as open source.
Create a lesson
Related papers
String Diagrams for Process Mining
Antony R. Lee, Peter Tiňo, Iain B. Styles
Rich Sequences and Decidability of Arithmetic Theories
Toghrul Karimov, Joris Nieuwveld, Joël Ouaknine
An Explicit Ordinal Bound for System T Dialogue Trees
MingKun Xiao, YiXuan Sun
Concurrency, Causality and Conflict via Independence in Reversible Calculi
Clément Aubert, Gabriele Cecilia, Iain C. C. Phillips et al.
A Theory of a Two-Dimensional Typed Lambda Calculus
Daniel O. Martínez-Rivillas, Arthur F. Ramos, Ruy J. G. B. de Queiroz
MightyPPL : Towards model checking MTL
Hsi-Ming Ho, Shankara Narayanan Krishna, Khushraj Madnani et al.