AFTD Auto-Formalizing Theoretical Domains

extendible_balanced_cut_maximum_matching_sizes_equal

theoremverified

For a k-extendible graph of order 4k, maximum matchings on the two halves of a balanced cut have equal sizes if their sizes sum to at least k.

Statement

theorem extendible_balanced_cut_maximum_matching_sizes_equal
    (k : ℕ) (G : SimpleGraph (Fin (4*k))) (hext : is_k_extendable G k)
    (C : Finset (Fin (4*k))) (hcard : C.card = 2*k)
    (M N : G.Subgraph) (hM : M.IsMatching) (hN : N.IsMatching)
    (hMC : M.verts ⊆ (C : Set (Fin (4*k))))
    (hNC : N.verts ⊆ ((C : Set (Fin (4*k)))ᶜ))
    (hmaxM : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ (C : Set (Fin (4*k))) → T.edgeSet.ncard ≤ M.edgeSet.ncard)
    (hmaxN : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ ((C : Set (Fin (4*k)))ᶜ) → T.edgeSet.ncard ≤ N.edgeSet.ncard)
    (hsum : k ≤ M.edgeSet.ncard + N.edgeSet.ncard) :
    M.edgeSet.ncard = N.edgeSet.ncard
Source
Balanced-cut structural reduction for OP-1957; https://arxiv.org/abs/2611.22690.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 7
Used by 2

The proof, explained

