AFTD Auto-Formalizing Theoretical Domains

grid57_seven_column_repetition_bound_via_choose

theoremverified

For any set of seven column positions, its size is at most one more than the number of increasing pairs it contains.

Statement

theorem grid57_seven_column_repetition_bound_via_choose (g : Fin 7 → Bool) :
    ((Finset.univ : Finset (Fin 7)).filter (fun y => g y = true)).card ≤
      ((Finset.univ : Finset (Fin 7 × Fin 7)).filter
        (fun p => p.1 < p.2 ∧ g p.1 = true ∧ g p.2 = true)).card + 1
Source
OP-1867: row-pair/color class repetition, related to arXiv:2611.19635 section 6.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

The theorem states that for any boolean predicate g on a 7-element set, the number of satisfying elements |s| is at most one more than the number of increasing satisfying pairs. The proof first identifies the count of such increasing pairs with the binomial coefficient (|s| choose 2). Since s is a subset of Fin 7, its cardinality satisfies |s| ≤ 7, and the resulting inequality |s| ≤ (|s| choose 2) + 1 is verified by exhaustive computation over all eight possible values |s| ∈ {0, ..., 7}.

  1. Let s be the subset of Fin 7 on which g is true; then |s| ≤ 7.

    We define s ⊆ Fin 7 as the set of elements y such that g y = true. Because Fin 7 has 7 elements, any of its subsets has cardinality at most 7 by Finset.card_le_univ.

    lines 9–11

    uses Finset.card_le_univ

      let s : Finset (Fin 7) := Finset.univ.filter (fun y => g y = true)
      have hs : s.card ≤ 7 := by
        simpa using Finset.card_le_univ s
  2. The number of increasing pairs (p₁, p₂) on which g is true equals (|s| choose 2).

    By Finset.card_product_filter_lt, the number of pairs (p₁, p₂) ∈ s × s with p₁ < p₂ is (|s| choose 2). Congruence reduces the claim to showing that the set of satisfying pairs in Fin 7 × Fin 7 equals {p ∈ s × s | p₁ < p₂}. By extensionality, a pair p belongs to the first set if and only if p₁ < p₂ and g p₁ = true and g p₂ = true. Unfolding the definition of s with Finset.mem_filter, Finset.mem_product, Finset.mem_univ, and true_and, and rearranging conjunctions using and_assoc, and_left_comm, and and_comm, shows this is equivalent to (p₁ ∈ s ∧ p₂ ∈ s) ∧ p₁ < p₂, which is membership in the second set.

    lines 12–18

    uses Finset.card_product_filter_lt, Finset.mem_filter, Finset.mem_product, Finset.mem_univ, true_and, and_assoc, and_left_comm, and_comm

      have hp : ((Finset.univ : Finset (Fin 7 × Fin 7)).filter
            (fun p => p.1 < p.2 ∧ g p.1 = true ∧ g p.2 = true)).card = s.card.choose 2 := by
        rw [← Finset.card_product_filter_lt (s := s)]
        congr 1
        ext p
        simp only [Finset.mem_filter, Finset.mem_product, Finset.mem_univ, true_and]
        simp [s, and_assoc, and_left_comm, and_comm]
  3. The main goal reduces to showing that |s| ≤ (|s| choose 2) + 1.

    Rewriting with the pair-count equality replaces the pair count with (|s| choose 2), reducing the required inequality to |s| ≤ (|s| choose 2) + 1.

    lines 19–20

      rw [hp]
      change s.card ≤ Nat.choose s.card 2 + 1
  4. The inequality |s| ≤ (|s| choose 2) + 1 holds.

    Since |s| ≤ 7, the cardinality |s| must be an integer between 0 and 7. The tactic interval_cases splits into the eight cases |s| ∈ {0, 1, 2, 3, 4, 5, 6, 7}, and norm_num verifies the inequality by direct numerical evaluation of (k choose 2) + 1 in each case.

    line 21

      interval_cases hs' : s.card <;> norm_num [hs', Nat.choose]
Finset.card_le_univ
The cardinality of any finite subset of a finite type is at most the cardinality of the whole type.
Finset.card_product_filter_lt
In any linearly ordered finite set s, the number of pairs (x, y) in s × s with x < y equals (card s choose 2).
Finset.mem_filter
An element x belongs to Finset.filter p s if and only if x is in s and p x holds.
Finset.mem_product
A pair (x, y) belongs to the Cartesian product s × t if and only if x is in s and y is in t.
Finset.mem_univ
Every element of a finite type belongs to the universal finset.
true_and
The conjunction of True with any proposition p is logically equivalent to p.
and_assoc
Logical conjunction is associative: ((a ∧ b) ∧ c) is equivalent to (a ∧ b ∧ c).
and_left_comm
Conjunction satisfies left-commutativity: (a ∧ b ∧ c) is equivalent to (b ∧ a ∧ c).
and_comm
Logical conjunction is commutative: (a ∧ b) is equivalent to (b ∧ a).

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 maxHeartbeats 4000000set_option maxRecDepth 10000set_option linter.all falsetheorem grid57_seven_column_repetition_bound_via_choose (g : Fin 7 → Bool) :    ((Finset.univ : Finset (Fin 7)).filter (fun y => g y = true)).card ≤      ((Finset.univ : Finset (Fin 7 × Fin 7)).filter        (fun p => p.1 < p.2 ∧ g p.1 = true ∧ g p.2 = true)).card + 1 := by  let s : Finset (Fin 7) := Finset.univ.filter (fun y => g y = true)  have hs : s.card ≤ 7 := by    simpa using Finset.card_le_univ s  have hp : ((Finset.univ : Finset (Fin 7 × Fin 7)).filter        (fun p => p.1 < p.2 ∧ g p.1 = true ∧ g p.2 = true)).card = s.card.choose 2 := by    rw [← Finset.card_product_filter_lt (s := s)]    congr 1    ext p    simp only [Finset.mem_filter, Finset.mem_product, Finset.mem_univ, true_and]    simp [s, and_assoc, and_left_comm, and_comm]  rw [hp]  change s.card ≤ Nat.choose s.card 2 + 1  interval_cases hs' : s.card <;> norm_num [hs', Nat.choose]
See it in the graphDiscuss this resultChallenge it