Formalizing the Real Numbers in Homotopy Type Theory with Cubical Agda
This paper presents a formalization of the Homotopy Type Theory construction of Cauchy real numbers in Cubical Agda, demonstrating that this approach avoids the countable choice, setoid overhead, and universe-level tracking issues inherent in other constructive definitions while type-checking without postulates.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to build a perfect, infinite ruler to measure everything in the universe. In the world of classical math, this ruler is easy to describe: you just take all the possible "approximate" measurements (like 3.1, 3.14, 3.141, etc.) and say, "If two sequences of measurements get closer and closer together, they represent the same point on the ruler."
However, in Constructive Mathematics—a style of math that insists you must be able to actually build or compute the thing you are talking about—this simple approach hits a wall. To prove that your ruler is complete, you have to make a magical choice: you have to pick one specific measurement from an infinite list of options to represent the final point. Constructive math says, "No magic allowed. If you can't show me how you picked it, you haven't built the ruler yet."
For decades, mathematicians had to compromise. They either used "bookkeeping" tricks that made every calculation messy, or they built the ruler in a way that required tracking complex "universe levels" (like keeping score of how big your boxes are).
The New Blueprint (HoTT Book Reals)
This thesis presents a new blueprint for building the ruler, taken from the famous Homotopy Type Theory (HoTT) book. Instead of building the ruler by gluing pieces together and then trying to smooth them out, this method builds the ruler and the "smoothness" rules simultaneously.
Think of it like building a house where the walls and the blueprint are being drawn at the exact same time.
- The Bricks: You start with simple, known numbers (like fractions).
- The Glue: You add a special rule that says, "If two points are close enough, they are actually the same point."
- The Magic: Because the "closeness" rule is built into the definition of the house itself, you don't need to make those magical choices later. The house is complete the moment you finish laying the bricks.
The Challenge: The Computer Translator
The author, Jackson Brough, took this theoretical blueprint and tried to translate it into a language a computer can understand and verify: Cubical Agda.
Imagine trying to explain a complex dance routine to a robot that only understands strict, literal instructions.
- The Problem: Previous attempts to translate this blueprint failed because the computer language didn't have the right "moves" (specifically, it couldn't handle the simultaneous definition of the ruler and the closeness rules). The translators had to say, "Assume this move exists," which is cheating in math.
- The Solution: Cubical Agda is a newer, smarter robot that natively understands these complex moves. It allows the author to write the blueprint exactly as it was designed, without cheating.
What Happened During the Translation?
The thesis isn't just about typing code; it's about what happened when the author tried to make the computer understand the math. The computer's strictness forced the author to find hidden gaps in the original explanation:
- The "Alternative" Map: The original book described how to check if two points are close. But when the author tried to write the code, they realized the book's method was like a "one-way street." You could prove points were close, but you couldn't easily work backward to see why. The author had to build a second, "computational" map (called an alternative relation) that acts like a reverse gear, allowing the computer to actually calculate the answer.
- The Missing Ingredient: The book described a rule for building functions (like multiplication) as if the computer could "remember" the original list of approximations. The author's first code version forgot this memory. The computer rejected it. The author had to rewrite the rule to explicitly carry the memory along, realizing the original text had been too vague for a machine.
- The Multi-Variable Puzzle: The book hinted that rules for single numbers could easily be applied to pairs or triplets of numbers. The computer wasn't convinced. The author had to prove a new, specific lemma showing that if a rule works for one variable, it works for two, provided you check them one at a time.
The Result
The final product is a massive, open-source library of code (over 13,000 lines) that proves the HoTT book reals work perfectly.
- It proves that these numbers form a complete, ordered field (you can add, subtract, multiply, divide, and compare them).
- It proves that the ruler is "Archimedean" (meaning no matter how small a gap you have, you can always find a fraction to fit inside it).
- Most importantly, it does all this without cheating. The computer checked every single step, and the code runs without any "magic assumptions."
In Summary
This thesis is the story of taking a beautiful, high-level mathematical idea and forcing it to survive the rigorous, literal world of computer verification. By doing so, the author didn't just build a digital ruler; they polished the blueprint itself, revealing hidden details and making the theory stronger and more precise than it was before. The code is now available for anyone to use as a solid foundation for future mathematical discoveries.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.