The theorem is proved by establishing the two mutual inequalities $|N| \le |M|$ and $|M| \le |N|$. Since $|M|, |N| \le k$ and $|M| + |N| \ge k$, $M$ contains a submatching $M'$ of size $k - |N|$; combining $M'$ with $N$ gives a matching of size $k$ spanning disjoint vertex sets on opposite sides of the cut. By $k$-extendability, this union extends to a perfect matching $P$ containing $N$. In any balanced cut, $P$ has equal numbers of internal edges on each side, so $|N|$ is bounded by the number of internal edges of $P$ in $C^c$, which equals the number in $C$, which in turn forms a matching on $C$ bounded by the maximum matching $|M|$. The symmetric argument gives $|M| \le |N|$, whence $|M| = |N|$.

  1. The complement $C^c$ has cardinality $2k$ and coincides with the set-theoretic complement of $C$.

    Since $C$ is a subset of the $4k$-element vertex set with $|C| = 2k$, its complement $C^c$ has cardinality $4k - 2k = 2k$ by `Finset.card_compl` and `Fintype.card_fin`. Its coercion to a set agrees with the set complement.

    lines 11–17

    uses Finset.card_compl, Fintype.card_fin

      set_option maxHeartbeats 4000000 in
        classical
        have hCcomp : ((Cᶜ : Finset (Fin (4*k))) : Set (Fin (4*k))) = (C : Set (Fin (4*k)))ᶜ := by ext v; simp
        have hCcompcard : (Cᶜ : Finset (Fin (4*k))).card = 2*k := by
          have h := Finset.card_compl C
          simp only [Fintype.card_fin] at h
          omega
  2. The matchings $M$ and $N$ each contain at most $k$ edges: $|M| \le k$ and $|N| \le k$.

    For any matching, the number of spanned vertices is twice the number of edges (`in1076_matching_twice_card`). Because the vertices of $M$ lie in $C$ and $|C| = 2k$, we have $2|M| \le 2k$, implying $|M| \le k$ (`Set.ncard_le_ncard`, `Set.toFinite`, `Set.ncard_coe_finset`). Symmetrically, the vertices of $N$ lie in $C^c$ of cardinality $2k$, so $2|N| \le 2k$, giving $|N| \le k$.

    lines 18–27

    uses in1076_matching_twice_card, Set.ncard_le_ncard, Set.toFinite, Set.ncard_coe_finset

        have hmle : M.edgeSet.ncard ≤ k := by
          have hverts := in1076_matching_twice_card hM
          have hsub := Set.ncard_le_ncard hMC (Set.toFinite _)
          rw [Set.ncard_coe_finset,hcard] at hsub
          omega
        have hnle : N.edgeSet.ncard ≤ k := by
          have hverts := in1076_matching_twice_card hN
          have hsub := Set.ncard_le_ncard hNC (Set.toFinite _)
          rw [← hCcomp,Set.ncard_coe_finset,hCcompcard] at hsub
          omega
  3. The vertex sets of $M$ and $N$ are disjoint.

    By assumption, all vertices of $M$ lie in $C$ while all vertices of $N$ lie in the complement $C^c$. Hence no vertex can belong to both sets, establishing disjointness via `Set.disjoint_left.mpr`.

    lines 28–31

    uses Set.disjoint_left.mpr

        have hMN : Disjoint M.verts N.verts := by
          apply Set.disjoint_left.mpr
          intro v hvM hvN
          exact (hNC hvN) (hMC hvM)
  4. The matching $N$ has at most as many edges as $M$, that is, $|N| \le |M|$.

    Since $|N| \le k$ and $|M| + |N| \ge k$, we have $k - |N| \le |M|$. By `finite_matching_has_submatching_of_each_smaller_size`, $M$ contains a submatching $M'$ of size $k - |N|$. Since $M'$ and $N$ have disjoint vertex sets, their union $M' \sqcup N$ is a matching of size $(k - |N|) + |N| = k$ edges (`extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard`). By $k$-extendability of $G$, $M' \sqcup N$ extends to a perfect matching $P$, so in particular $N \le P$ by `le_trans` and `le_sup_right`. All edges of $N$ have endpoints in $C^c$, so $N$ is contained in the induced subgraph $P[C^c]$ (`matching_edges_inside_induced`), yielding $|N| \le |P[C^c]|$ (`Set.ncard_le_ncard`, `Set.toFinite`). For a balanced cut, a perfect matching has equal numbers of internal edges on both sides (`perfect_matching_balanced_cut_internal_edge_counts_equal`, `Fintype.card_fin`), so $|P[C^c]| = |P[C]|$. Moreover, the edges $P[C]$ form a matching $Q$ on $C$ (`perfect_matching_induced_edges_form_matching`), and by maximality of $M$ on $C$, $|Q| \le |M|$. Chaining these relations gives $|N| \le |P[C^c]| = |P[C]| = |Q| \le |M|$.

    lines 32–48

    uses finite_matching_has_submatching_of_each_smaller_size, extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard, le_trans, le_sup_right, perfect_matching_induced_edges_form_matching, matching_edges_inside_induced, Set.ncard_le_ncard, Set.toFinite, perfect_matching_balanced_cut_internal_edge_counts_equal, Fintype.card_fin

        have hnleM : N.edgeSet.ncard ≤ M.edgeSet.ncard := by
          obtain ⟨M',hM',hM'M,hM'card⟩ :=
            finite_matching_has_submatching_of_each_smaller_size G M hM (k-N.edgeSet.ncard) (by omega)
          have hM'N : Disjoint M'.verts N.verts := hMN.mono_left hM'M.1
          have hT := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard M' N hM' hN hM'N
          have hTk : (M' ⊔ N).edgeSet.ncard = k := by rw [hT.2,hM'card]; omega
          obtain ⟨P,hP,hTP⟩ := hext.2.2 (M' ⊔ N) hT.1 hTk
          have hNP : N ≤ P := le_trans le_sup_right hTP
          obtain ⟨Q,hQ,hQC,hQP,hQE⟩ := perfect_matching_induced_edges_form_matching G P hP C
          have hNsub : N.edgeSet ⊆ (P.induce ((C : Set (Fin (4*k)))ᶜ)).edgeSet := by
            rw [← hCcomp]
            exact matching_edges_inside_induced G N P hNP (Cᶜ : Finset (Fin (4*k))) (by simpa [hCcomp] using hNC)
          have hNbound := Set.ncard_le_ncard hNsub (Set.toFinite _)
          have heq := perfect_matching_balanced_cut_internal_edge_counts_equal G P hP C (by simp only [Fintype.card_fin,hcard]; omega)
          have hQbound := hmaxM Q hQ hQC
          rw [← heq,← hQE] at hNbound
          omega
  5. The matching $M$ has at most as many edges as $N$, that is, $|M| \le |N|$.

    Symmetrically, since $|M| \le k$ and $|M| + |N| \ge k$, we have $k - |M| \le |N|$. By `finite_matching_has_submatching_of_each_smaller_size`, we select a submatching $N' \le N$ of size $k - |M|$. The union $M \sqcup N'$ is a matching of size $k$ with disjoint vertex sets (`extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard`), which by $k$-extendability extends to a perfect matching $P$ containing $M$ (`le_trans`, `le_sup_left`). All edges of $M$ lie in $P[C]$ (`matching_edges_inside_induced`), so $|M| \le |P[C]|$ (`Set.ncard_le_ncard`, `Set.toFinite`). By `perfect_matching_balanced_cut_internal_edge_counts_equal` and `Fintype.card_fin`, $|P[C]| = |P[C^c]|$. The internal edges of $P$ on $C^c$ form a matching $Q$ on $C^c$ (`perfect_matching_induced_edges_form_matching`), and by maximality of $N$ on $C^c$, $|Q| \le |N|$. Thus $|M| \le |P[C]| = |P[C^c]| = |Q| \le |N|$.

    lines 49–64

    uses finite_matching_has_submatching_of_each_smaller_size, extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard, le_trans, le_sup_left, perfect_matching_induced_edges_form_matching, matching_edges_inside_induced, Set.ncard_le_ncard, Set.toFinite, perfect_matching_balanced_cut_internal_edge_counts_equal, Fintype.card_fin

        have hmleN : M.edgeSet.ncard ≤ N.edgeSet.ncard := by
          obtain ⟨N',hN',hN'N,hN'card⟩ :=
            finite_matching_has_submatching_of_each_smaller_size G N hN (k-M.edgeSet.ncard) (by omega)
          have hMN' : Disjoint M.verts N'.verts := hMN.mono_right hN'N.1
          have hT := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard M N' hM hN' hMN'
          have hTk : (M ⊔ N').edgeSet.ncard = k := by rw [hT.2,hN'card]; omega
          obtain ⟨P,hP,hTP⟩ := hext.2.2 (M ⊔ N') hT.1 hTk
          have hMP : M ≤ P := le_trans le_sup_left hTP
          obtain ⟨Q,hQ,hQC,hQP,hQE⟩ := perfect_matching_induced_edges_form_matching G P hP (Cᶜ : Finset (Fin (4*k)))
          have hMsub := matching_edges_inside_induced G M P hMP C hMC
          have hMbound := Set.ncard_le_ncard hMsub (Set.toFinite _)
          have heq := perfect_matching_balanced_cut_internal_edge_counts_equal G P hP C (by simp only [Fintype.card_fin,hcard]; omega)
          have hQbound := hmaxN Q hQ (by simpa [hCcomp] using hQC)
          rw [← hCcomp,← hQE] at heq
          rw [heq] at hMbound
          omega
  6. The maximum matchings $M$ and $N$ have equal sizes: $|M| = |N|$.

    Linear integer arithmetic closes the goal immediately from the two opposite inequalities $|N| \le |M|$ and $|M| \le |N|$.

    line 65

        omega
Finset.card_compl
The cardinality of the complement of a finite set $s$ is the cardinality of the ambient finite type minus the cardinality of $s$.
Fintype.card_fin
The finite type `Fin n` has cardinality $n$.
in1076_matching_twice_card
For any matching in a graph, the number of vertices spanned by the matching is twice the number of edges.
Set.ncard_le_ncard
If a set $s$ is a subset of a finite set $t$, then the cardinality of $s$ is at most the cardinality of $t$.
Set.toFinite
A set whose coercion to a subtype is finite is a finite set.
Set.ncard_coe_finset
The cardinality of a set coerced from a `Finset` equals the cardinality of the `Finset`.
Set.disjoint_left.mpr
Two sets are disjoint if no element of the first belongs to the second.
finite_matching_has_submatching_of_each_smaller_size
Any matching of size at least $k$ in a finite graph contains a submatching of size exactly $k$.
extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard
The union of two matchings with disjoint vertex sets is a matching whose edge count is the sum of their edge counts.
le_trans
The order relation $\le$ is transitive.
le_sup_right
In a join-semilattice, $b \le a \sqcup b$.
le_sup_left
In a join-semilattice, $a \le a \sqcup b$.
perfect_matching_induced_edges_form_matching
For any perfect matching $P$ and vertex subset $S$, the edges of $P$ induced on $S$ form a matching contained in $S$.
matching_edges_inside_induced
If a subgraph $M \le P$ has all its vertices in $S$, then every edge of $M$ is an edge of the induced subgraph $P[S]$.
perfect_matching_balanced_cut_internal_edge_counts_equal
For any perfect matching in a graph and any balanced cut $C$, the number of edges induced inside $C$ equals the number induced inside $C^c$.

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_balanced_cut_maximum_matching_sizes_equal    (k : ℕ) (G : SimpleGraph (Fin (4*k))) (hext : is_k_extendable G k)    (C : Finset (Fin (4*k))) (hcard : C.card = 2*k)    (M N : G.Subgraph) (hM : M.IsMatching) (hN : N.IsMatching)    (hMC : M.verts ⊆ (C : Set (Fin (4*k))))    (hNC : N.verts ⊆ ((C : Set (Fin (4*k)))ᶜ))    (hmaxM : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ (C : Set (Fin (4*k))) → T.edgeSet.ncard ≤ M.edgeSet.ncard)    (hmaxN : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ ((C : Set (Fin (4*k)))ᶜ) → T.edgeSet.ncard ≤ N.edgeSet.ncard)    (hsum : k ≤ M.edgeSet.ncard + N.edgeSet.ncard) :    M.edgeSet.ncard = N.edgeSet.ncard := by  set_option maxHeartbeats 4000000 in    classical    have hCcomp : ((Cᶜ : Finset (Fin (4*k))) : Set (Fin (4*k))) = (C : Set (Fin (4*k)))ᶜ := by ext v; simp    have hCcompcard : (Cᶜ : Finset (Fin (4*k))).card = 2*k := by      have h := Finset.card_compl C      simp only [Fintype.card_fin] at h      omega    have hmle : M.edgeSet.ncard ≤ k := by      have hverts := in1076_matching_twice_card hM      have hsub := Set.ncard_le_ncard hMC (Set.toFinite _)      rw [Set.ncard_coe_finset,hcard] at hsub      omega    have hnle : N.edgeSet.ncard ≤ k := by      have hverts := in1076_matching_twice_card hN      have hsub := Set.ncard_le_ncard hNC (Set.toFinite _)      rw [← hCcomp,Set.ncard_coe_finset,hCcompcard] at hsub      omega    have hMN : Disjoint M.verts N.verts := by      apply Set.disjoint_left.mpr      intro v hvM hvN      exact (hNC hvN) (hMC hvM)    have hnleM : N.edgeSet.ncard ≤ M.edgeSet.ncard := by      obtain ⟨M',hM',hM'M,hM'card⟩ :=        finite_matching_has_submatching_of_each_smaller_size G M hM (k-N.edgeSet.ncard) (by omega)      have hM'N : Disjoint M'.verts N.verts := hMN.mono_left hM'M.1      have hT := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard M' N hM' hN hM'N      have hTk : (M' ⊔ N).edgeSet.ncard = k := by rw [hT.2,hM'card]; omega      obtain ⟨P,hP,hTP⟩ := hext.2.2 (M' ⊔ N) hT.1 hTk      have hNP : N ≤ P := le_trans le_sup_right hTP      obtain ⟨Q,hQ,hQC,hQP,hQE⟩ := perfect_matching_induced_edges_form_matching G P hP C      have hNsub : N.edgeSet ⊆ (P.induce ((C : Set (Fin (4*k)))ᶜ)).edgeSet := by        rw [← hCcomp]        exact matching_edges_inside_induced G N P hNP (Cᶜ : Finset (Fin (4*k))) (by simpa [hCcomp] using hNC)      have hNbound := Set.ncard_le_ncard hNsub (Set.toFinite _)      have heq := perfect_matching_balanced_cut_internal_edge_counts_equal G P hP C (by simp only [Fintype.card_fin,hcard]; omega)      have hQbound := hmaxM Q hQ hQC      rw [← heq,← hQE] at hNbound      omega    have hmleN : M.edgeSet.ncard ≤ N.edgeSet.ncard := by      obtain ⟨N',hN',hN'N,hN'card⟩ :=        finite_matching_has_submatching_of_each_smaller_size G N hN (k-M.edgeSet.ncard) (by omega)      have hMN' : Disjoint M.verts N'.verts := hMN.mono_right hN'N.1      have hT := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard M N' hM hN' hMN'      have hTk : (M ⊔ N').edgeSet.ncard = k := by rw [hT.2,hN'card]; omega      obtain ⟨P,hP,hTP⟩ := hext.2.2 (M ⊔ N') hT.1 hTk      have hMP : M ≤ P := le_trans le_sup_left hTP      obtain ⟨Q,hQ,hQC,hQP,hQE⟩ := perfect_matching_induced_edges_form_matching G P hP (Cᶜ : Finset (Fin (4*k)))      have hMsub := matching_edges_inside_induced G M P hMP C hMC      have hMbound := Set.ncard_le_ncard hMsub (Set.toFinite _)      have heq := perfect_matching_balanced_cut_internal_edge_counts_equal G P hP C (by simp only [Fintype.card_fin,hcard]; omega)      have hQbound := hmaxN Q hQ (by simpa [hCcomp] using hQC)      rw [← hCcomp,← hQE] at heq      rw [heq] at hMbound      omega    omega
See it in the graphDiscuss this resultChallenge it