Abstract
This paper describes the formalization of the prime number theorem with a remainder term in the Isabelle/HOL proof assistant. First, we formalized several lemmas in complex analysis that were not available in the library, such as the Borel–Carathéodory theorem and the factorization of an analytic function on a compact region. Then, we use these results to formalize a zero-free region of the Riemann zeta function with an explicitly computed constant and deduce the asymptotic growth order of \(\zeta '(s) / \zeta (s)\) near \(\textrm{Re}(s) = 1\). Finally, using a specific form of Perron’s formula, we prove the prime number theorem with the classical remainder term, expressed in terms of \(\psi (x)\). We also formalized the result that the prime number theorem stated using \(\psi (x)\) can imply the version stated using \(\pi (x)\). Thus, we can achieve the main result of this paper. Our work extensively utilizes the rich libraries of complex analysis and asymptotic analysis in Isabelle/HOL, including concepts such as the winding number, the residue theorem, and proof automation tools such as the
tactic. This is why we chose Isabelle to formalize analytic number theory instead of using other interactive provers.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Code availability
We have submitted our work as an AFP entry, which can be accessed at https://www.isa-afp.org/entries/PNT_with_Remainder.html. During the writing process of this paper, we updated some proofs, and this paper corresponds to the code available at https://foss.heptapod.net/isa-afp/afp-devel/-/tree/b3a92193767da553cf83b4399d701d85ea719e2a/thys/PNT_with_Remainder.
Notes
Lemma
in the AFP entry
.
References
Avigad, J., Donnelly, K., Gray, D., Raff, P.: A formally verified proof of the prime number theorem. ACM Trans. Comput. Log. 9(1), 2 (2007). https://doi.org/10.1145/1297658.1297660
Bartle, R.: A Modern Theory of Integration (2001). https://doi.org/10.1090/gsm/032
Carneiro, M.M.: Formalization of the prime number theorem and Dirichlet’s theorem. In: FM4M/MathUI/ThEdu/DP/WIP@CIKM, 2016 (2016). https://api.semanticscholar.org/CorpusID:14038947
Eberl, M., Paulson, L.C.: The prime number theorem. Archive of Formal Proofs (Formal proof development) (2018). https://isa-afp.org/entries/Prime_Number_Theorem.html
Eberl, M.: Nine chapters of analytic number theory in Isabelle/HOL. In: Harrison, J., O’Leary, J., Tolmach, A. (eds.) 10th International Conference on Interactive Theorem Proving (ITP 2019). Leibniz International Proceedings in Informatics (LIPIcs), 2019, vol. 141, pp. 16-11619. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl (2019). https://doi.org/10.4230/LIPIcs.ITP.2019.16
Eberl, M.: Verified real asymptotics in Isabelle/HOL. In: Proceedings of the International Symposium on Symbolic and Algebraic Computation. ISSAC ’19, 2019. ACM, New York (2019). https://doi.org/10.1145/3326229.3326240
Eberl, M.: The Hurwitz and Riemann \(\zeta \) functions. Archive of Formal Proofs (Formal proof development) (2017). https://isa-afp.org/entries/Zeta_Function.html
Freek, W.: Formalizing 100 Theorems. https://www.cs.ru.nl/%7efreek/100/
Gordon, R.A.: The Integrals of Lebesgue, Denjoy, Perron, and Henstock (1994). https://doi.org/10.1090/gsm/004
Harrison, J.: Formalizing an analytic proof of the prime number theorem. J. Autom. Reason. 43, 243–261 (2009). https://doi.org/10.1007/s10817-009-9145-6
Harrison, J.: A formalized proof of Dirichlet’s theorem on primes in arithmetic progression. J. Formaliz. Reason. 2, 63–83 (2010). https://doi.org/10.6092/issn.1972-5787/1558
Ingham, A.E.: The Distribution of Prime Numbers, vol. 30. Cambridge University Press, Cambridge (1990). https://doi.org/10.2307/3606518
Korobov, N.M.: Estimates of trigonometric sums and their applications. Uspekhi Mat. Nauk 13, 185–192 (1958)
Li, W., Paulson, L.C.: Evaluating winding numbers and counting complex roots through Cauchy indices in Isabelle/HOL. J. Autom. Reason. 64(2), 331–360 (2020). https://doi.org/10.1007/s10817-019-09521-3
Li, W., Paulson, L.C.: A formal proof of Cauchy’s residue theorem. In: Blanchette, J.C., Merz, S. (eds.) Interactive Theorem Proving, pp. 235–251. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-43144-4_15
Liu, J., Ye, Y.: Perron’s formula and the prime number theorem for automorphic L-functions. Pure Appl. Math. Q. 3, 481–497 (2007). https://doi.org/10.4310/PAMQ.2007.V3.N2.A4
Lu, W.C.: On the elementary proof of the prime number theorem with a remainder term. Rocky Mt. J. Math. 29(3), 979–1053 (1999). https://doi.org/10.1216/rmjm/1181071619
Mossinghoff, M.J., Trudgian, T.S., Yang, A.: Explicit zero-free regions for the Riemann zeta-function. Res. Number Theory 10(1), 11 (2024). https://doi.org/10.1007/s40993-023-00498-y
Mossinghoff, M.J., Trudgian, T.S.: Nonnegative trigonometric polynomials and a zero-free region for the Riemann zeta-function. J. Number Theory 157, 329–349 (2015). https://doi.org/10.1016/j.jnt.2015.05.010
Schoenfeld, L.: Sharper bounds for the Chebyshev functions \(\theta (x)\) and \(\psi (x).\) II. Math. Comput. 30, 337–360 (1976). https://doi.org/10.1090/S0025-5718-1976-0457374-X
Stein, E., Shakarchi, R.: Complex Analysis. Princeton University Press, Princeton (2003)
Tenenbaum, G.: Introduction to Analytic and Probabilistic Number Theory, vol. 163. American Mathematical Society, Providence (2015). https://doi.org/10.1090/gsm/163
Titchmarsh, E.C., Heath-Brown, D.R.: The Theory of the Riemann Zeta-function. Oxford University Press, Oxford (1986)
Titchmarsh, E.C.: The Theory of Functions. Oxford University, Oxford (1964)
Vinogradov, I.M.: A new estimate of the function \(\zeta (1+it)\). Izv. Akad. Nauk SSSR Ser. Mat. 22, 161–164 (1958)
Zagier, D.: Newman’s short proof of the prime number theorem. Am. Math. Mon. 104, 705–708 (1997). https://doi.org/10.1080/00029890.1997.11990704
Acknowledgements
We extend our heartfelt gratitude to Manuel Eberl for his invaluable assistance in adapting our code for acceptance as an AFP entry. He meticulously reviewed our formalization code, offering numerous suggestions on code style and intricate proof details.
The authors were partially supported by BUCTRC Grant #202145.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors have no relevant financial or non-financial interests to disclose.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Song, S., Yao, B. Formalization of the Prime Number Theorem with a Remainder Term. J Autom Reasoning 69, 4 (2025). https://doi.org/10.1007/s10817-025-09718-9
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10817-025-09718-9