AFTD Auto-Formalizing Theoretical Domains

minimally_k_extendable_complement_local_girth_degree_bound

theoremverified

For a minimally k-extendable graph on 2k+2j vertices with j at least two, if some vertex belongs to no triangle or four-cycle of the complement, then the graph has minimum degree at most 2k+1.

Statement

theorem minimally_k_extendable_complement_local_girth_degree_bound
    (k j : ℕ) (hj : 2 ≤ j) (G : SimpleGraph (Fin (2*k+2*j))) [DecidableRel G.Adj]
    (hmin : is_minimally_k_extendable G k) (u : Fin (2*k+2*j))
    (htri : ∀ a b, (Gᶜ).Adj u a → (Gᶜ).Adj u b → a ≠ b → ¬ (Gᶜ).Adj a b)
    (hsquare : ∀ a b x, (Gᶜ).Adj u a → (Gᶜ).Adj u b → a ≠ b → x ≠ u → ¬ ((Gᶜ).Adj a x ∧ (Gᶜ).Adj b x)) :
    G.minDegree ≤ 2*k+1
Source
OP-1957: the complementary local-girth obstruction, pending formal proof.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 7
  • is_minimally_k_extendableFor a finite vertex type V (with [Fintype V]), a simple graph G : SimpleGraph V and k : ℕ, is_minimally_k_extendable G k is the Prop…
  • 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…
  • matching_short_switch_complement_local_girth_fiveFor a graph on 2j vertices with minimum degree at least two and complement maximum degree at most 2j-3, suppose no triangle or four-cycle…
  • forced_matching_edge_blocks_four_and_six_switchesA forced matching edge blocks the specified four- and six-vertex switches.
  • k_extendable_essential_edge_has_forced_matching_residualAn essential edge of a k-extendible graph is forced in a perfect-matching residual on n−2k vertices.
  • g$g(S,M) = \dim_{\mathbb{F}_p}(S^{\perp}_M) - \dim_{\mathbb{F}_p}(S_M)$.
  • cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…

The proof, explained

