AFTD Auto-Formalizing Theoretical Domains

odd_component_bound_after_even_deletions

theoremverified

A perfect matching extending a forced matching leaves at most r+1 odd components on the opposite side if the forced matching meets all but at most one odd component in an even number of vertices and leaves r vertices on the first side.

Statement

theorem odd_component_bound_after_even_deletions
    (k r : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (C : Finset (Fin (4*k)))
    (P T : G.Subgraph) [DecidablePred (fun v => v ∈ T.verts)]
    (hP : P.IsPerfectMatching) (hT : T.IsMatching) (hTP : T ≤ P)
    (B : Finset (G.induce {v | v ∉ C}).ConnectedComponent) (hB : B.card ≤ 1)
    (hpar : ∀ i ∈ (G.induce {v | v ∉ C}).oddComponents.toFinset, i ∉ B →
      Even ((in1206_component_vertices G {v | v ∉ C} i) ∩ T.verts.toFinset).card)
    (hremain : ((C : Set (Fin (4*k))) \ T.verts).ncard = r) :
    (G.induce {v | v ∉ C}).oddComponents.ncard ≤ r+1
Source
Parity bookkeeping for OP-1957 balanced cuts; https://arxiv.org/abs/2611.22690.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
Used by 1

The proof, explained

The proof bounds the number of odd components of G[V \ C] by applying the odd groups budget lemma (odd_groups_budget_after_forced_matching) to the odd components outside the exceptional set B. Deleting the vertices of the forced matching T leaves an odd number of vertices in each such component, so the perfect matching P must match at least one vertex from each component to an unmatched vertex in C. Because there are r such unmatched vertices in C, there are at most r such odd components, and adding the at most one exceptional component in B yields at most r + 1 odd components in total.

  1. Define the induced subgraph H = G[R] on R = V \ C, its odd components O, the subset J = O \ B, the unmatched vertices F(i) in each component i, and the set L = R \ V(T) of unmatched vertices in R.

    We establish notation for the rest of the proof: R is the vertex complement of C; H is the subgraph induced by R; O is the finset of odd connected components of H; J is the set of odd components excluding the exceptional set B; F(i) is the set of vertices in component i not covered by the matching T; and L is the set of all vertices in R not covered by T.

    lines 11–19

      set_option maxHeartbeats 4000000 in
        classical
        let R : Set (Fin (4*k)) := {v | v ∉ C}
        let H := G.induce R
        let O : Finset H.ConnectedComponent := H.oddComponents.toFinset
        let J : Finset H.ConnectedComponent := O \ B
        let F : H.ConnectedComponent → Finset (Fin (4*k)) :=
          fun i => in1206_component_vertices G R i \ T.verts.toFinset
        let L : Finset (Fin (4*k)) := R.toFinset \ T.verts.toFinset
  2. The total number of odd components of H is at most |J| + 1.

    The finset O of odd components decomposes as the disjoint union of J = O \ B and O ∩ B. Since |O ∩ B| ≤ |B| ≤ 1 by hypothesis hB, we have |O| = |J| + |O ∩ B| ≤ |J| + 1.

    lines 20–27

    uses Set.ncard_eq_toFinset_card', Finset.card_sdiff_add_card_inter, Finset.card_le_card, Finset.inter_subset_right

        have hJcard : H.oddComponents.ncard ≤ J.card + 1 := by
          have hO : O.card = H.oddComponents.ncard := by
            dsimp [O]
            exact (Set.ncard_eq_toFinset_card' H.oddComponents).symm
          have hcount := Finset.card_sdiff_add_card_inter O B
          have hinter : (O ∩ B).card ≤ B.card := Finset.card_le_card Finset.inter_subset_right
          dsimp [J]
          omega
  3. For every component i ∈ J, the set of unmatched vertices F(i) has odd cardinality.

    Because i ∈ J ⊆ O, the component i has an odd number of vertices. By assumption hpar, since i ∉ B, the matching T meets component i in an even number of vertices. The set F(i) consists of the component vertices minus those in T, so its size is the difference of an odd number and an even number, which is odd.

    lines 28–44

    uses Finset.mem_sdiff.mp, induced_component_ambient_vertex_properties, Finset.card_sdiff_add_card_inter, Nat.odd_iff, Nat.even_iff

        have hJodd : ∀ i ∈ J, Odd (F i).card := by
          intro i hi
          have hiO : i ∈ O := (Finset.mem_sdiff.mp hi).1
          have hiB : i ∉ B := (Finset.mem_sdiff.mp hi).2
          have hiOdd : i ∈ H.oddComponents := by simpa [O] using hiO
          have hc := (induced_component_ambient_vertex_properties G R i i).2.1
          have horig : Odd (in1206_component_vertices G R i).card := by
            rw [hc]
            exact hiOdd
          have heven := hpar i hiO hiB
          change Even ((in1206_component_vertices G R i) ∩ T.verts.toFinset).card at heven
          have hcount := Finset.card_sdiff_add_card_inter
            (in1206_component_vertices G R i) T.verts.toFinset
          rw [Nat.odd_iff] at horig ⊢
          rw [Nat.even_iff] at heven
          dsimp [F]
          omega
  4. The sets F(i) for i ∈ J are subsets of L, pairwise disjoint, have no edges in G to L \ F(i), and contain no vertices of T.

    Each vertex of F(i) is in component i ⊆ R and not in T, so F(i) ⊆ R \ V(T) = L. Distinct components have disjoint vertex sets, so F(i) and F(j) are disjoint for i ≠ j. No edge in G connects a vertex in component i to any other vertex in R, so no edge connects F(i) to L \ F(i). Finally, by definition, no vertex in F(i) belongs to V(T).

    lines 45–66

    uses Finset.mem_sdiff.mp, Finset.mem_sdiff.mpr, induced_component_ambient_vertex_properties, Finset.sdiff_subset

        have hJsub : ∀ i ∈ J, F i ⊆ L := by
          intro i hi v hv
          have hv' := Finset.mem_sdiff.mp hv
          have hh := (induced_component_ambient_vertex_properties G R i i).1 hv'.1
          apply Finset.mem_sdiff.mpr
          exact ⟨by simpa using hh, hv'.2⟩
        have hJdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j) := by
          intro i hi j hj hij
          exact ((induced_component_ambient_vertex_properties G R i j).2.2.1 hij).mono
            Finset.sdiff_subset Finset.sdiff_subset
        have hJanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v ∈ L, v ∉ F i → ¬ G.Adj u v := by
          intro i hi u hu v hv hvnot
          have hu' := Finset.mem_sdiff.mp hu
          have hv' := Finset.mem_sdiff.mp hv
          have hvR : v ∈ R := by simpa using hv'.1
          have hvcomp : v ∉ in1206_component_vertices G R i := by
            intro hh
            exact hvnot (Finset.mem_sdiff.mpr ⟨hh,hv'.2⟩)
          exact (induced_component_ambient_vertex_properties G R i i).2.2.2 u hu'.1 v hvR hvcomp
        have hJfree : ∀ i ∈ J, ∀ u ∈ F i, u ∉ T.verts := by
          intro i hi u hu
          simpa using (Finset.mem_sdiff.mp hu).2
  5. The number of odd components in J is at most the number of vertices outside L that are unmatched by T.

    We apply the budget lemma odd_groups_budget_after_forced_matching using the verified conditions on the odd sets F(i) ⊆ L. Because P is a perfect matching and each F(i) is odd and isolated from the rest of L, each component in J must send at least one edge of P outside L to a vertex not covered by T, which bounds |J| by |(V \ L) \ V(T)|.

    lines 67–68

    uses odd_groups_budget_after_forced_matching

        have hbudget := odd_groups_budget_after_forced_matching G P T hP hT hTP J F L
          hJsub hJodd hJdis hJanti hJfree
  6. The number of vertices outside L that are unmatched by T is exactly r.

    A vertex lies outside L = R \ V(T) and outside V(T) if and only if it lies outside R and outside V(T). Since R = V \ C, this means the vertex belongs to C \ V(T). By hypothesis hremain, the cardinality of C \ V(T) is r.

    lines 69–76

    uses Set.ncard_coe_finset

        have hcount : ((Finset.univ \ L).filter (fun v => v ∉ T.verts)).card = r := by
          have heq : (((Finset.univ \ L).filter (fun v => v ∉ T.verts)) : Set (Fin (4*k))) =
              (C : Set (Fin (4*k))) \ T.verts := by
            ext v
            by_cases ht : v ∈ T.verts
            · simp [ht]
            · simp [L,R,ht]
          rw [← Set.ncard_coe_finset,heq,hremain]
  7. The number of odd components of H is at most r + 1.

    Substituting the count r into the budget inequality yields |J| ≤ r. Combining this with the earlier bound that the total number of odd components is at most |J| + 1, linear arithmetic gives the final upper bound r + 1.

    lines 77–79

        rw [hcount] at hbudget
        change H.oddComponents.ncard ≤ r+1
        omega
Set.ncard_eq_toFinset_card'
For any finite set s, its set cardinality (ncard) equals the cardinality of its finset representation (toFinset.card).
Finset.card_sdiff_add_card_inter
For finsets s and t, the cardinality of s \ t plus the cardinality of s ∩ t equals the cardinality of s.
Finset.card_le_card
If s ⊆ t for finsets s and t, then |s| ≤ |t|.
Finset.inter_subset_right
The intersection s₁ ∩ s₂ is a subset of s₂.
Finset.mem_sdiff.mp
If x ∈ s \ t, then x ∈ s and x ∉ t.
Finset.mem_sdiff.mpr
If x ∈ s and x ∉ t, then x ∈ s \ t.
induced_component_ambient_vertex_properties
For an induced subgraph G[R], each connected component has its vertices contained in R, its vertex count equals the component's support size, distinct components are disjoint, and no edge in G connects a vertex in the component to any other vertex in R.
Nat.odd_iff
A natural number n is odd if and only if n % 2 = 1.
Nat.even_iff
A natural number n is even if and only if n % 2 = 0.
Finset.sdiff_subset
The set difference s \ t is a subset of s.
odd_groups_budget_after_forced_matching
In a graph with a matching T extended by a perfect matching P, if J indexes pairwise disjoint, odd-sized subsets F(i) ⊆ L of vertices unmatched by T that have no edges to L \ F(i), then |J| is at most the number of vertices outside L not matched by T.
Set.ncard_coe_finset
The set cardinality (ncard) of a coerced finset equals the finset's cardinality.

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 odd_component_bound_after_even_deletions    (k r : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (C : Finset (Fin (4*k)))    (P T : G.Subgraph) [DecidablePred (fun v => v ∈ T.verts)]    (hP : P.IsPerfectMatching) (hT : T.IsMatching) (hTP : T ≤ P)    (B : Finset (G.induce {v | v ∉ C}).ConnectedComponent) (hB : B.card ≤ 1)    (hpar : ∀ i ∈ (G.induce {v | v ∉ C}).oddComponents.toFinset, i ∉ B →      Even ((in1206_component_vertices G {v | v ∉ C} i) ∩ T.verts.toFinset).card)    (hremain : ((C : Set (Fin (4*k))) \ T.verts).ncard = r) :    (G.induce {v | v ∉ C}).oddComponents.ncard ≤ r+1 := by  set_option maxHeartbeats 4000000 in    classical    let R : Set (Fin (4*k)) := {v | v ∉ C}    let H := G.induce R    let O : Finset H.ConnectedComponent := H.oddComponents.toFinset    let J : Finset H.ConnectedComponent := O \ B    let F : H.ConnectedComponent → Finset (Fin (4*k)) :=      fun i => in1206_component_vertices G R i \ T.verts.toFinset    let L : Finset (Fin (4*k)) := R.toFinset \ T.verts.toFinset    have hJcard : H.oddComponents.ncard ≤ J.card + 1 := by      have hO : O.card = H.oddComponents.ncard := by        dsimp [O]        exact (Set.ncard_eq_toFinset_card' H.oddComponents).symm      have hcount := Finset.card_sdiff_add_card_inter O B      have hinter : (O ∩ B).card ≤ B.card := Finset.card_le_card Finset.inter_subset_right      dsimp [J]      omega    have hJodd : ∀ i ∈ J, Odd (F i).card := by      intro i hi      have hiO : i ∈ O := (Finset.mem_sdiff.mp hi).1      have hiB : i ∉ B := (Finset.mem_sdiff.mp hi).2      have hiOdd : i ∈ H.oddComponents := by simpa [O] using hiO      have hc := (induced_component_ambient_vertex_properties G R i i).2.1      have horig : Odd (in1206_component_vertices G R i).card := by        rw [hc]        exact hiOdd      have heven := hpar i hiO hiB      change Even ((in1206_component_vertices G R i) ∩ T.verts.toFinset).card at heven      have hcount := Finset.card_sdiff_add_card_inter        (in1206_component_vertices G R i) T.verts.toFinset      rw [Nat.odd_iff] at horig ⊢      rw [Nat.even_iff] at heven      dsimp [F]      omega    have hJsub : ∀ i ∈ J, F i ⊆ L := by      intro i hi v hv      have hv' := Finset.mem_sdiff.mp hv      have hh := (induced_component_ambient_vertex_properties G R i i).1 hv'.1      apply Finset.mem_sdiff.mpr      exact ⟨by simpa using hh, hv'.2⟩    have hJdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j) := by      intro i hi j hj hij      exact ((induced_component_ambient_vertex_properties G R i j).2.2.1 hij).mono        Finset.sdiff_subset Finset.sdiff_subset    have hJanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v ∈ L, v ∉ F i → ¬ G.Adj u v := by      intro i hi u hu v hv hvnot      have hu' := Finset.mem_sdiff.mp hu      have hv' := Finset.mem_sdiff.mp hv      have hvR : v ∈ R := by simpa using hv'.1      have hvcomp : v ∉ in1206_component_vertices G R i := by        intro hh        exact hvnot (Finset.mem_sdiff.mpr ⟨hh,hv'.2⟩)      exact (induced_component_ambient_vertex_properties G R i i).2.2.2 u hu'.1 v hvR hvcomp    have hJfree : ∀ i ∈ J, ∀ u ∈ F i, u ∉ T.verts := by      intro i hi u hu      simpa using (Finset.mem_sdiff.mp hu).2    have hbudget := odd_groups_budget_after_forced_matching G P T hP hT hTP J F L      hJsub hJodd hJdis hJanti hJfree    have hcount : ((Finset.univ \ L).filter (fun v => v ∉ T.verts)).card = r := by      have heq : (((Finset.univ \ L).filter (fun v => v ∉ T.verts)) : Set (Fin (4*k))) =          (C : Set (Fin (4*k))) \ T.verts := by        ext v        by_cases ht : v ∈ T.verts        · simp [ht]        · simp [L,R,ht]      rw [← Set.ncard_coe_finset,heq,hremain]    rw [hcount] at hbudget    change H.oddComponents.ncard ≤ r+1    omega
See it in the graphDiscuss this resultChallenge it