Manuscript Offprint
arXiv:2610.24484Erdős-Gyárfás Balanced Five-Colorings
Abstract
A coloring of the edges of a complete graph with colors is balanced if the edges among any vertices use all colors. Erdős and Gyárfás (1999) conjectured that for all the complete graph has no balanced -coloring. They proved the conjecture for and . We prove the conjecture for , the first new case settled in over two decades. There is no balanced 5-coloring of , and since has one, is the largest complete graph admitting a balanced 5-coloring. We design a reduce-dispatch-enumerate workflow, where every machine step produces an artifact that can be independently checked. First, we use a machine-checked (Lean 4) proof to reduce the conjecture to a single extremal statement about the color class with the fewest edges: no graph on 26 vertices has between 55 and 65 edges while every 6 of its vertices span between 1 and 11 edges. We then search on the sparse class instead of its dense complement, which makes enumeration up to isomorphism feasible. With classical stability theorems for -free graphs, we dispatch the five near-extremal edge counts analytically. For the exhaustive enumeration on the remaining six edge counts, we design efficient encodings with SAT modulo symmetries and parallel cube-and-conquer. We also certify all eleven edge counts: each of the 12,296 subproblems carries a clausal refutation checked by the independent verifier drat-trim, and all 273,503,938 symmetry-breaking clauses are also validated against the vertex permutations that justify them.
1 Introduction
For an integer , a balanced -coloring of the complete graph on vertices is a map from its edges to colors such that every set of vertices spans edges of all colors, that is, the edges with both ends in the set use all colors. Balanced colorings were introduced in 1999 by Erdős and Gyárfás [11], who also gave a reformulation: a balanced -coloring of exists if and only if can be partitioned into graphs with for each . Here a set of vertices of a graph is independent if it spans no edge, and the independence number of a graph is the largest size of an independent set. In detail, an -coloring and a partition of into graphs determine each other, with the graph on all vertices whose edges are those of color . A set of vertices misses color , that is, none of the edges among them has color , exactly when it is an independent set of . Hence the coloring is balanced exactly when no has an independent set of vertices, which is the condition for every .
Erdős and Gyárfás [11] conjectured a sharp threshold for the existence of balanced colorings.
Conjecture (Erdős–Gyárfás). For every there is no balanced -coloring of .
The value is not an arbitrary threshold. When is a prime power (that is, for a prime and an integer ), the finite field with elements (for prime , the integers modulo ) yields an affine plane of order , which gives a balanced -coloring of . The plane has points and lines of points each. Every two points lie on exactly one line, and the lines fall into parallel classes of pairwise disjoint lines. Take the points as the vertices of and put each edge into the parallel class of the line through its two ends. This splits the edges into classes, each consisting of disjoint cliques (sets of pairwise adjacent vertices) on vertices [11]. An independent set meets each clique in at most one vertex, so every class has independence number . Merging two classes into one color leaves colors, each still with independence number at most . Therefore, the coloring is balanced (Fig. 1, right). The construction is called the affine coloring of . The Erdős–Gyárfás conjecture asserts that we cannot push past . For it is false: coloring the five edges of a pentagon with one color and the other five edges of with the second gives a balanced 2-coloring of (Fig. 1, left). For and , Erdős and Gyárfás [11] proved it: there is no balanced 3-coloring of and no balanced 4-coloring of . Their two proofs are case-specific. The argument relies on Brooks’ theorem [6] and a short case analysis; this case had in fact been settled already in 1978 by Chung and Liu [9] in the language of generalized Ramsey numbers (their Theorem 3.6): every 3-coloring of contains a that uses at most two colors. The argument involves edge counting and the Ramsey number [12]. The case , the existence of a balanced 5-coloring of , has remained open since 1999.
In this paper, our main result settles Erdős–Gyárfás balanced five-colorings as stated in Theorem 1.
Theorem 1. There is no balanced 5-coloring of . Equivalently, every 5-coloring of the edges of contains a copy of that misses at least one color. The Erdős–Gyárfás conjecture holds for r = 5.
Corollary 1. The maximum n for which admits a balanced 5-coloring is exactly .
Proof. Restricting a balanced 5-coloring of to any 26 of its vertices would give a balanced 5-coloring of , since every set of 6 chosen vertices still spans all 5 colors. Theorem 1 therefore rules out every . The affine coloring of described above attains 25.
A balanced 5-coloring of can be written as one propositional formula: the Boolean variables indicate the colors of the edges, and the clauses require that each edge has exactly one color and that every set of 6 vertices contains an edge of each

balanced 2-coloring of

balanced 3-coloring of
Figure 1: Two balanced colorings. Left: colored by the pentagon (solid) and its complement (dashed); every 3 vertices span both colors, which is why the conjecture is stated for . Right: the affine coloring of . The vertices are the 9 points of the affine plane of order 3, drawn as a grid, whose lines are the rows, the columns, and two classes of diagonals that wrap around the grid. Edges inside a row get the first color (solid), edges inside a column the second (dashed), and all remaining edges, which form the two diagonal classes, the third (dotted). Any 4 vertices include two in the same row, two in the same column, and two in neither, so every 4 vertices span all three colors.
color. However, such formulas are not solved in practice by state-of-the-art satisfiability (SAT) or constraint solving. Even the simpler formula for the known case on was not decided in our tests within 3600 seconds by the SAT solver kissat [3], by the constraint solver CP-SAT [23], or by CP-SAT with added cardinality constraints. The obstacle is the huge search space with its symmetries: relabeling the 17 vertices and permuting the 4 colors turns every coloring into up to equivalent copies (the group , where permutes objects). To overcome this obstacle, we design a reduce-dispatch-enumerate workflow: a reduction, an analytic dispatch of the near-extremal cases, and a computation. Furthermore, we design layers of certification to ensure that our results are trustworthy.
The reduction. We write for the number of edges of a graph . The smallest color class of a balanced 5-coloring of has , as the five classes partition the 325 edges. On the other hand, with and the Caro–Wei inequality (a lower bound on the independence number in terms of the vertex degrees, see Section 3), we have . These two bounds leave the 11 edge counts . Furthermore, the definition of balance also forces a local-density property (L), and the conjecture can be further reduced to the following statement, by a proof formally verified in the proof assistant Lean 4 (Section 3):
Main Lemma. No graph on 26 vertices has independence number at most
5, the local-density property (L) that every 6 vertices span at most 11 edges, and between 55 and 65 edges.
We settle the five edge counts analytically with two classical stability theorems [7, 16], as the complement of then has at least 266 of the at most 270 edges of a -free graph on 26 vertices (Section 4).
The computation. The remaining 6 edge counts, , are settled by an exhaustive enumeration of the graphs for the smallest class rather than for its dense complement. We enumerate the graphs with SAT modulo symmetries (SMS) [20], using encodings designed for it, where a SAT solver prunes graphs that are not the lexicographically smallest copy in their isomorphism class (Section 2). We further parallelize the search by cube-and-conquer, choosing the variables to fix by their frequency (Section 5.3), so that the computational load is spread evenly over independent subproblems (cells). For , we split each formula into 4,096 cubes, and we obtain refutation proofs for all subproblems. To make the computation trustworthy, we not only checked the proofs with an independent checker, but also validated all symmetry-breaking clauses added during the search against their permutation witnesses, the relabelings of the vertices that justify them (Section 6). Fig. 2 summarizes the workflow.
Contributions. (i) Result. We settle the case of the Erdős–Gyárfás conjecture, the first new case since 1999 (Theorem 1, Corollary 1). (ii) A verified reduction chain. A reduction checked in Lean 4 turns the conjecture into the Main Lemma, a statement about one sparse graph with 11 possible edge counts. The formal main theorem has the Main Lemma as its only hypothesis. (iii) Efficient encodings and cube selection. We encode the sparse class, impose the local-density property only on one densest 6-set per enumerated graph, and choose the 12 cube variables by their frequency, so that the heaviest cube holds 8.3% of a test family, against 74 to 100% for structural choices and SMS's default cubing (Section 5). (iv) Layers of certification. Programs separate from the search check the encodings, the completeness of the enumeration, the refutations of all 12,296 cells (with drat-trim), and all 273,503,938 symmetry-breaking clauses against their permutation witnesses. As the certified search covers all 11 edge counts, the result depends on neither external theorem (Section 6, Table 4).
The clique number is the largest number of pairwise adjacent vertices. A graph is -free if it has no pairwise adjacent vertices. Therefore, -free is equivalent to .
The chromatic number is the smallest number of colors in a coloring of the vertices such that adjacent vertices receive different colors. A graph is r-partite when

