General Information
Project Description
There is a growing effort to formalise mathematical knowledge in modern proof assistants,
with Lean and the mathlib library
playing a central role in recent progress across various areas of mathematics.
Most areas of undergraduate mathematics are already covered well.
However, graph theory is a subject which is still relatively underdeveloped in mathlib,
with there being key concepts still missing. In this project, we aim to fill in some of those gaps
while extending the framework already estabilished in the library, and see what challenges we encounter.
Research Log
Week 1
- I safely arrived and was accomodated
- We had some online meetings with my mentor and discussed Lean itself and the project direction
- To get a start on how graph theory is done in Lean, I studied Bhavik Mehta's
lecture notes
and played around with the API, constructing some graphs and proving simple lemmas
- I looked around mathlib to see the different approaches to formalising graphs that people used,
and also how much of the theory has already been done
- As an exercise, I formalised one of the characterisations of trees (which is already in mathlib) from the ground up;
it took me over a day (my initial approach proved too cumbersome)
Week 2
- I learnt how to make interactive slides in Lean using Verso and explored the different functionalities.
While not directly tied to research, I believe that this sort of promotion is also important.
I then successfully delivered my initial presentation
- I started this webpage. The intention was to do so in Lean, but it seems that it would take some effort,
and I would rather focus on research now, so I simply used a template from past REUs
- I found some more lecture notes
and worked through them, trying out different aspects of the theory. In the course of fixing them, I learnt a bit about how decidability is handled in Lean
- I formalised a very simple result not yet in mathlib: that path graphs are acyclic. My proof ended up being much longer than I had expected,
but I suppose such is the nature of doing things very rigorously
- I set up a GitHub repository for my Lean projects
- As mathlib was being updated, I had some problems with incompatible versions (some of my previous proofs also stopped working),
but at least I learnt something about the Lake package manager
- I looked around the Lean Zulip chat to see what topics people are actively working on
Week 3
- I proved the fact that path graphs are acyclic in three more ways, getting experience with various parts of the library
and proving tactics in general; my last proof was already mere 12 lines, a tenfold improvement
(and I believe that my style improved as well)
- In the process of trying out various things, I noted some gaps in the framework that was already developed;
it is my belief that something simple to prove in natural language should be reasonable to prove formally, too,
provided the right tools, so I would like to work towards amending that
- I wrote up my a little survey
detailing my impression of graph theory in Lean so far (what has been done and how, what has not, and the technical struggles one encounters)
- My mentor organised a meeting with other people interested in / working on Lean-related projects, and we all discussed our experiences,
findings, interests, potential collaboration and about Lean in general
- I started writing up the definitions and lemmas I found to be missing with the goal of meeting the library's standards of quality
and potentially contributing. The process of pondering the (dis)advanages of different definitions, structuring everything nicely and
integrating my additions with the existing theory was instructive in its own right
Week 4
- I finished writing up and polishing my first ideas for contribution. In total, it wound up being 38 definitions/lemmas, covering the following:
- creating API to delete an edge from a loop walk to get the remaining walk and relating it to the existing theory
(due to the way walks are implemented, this was very difficult before);
- linearly orderable graphs are acyclic, and a discrete form of the intermediate value theorem for them;
- a graph is a tree iff it is a tree when one deletes a leaf (to that end, some lemmas about inducing walks to induced subgraphs);
- disjoint union of acyclic graphs is acyclic.
- I reached out to the community. Unfortunately, no one responded to my question about suggestions what larger project to do...
Also, it turned out that I had underestimated the state of the art a bit; a lot more theory was scattered around different pull requests
not yet ready to merge. Nevertheless, some of my lemmas were genuinely new contributions
- I opened pull requests to make my first contributions. One of them was quickly picked up and the reviewer had some helpful advice
Week 5
- I pondered different options of what larger problem to tackle. In the end, I decided to formalise planar graphs
- I studied the previous discussions on how to formalise planarity. I found that the existing proposals, while elegant,
are not that practical to actually work with, so I opted to it my way (at the cost of some generality): in terms of rotation systems
and Euler§s formula (based on literature on the subject)
- I started building the API, supplying some lemmas about permutations I needed.
Week 6
- I made great progress with my project. I wanted to lay the groundwork for proving the constructive part of Kuratowski's theorem,
an environment where working with planarity would be as practical as possible. However, I realised that many times, one has to work with
multiple graphs in the same context (for example when two graphs share a vertex). Due to the nature of formalisation, this resulted in the need
of frequent annoying coercions. For this reason, I made the decision to build the whole theory for subgraphs instead, where everything lives
in a large underlying graph and all the objects exist on the same level.
- I also tranfered some of the theory about connectedness to the subgraph API and proved a description of the connected components
of a disjoint union of two graphs (a new result).
- I made sure the Euler formula definition is computable given the right assumptions (among others computably proving finiteness of the
number of faces etc.)
- I met with my mentor in person and we had a nice lengthy discussion
- We had a visit by another REU and I gave a talk about my research
Output
Acknowledgements
This work was carried out while I was a participant in the 2026 DIMACS REU programme at Rutgers University, CCF-2447342.
I was also supported by: