AFTD Auto-Formalizing Theoretical Domains

op1957_connected_anticomplete_partition_card

theoremverified

Connected anticomplete partition card.

Statement

theorem op1957_connected_anticomplete_partition_card
    {V I : Type*} [Fintype V] [DecidableEq V] [DecidableEq I]
    (G : SimpleGraph V) (hconn : G.Connected) (J : Finset I) (F : I → Finset V)
    (hnonempty : ∀ i ∈ J, (F i).Nonempty)
    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j))
    (hanti : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → ∀ u ∈ F i, ∀ v ∈ F j, ¬ G.Adj u v)
    (hcover : J.biUnion F = Finset.univ) : J.card ≤ 1
Source
OP-1957; positive-separator graph-to-count transfer.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

To show that the index set J has cardinality at most 1, we assume for contradiction that J contains two distinct indices i and j, and pick vertices u ∈ F(i) and v ∈ F(j). We first show that F(i) is closed under adjacency: because the sets cover V and have no edges between distinct parts, any neighbor of a vertex in F(i) must also lie in F(i). By induction on walks, F(i) is therefore closed under reachability. Since the graph is connected, v is reachable from u, forcing v ∈ F(i), which contradicts the disjointness of F(i) and F(j).

  1. To prove that |J| ≤ 1, assume for contradiction that there are two distinct indices i ≠ j in J, and pick elements u ∈ F(i) and v ∈ F(j).

    By `Finset.card_le_one.mpr`, showing that a finite set has at most one element reduces to proving that any two elements in it are equal. We assume for contradiction that there exist distinct indices i, j ∈ J with i ≠ j. Since each subset F(k) for k ∈ J is nonempty (by assumption `hnonempty`), we can choose elements u ∈ F(i) and v ∈ F(j).

    lines 10–15

    uses Finset.card_le_one.mpr

      classical
      apply Finset.card_le_one.mpr
      intro i hi j hj
      by_contra hne
      obtain ⟨u,hu⟩ := hnonempty i hi
      obtain ⟨v,hv⟩ := hnonempty j hj
  2. Each part F(i) is closed under graph adjacency: any neighbor of a vertex in F(i) also lies in F(i).

    Let a ∈ F(i) and let b be adjacent to a. Because the collection of sets {F(k)} covers the entire vertex set V (by `hcover`), b must belong to some part F(l) for l ∈ J by `Finset.mem_biUnion.mp`. We split into cases depending on whether i = l. If i = l, then b ∈ F(i) directly. If i ≠ l, the anticomplete hypothesis (`hanti`) states that there are no edges between F(i) and F(l), which contradicts the adjacency of a and b. We conclude the impossible case using `False.elim`.

    lines 16–23

    uses Finset.mem_biUnion.mp, False.elim

      have hclosed : ∀ a ∈ F i, ∀ b, G.Adj a b → b ∈ F i := by
        intro a ha b hab
        have hb : b ∈ J.biUnion F := by rw [hcover]; simp
        obtain ⟨l,hl,hbl⟩ := Finset.mem_biUnion.mp hb
        by_cases he : i=l
        · subst l
          exact hbl
        · exact False.elim (hanti i hi l hl he a ha b hbl hab)
  3. Each part F(i) is closed under reachability: any vertex reachable from a vertex in F(i) also lies in F(i).

    If b is reachable from a, there exists a walk p connecting them. We proceed by induction on the walk p. In the base case of an empty walk (nil), a = b so b ∈ F(i) holds immediately. In the inductive step (cons), the walk begins with an edge from u' to v' followed by a walk to b; since u' ∈ F(i), the adjacency closure property established in the previous step guarantees that v' ∈ F(i), and the induction hypothesis then implies that b ∈ F(i).

    lines 24–29

      have hwalk : ∀ (a b : V), G.Reachable a b → a ∈ F i → b ∈ F i := by
        intro a b hab
        obtain ⟨p⟩ := hab
        induction p with
        | nil => intro ha; exact ha
        | cons hadj p ih => intro ha; exact ih (hclosed _ ha _ hadj)
  4. Contradiction: v must belong to F(i), which contradicts the disjointness of F(i) and F(j).

    Since the graph G is connected (`hconn`), there is a path from u to v. By reachability closure, u ∈ F(i) implies v ∈ F(i). However, because i ≠ j, the parts F(i) and F(j) are disjoint (`hdis`). By `Finset.disjoint_left.mp`, v ∈ F(i) implies v ∉ F(j), which contradicts our choice of v ∈ F(j).

    lines 30–31

    uses Finset.disjoint_left.mp

      have hv' := hwalk u v (hconn u v) hu
      exact Finset.disjoint_left.mp (hdis i hi j hj hne) hv' hv
Finset.card_le_one.mpr
A finite set has cardinality at most 1 if and only if any two of its elements are equal.
Finset.mem_biUnion.mp
An element belongs to a union of sets indexed by a finite set if and only if it belongs to at least one of the constituent sets.
False.elim
The principle of explosion: from a contradiction (False), any conclusion follows.
Finset.disjoint_left.mp
If two sets are disjoint, then any element of the first set does not belong to the second set.

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 2000000theorem op1957_connected_anticomplete_partition_card    {V I : Type*} [Fintype V] [DecidableEq V] [DecidableEq I]    (G : SimpleGraph V) (hconn : G.Connected) (J : Finset I) (F : I → Finset V)    (hnonempty : ∀ i ∈ J, (F i).Nonempty)    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j))    (hanti : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → ∀ u ∈ F i, ∀ v ∈ F j, ¬ G.Adj u v)    (hcover : J.biUnion F = Finset.univ) : J.card ≤ 1 := by  classical  apply Finset.card_le_one.mpr  intro i hi j hj  by_contra hne  obtain ⟨u,hu⟩ := hnonempty i hi  obtain ⟨v,hv⟩ := hnonempty j hj  have hclosed : ∀ a ∈ F i, ∀ b, G.Adj a b → b ∈ F i := by    intro a ha b hab    have hb : b ∈ J.biUnion F := by rw [hcover]; simp    obtain ⟨l,hl,hbl⟩ := Finset.mem_biUnion.mp hb    by_cases he : i=l    · subst l      exact hbl    · exact False.elim (hanti i hi l hl he a ha b hbl hab)  have hwalk : ∀ (a b : V), G.Reachable a b → a ∈ F i → b ∈ F i := by    intro a b hab    obtain ⟨p⟩ := hab    induction p with    | nil => intro ha; exact ha    | cons hadj p ih => intro ha; exact ih (hclosed _ ha _ hadj)  have hv' := hwalk u v (hconn u v) hu  exact Finset.disjoint_left.mp (hdis i hi j hj hne) hv' hv
See it in the graphDiscuss this resultChallenge it