Sequencelib: A Computational Platform for Formalizing the OEIS in Lean

Walter Moreira, Joe Stubbs · 2026

Read Sequencelib: A Computational Platform for Formalizing the OEIS in Lean by Walter Moreira, Joe Stubbs (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-11757.txt.

Introduction

Walter Moreira and Joe Stubbs report a bid to put a famed maths data base into a strict proof tool. The data base is the OEIS, a web list of whole number sequences and linked theorems. It is cited in more than 12,000 works and is a core source in pure maths.

Their project, named Sequencelib in the work, states OEIS maths in Lean. Lean checks each proof step by machine. A checked form would let users trust and reuse those results in new proofs. The work sets out the plan and the form of the new library.

Catalog record

CREATORWalter Moreira, Joe Stubbs
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE38 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-11757

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Sequencelib: A Computational Platform for Formalizing the OEIS in Lean Walter Moreira, Joe Stubbs Abstract The On-Line Encyclopedia of Integer Sequences (OEIS) is a web-accessible database cataloging interesting integer sequences and associated theorems. With more than 12,000 citations, the OEIS is one of the most highly cited resources in all of theoretical mathematics. In this paper, we present Sequencelib, a project to formalize the mathematics contained within the OEIS using the Lean programming language. Sequencelib includes a library of Lean formalizations of OEIS sequences as well as metaprogramming tools for programmatically attaching OEIS metadata to Lean definitions and deriving theorems about their values. Further, we describe OEIS-LT, a highly scalable Lean server that exposes these tools via a low-latency API. Finally, using OEIS-LT and prior work of Gauthier, et al. [ 5 ] , we describe a computational pipeline that formalized more than 25,000 sequences from the OEIS and proved more than 1.6 million theorems about their values. Our method makes use of a transpiler, available in OEIS-LT, that is capable of translating a subset of Standard ML to Lean, together with a set of performance improvement transformations and proofs of correctness. Texas Advanced Computing Center, University of Texas at Austin, Austin TX [email protected]://orcid.org/0000-0003-4830-687X Texas Advanced Computing Center, University of Texas at Austin, Austin TX [email protected]://orcid.org/0000-0002-8644-0300NSF awards #1931439 and #2112606 The authors would like to thank Vijay Ganesh and his students Leyan, Greg, Prithwish, and Congyan (Cruise), for many helpful discussions as part of an ongoing collaboration related to Sequencelib. \lstdefinelanguage lean literate= *ℕ \mathbb{N} 1 → \rightarrow 1 ∀ \forall 1 \lstset language=lean ccs Computing methodologies Theorem proving algorithms keywords Formalization, Lean, Mathematics, Formal Verification, AI † † runningauthor: W. Moreira and J. Stubbs † † copyright: Walter Moreira and Joe Stubbs † † editors: John Q. Open and Joan R. Access † † event-title: 42nd Conference on Very Important Topics (CVIT 2016) † † event-shorttitle: CVIT 2016 † † event-acronym: CVIT † † year: 2016 † † event-date: December 24–27, 2016 † † event-location: Little Whinging, United Kingdom † † series-volume: 42 † † articleno: 23 1 Introduction The On-Line Encyclopedia of Integer Sequences (OEIS) is a web-accessible catalog and search facility for discovering integer sequences. With more than 12,000 citations, the OEIS is one of the most highly cited resources in all of theoretical mathematics. The OEIS contains more than 385,000 sequence definitions, each described in natural language, together with a wealth of metadata about the sequences, including many known values, propositions, conjectures, and relations between them. In this paper, we present Sequencelib, a computational platform to formalize the mathematics contained within the OEIS using the Lean 4 programming language. Formalization of the OEIS would: 1) remove ambiguities from natural language descriptions, both within the sequence definitions themselves and within notes and other metadata describing properties of the sequences; 2) ensure the encyclopedia is free of errors or other inaccuracies; 3) produce formalizations of a rich set of mathematics across a range of areas; 4) serve as a benchmark for evaluating theorem provers and AI tools; and 5) provide a programmable interface to study the OEIS as a whole, including dependencies between sequences. The Sequencelib platform provides a computational ecosystem that supports both human and automated formalization, and a central goal of the project is to facilitate code generation and proof synthesis with AI-based tools. The primary components of Sequencelib are: 1) a library of Lean code containing formalizations of sequence definitions from OEIS and theorems about them; 2) a new Lean tactic and a metaprogramming attribute as well as associated functions for automatically attaching OEIS metadata to Lean function definitions and deriving theorems about their values; 3) an automated build and documentation generator that programmatically collects all sequences and theorems contained within the code library and generates a high-quality, searchable website; and 4) OEIS-LT, a multi-threaded, highly scalable tool server, written in Lean, that can be used by both humans and automated systems to interact with the Sequencelib platform. In subsequent sections, we provide details on the design and implementation of the primary components of the Sequencelib ecosystem. Furthermore, we describe a computational pipeline that leveraged Sequencelib to formalize more than 25,000 OEIS sequence definitions and to prove more than 1.6 million theorems about their values. This pipeline builds on work of Gauthier, et al. [ 5 ] and leverages a transpiler within OEIS-LT that can translate a subset of ML to Lean 4. The pipeline establishes the scalability and effectiveness of the Sequencelib tools. The rest of the paper is organized as follows: Section 2 collects necessary background material and related work; Section 3 provides an overview of Sequencelib and the goals for the project; in Section 4 we describe the design and implementation of Sequencelib’s metaprogramming functions; Section 5 describes the OEIS-LT server and the autoformalization pipeline; in Section we provide an overview of our future plans for the platform before concluding in Section 7 . 2 Background and Related Work In this section we review background material necessary for the rest of the manuscript. 2.1 Interactive Theorem Provers and Lean Interactive Theorem Provers (ITPs), such as Lean [ 17 ] , Isabelle [ 18 ] , and Rocq (formerly named Coq) [ 9 ] , are tools for formalization that combine a programming language that is capable of expressing mathematical statements with tools that enable humans to guide the proof creation process. Based on the Calculus of Inductive Constructions, Lean is capable of expressing theoretical mathematical statements and their proofs. Additionally, Lean can be viewed as a programming language with robust metaprogramming facilities that allow for the automation and extension of Lean itself. Powerful advances in ITPs have led to their increased use in advanced cases of research mathematics, such as the formalization of Polynomial Freiman-Ruzsa (PFR) Conjecture [ 20 ] , Perfectoid spaces [ 1 ] , optimal sphere packing (the E_{8} lattice) [ 22 ] and Fermat’s Last Theorem [ 2 ] . Prominent mathematicians, including a number of Fields Medal winners, such as Peter Sholze, Terrance Tao, and Maryna Viazovska, have strongly advocated for their use. Moreover, a growing number of university math departments are exploring complementing traditional undergraduate curricula with ITP-based content. 2.2 Mathlib Mathlib [ 14 ] , written in the Lean programming language, is one of the fastest growing libraries of formal mathematics. At nearly 2 million lines of code, Mathlib contains a significant portion of advanced mathematics across all major branches, including algebra, analysis, geometry, number theory, and topology. The depth and quality of mathlib qualify it for use in the formalization of research mathematics, and it has been used to that end in many projects, see, e.g., [ 3 , 13 , 7 , 6 ] . The origins of the Sequencelib project began with an effort to contribute to Mathlib a formalization of some results about Sylvester’s sequence, that appeared as an exercise in the textbook “Concrete Mathematics” [ 8 ] . After a discussion with some of the primary Mathlib maintainers, it was decided that the results on Sylvester’s sequence would not be appropriate for inclusion in Mathlib and would better suited in a separate library dedicated to results on mathematical sequences. In

Read the complete text