A Mechanical Proof of Stirling's Approximation in ACL2(r)
Stirling's approximation to the factorial function is used extensively in science, appearing, for example, in thermal physics, where it is used to calculate entropy. It is also relevant to computer science, where it can be used to estimate the log of the factorial function, resulting in the familiar O(n ln n) bound for sorting. This paper describes a formalization in ACL2(r) of Stirling's approximation to the factorial function and its logarithm. Following the original mathematical derivation, the proofs proceed by first showing that Stirling's formula is correct up to a constant factor, then showing what the value of the constant must be. Along the way, an important equation due to Wallis is needed. This equation is especially significant to the ACL2 community, since its proof relies heavily on induction. The proof of Stirling's theorem and Wallis's formula also rely on the calculation of many integrals and the principle of integration by parts. As such, this formal proof serves both to validate ACL2(r)'s theory of integration, and to suggest some possible improvements.
Authors
- Ruben A. Gamboa (ORCID: https://orcid.org/0000-0003-3146-584X)
Institutions
- University of Wyoming (US)
- Kestrel Institute (US)
Publication Details
- Journal
- Electronic Proceedings in Theoretical Computer Science
- Published
- 2026-12-02
- DOI
- https://doi.org/10.4204/eptcs.459.1
- Citations
- 1
- Primary Topic
- Logic, programming, and type systems
- Type
- article
- Field-Weighted Citation Impact
- 1.95