AFTD Auto-Formalizing Theoretical Domains

op869_incidence_degree_count

theoremverified

For a finite incidence relation in which each element of A is incident with at least d elements of B, and 1 ≤ r ≤ |A|, the incidence count |A|d is at most |B|(r−1) plus (|A|−(r−1)) times the number of elements of B incident with at least r elements of A.

Statement

theorem op869_incidence_degree_count {α β : Type} [DecidableEq α] [DecidableEq β] (A : Finset α) (B : Finset β)
    (R : α → β → Prop) [DecidableRel R] (d r : ℕ) :
    1 ≤ r → r ≤ A.card → (∀ a ∈ A, d ≤ (B.filter (R a)).card) →
    A.card * d ≤ B.card * (r - 1) +
      (A.card - (r - 1)) * (B.filter (fun b => r ≤ (A.filter (fun a => R a b)).card)).card
Source
arXiv:2610.41516, Lemma 2.2; double-counting step toward the three-colorable adversary construction.
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • op869_double_countDouble counting in a bipartite incidence: if every element x of A meets at least d elements of B, then for i ≤ |A|, |A|·d ≤ |B|·(i-1) +…
Used by 1
  • op869_repeated_color_incidenceSuppose there are KqD copies and fewer than K colors, and every copy contains at least q colors. If 1 ≤ q ≤ K and D ≥ 1, at least q colors…

The proof, explained

The theorem is proven by reducing the incidence relation to an abstract family of subsets and invoking a double-counting lemma (op869_double_count). For each element a ∈ A, its neighborhood in B is represented by the subset E(a) = {b ∈ B | R a b}. Applying the double-counting lemma bounds the incidence count |A|d in terms of |B|(r - 1) and the number of elements of B incident to at least r elements of A, after which a natural number arithmetic simplification completes the argument.

  1. Define the neighborhood family E(a) = {b ∈ B | R a b} for each a ∈ A; then each E(a) ⊆ B and |E(a)| ≥ d.

    We introduce the hypotheses 1 ≤ r, r ≤ |A|, and the degree condition ∀ a ∈ A, d ≤ |{b ∈ B | R a b}|. We define E(a) to be the set of elements of B related to a. By definition of filtering (Finset.mem_filter.mp), every element of E(a) belongs to B, establishing E(a) ⊆ B.

    lines 6–10

    uses Finset.mem_filter.mp

      intro hr hrA hd
      let E : α → Finset β := fun a => B.filter (R a)
      have hE : ∀ a ∈ A, E a ⊆ B := by
        intro a ha b hb
        exact (Finset.mem_filter.mp hb).1
  2. The set of elements in B belonging to at least r sets E(a) coincides with the set of elements in B incident to at least r elements of A under R.

    By Finset.filter_congr, two filtered subsets of B are equal if their filtering conditions are equivalent for every b ∈ B. For any fixed b ∈ B, the fiber {a ∈ A | b ∈ E(a)} equals {a ∈ A | R a b} by extensionality, since b ∈ E(a) means b ∈ B ∧ R a b, which simplifies to R a b using b ∈ B. Rewriting by this fiber equality equates the two filtering conditions.

    lines 11–18

    uses Finset.filter_congr

      have hcard : (B.filter (fun b => r ≤ (A.filter (fun a => b ∈ E a)).card)) =
          B.filter (fun b => r ≤ (A.filter (fun a => R a b)).card) := by
        apply Finset.filter_congr
        intro b hb
        have heq : (A.filter (fun a => b ∈ E a)) = A.filter (fun a => R a b) := by
          ext a
          simp [E, hb]
        rw [heq]
  3. |A| · d ≤ |B|(r - 1) + (|A| - r + 1) · |{b ∈ B | r ≤ |{a ∈ A | R a b}|}|

    We apply the double-counting lemma op869_double_count with sets A and B and family E, using the verified conditions E(a) ⊆ B, |E(a)| ≥ d, and r ≤ |A|. We then rewrite the count of elements with degree at least r using the set equality proved in the previous step.

    lines 19–20

    uses op869_double_count

      have h := op869_double_count A B E d r hE hd hrA
      rw [hcard] at h
  4. |A| · d ≤ |B|(r - 1) + (|A| - (r - 1)) · |{b ∈ B | r ≤ |{a ∈ A | R a b}|}|

    Since 1 ≤ r ≤ |A|, linear natural number arithmetic shows |A| - r + 1 = |A| - (r - 1) (dispatched by omega). Rewriting this identity into the inequality established by double-counting completes the proof.

    lines 21–22

      have harith : A.card - r + 1 = A.card - (r - 1) := by omega
      rwa [harith] at h
Finset.mem_filter.mp
If an element belongs to a filtered set {x ∈ s | p x}, then it belongs to s (and satisfies p).
Finset.filter_congr
If two predicates agree on every element of a finite set s, then filtering s by either predicate yields the same subset.
op869_double_count
For finite sets A and B, a family of subsets E(x) ⊆ B with |E(x)| ≥ d for all x ∈ A, and i ≤ |A|, the total size |A|d is at most |B|(i - 1) plus (|A| - i + 1) times the number of elements of B belonging to at least i sets E(x).

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 op869_incidence_degree_count {α β : Type} [DecidableEq α] [DecidableEq β] (A : Finset α) (B : Finset β)    (R : α → β → Prop) [DecidableRel R] (d r : ℕ) :    1 ≤ r → r ≤ A.card → (∀ a ∈ A, d ≤ (B.filter (R a)).card) →    A.card * d ≤ B.card * (r - 1) +      (A.card - (r - 1)) * (B.filter (fun b => r ≤ (A.filter (fun a => R a b)).card)).card := by  intro hr hrA hd  let E : α → Finset β := fun a => B.filter (R a)  have hE : ∀ a ∈ A, E a ⊆ B := by    intro a ha b hb    exact (Finset.mem_filter.mp hb).1  have hcard : (B.filter (fun b => r ≤ (A.filter (fun a => b ∈ E a)).card)) =      B.filter (fun b => r ≤ (A.filter (fun a => R a b)).card) := by    apply Finset.filter_congr    intro b hb    have heq : (A.filter (fun a => b ∈ E a)) = A.filter (fun a => R a b) := by      ext a      simp [E, hb]    rw [heq]  have h := op869_double_count A B E d r hE hd hrA  rw [hcard] at h  have harith : A.card - r + 1 = A.card - (r - 1) := by omega  rwa [harith] at h
See it in the graphDiscuss this resultChallenge it