AFTD Auto-Formalizing Theoretical Domains

extendible_two_odd_anticomplete_shores_complement_unmatchable

theoremverified

In a finite k-extendible graph, if disjoint odd vertex sets T and N are anticomplete and their complement has 2k vertices, that complement is not matchable.

Statement

theorem extendible_two_odd_anticomplete_shores_complement_unmatchable
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (k : ℕ)
    (hG : is_k_extendable G k) (T N : Finset V)
    (ht : T.card % 2 = 1) (hn : N.card % 2 = 1) (hdisj : Disjoint T N)
    (hcross : ∀ a ∈ T, ∀ b ∈ N, ¬ G.Adj a b)
    (hsize : ({v : V | v ∉ T ∧ v ∉ N} : Set V).ncard = 2 * k) :
    ¬ ∃ P : (G.induce {v | v ∉ T ∧ v ∉ N}).Subgraph, P.IsPerfectMatching
Source
General form of the proved twenty-vertex odd-shore lemma in the OP-1957 cut route.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
Used by 3

The proof, explained

We argue by contradiction. Suppose the complement S = V(G) \ (T ∪ N) has a perfect matching P, which has k edges because |S| = 2k. By k-extendibility, P extends to a perfect matching P' of the whole graph G. Since T and N are anticomplete and vertices in S are already matched within S by P, any vertex in T must be matched by P' to another vertex in T. This implies that P' induces a matching on T, which forces |T| to be even, contradicting the assumption that |T| is odd.

  1. Every edge in a matching has exactly two endpoints in the matching's vertex set.

    For an edge e = s(a, b) in a matching M, the fiber of the vertex-to-edge projection consists precisely of the pair of endpoints {a, b}. Because a and b are adjacent in a simple graph, they are distinct, so this fiber has cardinality 2.

    lines 4–30

    uses Sym2.ind, Subtype.ext, Fintype.card_congr, Equiv.setCongr, Set.toFinset_card

      classical
      have key : ∀ e : M.edgeSet, Fintype.card {v : M.verts // h.toEdge v = e} = 2 := by
        rintro ⟨x, hx⟩
        revert hx
        induction x using Sym2.ind with
        | _ a b =>
          intro hx
          have hab : M.Adj a b := SimpleGraph.Subgraph.mem_edgeSet.mp hx
          have h1 : (⟨s(a, b), hx⟩ : M.edgeSet) =
              ⟨s(a, b), SimpleGraph.Subgraph.mem_edgeSet.mpr hab⟩ := Subtype.ext rfl
          have hEq : h.toEdge ⁻¹' {⟨s(a, b), hx⟩} = {⟨a, hab.fst_mem⟩, ⟨b, hab.snd_mem⟩} := by
            rw [h1]
            exact h.toEdge_preimage_singleton hab
          have hset2 : {v : M.verts | h.toEdge v = (⟨s(a, b), hx⟩ : M.edgeSet)}
              = ({⟨a, hab.fst_mem⟩, ⟨b, hab.snd_mem⟩} : Set M.verts) := by
            ext v
            have hmem := Set.ext_iff.mp hEq v
            simpa only [Set.mem_preimage, Set.mem_singleton_iff, Set.mem_ofPred_eq,
              Set.mem_insert_iff] using hmem
          calc Fintype.card {v : M.verts // h.toEdge v = (⟨s(a, b), hx⟩ : M.edgeSet)}
              = Fintype.card ↥({⟨a, hab.fst_mem⟩, ⟨b, hab.snd_mem⟩} : Set M.verts) :=
                Fintype.card_congr (Equiv.setCongr hset2)
            _ = 2 := by
                rw [← Set.toFinset_card]
                have hne : (⟨a, hab.fst_mem⟩ : M.verts) ≠ ⟨b, hab.snd_mem⟩ := by
                  simp [G.ne_of_adj (M.adj_sub hab)]
                simp [hne]
  2. The vertex set of a matching has twice as many elements as the edge set, as finite types.

    Decomposing the vertices into fibers over the edges via Equiv.sigmaFiberEquiv shows that the total number of vertices is the sum of fiber sizes over all edges. Since each fiber has size 2, the sum equals 2 * |E(M)|.

    lines 31–37

    uses Fintype.card_sigma, Equiv.sigmaFiberEquiv, Nat.mul_comm

      have hsum : Fintype.card M.verts =
          ∑ e : M.edgeSet, Fintype.card {v : M.verts // h.toEdge v = e} := by
        rw [← Fintype.card_sigma]
        exact Fintype.card_congr (Equiv.sigmaFiberEquiv h.toEdge).symm
      have h1 : Fintype.card M.verts = 2 * Fintype.card M.edgeSet := by
        rw [hsum]
        simp [key, Nat.mul_comm]
  3. For any matching M, 2 * |E(M)| = |V(M)| in terms of set cardinality (ncard).

    Using Set.ncard_eq_toFinset_card, the equality of cardinalities transfers from Fintype.card to Set.ncard.

    lines 38–44

    uses Set.ncard_eq_toFinset_card, Set.toFinite_toFinset, Set.toFinset_card

      have hv : M.verts.ncard = Fintype.card M.verts := by
        rw [Set.ncard_eq_toFinset_card M.verts, Set.toFinite_toFinset]
        exact Set.toFinset_card M.verts
      have he : M.edgeSet.ncard = Fintype.card M.edgeSet := by
        rw [Set.ncard_eq_toFinset_card M.edgeSet, Set.toFinite_toFinset]
        exact Set.toFinset_card M.edgeSet
      rw [hv, he, h1]
  4. Assume for contradiction that G[S] has a perfect matching P, and unpack the extension property from k-extendibility.

    We assume for contradiction that the induced subgraph on S = V \ (T ∪ N) has a perfect matching P. From the hypothesis that G is k-extendable, we extract the property that every matching of size k extends to a perfect matching of G.

    lines 53–55

      classical
      obtain ⟨-, -, hext⟩ := hG
      rintro ⟨P, hP⟩
  5. The matching P pushes forward to a valid matching M in G.

    The inclusion of the induced subgraph G[S] into G is an injective graph homomorphism because Subtype.val is injective. The pushforward of P under this injective homomorphism is therefore a matching M in G.

    lines 56–61

    uses Subtype.val_injective

      let S : Set (V) := {v | v ∉ T ∧ v ∉ N}
      let f : (G.induce S) →g G :=
        { toFun := Subtype.val, map_rel' := by intro a b h; simpa using h }
      let M : G.Subgraph := P.map f
      have hMinj : Function.Injective f := fun a b h => Subtype.val_injective h
      have hMmatch : M.IsMatching := hP.1.map f hMinj
  6. The vertex set of M is precisely S.

    By SimpleGraph.Subgraph.map_verts, the vertices of M are the images under inclusion of the vertices of P. Since P is a perfect matching of G[S], its vertex set is all of S, so V(M) = S.

    lines 62–67

    uses SimpleGraph.Subgraph.map_verts

      have hMverts : M.verts = S := by
        rw [SimpleGraph.Subgraph.map_verts]
        ext v
        constructor
        · rintro ⟨x, -, rfl⟩; exact x.property
        · intro hv; exact ⟨⟨v, hv⟩, hP.2 ⟨v, hv⟩, rfl⟩
  7. The matching M has size k.

    Applying the auxiliary lemma in1076_odd_shore_two_mul_edge_ncard to M gives 2 * |E(M)| = |V(M)| = |S| = 2k. Linear arithmetic (omega) concludes that |E(M)| = k.

    lines 68–73

    uses in1076_odd_shore_two_mul_edge_ncard

      have hSncard : S.ncard = 2 * k := hsize
      have hMcard : M.edgeSet.ncard = k := by
        have h := in1076_odd_shore_two_mul_edge_ncard
          hMmatch
        rw [hMverts, hSncard] at h
        omega
  8. Extend M to a perfect matching P' of G, and define R as the subgraph of P' induced on T.

    Because M has size k, the k-extendibility of G provides a perfect matching P' of G extending M. We define R = P'[T] to be the subgraph of P' induced on T, so V(R) = T.

    lines 74–76

      obtain ⟨P', hP', hle⟩ := hext M hMmatch hMcard
      let R : G.Subgraph := P'.induce (↑T : Set (V))
      have hRverts : R.verts = ↑T := rfl
  9. The induced subgraph R = P'[T] is a matching.

    For any vertex v ∈ T, the perfect matching P' pairs v with a unique vertex w. The partner w cannot lie in N because T and N are anticomplete in G. Nor can w lie in S: if w ∈ S, then w is already matched in M ⊆ P' to some u ∈ S, forcing u = v by uniqueness in P', which contradicts the disjointness of S and T. Hence w must lie in T, so vw is an edge of R. By uniqueness of the neighbor in P', w is the unique neighbor of v in R.

    lines 77–97

      have hRmatch : R.IsMatching := by
        intro v hv
        rw [hRverts] at hv
        obtain ⟨w, hw, hwuniq⟩ := hP'.1 (hP'.2 v)
        have hwN : w ∉ N := by
          intro hwN
          exact hcross v hv w hwN (P'.adj_sub hw)
        have hwS : w ∉ S := by
          intro hwS
          obtain ⟨u, hMu, -⟩ := hMmatch (v := w) (by rw [hMverts]; exact hwS)
          have hPu : P'.Adj w u := hle.2 hMu
          have huv : u = v := (hP'.1 (hP'.2 w)).unique hPu hw.symm
          have huS : u ∈ S := hMverts ▸ M.edge_vert hMu.symm
          rw [huv] at huS
          exact huS.1 hv
        have hwT : w ∈ T := by
          by_contra hwT
          exact hwS ⟨hwT, hwN⟩
        refine ⟨w, ⟨hv, hwT, hw⟩, ?_⟩
        rintro y ⟨-, -, hPy⟩
        exact hwuniq y hPy
  10. The cardinality of T is both even and odd, which is a contradiction.

    Since R is a matching on T, |T| must be even. However, |T| is given to be odd (|T| % 2 = 1). Linear arithmetic (omega) derives a contradiction from an integer being simultaneously even and odd.

    lines 98–105

      have hEven : Even R.verts.toFinset.card := hRmatch.even_card
      have hTeq : R.verts.toFinset = T := by
        rw [hRverts]
        ext v
        simp
      rw [hTeq] at hEven
      obtain ⟨t, htEven⟩ := hEven
      omega
Sym2.ind
Every unordered pair in Sym2 α is of the form s(x, y) for some elements x, y.
Subtype.ext
Two subtype elements are equal if their underlying values are equal.
Fintype.card_congr
A bijection between finite types preserves their cardinality.
Equiv.setCongr
Equal sets induce an equivalence between their corresponding subtype types.
Set.toFinset_card
The cardinality of the finset associated to a finite set equals the cardinality of the subtype.
Fintype.card_sigma
The cardinality of a dependent sum of finite types is the sum of the cardinalities of the fibers.
Equiv.sigmaFiberEquiv
A type is naturally equivalent to the sigma-type of fibers over any target type.
Nat.mul_comm
Multiplication of natural numbers is commutative.
Set.ncard_eq_toFinset_card
For any finite set, its set cardinality (ncard) equals the cardinality of its corresponding toFinset.
Set.toFinite_toFinset
The finset obtained from a set by finiteness coincides with toFinset.
Subtype.val_injective
The subtype coercion map from a subtype to its ambient type is injective.
SimpleGraph.Subgraph.map_verts
The vertex set of a subgraph mapped along a graph homomorphism is the image of the original vertex set.
in1076_odd_shore_two_mul_edge_ncard
In any matching of a finite graph, twice the number of edges equals the number of vertices.

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

private lemma in1076_odd_shore_two_mul_edge_ncard    {V : Type*} [Fintype V] {G : SimpleGraph V} {M : G.Subgraph}    (h : M.IsMatching) : 2 * M.edgeSet.ncard = M.verts.ncard := by  classical  have key : ∀ e : M.edgeSet, Fintype.card {v : M.verts // h.toEdge v = e} = 2 := by    rintro ⟨x, hx⟩    revert hx    induction x using Sym2.ind with    | _ a b =>      intro hx      have hab : M.Adj a b := SimpleGraph.Subgraph.mem_edgeSet.mp hx      have h1 : (⟨s(a, b), hx⟩ : M.edgeSet) =          ⟨s(a, b), SimpleGraph.Subgraph.mem_edgeSet.mpr hab⟩ := Subtype.ext rfl      have hEq : h.toEdge ⁻¹' {⟨s(a, b), hx⟩} = {⟨a, hab.fst_mem⟩, ⟨b, hab.snd_mem⟩} := by        rw [h1]        exact h.toEdge_preimage_singleton hab      have hset2 : {v : M.verts | h.toEdge v = (⟨s(a, b), hx⟩ : M.edgeSet)}          = ({⟨a, hab.fst_mem⟩, ⟨b, hab.snd_mem⟩} : Set M.verts) := by        ext v        have hmem := Set.ext_iff.mp hEq v        simpa only [Set.mem_preimage, Set.mem_singleton_iff, Set.mem_ofPred_eq,          Set.mem_insert_iff] using hmem      calc Fintype.card {v : M.verts // h.toEdge v = (⟨s(a, b), hx⟩ : M.edgeSet)}          = Fintype.card ↥({⟨a, hab.fst_mem⟩, ⟨b, hab.snd_mem⟩} : Set M.verts) :=            Fintype.card_congr (Equiv.setCongr hset2)        _ = 2 := by            rw [← Set.toFinset_card]            have hne : (⟨a, hab.fst_mem⟩ : M.verts) ≠ ⟨b, hab.snd_mem⟩ := by              simp [G.ne_of_adj (M.adj_sub hab)]            simp [hne]  have hsum : Fintype.card M.verts =      ∑ e : M.edgeSet, Fintype.card {v : M.verts // h.toEdge v = e} := by    rw [← Fintype.card_sigma]    exact Fintype.card_congr (Equiv.sigmaFiberEquiv h.toEdge).symm  have h1 : Fintype.card M.verts = 2 * Fintype.card M.edgeSet := by    rw [hsum]    simp [key, Nat.mul_comm]  have hv : M.verts.ncard = Fintype.card M.verts := by    rw [Set.ncard_eq_toFinset_card M.verts, Set.toFinite_toFinset]    exact Set.toFinset_card M.verts  have he : M.edgeSet.ncard = Fintype.card M.edgeSet := by    rw [Set.ncard_eq_toFinset_card M.edgeSet, Set.toFinite_toFinset]    exact Set.toFinset_card M.edgeSet  rw [hv, he, h1]theorem extendible_two_odd_anticomplete_shores_complement_unmatchable    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (k : ℕ)    (hG : is_k_extendable G k) (T N : Finset V)    (ht : T.card % 2 = 1) (hn : N.card % 2 = 1) (hdisj : Disjoint T N)    (hcross : ∀ a ∈ T, ∀ b ∈ N, ¬ G.Adj a b)    (hsize : ({v : V | v ∉ T ∧ v ∉ N} : Set V).ncard = 2 * k) :    ¬ ∃ P : (G.induce {v | v ∉ T ∧ v ∉ N}).Subgraph, P.IsPerfectMatching := by  classical  obtain ⟨-, -, hext⟩ := hG  rintro ⟨P, hP⟩  let S : Set (V) := {v | v ∉ T ∧ v ∉ N}  let f : (G.induce S) →g G :=    { toFun := Subtype.val, map_rel' := by intro a b h; simpa using h }  let M : G.Subgraph := P.map f  have hMinj : Function.Injective f := fun a b h => Subtype.val_injective h  have hMmatch : M.IsMatching := hP.1.map f hMinj  have hMverts : M.verts = S := by    rw [SimpleGraph.Subgraph.map_verts]    ext v    constructor    · rintro ⟨x, -, rfl⟩; exact x.property    · intro hv; exact ⟨⟨v, hv⟩, hP.2 ⟨v, hv⟩, rfl⟩  have hSncard : S.ncard = 2 * k := hsize  have hMcard : M.edgeSet.ncard = k := by    have h := in1076_odd_shore_two_mul_edge_ncard      hMmatch    rw [hMverts, hSncard] at h    omega  obtain ⟨P', hP', hle⟩ := hext M hMmatch hMcard  let R : G.Subgraph := P'.induce (↑T : Set (V))  have hRverts : R.verts = ↑T := rfl  have hRmatch : R.IsMatching := by    intro v hv    rw [hRverts] at hv    obtain ⟨w, hw, hwuniq⟩ := hP'.1 (hP'.2 v)    have hwN : w ∉ N := by      intro hwN      exact hcross v hv w hwN (P'.adj_sub hw)    have hwS : w ∉ S := by      intro hwS      obtain ⟨u, hMu, -⟩ := hMmatch (v := w) (by rw [hMverts]; exact hwS)      have hPu : P'.Adj w u := hle.2 hMu      have huv : u = v := (hP'.1 (hP'.2 w)).unique hPu hw.symm      have huS : u ∈ S := hMverts ▸ M.edge_vert hMu.symm      rw [huv] at huS      exact huS.1 hv    have hwT : w ∈ T := by      by_contra hwT      exact hwS ⟨hwT, hwN⟩    refine ⟨w, ⟨hv, hwT, hw⟩, ?_⟩    rintro y ⟨-, -, hPy⟩    exact hwuniq y hPy  have hEven : Even R.verts.toFinset.card := hRmatch.even_card  have hTeq : R.verts.toFinset = T := by    rw [hRverts]    ext v    simp  rw [hTeq] at hEven  obtain ⟨t, htEven⟩ := hEven  omega
See it in the graphDiscuss this resultChallenge it