layer_mono_five_seven_ge_eight
Every $2$-colouring of the $5\times 7$ grid contains at least $8$ monochromatic rectangles, counting both colours: $\rho(5,7) \ge 8$. Combined with the layer bound this yields $N(5,7)\le 52$.
Statement
theorem layer_mono_five_seven_ge_eight (h : Fin 5 → Fin 7 → Bool) : 8 ≤ (layer_mono (fun x y (_ : Fin 1) => h x y) 0).card
- Source
- step towards grid_box_free_max_five_seven
- Verified
- 28 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 5
- layer_monoFor a $2$-colouring $f$ of $[a]\times[b]\times[c]$ and a layer index $z$, $\mathrm{layer\_mono}(f,z)$ is the finite set of coloured…
- grid57_column_agreementsThe number of agreeing unordered row pairs in a column of a binary five-by-seven layer.
- grid57_agreements_le_rectangles_add_twentyThe total column agreements are at most the number of monochromatic rectangles plus twenty.
- BoxPatternA coloured rectangle pattern in an $a\times b$ grid: a pair of rows $x_1<x_2$, a pair of columns $y_1<y_2$, and a colour, encoded as the…
- cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…
- Used by 3
- grid_five_seven_fifty_one_at_most_six_unbalanced_layersA box-free five-by-seven-by-fifty-one binary coloring has at most six layers containing an unbalanced column.
- grid_five_seven_fifty_one_many_minimum_layersEvery box-free binary coloring of a five-by-seven-by-fifty-one grid has at least thirty-nine layers with exactly eight monochromatic…
- grid57_stack_at_most_fifty_twoEvery box-free binary coloring of a five-by-seven-by-n grid has at most 52 layers.
The proof, explained
To show that every 2-colouring of the $5 \times 7$ grid contains at least 8 monochromatic rectangles, the proof double-counts monochromatic pairs of cells in each column. First, a pigeonhole argument (verified by exhaustive check over all $2^5 = 32$ boolean 5-tuples) shows that every column of length 5 has at least 4 agreeing pairs of rows, giving at least $7 \times 4 = 28$ agreements across the 7 columns. Combining this lower bound with the known upper bound that total column agreements cannot exceed the number of monochromatic rectangles plus 20, linear arithmetic establishes that there are at least $28 - 20 = 8$ monochromatic rectangles.
Any boolean 5-tuple has at least 4 pairs of matching entries.
We define `count g` to be the number of pairs $i < j$ in $\{0, 1, 2, 3, 4\}$ where $g(i) = g(j)$. By exhaustive evaluation of all $2^5 = 32$ possible boolean 5-tuples (`decide`), Lean verifies that every 5-tuple satisfies $4 \le \text{count} ![a, b, c, d, e]$, matching the pigeonhole bound $\binom{3}{2} + \binom{2}{2} = 4$.
let count (g : Fin 5 → Bool) := ((Finset.univ : Finset (Fin 5 × Fin 5)).filter (fun p => p.1 < p.2 ∧ g p.1 = g p.2)).card have columns : ∀ a b c d e : Bool, 4 ≤ count ![a,b,c,d,e] := by unfold count decide
Every column of a $5 \times 7$ grid contains at least 4 monochromatic pairs of cells.
We define $\text{col}$ to be the $j$-th column $i \mapsto f(i, j)$. By function extensionality (`funext`) and finite case exhaustion on $\text{Fin } 5$ (`fin_cases`), $\text{col}$ equals the explicit 5-tuple of its entries. Rewriting by this equality allows us to apply the 5-tuple bound from the previous step, establishing $4 \le \text{grid57_column_agreements } f\ j$.
let col : Fin 5 → Bool := fun i => f i j have hcol : col = ![col 0,col 1,col 2,col 3,col 4] := by funext x fin_cases x <;> rfl change 4 ≤ count col rw [hcol] apply columns
The sum of column agreements across all 7 columns is at least 28.
We sum the per-column lower bound $4 \le \text{grid57_column_agreements } h\ j$ over all $j \in \text{Fin } 7$ using `Finset.sum_le_sum`. Since the grid has 7 columns, the sum of 4 over all columns simplifies (`simpa`) to $7 \times 4 = 28$.
uses
Finset.sum_le_sum,grid57EachColumnFourhave hsum := Finset.sum_le_sum (s := Finset.univ) (fun j _ => grid57EachColumnFour h j) have low : 28 ≤ ∑ j, grid57_column_agreements h j := by simpa using hsum
The grid contains at least 8 monochromatic rectangles.
We invoke `grid57_agreements_le_rectangles_add_twenty`, which bounds the total number of column agreements from above by the number of monochromatic rectangles plus 20. Combining this with the lower bound of 28 from the previous step, linear integer arithmetic (`omega`) deduces that the number of monochromatic rectangles is at least $28 - 20 = 8$.
uses
grid57_agreements_le_rectangles_add_twentyhave high := grid57_agreements_le_rectangles_add_twenty h omega
Finset.sum_le_sum- If $f(i) \le g(i)$ for all elements $i$ in a finite set $s$, then the sum of $f$ over $s$ is at most the sum of $g$ over $s$.
grid57EachColumnFour- In any 2-colouring of a $5 \times 7$ grid, each column contains at least 4 pairs of rows with the same colour.
grid57_agreements_le_rectangles_add_twenty- For any 2-colouring of a $5 \times 7$ grid, the sum over all columns of the number of agreeing row pairs is at most the number of monochromatic rectangles plus 20.
- The lemma that every column has at least 4 agreeing pairs (`grid57EachColumnFour`) is verified by exhaustive computation (`decide`) over all $2^5 = 32$ boolean 5-tuples, rather than an explicit pigeonhole calculation.
- The 2D grid colouring $h$ is formally embedded as a single layer of a 3D grid with depth 1 (`Fin 1`), which is why the theorem statement refers to `layer_mono (fun x y (_ : Fin 1) => h x y) 0`.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option maxRecDepth 10000set_option maxHeartbeats 1200000private theorem grid57EachColumnFour (f : Fin 5 → Fin 7 → Bool) (j : Fin 7) : 4 ≤ grid57_column_agreements f j := by let count (g : Fin 5 → Bool) := ((Finset.univ : Finset (Fin 5 × Fin 5)).filter (fun p => p.1 < p.2 ∧ g p.1 = g p.2)).card have columns : ∀ a b c d e : Bool, 4 ≤ count ![a,b,c,d,e] := by unfold count decide let col : Fin 5 → Bool := fun i => f i j have hcol : col = ![col 0,col 1,col 2,col 3,col 4] := by funext x fin_cases x <;> rfl change 4 ≤ count col rw [hcol] apply columns/-- $\rho(5,7)\ge 8$: every $5\times7$ layer has at least 8 monochromatic rectangles (both colours counted). -/theorem layer_mono_five_seven_ge_eight (h : Fin 5 → Fin 7 → Bool) : 8 ≤ (layer_mono (fun x y (_ : Fin 1) => h x y) 0).card := by have hsum := Finset.sum_le_sum (s := Finset.univ) (fun j _ => grid57EachColumnFour h j) have low : 28 ≤ ∑ j, grid57_column_agreements h j := by simpa using hsum have high := grid57_agreements_le_rectangles_add_twenty h omega