Figure 2: The proof at a glance. A balanced 5-coloring of would yield a smallest color class with , the local-density property (L), and (Lemma 1), which the Main Lemma excludes. Two classical stability theorems dispatch the near-extremal counts analytically (a graph is 5-partite if its vertices split into 5 independent sets), and a drat-trim-certified SAT-modulo-symmetries enumeration settles . Each of the three cases forces a 6-set violating (L), so cannot exist.
. That is, the vertices of an -partite graph can be split into independent sets, its parts.
The complement graph of , , has the same vertices as and contains exactly the pairs that are not edges of . Then we have and . Throughout our paper for , we have the number of vertices, and the number of edges, . For integers , denotes the range, . When the graph is clear from context, we write for , and similarly for and .
A graph is complete -partite if its vertices split into parts with no edge inside a part and an edge between every two vertices in different parts. denotes the one with parts of sizes . The Turán graph is the complete -partite graph on vertices with parts as equal as possible. For our instance, and , the corresponding parts have sizes , so . By Turán's theorem [27], a -free graph on 26 vertices has at most 270 edges, with equality only for . The following two stability theorems describe the
-free graphs just below this bound.
Theorem 2 (Brouwer [7]). Every -free graph on 26 vertices with at least edges is 5-partite.
Theorem 3 (Kang and Pikhurko [16]). The maximum number of edges of a -free graph on 26 vertices that is not 5-partite is exactly 266. Up to isomorphism, the extremal graphs are exactly
where is the graph obtained from the 5-cycle by replacing its -th vertex with an independent set of vertices, with all edges between consecutive sets, is the join, which adds all edges between the two graphs, , and the tuple of part sizes is one of , , and .
These tuples are exactly the ones for which the construction is -free, not 5-partite, and has 266 edges. Every part of the pentagon skeleton and of the tripartite part is an independent set. Fig. 3 shows an example of the construction.

(a) and the set sizes

(b) : 26 edges

