Pursuit of truth and beauty in Lean 4 : Formally verified theory of grammars, optimization, matroids

Dvorak M. 2026. Pursuit of truth and beauty in Lean 4 : Formally verified theory of grammars, optimization, matroids. Institute of Science and Technology Austria.

Download
OA 2026_Dvorak_Martin_Thesis.pdf 1.77 MB [Published Version]

Thesis | PhD | Published | English
Supervisor
Kolmogorov, VladimirISTA; Blanchette, Jasmin

Corresponding author has ISTA affiliation

Series Title
ISTA Thesis
Abstract
This thesis documents a voyage towards truth and beauty via formal verification of theorems. To this end, we develop libraries in Lean 4 that present definitions and results from diverse areas of MathematiCS (i.e., Mathematics and Computer Science). The aim is to create code that is understandable, believable, useful, and elegant. The code should stand for itself as much as possible without a need for documentation; however, this text redundantly documents our code artifacts and provides additional context that isn’t present in the code. This thesis is written for readers who know Lean 4 but are not familiar with any of the topics presented. We manifest truth and beauty in three formalized areas of MathematiCS. We formalize general grammars in Lean 4 and use grammars to show closure of the class of type-0 languages under four operations; union, reversal, concatenation, and the Kleene star. Our second stop is the theory of optimization. Farkas established that a system of linear inequalities has a solution if and only if we cannot obtain a contradiction by taking a linear combination of the inequalities. We state and formally prove several Farkas-like theorems over linearly ordered fields in Lean 4. Furthermore, we extend duality theory to the case when some coefficients are allowed to take “infinite values”. Additionally, we develop the basics of the theory of optimization in terms of the framework called General-Valued Constraint Satisfaction Problems, and we prove that, if a Rational-Valued Constraint Satisfaction Problem template has symmetric fractional polymorphisms of all arities, then its basic LP relaxation is tight. Our third stop is matroid theory. Seymour’s decomposition theorem is a hallmark result in matroid theory, presenting a structural characterization of the class of regular matroids. We aim to formally verify Seymour’s theorem in Lean 4. First, we build a library for working with totally unimodular matrices. We define binary matroids and their standard representations, and we prove that they form a matroid in the sense how Mathlib defines matroids. We define regular matroids to be matroids for which there exists a full representation rational matrix that is totally unimodular, and we prove that all regular matroids are binary. We define 1-sum, 2-sum, and 3 sum of binary matroids as specific ways to compose their standard representation matrices. We prove that the 1-sum, the 2-sum, and the 3-sum of regular matroids are a regular matroid, which concludes the composition direction of the Seymour’s theorem. The (more difficult) decomposition direction remains unproved. In the pursuit of truth, we focus on identifying the trusted code in each project and presenting it faithfully. We emphasize the readability and believability of definitions rather than choosing definitions that are easier to work with. In search for beauty, we focus on the philosophical framework of Roger Scruton, who emphasizes that beauty is not a mere decoration but, most importantly, beauty is the means for shaping our place in the world and a source of redemption, where it can be viewed as a substitute for religion.
Publishing Year
Date Published
2026-03-04
Publisher
Institute of Science and Technology Austria
Page
160
ISSN
IST-REx-ID

Cite this

Dvorak M. Pursuit of truth and beauty in Lean 4 : Formally verified theory of grammars, optimization, matroids. 2026. doi:10.15479/AT-ISTA-21393
Dvorak, M. (2026). Pursuit of truth and beauty in Lean 4 : Formally verified theory of grammars, optimization, matroids. Institute of Science and Technology Austria. https://doi.org/10.15479/AT-ISTA-21393
Dvorak, Martin. “Pursuit of Truth and Beauty in Lean 4 : Formally Verified Theory of Grammars, Optimization, Matroids.” Institute of Science and Technology Austria, 2026. https://doi.org/10.15479/AT-ISTA-21393.
M. Dvorak, “Pursuit of truth and beauty in Lean 4 : Formally verified theory of grammars, optimization, matroids,” Institute of Science and Technology Austria, 2026.
Dvorak M. 2026. Pursuit of truth and beauty in Lean 4 : Formally verified theory of grammars, optimization, matroids. Institute of Science and Technology Austria.
Dvorak, Martin. Pursuit of Truth and Beauty in Lean 4 : Formally Verified Theory of Grammars, Optimization, Matroids. Institute of Science and Technology Austria, 2026, doi:10.15479/AT-ISTA-21393.
All files available under the following license(s):
Creative Commons Attribution 4.0 International Public License (CC-BY 4.0):
Main File(s)
Access Level
OA Open Access
Date Uploaded
2026-03-04
MD5 Checksum
cface6dc18152680962b5361575f6e4f

Source File
Access Level
Restricted Closed Access
Date Uploaded
2026-03-04
MD5 Checksum
290ddfacfb7e07fb07e6f0b334e67c90

Software:
Description
Full version of all definitions, statements, and proofs for Chapter 3.1 (Linear duality)
Description
Full version of all definitions, statements, and proofs for Chapter 3.2 (Valued Constraint Satisfaction Problems)
Description
Full version of all definitions, statements, and proofs for Chapter 4 (Seymour project)
Description
Full version of all definitions, statements, and proofs for Chapter 5 (Theory of grammars)
Description
Old version (Lean 3) of the project about grammars
Description
Demonstration of (minimal) requirements for selected algebraic classes used in my Ph.D. thesis

Export

Marked Publications

Open Data ISTA Research Explorer

Search this title in

Google Scholar
ISBN Search