This document provides guidelines for AI agents working on the Formal Conjectures repository.
-
FormalConjectures/: Contains formalisations of conjectures, organized by source:ErdosProblems/- Problems from erdosproblems.comPaper/- Problems from research papersArxiv/- Problems from arXiv papers (organized by arXiv ID)Books/- Problems from mathematics booksWikipedia/- Problems from WikipediaOptimizationConstants/- Problems from Tao's Optimization Constants- Other sources as appropriate
IMPORTANT: Some subdirectories contain their own
README.mdwith more specific conventions (e.g. naming, docstring, and reference rules). Always check for and follow a subdirectory'sREADME.mdbefore applying the general guidelines below. For example,FormalConjectures/ErdosProblems/README.mddefines naming patterns for multi-part questions, estimate questions, and variants that supplement the general conventions in this file. -
FormalConjectures/Util/: Repository infrastructure and utilities:Attributes/- Defines thecategoryandAMSattributesAnswer.lean- Implements theanswer()elaborator for problems requiring answersLinters/- Custom linters for the repositoryProblemImports.lean- Standard imports for problem files
-
FormalConjecturesForMathlib/: Definitions, lemmas, and basic API suitable for upstreaming to Mathlib:- IMPORTANT: No
sorryis allowed in this directory - Follows Mathlib's directory structure (e.g.,
Topology/,Algebra/,NumberTheory/) - Contains supporting definitions and lemmas needed for problem statements
- Code here should be of Mathlib quality and eventually PR-able to Mathlib
- IMPORTANT: No
Each problem file should define its content in a dedicated namespace:
namespace Erdos10
-- definitions, theorems, variants here
end Erdos10For variants of a problem, use dotted notation within the same namespace:
theorem main_conjecture : ... := by
sorry
theorem main_conjecture.variants.special_case : ... := by
sorryEvery theorem/lemma should have exactly one category attribute indicating its type:
Values:
@[category textbook]- Textbook level math problem (high school, undergraduate, or graduate)@[category research open]- Open research problem (no accepted solution exists)@[category research solved]- Solved research problem (informal proof widely accepted)@[category test]- Sanity check or unit test for definitions@[category API]- Basic theory around a new definition
Examples:
@[category research open, AMS 11]
theorem riemann_hypothesis : ... := by
sorry
@[category test, AMS 11]
theorem sanity_check : ¬ SomeBadProperty := by
sorry
@[category API]
lemma basic_property_of_new_definition : ... := by exact ...The formal_proof attribute records the existence and location of a formal proof.
It is independent of the category attribute and can be used with any category.
Values:
@[formal_proof using formal_conjectures at "link"]- Formally proved in this repository@[formal_proof using lean4 at "link"]- Formally proved in Lean 4 elsewhere@[formal_proof using other_system at "link"]- Formally proved in another system (Roqc, Isabelle, Lean 3, HOL, etc.)
Examples:
@[category research solved, AMS 11, formal_proof using lean4 at "https://github.com/example"]
theorem some_solved_problem : ... := by
sorry
@[category textbook, AMS 11, formal_proof using formal_conjectures at "https://..."]
theorem a_textbook_problem_with_proof : ... := by
sorryNote: A formal_proof annotation on a research open problem will trigger a lint warning,
since open problems should not have proofs.
Every problem should have at least one AMS subject classification number from the AMS MSC2020.
Common subjects:
3- Mathematical logic and foundations5- Combinatorics11- Number theory14- Algebraic geometry54- General topology60- Probability theory
Multiple subjects can be specified:
@[AMS 5 11] -- Both combinatorics and number theory
theorem erdos_problem : ... := by
sorryIn VS Code: Use #AMS command to list all available subjects and their numbers. Hover over a number to see its description.
Full list of AMS subjects
| Code | Name | Keywords |
|---|---|---|
| 00 | General and overarching topics | general |
| 03 | Mathematical logic and foundations | logic, set theory, model theory |
| 05 | Combinatorics | combinatorics, graph theory, enumeration |
| 06 | Order | order, lattice, poset, partial order |
| 08 | General algebraic systems | universal algebra, algebraic system |
| 11 | Number theory | number theory, prime, arithmetic, diophantine |
| 12 | Field theory and polynomials | field, polynomial, galois |
| 13 | Commutative algebra | commutative, ring, ideal, module |
| 14 | Algebraic geometry | algebraic geometry, variety, scheme |
| 15 | Linear algebra | linear algebra, matrix, vector |
| 16 | Associative rings and algebras | associative, ring, algebra |
| 17 | Nonassociative rings and algebras | lie algebra, jordan |
| 18 | Category theory; homological algebra | category, functor, homological |
| 19 | K-theory | k-theory |
| 20 | Group theory and generalizations | group, finite group, representation |
| 22 | Topological groups + Lie groups | topological group, lie group |
| 26 | Real functions | real analysis, real function, derivative |
| 28 | Measure and integration | measure, integration, lebesgue |
| 30 | Functions of a complex variable | complex analysis, holomorphic, analytic |
| 31 | Potential theory | potential, harmonic function, subharmonic |
| 32 | Complex analysis | several complex variables, complex manifold |
| 33 | Special functions | special function, gamma, zeta, bessel |
| 34 | Ordinary differential equations | ode, differential equation |
| 35 | Partial differential equations | pde, partial differential |
| 37 | Dynamical systems and ergodic theory | dynamical, ergodic, chaos |
| 39 | Difference and functional equations | difference equation, functional equation |
| 40 | Sequences + series + summability | sequence, series, convergence |
| 41 | Approximations and expansions | approximation, expansion, interpolation |
| 42 | Harmonic analysis on Euclidean spaces | harmonic analysis, fourier |
| 43 | Abstract harmonic analysis | abstract harmonic |
| 44 | Integral transforms + operational calculus | integral transform, laplace |
| 45 | Integral equations | integral equation |
| 46 | Functional analysis | functional analysis, banach, hilbert |
| 47 | Operator theory | operator, spectral |
| 49 | Calc. of vars. and opt. ctrl.; optimiz. | calculus of variations, optimal control |
| 51 | Geometry | geometry, euclidean, projective |
| 52 | Convex and discrete geometry | convex, polytope, discrete geometry |
| 53 | Differential geometry | differential geometry, manifold, riemannian |
| 54 | General topology | topology, topological space, compact |
| 55 | Algebraic topology | algebraic topology, homotopy, homology |
| 57 | Manifolds and cell complexes | manifold, cell complex |
| 58 | Global analysis + analysis on manifolds | global analysis |
| 60 | Probability theory | probability, stochastic, random |
| 62 | Statistics | statistics, estimation, hypothesis |
| 65 | Numerical analysis | numerical, approximation, algorithm |
| 68 | Computer science | computer science, complexity, algorithm |
| 70 | Mechanics of particles and systems | mechanics, particle, celestial |
| 74 | Mechanics of deformable solids | elasticity, solid mechanics |
| 76 | Fluid mechanics | fluid, navier-stokes |
| 78 | Optics + electromagnetic theory | optics, electromagnetic |
| 80 | Classical thermodynamics + heat transfer | thermodynamics, heat |
| 81 | Quantum theory | quantum, quantum mechanics |
| 82 | Statistical mechanics | statistical mechanics |
| 83 | Relativity and gravitational theory | relativity, gravity, einstein |
| 85 | Astronomy and astrophysics | astronomy, astrophysics |
| 86 | Geophysics | geophysics |
| 90 | Mathematical programming | optimization, linear programming |
| 91 | Game theory | game theory, economics |
| 92 | Biology and other natural sciences | biology, mathematical biology |
| 93 | Systems theory; control | control theory, systems theory |
| 94 | Information and communication + circuits | information theory, coding theory |
| 97 | Mathematics education | education |
For problems that ask questions requiring specific answers (not just yes/no), use answer(sorry):
/-- Does $P$ hold? -/
@[category research open]
theorem problem_name : answer(sorry) ↔ SomeProperty := by
sorryNote that if the statement of the theorem depends on some variables, then the quantification should
happen after the answer(sorry), i.e.
/-- Does $P(n)$ hold for all $n$? -/
@[category research open]
theorem problem_name : answer(sorry) ↔ ∀ n, P n := by
sorryrather than
/-- Does $P(n)$ hold for all $n$? -/
@[category research open]
theorem problem_name (n) : answer(sorry) ↔ P n := by
sorryWhen the problem is solved:
- Replace
answer(sorry)withanswer(True)oranswer(False)as appropriate - Update the category to
research solved - If a formal proof exists, add
formal_proof using <kind> at "<link>"
Note: Providing a term inside answer() does NOT automatically mean the problem is mathematically solved - trivial or tautological answers don't count as solutions.
-
One problem per file (with flexibility for closely related variants)
-
Copyright header required (see template in README.md, use year 2026)
-
Module docstring with references:
/-! # Problem Name *References:* - [Title](URL) by *Author Name*, Journal (Year) - [Title](URL) Brief description if needed. -/
For a single reference,
*Reference:*(singular) is also acceptable. -
Import structure:
- Problem files: Import
FormalConjecturesUtil - ForMathlib files: Import only necessary Mathlib modules
- Problem files: Import
-
If a problem fits in several directories then it should stated in one directory rather than copied accross several. In other directories, one can simply add a file with a declaration pointing to the original, e.g.
@[category research open, AMS 11] theorem pointer_to_original : type_of% my_original_theorem := by sorry
See for example
FormalConjectures/GreensOpenProblems/81.lean.
Variants should be in the same file as the main conjecture:
@[category research open, AMS 11]
theorem main_conjecture : MainStatement := by
sorry
@[category research solved, AMS 11]
theorem main_conjecture.variants.weaker_version : WeakerStatement := by
sorry
@[category test, AMS 11]
theorem main_conjecture.variants.small_cases : MainStatement with (n < 100) := by
interval_cases n <;> decideFollow Mathlib's naming conventions. Unlike Lean 3, Lean 4 uses a combination of snake_case, lowerCamelCase, and UpperCamelCase:
-
Terms of Props (proofs, theorem names) use
snake_case:theorem fermat_last_theorem : FermatLastTheorem := by sorry lemma add_comm (a b : ℕ) : a + b = b + a := by sorry
-
Props and Types (inductive types, structures, classes) use
UpperCamelCase:class HasGδSingletons (X : Type*) [TopologicalSpace X] : Prop structure MyStructure where field1 : ℕ field2 : String inductive Color where | Red | Green | Blue
-
Functions are named the same way as their return values:
- A function
A → B → Cis named as though it's a term of typeC. - A function
A → B → ProporA → B → Type _should be named inUpperCamelCase. - A function
A → B → CwhereC : Type _andCisn't itselfType _should be named inlowerCamelCase. - A function
A → B → CwhereC : Propshould be named insnake_case.
- A function
-
All other terms of Types use
lowerCamelCase:def leftFactorial (n : ℕ) : ℕ := ∑ i in Finset.range n, i! def myFunction (x : ℕ) : ℕ := x + 1
-
UpperCamelCase in snake_case contexts: When something named with
UpperCamelCaseis part of something named withsnake_case, it is referenced inlowerCamelCase:theorem fermat_last_theorem : FermatLastTheorem := by sorry theorem nat_factorial_pos (n : ℕ) : 0 < n! := by sorry
-
Acronyms: Written as a group in upper-/lowercase depending on the first character:
LE,LT,GE,GT(when inUpperCamelCasecontext)le,lt,ge,gt(when inlowerCamelCasecontext)
-
Structure fields and constructors: Follow the same rules (1-6) as top-level declarations
add_comm,mul_assoc- operation + propertyNat.factorial_pos- namespace + definition + propertyfoo_of_bar- derivefoofrom hypothesisbarbar_iff_foo- equivalence betweenbarandfoofoo_le_bar- inequality statement
Some rare exceptions exist for consistency:
Ne(notNE) followsEq- Intervals:
Set.Icc,Set.Iic(capitalIdespite convention) - Some legacy structure fields may be lowercase
Note: In this repository, most declarations are theorems (terms of Props), so you'll primarily use snake_case.
-
Use Unicode math symbols where appropriate:
∀,∃,∈,⊆,∧,∨,¬, etc. -
Format code properly: Use consistent indentation (2 spaces)
-
Add docstrings with the math written in LaTeX for definitions and main theorems. Note that docstrings should generally use LaTeX markdown (e.g.,
$P$instead of`P`) to represent mathematical expressions, except for theFormalConjecturesForMathlibparts and for definitions that are very much on the Lean/Mathlib API side, where backticks are preferred:/-- The left factorial of $n$, defined as $0! + 1! + 2! + ... + (n-1)!$ -/ def left_factorial (n : ℕ) := ...
-
research open,research solvedandtextbookdocstrings MUST include a concise description of the problem:/-- Can every even integer greater than 2 be written as the sum of two primes? -/ @[category research open, AMS 11] theorem goldbach : answer(sorry) ↔ ∀ n : ℕ, 2 < n → Even n → ∃ p q, Prime p ∧ Prime q ∧ n = p + q := by sorry
-
Use
local notationfor problem-specific notation within namespaces -
Avoid unnecessary type annotations when Lean can infer them
-
Use
bytactic mode for sorries:by sorry(not justsorry) -
Do not try to add a suggested informal proof for an open research problem
-
Avoid using tactics like
native_decidein proofs. These are completely banned inFormalConjecturesForMathliband may be considered on a case by case basis for incategory teststatements in problem files when the goal is a large computation.
- Be specific with imports - don't import more than needed
- In FormalConjecturesForMathlib, import only from Mathlib
- In problem files, import only
FormalConjecturesUtil, unless you are adding a pointer to another problem or need to state an implication.
CRITICAL REQUIREMENTS:
-
lake --wfail buildMUST pass without errors before submitting for review- Run
lake --wfail buildin the repository root - Fix all compilation errors
- Fix all linter warnings (fail for warning option is set by
--wfail) - Ensure all dependencies are properly imported
- Run
-
sorryusage restrictions:-
✅ ALLOWED: In
FormalConjectures/for benchmark problem statements@[category research open] theorem open_conjecture : Statement := by sorry
-
❌ NOT ALLOWED: In
FormalConjecturesForMathlib/-- WRONG - will be rejected def helper_function : Type := sorry lemma helper_lemma : P := by sorry
-
Exception:
answer(sorry)is allowed as a placeholder for unknown answers
-
-
Completeness:
- No placeholder definitions (e.g.,
def foo : Type := sorry) - No incomplete type annotations or holes
- All referenced definitions must exist
- All imports must be correct
- No placeholder definitions (e.g.,
-
Clean code:
- Remove commented-out code
- Remove debug statements
- No unused imports
- No unnecessary intermediate definitions
Before considering your work complete, verify:
- File has correct copyright header (current year)
- Module docstring with reference links present
- Namespace properly opened and closed
- All theorems have
categoryattribute - All theorems have at least one
AMSsubject - Names follow snake_case convention
-
lake buildsucceeds - No
sorryin FormalConjecturesForMathlib/ - Docstrings present for main definitions
-
research open,textbookandresearch solveddocstrings include a concise description - Code properly formatted and readable
When adding new definitions to FormalConjecturesForMathlib/, include basic sanity checks:
-- In FormalConjecturesForMathlib/Topology/MyDefinition.lean
class MyNewClass (X : Type*) : Prop where
property : SomeProperty X
-- In FormalConjectures/Paper/ProblemUsingMyDefinition.lean
@[category test]
theorem myNewClass_sanity_check :
MyNewClass SomeConcreteType := by
constructor
exact proof_of_property❌ DON'T:
- Use
sorryoutside of problem statement proofs - Create files without copyright headers
- Forget to add
categoryandAMSattributes - Submit code that doesn't compile
- Add large proofs (this is a benchmark repository, not a proof repository)
- Use camelCase for theorem names
- Create placeholder definitions in FormalConjecturesForMathlib/
✅ DO:
- Follow existing file patterns in the repository
- Keep formalisations clean and minimal
- Add references to sources. These should all appear in the module docstring reference list, and
each
textbook,research openandresearch solvedtheorem docstring MUST have a reference and a concise description of the problem. - Use namespaces appropriately
- Test that
lake buildworks - Add variants in the same file as the main problem
- Include basic API for new definitions
- Check existing files for examples:
FormalConjectures/ErdosProblems/10.lean,FormalConjectures/Paper/Kurepa.lean - Use
#AMScommand in VS Code to see available subject classifications - Refer to Mathlib naming conventions
- See main README.md for contribution workflow
- See CONTRIBUTING.md for CLA requirements
/-
Copyright YYYY The Formal Conjectures Authors.
(Replace YYYY with the current year, e.g., 2026 for work done in 2026)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
import FormalConjecturesUtil
/-!
# Problem Name
*Reference:* [Source Title](https://source-url.com)
Brief description if helpful.
-/
namespace ProblemName
/-- Main definition if needed -/
def myDefinition (x : ℕ) : ℕ := x + 1
/-- The main conjecture -/
@[category research open, AMS 11]
theorem main_conjecture : SomeStatement := by
sorry
/-- A variant or special case -/
@[category research solved, AMS 11]
theorem main_conjecture.variants.special_case : WeakerStatement := by
sorry
end ProblemName