AFTD Auto-Formalizing Theoretical Domains

induced_odd_components_le_independence

theoremverified

The number of odd components of an induced finite graph is at most the independence bound of the ambient graph.

Statement

theorem induced_odd_components_le_independence
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (R : Set V)
    (a : ℕ) (hind : ∀ U : Finset V,
      (∀ u ∈ U, ∀ v ∈ U, u ≠ v → ¬ G.Adj u v) → U.card ≤ a) :
    (G.induce R).oddComponents.ncard ≤ a
Source
Balanced-cut matching symmetry for OP-1957; https://arxiv.org/abs/2611.22690.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • is_k_extendableFor a finite vertex type V (with [Fintype V]), a simple graph G : SimpleGraph V and k : ℕ, is_k_extendable G k is the Prop that is the…
Used by 2

The proof, explained

By selecting one vertex from each odd component of the induced subgraph G[R], we construct a set of vertices U whose size equals the number of odd components. Because these vertices are chosen from distinct connected components of G[R], no two can be adjacent in G, so U is an independent set. The ambient independence bound then immediately implies that the number of odd components is at most a.

  1. For each odd component of the induced subgraph H = G[R], choose a representative vertex.

    Let H = G[R] be the subgraph of G induced on R, and let O be the finite set of odd connected components of H. Since each odd component has an odd number of vertices, its vertex set (support) is non-empty. We can therefore choose a vertex pick(c) ∈ R in the support of each component c ∈ O.

    lines 6–11

      set_option maxHeartbeats 4000000 in
        classical
        let H := G.induce R
        let O : Finset H.ConnectedComponent := H.oddComponents.toFinset
        let pick : O → R := fun c => c.val.nonempty_supp.choose
        have hpick : ∀ c : O, pick c ∈ c.val.supp := fun c => c.val.nonempty_supp.choose_spec
  2. The map sending each odd component to its chosen vertex is injective.

    Suppose two odd components c and d yield the same chosen vertex in V. By Subtype.ext, their chosen vertices in R are also equal. By SimpleGraph.ConnectedComponent.mem_supp_iff, the chosen vertex of a component determines that component. Since the vertices coincide, c = d by Subtype.ext.

    lines 12–19

    uses Subtype.ext, SimpleGraph.ConnectedComponent.mem_supp_iff

        have hinj : Function.Injective (fun c : O => (pick c).val) := by
          intro c d he
          have hv : pick c = pick d := Subtype.ext he
          apply Subtype.ext
          have hc := (SimpleGraph.ConnectedComponent.mem_supp_iff c.val (pick c)).mp (hpick c)
          have hd := (SimpleGraph.ConnectedComponent.mem_supp_iff d.val (pick d)).mp (hpick d)
          rw [hv] at hc
          exact hc.symm.trans hd
  3. The set U of chosen vertices has cardinality equal to the number of odd components of H.

    Let U be the image of O under the vertex selection map. Because this map is injective, Finset.card_image_of_injective and Finset.card_attach show that |U| = |O|. By Set.ncard_eq_toFinset_card', |O| is equal to the number of odd components of H.

    lines 20–26

    uses Finset.card_image_of_injective, Finset.card_attach, Set.ncard_eq_toFinset_card'

        let U : Finset V := Finset.univ.image (fun c : O => (pick c).val)
        have hUcard : U.card = H.oddComponents.ncard := by
          dsimp [U]
          rw [Finset.card_image_of_injective _ hinj]
          change O.attach.card = H.oddComponents.ncard
          rw [Finset.card_attach]
          exact (Set.ncard_eq_toFinset_card' H.oddComponents).symm
  4. The set U of chosen vertices is an independent set in G.

    Suppose for contradiction that two distinct vertices u, v ∈ U are adjacent in G. Using Finset.mem_image.mp, let u and v be the vertices chosen from components c, d ∈ O. Because u and v belong to R and are adjacent in G, they are adjacent in the induced subgraph H. By SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj, adjacent vertices in H belong to the same connected component. Since each vertex belongs to its chosen component by SimpleGraph.ConnectedComponent.mem_supp_iff, we obtain c = d by Subtype.ext. By congrArg, their chosen vertices are equal (u = v), contradicting u ≠ v.

    lines 27–37

    uses Finset.mem_image.mp, SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj, SimpleGraph.ConnectedComponent.mem_supp_iff, Subtype.ext, congrArg

        have hUind : ∀ u ∈ U, ∀ v ∈ U, u ≠ v → ¬ G.Adj u v := by
          intro u hu v hv hne hadj
          obtain ⟨c,_,rfl⟩ := Finset.mem_image.mp hu
          obtain ⟨d,_,rfl⟩ := Finset.mem_image.mp hv
          have hH : H.Adj (pick c) (pick d) := hadj
          have hcomp := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hH
          have hc := (SimpleGraph.ConnectedComponent.mem_supp_iff c.val (pick c)).mp (hpick c)
          have hd := (SimpleGraph.ConnectedComponent.mem_supp_iff d.val (pick d)).mp (hpick d)
          rw [hc,hd] at hcomp
          have hcd : c=d := Subtype.ext hcomp
          exact hne (congrArg (fun x : O => (pick x).val) hcd)
  5. The number of odd components of H is at most a. automation

    Applying the hypothesis that every independent set has size at most a to the independent set U gives |U| ≤ a. Since |U| equals the number of odd components of H, linear integer arithmetic (omega) concludes that the number of odd components is at most a.

    lines 38–40

        have h := hind U hUind
        change H.oddComponents.ncard ≤ a
        omega
congrArg
Applying a function to equal arguments yields equal values.
Finset.card_attach
Attaching proofs of membership to elements of a finite set does not change its cardinality.
Finset.card_image_of_injective
The image of a finite set under an injective function has the same cardinality as the original set.
Finset.mem_image.mp
An element belongs to the image of a set under a function if and only if it is the image of some element in that set.
Set.ncard_eq_toFinset_card'
The cardinality of a finite set as a `Set` equals the cardinality of its associated `Finset`.
SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj
Adjacent vertices in a graph belong to the same connected component.
SimpleGraph.ConnectedComponent.mem_supp_iff
A vertex belongs to the support of a connected component if and only if the component containing that vertex is that component.
Subtype.ext
Two elements of a subtype are equal if and only if their underlying values are equal.

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 induced_odd_components_le_independence    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (R : Set V)    (a : ℕ) (hind : ∀ U : Finset V,      (∀ u ∈ U, ∀ v ∈ U, u ≠ v → ¬ G.Adj u v) → U.card ≤ a) :    (G.induce R).oddComponents.ncard ≤ a := by  set_option maxHeartbeats 4000000 in    classical    let H := G.induce R    let O : Finset H.ConnectedComponent := H.oddComponents.toFinset    let pick : O → R := fun c => c.val.nonempty_supp.choose    have hpick : ∀ c : O, pick c ∈ c.val.supp := fun c => c.val.nonempty_supp.choose_spec    have hinj : Function.Injective (fun c : O => (pick c).val) := by      intro c d he      have hv : pick c = pick d := Subtype.ext he      apply Subtype.ext      have hc := (SimpleGraph.ConnectedComponent.mem_supp_iff c.val (pick c)).mp (hpick c)      have hd := (SimpleGraph.ConnectedComponent.mem_supp_iff d.val (pick d)).mp (hpick d)      rw [hv] at hc      exact hc.symm.trans hd    let U : Finset V := Finset.univ.image (fun c : O => (pick c).val)    have hUcard : U.card = H.oddComponents.ncard := by      dsimp [U]      rw [Finset.card_image_of_injective _ hinj]      change O.attach.card = H.oddComponents.ncard      rw [Finset.card_attach]      exact (Set.ncard_eq_toFinset_card' H.oddComponents).symm    have hUind : ∀ u ∈ U, ∀ v ∈ U, u ≠ v → ¬ G.Adj u v := by      intro u hu v hv hne hadj      obtain ⟨c,_,rfl⟩ := Finset.mem_image.mp hu      obtain ⟨d,_,rfl⟩ := Finset.mem_image.mp hv      have hH : H.Adj (pick c) (pick d) := hadj      have hcomp := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hH      have hc := (SimpleGraph.ConnectedComponent.mem_supp_iff c.val (pick c)).mp (hpick c)      have hd := (SimpleGraph.ConnectedComponent.mem_supp_iff d.val (pick d)).mp (hpick d)      rw [hc,hd] at hcomp      have hcd : c=d := Subtype.ext hcomp      exact hne (congrArg (fun x : O => (pick x).val) hcd)    have h := hind U hUind    change H.oddComponents.ncard ≤ a    omega
See it in the graphDiscuss this resultChallenge it