AFTD Auto-Formalizing Theoretical Domains

odd_groups_budget_after_forced_matching

theoremverified

Odd anticomplete groups disjoint from a forced matching require distinct matching partners outside the groups and outside the forced matching.

Statement

theorem odd_groups_budget_after_forced_matching
    {V I : Type*} [Fintype V] [DecidableEq V] [DecidableEq I]
    (G : SimpleGraph V) (P T : G.Subgraph) [DecidablePred (fun v => v ∈ T.verts)]
    (hP : P.IsPerfectMatching) (hT : T.IsMatching) (hTP : T ≤ P)
    (J : Finset I) (F : I → Finset V) (L : Finset V)
    (hsub : ∀ i ∈ J, F i ⊆ L) (hodd : ∀ i ∈ J, Odd (F i).card)
    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j))
    (hanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v ∈ L, v ∉ F i → ¬ G.Adj u v)
    (hfree : ∀ i ∈ J, ∀ u ∈ F i, u ∉ T.verts) :
    J.card ≤ ((Finset.univ \ L).filter (fun v => v ∉ T.verts)).card
Source
Matching and odd-component budget for OP-1957; https://arxiv.org/abs/2611.22690.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 9

The proof, explained

To show that the number of odd groups is at most the number of available vertices outside L and outside the forced matching T, we construct an injection from J into the set of vertices in V \ L that do not belong to T. Each group F i has odd cardinality and is anticomplete to L \ F i, so the perfect matching P cannot match F i entirely within L without inducing an even-sized matching on F i, which guarantees a partner b outside L. Furthermore, this partner b cannot belong to T, because the unique P-edge incident to b would force a vertex of F i to lie in T, contradicting that F i is disjoint from T. Since P is a matching and the groups are pairwise disjoint, distinct groups must receive distinct partners, giving an injection that establishes the desired inequality.

  1. To establish the cardinality bound, it suffices to show that each group F i has a matching partner in P lying outside L and outside the forced matching T.

    We fix an arbitrary group index i ∈ J to prove the key lemma (hkey): every odd group F i has a vertex matched under P to some vertex b ∉ L with b ∉ V(T).

    lines 11–13

      classical
      have hkey : ∀ i ∈ J, ∃ b : V, b ∉ L ∧ b ∉ T.verts ∧ ∃ a ∈ F i, P.Adj a b := by
        intro i hi
  2. Each group F i contains at least one vertex matched under P to a vertex outside L.

    Suppose for contradiction that all vertices of F i were matched in P to vertices inside L. Since F i is anticomplete to L \ F i in G, and P is a subgraph of G, no edges of P can leave F i to L \ F i. Thus all matching edges of P incident to F i would have to remain entirely within F i, making the induced subgraph of P on F i a matching. Any graph admitting a matching has an even number of vertices by even_card (using Fintype.ofFinite and Set.ncard_eq_toFinset_card'), which forces |F i| to be even. This contradicts the hypothesis that |F i| is odd (via Nat.not_even_iff_odd.mpr). Hence, some vertex a ∈ F i must be matched under P to a vertex b ∉ L.

    lines 14–38

    uses Fintype.ofFinite, Set.ncard_eq_toFinset_card', Nat.not_even_iff_odd.mpr

        have hout : ∃ b : V, b ∉ L ∧ ∃ a ∈ F i, P.Adj a b := by
          by_contra hno
          push Not at hno
          let C : Set V := (F i : Set V)
          have hmatch : (P.induce C).IsMatching := by
            intro a ha
            have haF : a ∈ F i := ha
            obtain ⟨b,hab,huniq⟩ := hP.1 (hP.2 a)
            have hbL : b ∈ L := by
              by_contra hb
              exact hno b hb a haF hab
            have hbF : b ∈ F i := by
              by_contra hb
              exact hanti i hi a haF b hbL hb (P.adj_sub hab)
            refine ⟨b,⟨haF,hbF,hab⟩,?_⟩
            intro z hz
            exact huniq z hz.2.2
          have hfin : Fintype (P.induce C).verts := Fintype.ofFinite _
          have he := hmatch.even_card
          rw [← Set.ncard_eq_toFinset_card'] at he
          have hC : (P.induce C).verts.ncard = (F i).card := by
            show C.ncard = _
            simp [C]
          rw [hC] at he
          exact (Nat.not_even_iff_odd.mpr (hodd i hi)) he
  3. The matching partner b ∉ L cannot belong to the forced matching T.

    Suppose b ∈ V(T). Since T is a matching, b is incident to an edge (b, z) in T. Because T ≤ P, this edge also belongs to P. By the uniqueness of matching partners in the perfect matching P, this implies z = a. Since z is a vertex of T, it follows that a ∈ V(T), which directly contradicts the assumption that F i contains no vertices of T. Thus b ∉ V(T).

    lines 39–47

        obtain ⟨b,hb,a,ha,hab⟩ := hout
        refine ⟨b,hb,?_,a,ha,hab⟩
        intro hbT
        obtain ⟨z,hbz,_⟩ := hT hbT
        have hpz : P.Adj b z := hTP.2 hbz
        have hza : z = a := (hP.1 (hP.2 b)).unique hpz hab.symm
        apply hfree i hi a ha
        rw [← hza]
        exact hbz.snd_mem
  4. Define a function f from J into the set of vertices outside L and outside V(T).

    For each i ∈ J, we choose the witness vertex b outside L and outside V(T) guaranteed by the key lemma to be the value f(i).

    lines 48–51

      let f : J → {v : V // v ∈ (Finset.univ \ L).filter (fun w => w ∉ T.verts)} := fun i =>
        ⟨(hkey i.val i.property).choose, by
          have hh := (hkey i.val i.property).choose_spec
          simp [hh.1,hh.2.1]⟩
  5. The function f is injective.

    Suppose f(i) = f(j) = b for some i, j ∈ J (using congrArg). The vertex b is matched in P to some a_i ∈ F i and to some a_j ∈ F j. By uniqueness of matching partners in P, a_i = a_j. If i ≠ j, the sets F i and F j are disjoint by Finset.disjoint_left.mp, so they cannot share the common vertex a_i = a_j. Hence i = j by Subtype.ext, proving that f is injective.

    lines 52–63

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

      have hinj : Function.Injective f := by
        intro i j heq
        obtain ⟨_,_,ai,hai,hPi⟩ := (hkey i.val i.property).choose_spec
        obtain ⟨_,_,aj,haj,hPj⟩ := (hkey j.val j.property).choose_spec
        have he : (hkey i.val i.property).choose = (hkey j.val j.property).choose := congrArg Subtype.val heq
        rw [he] at hPi
        have hb : (hkey j.val j.property).choose ∈ P.verts := P.edge_vert hPi.symm
        have ha : ai=aj := (hP.1 hb).unique hPi.symm hPj.symm
        apply Subtype.ext
        by_contra hij
        have hd := hdis i.val i.property j.val j.property hij
        exact Finset.disjoint_left.mp hd hai (ha ▸ haj)
  6. The number of groups |J| is at most the number of available vertices outside L and outside T.

    Because f is an injective function from J to the subtype of vertices in V \ L not in V(T), the cardinality of the domain is at most that of the codomain by Fintype.card_le_of_injective. Simplifying the subtype cardinalities to finset cardinalities via Fintype.card_coe yields the inequality.

    lines 64–65

    uses Fintype.card_le_of_injective, Fintype.card_coe

      have hc := Fintype.card_le_of_injective f hinj
      simpa only [Fintype.card_coe] using hc
Fintype.ofFinite
Constructs a finite type instance from a proof that the type is finite.
Set.ncard_eq_toFinset_card'
The noncomputable cardinality of a set equals the cardinality of its finite set representation.
Nat.not_even_iff_odd.mpr
If a natural number is odd, then it is not even.
congrArg
Applying a function to equal arguments yields equal results.
Finset.disjoint_left.mp
If two finite sets are disjoint, an element of the first cannot belong to the second.
Subtype.ext
Two elements of a subtype are equal if their underlying values are equal.
Fintype.card_le_of_injective
An injective map between finite types implies that the cardinality of the domain is at most the cardinality of the codomain.
Fintype.card_coe
The cardinality of a subtype coerced from a finite set equals the cardinality of the finite set itself.

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_groups_budget_after_forced_matching    {V I : Type*} [Fintype V] [DecidableEq V] [DecidableEq I]    (G : SimpleGraph V) (P T : G.Subgraph) [DecidablePred (fun v => v ∈ T.verts)]    (hP : P.IsPerfectMatching) (hT : T.IsMatching) (hTP : T ≤ P)    (J : Finset I) (F : I → Finset V) (L : Finset V)    (hsub : ∀ i ∈ J, F i ⊆ L) (hodd : ∀ i ∈ J, Odd (F i).card)    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j))    (hanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v ∈ L, v ∉ F i → ¬ G.Adj u v)    (hfree : ∀ i ∈ J, ∀ u ∈ F i, u ∉ T.verts) :    J.card ≤ ((Finset.univ \ L).filter (fun v => v ∉ T.verts)).card := by  classical  have hkey : ∀ i ∈ J, ∃ b : V, b ∉ L ∧ b ∉ T.verts ∧ ∃ a ∈ F i, P.Adj a b := by    intro i hi    have hout : ∃ b : V, b ∉ L ∧ ∃ a ∈ F i, P.Adj a b := by      by_contra hno      push Not at hno      let C : Set V := (F i : Set V)      have hmatch : (P.induce C).IsMatching := by        intro a ha        have haF : a ∈ F i := ha        obtain ⟨b,hab,huniq⟩ := hP.1 (hP.2 a)        have hbL : b ∈ L := by          by_contra hb          exact hno b hb a haF hab        have hbF : b ∈ F i := by          by_contra hb          exact hanti i hi a haF b hbL hb (P.adj_sub hab)        refine ⟨b,⟨haF,hbF,hab⟩,?_⟩        intro z hz        exact huniq z hz.2.2      have hfin : Fintype (P.induce C).verts := Fintype.ofFinite _      have he := hmatch.even_card      rw [← Set.ncard_eq_toFinset_card'] at he      have hC : (P.induce C).verts.ncard = (F i).card := by        show C.ncard = _        simp [C]      rw [hC] at he      exact (Nat.not_even_iff_odd.mpr (hodd i hi)) he    obtain ⟨b,hb,a,ha,hab⟩ := hout    refine ⟨b,hb,?_,a,ha,hab⟩    intro hbT    obtain ⟨z,hbz,_⟩ := hT hbT    have hpz : P.Adj b z := hTP.2 hbz    have hza : z = a := (hP.1 (hP.2 b)).unique hpz hab.symm    apply hfree i hi a ha    rw [← hza]    exact hbz.snd_mem  let f : J → {v : V // v ∈ (Finset.univ \ L).filter (fun w => w ∉ T.verts)} := fun i =>    ⟨(hkey i.val i.property).choose, by      have hh := (hkey i.val i.property).choose_spec      simp [hh.1,hh.2.1]⟩  have hinj : Function.Injective f := by    intro i j heq    obtain ⟨_,_,ai,hai,hPi⟩ := (hkey i.val i.property).choose_spec    obtain ⟨_,_,aj,haj,hPj⟩ := (hkey j.val j.property).choose_spec    have he : (hkey i.val i.property).choose = (hkey j.val j.property).choose := congrArg Subtype.val heq    rw [he] at hPi    have hb : (hkey j.val j.property).choose ∈ P.verts := P.edge_vert hPi.symm    have ha : ai=aj := (hP.1 hb).unique hPi.symm hPj.symm    apply Subtype.ext    by_contra hij    have hd := hdis i.val i.property j.val j.property hij    exact Finset.disjoint_left.mp hd hai (ha ▸ haj)  have hc := Fintype.card_le_of_injective f hinj  simpa only [Fintype.card_coe] using hc
See it in the graphDiscuss this resultChallenge it