π€ AI Summary
This work addresses the challenge of automated formal verification for higher-order, recursive, and polymorphic Scala programs involving floating-point arithmeticβa task that existing tools struggle to support. We present the first comprehensive integration of floating-point reasoning into the Stainless deductive verifier for Scala. Our approach axiomatically models all standard math library functions and incorporates built-in mechanisms to validate the consistency between these axioms and their actual implementations. The framework fully supports polymorphism, recursion, and higher-order functions, combining formal specifications with counterexample generation. Evaluated on real-world GitHub codebases, it successfully verifies critical properties such as output range bounds and the absence of NaN or infinity values, or automatically produces counterexamples when violations occur, thereby substantially advancing the verifiability of floating-point functional programs.
π Abstract
We extend the Stainless deductive verifier with floating-point support, providing the first automated verification support for floating-point numbers for a subset of Scala that includes polymorphism, recursion and higher-order functions. We follow the recent approach in the KeY verifier to axiomatise reasoning about mathematical functions, but go further by supporting all functions from Scala's math API, and by verifying the correctness of the axioms against the actual implementation in Stainless itself. We validate Stainless'floating-point support on a new set of benchmarks sampled from real-world code from GitHub, showing that it can verify specifications about, e.g., ranges of output or absence of special values for most supported functions, or produce counter-examples when the specifications do not hold.