AFTD Auto-Formalizing Theoretical Domains

op1957_odd_components_ambient_partition

theoremverified

Odd components ambient partition.

Statement

theorem op1957_odd_components_ambient_partition
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (U : Finset V) (s : ℕ)
    (hs : 1 ≤ s) (hodd : s ≤ (G.induce {v | v ∈ U}).oddComponents.ncard)
    (hpar : U.card % 2 = s % 2) :
    ∃ F : Fin s → Finset V,
      (∀ i, F i ⊆ U ∧ Odd (F i).card) ∧
      (∀ i j, i ≠ j → Disjoint (F i) (F j) ∧
        (∀ u ∈ F i, ∀ v ∈ F j, ¬ G.Adj u v)) ∧
      (Finset.univ.biUnion F = U)
Source
OP-1957; positive-separator graph-to-count transfer.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • odd_components_group_into_exactlyIf a finite graph has at least s odd connected components, s is positive, and the vertex count has the same parity as s, then its vertices…
Used by 7

The proof, explained

The theorem partitions a vertex subset $U \subseteq V$ into $s$ pairwise disjoint sets $F_i$ of odd cardinality with no edges between distinct parts, given that $1 \le s \le q(G[U])$ (where $q$ counts odd components) and $|U| \equiv s \pmod 2$. The key step applies the lemma `odd_components_group_into_exactly` to the induced subgraph $G[U]$, grouping its components into $s$ color classes of odd size with no edges between distinct colors. The desired partition of $U$ in the ambient graph is then obtained by pushing these color classes into $V$ under the canonical inclusion and verifying the required disjointness, edge-isolation, and union properties.

  1. The problem reduces to verifying block properties, pairwise separation, and covering for a candidate partition $F : \mathrm{Fin}\, s \to \mathrm{Finset}\, V$ constructed from the induced subgraph $G[U]$.

    We consider the subgraph $H = G[U]$ induced on the subtype of vertices in $U$. Applying `odd_components_group_into_exactly` to $H$ yields a partition function $f : U \to \mathrm{Fin}\, s$ such that each fiber has odd cardinality and no edge of $H$ connects vertices with different values of $f$. We define $Q_i = f^{-1}(i) \subseteq U$ and push each $Q_i$ forward into $V$ via the injective inclusion map `Subtype.val` to obtain $F_i \subseteq V$. An auxiliary equivalence `hQ` establishes that $v \in Q_i \iff f(v) = i$. Providing $F$ as the existential witness leaves three subgoals: verifying that each $F_i \subseteq U$ has odd size, that distinct blocks are disjoint with no cross-edges, and that the union of all $F_i$ equals $U$.

    lines 12–20

    uses odd_components_group_into_exactly, Subtype.val_injective

      classical
      let H := G.induce {v | v ∈ U}
      obtain ⟨f,hfodd,hfanti⟩ := odd_components_group_into_exactly H s hs hodd (by simpa using hpar)
      let Q : Fin s → Finset {v // v ∈ U} := fun i => Finset.univ.filter (fun v => f v=i)
      let F : Fin s → Finset V := fun i => (Q i).map (⟨Subtype.val, Subtype.val_injective⟩ : {v // v ∈ U} ↪ V)
      have hQ : ∀ i (v : {v // v ∈ U}), v ∈ Q i ↔ f v=i := by
        intro i v
        simp [Q]
      refine ⟨F,?_,?_,?_⟩
  2. Each block $F_i$ is a subset of $U$ and has odd cardinality.

    Any $v \in F_i$ is the image under the canonical embedding of some element $u$ of the subtype $U$ by `Finset.mem_map.mp`, so $v \in U$. Because the embedding is injective, the cardinality of $F_i$ equals that of the fiber $Q_i = \{u \in U \mid f(u) = i\}$, which is odd by the property `hfodd` guaranteed by the construction of $f$.

    lines 21–26

    uses Finset.mem_map.mp

      · intro i
        constructor
        · intro v hv
          obtain ⟨u,_,rfl⟩ := Finset.mem_map.mp hv
          exact u.property
        · simpa [F,Q] using hfodd i
  3. For any distinct indices $i \ne j$, the blocks $F_i$ and $F_j$ are disjoint.

    By `Finset.disjoint_left.mpr`, we suppose for contradiction that some vertex $v$ belongs to both $F_i$ and $F_j$. By `Finset.mem_map.mp`, $v$ is the underlying vertex of some $u \in Q_i$ and also of some $w \in Q_j$. Since both have the same underlying vertex in $V$, they are equal as subtype elements by `Subtype.ext`. The characterization `hQ` gives $f(u) = i$ and $f(w) = j$. Since $u = w$, it follows that $i = f(u) = f(w) = j$, contradicting the hypothesis $i \ne j$.

    lines 27–37

    uses Finset.disjoint_left.mpr, Finset.mem_map.mp, Subtype.ext

      · intro i j hij
        constructor
        · apply Finset.disjoint_left.mpr
          intro v hvi hvj
          obtain ⟨u,hui,huv⟩ := Finset.mem_map.mp hvi
          obtain ⟨w,hwj,hwv⟩ := Finset.mem_map.mp hvj
          have huw : u=w := Subtype.ext (huv.trans hwv.symm)
          have hfi := (hQ i u).mp hui
          have hfj := (hQ j w).mp hwj
          apply hij
          rw [← hfi,← hfj,huw]
  4. For distinct indices $i \ne j$, no edge of $G$ connects a vertex in $F_i$ to a vertex in $F_j$.

    Suppose for contradiction that $u \in F_i$ and $v \in F_j$ are adjacent in $G$. By `Finset.mem_map.mp`, $u$ and $v$ arise from subtype elements $u' \in Q_i$ and $v' \in Q_j$. By `hQ`, $f(u') = i$ and $f(v') = j$, which implies $f(u') \ne f(v')$ since $i \ne j$. By the construction of $f$, vertices assigned different colors cannot be adjacent in the induced subgraph $H = G[U]$, contradicting the adjacency of $u$ and $v$.

    lines 38–47

    uses Finset.mem_map.mp

        · intro u hu v hv hadj
          obtain ⟨u',hu',rfl⟩ := Finset.mem_map.mp hu
          obtain ⟨v',hv',rfl⟩ := Finset.mem_map.mp hv
          have hfu := (hQ i u').mp hu'
          have hfv := (hQ j v').mp hv'
          have hne : f u' ≠ f v' := by
            intro h
            apply hij
            rw [← hfu,← hfv,h]
          exact hfanti u' v' hne hadj
  5. The union of all blocks $\bigcup_{i} F_i$ equals $U$.

    We prove mutual inclusion. If $v \in \bigcup_i F_i$, then by `Finset.mem_biUnion.mp` and `Finset.mem_map.mp`, $v$ is the underlying vertex of an element of $U$, so $v \in U$. Conversely, if $v \in U$, let $u = \langle v, hv \rangle \in U$; then $u \in Q_{f(u)}$ by `hQ`, so $v \in F_{f(u)}$ by `Finset.mem_map.mpr`. By `Finset.mem_biUnion.mpr` and `Finset.mem_univ`, $v$ belongs to the union $\bigcup_i F_i$.

    lines 48–57

    uses Finset.mem_biUnion.mp, Finset.mem_map.mp, Finset.mem_biUnion.mpr, Finset.mem_univ, Finset.mem_map.mpr

      · ext v
        constructor
        · intro hv
          obtain ⟨i,_,hvi⟩ := Finset.mem_biUnion.mp hv
          obtain ⟨u,_,rfl⟩ := Finset.mem_map.mp hvi
          exact u.property
        · intro hv
          let u : {v // v ∈ U} := ⟨v,hv⟩
          refine Finset.mem_biUnion.mpr ⟨f u,Finset.mem_univ _,?_⟩
          exact Finset.mem_map.mpr ⟨u,(hQ (f u) u).mpr rfl,rfl⟩
odd_components_group_into_exactly
In a finite graph $H$, if $1 \le s \le q(H)$ (the number of odd components of $H$) and $|V(H)| \equiv s \pmod 2$, there exists a coloring $f : V(H) \to \mathrm{Fin}\, s$ such that every color class has odd cardinality and no adjacent vertices receive distinct colors.
Subtype.val_injective
The canonical projection mapping each subtype element to its underlying value is an injective function.
Finset.mem_map.mp
If an element belongs to the image of a finset under an embedding, then it equals the image of some element of that finset.
Finset.disjoint_left.mpr
Two finsets are disjoint if no element of the first finset belongs to the second finset.
Subtype.ext
Two elements of a subtype are equal if their underlying values in the ambient type are equal.
Finset.mem_biUnion.mp
If an element belongs to an indexed union of finsets $\bigcup_{i} A_i$, then it belongs to $A_i$ for some index $i$.
Finset.mem_biUnion.mpr
An element belongs to the indexed union $\bigcup_{i} A_i$ if it belongs to $A_i$ for some valid index $i$.
Finset.mem_univ
Every element of a finite type belongs to the universal finset `univ` of that type.
Finset.mem_map.mpr
An element belongs to the image of a finset under an embedding if it is the image of some element belonging to that finset.

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_odd_components_ambient_partition    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (U : Finset V) (s : ℕ)    (hs : 1 ≤ s) (hodd : s ≤ (G.induce {v | v ∈ U}).oddComponents.ncard)    (hpar : U.card % 2 = s % 2) :    ∃ F : Fin s → Finset V,      (∀ i, F i ⊆ U ∧ Odd (F i).card) ∧      (∀ i j, i ≠ j → Disjoint (F i) (F j) ∧        (∀ u ∈ F i, ∀ v ∈ F j, ¬ G.Adj u v)) ∧      (Finset.univ.biUnion F = U) := by  classical  let H := G.induce {v | v ∈ U}  obtain ⟨f,hfodd,hfanti⟩ := odd_components_group_into_exactly H s hs hodd (by simpa using hpar)  let Q : Fin s → Finset {v // v ∈ U} := fun i => Finset.univ.filter (fun v => f v=i)  let F : Fin s → Finset V := fun i => (Q i).map (⟨Subtype.val, Subtype.val_injective⟩ : {v // v ∈ U} ↪ V)  have hQ : ∀ i (v : {v // v ∈ U}), v ∈ Q i ↔ f v=i := by    intro i v    simp [Q]  refine ⟨F,?_,?_,?_⟩  · intro i    constructor    · intro v hv      obtain ⟨u,_,rfl⟩ := Finset.mem_map.mp hv      exact u.property    · simpa [F,Q] using hfodd i  · intro i j hij    constructor    · apply Finset.disjoint_left.mpr      intro v hvi hvj      obtain ⟨u,hui,huv⟩ := Finset.mem_map.mp hvi      obtain ⟨w,hwj,hwv⟩ := Finset.mem_map.mp hvj      have huw : u=w := Subtype.ext (huv.trans hwv.symm)      have hfi := (hQ i u).mp hui      have hfj := (hQ j w).mp hwj      apply hij      rw [← hfi,← hfj,huw]    · intro u hu v hv hadj      obtain ⟨u',hu',rfl⟩ := Finset.mem_map.mp hu      obtain ⟨v',hv',rfl⟩ := Finset.mem_map.mp hv      have hfu := (hQ i u').mp hu'      have hfv := (hQ j v').mp hv'      have hne : f u' ≠ f v' := by        intro h        apply hij        rw [← hfu,← hfv,h]      exact hfanti u' v' hne hadj  · ext v    constructor    · intro hv      obtain ⟨i,_,hvi⟩ := Finset.mem_biUnion.mp hv      obtain ⟨u,_,rfl⟩ := Finset.mem_map.mp hvi      exact u.property    · intro hv      let u : {v // v ∈ U} := ⟨v,hv⟩      refine Finset.mem_biUnion.mpr ⟨f u,Finset.mem_univ _,?_⟩      exact Finset.mem_map.mpr ⟨u,(hQ (f u) u).mpr rfl,rfl⟩
See it in the graphDiscuss this resultChallenge it