Numerical Fuzz: A Type System for Rounding Error Analysis (2405.04612v2)
Abstract: Algorithms operating on real numbers are implemented as floating-point computations in practice, but floating-point operations introduce roundoff errors that can degrade the accuracy of the result. We propose $\Lambda_{num}$, a functional programming language with a type system that can express quantitative bounds on roundoff error. Our type system combines a sensitivity analysis, enforced through a linear typing discipline, with a novel graded monad to track the accumulation of roundoff errors. We prove that our type system is sound by relating the denotational semantics of our language to the exact and floating-point operational semantics. To demonstrate our system, we instantiate $\Lambda_{num}$ with error metrics proposed in the numerical analysis literature and we show how to incorporate rounding operations that faithfully model aspects of the IEEE 754 floating-point standard. To show that $\Lambda_{num}$ can be a useful tool for automated error analysis, we develop a prototype implementation for $\Lambda_{num}$ that infers error bounds that are competitive with existing tools, while often running significantly faster. Finally, we consider semantic extensions of our graded monad to bound error under more complex rounding behaviors, such as non-deterministic and randomized rounding.
- Rosa Abbasi and Eva Darulova. 2023. Modular Optimization-Based Roundoff Error Analysis of Floating-Point Programs. In International Symposium on Static Analysis (SAS), Cascais, Portugal (Lecture Notes in Computer Science, Vol. 14284). Springer, 41–64. https://doi.org/10.1007/978-3-031-44245-2_4
- Andrew W. Appel and Ariel E. Kellison. 2024. VCFloat2: Floating-Point Error Analysis in Coq. In ACM SIGPLAN Conference on Certified Proofs and Programs (CPP), London, England. 14–29. https://doi.org/10.1145/3636501.3636953
- Steve Awodey. 2010. Category Theory (2nd ed.). Oxford University Press.
- Really Natural Linear Indexed Type-Checking. In Symposium on Implementation and Application of Functional Programming Languages (IFL), Boston, Massachusetts. ACM Press, 5:1–5:12. https://doi.org/10.1145/2746325.2746335 arXiv:1503.04522 [cs.LO]
- A semantic account of metric preservation. In ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages (POPL), Paris, France. 545–556. https://doi.org/10.1145/3009837.3009890
- Probabilistic Relational Reasoning via Metrics. In IEEE Symposium on Logic in Computer Science (LICS), Vancouver, British Columbia. 1–19. https://doi.org/10.1109/LICS.2019.8785715
- Trusting computations: A mechanized proof from partial differential equations to actual program. Comput. Math. Appl. 68, 3 (2014), 325–352. https://doi.org/10.1016/J.CAMWA.2014.06.004
- Floating-point arithmetic. Acta Numerica 32 (2023), 203–290. https://doi.org/10.1017/S0962492922000101
- Sylvie Boldo and Guillaume Melquiond. 2011. Flocq: A Unified Library for Proving Floating-Point Algorithms in Coq. In IEEE Symposium on Computer Arithmetic (ARITH), Tübingen, Germany. 243–252. https://doi.org/10.1109/ARITH.2011.40
- A Core Quantitative Coeffect Calculus. In European Symposium on Programming (ESOP), Grenoble, France (Lecture Notes in Computer Science, Vol. 8410). Springer-Verlag, 351–370. https://doi.org/10.1007/978-3-642-54833-8_19
- A Sound Floating-Point Polyhedra Abstract Domain. In Asian Symposium on Programming Languages and Systems (APLAS), Bangalore, India (Lecture Notes in Computer Science, Vol. 5356). Springer-Verlag, 3–18. https://doi.org/10.1007/978-3-540-89330-1_2
- Stochastic Rounding and Its Probabilistic Backward Error Analysis. SIAM Journal on Scientific Computing 43, 1 (2021), A566–A585. https://doi.org/10.1137/20M1334796 arXiv:https://doi.org/10.1137/20M1334796
- The ASTREÉ Analyzer. In European Symposium on Programming (ESOP), Edinburgh, Scotland (Lecture Notes in Computer Science, Vol. 3444). Springer-Verlag, 21–30. https://doi.org/10.1007/978-3-540-31987-0_3
- Germund Dahlquist and Åke Björck. 2008. Numerical Methods in Scientific Computing, Volume I. Society for Industrial and Applied Mathematics. https://doi.org/10.1137/1.9780898717785
- Ugo Dal Lago and Francesco Gavazzo. 2022. A Relational Theory of Effects and Coeffects. 6, POPL, Article 31 (Jan. 2022). https://doi.org/10.1145/3498692
- Toward a Standard Benchmark Format and Suite for Floating-Point Analysis. In International Workshop on Numerical Software Verification (NSV) , Toronto, Ontario. Springer-Verlag, 63–77.
- Daisy - Framework for Analysis and Optimization of Numerical Programs (Tool Paper). In International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Thessaloniki, Greece (Lecture Notes in Computer Science, Vol. 10805). Springer-Verlag, 270–287. https://doi.org/10.1007/978-3-319-89960-2_15
- Eva Darulova and Viktor Kuncak. 2014. Sound Compilation of Reals. In ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages (POPL), San Diego, California. 235–248. https://doi.org/10.1145/2535838.2535874
- Eva Darulova and Viktor Kuncak. 2017. Towards a Compiler for Reals. ACM Trans. Program. Lang. Syst. 39, 2, Article 8 (March 2017). https://doi.org/10.1145/3014426
- Scalable yet Rigorous Floating-Point Error Analysis. In International Conference for High Performance Computing, Networking, Storage and Analysis (SC20). 1–14. https://doi.org/10.1109/SC41405.2020.00055
- Marc Daumas and Guillaume Melquiond. 2010. Certification of bounds on expressions involving rounded operators. ACM Trans. Math. Softw. 37, 1 (2010), 2:1–2:20. https://doi.org/10.1145/1644001.1644003
- Towards a Formal Theory of Graded Monads. In International Conference on Foundations of Software Science and Computation Structures (FoSSaCS), Eindhoven, The Netherlands (Lecture Notes in Computer Science, Vol. 9634). Springer-Verlag, 513–530. https://doi.org/10.1007/978-3-662-49630-5_30
- Linear Dependent Types for Differential Privacy. In ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages (POPL), Rome, Italy. 357–370. https://doi.org/10.1145/2429069.2429113
- Combining effects and coeffects via grading. In ACM SIGPLAN International Conference on Functional Programming (ICFP), Nara, Japan. 476–489. https://doi.org/10.1145/2951913.2951939
- Bounded Linear Logic: A Modular Approach to Polynomial-Time Computability. Theor. Comput. Sci. 97, 1 (1992), 1–66. https://doi.org/10.1016/0304-3975(92)90386-T
- David Goldberg. 1991. What Every Computer Scientist Should Know about Floating-Point Arithmetic. ACM Comput. Surv. 23, 1 (March 1991), 5–48. https://doi.org/10.1145/103162.103163
- Eric Goubault and Sylvie Putot. 2006. Static Analysis of Numerical Algorithms. In International Symposium on Static Analysis (SAS), Seoul, Korea (Lecture Notes in Computer Science, Vol. 4134). Springer-Verlag, 18–34. https://doi.org/10.1007/11823230_3
- John Harrison. 1997. Floating Point Verification in HOL Light: The Exponential Function. In International Conference on Algebraic Methodology and Software Technology (AMAST), Sydney, Australia (Lecture Notes in Computer Science, Vol. 1349). Springer-Verlag, 246–260. https://doi.org/10.1007/BFB0000475
- John Harrison. 1999. A Machine-Checked Theory of Floating Point Arithmetic. In International Conference on Theorem Proving in Higher Order Logics (TPHOLs), Nice, France (Lecture Notes in Computer Science, Vol. 1690). Springer-Verlag, 113–130. https://doi.org/10.1007/3-540-48256-3_9
- John Harrison. 2000. Formal Verification of Floating Point Trigonometric Functions. In International Conference on Formal Methods in Computer-Aided Design (FMCAD), Austin, Texas (Lecture Notes in Computer Science, Vol. 1954). Springer-Verlag, 217–233. https://doi.org/10.1007/3-540-40922-X_14
- Nicholas J. Higham. 2002. Accuracy and Stability of Numerical Algorithms (2nd ed.). Society for Industrial and Applied Mathematics. https://doi.org/10.1137/1.9780898718027 arXiv:https://epubs.siam.org/doi/pdf/10.1137/1.9780898718027
- Nicholas J. Higham and Theo Mary. 2019. A New Approach to Probabilistic Rounding Error Analysis. SIAM Journal on Scientific Computing 41, 5 (2019), A2815–A2835. https://doi.org/10.1137/18M1226312
- Shin-ya Katsumata. 2014. Parametric effect monads and semantics of effect systems. In ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages (POPL), San Diego, California. 633–646. https://doi.org/10.1145/2535838.2535846
- Ariel E. Kellison and Andrew W. Appel. 2022. Verified Numerical Methods for Ordinary Differential Equations. In International Workshop on Numerical Software Verification (NSV) , Haifa, Israel (Lecture Notes in Computer Science, Vol. 13466). Springer-Verlag, 147–163. https://doi.org/10.1007/978-3-031-21222-2_9
- LAProof: A Library of Formal Proofs of Accuracy and Correctness for Linear Algebra Programs. In IEEE Symposium on Computer Arithmetic (ARITH), Portland, Oregon. 36–43. https://doi.org/10.1109/ARITH58626.2023.00021
- Ariel E. Kellison and Justin Hsu. 2024. Numerical Fuzz: A Type System for Rounding Error Analysis. https://doi.org/10.5281/zenodo.10802849
- Tom Leinster. 2014. Basic Category Theory. Cambridge University Press. https://doi.org/10.1017/CBO9781107360068
- Jay P. Lim and Santosh Nagarakatte. 2022. One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes. Proceedings of the ACM on Programming Languages 6, POPL (2022), 1–28. https://doi.org/10.1145/3498664
- Certified Roundoff Error Bounds Using Semidefinite Programming. ACM Trans. Math. Softw. 43, 4 (2017), 34:1–34:31. https://doi.org/10.1145/3015465
- Matthieu Martel. 2018. Strongly Typed Numerical Computations. In International Conference on Formal Methods and Software Engineering (ICFEM), Gold Coast, Australia (Lecture Notes in Computer Science, Vol. 11232). Springer-Verlag, 197–214. https://doi.org/10.1007/978-3-030-02450-5_12
- Paul S. Miner. 1995. Formal Specification of IEEE Floating-Point Arithmetic Using PVS. In IFAC Workshop on Safety and Reliability in Emerging Control Technologies, Daytona Beach, Florida, Vol. 28. 31–36. https://doi.org/10.1016/S1474-6670(17)44820-8
- Eugenio Moggi. 1991. Notions of Computation and Monads. Inf. Comput. 93, 1 (1991), 55–92. https://doi.org/10.1016/0890-5401(91)90052-4
- Provably Correct Floating-Point Implementation of a Point-in-Polygon Algorithm. In Formal Methods – The Next 30 Years (FM), Porto, Portugal. Springer-Verlag, 21–37. https://doi.org/10.1007/978-3-030-30942-8_3
- F. W. J. Olver. 1978. A New Approach to Error Arithmetic. SIAM J. Numer. Anal. 15, 2 (1978), 368–393. https://doi.org/10.1137/0715024
- Automatically improving accuracy for floating point expressions. (2015), 1–11. https://doi.org/10.1145/2737924.2737959
- A Unified Coq Framework for Verifying C Programs with Floating-Point Computations. In ACM SIGPLAN Conference on Certified Proofs and Programs (CPP), St. Petersburg, Florida. 15–26. https://doi.org/10.1145/2854065.2854066
- Jason Reed and Benjamin C. Pierce. 2010. Distance makes the types grow stronger: a calculus for differential privacy. (2010), 157–168. https://doi.org/10.1145/1863543.1863568
- Stochastic optimization of floating-point programs with tunable precision. (2014), 53–64. https://doi.org/10.1145/2594291.2594302
- Rigorous Estimation of Floating-Point Round-Off Errors with Symbolic Taylor Expansions. ACM Transactions on Programming Languages and Systems 41, 1 (2019), 2:1–2:39. https://doi.org/10.1145/3230733
- Verified Correctness, Accuracy, And Convergence Of a Stationary Iterative Linear Solver: Jacobi Method. In International Conference on Intelligent Computer Mathematics (CICM), Cambridge, UK. Springer-Verlag, 206–221. https://doi.org/10.1007/978-3-031-42753-4_14
- An Abstract Interpretation Framework for the Round-Off Error Analysis of Floating-Point Programs. In International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI), Los Angeles, California (Lecture Notes in Computer Science, Vol. 10747). Springer-Verlag, 516–537. https://doi.org/10.1007/978-3-319-73721-8_24
- Lei Yu. 2013. A Formal Model of IEEE Floating Point Arithmetic. Archive of Formal Proofs (July 2013). https://isa-afp.org/entries/IEEE_Floating_Point.html, Formal proof development.
Collections
Sign up for free to add this paper to one or more collections.