The theorem is proved by contradiction: assuming the minimum degree is at least 2k+2, the vertex u has an incident edge uv. Because G is minimally k-extendable, this edge is essential, so deleting it leaves a residual induced subgraph on 2j vertices in which uv is forced in every perfect matching, thereby blocking any alternating 4-cycle or 6-cycle switches. The high minimum degree of G implies that the residual graph has minimum degree at least 2 and complement degree at most 2j-3. Together with the hypothesis that u belongs to no complement triangles or 4-cycles (local girth at least 5 in the complement), a structural lemma forces the edge to admit an alternating 4- or 6-switch, contradicting that it is forced.

  1. A bijective graph homomorphism pulls back a perfect matching to a perfect matching.

    By definition, a subgraph is a perfect matching if and only if every vertex has a unique incident edge in the subgraph. For any vertex a in G, its image f(a) has a unique neighbor w in Q. By bijectivity of f, w = f(b) for a unique vertex b, and the edge condition guarantees that a and b are adjacent in G, so b is the unique neighbor of a in the pullback.

    lines 4–10

    uses SimpleGraph.Subgraph.isPerfectMatching_iff

      rw [SimpleGraph.Subgraph.isPerfectMatching_iff] at hQ ⊢
      intro a
      obtain ⟨w, hw, hu⟩ := hQ (f a)
      obtain ⟨b, rfl⟩ := hf.2 w
      refine ⟨b, ⟨hadj a b hw, hw⟩, ?_⟩
      intro c hc
      exact hf.1 (hu _ hc.2)
  2. Assuming for contradiction that the minimum degree of G is at least 2k+2, the vertex u has an adjacent vertex v in G.

    We argue by contradiction and suppose the minimum degree of G is strictly greater than 2k+1, so minDegree(G) ≥ 2k+2. The degree of u is bounded below by minDegree(G) ≥ 2k+2 > 0, so the neighbor set of u is nonempty, yielding a neighbor v.

    lines 18–25

    uses G.minDegree_le_degree, card_neighborFinset_eq_degree, Finset.card_pos.mp, mem_neighborFinset

      classical
      by_contra hlt
      have hdeg : 2*k+2 ≤ G.minDegree := by omega
      obtain ⟨v, huv⟩ : ∃ v, G.Adj u v := by
        have h := G.minDegree_le_degree u
        have : 0 < (G.neighborFinset u).card := by rw [card_neighborFinset_eq_degree]; omega
        obtain ⟨v, hv⟩ := Finset.card_pos.mp this
        exact ⟨v, (mem_neighborFinset _ _ _).1 hv⟩
  3. There is a vertex subset R of size 2j containing u and v such that the induced subgraph G[R] has a perfect matching, but G[R] with the edge uv removed has no perfect matching.

    Because G is minimally k-extendable, the edge uv is essential: deleting it destroys k-extendability. By k_extendable_essential_edge_has_forced_matching_residual, there exists a subset R of vertices with |R| + 2k = 2k+2j containing u and v such that G[R] has a perfect matching P, but no perfect matching survives in G[R] after deleting uv. Cardinality arithmetic confirms |R| = 2j.

    lines 26–31

    uses k_extendable_essential_edge_has_forced_matching_residual, Fintype.card_subtype, Set.mem_ofPred_eq, Finset.filter_mem_eq_inter, Finset.univ_inter

      obtain ⟨R, hRc, hu, hv, ⟨P, hP⟩, hnoPM⟩ :=
        k_extendable_essential_edge_has_forced_matching_residual _ k G u v huv hmin.1 (hmin.2 _ huv)
      have hcardW : Fintype.card ({a | a ∈ R} : Set (Fin (2*k+2*j))) = 2*j := by
        rw [Fintype.card_subtype]
        simp only [Set.mem_ofPred_eq, Finset.filter_mem_eq_inter, Finset.univ_inter]
        omega
  4. The induced subgraph G[R] is isomorphic to a graph H on Fin (2*j), preserving adjacency and non-adjacency, and the perfect matching P pulls back to a perfect matching on H.

    Using the cardinality |R| = 2j, we choose a bijection e : R ≃ Fin (2*j) and define H by pulling back G[R] along the inverse of e. By construction, adjacency and complement adjacency in H match those in G on R. Applying in1163_pm_comap along the isomorphism e.symm pulls back the matching P on G[R] to a perfect matching on H.

    lines 32–48

    uses Fintype.equivFinOfCardEq, compl_adj, Subtype.ext, in1163_pm_comap

      let e : ({a | a ∈ R} : Set (Fin (2*k+2*j))) ≃ Fin (2*j) := Fintype.equivFinOfCardEq hcardW
      let GR := G.induce {a | a ∈ R}
      let H : SimpleGraph (Fin (2*j)) := GR.comap e.symm
      have hHadj : ∀ x y, H.Adj x y ↔ G.Adj (e.symm x).1 (e.symm y).1 := fun x y => Iff.rfl
      have hHc : ∀ x y, (Hᶜ).Adj x y ↔ (Gᶜ).Adj (e.symm x).1 (e.symm y).1 := by
        intro x y
        rw [compl_adj, compl_adj, hHadj]
        constructor
        · rintro ⟨hne, hn⟩
          refine ⟨fun h => hne (e.symm.injective (Subtype.ext h)), hn⟩
        · rintro ⟨hne, hn⟩
          exact ⟨fun h => hne (h ▸ rfl), hn⟩
      let f1 : H →g GR := ⟨e.symm, fun h => h⟩
      have hPH : (P.comap f1).IsPerfectMatching :=
        in1163_pm_comap f1 e.symm.bijective P hP (fun a b h => P.adj_sub h)
      let u' : ({a | a ∈ R} : Set (Fin (2*k+2*j))) := ⟨u, hu⟩
      let v' : ({a | a ∈ R} : Set (Fin (2*k+2*j))) := ⟨v, hv⟩
  5. The edge between the images of u and v is present in every perfect matching of H, and consequently cannot participate in an alternating 4-switch or 6-switch.

    If some perfect matching Q of H avoided the edge between e(u) and e(v), pulling Q back to G[R] would produce a perfect matching avoiding uv, contradicting that uv was essential in G[R]. Hence that edge is forced in all perfect matchings of H. By forced_matching_edge_blocks_four_and_six_switches, any edge forced in all perfect matchings cannot participate in an alternating 4-switch or 6-switch.

    lines 49–72

    uses SimpleGraph.deleteEdges_adj.mp, in1163_pm_comap, SimpleGraph.deleteEdges_adj.mpr, Set.mem_singleton_iff, Sym2.eq_iff, forced_matching_edge_blocks_four_and_six_switches

      have hforced : ∀ Q : H.Subgraph, Q.IsPerfectMatching → Q.Adj (e u') (e v') := by
        intro Q hQ
        by_contra hn
        apply hnoPM
        let f2 : (GR.deleteEdges {s(u', v')}) →g H :=
          ⟨e, fun {x y} h => by
            have h' := (SimpleGraph.deleteEdges_adj.mp h).1
            show GR.Adj (e.symm (e x)) (e.symm (e y))
            simpa using h'⟩
        refine ⟨Q.comap f2, in1163_pm_comap f2 e.bijective Q hQ ?_⟩
        intro a b hab
        apply SimpleGraph.deleteEdges_adj.mpr
        refine ⟨?_, ?_⟩
        · have h := Q.adj_sub hab
          change GR.Adj (e.symm (e a)) (e.symm (e b)) at h
          simpa using h
        · intro hs
          simp only [Set.mem_singleton_iff, Sym2.eq_iff] at hs
          rcases hs with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩
          · exact hn hab
          · exact hn hab.symm
      have huvH : (P.comap f1).Adj (e u') (e v') := hforced _ hPH
      have hblock := forced_matching_edge_blocks_four_and_six_switches H (P.comap f1) hPH
        (e u') (e v') huvH hforced
  6. Every vertex in H has degree at least 2.

    For any vertex x in H with preimage a in R, the neighbors of a in G are partitioned into those inside R and those outside R. Since |V(G) \ R| = 2k and deg_G(a) ≥ minDegree(G) ≥ 2k+2, at least (2k+2) - 2k = 2 neighbors of a must lie in R. The images of two distinct neighbors under e provide two distinct neighbors of x in H, proving deg_H(x) ≥ 2.

    lines 73–108

    uses G.minDegree_le_degree, card_neighborFinset_eq_degree, Finset.card_sdiff_of_subset, Finset.one_lt_card.mp, Finset.card_pair

      have hdegH : ∀ x, 2 ≤ H.degree x := by
        intro x
        set a := e.symm x with ha
        have hsub : G.neighborFinset a.1 ⊆ R.filter (fun y => G.Adj a.1 y) ∪ (Finset.univ \ R) := by
          intro y hy
          rw [mem_neighborFinset] at hy
          by_cases hyR : y ∈ R
          · exact Finset.mem_union_left _ (Finset.mem_filter.2 ⟨hyR, hy⟩)
          · exact Finset.mem_union_right _ (by simp [hyR])
        have h1 := Finset.card_le_card hsub
        have h2 := Finset.card_union_le (R.filter (fun y => G.Adj a.1 y)) (Finset.univ \ R)
        have h3 : (Finset.univ \ R).card = 2*k := by
          rw [Finset.card_sdiff_of_subset (Finset.subset_univ _), Finset.card_univ, Fintype.card_fin]
          omega
        have h4 := G.minDegree_le_degree a.1
        rw [card_neighborFinset_eq_degree] at h1
        have hgt : 1 < (R.filter (fun y => G.Adj a.1 y)).card := by omega
        obtain ⟨y1, hy1, y2, hy2, hy12⟩ := Finset.one_lt_card.mp hgt
        rw [Finset.mem_filter] at hy1 hy2
        have hn1 : e ⟨y1, hy1.1⟩ ∈ H.neighborFinset x := by
          rw [mem_neighborFinset, hHadj, Equiv.symm_apply_apply]
          exact hy1.2
        have hn2 : e ⟨y2, hy2.1⟩ ∈ H.neighborFinset x := by
          rw [mem_neighborFinset, hHadj, Equiv.symm_apply_apply]
          exact hy2.2
        have hne : e ⟨y1, hy1.1⟩ ≠ e ⟨y2, hy2.1⟩ := by
          intro h
          exact hy12 (congrArg Subtype.val (e.injective h))
        have := Finset.card_le_card (show {e ⟨y1, hy1.1⟩, e ⟨y2, hy2.1⟩} ⊆ H.neighborFinset x by
          intro z hz
          simp only [Finset.mem_insert, Finset.mem_singleton] at hz
          rcases hz with rfl | rfl
          · exact hn1
          · exact hn2)
        rw [Finset.card_pair hne, card_neighborFinset_eq_degree] at this
        exact this
  7. Every vertex in the complement graph Hᶜ has degree at most 2j - 3.

    In any graph on 2j vertices, the complement degree of x satisfies deg_{Hᶜ}(x) = 2j - 1 - deg_H(x). Since deg_H(x) ≥ 2, this is at most 2j - 1 - 2 = 2j - 3.

    lines 109–114

    uses H.degree_compl, Fintype.card_fin

      have hmaxH : ∀ x, (Hᶜ).degree x ≤ 2*j-3 := by
        intro x
        have h1 := H.degree_compl x
        rw [Fintype.card_fin] at h1
        have := hdegH x
        omega
  8. The image of u in Hᶜ belongs to no triangle and no 4-cycle in Hᶜ.

    Adjacency in Hᶜ corresponds directly to adjacency in Gᶜ under the bijection e.symm. The hypothesis htri states that u belongs to no triangle in Gᶜ, which translates to the image of u belonging to no triangle in Hᶜ. Similarly, hsquare states that u belongs to no 4-cycle in Gᶜ, translating to the absence of 4-cycles containing the image of u in Hᶜ.

    lines 115–131

    uses Equiv.symm_apply_apply, Subtype.ext

      have heu : (e.symm (e u')).1 = u := by rw [Equiv.symm_apply_apply]
      have htriH : ∀ a b, (Hᶜ).Adj (e u') a → (Hᶜ).Adj (e u') b → a ≠ b → ¬ (Hᶜ).Adj a b := by
        intro a b ha hb hab
        rw [hHc, heu] at ha hb
        rw [hHc]
        exact htri _ _ ha hb (fun h => hab (e.symm.injective (Subtype.ext h)))
      have hsquareH : ∀ a b x, (Hᶜ).Adj (e u') a → (Hᶜ).Adj (e u') b → a ≠ b → x ≠ e u' →
          ¬ ((Hᶜ).Adj a x ∧ (Hᶜ).Adj b x) := by
        intro a b x ha hb hab hx
        rw [hHc, heu] at ha hb
        rw [hHc, hHc]
        refine hsquare _ _ _ ha hb (fun h => hab (e.symm.injective (Subtype.ext h))) ?_
        intro h
        apply hx
        rw [← heu] at h
        have := e.symm.injective (Subtype.ext h)
        exact this
  9. A contradiction is derived, completing the proof that minDegree(G) ≤ 2k+1.

    By matching_short_switch_complement_local_girth_five, any perfect matching edge in a graph on 2j vertices (j ≥ 2) with minimum degree at least 2, complement degree at most 2j - 3, and whose endpoint has complement local girth at least 5 must admit either an alternating 4-switch or an alternating 6-switch. But earlier we showed that the edge between the images of u and v is forced, and therefore blocks both types of switches. This contradiction finishes the proof.

    lines 132–135

    uses matching_short_switch_complement_local_girth_five

      rcases matching_short_switch_complement_local_girth_five j hj H (P.comap f1) hPH hdegH hmaxH
          (e u') (e v') huvH htriH hsquareH with h4 | h6
      · exact hblock.1 h4
      · exact hblock.2 h6
Equiv.symm_apply_apply
Applying an equivalence after its inverse is the identity map.
Fintype.card_fin
The cardinality of the finset Fin n is n.
Fintype.equivFinOfCardEq
Any two finite types with the same cardinality are equivalent, in particular providing an equivalence to Fin n.
Fintype.card_subtype
The cardinality of a subtype defined by a predicate equals the cardinality of the filtered finset of elements satisfying the predicate.
Finset.card_pair
The cardinality of a two-element set {a, b} with a ≠ b is 2.
Finset.card_pos.mp
A finset with strictly positive cardinality is nonempty.
Finset.card_sdiff_of_subset
If s is a subset of t, the cardinality of the difference t \ s is the cardinality of t minus the cardinality of s.
Finset.filter_mem_eq_inter
Filtering a finset by membership in a second finset produces their intersection.
Finset.one_lt_card.mp
A finset has cardinality strictly greater than 1 if and only if it contains at least two distinct elements.
Finset.univ_inter
The intersection of the universal finset with any finset is that finset.
G.minDegree_le_degree
The minimum degree of a graph is at most the degree of any of its vertices.
H.degree_compl
In a finite graph, the degree of a vertex in the complement graph equals the total number of vertices minus 1 minus its degree in the graph.
Subtype.ext
Two elements of a subtype are equal if and only if their underlying values are equal.
Sym2.eq_iff
Two unordered pairs are equal if and only if their elements match in some order.
card_neighborFinset_eq_degree
The cardinality of the neighbor finset of a vertex equals its degree.
compl_adj
Two vertices are adjacent in the complement graph if and only if they are distinct and not adjacent in the original graph.
forced_matching_edge_blocks_four_and_six_switches
An edge present in every perfect matching cannot admit an alternating 4-cycle switch or an alternating 6-cycle switch.
in1163_pm_comap
A bijective graph homomorphism pulls back a perfect matching to a perfect matching, provided the preimage relation holds on matching edges.
k_extendable_essential_edge_has_forced_matching_residual
If deleting an edge in a k-extendable graph destroys k-extendability, there is an induced subgraph on |V| - 2k vertices containing the edge, having a perfect matching, but with no perfect matching avoiding that edge.
matching_short_switch_complement_local_girth_five
In a graph on 2j vertices (j ≥ 2) with minimum degree at least 2 and complement maximum degree at most 2j - 3, any perfect matching edge whose endpoint belongs to no complement triangle or 4-cycle admits an alternating 4-switch or 6-switch.
mem_neighborFinset
A vertex w is in the neighbor finset of v if and only if v and w are adjacent.
SimpleGraph.deleteEdges_adj.mp
An edge belongs to a graph with deleted edges if and only if it is an edge of the original graph and not in the deleted edge set.
SimpleGraph.deleteEdges_adj.mpr
An edge of the original graph that is not in the deleted set is an edge of the graph with deleted edges.
SimpleGraph.Subgraph.isPerfectMatching_iff
A subgraph is a perfect matching if and only if every vertex of the ambient graph has a unique neighbor in the subgraph.
Set.mem_ofPred_eq
An element belongs to a set defined by a predicate if and only if it satisfies the predicate.
Set.mem_singleton_iff
An element belongs to a singleton {x} if and only if it equals x.

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 in1163_pm_comap {V W : Type*} {G : SimpleGraph V} {G' : SimpleGraph W}    (f : G →g G') (hf : Function.Bijective f) (Q : G'.Subgraph) (hQ : Q.IsPerfectMatching)    (hadj : ∀ a b, Q.Adj (f a) (f b) → G.Adj a b) : (Q.comap f).IsPerfectMatching := by  rw [SimpleGraph.Subgraph.isPerfectMatching_iff] at hQ ⊢  intro a  obtain ⟨w, hw, hu⟩ := hQ (f a)  obtain ⟨b, rfl⟩ := hf.2 w  refine ⟨b, ⟨hadj a b hw, hw⟩, ?_⟩  intro c hc  exact hf.1 (hu _ hc.2)theorem minimally_k_extendable_complement_local_girth_degree_bound    (k j : ℕ) (hj : 2 ≤ j) (G : SimpleGraph (Fin (2*k+2*j))) [DecidableRel G.Adj]    (hmin : is_minimally_k_extendable G k) (u : Fin (2*k+2*j))    (htri : ∀ a b, (Gᶜ).Adj u a → (Gᶜ).Adj u b → a ≠ b → ¬ (Gᶜ).Adj a b)    (hsquare : ∀ a b x, (Gᶜ).Adj u a → (Gᶜ).Adj u b → a ≠ b → x ≠ u → ¬ ((Gᶜ).Adj a x ∧ (Gᶜ).Adj b x)) :    G.minDegree ≤ 2*k+1 := open SimpleGraph in by  classical  by_contra hlt  have hdeg : 2*k+2 ≤ G.minDegree := by omega  obtain ⟨v, huv⟩ : ∃ v, G.Adj u v := by    have h := G.minDegree_le_degree u    have : 0 < (G.neighborFinset u).card := by rw [card_neighborFinset_eq_degree]; omega    obtain ⟨v, hv⟩ := Finset.card_pos.mp this    exact ⟨v, (mem_neighborFinset _ _ _).1 hv⟩  obtain ⟨R, hRc, hu, hv, ⟨P, hP⟩, hnoPM⟩ :=    k_extendable_essential_edge_has_forced_matching_residual _ k G u v huv hmin.1 (hmin.2 _ huv)  have hcardW : Fintype.card ({a | a ∈ R} : Set (Fin (2*k+2*j))) = 2*j := by    rw [Fintype.card_subtype]    simp only [Set.mem_ofPred_eq, Finset.filter_mem_eq_inter, Finset.univ_inter]    omega  let e : ({a | a ∈ R} : Set (Fin (2*k+2*j))) ≃ Fin (2*j) := Fintype.equivFinOfCardEq hcardW  let GR := G.induce {a | a ∈ R}  let H : SimpleGraph (Fin (2*j)) := GR.comap e.symm  have hHadj : ∀ x y, H.Adj x y ↔ G.Adj (e.symm x).1 (e.symm y).1 := fun x y => Iff.rfl  have hHc : ∀ x y, (Hᶜ).Adj x y ↔ (Gᶜ).Adj (e.symm x).1 (e.symm y).1 := by    intro x y    rw [compl_adj, compl_adj, hHadj]    constructor    · rintro ⟨hne, hn⟩      refine ⟨fun h => hne (e.symm.injective (Subtype.ext h)), hn⟩    · rintro ⟨hne, hn⟩      exact ⟨fun h => hne (h ▸ rfl), hn⟩  let f1 : H →g GR := ⟨e.symm, fun h => h⟩  have hPH : (P.comap f1).IsPerfectMatching :=    in1163_pm_comap f1 e.symm.bijective P hP (fun a b h => P.adj_sub h)  let u' : ({a | a ∈ R} : Set (Fin (2*k+2*j))) := ⟨u, hu⟩  let v' : ({a | a ∈ R} : Set (Fin (2*k+2*j))) := ⟨v, hv⟩  have hforced : ∀ Q : H.Subgraph, Q.IsPerfectMatching → Q.Adj (e u') (e v') := by    intro Q hQ    by_contra hn    apply hnoPM    let f2 : (GR.deleteEdges {s(u', v')}) →g H :=      ⟨e, fun {x y} h => by        have h' := (SimpleGraph.deleteEdges_adj.mp h).1        show GR.Adj (e.symm (e x)) (e.symm (e y))        simpa using h'⟩    refine ⟨Q.comap f2, in1163_pm_comap f2 e.bijective Q hQ ?_⟩    intro a b hab    apply SimpleGraph.deleteEdges_adj.mpr    refine ⟨?_, ?_⟩    · have h := Q.adj_sub hab      change GR.Adj (e.symm (e a)) (e.symm (e b)) at h      simpa using h    · intro hs      simp only [Set.mem_singleton_iff, Sym2.eq_iff] at hs      rcases hs with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩      · exact hn hab      · exact hn hab.symm  have huvH : (P.comap f1).Adj (e u') (e v') := hforced _ hPH  have hblock := forced_matching_edge_blocks_four_and_six_switches H (P.comap f1) hPH    (e u') (e v') huvH hforced  have hdegH : ∀ x, 2 ≤ H.degree x := by    intro x    set a := e.symm x with ha    have hsub : G.neighborFinset a.1 ⊆ R.filter (fun y => G.Adj a.1 y) ∪ (Finset.univ \ R) := by      intro y hy      rw [mem_neighborFinset] at hy      by_cases hyR : y ∈ R      · exact Finset.mem_union_left _ (Finset.mem_filter.2 ⟨hyR, hy⟩)      · exact Finset.mem_union_right _ (by simp [hyR])    have h1 := Finset.card_le_card hsub    have h2 := Finset.card_union_le (R.filter (fun y => G.Adj a.1 y)) (Finset.univ \ R)    have h3 : (Finset.univ \ R).card = 2*k := by      rw [Finset.card_sdiff_of_subset (Finset.subset_univ _), Finset.card_univ, Fintype.card_fin]      omega    have h4 := G.minDegree_le_degree a.1    rw [card_neighborFinset_eq_degree] at h1    have hgt : 1 < (R.filter (fun y => G.Adj a.1 y)).card := by omega    obtain ⟨y1, hy1, y2, hy2, hy12⟩ := Finset.one_lt_card.mp hgt    rw [Finset.mem_filter] at hy1 hy2    have hn1 : e ⟨y1, hy1.1⟩ ∈ H.neighborFinset x := by      rw [mem_neighborFinset, hHadj, Equiv.symm_apply_apply]      exact hy1.2    have hn2 : e ⟨y2, hy2.1⟩ ∈ H.neighborFinset x := by      rw [mem_neighborFinset, hHadj, Equiv.symm_apply_apply]      exact hy2.2    have hne : e ⟨y1, hy1.1⟩ ≠ e ⟨y2, hy2.1⟩ := by      intro h      exact hy12 (congrArg Subtype.val (e.injective h))    have := Finset.card_le_card (show {e ⟨y1, hy1.1⟩, e ⟨y2, hy2.1⟩} ⊆ H.neighborFinset x by      intro z hz      simp only [Finset.mem_insert, Finset.mem_singleton] at hz      rcases hz with rfl | rfl      · exact hn1      · exact hn2)    rw [Finset.card_pair hne, card_neighborFinset_eq_degree] at this    exact this  have hmaxH : ∀ x, (Hᶜ).degree x ≤ 2*j-3 := by    intro x    have h1 := H.degree_compl x    rw [Fintype.card_fin] at h1    have := hdegH x    omega  have heu : (e.symm (e u')).1 = u := by rw [Equiv.symm_apply_apply]  have htriH : ∀ a b, (Hᶜ).Adj (e u') a → (Hᶜ).Adj (e u') b → a ≠ b → ¬ (Hᶜ).Adj a b := by    intro a b ha hb hab    rw [hHc, heu] at ha hb    rw [hHc]    exact htri _ _ ha hb (fun h => hab (e.symm.injective (Subtype.ext h)))  have hsquareH : ∀ a b x, (Hᶜ).Adj (e u') a → (Hᶜ).Adj (e u') b → a ≠ b → x ≠ e u' →      ¬ ((Hᶜ).Adj a x ∧ (Hᶜ).Adj b x) := by    intro a b x ha hb hab hx    rw [hHc, heu] at ha hb    rw [hHc, hHc]    refine hsquare _ _ _ ha hb (fun h => hab (e.symm.injective (Subtype.ext h))) ?_    intro h    apply hx    rw [← heu] at h    have := e.symm.injective (Subtype.ext h)    exact this  rcases matching_short_switch_complement_local_girth_five j hj H (P.comap f1) hPH hdegH hmaxH      (e u') (e v') huvH htriH hsquareH with h4 | h6  · exact hblock.1 h4  · exact hblock.2 h6
See it in the graphDiscuss this resultChallenge it