(c) : 266 edges
Figure 3: Construction of the extremal graph of Kang and Pikhurko [16] for the tuple and . (a) The 5-cycle skeleton: each vertex labeled with the size of the set that replaces it. (b) The blow-up: every set is independent, and consecutive sets are joined by all edges, 26 in total. (c) The join with : a gray band stands for all edges between two parts. The result has 26 vertices and 266 edges.
SAT modulo symmetries. The computational core enumerates isomorph-free graphs subject to combinatorial constraints. As we mentioned in the introduction, encoding the constraints with one Boolean variable per possible edge and running a SAT solver to enumerate models fails at our scale: the vertex-relabeling group has 26! elements. Even though static symmetry-breaking constraints [10] can be added to the formula before solving for excluding some symmetric copies, they can remove only part of this symmetry in practice. SAT modulo symmetries (SMS) [20] interleaves a conflict-driven clause-learning (CDCL) SAT solver with a propagator. SMS compares adjacency matrices lexicographically, as 0/1 strings of their entries above the diagonal read row by row, and calls a graph canonical if its matrix is the smallest in its isomorphism class. The propagator runs a minimality check at regular intervals: it looks for a vertex permutation showing that no completion of the current partial adjacency matrix is canonical, and if it finds one, it learns a symmetry-breaking clause (symmetry clause for short) that prunes the branch. When the constraints are invariant under relabeling the vertices, a complete run of SMS emits at least one representative of every isomorphism class of graphs satisfying them.
We use the official implementation of SMS . Two of its features matter here. First, SMS bounds the work of each minimality check by a cutoff on its number of recursive steps (200,000 by default). A check that reaches the cutoff keeps the graph, so in its enumerate-all mode with a cutoff SMS may emit several isomorphic copies of a class, and its output contains at least one representative of every isomorphism class. This is exactly what a nonexistence conclusion needs. Second, SMS supports cube-and-conquer. A cube is a conjunction of literals that fixes the truth values of chosen variables, and the cubes over k chosen variables split the formula into disjoint subproblems whose union is the whole search space. A proof-logging SMS also emits the symmetry clauses along with a permutation witness. The witness contains a vertex permutation showing that every graph the clause excludes has a lexicographically smaller relabeling. Therefore, the clause excludes no canonical graph (Section 6). The formula together with these clauses, the augmented formula, can then be refuted by an ordinary SAT solver and the refutation checked by an independent verifier [17], which verifies in Lean the encoding, the symmetry clauses and the refutation of a single formula. That framework does not yet support cube-and-conquer. Our refutations total 5.5 TB in the DRAT format (Table 2). We therefore use only its proof-logging SMS build, verify the refutations with drat-trim, and check the symmetry clauses with our own checker (Section 6).
3 Reduction to a Single Color Class
For contradiction, we suppose that a balanced 5-coloring of exists, with color classes partitioning the 325 edges. Every set of 6 vertices, a 6-set, spans edges, which use all 5 colors. Hence, for every color class :
(A) : A 6-set without an edge of would miss color .
(L) Every 6-set spans at most 11 edges of : The other four colors each occupy at least one of the 15 edges, so at most are of color . In particular , since a would be a 6-set spanning all 15 edges in one color.
Properties (A) and (L) hold for every color class, and the smallest class controls the edge count.
Lemma 1. Some color class of a balanced 5-coloring of satisfies , property (L), and .
Proof. Take with the fewest edges. As the five classes partition 325 edges, . For the lower bound, the Caro–Wei inequality [8, 28] gives
https://github.com/markirch/sat-modulo-symmetries
with the average degree. With and this forces , hence , so .
Lemma 1 reduces Theorem 1 to the Main Lemma stated in the introduction. If the Main Lemma holds, the graph cannot exist, so the assumed coloring cannot exist. The rest of the paper proves the Main Lemma.
The complement view. For a candidate as in the Main Lemma, with edges, set . Then is -free, since , and has . Property (L) becomes a lower bound on local density: every 6 vertices span at least edges of . In particular . We prove the Main Lemma by ruling out, for each , a -free graph on 26 vertices with in which every 6-set spans at least 4 edges.
Remark 1. Property (L) is not implied by and alone, so property (L) excludes graphs that and allow. For a witness, we take . The graph has 266 edges and , so its complement has , and deleting up to six suitable edges from covers . Each of these has a 6-set spanning at most 3 edges, so the corresponding has a 6-set spanning at least 12 and violates (L).
The reduction is formally verified. The argument of this section is mechanically checked in Lean 4 (Section 6, Listing 1): the implications “balanced (A)” and “balanced (L)”, the bound “some class has at most 65 edges”, and the lower bound of 55 edges are all proved. Lean derives the lower bound from the formalization of Turán’s theorem in Mathlib, applied to the complement.
4 The Analytic Edge Counts
We prove the Main Lemma for analytically. Throughout, is -free with , and we look for a 6-set of spanning at most 3 edges, which violates (L).
Edge counts 55 to 58. Here , so by Brouwer's theorem (Theorem 2) is 5-partite. A 5-partition of 26 vertices has a part of size at least , an independent 6-set of spanning 0 edges, violating (L).
Edge count 59. Here . If , then as above some part of a 5-partition of has at least 6 vertices, an independent 6-set. Otherwise is -free and not 5-partite, so by Kang–Pikhurko (Theorem 3) it is one of the explicit graphs , and we make these explicit. Fix one of the four admissible size tuples and a complete 5-partite graph with parts . Pick a vertex and a nonempty proper subset , delete every edge between and , and add one new vertex adjacent to . The resulting graph has 26 vertices and 266 edges, is -free, and is not 5-partite. The parts
, , can be permuted and vertices within a part are interchangeable, so the choice of and of of a given size does not matter up to isomorphism: the construction is determined by the size tuple together with , . No operation adds an edge inside a part, so each remains independent. This gives fourteen candidate graphs, possibly with isomorphic repetitions (reflecting the 5-cycle maps the graph for to the graph for ): for and , and for and . For each of the fourteen candidate graphs we minimize, over all 6-sets, the number of -edges spanned. The minimum is 0 for the ten graphs of the three tuples with a part of size 6, since that part is an independent 6-set, and 1 for the four graphs of , so in every case has a 6-set spanning at most 3 edges and violates (L). As an independent check, a SAT solver confirms that none of the fourteen complements extends to a balanced 5-coloring of (the fourteen graphs and the check are in the supplementary archive, Section 6). Hence the Main Lemma holds for .
5 The Computational Core
We continue to prove the Main Lemma for , equivalently, in the complement view, for . We settle each of the 6 edge counts separately by an exhaustive graph enumeration covering all isomorphism classes. Algorithm 1 gives the pipeline in outline: the search of this section together with the certification of Section 6.
Algorithm 1 The certified search at edge count , run in full for the six searched counts . The five analytic counts run the same loop on a single monolithic cell each (Section 6). The outcome is for all eleven counts, with every certificate checked.
Require: a target edge count for graphs on 26 vertices
Ensure: the property (L) survivor count ; one checked refutation per cell
1: compared with an independent regeneration
2: the 12 edge variables whose frequency in a saved family is nearest (Sec. 5.3)
3: if , else cubes or monolithic
4:
5: for all cells do one cluster node task each
6: SMS; completeness checked (Sec. 6)
7:
8: , with read off symmetry clauses, witnesses
9: refute with the SAT solver CaDiCaL; check by drat-trim
10: check each clause of against the lex-leader inequality of its witness in (Sec. 6)
11: end for
12: return for all eleven is the Main Lemma
5.1 The Encoding
Fix the vertex set and number the 325 pairs with in lexicographic order, so that stand for the pairs .
An assignment to these variables is a graph G on V: the variable of a pair is true if the pair is an edge of G. For a 6-set , let be the set of the 15 variables of pairs inside S. For a target edge count e, the base formula is the conjunction of three clause groups.
(I) Independence. For every 6-set the clause : some edge lies inside . This clause has length 15, and there are clauses in all. This group forces .
(K) Clique. For every 6-set , some edge is missing inside ; the clause is , again of length 15. This group forces .
(E) Edge count. We use the sequential counter [24] encoding over edge variables, . The registers are defined as for and . is true when at least of the first pairs are edges. We write for the literal expressing that at least of the first pairs are edges: , except that and is the constant true. The register occurs in no clause. For and the clauses
express . For the last clause is trivially true and omitted. The family is completed by the units for , the unit , and the clauses for .
The unit therefore forces at least e edges. The last clauses forbid an edge once e edges have been counted, so exactly e edges remain. Conversely, every assignment with exactly e true edge variables extends to a model by giving each register its intended value, and this extension is unique on the variables that occur in .
Lemma 2. For every graph G on V, the assignment of G extends to a model of if and only if , , and . The extension is unique on the variables in .
The counter contributes auxiliary variables (including the unused ) and clauses, so has variables and clauses (Table 1). A cell of the search adds up to three further layers to , and the result is the cell's augmented formula refuted by CaDiCaL in the end (Section 6).
(U) Cube. For , the 12 unit clauses fixing the cube variables (chosen in Section 5.3), namely , , , , , , , , , , , , the variables of the pairs , , , , , , , , , , , in this order, to one of their truth assignments. The 4096 cubes are pairwise disjoint and together cover all assignments.
(L_D) Restricted local density. For a set of 6-sets, the clauses for every and every 12-element : at most 11 of the 15 edges inside . We write for this set of clauses. These are clauses per 6-set, each
Table 1: Formula sizes for the searched edge counts. has variables and clauses. The per-cell columns are maxima over the cells of an edge count, except the mean number of symmetry clauses. The augmented formula of a cell is with its cube, restricted local-density and symmetry breaking clauses. is the number of distinct 6-sets in its restricted local-density clauses, one densest 6-set per base graph; it is at most the number of base graphs of line 6 of Algorithm 1, and smaller when several base graphs share a densest 6-set. The five analytic-band cells have between 18,200 and 19,500 variables, and their corresponding formulas have between 531,795 and 536,983 clauses.
| e | variables | clauses of | cells | |D| | symmetry clauses | augmented clauses | |
|---|---|---|---|---|---|---|---|
| mean | max | ||||||
| 60 | 19,825 | 538,280 | 1 | 5 | 33,274 | 33,274 | 573,829 |
| 61 | 20,150 | 539,577 | 1 | 7 | 43,150 | 43,150 | 585,912 |
| 62 | 20,475 | 540,874 | 1 | 25 | 52,122 | 52,122 | 604,371 |
| 63 | 20,800 | 542,171 | 4,096 | 13 | 17,713 | 44,180 | 586,363 |
| 64 | 21,125 | 543,468 | 4,096 | 28 | 21,860 | 54,983 | 598,918 |
| 65 | 21,450 | 544,765 | 4,096 | 56 | 27,145 | 70,440 | 617,665 |
implied by property (L), so the layer excludes no graph that satisfies (L). The base graphs of a cell are the graphs that SMS emits for and the cell's cube (Section 5.2). For each base graph, contains one 6-set on which that graph has the most edges. No base graph satisfies (L) (Table 2 and Section 6), so each of these 6-sets spans at least 12 edges, and the layer excludes every base graph.
Symmetry. The symmetry-breaking clauses that SMS emits while solving the cell, each validated against its permutation witness (Section 6).
The sparse-versus-dense choice. Generating rather than its dense complement is the key modeling choice. With and at most 65 edges, every graph of the family that describes is sparse. In our preliminary runs, the per-graph minimality check was efficient, producing 0.3 to 0.5 graphs per second. But the dense complement has about 260 edges, and the minimality check of SMS on dense graphs with 26 vertices is so costly that a direct enumeration of produced no graphs within 7 minutes.
5.2 Enumeration and Cube-and-Conquer
For each , we run SMS and test property (L) on each emitted graph. The test computes over all 6-sets the maximum number of spanned -edges and reports any graph whose maximum is at most 11. The counts are enumerated monolithically. For the search is partitioned by cube-and-conquer [13]: we fix 12 edge variables in all ways, splitting the formula into disjoint subproblems whose union is the full search space. Each cube runs as a separate single-core task. A cell is one unit of the search: the monolithic formula of a count , or one cube of a partitioned count. The selection of the cube variables is presented in
Section 5.3. The graph enumeration is complete, and the guarantee attaches to the union of the cubes. In the SMS propagator, the minimality check compares a graph with all its relabelings, including those that violate the cube. Therefore, a single cube need not emit every graph that satisfies it, as only the lexicographically minimal representatives of the class are emitted. Since the 4096 cubes are pairwise disjoint, every isomorphism class of the family has its canonical graph in exactly one cube. The union of the cubes has at least one representative of every class (line 6 of Algorithm 1). Afterwards, property (L) is tested on the emitted graphs. In Table 2, duplicate emissions only inflate the counts without affecting the final number of emitted graphs that satisfy property (L), which is 0.
Table 2: Results for the searched edge counts . Cells: 1 for a monolithic count, 4096 cubes for a partitioned one. Emitted: the base graphs, i.e., the graphs with , and edges that SMS emits, repetitions included; sat. (L): those satisfying property (L). Times are in core-hours (core-h), hours of single-threaded tasks. The certification columns cover the full pipeline of Section 6 per cell, from the enumeration to the drat-trim check: the wall-clock of the slowest cell, the total time, and the total size of the raw DRAT refutations. All times come from the certification run.
| e | cells | enumeration | certification | ||||
|---|---|---|---|---|---|---|---|
| emitted | sat. (L) | core-h | slowest (h) | core-h | DRAT (GB) | ||
| 60 | 1 | 124 | 0 | 0.3 | 0.9 | 0.9 | 1.0 |
| 61 | 1 | 503 | 0 | 0.5 | 1.2 | 1.2 | 0.9 |
| 62 | 1 | 2,455 | 0 | 0.8 | 1.6 | 1.6 | 1.3 |
| 63 | 4,096 | 26,521 | 0 | 548 | 5.5 | 1,959 | 1,296 |
| 64 | 4,096 | 238,420 | 0 | 772 | 6.7 | 2,799 | 1,760 |
| 65 | 4,096 | 2,605,003 | 0 | 1,219 | 9.8 | 4,143 | 2,484 |
| total | 12,291 | 2,873,026 | 0 | 2,540 | 8,905 | 5,543 | |
Table 2 reports, for each searched edge count, the number of graphs emitted and the number satisfying property (L). The latter number is always 0. Therefore, no graph on 26 vertices with edges satisfies both and property (L). Together with Section 4, this proves the Main Lemma. The remaining columns report the cost: the enumeration takes 2,540 core-hours in total, and the certification of Section 6, whose first stage repeats this enumeration, takes 8,905.
5.3 Choosing the Cube Variables
Any set of edge variables partitions the search space into cubes, but the workload is not guaranteed to spread evenly. Because SMS keeps mostly lexicographically minimal graphs, most edge variables are nearly constant over the family. In the preliminary experiments, a run for that was stopped early had saved 2,444 of the 2,455 graphs. On these graphs, we found 236 of the 325 edge variables occur in of the graphs, and 47 variables occur in . Surprisingly, only one variable lies in
[35%, 65%]. Fixing a nearly constant variable contributes almost nothing to the split. Therefore, we take to be the edge variables whose presence frequency is closest to on the family for . Later, we use the same for .
To verify the effectiveness of the mentioned variable selection method, we compare it with other alternatives on the same family. Table 3 shows the number and the share of the emitted graphs in the heaviest cube. This ratio of graphs is a proxy for load balance that is available before any cube has run (in the final search is a single cell; see Table 2). Running the cubes of every candidate would cost one cube-and-conquer run per candidate, so we compute these numbers from the saved graphs. A saved graph sets all 325 edge variables, so its edges show which cube it satisfies. In every cube set of Table 3, each graph satisfies exactly one cube, so counting the graphs per cube needs no solver run on the cubes. The heaviest cube matters because it shows the imbalance of the load among cubes. From the share in Table 3, the default SMS cubing puts almost all emitted graphs into a single cube, and the matchings do little better, leaving three quarters of the family in one cube, and the first twelve edges at one vertex do not split it at all. However, the frequency-based selections bring the heaviest share down to , and for , 12 and 14. We took for later experiments: its 4096 cubes give about 14 cubes for each of the 288 cores that ran at once, while would quadruple the number of cubes for a gain of 1.3 points. We also tried the look-ahead cube generator march_cu [13], which was found to be the most suitable cuber for SMS [19]. It did not return cubes within 300 seconds on the full formula for . An SMS pre-run removed only of its clauses, since the 6-set clauses do not simplify away.
Table 3: Cube-variable choices compared on one family: 2,444 graphs with , and 62 edges. Heaviest cube: the number and share of these graphs in the most populated cube. Nonempty: the number of cubes that contain at least one of these graphs. A matching is a set of pairwise disjoint edges. SMS's default cubing (SMS option --simple-assignment-cutoff 30) emits the current partial assignment as a cube once at least 30 edge variables are assigned. The 10,246 cubes fix 30 to 57 edge variables each. The SMS cubes come from our first cubing run on the same family.
| cube variables | k | cubes | nonempty | heaviest cube |
|---|---|---|---|---|
| SMS default cubing | - | 10,246 | 2 | 2,443 (99.96%) |
| edges of an 8-edge matching | 8 | 256 | 5 | 1,899 (77.7%) |
| edges of a 12-edge matching | 12 | 4,096 | 8 | 1,812 (74.1%) |
| first 12 edges at vertex 0 | 12 | 4,096 | 1 | 2,444 (100%) |
| frequency nearest | 10 | 1,024 | 122 | 368 (15.1%) |
| frequency nearest (chosen) | 12 | 4,096 | 206 | 203 (8.3%) |
| frequency nearest | 14 | 16,384 | 353 | 172 (7.0%) |
The computation of this section and Section 6 confirms the choice at the counts. For , 64 and 65 the heaviest cube held , and of the family, and 3,574, 3,074 and 2,393 of the 4096 cubes emitted no graph. Running time is driven by search rather than by graph count. These empty cubes account for , and of the certification time in Table 2, and the slowest cube for is empty. In the first complete enumeration run, a separate earlier run under different cluster load than the certification run of Table 2, with one cube per task, the counts , 64 and 65 finished in 3.0, 3.5 and 10.3 hours of wall-clock time with at most 288 single-threaded tasks at once.
6 Certification
For the certification, we first check the encoding as described below, and then we certify the search in three levels of formality. Table 4 presents what each level establishes.
Table 4: The trusted base, component by component. Every computational step specific to this proof is checked by a program separate from the search: Lean 4, drat-trim, the witness checker, or the encoding checks of this section. The result depends on neither external theorem: the certified search independently covers the analytic dispatch, and the lower bound of 55 edges is proved in Lean. The certificate and encoding checkers are separate from the search programs but are not themselves formally verified.
| proof component | established by |
|---|---|
| reduction; , (L) isomorphism-invariant; | Lean 4 |
| base formulas | regenerated (Lemma 2) |
| ruled out | analytic + drat-trim |
| complete | SMS, completeness-checked re-run |
| augmented formula unsatisfiable, each cell | drat-trim |
| symmetry clauses, each cell | witness check |
| Brouwer, Kang-Pikhurko theorems | external |
Encoding checks. In the computation, the base formulas must match the formulas described in Section 5.1. To this end, we design an encoder independent from ENCODE of Algorithm 1. The encoder rebuilds the clause groups (I), (K) and (E) from their definitions. For each of the eleven base encoding files, identified by SHA-256 hashes, we checked that the clause multiset and the variable/clause counts agree with the generated formula. Next, we injected three flaws (a dropped clause, a flipped literal and an added clause), and all of them were detected. In addition, the cube file contains each of the truth assignments of the 12 cube variables exactly once. Each clause of a restricted local-density layer is one of the 455 at-most-11 clauses of a 6-set and is therefore implied by (L). In every cell with , the recorded counts satisfy and sum to the size of the augmented formula. The only cell whose files were all retained (, cube 3228 of the cube file) also passes the checks. All 753 cells that were run more than once produced byte-identical augmented formulas.
A completeness-checked re-run. The first level addresses the basic risk that a sub-problem was silently truncated and reported complete. We re-ran the entire enumeration under a stricter runner that requires, for each monolithic cell and each of the cubes, a four-part completeness certificate: (1) SMS exited with status 0, so it was not killed, timed out, or crashed. (2) It printed its closing timing line, which it prints only at a normal end. (3) Its SAT search ended with result code 20 (unsatisfiable), meaning the search tree was exhausted rather than cut off. (4) The number of graphs SMS reported equals the number of graphs captured from its output. A separate verifier confirms that every cube is present exactly once with its certificate. The re-run reproduces Table 2 exactly.
Clausal certificates from proof-logging SMS. The second level gives each cell a clausal certificate that an independent program checks. A cell claims that no graph G in the cell satisfies , , and (L). The formula of a cell consists of , the unit clauses of its cube (for ) and the layer . Its certificate is built in three steps. First, the proof-logging SMS [17] runs on the cell and outputs each symmetry clause it learns, together with a permutation witness. Second, these clauses are added to the formula of the cell, and CaDiCaL [2] refutes the resulting augmented formula. Third, drat-trim [29] checks the refutation, which CaDiCaL writes in the standard DRAT proof format.
The formula of a cell contains (L) only in restricted form. The full (L) encoding with the at-most-11 constraints on all 6-sets would add about clauses per cell. Therefore, we add the constraint only on the 6-sets of (Section 5.1), one densest 6-set per base graph. Every clause of this layer is implied by (L), and the layer is then small (Table 1).
A refutation shows only that the augmented formula is unsatisfiable. It proves the claim of the cell as the added clauses exclude no canonical graph with the target properties ( , , edges and (L)). Supposing some graph has these properties, they are invariant under isomorphism (the Lean development proves this for and (L)), so the canonical copy of has them as well. The canonical copy also lies in one cell, and the corresponding assignment extends to a model of (Lemma 2). It satisfies , because every clause of is implied by (L), and it satisfies every symmetry clause as checked below. The augmented formula of that cell would then be satisfiable, which its refutation rules out.
Each symmetry clause comes with a permutation witness . Let be the 0/1 vector of the 325 edge variables in the order of Section 5.1, and let be this vector for the graph relabeled by . Every canonical graph satisfies the lex-leader inequality , where is the lexicographic order of Section 2. Therefore, a clause excludes no canonical graph if every assignment falsifying it violates this inequality. Our checker tests this condition. A fast test looks for one position where every such assignment makes and first differ, with 1 in and 0 in . If no such position exists, an exact test considers each way to satisfy the inequality: , or a first difference at a position where has 0 and has 1. For both cases, union-find on the equalities and fixed values that the case forces decides whether the case is consistent with falsifying the clause, and the clause is accepted when no case is. The checker shares no code with the SMS build that emitted the clauses. It accepts all 273,406,587 symmetry clauses of the 12,291 cells.
We ran this pipeline (Algorithm 1, lines 8–10) on all 12,291 cells: the three monolithic cases and the cubes. Every refutation passes drat-trim without failure.
The cells exclude 2,873,026 base graphs in total, and the per-cell counts reproduce Table 2. Table 2 also gives the time and the proof size per edge count. In detail, the time cost splits nearly evenly over the four stages of a cell: 29% for enumerating the base graphs, 26% for the proof-logging SMS run that emits the symmetry clauses, 23% for the CaDiCaL refutations, and 22% for checking them with drat-trim.
The raw DRAT proofs total 5.5 TB, or 2.0 TB after drat-trim removes the steps unused by the refutation. Therefore, for every cell, we store a complete record of the run instead of the proof itself (times, SHA-256 hashes of all artifacts, and solver statistics). The solvers are deterministic, so any cell's certificate regenerates from the recorded inputs, identified by their hashes, and re-checks against its recorded hash.
The analytic edge counts, certified. The five near-extremal counts, , are settled analytically in Section 4, and they were also put through the certificate pipeline. For the family of graphs with , and edges is empty, so the cell has no base graphs. When is empty, its formula is directly refuted. For , SMS emits seven graphs, but none of them satisfies (L). These seven graphs are copies of exactly two isomorphism classes, the complements of the graphs of Theorem 3 for the tuple with and , which is precisely the family that the argument of Section 4 predicts for , and 59 edges, so the enumeration cross-checks Theorem 3, as the empty families for cross-check Theorem 2. All five augmented refutations pass drat-trim, and all 97,351 of their symmetry clauses are validated against their permutation witnesses. With them the certification comprises 12,296 cells and 273,503,938 witness-checked clauses in total. In the end, every edge count in [55, 65] carries a drat-trim-checked refutation whose symmetry clauses are witness-checked.
A Lean 4 formalization of the reduction, and its contract. The third level formalizes the reduction of Section 3 in Lean 4 with Mathlib [26]. A formal theorem is only as good as the fit between its statement and the claim, so we checked its contract: the definitions the statements use and the statements themselves are the same as they appear in the development. (See Listing 1 in Appendix A). A 5-coloring of is a map c : Sym2 v → Fin 5 on a type v with 26 vertices. The values on the diagonal pairs s(v, v) are never consulted. Here Sym2 v is Mathlib's type of unordered pairs s(v, w) of vertices of v, diagonal pairs included, and Fin 5 is the type {0, ..., 4}, so Lean numbers the colors 0, ..., 4 rather than 1, ..., 5. The color class k is the simple graph classGraph c k of the k-colored pairs. Balanced, NoIndep6 and PropertyL literally state the definitions of Sections 1 and 3, except that PropertyL counts ordered pairs and is therefore bounded by .
The contract reads against the paper as follows.
• Notation. G.edgeFinset.card is the number of edges of G, S.offDiag is the set of ordered pairs of distinct elements of S, and f : G ≈g G' is a graph isomorphism. The argument [DecidableRel G.Adj] only makes adjacency decidable, so that the edges can be counted.
• noIndep6_classGraph and propertyL_classGraph are properties (A) and (L) of Section 3, and exists_class_le_65 is the averaging bound of Lemma 1.
• card_edgeFinset_ge_55 is the lower bound of Lemma 1. Lean proves it from the formalization of Turán’s theorem in Mathlib applied to the complement, which gives the same bound as the Caro–Wei inequality.
- no_balanced_5_colouring_of_mainLemma concludes Balanced c for every coloring of a 26-element type, which is Theorem 1. Its only hypothesis, step_sms_full, is a statement about graphs alone. It is the Main Lemma, which the certified search establishes. The search also imposes , but (L) implies it because a has 15 edges.
• The variant no_balanced_5_colouring of Basic.lean, not shown in Listing 1, predates card_edgeFinset_ge_55 and has four hypotheses in place of the Main Lemma: the lower bound, which is now proved, and one per case of Fig. 2, namely Brouwer, Kang–Pikhurko, and the search for . The lemmas noIndep6_iso and propertyL_iso give the isomorphism invariance that the certification argument above relies on.
• Checks. With Lean 4.28.0 and Mathlib, the development builds without errors, and #print axioms reports only propext, Classical.choice and Quot.sound, the standard axioms of Lean's logic, for every theorem in the listing. Therefore, the development adds no axioms, and its one remaining hypothesis is the Main Lemma, which the certified search establishes outside Lean. Lean prints the conclusion of the main theorem as ErdosGyarfasR5.Balanced c, and it can confirm that it refers to the definition above and not to Mathlib's unrelated Balanced, a property of sets in normed spaces.
Artifact and reproducibility. The anonymous artifact is available [1]. (Note that the link may be broken when copied with multiple lines, so please copy the links if clicks fail.) The encodings, the cube partition, the property (L) test, the completeness-checked runner and verifier, the certificate pipeline, the per-cell run records with the SHA-256 hashes of every artifact, complete certificate chains for representative cells, the regeneration and re-verification tooling, and the Lean 4 development accompany the paper as an anonymized code-and-data archive in the supplementary material. The full witness and certificate corpus exceeds the supplementary size limit, so its archives are identified by SHA-256 hashes in the supplement and regenerate deterministically from the recorded inputs. The archive also records the checksums of the binaries and the hashes of every input formula and cube file, and the Lean 4 development builds against a fixed Mathlib version. All runs used cluster nodes with two 24-core AMD EPYC 7402 CPUs (96 hardware threads) and 1 TB of RAM. The search and its certification ran under Ubuntu 18.04 (Linux 4.15), up to 288 single-threaded tasks concurrently, and the direct-solving tests of Section 1 under Debian 13 (Linux 6.12), kissat on one core and CP-SAT with eight threads. During development two settings were explored, the cube variables and their number k (Section 5.3 reports all candidates and the selection criterion). The remaining settings (the per-tool time limits, the solver versions, and the minimality-check cutoff of SMS, left at its default of 200,000 steps in the enumeration and switched off (--cutoff 0) in the proof-logging runs that emit the symmetry clauses) were fixed at the beginning. All of these affect only the cost of the search, because the validity of the result rests on the certificates as we discussed, which are checked independently of how the search was configured.
7 Discussion
Validation. Three checks support the computation. First, the same reduction and enumeration, without the certificate stages, reproduce the known case : over the band , the search emits every isomorphism class on 17 vertices with and , and none satisfies the local-density bound that every 5-set spans at most 7 edges, reproducing the nonexistence of a balanced 4-coloring of . Second, the direct encoding of a balanced coloring as one propositional formula (Section 1) passes positive and negative controls: it finds balanced colorings of and and reports nonexistence for , and for through the reduction used in the first check. Third, an independent simulated-annealing search (a randomized local search) found a genuinely balanced 5-coloring of that is not affine: its color classes have 56, 59, 60, 61 and 64 edges, not the affine 50, 50, 50, 50 and 100. Consistent with Theorem 1, it does not extend to .
The method. The proof instantiates a reusable template for extremal existence questions: reduce the existence question to a property of one sparse substructure with parameters in a narrow range; dispatch the extreme parameter values analytically with stability theorems, which apply precisely at near-extremal values; and enumerate the remaining mid-range values exhaustively with SAT modulo symmetries. The reduction grew from one observation: once one color class is fixed, deciding whether the remaining edges can be colored to complete a balanced coloring is essentially instant already at r = 4, while the single balanced-coloring formula is out of reach. The hard part is ranging over all candidate classes, an isomorph-free generation problem.
Related work. The Boolean Pythagorean triples problem [15] and Schur number five [14] were settled by massive cube-and-conquer refutations with DRAT certificates, and in both the solver carries essentially the entire case distinction, with no mathematical reduction in front of it. Other major certificate-backed SAT computations include the resolution of Keller's conjecture [4]. More recently, the empty-hexagon number [25] combines SAT certification with a reduction formalized in an interactive theorem prover. SAT modulo symmetries [20] brought isomorph-free generation into the solver, with cube-and-conquer strategies tailored to it [19] and a formally verified extension that checks the symmetry reasoning in Lean [17]. A side condition like property (L), whose violation is witnessed by a single 6-set spanning at least 12 edges, can instead be enforced inside the solver by co-certificate learning [18], which turns each such witness into a learned clause, but generating the base family and imposing a sound restricted (L) is simpler at our scale. Pairing an analytic reduction with a certified search is an established pattern: the nonexistence of a projective plane of order 10 was settled this way by Lam, Thiel, and Swiercz [21] and re-established with a SAT certificate [5], and isomorph-free generation of the sparse side is standard since McKay [22]. What is specific here is that both halves are checked: the reduction in Lean, and every cell by an independent refutation.
8 Conclusion
We settled the Erdős–Gyárfás balanced-coloring conjecture for , the first new case since 1999: is the largest complete graph with a balanced 5-coloring. The proof reduces the conjecture to an extremal lemma about one color class, dispatches the near-extremal counts analytically, and settles the rest by a certified enumeration, with every computational step checked by a program separate from the search. The next case, , is of independent interest: 6 is not a prime power, so no affine plane of order 6 exists, and it is open whether even has a balanced 6-coloring.
Acknowledgments The authors acknowledge the support by the European Union's Horizon 2020 research and innovation programme under the Maria Skłodowska-Curie grant agreement No. 101034440, and the support from the Austrian Science Fund (FWF), project 10.55776/P36688, 10.55776/P36420 and 10.55776/COE12.
Use of AI assistants We used generative AI tools to implement the Lean formalizations. We also used AI tools to draft and edit text and figures. We reviewed all AI-assisted work. Code and proofs are checked by tests and the Lean kernel. We take responsibility for the final content of this paper, including text, claims and artifacts produced with the aid of generative AI.
References
[1] Anonymous. Anonymized research artifact (code, proofs and data). Zenodo, 2026. Access link for reviewers.
[2] Armin Biere, Tobias Faller, Katalin Fazekas, Mathias Fleury, Nils Froleyks, and Florian Pollitt. CaDiCaL 2.0. In Computer Aided Verification (CAV), volume 14681 of Lecture Notes in Computer Science, pages 133–152. Springer, 2024.
[3] Armin Biere, Katalin Fazekas, Mathias Fleury, and Maximilian Heisinger. CaDiCaL, Kissat, Paracooba, Plingeling and Treengeling entering the SAT Competition 2020. In Tomáš Balyo, Nils Froleyks, Marijn Heule, Markus Iser, Matti Järvisalo, and Martin Suda, editors, Proceedings of SAT Competition 2020: Solver and Benchmark Descriptions, volume B-2020-1 of Department of Computer Science Report Series B, pages 50–53. University of Helsinki, 2020.
[4] Joshua Brakensiek, Marijn Heule, John Mackey, and David E. Narváez. The resolution of Keller's conjecture. Journal of Automated Reasoning, 66(3):277–300, 2022.
19

