AFTD Auto-Formalizing Theoretical Domains

op1957_connected_block_two_families_at_most_one

theoremverified

Connected block two families at most one.

Statement

theorem op1957_connected_block_two_families_at_most_one
    {V I J : Type*} [Fintype V] [DecidableEq V] [DecidableEq I] [DecidableEq J]
    (G : SimpleGraph V) (B : Finset V) (hconn : (G.induce {v | v ∈ B}).Connected)
    (K : Finset I) (T : Finset J) (F : I → Finset V) (Q : J → Finset V)
    (hFsub : ∀ i ∈ K, F i ⊆ B) (hQsub : ∀ j ∈ T, Q j ⊆ B)
    (hQne : ∀ j ∈ T, (Q j).Nonempty)
    (hFdis : ∀ i ∈ K, ∀ l ∈ K, i ≠ l → Disjoint (F i) (F l))
    (hQdis : ∀ i ∈ T, ∀ l ∈ T, i ≠ l → Disjoint (Q i) (Q l))
    (hFQdis : ∀ i ∈ K, ∀ j ∈ T, Disjoint (F i) (Q j))
    (hFanti : ∀ i ∈ K, ∀ l ∈ K, i ≠ l → ∀ u ∈ F i, ∀ v ∈ F l, ¬ G.Adj u v)
    (hQanti : ∀ i ∈ T, ∀ l ∈ T, i ≠ l → ∀ u ∈ Q i, ∀ v ∈ Q l, ¬ G.Adj u v)
    (hFQanti : ∀ i ∈ K, ∀ j ∈ T, ∀ u ∈ F i, ∀ v ∈ Q j, ¬ G.Adj u v)
    (hcover : K.biUnion F ∪ T.biUnion Q = B) :
    (K.filter (fun i => (F i).Nonempty)).card+T.card ≤ 1
Source
OP-1957; positive-separator graph-to-count transfer.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
Used by 1

The proof, explained

