AFTD Auto-Formalizing Theoretical Domains

induced_odd_components_le_unmatched_matching_vertices

theoremverified

Each odd component of an induced graph contains a vertex missed by any matching contained in that induced graph.

Statement

theorem induced_odd_components_le_unmatched_matching_vertices
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
    (R : Finset V) (M : G.Subgraph) [DecidablePred (· ∈ M.verts)]
    (hM : M.IsMatching) (hMR : M.verts ⊆ (R : Set V)) :
    (G.induce {v | v ∈ R}).oddComponents.ncard ≤ (R \ M.verts.toFinset).card
Source
Balanced-cut reduction for OP-1957; https://arxiv.org/abs/1011.3384.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
Used by 1

The proof, explained

The proof establishes that each odd component of the induced subgraph G[R] contains at least one vertex not saturated by the matching M. If all vertices of an odd component were matched, their matching edges would be constrained to remain entirely within that component—since M ⊆ R and no edges exist in G[R] between distinct components—forming a matching on the component and forcing its vertex count to be even, which contradicts that it is odd. Choosing one unmatched vertex from each odd component defines an injective map into R \ V(M) because distinct components have disjoint vertex sets, proving that the number of odd components is at most |R \ V(M)|.

  1. Set up the induced subgraph H = G[R], the set O of its odd components, and establish that each component's vertex set F(c) is contained in R.

    We define H = G[R] as the subgraph induced by R, let O be the finite set of odd connected components of H, and define F(c) to be the ambient vertex set in V corresponding to each component c. By induced_component_ambient_vertex_properties, each such vertex set F(c) is a subset of R.

    lines 6–13

    uses induced_component_ambient_vertex_properties

      set_option maxHeartbeats 4000000 in
        classical
        let H := G.induce {v | v ∈ R}
        let O : Finset H.ConnectedComponent := H.oddComponents.toFinset
        let F : O → Finset V := fun c => in1206_component_vertices G (R : Set V) c.val
        have hFsub : ∀ c : O, F c ⊆ R := by
          intro c x hx
          exact (induced_component_ambient_vertex_properties G (R : Set V) c.val c.val).1 hx
  2. Each component c ∈ O has an odd number of vertices.

    By induced_component_ambient_vertex_properties, the cardinality of F(c) matches the size of the component's support. Since c is an odd component, its support cardinality is odd, and therefore |F(c)| is odd.

    lines 14–20

    uses induced_component_ambient_vertex_properties

        have hFodd : ∀ c : O, Odd (F c).card := by
          intro c
          have hh := (induced_component_ambient_vertex_properties G (R : Set V) c.val c.val).2.1
          change Odd (in1206_component_vertices G (R : Set V) c.val).card
          rw [hh]
          have hc : c.val ∈ H.oddComponents := by simpa [O] using c.property
          exact hc
  3. Each odd component c ∈ O contains at least one vertex not matched by M.

    Suppose for contradiction that every vertex in F(c) is covered by the matching M. Consider the induced subgraph Q = M[F(c)]. For any vertex x ∈ F(c), its unique matching partner y in M must also belong to F(c), because y ∈ R (since M ⊆ R) and induced_component_ambient_vertex_properties forbids edges in G between F(c) and R \ F(c). Thus Q is a matching whose vertex set is F(c). By in1076_matching_twice_card and Set.ncard_coe_finset, |F(c)| = 2|E(Q)|, forcing |F(c)| to be even. This contradicts that |F(c)| is odd.

    lines 21–43

    uses induced_component_ambient_vertex_properties, in1076_matching_twice_card, Set.ncard_coe_finset

        have hFmiss : ∀ c : O, ∃ x ∈ F c, x ∉ M.verts := by
          intro c
          by_contra hn
          push Not at hn
          let Q : G.Subgraph := M.induce (F c : Set V)
          have hQ : Q.IsMatching := by
            intro x hx
            have hxF : x ∈ F c := hx
            have hxM : x ∈ M.verts := hn x hxF
            obtain ⟨y,hxy,huniq⟩ := hM hxM
            have hyR : y ∈ R := hMR (M.edge_vert hxy.symm)
            have hyF : y ∈ F c := by
              by_contra hyF
              exact (induced_component_ambient_vertex_properties G (R : Set V) c.val c.val).2.2.2
                x hxF y hyR hyF (M.adj_sub hxy)
            refine ⟨y,⟨hxF,hyF,hxy⟩,?_⟩
            intro z hz
            exact huniq z hz.2.2
          have hQverts : Q.verts = (F c : Set V) := rfl
          have hc := in1076_matching_twice_card hQ
          rw [hQverts,Set.ncard_coe_finset] at hc
          obtain ⟨z,hz⟩ := hFodd c
          omega
  4. Selecting one unmatched vertex from each odd component yields an injective function from O into V.

    For each odd component c ∈ O, we choose a vertex pick(c) ∈ F(c) not covered by M. If pick(c) = pick(d) for two components c, d ∈ O, then c and d must coincide: if they were distinct, Subtype.ext implies their underlying components are distinct, so by induced_component_ambient_vertex_properties their vertex sets F(c) and F(d) are disjoint, which contradicts pick(c) ∈ F(c) ∩ F(d) via Finset.disjoint_left.mp.

    lines 44–54

    uses Subtype.ext, induced_component_ambient_vertex_properties, Finset.disjoint_left.mp

        let pick : O → V := fun c => (hFmiss c).choose
        have hpick : ∀ c : O, pick c ∈ F c ∧ pick c ∉ M.verts := fun c => (hFmiss c).choose_spec
        have hinj : Function.Injective pick := by
          intro c d h
          apply Subtype.ext
          by_contra hne
          have hdis := (induced_component_ambient_vertex_properties G (R : Set V) c.val d.val).2.2.1 hne
          have hc := (hpick c).1
          have hd := (hpick d).1
          have he : pick c ∈ F d := by simpa [h] using hd
          exact Finset.disjoint_left.mp hdis hc he
  5. The image T of the selection function has cardinality equal to the number of odd components.

    Let T be the image of pick over all c ∈ O. Because pick is injective, Finset.card_image_of_injective and Finset.card_attach establish that |T| = |O|. By Set.ncard_eq_toFinset_card', |O| equals the number of odd components of H.

    lines 55–61

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

        let T : Finset V := Finset.univ.image pick
        have hTcard : T.card = H.oddComponents.ncard := by
          dsimp [T]
          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
  6. The set T is contained in R \ V(M), which implies that the number of odd components is at most |R \ V(M)|.

    Every x ∈ T is of the form pick(c) for some component c by Finset.mem_image.mp. Since pick(c) ∈ F(c) ⊆ R and pick(c) ∉ V(M), Finset.mem_sdiff.mpr shows that x ∈ R \ V(M). Thus T ⊆ R \ V(M), so Finset.card_le_card gives |T| ≤ |R \ V(M)|. Substituting |T| = |oddComponents| yields the required bound.

    lines 62–68

    uses Finset.mem_image.mp, Finset.mem_sdiff.mpr, Finset.card_le_card

        have hTsub : T ⊆ R \ M.verts.toFinset := by
          intro x hx
          obtain ⟨c,_,rfl⟩ := Finset.mem_image.mp hx
          exact Finset.mem_sdiff.mpr ⟨hFsub c (hpick c).1,by simpa using (hpick c).2⟩
        have hh := Finset.card_le_card hTsub
        change H.oddComponents.ncard ≤ (R \ M.verts.toFinset).card
        omega
