AFTD Auto-Formalizing Theoretical Domains

op874_four_two_incidence_count

theoremverified

In a four-by-two incidence system, the total number of incidences of any finite set of right vertices is twice its cardinality.

Statement

theorem op874_four_two_incidence_count
    {L E : Type*} [Fintype L] [Fintype E] [DecidableEq L] [DecidableEq E]
    (inc : L → E → Prop) [DecidableRel inc]
    (hright : ∀ e, (univ.filter fun l => inc l e).card = 2)
    (X : Finset E) :
    (∑ l : L, (X.filter fun e => inc l e).card) = 2 * X.card
Source
Incidence and matching reduction for OP-874, https://arxiv.org/abs/2610.41950, Section 2.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 2

The proof, explained

The theorem is proved by double counting the incidences between the full set of left vertices L and the chosen subset of right vertices X. Grouping incidences by right vertex expresses the total count as a sum over e ∈ X of the number of left vertices incident to e. Because every right vertex has degree 2, this sum equals 2 * |X|.

  1. The sum over all l ∈ L of the number of elements in X incident to l equals the sum over all e ∈ X of the number of elements in L incident to e.

    By bipartite double counting (Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow applied to s = univ and t = X), counting the incidences between the entire set of left vertices L and the subset of right vertices X by grouping by left vertex gives the same total as grouping by right vertex.

    line 11

    uses Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow

      have h := @Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow L E inc univ X _
  2. The total incidence count ∑ l : L, |{e ∈ X | inc l e}| equals 2 * |X|.

    Unfolding the definitions of bipartiteAbove and bipartiteBelow converts the identity into an equality between the desired sum and the sum over e ∈ X of the degree of e in L. By hypothesis (hright), every vertex e has degree exactly 2 in L, so the sum over X evaluates to |X| * 2. Commuting the product using mul_comm yields 2 * |X|, concluding the proof.

    line 12

    uses Finset.bipartiteAbove, Finset.bipartiteBelow, mul_comm

      simpa [Finset.bipartiteAbove, Finset.bipartiteBelow, hright, mul_comm] using h
Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
For any relation r between finite sets s and t, the sum over a ∈ s of the number of elements in t related to a equals the sum over b ∈ t of the number of elements in s related to b (bipartite double counting).
Finset.bipartiteAbove
The sub-finset of elements b ∈ t that satisfy r a b for a given element a.
Finset.bipartiteBelow
The sub-finset of elements a ∈ s that satisfy r a b for a given element b.
mul_comm
Multiplication is commutative: a * b = 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

open Finsetset_option maxHeartbeats 4000000set_option maxRecDepth 8192theorem op874_four_two_incidence_count    {L E : Type*} [Fintype L] [Fintype E] [DecidableEq L] [DecidableEq E]    (inc : L → E → Prop) [DecidableRel inc]    (hright : ∀ e, (univ.filter fun l => inc l e).card = 2)    (X : Finset E) :    (∑ l : L, (X.filter fun e => inc l e).card) = 2 * X.card := by  have h := @Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow L E inc univ X _  simpa [Finset.bipartiteAbove, Finset.bipartiteBelow, hright, mul_comm] using h
See it in the graphDiscuss this resultChallenge it