AFTD Auto-Formalizing Theoretical Domains

five_extendable_twenty_vertex_odd_shores_no_complement_matching

theoremverified

Let G be a 5-extendible graph on 20 vertices, and let disjoint sets T and N have 3 and 7 vertices with no edges between them. The induced graph on the ten vertices outside T and N has no perfect matching.

Statement

theorem five_extendable_twenty_vertex_odd_shores_no_complement_matching
    (G : SimpleGraph (Fin 20)) (hG : is_k_extendable G 5)
    (T N : Finset (Fin 20)) (ht : T.card = 3) (hn : N.card = 7)
    (hdisj : Disjoint T N)
    (hcross : ∀ a ∈ T, ∀ b ∈ N, ¬ G.Adj a b) :
    ¬ ∃ P : (G.induce {v | v ∉ T ∧ v ∉ N}).Subgraph, P.IsPerfectMatching
Source
Triple-twin cut obstruction used in the two-critical-edge branch of OP-1957.
Verified
20 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 1

The proof, explained

The theorem is proved by contradiction. Suppose the induced subgraph on the ten remaining vertices S = (T ∪ N)ᶜ has a perfect matching P, which embeds into G as a matching M of size 5. Because G is 5-extendible, M extends to a perfect matching P' of G. Vertices in T cannot be matched by P' to N (no edges exist between them) nor to S (whose vertices are already fully matched to each other in M ⊆ P'), so P' must match T entirely within itself. This induces a matching on T, forcing |T| = 3 to be even, which is impossible.

  1. In any matching M, each edge contains exactly two vertices.

    For each edge e = s(a, b) in M, the fiber of the map toEdge (which associates each vertex of M to its incident edge) consists precisely of the endpoints a and b. Since a and b are adjacent in M, they are distinct, so this fiber has cardinality exactly 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 number of vertices in a matching M is twice the number of edges: |M.verts| = 2 |M.edgeSet|.

    Partitioning the vertices of M into fibers over the edges of M via sigmaFiberEquiv shows that the total number of vertices is the sum of the fiber sizes over all edges, giving |M.verts| = ∑ 2 = 2 |M.edgeSet|. Converting between fintype card and set ncard completes the helper lemma.

    lines 31–44

    uses Fintype.card_sigma, Equiv.sigmaFiberEquiv, Nat.mul_comm, Set.ncard_eq_toFinset_card, Set.toFinite_toFinset

      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]
  3. Assuming for contradiction that G[S] has a perfect matching P, embedding P into G yields a matching M whose vertex set is S.

    Suppose for contradiction that the induced subgraph on S = (T ∪ N)ᶜ has a perfect matching P. The canonical inclusion f : G[S] →g G is injective. Pushing P forward along f produces a matching M in G whose vertex set is exactly S, because every vertex in S is matched by P.

    lines 52–66

    uses Subtype.val_injective, SimpleGraph.Subgraph.map_verts

      classical
      obtain ⟨-, -, hext⟩ := hG
      rintro ⟨P, hP⟩
      let S : Set (Fin 20) := {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⟩
  4. The set S has 10 vertices, M has 5 edges, and M extends to a perfect matching P' of G.

    Since T and N are disjoint with sizes 3 and 7, their union has size 10, leaving 20 - 10 = 10 vertices in S. By the helper lemma, 2 |M.edgeSet| = |S| = 10, so M has 5 edges. Because G is 5-extendible, M extends to a perfect matching P' of G.

    lines 67–79

    uses Set.ncard_coe_finset, Finset.card_sdiff, Finset.card_union_of_disjoint, five_extendable_twenty_vertex_odd_shores_no_complement_matching_two_mul_edge_ncard

      have hSncard : S.ncard = 10 := by
        have hSeq : S = ↑(Finset.univ \ (T ∪ N)) := by
          ext v; simp [S]
        rw [hSeq, Set.ncard_coe_finset, Finset.card_sdiff]
        have hcard : (T ∪ N).card = 10 := by
          rw [Finset.card_union_of_disjoint hdisj, ht, hn]
        simp [hcard]
      have hMcard : M.edgeSet.ncard = 5 := by
        have h := five_extendable_twenty_vertex_odd_shores_no_complement_matching_two_mul_edge_ncard
          hMmatch
        rw [hMverts, hSncard] at h
        omega
      obtain ⟨P', hP', hle⟩ := hext M hMmatch hMcard
  5. The restriction R = P'[T] of P' to T is a matching on T.

    Every vertex v ∈ T is matched by the perfect matching P' to a unique partner w. We show w must be in T: w cannot be in N because there are no edges between T and N in G; and w cannot be in S because all vertices of S are already matched to each other in M ⊆ P', which would force v ∈ S by uniqueness of edges in P', contradicting v ∈ T. Hence w ∈ T, showing R is a matching on T.

    lines 80–102

      let R : G.Subgraph := P'.induce (↑T : Set (Fin 20))
      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
  6. The cardinality of T must be even, contradicting |T| = 3.

    Because R is a matching on T whose vertex set is all of T, the cardinality of T must be even. But |T| = 3 is odd, which is impossible (2k = 3 has no integer solution). This contradiction shows that G[S] has no perfect matching.

    lines 103–110

      have hEven : Even R.verts.toFinset.card := hRmatch.even_card
      have hTeq : R.verts.toFinset = T := by
        rw [hRverts]
        ext v
        simp
      rw [hTeq, ht] at hEven
      obtain ⟨k, hk⟩ := hEven
      omega
Sym2.ind
Every property of unordered pairs holds for all pairs if it holds for pairs of the form s(x, y).
Subtype.ext
Two subtype elements are equal if their underlying values are equal.
Fintype.card_congr
Two types in bijection have the same cardinality.
Equiv.setCongr
Equal sets induce an equivalence between their subtype elements.
Set.toFinset_card
The cardinality of a finite set as a finset equals the cardinality of its subtype fintype.
Fintype.card_sigma
The cardinality of a sigma type is the sum of the cardinalities of its fibers.
Equiv.sigmaFiberEquiv
A domain type is naturally equivalent to the disjoint union of the fibers of any map defined on it.
Nat.mul_comm
Multiplication of natural numbers is commutative.
Set.ncard_eq_toFinset_card
The set cardinality ncard of a finite set equals the cardinality of its finset representation.
Set.toFinite_toFinset
The finset obtained from finiteness of a set agrees with the finset from its subtype fintype instance.
Subtype.val_injective
The projection Subtype.val from a subtype to its base type is injective.
SimpleGraph.Subgraph.map_verts
The vertex set of the pushforward of a subgraph under a homomorphism is the image of the subgraph's vertex set.
Set.ncard_coe_finset
The set cardinality ncard of a coerced finset equals the finset's cardinality.
Finset.card_sdiff
The cardinality of a set difference t \ s is |t| - |s ∩ t|.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finsets is the sum of their cardinalities.
five_extendable_twenty_vertex_odd_shores_no_complement_matching_two_mul_edge_ncard
For any matching M, twice the number of edges equals the number of vertices in M.

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 five_extendable_twenty_vertex_odd_shores_no_complement_matching_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 five_extendable_twenty_vertex_odd_shores_no_complement_matching    (G : SimpleGraph (Fin 20)) (hG : is_k_extendable G 5)    (T N : Finset (Fin 20)) (ht : T.card = 3) (hn : N.card = 7)    (hdisj : Disjoint T N)    (hcross : ∀ a ∈ T, ∀ b ∈ N, ¬ G.Adj a b) :    ¬ ∃ P : (G.induce {v | v ∉ T ∧ v ∉ N}).Subgraph, P.IsPerfectMatching := by  classical  obtain ⟨-, -, hext⟩ := hG  rintro ⟨P, hP⟩  let S : Set (Fin 20) := {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 = 10 := by    have hSeq : S = ↑(Finset.univ \ (T ∪ N)) := by      ext v; simp [S]    rw [hSeq, Set.ncard_coe_finset, Finset.card_sdiff]    have hcard : (T ∪ N).card = 10 := by      rw [Finset.card_union_of_disjoint hdisj, ht, hn]    simp [hcard]  have hMcard : M.edgeSet.ncard = 5 := by    have h := five_extendable_twenty_vertex_odd_shores_no_complement_matching_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 (Fin 20))  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, ht] at hEven  obtain ⟨k, hk⟩ := hEven  omega
See it in the graphDiscuss this resultChallenge it