mortarsanjaya/IMOSLLean4

Formalization of IMO shortlist problems in Lean 4

Lean

26

691 commits

updated Sep 18, 2026

See the code

README

IMOSLLean4

Formalization of IMO Shortlist Problems in Lean 4.

This repository stores formalization of IMO Shortlist problems from 2006 onwards in Lean 4. It mainly covers problems in the Algebra and Number Theory category, with some problems in the Combinatorics category included as well. All problems formalized here include their complete solutions.

Aside from formalizing the IMO Shortlist problems, this repository also formalizes attempts to generalize a few of these problems. For example, after rephrasing, the IMO Shortlist 2012 N8 problem reads as follows.

For any prime power $q$, let $\mathbb{F}_q$ be the finite field of $q$ elements. Prove that for every prime $p > 100$ and for every $r \in \mathbb{F}_p$, there exist two elements $a, b \in \mathbb{F}_p$ such that $a^2 + b^5 = r$.

Then we prove more:

For any finite field $F$ of cardinality not equal to $11$ and for every $r \in F$, there exist two elements $a, b \in F$ such that $a^2 + b^5 = r$ (and that this fails for cardinality $11$).

Installation and Dependencies

Please follow the instructions at https://leanprover-community.github.io/install/project.html about working on an existing project.

This project depends on Mathlib4 and is currently using version 4.35.0-rc2.

Documentation

The documentation of this project is available on this webpage. This documentation is built using doc-gen4.

The folder IMOSLLean4/Main contains the formalization of the IMO Shortlist problems. The files here are organized by year. The formalization of the main statement to be proved is named final_solution. If there are multiple parts to the problem, then part 1 is named final_solution_part1, part 2 is named final_solution_part2, and so on.

Meanwhile, the folder IMOSLLean4/Generalization contains formalization of generalized versions of some IMO Shortlist problems, such as the aforementioned IMO Shortlist 2012 N8 problem. The files here are organized by the problem they generalize.

Contributing

Thank you for your interest in contributing to this project! This repository is a personal project, so currently I am not looking for external contributions. That being said, feel free to fork this repository for your needs.

Progress

Below are some statistics on the number of problems formalized in this repository as of September 18, 2026. Here, "A" stands for Algebra, "C" stands for Combinatorics, and "N" stands for Number Theory.

YearNumber of problems
FormalizedAll
ACNTotalACNTotal
20064061067720
20075151178722
20085321076619
20097461778722
2010513987621
20116041077822
20124251177822
2013204668721
2014323869823
2015304767821
2016412788824
20177131188824
2018114677721
2019213679824
2020303688723
20216221088824
2022322789825
2023306977822
2024214788723
2025102388824
Total762273171144154149447

Contributors

mortarsanjaya

691 commits

mortarsanjaya/IMOSLLean4

Formalization of IMO shortlist problems in Lean 4

Lean

26

691 commits

updated Sep 18, 2026

See the code

README

IMOSLLean4

Formalization of IMO Shortlist Problems in Lean 4.

This repository stores formalization of IMO Shortlist problems from 2006 onwards in Lean 4. It mainly covers problems in the Algebra and Number Theory category, with some problems in the Combinatorics category included as well. All problems formalized here include their complete solutions.

Aside from formalizing the IMO Shortlist problems, this repository also formalizes attempts to generalize a few of these problems. For example, after rephrasing, the IMO Shortlist 2012 N8 problem reads as follows.

For any prime power $q$, let $\mathbb{F}_q$ be the finite field of $q$ elements. Prove that for every prime $p > 100$ and for every $r \in \mathbb{F}_p$, there exist two elements $a, b \in \mathbb{F}_p$ such that $a^2 + b^5 = r$.

Then we prove more:

For any finite field $F$ of cardinality not equal to $11$ and for every $r \in F$, there exist two elements $a, b \in F$ such that $a^2 + b^5 = r$ (and that this fails for cardinality $11$).

Installation and Dependencies

Please follow the instructions at https://leanprover-community.github.io/install/project.html about working on an existing project.

This project depends on Mathlib4 and is currently using version 4.35.0-rc2.

Documentation

The documentation of this project is available on this webpage. This documentation is built using doc-gen4.

The folder IMOSLLean4/Main contains the formalization of the IMO Shortlist problems. The files here are organized by year. The formalization of the main statement to be proved is named final_solution. If there are multiple parts to the problem, then part 1 is named final_solution_part1, part 2 is named final_solution_part2, and so on.

Meanwhile, the folder IMOSLLean4/Generalization contains formalization of generalized versions of some IMO Shortlist problems, such as the aforementioned IMO Shortlist 2012 N8 problem. The files here are organized by the problem they generalize.

Contributing

Thank you for your interest in contributing to this project! This repository is a personal project, so currently I am not looking for external contributions. That being said, feel free to fork this repository for your needs.

Progress

Below are some statistics on the number of problems formalized in this repository as of September 18, 2026. Here, "A" stands for Algebra, "C" stands for Combinatorics, and "N" stands for Number Theory.

YearNumber of problems
FormalizedAll
ACNTotalACNTotal
20064061067720
20075151178722
20085321076619
20097461778722
2010513987621
20116041077822
20124251177822
2013204668721
2014323869823
2015304767821
2016412788824
20177131188824
2018114677721
2019213679824
2020303688723
20216221088824
2022322789825
2023306977822
2024214788723
2025102388824
Total762273171144154149447

Contributors

mortarsanjaya

691 commits

Languages

Lean

87.8%

TeX

12.2%