grid_five_seven_fifty_one_many_minimum_layers
Every box-free binary coloring of a five-by-seven-by-fifty-one grid has at least thirty-nine layers with exactly eight monochromatic rectangles.
Statement
theorem grid_five_seven_fifty_one_many_minimum_layers (f : Fin 5 → Fin 7 → Fin 51 → Bool) (hf : grid_box_free f) : 39 ≤ ((Finset.univ : Finset (Fin 51)).filter (fun z => (layer_mono f z).card = 8)).card
- Source
- OP-1867: layer-packing count and arXiv:2611.19635 section 6.
- Verified
- 28 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 7
- grid_box_freeA 2-coloring $f : [a] \times [b] \times [c] \to \{0, 1\}$ is box-free if for all $x_1 < x_2 \le a$, $y_1 < y_2 \le b$, and…
- 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…
- layer_mono_card_sum_leLayer bound (Lemma 4.1 core): for a box-free colouring of $[a]\times[b]\times[c]$, the total number of monochromatic rectangles summed…
- layer_mono_five_seven_ge_eightEvery $2$-colouring of the $5\times 7$ grid contains at least $8$ monochromatic rectangles, counting both colours: $\rho(5,7) \ge 8$.…
- ordered_patterns_five_seven_cardThe $5\times 7$ grid has exactly $2\binom52\binom72 = 420$ ordered coloured rectangle slots.
- 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…
- ordered_patternsThe finite set of ordered coloured rectangle patterns of an $a\times b$ grid, i.e. the patterns with $x_1<x_2$ and $y_1<y_2$. Its…
The proof, explained
The proof uses an averaging and double-counting argument. Because the grid coloring is box-free, no monochromatic rectangle pattern can appear in two different layers, so the total number of monochromatic rectangles summed across all 51 layers cannot exceed the 420 patterns available on a 5-by-7 grid. Since every layer has at least 8 monochromatic rectangles and any layer not having 8 must have at least 9, the cardinalities |A| (layers with 8 rectangles) and |B| (layers with at least 9) satisfy |A| + |B| = 51 and 8|A| + 9|B| ≤ 420, forcing |A| ≥ 39.
The 51 layers of the grid are partitioned into sets A and B satisfying |A| + |B| = 51.
We define A to be the set of layers z having exactly 8 monochromatic rectangles, and B to be its complement (layers with any other count). Since A and B partition the 51 layers of the grid, their cardinalities sum to 51 by Finset.card_filter_add_card_filter_not.
uses
Finset.card_filter_add_card_filter_notlet A := (Finset.univ : Finset (Fin 51)).filter (fun z => (layer_mono f z).card = 8) let B := (Finset.univ : Finset (Fin 51)).filter (fun z => ¬((layer_mono f z).card = 8)) have hAB : A.card + B.card = 51 := by have h := Finset.card_filter_add_card_filter_not (s := Finset.univ) (fun z => (layer_mono f z).card = 8) simpa using h
Every layer contains at least 8 monochromatic rectangles.
Applying the known bound that any binary coloring of a 5-by-7 grid has at least 8 monochromatic rectangles (layer_mono_five_seven_ge_eight) to each individual layer z gives |layer_mono f z| ≥ 8.
uses
layer_mono_five_seven_ge_eighthave hl (z : Fin 51) : 8 ≤ (layer_mono f z).card := layer_mono_five_seven_ge_eight (fun x j => f x j z)
The sum of the rectangle counts over layers in A is at least 8 · |A|.
Since every layer in A has at least 8 monochromatic rectangles, summing this lower bound over all z ∈ A yields 8 · |A| ≤ ∑_{z ∈ A} |layer_mono f z| by Finset.card_nsmul_le_sum.
uses
Finset.card_nsmul_le_sum,nsmul_eq_mul,mul_commhave hA_le : 8 * A.card ≤ ∑ z ∈ A, (layer_mono f z).card := by have h := Finset.card_nsmul_le_sum (s := A) (f := fun z => (layer_mono f z).card) (n := 8) (fun z _ => hl z) simpa [nsmul_eq_mul, mul_comm] using h
The sum of the rectangle counts over layers in B is at least 9 · |B|.
For each layer z ∈ B, its rectangle count is an integer at least 8 and not equal to 8, which implies it is at least 9. Summing this bound over all z ∈ B yields 9 · |B| ≤ ∑_{z ∈ B} |layer_mono f z|.
uses
Finset.card_nsmul_le_sum,Finset.mem_filter,nsmul_eq_mul,mul_commhave hB_le : 9 * B.card ≤ ∑ z ∈ B, (layer_mono f z).card := by have h := Finset.card_nsmul_le_sum (s := B) (f := fun z => (layer_mono f z).card) (n := 9) (fun z hz => by rw [Finset.mem_filter] at hz have hne : (layer_mono f z).card ≠ 8 := hz.2 have h8 := hl z omega) simpa [nsmul_eq_mul, mul_comm] using h
The sum of the rectangle counts across all 51 layers is the sum over A plus the sum over B, and is at most 420.
By Finset.sum_filter_add_sum_filter_not, the total sum of monochromatic rectangles over all 51 layers splits into the sum over A and the sum over B. Because f is box-free, no monochromatic rectangle pattern can be repeated across distinct layers, bounding the total sum by the number of patterns on a 5-by-7 grid (layer_mono_card_sum_le), which is 420 (ordered_patterns_five_seven_card).
uses
Finset.sum_filter_add_sum_filter_not,layer_mono_card_sum_le,ordered_patterns_five_seven_cardhave hsplit : ∑ z ∈ A, (layer_mono f z).card + ∑ z ∈ B, (layer_mono f z).card = ∑ z : Fin 51, (layer_mono f z).card := Finset.sum_filter_add_sum_filter_not (s := Finset.univ) (p := fun z => (layer_mono f z).card = 8) (f := fun z => (layer_mono f z).card) have htot := layer_mono_card_sum_le f hf rw [ordered_patterns_five_seven_card] at htot
At least 39 layers have exactly 8 monochromatic rectangles (|A| ≥ 39).
Combining 8 · |A| + 9 · |B| ≤ ∑_{z} |layer_mono f z| ≤ 420 with |A| + |B| = 51 yields 8 · |A| + 9 · (51 - |A|) = 459 - |A| ≤ 420, which forces |A| ≥ 39 by linear arithmetic.
show 39 ≤ A.card omega
Finset.card_filter_add_card_filter_not- For any finite set s and predicate p, the number of elements in s satisfying p plus the number of elements not satisfying p equals the cardinality of s.
Finset.card_nsmul_le_sum- If every element x of a finite set s satisfies n ≤ f(x), then |s| · n is at most the sum of f over s.
Finset.mem_filter- An element belongs to {x ∈ s | p x} if and only if it belongs to s and satisfies p.
Finset.sum_filter_add_sum_filter_not- The sum of a function over a finite set s decomposes into the sum over elements satisfying p plus the sum over elements satisfying ¬p.
layer_mono_five_seven_ge_eight- Every binary coloring of a 5-by-7 grid contains at least 8 monochromatic rectangles.
layer_mono_card_sum_le- For any box-free coloring of a grid, the sum of the number of monochromatic rectangles across all layers is at most the total number of rectangle patterns on a single layer.
mul_comm- Multiplication is commutative: a * b = b * a.
nsmul_eq_mul- Scalar multiplication by a natural number n coincides with multiplication by n.
ordered_patterns_five_seven_card- There are exactly 420 rectangle patterns on a 5-by-7 grid.
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.
theorem grid_five_seven_fifty_one_many_minimum_layers (f : Fin 5 → Fin 7 → Fin 51 → Bool) (hf : grid_box_free f) : 39 ≤ ((Finset.univ : Finset (Fin 51)).filter (fun z => (layer_mono f z).card = 8)).card := by let A := (Finset.univ : Finset (Fin 51)).filter (fun z => (layer_mono f z).card = 8) let B := (Finset.univ : Finset (Fin 51)).filter (fun z => ¬((layer_mono f z).card = 8)) have hAB : A.card + B.card = 51 := by have h := Finset.card_filter_add_card_filter_not (s := Finset.univ) (fun z => (layer_mono f z).card = 8) simpa using h have hl (z : Fin 51) : 8 ≤ (layer_mono f z).card := layer_mono_five_seven_ge_eight (fun x j => f x j z) have hA_le : 8 * A.card ≤ ∑ z ∈ A, (layer_mono f z).card := by have h := Finset.card_nsmul_le_sum (s := A) (f := fun z => (layer_mono f z).card) (n := 8) (fun z _ => hl z) simpa [nsmul_eq_mul, mul_comm] using h have hB_le : 9 * B.card ≤ ∑ z ∈ B, (layer_mono f z).card := by have h := Finset.card_nsmul_le_sum (s := B) (f := fun z => (layer_mono f z).card) (n := 9) (fun z hz => by rw [Finset.mem_filter] at hz have hne : (layer_mono f z).card ≠ 8 := hz.2 have h8 := hl z omega) simpa [nsmul_eq_mul, mul_comm] using h have hsplit : ∑ z ∈ A, (layer_mono f z).card + ∑ z ∈ B, (layer_mono f z).card = ∑ z : Fin 51, (layer_mono f z).card := Finset.sum_filter_add_sum_filter_not (s := Finset.univ) (p := fun z => (layer_mono f z).card = 8) (f := fun z => (layer_mono f z).card) have htot := layer_mono_card_sum_le f hf rw [ordered_patterns_five_seven_card] at htot show 39 ≤ A.card omega