[5] Curtis Bright, Kevin K. H. Cheung, Brett Stevens, Ilias S. Kotsireas, and Vijay Ganesh. A SAT-based resolution of Lam’s problem. In Proceedings of the 35th AAAI Conference on Artificial Intelligence (AAAI), pages 3669–3676. AAAI Press, 2021.
[6] R. L. Brooks. On colouring the nodes of a network. Mathematical Proceedings of the Cambridge Philosophical Society, 37(2):194–197, 1941.
[7] Andries E. Brouwer. Some lotto numbers from an extension of Turán’s theorem. Technical Report ZW 152/81, Mathematisch Centrum, Amsterdam, 1981. Zbl 0443.05032.
[8] Yair Caro. New results on the independence number. Technical report, Tel-Aviv University, 1979.
[9] K. M. Chung and C. L. Liu. A generalization of Ramsey theory for graphs. Discrete Mathematics, 21(2):117–127, 1978. doi:10.1016/0012-365X(78)90084-5.
[10] James M. Crawford, Matthew L. Ginsberg, Eugene M. Luks, and Amitabha Roy. Symmetry-breaking predicates for search problems. In Proceedings of the 5th International Conference on Principles of Knowledge Representation and Reasoning (KR), pages 148–159. Morgan Kaufmann, 1996.
[11] Paul Erdős and András Gyárfás. Split and balanced colorings of complete graphs. Discrete Mathematics, 200(1–3):79–86, 1999.
[12] R. E. Greenwood and A. M. Gleason. Combinatorial relations and chromatic graphs. Canadian Journal of Mathematics, 7:1–7, 1955.
[13] Marijn Heule, Oliver Kullmann, Siert Wieringa, and Armin Biere. Cube and conquer: Guiding CDCL SAT solvers by lookahead. In Hardware and Software: Verification and Testing (HVC), volume 7261 of Lecture Notes in Computer Science, pages 50–65. Springer, 2011.
[14] Marijn J. H. Heule. Schur number five. In Proceedings of the 32nd AAAI Conference on Artificial Intelligence (AAAI), pages 6598–6606. AAAI Press, 2018.
[15] Marijn J. H. Heule, Oliver Kullmann, and Victor W. Marek. Solving and verifying the Boolean Pythagorean triples problem via cube-and-conquer. In Theory and Applications of Satisfiability Testing (SAT), volume 9710 of Lecture Notes in Computer Science, pages 228–245. Springer, 2016.
[16] Mihyun Kang and Oleg Pikhurko. Maximum -free graphs which are not r-partite. Matematychni Studii, 24(1):12–20, 2005.
[17] Markus Kirchweger, Pablo Manrique, and Stefan Szeider. Formally verified graph generation with SAT modulo symmetries and Lean. In Armin Biere, Carsten Lutz, and Sara Negri, editors, Automated Reasoning (IJCAR), volume 16688 of Lecture Notes in Computer Science, pages 117–135. Springer, 2026. doi:10.1007/978-3-032-32589-1_8.
[18] Markus Kirchweger, Tomáš Peitl, and Stefan Szeider. Co-certificate learning with SAT modulo symmetries. In Proceedings of the 32nd International Joint Conference on Artificial Intelligence (IJCAI), pages 1944–1953, 2023.
[19] Markus Kirchweger, Tomáš Peitl, Stefan Szeider, and Hai Xia. Smart cubing for graph search: A comparative study. In Principles and Practice of Constraint Programming (CP), volume 379 of LIPIcs, pages 33:1–33:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2026.
[20] Markus Kirchweger and Stefan Szeider. SAT modulo symmetries for graph generation and enumeration. ACM Transactions on Computational Logic, 25(3):1–30, 2024.
[21] C. W. H. Lam, L. Thiel, and S. Swiercz. The non-existence of finite projective planes of order 10. Canadian Journal of Mathematics, 41(6):1117–1123, 1989. doi:10.4153/CJM-1989-049-4.
[22] Brendan D. McKay. Isomorph-free exhaustive generation. Journal of Algorithms, 26(2):306–324, 1998.
[23] Laurent Perron, Frédéric Didier, and Steven Gay. The CP-SAT-LP solver. In Proceedings of the 29th International Conference on Principles and Practice of Constraint Programming (CP), volume 280 of LIPIcs, pages 3:1–3:2. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023.
[24] Carsten Sinz. Towards an optimal CNF encoding of boolean cardinality constraints. In Principles and Practice of Constraint Programming (CP), volume 3709 of Lecture Notes in Computer Science, pages 827–831. Springer, 2005.
[25] Bernardo Subercaseaux, Wojciech Nawrocki, James Gallicchio, Cayden R. Codel, Mario Carneiro, and Marijn J. H. Heule. Formal verification of the empty hexagon number. In Interactive Theorem Proving (ITP), volume 309 of LIPIcs, pages 35:1–35:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024.
[26] The mathlib Community. The Lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs (CPP), pages 367–381. ACM, 2020.
[27] Pál Turán. Eine Extremalaufgabe aus der Graphentheorie. Matematikai és Fizikai Lapok, 48:436–452, 1941. In Hungarian, with a German summary. Zbl 0026.26903.
[28] Victor K. Wei. A lower bound on the stability number of a simple graph. Technical Report TM 81-11217-9, Bell Laboratories, 1981.
[29] Nathan Wetzler, Marijn J. H. Heule, and Warren A. Hunt Jr. DRAT-trim: Efficient checking and trimming using expressive clausal proofs. In Theory and Applications of Satisfiability Testing (SAT), volume 8561 of Lecture Notes in Computer Science, pages 422–429. Springer, 2014.
A The Lean Contract
Listing 1 shows the definitions and theorem statements of the Lean development discussed in Section 6. Lean notation used in it: SimpleGraph v is a simple graph on the vertex type v, with adjacency relation G.Adj; Finset V is a finite set of vertices, S.card its size, and S.filter p the elements of S satisfying p; p.1 and p.2 are the components of a pair; Fintype.card V is the number of elements of V; Prop is the type of propositions; noncomputable marks a definition that Lean does not compile to executable code; and the omitted fields symm and loopless of classGraph prove that adjacency is symmetric and irreflexive.
Listing 1: The contract of the Lean development: definitions and theorem statements as they appear in the source (Basic.lean, EdgeBound.lean, IsoInvariance.lean), proofs omitted. The vertex types v and w, the graphs g and g' of the last two lemmas and, where needed, decidable equality and finiteness are implicit section variables.
def classGraph (c : Sym2 V → Fin 5) (k : Fin 5) : SimpleGraph V where Adj v w := v ≠ w ∧ c s(v, w) = k -- symm, loopless: proofs omitted def Balanced (c : Sym2 V → Fin 5) : Prop := ∀ S : Finset V, S.card = 6 → ∀ k : Fin 5, ∃ v ∈ S, ∃ w ∈ S, v ≠ w ∧ c s(v, w) = k def NoIndep6 (G : SimpleGraph V) : Prop := ∀ S : Finset V, S.card = 6 → ∃ v ∈ S, ∃ w ∈ S, G.Adj v w noncomputable def edgesOrdWithin (G : SimpleGraph V) (S : Finset V) : N := (S.offDiag.filter (fun p => G.Adj p.1 p.2)).card def PropertyL (G : SimpleGraph V) : Prop := ∀ S : Finset V, S.card = 6 → edgesOrdWithin G S ≤ 22
theorem noIndep6_classGraph (c : Sym2 V → Fin 5) (hc : Balanced c) (k : Fin 5) : NoIndep6 (classGraph c k)
theorem propertyL_classGraph (c : Sym2 V → Fin 5) (hc : Balanced c) (k : Fin 5) : PropertyL (classGraph c k)
theorem exists_class_le_65 (c : Sym2 V → Fin 5) (hcard : Fintype.card V = 26) : ∃ k : Fin 5, (classGraph c k).edgeFinset.card ≤ 65
theorem card_edgeFinset_ge_55 (hcard : Fintype.card V = 26) (G : SimpleGraph V) [DecidableRel G.Adj] (hA : NoIndep6 G) : 55 ≤ G.edgeFinset.card
theorem no_balanced_5_colouring_of_mainLemma (step_sms_full : ∀ (G : SimpleGraph V) [DecidableRel G.Adj], NoIndep6 G → PropertyL G → ¬ (55 ≤ G.edgeFinset.card ∧ G.edgeFinset.card ≤ 65)) (hcard : Fintype.card V = 26) (c : Sym2 V → Fin 5) : ¬ Balanced c
theorem noIndep6_iso (f : G ≈ g G') : NoIndep6 G ↔ NoIndep6 G'
theorem propertyL_iso (f : G ≈ g G') : PropertyL G ↔ PropertyL G'