AFTD Auto-Formalizing Theoretical Domains

extendible_independent_common_nonneighbor_deficit_le_one

theoremverified

Under the stated high-degree extendibility and independence assumptions, a nonempty independent U and a disjoint anticomplete W satisfy 2|U|+|W|≤2k+1.

Statement

theorem extendible_independent_common_nonneighbor_deficit_le_one
    (k : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (hext : is_k_extendable G k)
    (hdegree : ∀ v, 2*k+1 ≤ (G.neighborFinset v).card)
    (hind : ∀ I : Finset (Fin (4*k)),
      (∀ x ∈ I, ∀ y ∈ I, x ≠ y → ¬ G.Adj x y) → I.card ≤ k)
    (U W : Finset (Fin (4*k))) (hdis : Disjoint U W) (hU : U.Nonempty)
    (hUind : ∀ u ∈ U, ∀ v ∈ U, ¬ G.Adj u v)
    (hanti : ∀ u ∈ U, ∀ w ∈ W, ¬ G.Adj u w) :
    2*U.card+W.card ≤ 2*k+1
Source
Positive-separator transfer for OP-1957; https://arxiv.org/abs/2611.22690.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 10
Used by 3

The proof, explained

The proof proceeds by contradiction, assuming 2|U| + |W| ≥ 2k + 2. First, the degree condition and anticompleteness force |U| ≥ 3, which combined with the bound on the independence number α(G) ≤ k gives k ≥ 3. We choose a subset W₀ ⊆ W of size q = 2k + 2 - 2|U| and an edge {w, z} with w ∈ W₀ and z outside U ∪ W₀, allowing U ∪ W₀ ∪ {z} to be extended to one side R of a balanced cut (R, C) with |R| = |C| = 2k. Using extendibility and cut symmetry, C contains a matching T of size k - 1, which combines with the disjoint edge {w, z} into a matching of size k whose vertex set S of size 2k is disjoint from U ∪ (W₀ \ {w}) and induces a subgraph with a perfect matching. However, the general independent-anticomplete obstruction theorem asserts that no such 2k-vertex induced subgraph can admit a perfect matching, producing the desired contradiction.

  1. For any matching M in G, the induced subgraph on its vertices G[V(M)] has a perfect matching.

    Each vertex v in the vertex set of M is incident to a unique matched edge. Pairing each vertex with its matched partner defines a fixed-point-free involution on V(M) that preserves adjacency. By perfect_matching_of_adjacency_involution, this involution defines a perfect matching on the induced subgraph G[V(M)].

    lines 4–18

    uses Subtype.ext, perfect_matching_of_adjacency_involution

      set_option maxHeartbeats 4000000 in
        classical
        let f : M.verts → M.verts := fun v =>
          ⟨Classical.choose (hM v.property), M.edge_vert (Classical.choose_spec (hM v.property)).1.symm⟩
        have hf : ∀ v : M.verts, M.Adj v.val (f v).val := by
          intro v
          exact (Classical.choose_spec (hM v.property)).1
        have hinv : Function.Involutive f := by
          intro v
          apply Subtype.ext
          exact (hM (f v).property).unique (hf (f v)) (hf v).symm
        have hadj : ∀ v : M.verts, (G.induce M.verts).Adj v (f v) := by
          intro v
          exact M.adj_sub (hf v)
        exact perfect_matching_of_adjacency_involution (G.induce M.verts) f hinv hadj
  2. We assume for contradiction that 2|U| + |W| > 2k + 1.

    We set up a proof by contradiction by negating the desired inequality 2|U| + |W| ≤ 2k + 1.

    lines 30–32

      set_option maxHeartbeats 4000000 in
        classical
        by_contra hn
  3. The independent set U has size at least 3, that is, |U| ≥ 3.

    If |U| ≤ 2, pick u ∈ U (since U is nonempty). Because U is independent and anticomplete to W, all neighbors of u lie in the complement (U ∪ W)ᶜ, which has size 4k - |U| - |W|. The minimum degree hypothesis gives 2k + 1 ≤ deg(u) ≤ 4k - |U| - |W|, so |U| + |W| ≤ 2k - 1. Combining this with |U| ≤ 2 yields 2|U| + |W| ≤ 2k + 1, contradicting the assumption 2|U| + |W| ≥ 2k + 2. Linear arithmetic closes the contradiction.

    lines 33–50

    uses Finset.mem_compl, Finset.mem_union, Finset.card_le_card, Finset.card_compl, Finset.card_union_of_disjoint, Fintype.card_fin

        have hUlarge : 3 ≤ U.card := by
          by_contra hs
          have hsmall : U.card ≤ 2 := by omega
          obtain ⟨u,hu⟩ := hU
          have hNbr : G.neighborFinset u ⊆ (U ∪ W)ᶜ := by
            intro v hv
            have huv : G.Adj u v := by simpa using hv
            simp only [Finset.mem_compl,Finset.mem_union]
            intro hvUW
            rcases hvUW with hvU | hvW
            · exact hUind u hu v hvU huv
            · exact hanti u hu v hvW huv
          have hc := Finset.card_le_card hNbr
          have hcomp := Finset.card_compl (U ∪ W)
          have hunion := Finset.card_union_of_disjoint hdis
          have hd := hdegree u
          simp only [Fintype.card_fin] at hcomp
          omega
  4. |U| ≤ k and k ≥ 3.

    Since U is an independent set, the global hypothesis bounding the independence number by k implies |U| ≤ k. Along with |U| ≥ 3, this gives k ≥ 3.

    lines 51–52

        have hUk : U.card ≤ k := hind U (by intro x hx y hy hne; exact hUind x hx y hy)
        have hk : 3 ≤ k := by omega
  5. There exists a subset W₀ ⊆ W of size q = 2k + 2 - 2|U| disjoint from U, and a vertex w ∈ W₀.

    We define q = 2k + 2 - 2|U|. Since |U| ≤ k and 2|U| + |W| ≥ 2k + 2, we have 1 ≤ q ≤ |W|. By Finset.exists_subset_card_eq, we choose a subset W₀ ⊆ W of size q. Because q ≥ 1, W₀ is nonempty (via Finset.card_pos.mp), so we choose an element w ∈ W₀. Since W₀ ⊆ W and U is disjoint from W, Finset.disjoint_of_subset_right gives that U and W₀ are disjoint.

    lines 53–61

    uses Finset.exists_subset_card_eq, Finset.card_pos.mp, Finset.disjoint_of_subset_right

        let q := 2*k+2-2*U.card
        have hq : q+2*U.card=2*k+2 := by dsimp [q]; omega
        have hqpos : 1 ≤ q := by omega
        have hqW : q ≤ W.card := by omega
        obtain ⟨W0,hW0W,hW0card⟩ := Finset.exists_subset_card_eq hqW
        have hW0ne : W0.Nonempty := Finset.card_pos.mp (by omega)
        obtain ⟨w,hw0⟩ := hW0ne
        have hdis0 : Disjoint U W0 := Finset.disjoint_of_subset_right hW0W hdis
        have hwW : w ∈ W := hW0W hw0
  6. The vertex w has a neighbor z outside U ∪ W₀, so {z} is disjoint from U ∪ W₀.

    The neighborhood of w cannot be entirely contained in W₀ because deg(w) ≥ 2k + 1, whereas |W₀| = q = 2k + 2 - 2|U| ≤ 2k - 4 (since |U| ≥ 3). Thus there is a neighbor z of w with z ∉ W₀. Furthermore, z cannot lie in U because w ∈ W and U is anticomplete to W. Hence z ∉ U ∪ W₀, which means {z} is disjoint from U ∪ W₀ by Finset.disjoint_singleton_right.

    lines 62–74

    uses Finset.card_le_card, Finset.not_subset.mp, Finset.disjoint_singleton_right

        have hnot : ¬ G.neighborFinset w ⊆ W0 := by
          intro hh
          have hc := Finset.card_le_card hh
          have hd := hdegree w
          omega
        obtain ⟨z,hzw,hzW0⟩ := Finset.not_subset.mp hnot
        have hwz : G.Adj w z := by simpa using hzw
        have hzU : z ∉ U := by
          intro hz
          exact hanti z hz w hwW hwz.symm
        have hzUW : z ∉ U ∪ W0 := by simp [hzU,hzW0]
        have hdisz : Disjoint (U ∪ W0) ({z} : Finset (Fin (4*k))) := by
          simp [Finset.disjoint_singleton_right,hzUW]
  7. The set X = U ∪ W₀ ∪ {z} has size at most 2k and can be extended to an equicut (R, C) with |R| = |C| = 2k.

    Since U, W₀, and {z} are pairwise disjoint, |X| = |U| + |W₀| + 1 = |U| + q + 1 = 2k + 3 - |U| ≤ 2k using |U| ≥ 3 and Finset.card_union_of_disjoint. By Finset.exists_subsuperset_card_eq with Finset.subset_univ, X extends to a set R of size 2k. Its complement C = Rᶜ also has size 4k - 2k = 2k by Finset.card_compl and Fintype.card_fin.

    lines 75–89

    uses Finset.card_union_of_disjoint, Finset.exists_subsuperset_card_eq, Finset.subset_univ, Finset.card_compl, Fintype.card_fin

        let X : Finset (Fin (4*k)) := U ∪ W0 ∪ {z}
        have hXcard : X.card = U.card+W0.card+1 := by
          dsimp [X]
          rw [Finset.card_union_of_disjoint hdisz,Finset.card_union_of_disjoint hdis0]
          simp
        have hXle : X.card ≤ 2*k := by omega
        obtain ⟨R,hXR,hRuniv,hRcard⟩ := Finset.exists_subsuperset_card_eq
          (s:=X) (t:=Finset.univ) (n:=2*k) (Finset.subset_univ X) hXle (by simp; omega)
        let C : Finset (Fin (4*k)) := Rᶜ
        have hCcard : C.card=2*k := by
          have hh := Finset.card_compl R
          simp only [Fintype.card_fin] at hh
          dsimp [C]
          omega
        have hCset : (C : Set (Fin (4*k))) = (R : Set (Fin (4*k)))ᶜ := by ext x; simp [C]
  8. U ⊆ R, W₀ ⊆ R, and z ∈ R.

    Since X = U ∪ W₀ ∪ {z} and X ⊆ R, each component U, W₀, and {z} is contained in R, using Finset.mem_union_left and Finset.mem_union_right.

    lines 90–100

    uses Finset.mem_union_left, Finset.mem_union_right

        have hUinR : U ⊆ R := by
          intro x hx
          apply hXR
          exact Finset.mem_union_left _ (Finset.mem_union_left _ hx)
        have hWinR : W0 ⊆ R := by
          intro x hx
          apply hXR
          exact Finset.mem_union_left _ (Finset.mem_union_right _ hx)
        have hzinR : z ∈ R := by
          apply hXR
          exact Finset.mem_union_right _ (by simp)
  9. There exists a matching T supported on C with exactly k - 1 edges.

    Let M and N be maximum matchings in C and R = Cᶜ, respectively, via finite_subset_has_maximum_matching. By extendible_balanced_cut_matching_symmetry_of_independence, |E(M)| = |E(N)|. Then extendible_equal_cut_maximum_matching_deficiency_at_most_one implies |E(M)| ≥ k - 1. By finite_matching_has_submatching_of_each_smaller_size, M has a submatching T with |E(T)| = k - 1, and its vertices remain in C by Set.Subset.trans.

    lines 101–109

    uses finite_subset_has_maximum_matching, extendible_balanced_cut_matching_symmetry_of_independence, extendible_equal_cut_maximum_matching_deficiency_at_most_one, finite_matching_has_submatching_of_each_smaller_size, Set.Subset.trans

        obtain ⟨M,hM,hMC,hmaxM⟩ := finite_subset_has_maximum_matching G C
        obtain ⟨N,hN,hNR,hmaxNR⟩ := finite_subset_has_maximum_matching G R
        have hNC : N.verts ⊆ (C : Set (Fin (4*k)))ᶜ := by simpa [hCset] using hNR
        have hmaxN : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ (C : Set (Fin (4*k)))ᶜ → T.edgeSet.ncard ≤ N.edgeSet.ncard := by
          simpa [hCset] using hmaxNR
        have heq := extendible_balanced_cut_matching_symmetry_of_independence k G hext hind C hCcard M N hM hN hMC hNC hmaxM hmaxN
        have hnear := extendible_equal_cut_maximum_matching_deficiency_at_most_one k G hext hdegree C hCcard M N hM hN hMC hNC hmaxM hmaxN heq hind
        obtain ⟨T,hT,hTM,hTcard⟩ := finite_matching_has_submatching_of_each_smaller_size G M hM (k-1) (by omega)
        have hTC : T.verts ⊆ (C : Set (Fin (4*k))) := Set.Subset.trans hTM.1 hMC
  10. The edge {w, z} forms a matching E disjoint from T, and their union T ⊔ E is a matching of size k.

    The edge {w, z} forms a matching E of size 1 with vertex set {w, z} via indexed_disjoint_cross_edges_form_matching, using Subsingleton.elim for injectivity. Since w, z ∈ R and V(T) ⊆ C = Rᶜ, V(T) and V(E) are disjoint (by Set.disjoint_left.mpr). By extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard, T ⊔ E is a matching with |E(T ⊔ E)| = (k - 1) + 1 = k edges.

    lines 110–128

    uses indexed_disjoint_cross_edges_form_matching, Subsingleton.elim, Set.disjoint_left.mpr, extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard

        let f : Fin 1 → Fin (4*k) := fun _ => w
        let g : Fin 1 → Fin (4*k) := fun _ => z
        obtain ⟨E,hE,hEcard,hEverts⟩ := indexed_disjoint_cross_edges_form_matching G 1 f g
          (by intro i j h; exact Subsingleton.elim i j)
          (by intro i j h; exact Subsingleton.elim i j)
          (by intro i j; exact G.ne_of_adj hwz)
          (by intro i; exact hwz)
        have hTE : Disjoint T.verts E.verts := by
          apply Set.disjoint_left.mpr
          intro x hxT hxE
          have hxC := hTC hxT
          rw [hEverts] at hxE
          rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩
          · have hxR : x ∈ R := by simpa [f,hi] using hWinR hw0
            simpa [C,hxR] using hxC
          · have hxR : x ∈ R := by simpa [g,hi] using hzinR
            simpa [C,hxR] using hxC
        have hTE' := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard T E hT hE hTE
        have hTEcard : (T ⊔ E).edgeSet.ncard = k := by rw [hTE'.2,hTcard,hEcard]; omega
  11. The vertex set S = V(T ⊔ E) has cardinality 2k.

    Since T ⊔ E is a matching with k edges, in1076_matching_twice_card shows that it spans 2k vertices, which converts to Finset cardinality via Set.ncard_eq_toFinset_card'.

    lines 129–133

    uses Set.ncard_eq_toFinset_card', in1076_matching_twice_card

        let S : Finset (Fin (4*k)) := (T ⊔ E).verts.toFinset
        have hScard : S.card=2*k := by
          change ((T ⊔ E).verts.toFinset).card = 2*k
          rw [← Set.ncard_eq_toFinset_card']
          simpa only [hTEcard] using (in1076_matching_twice_card hTE'.1).symm
  12. S is disjoint from U ∪ (W₀ \ {w}).

    Any vertex x ∈ S lies in V(T) ⊆ C or in V(E) = {w, z}. If x ∈ V(T) ⊆ C, then x ∉ R; since U ∪ (W₀ \ {w}) ⊆ R, x cannot belong to this set. If x = w, then w ∉ U (as U and W₀ are disjoint) and w ∉ W₀ \ {w}. If x = z, recall z ∉ U and z ∉ W₀. Thus by Finset.disjoint_left.mpr, S is disjoint from U ∪ (W₀ \ {w}).

    lines 134–154

    uses Finset.disjoint_left.mpr, Finset.mem_union.mp, Finset.mem_of_mem_erase, Finset.disjoint_left.mp

        have hSdis : Disjoint S (U ∪ W0.erase w) := by
          apply Finset.disjoint_left.mpr
          intro x hxS hxUW
          have hxTE : x ∈ (T ⊔ E).verts := by simpa [S] using hxS
          change x ∈ T.verts ∪ E.verts at hxTE
          rcases hxTE with hxT | hxE
          · have hxC := hTC hxT
            have hxR : x ∈ R := by
              rcases Finset.mem_union.mp hxUW with hxU | hxW
              · exact hUinR hxU
              · exact hWinR (Finset.mem_of_mem_erase hxW)
            simpa [C,hxR] using hxC
          · rw [hEverts] at hxE
            rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩
            · have hxw : x=w := by simpa [f] using hi.symm
              have hwU : w ∉ U := fun hh => Finset.disjoint_left.mp hdis0 hh hw0
              rw [hxw] at hxUW
              simp [hwU] at hxUW
            · have hxz : x=z := by simpa [g] using hi.symm
              rw [hxz] at hxUW
              simp [hzU,hzW0] at hxUW
  13. The induced subgraph G[S] has a perfect matching.

    Because S is the vertex set of the matching T ⊔ E, applying the preliminary lemma in1214_match_verts_perfect to T ⊔ E yields a perfect matching on G[S].

    lines 155–160

    uses in1214_match_verts_perfect

        have hSMatch : ∃ P : (G.induce {v | v ∈ S}).Subgraph, P.IsPerfectMatching := by
          have hSeq : {v | v ∈ S} = (T ⊔ E).verts := by
            ext v
            simp [S]
          rw [hSeq]
          exact in1214_match_verts_perfect G (T ⊔ E) hTE'.1
  14. The general obstruction theorem shows that G[S] cannot have a perfect matching, yielding a contradiction.

    Let W' = W₀ \ {w}. By Finset.card_erase_add_one, |W'| = |W₀| - 1 = q - 1. Then 2|U| + |W'| = 2|U| + q - 1 = (2k + 2) - 1 = 2k + 1 > 2k = |V| - 2k. Furthermore, U and W' are disjoint and anticomplete. By extendible_independent_anticomplete_matching_obstruction_general, the induced subgraph G[S] cannot have a perfect matching, contradicting the perfect matching just constructed.

    lines 161–170

    uses Finset.card_erase_add_one, Fintype.card_fin, Finset.mem_of_mem_erase, Finset.disjoint_of_subset_right, Finset.erase_subset, extendible_independent_anticomplete_matching_obstruction_general

        have hW0erase : (W0.erase w).card+1=W0.card := Finset.card_erase_add_one hw0
        have hlarge : Fintype.card (Fin (4*k))-2*k < 2*U.card+(W0.erase w).card := by
          simp only [Fintype.card_fin]
          omega
        have hanti0 : ∀ u ∈ U, ∀ v ∈ W0.erase w, ¬ G.Adj u v := by
          intro u hu v hv
          exact hanti u hu v (hW0W (Finset.mem_of_mem_erase hv))
        have hUW0 : Disjoint U (W0.erase w) := Finset.disjoint_of_subset_right (Finset.erase_subset _ _) hdis0
        exact extendible_independent_anticomplete_matching_obstruction_general G k hext U (W0.erase w) S
          hUW0 hUind hanti0 hSdis hScard hlarge hSMatch
Subtype.ext
Two subtype elements are equal if and only if their underlying values are equal.
perfect_matching_of_adjacency_involution
An involution on the vertex set of a graph that pairs adjacent vertices yields a perfect matching.
Finset.mem_compl
An element belongs to the complement of a finite set if and only if it is not in the set.
Finset.mem_union
An element belongs to the union of two finite sets if and only if it belongs to at least one of them.
Finset.card_le_card
If one finite set is a subset of another, its cardinality is at most that of the larger set.
Finset.card_compl
The cardinality of the complement of a subset in a finite type is the size of the ambient type minus the size of the subset.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Fintype.card_fin
The cardinality of the finite type Fin n is n.
Finset.exists_subset_card_eq
Any finite set of cardinality at least n contains a subset of cardinality n.
Finset.card_pos.mp
A finite set is nonempty if its cardinality is strictly positive.
Finset.disjoint_of_subset_right
If a set is disjoint from another set, it is disjoint from any subset of that set.
Finset.not_subset.mp
If a set is not a subset of another, there exists an element in the former that is not in the latter.
Finset.disjoint_singleton_right
A set is disjoint from a singleton {a} if and only if a does not belong to the set.
Finset.exists_subsuperset_card_eq
Given nested finite sets s ⊆ t and an integer n between |s| and |t|, there exists an intermediate subset u with s ⊆ u ⊆ t of size n.
Finset.subset_univ
Every finite set in a finite type is a subset of the universal set Finset.univ.
Finset.mem_union_left
An element of a set s belongs to the union s ∪ t.
Finset.mem_union_right
An element of a set t belongs to the union s ∪ t.
finite_subset_has_maximum_matching
Every vertex subset of a finite graph contains a matching of maximum size among all submatchings supported on that subset.
extendible_balanced_cut_matching_symmetry_of_independence
In a k-extendable graph with independence number at most k, maximum matchings on the two sides of a balanced 2k-cut have equal size.
extendible_equal_cut_maximum_matching_deficiency_at_most_one
In a k-extendable graph of minimum degree at least 2k+1 and independence number at most k, maximum matchings on each side of an equicut have size at least k-1.
finite_matching_has_submatching_of_each_smaller_size
Any finite matching of size m contains a submatching of size j for each j ≤ m.
Set.Subset.trans
Subset inclusion is transitive.
indexed_disjoint_cross_edges_form_matching
A collection of edges between pairwise disjoint endpoints forms a matching of the corresponding size.
Subsingleton.elim
Any two elements of a subsingleton type are equal.
Set.disjoint_left.mpr
Two sets are disjoint if no element of the first belongs to the second.
extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard
The union of two vertex-disjoint matchings is a matching whose edge count is the sum of their edge counts.
Set.ncard_eq_toFinset_card'
The cardinality of a finite set as a Set coincides with its cardinality as a Finset.
in1076_matching_twice_card
The number of vertices saturated by a matching is twice its number of edges.
Finset.disjoint_left.mpr
Two finite sets are disjoint if no element of the first belongs to the second.
Finset.mem_union.mp
If an element belongs to s ∪ t, then it belongs to s or to t.
Finset.mem_of_mem_erase
An element belonging to s \ {a} belongs to s.
Finset.disjoint_left.mp
If two finite sets are disjoint, no element of the first belongs to the second.
in1214_match_verts_perfect
The subgraph induced by the vertices of any matching has a perfect matching.
Finset.card_erase_add_one
Removing an element from a finite set decreases its cardinality by 1.
Finset.erase_subset
Removing an element from a set produces a subset of the original set.
extendible_independent_anticomplete_matching_obstruction_general
In a k-extendable graph, if disjoint sets U, W satisfy independence, anticompleteness, and 2|U|+|W| > |V|-2k, no induced subgraph on a 2k-vertex set disjoint from U ∪ W can have a perfect matching.

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 theorem in1214_match_verts_perfect    {V : Type*} (G : SimpleGraph V) (M : G.Subgraph) (hM : M.IsMatching) :    ∃ P : (G.induce M.verts).Subgraph, P.IsPerfectMatching := by  set_option maxHeartbeats 4000000 in    classical    let f : M.verts → M.verts := fun v =>      ⟨Classical.choose (hM v.property), M.edge_vert (Classical.choose_spec (hM v.property)).1.symm⟩    have hf : ∀ v : M.verts, M.Adj v.val (f v).val := by      intro v      exact (Classical.choose_spec (hM v.property)).1    have hinv : Function.Involutive f := by      intro v      apply Subtype.ext      exact (hM (f v).property).unique (hf (f v)) (hf v).symm    have hadj : ∀ v : M.verts, (G.induce M.verts).Adj v (f v) := by      intro v      exact M.adj_sub (hf v)    exact perfect_matching_of_adjacency_involution (G.induce M.verts) f hinv hadjtheorem extendible_independent_common_nonneighbor_deficit_le_one    (k : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (hext : is_k_extendable G k)    (hdegree : ∀ v, 2*k+1 ≤ (G.neighborFinset v).card)    (hind : ∀ I : Finset (Fin (4*k)),      (∀ x ∈ I, ∀ y ∈ I, x ≠ y → ¬ G.Adj x y) → I.card ≤ k)    (U W : Finset (Fin (4*k))) (hdis : Disjoint U W) (hU : U.Nonempty)    (hUind : ∀ u ∈ U, ∀ v ∈ U, ¬ G.Adj u v)    (hanti : ∀ u ∈ U, ∀ w ∈ W, ¬ G.Adj u w) :    2*U.card+W.card ≤ 2*k+1 := by  set_option maxHeartbeats 4000000 in    classical    by_contra hn    have hUlarge : 3 ≤ U.card := by      by_contra hs      have hsmall : U.card ≤ 2 := by omega      obtain ⟨u,hu⟩ := hU      have hNbr : G.neighborFinset u ⊆ (U ∪ W)ᶜ := by        intro v hv        have huv : G.Adj u v := by simpa using hv        simp only [Finset.mem_compl,Finset.mem_union]        intro hvUW        rcases hvUW with hvU | hvW        · exact hUind u hu v hvU huv        · exact hanti u hu v hvW huv      have hc := Finset.card_le_card hNbr      have hcomp := Finset.card_compl (U ∪ W)      have hunion := Finset.card_union_of_disjoint hdis      have hd := hdegree u      simp only [Fintype.card_fin] at hcomp      omega    have hUk : U.card ≤ k := hind U (by intro x hx y hy hne; exact hUind x hx y hy)    have hk : 3 ≤ k := by omega    let q := 2*k+2-2*U.card    have hq : q+2*U.card=2*k+2 := by dsimp [q]; omega    have hqpos : 1 ≤ q := by omega    have hqW : q ≤ W.card := by omega    obtain ⟨W0,hW0W,hW0card⟩ := Finset.exists_subset_card_eq hqW    have hW0ne : W0.Nonempty := Finset.card_pos.mp (by omega)    obtain ⟨w,hw0⟩ := hW0ne    have hdis0 : Disjoint U W0 := Finset.disjoint_of_subset_right hW0W hdis    have hwW : w ∈ W := hW0W hw0    have hnot : ¬ G.neighborFinset w ⊆ W0 := by      intro hh      have hc := Finset.card_le_card hh      have hd := hdegree w      omega    obtain ⟨z,hzw,hzW0⟩ := Finset.not_subset.mp hnot    have hwz : G.Adj w z := by simpa using hzw    have hzU : z ∉ U := by      intro hz      exact hanti z hz w hwW hwz.symm    have hzUW : z ∉ U ∪ W0 := by simp [hzU,hzW0]    have hdisz : Disjoint (U ∪ W0) ({z} : Finset (Fin (4*k))) := by      simp [Finset.disjoint_singleton_right,hzUW]    let X : Finset (Fin (4*k)) := U ∪ W0 ∪ {z}    have hXcard : X.card = U.card+W0.card+1 := by      dsimp [X]      rw [Finset.card_union_of_disjoint hdisz,Finset.card_union_of_disjoint hdis0]      simp    have hXle : X.card ≤ 2*k := by omega    obtain ⟨R,hXR,hRuniv,hRcard⟩ := Finset.exists_subsuperset_card_eq      (s:=X) (t:=Finset.univ) (n:=2*k) (Finset.subset_univ X) hXle (by simp; omega)    let C : Finset (Fin (4*k)) := Rᶜ    have hCcard : C.card=2*k := by      have hh := Finset.card_compl R      simp only [Fintype.card_fin] at hh      dsimp [C]      omega    have hCset : (C : Set (Fin (4*k))) = (R : Set (Fin (4*k)))ᶜ := by ext x; simp [C]    have hUinR : U ⊆ R := by      intro x hx      apply hXR      exact Finset.mem_union_left _ (Finset.mem_union_left _ hx)    have hWinR : W0 ⊆ R := by      intro x hx      apply hXR      exact Finset.mem_union_left _ (Finset.mem_union_right _ hx)    have hzinR : z ∈ R := by      apply hXR      exact Finset.mem_union_right _ (by simp)    obtain ⟨M,hM,hMC,hmaxM⟩ := finite_subset_has_maximum_matching G C    obtain ⟨N,hN,hNR,hmaxNR⟩ := finite_subset_has_maximum_matching G R    have hNC : N.verts ⊆ (C : Set (Fin (4*k)))ᶜ := by simpa [hCset] using hNR    have hmaxN : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ (C : Set (Fin (4*k)))ᶜ → T.edgeSet.ncard ≤ N.edgeSet.ncard := by      simpa [hCset] using hmaxNR    have heq := extendible_balanced_cut_matching_symmetry_of_independence k G hext hind C hCcard M N hM hN hMC hNC hmaxM hmaxN    have hnear := extendible_equal_cut_maximum_matching_deficiency_at_most_one k G hext hdegree C hCcard M N hM hN hMC hNC hmaxM hmaxN heq hind    obtain ⟨T,hT,hTM,hTcard⟩ := finite_matching_has_submatching_of_each_smaller_size G M hM (k-1) (by omega)    have hTC : T.verts ⊆ (C : Set (Fin (4*k))) := Set.Subset.trans hTM.1 hMC    let f : Fin 1 → Fin (4*k) := fun _ => w    let g : Fin 1 → Fin (4*k) := fun _ => z    obtain ⟨E,hE,hEcard,hEverts⟩ := indexed_disjoint_cross_edges_form_matching G 1 f g      (by intro i j h; exact Subsingleton.elim i j)      (by intro i j h; exact Subsingleton.elim i j)      (by intro i j; exact G.ne_of_adj hwz)      (by intro i; exact hwz)    have hTE : Disjoint T.verts E.verts := by      apply Set.disjoint_left.mpr      intro x hxT hxE      have hxC := hTC hxT      rw [hEverts] at hxE      rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩      · have hxR : x ∈ R := by simpa [f,hi] using hWinR hw0        simpa [C,hxR] using hxC      · have hxR : x ∈ R := by simpa [g,hi] using hzinR        simpa [C,hxR] using hxC    have hTE' := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard T E hT hE hTE    have hTEcard : (T ⊔ E).edgeSet.ncard = k := by rw [hTE'.2,hTcard,hEcard]; omega    let S : Finset (Fin (4*k)) := (T ⊔ E).verts.toFinset    have hScard : S.card=2*k := by      change ((T ⊔ E).verts.toFinset).card = 2*k      rw [← Set.ncard_eq_toFinset_card']      simpa only [hTEcard] using (in1076_matching_twice_card hTE'.1).symm    have hSdis : Disjoint S (U ∪ W0.erase w) := by      apply Finset.disjoint_left.mpr      intro x hxS hxUW      have hxTE : x ∈ (T ⊔ E).verts := by simpa [S] using hxS      change x ∈ T.verts ∪ E.verts at hxTE      rcases hxTE with hxT | hxE      · have hxC := hTC hxT        have hxR : x ∈ R := by          rcases Finset.mem_union.mp hxUW with hxU | hxW          · exact hUinR hxU          · exact hWinR (Finset.mem_of_mem_erase hxW)        simpa [C,hxR] using hxC      · rw [hEverts] at hxE        rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩        · have hxw : x=w := by simpa [f] using hi.symm          have hwU : w ∉ U := fun hh => Finset.disjoint_left.mp hdis0 hh hw0          rw [hxw] at hxUW          simp [hwU] at hxUW        · have hxz : x=z := by simpa [g] using hi.symm          rw [hxz] at hxUW          simp [hzU,hzW0] at hxUW    have hSMatch : ∃ P : (G.induce {v | v ∈ S}).Subgraph, P.IsPerfectMatching := by      have hSeq : {v | v ∈ S} = (T ⊔ E).verts := by        ext v        simp [S]      rw [hSeq]      exact in1214_match_verts_perfect G (T ⊔ E) hTE'.1    have hW0erase : (W0.erase w).card+1=W0.card := Finset.card_erase_add_one hw0    have hlarge : Fintype.card (Fin (4*k))-2*k < 2*U.card+(W0.erase w).card := by      simp only [Fintype.card_fin]      omega    have hanti0 : ∀ u ∈ U, ∀ v ∈ W0.erase w, ¬ G.Adj u v := by      intro u hu v hv      exact hanti u hu v (hW0W (Finset.mem_of_mem_erase hv))    have hUW0 : Disjoint U (W0.erase w) := Finset.disjoint_of_subset_right (Finset.erase_subset _ _) hdis0    exact extendible_independent_anticomplete_matching_obstruction_general G k hext U (W0.erase w) S      hUW0 hUind hanti0 hSdis hScard hlarge hSMatch
See it in the graphDiscuss this resultChallenge it