AFTD Auto-Formalizing Theoretical Domains

extendible_matching_residual_has_perfect_matching

theoremverified

In a k-extendible graph, the vertices uncovered by a k-matching have a perfect matching.

Statement

theorem extendible_matching_residual_has_perfect_matching
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (k : ℕ)
    (hext : is_k_extendable G k) (M : G.Subgraph)
    (hM : M.IsMatching) (hcard : M.edgeSet.ncard = k) :
    ∃ P : (G.induce {v | v ∉ M.verts}).Subgraph, P.IsPerfectMatching
Source
Matching residual in 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 the definition of a k-extendible graph, the k-matching M extends to a perfect matching P of G. Because M is a sub-matching of P, any edge of P incident to a vertex uncovered by M cannot have its other endpoint in M, meaning the edges of P incident to the uncovered vertices never cross into M. Restricting P to the induced subgraph on the uncovered vertices therefore yields a perfect matching of that subgraph.

  1. The k-matching M extends to a perfect matching P of G.

    Enable classical logic and invoke the definition of k-extendibility (is_k_extendable), which guarantees that any matching of size k extends to a perfect matching P of G containing all edges of M.

    lines 6–7

      classical
      obtain ⟨P,hP,hMP⟩ := hext.2.2 M hM hcard
  2. Any edge in P with one endpoint outside M has both endpoints outside M.

    Suppose for contradiction that a and b are adjacent in P with a ∉ M.verts but b ∈ M.verts. Since M is a matching, b is incident to an edge (b, c) in M. Because M ≤ P, the edge (b, c) also belongs to P. But P is a matching, so b has a unique neighbor in P. Since b is adjacent to both a and c in P, we must have c = a. However, c is an endpoint of an edge in M, which means a = c ∈ M.verts, contradicting a ∉ M.verts.

    lines 8–13

      have hcl : ∀ a b, P.Adj a b → a ∉ M.verts → b ∉ M.verts := by
        intro a b hab ha hbM
        obtain ⟨c,hc,_⟩ := hM hbM
        have hPc : P.Adj b c := hMP.2 hc
        have hca : c = a := (hP.1 (hP.2 b)).unique hPc hab.symm
        exact ha (hca ▸ M.edge_vert hc.symm)
  3. Restricting P to the induced subgraph on V ∖ M.verts yields a candidate subgraph P', and it suffices to show P' is a perfect matching.

    Construct the graph homomorphism f from the induced subgraph on V ∖ M.verts into G via the vertex inclusion Subtype.val. Define P' as the pullback (comap) of P along f. To prove that P' is a perfect matching on the induced subgraph, it suffices to show that P' is a matching and that it spans all vertices of the induced subgraph.

    lines 14–17

    uses Subtype.val

      let f : (G.induce {v | v ∉ M.verts}) →g G := ⟨Subtype.val, by intro a b h; exact h⟩
      let P' := P.comap f
      refine ⟨P',?_⟩
      constructor
  4. P' is a matching in the induced subgraph.

    Given any vertex a in the induced subgraph, since P is a perfect matching on G, a has a unique neighbor b in P. By the previously established property, since a ∉ M.verts, b ∉ M.verts as well, so b belongs to the induced subgraph and is adjacent to a in P'. Any neighbor c of a in P' must also be a neighbor of a in P, so c.val = b by the uniqueness of a's neighbor in P. By Subtype.ext, c equals b in the induced subgraph, showing that every vertex in P' has a unique neighbor.

    lines 18–24

    uses Subtype.ext

      · intro a ha
        obtain ⟨b,hab,huniq⟩ := hP.1 (hP.2 a.val)
        have hbR : b ∉ M.verts := hcl _ _ hab a.property
        refine ⟨⟨b,hbR⟩,⟨P.adj_sub hab,hab⟩,?_⟩
        intro c hc
        apply Subtype.ext
        exact huniq c.val hc.2
  5. P' is spanning in the induced subgraph, completing the proof that P' is a perfect matching.

    Every vertex a of the induced subgraph is a vertex of G, and since P is a perfect matching on G, it is spanning and therefore contains a.val. Thus a belongs to P' as well.

    lines 25–26

      · intro a
        exact hP.2 a.val
Subtype.val
The projection from a subtype {x // p x} to the underlying type, extracting the value.
Subtype.ext
Two elements 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 extendible_matching_residual_has_perfect_matching    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (k : ℕ)    (hext : is_k_extendable G k) (M : G.Subgraph)    (hM : M.IsMatching) (hcard : M.edgeSet.ncard = k) :    ∃ P : (G.induce {v | v ∉ M.verts}).Subgraph, P.IsPerfectMatching := by  classical  obtain ⟨P,hP,hMP⟩ := hext.2.2 M hM hcard  have hcl : ∀ a b, P.Adj a b → a ∉ M.verts → b ∉ M.verts := by    intro a b hab ha hbM    obtain ⟨c,hc,_⟩ := hM hbM    have hPc : P.Adj b c := hMP.2 hc    have hca : c = a := (hP.1 (hP.2 b)).unique hPc hab.symm    exact ha (hca ▸ M.edge_vert hc.symm)  let f : (G.induce {v | v ∉ M.verts}) →g G := ⟨Subtype.val, by intro a b h; exact h⟩  let P' := P.comap f  refine ⟨P',?_⟩  constructor  · intro a ha    obtain ⟨b,hab,huniq⟩ := hP.1 (hP.2 a.val)    have hbR : b ∉ M.verts := hcl _ _ hab a.property    refine ⟨⟨b,hbR⟩,⟨P.adj_sub hab,hab⟩,?_⟩    intro c hc    apply Subtype.ext    exact huniq c.val hc.2  · intro a    exact hP.2 a.val
See it in the graphDiscuss this resultChallenge it