AFTD Auto-Formalizing Theoretical Domains

grid_box_free_max_eq_fifty_of_not_exists_fifty_one

theoremverified

If the grid $[5] \times [7] \times [50]$ admits a box-free $2$-coloring and $[5] \times [7] \times [51]$ admits no box-free $2$-coloring, then $N(5, 7) = 50$.

Statement

theorem grid_box_free_max_eq_fifty_of_not_exists_fifty_one (h50 : ∃ f : Fin 5 → Fin 7 → Fin 50 → Bool, grid_box_free f) (h51 : ¬ ∃ f : Fin 5 → Fin 7 → Fin 51 → Bool, grid_box_free f) : grid_box_free_max 5 7 = 50
Source
arXiv:2611.19635 (Constructive and computational methods for extremal and near-extremal box colorings), Sec. 6
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • grid_box_free_maxThe parameter $N(a, b)$ is the maximum integer $c$ such that the grid $[a] \times [b] \times [c]$ admits an axis-parallel box-free…
  • 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…
  • grid_box_free_of_leIf $c' \le c$ and $f$ is a box-free $2$-coloring of $[a] \times [b] \times [c]$, then the restriction of $f$ to…

Read back from the Lean

Under the hypotheses that: 1. (h50) there exists a function f : Fin 5 → Fin 7 → Fin 50 → Bool satisfying grid_box_free f, and 2. (h51) there does not exist any function f : Fin 5 → Fin 7 → Fin 51 → Bool satisfying grid_box_free f, the value grid_box_free_max 5 7 is equal to 50.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The theorem states that if the $5 \times 7$ grid can be 2-colored box-freely up to depth 50 but not at depth 51, the maximum depth $N(5, 7)$ is 50. The proof shows that 50 is the greatest element of the set of depths admitting a box-free coloring: depth 50 is colorable by assumption, and any depth $c > 50$ would restrict to a valid box-free coloring at depth 51, contradicting the non-existence assumption. Since 50 is the greatest element of the set, the supremum defining $N(5, 7)$ is 50.

  1. To show that `grid_box_free_max 5 7 = 50`, it suffices to show that $50$ is the greatest element of the set of layer counts $c$ for which a box-free coloring exists, which reduces to showing that $50$ is an upper bound.

    We introduce the intermediate assertion `hg` stating that $50$ is the greatest element (`IsGreatest`) of the set of colorable grid depths. By definition, an element is the greatest if it belongs to the set and is an upper bound for it. The hypothesis `h50` immediately supplies membership, leaving the upper-bound condition to be proved.

    lines 3–4

      have hg : IsGreatest {c : ℕ | ∃ f : Fin 5 → Fin 7 → Fin c → Bool, grid_box_free f} 50 := by
        refine ⟨h50, ?_⟩
  2. Assume for contradiction that there exists a layer count $c > 50$ admitting a box-free coloring.

    To show $50$ is an upper bound, let $c$ be any layer count admitting a box-free coloring $f$. We assume for contradiction that $c > 50$ (which for natural numbers means $51 \le c$).

    lines 5–7

        intro c hc
        rcases hc with ⟨f, hf⟩
        by_contra! hgt
  3. The existence of a box-free coloring on $c > 50$ layers yields a box-free coloring on $51$ layers, contradicting `h51`.

    Since $51 \le c$, restricting $f$ to the first $51$ layers produces a box-free coloring of $[5] \times [7] \times [51]$ via `grid_box_free_of_le`. This directly contradicts the hypothesis `h51` that no such coloring exists, completing the proof that $50$ is an upper bound and thus the greatest element `hg`.

    lines 8–10

    uses grid_box_free_of_le

        have h51_ex : ∃ f' : Fin 5 → Fin 7 → Fin 51 → Bool, grid_box_free f' :=
          ⟨fun x y z => f x y (z.castLE hgt), grid_box_free_of_le hgt hf⟩
        exact h51 h51_ex
  4. The maximum layer count `grid_box_free_max 5 7` equals $50$.

    By definition, `grid_box_free_max 5 7` is the supremum of the set of depths admitting a box-free coloring. Since $50$ is the greatest element of this set (`hg`), its supremum is $50$, concluding the proof.

    line 11

      exact hg.csSup_eq
grid_box_free_of_le
If $c' \le c$ and a 3D grid $[a] \times [b] \times [c]$ has a box-free coloring $f$, then restricting $f$ along the third coordinate to $[a] \times [b] \times [c']$ also yields a box-free coloring.

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

/-- If 50 layers are colorable but 51 are not, then N(5, 7) = 50. -/theorem grid_box_free_max_eq_fifty_of_not_exists_fifty_one (h50 : ∃ f : Fin 5 → Fin 7 → Fin 50 → Bool, grid_box_free f) (h51 : ¬ ∃ f : Fin 5 → Fin 7 → Fin 51 → Bool, grid_box_free f) : grid_box_free_max 5 7 = 50 := by  have hg : IsGreatest {c : ℕ | ∃ f : Fin 5 → Fin 7 → Fin c → Bool, grid_box_free f} 50 := by    refine ⟨h50, ?_⟩    intro c hc    rcases hc with ⟨f, hf⟩    by_contra! hgt    have h51_ex : ∃ f' : Fin 5 → Fin 7 → Fin 51 → Bool, grid_box_free f' :=      ⟨fun x y z => f x y (z.castLE hgt), grid_box_free_of_le hgt hf⟩    exact h51 h51_ex  exact hg.csSup_eq
See it in the graphDiscuss this resultChallenge it