Hostname: page-component-5d59c44645-mhl4m Total loading time: 0 Render date: 2024-03-01T16:11:35.860Z Has data issue: false hasContentIssue false

A monadic, functional implementation of real numbers

Published online by Cambridge University Press:  01 February 2007

Institute for Computing and Information Science, Faculty of Science, Radboud UniversityNijmegen Email:


Large scale real number computation is an essential ingredient in several modern mathematical proofs. Because such lengthy computations cannot be verified by hand, some mathematicians want to use software proof assistants to verify the correctness of these proofs. This paper develops a new implementation of the constructive real numbers and elementary functions for such proofs by using the monad properties of the completion operation on metric spaces. Bishop and Bridges's notion (Bishop and Bridges 1985) of regular sequences is generalised to what I call regular functions, which form the completion of any metric space. Using the monad operations, continuous functions on length spaces (which are a common subclass of metric spaces) are created by lifting continuous functions on the original space. A prototype Haskell implementation has been created. I believe that this approach yields a real number library that is reasonably efficient for computation, and still simple enough to verify its correctness easily.

Copyright © Cambridge University Press 2007

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)


Bishop, E. and Bridges, D. (1985) Constructive Analysis. Grundlehren der mathematischen Wissenschaften 279, Springer-VerlagGoogle Scholar
Boehm, H.-J., Cartwright, R., Riggle, M. and O'Donnell, M. J. (1986) Exact real arithmetic: a case study in higher order programming. In: LFP '86: Proceedings of the 1986 ACM conference on LISP and functional programming, ACM Press 162173.Google Scholar
Burago, D., Burago, Y. and Ivanov, S. (2001) A Course in Metric Geometry, Graduate Studies in Mathematics 33, American Mathematical Society.Google Scholar
Cruz-Filipe, L. (2003) A constructive formalization of the fundamental theorem of calculus. In: Geuvers, H. and Wiedijk, F. (eds.) Types for Proofs and Programs. Springer-Verlag Lecture Notes in Computer Science 2646 108126.Google Scholar
Cruz-Filipe, L. and Spitters, B. (2003) Program extraction from large proof developments. In: Basin, D. and Wolff, B. (eds.) Theorem Proving in Higher Order Logics, 16th International Conference, TPHOLs 2003. Springer-Verlag Lecture Notes in Computer Science 2758205220.Google Scholar
Hales, T. C. (2002) A computer verification of the Kepler conjecture. In: Proceedings of the International Congress of Mathematicians, Beijing, 2002, Volume III, Higher Ed. Press 795804.Google Scholar
Kurzweg, U. H. (2001) Pi. (Available at Scholar
Lester, D. (2003) Using PVS to validate the inverse trigonometric functions of an exact arithmetic. In: Alt, R., Frommer, A., Kearfott, R. B. and Luther, W. (eds.) Numerical Software with Result Verification. Springer-Verlag Lecture Notes in Computer Science 2991259273.Google Scholar
Lester, D. and Gowland, P. (2002) Using PVS to validate the algorithms of an exact arithmetic. Theoretical Computer Science 291 (2)203218.Google Scholar
Moggi, E. (1991) Notions of computation and monads. Information and Computation 93 (1)5592.Google Scholar
Muñoz, C. and Lester, D. (2005) Real number calculations and theorem proving. In: Hurd, J. and Melham, T. (eds.) Proceedings of the 18th International Conference on Theorem Proving in Higher Order Logics, TPHOLs 2005. Springer-Verlag Lecture Notes in Computer Science 3603195210.Google Scholar
Niqui, M. and Wiedijk, F. (2005) The ‘many digits’ friendly competition 2005. (Details at Scholar
O'Connor, R. (2005) Few digits 0.4.0. (Available at Scholar
Odlyzko, A. M. and te Riele, H. J. J. (1985) Disproof of the Mertens conjecture. J. Reine Angew. Math. 357 138160.Google Scholar
Peyton Jones, S. (ed.) (2003) Haskell 98 Language and Libraries: The Revised Report, Cambridge University Press.Google Scholar
The Coq development team (2004) The Coq proof assistant reference manual, Version 8.0, LogiCal Project.Google Scholar
Wadler, P. (1992) Monads for functional programming. In: Proceedings of the Marktoberdorf Summer School on Program Design Calculi.Google Scholar