The proof reduces the two-family problem to the one-family theorem op1957_connected_block_anticomplete_groups_at_most_one, which establishes that a connected induced subgraph cannot be partitioned into two or more nonempty, pairwise anticomplete subsets. Empty sets in the first family are removed by filtering to K' = {i ∈ K | F_i ≠ ∅}, after which the two families are merged into a single family H indexed by the disjoint sum M = K' ⊕ T. Once the hypotheses of the single-family theorem (containment in B, nonemptiness, pairwise disjointness, pairwise anticompleteness, and covering B) are verified by case analysis, that theorem yields |M| ≤ 1, which equals |K'| + |T| ≤ 1.

  1. Define the combined index set M = K' ⊕ T and the combined family of subsets H.

    To apply a known result for a single family of subsets, we combine the two families. First, we discard any empty sets from F by defining K' = {i ∈ K | F_i ≠ ∅}. We then take M to be the disjoint sum K' ⊕ T and define H on M by H(inl(i)) = F_i and H(inr(j)) = Q_j.

    lines 17–20

      classical
      let K' := K.filter (fun i => (F i).Nonempty)
      let M : Finset (I ⊕ J) := K'.disjSum T
      let H : I ⊕ J → Finset V := Sum.elim F Q
  2. Every subset in the combined family is contained in B (∀ m ∈ M, H_m ⊆ B).

    For any index m ∈ M, we split into cases: if m comes from K', then H_m = F_i ⊆ B by the hypothesis hFsub; if m comes from T, then H_m = Q_j ⊆ B by hQsub.

    lines 21–29

    uses Finset.mem_filter.mp

      have hsub : ∀ i ∈ M, H i ⊆ B := by
        intro i hi
        cases i with
        | inl i =>
          have hi' : i ∈ K' := by simpa [M] using hi
          exact hFsub i (Finset.mem_filter.mp hi').1
        | inr i =>
          have hi' : i ∈ T := by simpa [M] using hi
          exact hQsub i hi'
  3. Every subset in the combined family is nonempty (∀ m ∈ M, H_m ≠ ∅).

    If m = inl(i) comes from K', then F_i is nonempty by the defining condition of K'. If m = inr(j) comes from T, then Q_j is nonempty by the hypothesis hQne.

    lines 30–38

    uses Finset.mem_filter.mp

      have hne : ∀ i ∈ M, (H i).Nonempty := by
        intro i hi
        cases i with
        | inl i =>
          have hi' : i ∈ K' := by simpa [M] using hi
          exact (Finset.mem_filter.mp hi').2
        | inr i =>
          have hi' : i ∈ T := by simpa [M] using hi
          exact hQne i hi'
  4. The subsets in the combined family are pairwise disjoint for distinct indices in M.

    For any two distinct indices i, j ∈ M, we case split on which component each belongs to: if both are in K', disjointness of F_i and F_j follows from hFdis; if both are in T, disjointness of Q_i and Q_j follows from hQdis; if one is in K' and the other in T, disjointness follows from hFQdis (or its symmetry).

    lines 39–65

    uses Finset.mem_filter.mp

      have hdis : ∀ i ∈ M, ∀ j ∈ M, i ≠ j → Disjoint (H i) (H j) := by
        intro i hi j hj hij
        cases i with
        | inl i =>
          have hi' : i ∈ K := by
            have hh : i ∈ K' := by simpa [M] using hi
            exact (Finset.mem_filter.mp hh).1
          cases j with
          | inl j =>
            have hj' : j ∈ K := by
              have hh : j ∈ K' := by simpa [M] using hj
              exact (Finset.mem_filter.mp hh).1
            exact hFdis i hi' j hj' (fun h => hij (by simp [h]))
          | inr j =>
            have hj' : j ∈ T := by simpa [M] using hj
            exact hFQdis i hi' j hj'
        | inr i =>
          have hi' : i ∈ T := by simpa [M] using hi
          cases j with
          | inl j =>
            have hj' : j ∈ K := by
              have hh : j ∈ K' := by simpa [M] using hj
              exact (Finset.mem_filter.mp hh).1
            exact (hFQdis j hj' i hi').symm
          | inr j =>
            have hj' : j ∈ T := by simpa [M] using hj
            exact hQdis i hi' j hj' (fun h => hij (by simp [h]))
  5. The subsets in the combined family are pairwise anticomplete (no edge joins H_i and H_j for i ≠ j).

    Given distinct indices i, j ∈ M and vertices u ∈ H_i, v ∈ H_j, we check that u and v are not adjacent in G. If both belong to K', non-adjacency holds by hFanti; if both belong to T, it holds by hQanti; if one belongs to K' and the other to T, it holds by hFQanti (using symmetry of adjacency if the roles of u and v are reversed).

    lines 66–92

    uses Finset.mem_filter.mp

      have hanti : ∀ i ∈ M, ∀ j ∈ M, i ≠ j → ∀ u ∈ H i, ∀ v ∈ H j, ¬ G.Adj u v := by
        intro i hi j hj hij u hu v hv hadj
        cases i with
        | inl i =>
          have hi' : i ∈ K := by
            have hh : i ∈ K' := by simpa [M] using hi
            exact (Finset.mem_filter.mp hh).1
          cases j with
          | inl j =>
            have hj' : j ∈ K := by
              have hh : j ∈ K' := by simpa [M] using hj
              exact (Finset.mem_filter.mp hh).1
            exact hFanti i hi' j hj' (fun h => hij (by simp [h])) u hu v hv hadj
          | inr j =>
            have hj' : j ∈ T := by simpa [M] using hj
            exact hFQanti i hi' j hj' u hu v hv hadj
        | inr i =>
          have hi' : i ∈ T := by simpa [M] using hi
          cases j with
          | inl j =>
            have hj' : j ∈ K := by
              have hh : j ∈ K' := by simpa [M] using hj
              exact (Finset.mem_filter.mp hh).1
            exact hFQanti j hj' i hi' v hv u hu hadj.symm
          | inr j =>
            have hj' : j ∈ T := by simpa [M] using hj
            exact hQanti i hi' j hj' (fun h => hij (by simp [h])) u hu v hv hadj
  6. The union of the combined family covers B (⋃_{m ∈ M} H_m = B).

    The inclusion ⊆ follows from each H_m being a subset of B. Conversely, any v ∈ B lies in ⋃_{i ∈ K} F_i ∪ ⋃_{j ∈ T} Q_j by hcover. If v ∈ F_i for some i ∈ K, then F_i is nonempty (as it contains v), so i ∈ K' and v ∈ H(inl(i)). If v ∈ Q_j for some j ∈ T, then v ∈ H(inr(j)). In either case v is covered by the combined family.

    lines 93–106

    uses Finset.mem_biUnion.mp, Finset.mem_union.mp, Finset.mem_filter.mpr, Finset.mem_biUnion.mpr

      have hMcover : M.biUnion H = B := by
        ext v
        constructor
        · intro hv
          obtain ⟨i,hi,hvi⟩ := Finset.mem_biUnion.mp hv
          exact hsub i hi hvi
        · intro hv
          have hv' : v ∈ K.biUnion F ∪ T.biUnion Q := by rw [hcover]; exact hv
          rcases Finset.mem_union.mp hv' with hvF | hvQ
          · obtain ⟨i,hi,hvi⟩ := Finset.mem_biUnion.mp hvF
            have hi' : i ∈ K' := Finset.mem_filter.mpr ⟨hi,⟨v,hvi⟩⟩
            exact Finset.mem_biUnion.mpr ⟨Sum.inl i,by simpa [M] using hi',hvi⟩
          · obtain ⟨j,hj,hvj⟩ := Finset.mem_biUnion.mp hvQ
            exact Finset.mem_biUnion.mpr ⟨Sum.inr j,by simpa [M] using hj,hvj⟩
  7. |K'| + |T| ≤ 1.

    Applying the single-family theorem op1957_connected_block_anticomplete_groups_at_most_one to the connected induced subgraph on B and the merged family H indexed by M gives |M| ≤ 1. Since M is the disjoint sum of K' and T, its cardinality is |K'| + |T|, completing the proof.

    lines 107–108

    uses op1957_connected_block_anticomplete_groups_at_most_one, Finset.card_disjSum

      have hh := op1957_connected_block_anticomplete_groups_at_most_one G B hconn M H hsub hne hdis hanti hMcover
      simpa [M,K',Finset.card_disjSum] using hh
Finset.card_disjSum
The cardinality of the disjoint sum of two finite sets is the sum of their individual cardinalities: |s ⊕ t| = |s| + |t|.
Finset.mem_biUnion.mp
If an element belongs to the union of an indexed family of finite sets, then it belongs to at least one set in the family.
Finset.mem_biUnion.mpr
If an element belongs to at least one set in an indexed family of finite sets, then it belongs to their union.
Finset.mem_filter.mp
Membership in a filtered finite set implies membership in the original set and satisfaction of the filtering predicate.
Finset.mem_filter.mpr
If an element belongs to a finite set and satisfies a given predicate, then it belongs to the filtered finite set.
Finset.mem_union.mp
If an element belongs to the union of two finite sets, then it belongs to the first or to the second set.
op1957_connected_block_anticomplete_groups_at_most_one
If an induced subgraph on B is connected and B is partitioned into a family of non-empty, pairwise disjoint, and pairwise anticomplete vertex subsets, then the index set has cardinality at most 1.

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_block_two_families_at_most_one    {V I J : Type*} [Fintype V] [DecidableEq V] [DecidableEq I] [DecidableEq J]    (G : SimpleGraph V) (B : Finset V) (hconn : (G.induce {v | v ∈ B}).Connected)    (K : Finset I) (T : Finset J) (F : I → Finset V) (Q : J → Finset V)    (hFsub : ∀ i ∈ K, F i ⊆ B) (hQsub : ∀ j ∈ T, Q j ⊆ B)    (hQne : ∀ j ∈ T, (Q j).Nonempty)    (hFdis : ∀ i ∈ K, ∀ l ∈ K, i ≠ l → Disjoint (F i) (F l))    (hQdis : ∀ i ∈ T, ∀ l ∈ T, i ≠ l → Disjoint (Q i) (Q l))    (hFQdis : ∀ i ∈ K, ∀ j ∈ T, Disjoint (F i) (Q j))    (hFanti : ∀ i ∈ K, ∀ l ∈ K, i ≠ l → ∀ u ∈ F i, ∀ v ∈ F l, ¬ G.Adj u v)    (hQanti : ∀ i ∈ T, ∀ l ∈ T, i ≠ l → ∀ u ∈ Q i, ∀ v ∈ Q l, ¬ G.Adj u v)    (hFQanti : ∀ i ∈ K, ∀ j ∈ T, ∀ u ∈ F i, ∀ v ∈ Q j, ¬ G.Adj u v)    (hcover : K.biUnion F ∪ T.biUnion Q = B) :    (K.filter (fun i => (F i).Nonempty)).card+T.card ≤ 1 := by  classical  let K' := K.filter (fun i => (F i).Nonempty)  let M : Finset (I ⊕ J) := K'.disjSum T  let H : I ⊕ J → Finset V := Sum.elim F Q  have hsub : ∀ i ∈ M, H i ⊆ B := by    intro i hi    cases i with    | inl i =>      have hi' : i ∈ K' := by simpa [M] using hi      exact hFsub i (Finset.mem_filter.mp hi').1    | inr i =>      have hi' : i ∈ T := by simpa [M] using hi      exact hQsub i hi'  have hne : ∀ i ∈ M, (H i).Nonempty := by    intro i hi    cases i with    | inl i =>      have hi' : i ∈ K' := by simpa [M] using hi      exact (Finset.mem_filter.mp hi').2    | inr i =>      have hi' : i ∈ T := by simpa [M] using hi      exact hQne i hi'  have hdis : ∀ i ∈ M, ∀ j ∈ M, i ≠ j → Disjoint (H i) (H j) := by    intro i hi j hj hij    cases i with    | inl i =>      have hi' : i ∈ K := by        have hh : i ∈ K' := by simpa [M] using hi        exact (Finset.mem_filter.mp hh).1      cases j with      | inl j =>        have hj' : j ∈ K := by          have hh : j ∈ K' := by simpa [M] using hj          exact (Finset.mem_filter.mp hh).1        exact hFdis i hi' j hj' (fun h => hij (by simp [h]))      | inr j =>        have hj' : j ∈ T := by simpa [M] using hj        exact hFQdis i hi' j hj'    | inr i =>      have hi' : i ∈ T := by simpa [M] using hi      cases j with      | inl j =>        have hj' : j ∈ K := by          have hh : j ∈ K' := by simpa [M] using hj          exact (Finset.mem_filter.mp hh).1        exact (hFQdis j hj' i hi').symm      | inr j =>        have hj' : j ∈ T := by simpa [M] using hj        exact hQdis i hi' j hj' (fun h => hij (by simp [h]))  have hanti : ∀ i ∈ M, ∀ j ∈ M, i ≠ j → ∀ u ∈ H i, ∀ v ∈ H j, ¬ G.Adj u v := by    intro i hi j hj hij u hu v hv hadj    cases i with    | inl i =>      have hi' : i ∈ K := by        have hh : i ∈ K' := by simpa [M] using hi        exact (Finset.mem_filter.mp hh).1      cases j with      | inl j =>        have hj' : j ∈ K := by          have hh : j ∈ K' := by simpa [M] using hj          exact (Finset.mem_filter.mp hh).1        exact hFanti i hi' j hj' (fun h => hij (by simp [h])) u hu v hv hadj      | inr j =>        have hj' : j ∈ T := by simpa [M] using hj        exact hFQanti i hi' j hj' u hu v hv hadj    | inr i =>      have hi' : i ∈ T := by simpa [M] using hi      cases j with      | inl j =>        have hj' : j ∈ K := by          have hh : j ∈ K' := by simpa [M] using hj          exact (Finset.mem_filter.mp hh).1        exact hFQanti j hj' i hi' v hv u hu hadj.symm      | inr j =>        have hj' : j ∈ T := by simpa [M] using hj        exact hQanti i hi' j hj' (fun h => hij (by simp [h])) u hu v hv hadj  have hMcover : M.biUnion H = B := by    ext v    constructor    · intro hv      obtain ⟨i,hi,hvi⟩ := Finset.mem_biUnion.mp hv      exact hsub i hi hvi    · intro hv      have hv' : v ∈ K.biUnion F ∪ T.biUnion Q := by rw [hcover]; exact hv      rcases Finset.mem_union.mp hv' with hvF | hvQ      · obtain ⟨i,hi,hvi⟩ := Finset.mem_biUnion.mp hvF        have hi' : i ∈ K' := Finset.mem_filter.mpr ⟨hi,⟨v,hvi⟩⟩        exact Finset.mem_biUnion.mpr ⟨Sum.inl i,by simpa [M] using hi',hvi⟩      · obtain ⟨j,hj,hvj⟩ := Finset.mem_biUnion.mp hvQ        exact Finset.mem_biUnion.mpr ⟨Sum.inr j,by simpa [M] using hj,hvj⟩  have hh := op1957_connected_block_anticomplete_groups_at_most_one G B hconn M H hsub hne hdis hanti hMcover  simpa [M,K',Finset.card_disjSum] using hh
See it in the graphDiscuss this resultChallenge it