AFTD Auto-Formalizing Theoretical Domains

four_by_five_defect_incidence_impossible

theoremverified

A relation between sets of sizes four and five cannot give each of the five vertices at least two neighbors while giving each of the four vertices at most two neighbors.

Statement

theorem four_by_five_defect_incidence_impossible
    {V : Type*} [DecidableEq V] (A C : Finset V) (R : V → V → Prop) [DecidableRel R]
    (hA : A.card = 4) (hC : C.card = 5)
    (hupper : ∀ a ∈ A, (C.filter (R a)).card ≤ 2)
    (hlower : ∀ c ∈ C, 2 ≤ (A.filter (fun a => R a c)).card) : False
Source
OP-1957: degree and incidence bounds for the size-five block route.
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 4

The proof, explained

The proof proceeds by double-counting the total number of incidences between A and C. Summing the degree lower bound of 2 over all five vertices in C shows there must be at least 10 incidences, whereas summing the degree upper bound of 2 over all four vertices in A shows there can be at most 8 incidences. Exchanging the order of summation equates these two counts, yielding the contradiction 10 ≤ 8.

  1. The sum of in-degrees over C is at least 10, while the sum of out-degrees over A is at most 8.

    Every vertex c ∈ C has at least 2 neighbors in A, so summing this lower bound over C using `Finset.sum_le_sum` gives ∑ c ∈ C, 2 ≤ ∑ c ∈ C, |{a ∈ A | R a c}|. Because |C| = 5, the left-hand sum evaluates to 2 · 5 = 10. Similarly, every vertex a ∈ A has at most 2 neighbors in C, so summing this upper bound over A using `Finset.sum_le_sum` gives ∑ a ∈ A, |{c ∈ C | R a c}| ≤ ∑ a ∈ A, 2. Because |A| = 4, the right-hand sum evaluates to 2 · 4 = 8.

    lines 6–14

    uses Finset.sum_le_sum

      classical
      have hl : (∑ c ∈ C, (2 : ℕ)) ≤ ∑ c ∈ C, (A.filter (fun a => R a c)).card :=
        Finset.sum_le_sum hlower
      have hu : (∑ a ∈ A, (C.filter (R a)).card) ≤ ∑ a ∈ A, (2 : ℕ) :=
        Finset.sum_le_sum hupper
      have hl' : 10 ≤ ∑ c ∈ C, (A.filter (fun a => R a c)).card := by
        simpa [hC] using hl
      have hu' : (∑ a ∈ A, (C.filter (R a)).card) ≤ 8 := by
        simpa [hA] using hu
  2. The sum of in-degrees over C equals the sum of out-degrees over A: ∑ c ∈ C, |{a ∈ A | R a c}| = ∑ a ∈ A, |{c ∈ C | R a c}|.

    The cardinality of each neighborhood is rewritten as a sum of ones using `Finset.card_eq_sum_ones`, and then as a sum of indicator functions (if R a c then 1 else 0) using `Finset.sum_filter`. Exchanging the order of summation with `Finset.sum_comm` demonstrates that both sums count the total number of related pairs (a, c) ∈ A × C.

    lines 15–18

    uses Finset.card_eq_sum_ones, Finset.sum_filter, Finset.sum_comm

      have heq : (∑ c ∈ C, (A.filter (fun a => R a c)).card) =
          ∑ a ∈ A, (C.filter (R a)).card := by
        simp only [Finset.card_eq_sum_ones, Finset.sum_filter]
        exact Finset.sum_comm
  3. A contradiction is reached.

    Denoting the total number of incidences by S, the previous steps establish that 10 ≤ S and S ≤ 8. This implies 10 ≤ 8, which is an immediate arithmetic contradiction resolved by `omega`.

    line 19

      omega
Finset.sum_le_sum
If f(x) ≤ g(x) for all x in a finite set s, then ∑ x ∈ s, f(x) ≤ ∑ x ∈ s, g(x).
Finset.card_eq_sum_ones
The cardinality of a finite set s is equal to the sum of 1 over all elements of s.
Finset.sum_filter
The sum of a function over the elements of a finite set satisfying a predicate equals the sum over the entire set with terms where the predicate fails replaced by 0.
Finset.sum_comm
The order of summation in a double sum over two finite sets can be exchanged.

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

theorem four_by_five_defect_incidence_impossible    {V : Type*} [DecidableEq V] (A C : Finset V) (R : V → V → Prop) [DecidableRel R]    (hA : A.card = 4) (hC : C.card = 5)    (hupper : ∀ a ∈ A, (C.filter (R a)).card ≤ 2)    (hlower : ∀ c ∈ C, 2 ≤ (A.filter (fun a => R a c)).card) : False := by  classical  have hl : (∑ c ∈ C, (2 : ℕ)) ≤ ∑ c ∈ C, (A.filter (fun a => R a c)).card :=    Finset.sum_le_sum hlower  have hu : (∑ a ∈ A, (C.filter (R a)).card) ≤ ∑ a ∈ A, (2 : ℕ) :=    Finset.sum_le_sum hupper  have hl' : 10 ≤ ∑ c ∈ C, (A.filter (fun a => R a c)).card := by    simpa [hC] using hl  have hu' : (∑ a ∈ A, (C.filter (R a)).card) ≤ 8 := by    simpa [hA] using hu  have heq : (∑ c ∈ C, (A.filter (fun a => R a c)).card) =      ∑ a ∈ A, (C.filter (R a)).card := by    simp only [Finset.card_eq_sum_ones, Finset.sum_filter]    exact Finset.sum_comm  omega
See it in the graphDiscuss this resultChallenge it