Finset.card_le_card
If a finite set s is a subset of t, then the cardinality of s is at most that of t.
Finset.card_image_of_injective
The image of a finite set under an injective function has the same cardinality as the domain set.
Finset.card_attach
The attached subtype finset of a finite set s has the same cardinality as s.
Finset.disjoint_left.mp
If two finite sets are disjoint, an element in the first set cannot belong to the second 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.
Finset.mem_sdiff.mpr
An element belongs to the set difference s \ t if it belongs to s and not to t.
in1076_matching_twice_card
The number of vertices in any matching is twice its number of edges (|V(M)| = 2|E(M)|).
induced_component_ambient_vertex_properties
For connected components of an induced subgraph G[R], each component's ambient vertex set is contained in R, its cardinality equals the component support's cardinality, distinct components have disjoint vertex sets, and no edge connects a component to the rest of R.
Set.ncard_coe_finset
The set cardinality (ncard) of a finite set viewed as a set equals its Finset cardinality.
Set.ncard_eq_toFinset_card'
The cardinality of a finite set equals the cardinality of its converted Finset.
Subtype.ext
Two terms of a subtype are equal 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_unmatched_matching_vertices    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)    (R : Finset V) (M : G.Subgraph) [DecidablePred (· ∈ M.verts)]    (hM : M.IsMatching) (hMR : M.verts ⊆ (R : Set V)) :    (G.induce {v | v ∈ R}).oddComponents.ncard ≤ (R \ M.verts.toFinset).card := by  set_option maxHeartbeats 4000000 in    classical    let H := G.induce {v | v ∈ R}    let O : Finset H.ConnectedComponent := H.oddComponents.toFinset    let F : O → Finset V := fun c => in1206_component_vertices G (R : Set V) c.val    have hFsub : ∀ c : O, F c ⊆ R := by      intro c x hx      exact (induced_component_ambient_vertex_properties G (R : Set V) c.val c.val).1 hx    have hFodd : ∀ c : O, Odd (F c).card := by      intro c      have hh := (induced_component_ambient_vertex_properties G (R : Set V) c.val c.val).2.1      change Odd (in1206_component_vertices G (R : Set V) c.val).card      rw [hh]      have hc : c.val ∈ H.oddComponents := by simpa [O] using c.property      exact hc    have hFmiss : ∀ c : O, ∃ x ∈ F c, x ∉ M.verts := by      intro c      by_contra hn      push Not at hn      let Q : G.Subgraph := M.induce (F c : Set V)      have hQ : Q.IsMatching := by        intro x hx        have hxF : x ∈ F c := hx        have hxM : x ∈ M.verts := hn x hxF        obtain ⟨y,hxy,huniq⟩ := hM hxM        have hyR : y ∈ R := hMR (M.edge_vert hxy.symm)        have hyF : y ∈ F c := by          by_contra hyF          exact (induced_component_ambient_vertex_properties G (R : Set V) c.val c.val).2.2.2            x hxF y hyR hyF (M.adj_sub hxy)        refine ⟨y,⟨hxF,hyF,hxy⟩,?_⟩        intro z hz        exact huniq z hz.2.2      have hQverts : Q.verts = (F c : Set V) := rfl      have hc := in1076_matching_twice_card hQ      rw [hQverts,Set.ncard_coe_finset] at hc      obtain ⟨z,hz⟩ := hFodd c      omega    let pick : O → V := fun c => (hFmiss c).choose    have hpick : ∀ c : O, pick c ∈ F c ∧ pick c ∉ M.verts := fun c => (hFmiss c).choose_spec    have hinj : Function.Injective pick := by      intro c d h      apply Subtype.ext      by_contra hne      have hdis := (induced_component_ambient_vertex_properties G (R : Set V) c.val d.val).2.2.1 hne      have hc := (hpick c).1      have hd := (hpick d).1      have he : pick c ∈ F d := by simpa [h] using hd      exact Finset.disjoint_left.mp hdis hc he    let T : Finset V := Finset.univ.image pick    have hTcard : T.card = H.oddComponents.ncard := by      dsimp [T]      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 hTsub : T ⊆ R \ M.verts.toFinset := by      intro x hx      obtain ⟨c,_,rfl⟩ := Finset.mem_image.mp hx      exact Finset.mem_sdiff.mpr ⟨hFsub c (hpick c).1,by simpa using (hpick c).2⟩    have hh := Finset.card_le_card hTsub    change H.oddComponents.ncard ≤ (R \ M.verts.toFinset).card    omega
See it in the graphDiscuss this resultChallenge it