AFTD Auto-Formalizing Theoretical Domains

ordered_patterns_five_seven_card

theoremverified

The $5\times 7$ grid has exactly $2\binom52\binom72 = 420$ ordered coloured rectangle slots.

Statement

theorem ordered_patterns_five_seven_card : (ordered_patterns 5 7).card = 420
Source
step towards grid_box_free_max_five_seven
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • 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…
  • 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…
Used by 3

The proof, explained

The theorem states that there are exactly 420 ordered coloured rectangle slots in a $5 \times 7$ grid. Because the set of patterns is defined by filtering a finite product of `Fin` and `Bool` types with decidable inequalities, the cardinality assertion is decidable. The proof proceeds entirely by computational evaluation using the `decide` tactic, which exhaustively enumerates the valid configurations.

  1. (ordered_patterns 5 7).card = 420 automation

    The proposition is verified by finite computational reflection. Because `BoxPattern 5 7` is built from finite types (`Fin 5`, `Fin 7`, and `Bool`) and the filtering conditions ($r_1 < r_2$ and $c_1 < c_2$) are decidable, Lean evaluates the cardinality of the resulting finite set by exhaustive enumeration and verifies that it equals 420.

    line 5

    theorem ordered_patterns_five_seven_card : (ordered_patterns 5 7).card = 420 := by decide

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

set_option maxRecDepth 10000set_option maxHeartbeats 1200000/-- There are 420 coloured rectangle slots in the $5\times 7$ grid. -/theorem ordered_patterns_five_seven_card : (ordered_patterns 5 7).card = 420 := by decide
See it in the graphDiscuss this resultChallenge it