AFTD Auto-Formalizing Theoretical Domains

in1277_seven_control_large_balanced_cross_match

theoremverified

Equally large sets of at least five vertices from the two fourteen-vertex halves of the explicit seven-block control induce a graph with a perfect matching.

Statement

theorem in1277_seven_control_large_balanced_cross_match (X Y : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13}) (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27}) (hsize : 5 ≤ X.card) (hcard : X.card = Y.card) : ∃ M : (in1261_seven_graph.induce {v | v ∈ X ∪ Y}).Subgraph, M.IsPerfectMatching
Source
OP-1957 seven-block control; experiment 43907; arXiv:2611.22690.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2

The proof, explained

The theorem proves that any two equicardinal subsets X ⊆ {0, ..., 13} and Y ⊆ {14, ..., 27} of size at least 5 induce a subgraph with a perfect matching in in1261_seven_graph. The strategy is to apply Hall's Marriage Theorem to the bipartite graph between X and Y. Cross-edges are characterized so that every x ≥ 4 connects to all of Y, 0 connects to Y ∖ {21}, and 1 ≤ x ≤ 3 connects to Y ∖ {14, 21}; because |X| = |Y| ≥ 5, Hall's condition |s| ≤ |N_Y(s)| holds for every s ⊆ X. The resulting bijection between X and Y yields a matching spanning X ∪ Y, which is a perfect matching in the induced subgraph.

  1. Adjacency across the cut between {0, ..., 13} and {14, ..., 27} is equivalent to not being a forbidden pair.

    For u < 14 and v ≥ 14, min(u, v) = u and max(u, v) = v, and u ≠ v. Unfolding the definition of in1261_seven_graph and in1261_seven_forbidden_ordered simplifies the forbidden condition to (u = 0 ∧ v = 21) ∨ (1 ≤ u ≤ 3 ∧ (v = 14 ∨ v = 21)).

    lines 1–20

    uses Nat.min_eq_left, Nat.max_eq_right

    private noncomputable instance in1277_seven_control_large_balanced_cross_match_dec :
        DecidableRel in1261_seven_graph.Adj := fun _ _ => Classical.propDecidable _
    
    private lemma in1277_seven_control_large_balanced_cross_match_adj_iff (u v : Fin 28)
        (hu : u.val < 14) (hv : 14 ≤ v.val) :
        in1261_seven_graph.Adj u v ↔
          ¬ ((u.val = 0 ∧ v.val = 21) ∨
              (1 ≤ u.val ∧ u.val ≤ 3 ∧ (v.val = 14 ∨ v.val = 21))) := by
      have hmin : min u.val v.val = u.val := Nat.min_eq_left (by omega)
      have hmax : max u.val v.val = v.val := Nat.max_eq_right (by omega)
      have huv : u ≠ v := by intro h; rw [h] at hu; omega
      unfold in1261_seven_graph
      simp only [hmin, hmax]
      have hforb : in1261_seven_forbidden_ordered u.val v.val ↔
          (u.val = 0 ∧ v.val = 21) ∨
            (1 ≤ u.val ∧ u.val ≤ 3 ∧ (v.val = 14 ∨ v.val = 21)) := by
        unfold in1261_seven_forbidden_ordered; omega
      rw [hforb]
      exact ⟨fun h => h.2, fun h => ⟨huv, h⟩⟩
    
  2. Every vertex u with 4 ≤ u < 14 is adjacent to every vertex v ≥ 14.

    By the adjacency criterion in1277_seven_control_large_balanced_cross_match_adj_iff, any forbidden edge across the cut requires u = 0 or 1 ≤ u ≤ 3, which contradicts 4 ≤ u.

    lines 21–27

    uses in1277_seven_control_large_balanced_cross_match_adj_iff

    private lemma in1277_seven_control_large_balanced_cross_match_adj_ge_four
        (u v : Fin 28) (hu4 : 4 ≤ u.val) (hu : u.val < 14) (hv : 14 ≤ v.val) :
        in1261_seven_graph.Adj u v := by
      rw [in1277_seven_control_large_balanced_cross_match_adj_iff u v hu hv]
      intro h
      rcases h with ⟨h0, -⟩ | ⟨h1, h3, -⟩ <;> omega
    
  3. Vertex 0 is adjacent to v ≥ 14 if and only if v ≠ 21.

    Specializing the adjacency criterion to u = 0 eliminates the case 1 ≤ u ≤ 3, leaving only ¬(v = 21), which is v ≠ 21.

    lines 28–37

    uses in1277_seven_control_large_balanced_cross_match_adj_iff, Or.inl

    private lemma in1277_seven_control_large_balanced_cross_match_adj_zero
        (v : Fin 28) (hv : 14 ≤ v.val) :
        in1261_seven_graph.Adj (0 : Fin 28) v ↔ v.val ≠ 21 := by
      rw [in1277_seven_control_large_balanced_cross_match_adj_iff (0 : Fin 28) v (by decide) hv]
      constructor
      · intro h; by_contra hc; exact h (Or.inl ⟨rfl, hc⟩)
      · intro h; rintro (⟨-, h21⟩ | ⟨h1, -⟩)
        · exact h h21
        · omega
    
  4. Every vertex u with 1 ≤ u ≤ 3 is adjacent to v ≥ 14 if and only if v ≠ 14 and v ≠ 21.

    Specializing the adjacency criterion to 1 ≤ u ≤ 3 eliminates the u = 0 clause, leaving ¬(v = 14 ∨ v = 21), which is v ≠ 14 ∧ v ≠ 21.

    lines 38–50

    uses in1277_seven_control_large_balanced_cross_match_adj_iff, Or.inl, Or.inr

    private lemma in1277_seven_control_large_balanced_cross_match_adj_low
        (u v : Fin 28) (hu1 : 1 ≤ u.val) (hu3 : u.val ≤ 3) (hv : 14 ≤ v.val) :
        in1261_seven_graph.Adj u v ↔ v.val ≠ 14 ∧ v.val ≠ 21 := by
      rw [in1277_seven_control_large_balanced_cross_match_adj_iff u v (by omega) hv]
      constructor
      · intro h
        exact ⟨fun h14 => h (Or.inr ⟨hu1, hu3, Or.inl h14⟩),
               fun h21 => h (Or.inr ⟨hu1, hu3, Or.inr h21⟩)⟩
      · rintro ⟨h14, h21⟩ (⟨h0, -⟩ | ⟨-, -, h14' | h21'⟩)
        · omega
        · exact h14 h14'
        · exact h21 h21'
    
  5. Any subset of vertices with value strictly less than 4 has cardinality at most 4.

    The image of s under the injection taking each subtype element to its value is a subset of {0, 1, 2, 3}. Since |{0, 1, 2, 3}| = 4, |s| ≤ 4.

    lines 51–68

    uses Fin.ext, Finset.card_image_of_injective, Finset.card_le_card, Finset.mem_image, Subtype.val_injective

    private lemma in1277_seven_control_large_balanced_cross_match_card_le_four
        (X : Finset (Fin 28)) (s : Finset ↥X) (h : ∀ x ∈ s, x.val.val < 4) : s.card ≤ 4 := by
      have himg : s.image (fun x : ↥X => x.val) ⊆ ({0,1,2,3} : Finset (Fin 28)) := by
        intro v hv
        rw [Finset.mem_image] at hv
        obtain ⟨x, hxs, rfl⟩ := hv
        have hx := h x hxs
        have h4 : x.val.val = 0 ∨ x.val.val = 1 ∨ x.val.val = 2 ∨ x.val.val = 3 := by omega
        rcases h4 with h0 | h1 | h2 | h3
        · have : x.val = 0 := Fin.ext (by simpa using h0); simp [this]
        · have : x.val = 1 := Fin.ext (by simpa using h1); simp [this]
        · have : x.val = 2 := Fin.ext (by simpa using h2); simp [this]
        · have : x.val = 3 := Fin.ext (by simpa using h3); simp [this]
      calc s.card = (s.image (fun x : ↥X => x.val)).card :=
            (Finset.card_image_of_injective s Subtype.val_injective).symm
        _ ≤ ({0,1,2,3} : Finset (Fin 28)).card := Finset.card_le_card himg
        _ = 4 := by decide
    
  6. Any subset of vertices with values between 1 and 3 has cardinality at most 3.

    The image of s embeds injectively into {1, 2, 3}, which has cardinality 3, hence |s| ≤ 3.

    lines 69–86

    uses Fin.ext, Finset.card_image_of_injective, Finset.card_le_card, Finset.mem_image, Subtype.val_injective

    private lemma in1277_seven_control_large_balanced_cross_match_card_le_three
        (X : Finset (Fin 28)) (s : Finset ↥X)
        (h : ∀ x ∈ s, x.val.val ≤ 3 ∧ x.val.val ≠ 0) : s.card ≤ 3 := by
      have himg : s.image (fun x : ↥X => x.val) ⊆ ({1,2,3} : Finset (Fin 28)) := by
        intro v hv
        rw [Finset.mem_image] at hv
        obtain ⟨x, hxs, rfl⟩ := hv
        obtain ⟨hle, hne⟩ := h x hxs
        have h4 : x.val.val = 1 ∨ x.val.val = 2 ∨ x.val.val = 3 := by omega
        rcases h4 with h0 | h1 | h2
        · have : x.val = 1 := Fin.ext (by simpa using h0); simp [this]
        · have : x.val = 2 := Fin.ext (by simpa using h1); simp [this]
        · have : x.val = 3 := Fin.ext (by simpa using h2); simp [this]
      calc s.card = (s.image (fun x : ↥X => x.val)).card :=
            (Finset.card_image_of_injective s Subtype.val_injective).symm
        _ ≤ ({1,2,3} : Finset (Fin 28)).card := Finset.card_le_card himg
        _ = 3 := by decide
    
  7. Vertices in X have values < 14, and vertices in Y have values ≥ 14.

    This establishes the general setup for Hall's condition by unpacking the membership hypotheses X ⊆ {0, ..., 13} and Y ⊆ {14, ..., 27}.

    lines 87–104

    uses Finset.mem_insert, Finset.mem_singleton

    private lemma in1277_seven_control_large_balanced_cross_match_hall
        (X Y : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13})
        (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27})
        (hsize : 5 ≤ X.card) (hcard : X.card = Y.card) :
        ∀ s : Finset ↥X,
          s.card ≤ (s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y))).card := by
      classical
      intro s
      have hx_lt : ∀ x : Fin 28, x ∈ X → x.val < 14 := by
        intro x hx
        have h := hX hx
        simp only [Finset.mem_insert, Finset.mem_singleton] at h
        omega
      have hy_ge : ∀ y : Fin 28, y ∈ Y → 14 ≤ y.val := by
        intro y hy
        have h := hY hy
        simp only [Finset.mem_insert, Finset.mem_singleton] at h
        omega
  8. Hall's condition holds if s contains a vertex x with value at least 4.

    Since x ≥ 4 is adjacent to all of Y, the neighbourhood of s in Y contains all of Y. Thus |s| ≤ |X| = |Y| ≤ |N_Y(s)|.

    lines 105–116

    uses Finset.card_le_card, Finset.card_le_univ, Finset.mem_biUnion, Finset.mem_filter, in1277_seven_control_large_balanced_cross_match_adj_ge_four

      by_cases hA : ∃ x ∈ s, 4 ≤ x.val.val
      · obtain ⟨x, hxs, hx4⟩ := hA
        have hsub : Y ⊆ s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) := by
          intro y hy
          rw [Finset.mem_biUnion]
          refine ⟨x, hxs, ?_⟩
          rw [Finset.mem_filter]
          exact ⟨hy, in1277_seven_control_large_balanced_cross_match_adj_ge_four
            x.val y hx4 (hx_lt x.val x.property) (hy_ge y hy)⟩
        calc s.card ≤ X.card := by simpa using Finset.card_le_univ s
          _ = Y.card := hcard
          _ ≤ _ := Finset.card_le_card hsub
  9. Hall's condition holds if s contains 0 but no vertex with value at least 4.

    Since 0 ∈ s, the neighbourhood N_Y(s) contains Y ∖ {21}. All elements in s have value < 4, so |s| ≤ 4. Since |Y| = |X| ≥ 5, |Y ∖ {21}| ≥ |Y| - 1 ≥ 4 ≥ |s|.

    lines 117–140

    uses Fin.ext, Finset.card_le_card, Finset.mem_biUnion, Finset.mem_erase, Finset.mem_filter, Finset.pred_card_le_card_erase, in1277_seven_control_large_balanced_cross_match_adj_zero, in1277_seven_control_large_balanced_cross_match_card_le_four

      · by_cases h0 : ∃ x ∈ s, x.val.val = 0
        · obtain ⟨x, hxs, hx0⟩ := h0
          have hx : x.val = 0 := Fin.ext (by simpa using hx0)
          have hsub : Y.erase (21 : Fin 28) ⊆
              s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) := by
            intro y hy
            rw [Finset.mem_erase] at hy
            obtain ⟨hyne, hyY⟩ := hy
            rw [Finset.mem_biUnion]
            refine ⟨x, hxs, ?_⟩
            rw [Finset.mem_filter]
            refine ⟨hyY, ?_⟩
            rw [hx, in1277_seven_control_large_balanced_cross_match_adj_zero y (hy_ge y hyY)]
            intro hval
            exact hyne (Fin.ext (by simpa using hval))
          have hscard4 : s.card ≤ 4 := by
            apply in1277_seven_control_large_balanced_cross_match_card_le_four
            intro x hx
            by_contra hc
            exact hA ⟨x, hx, by omega⟩
          calc s.card ≤ X.card - 1 := by omega
            _ = Y.card - 1 := by rw [hcard]
            _ ≤ (Y.erase (21 : Fin 28)).card := Finset.pred_card_le_card_erase
            _ ≤ _ := Finset.card_le_card hsub
  10. Hall's condition holds if s contains no vertex ≥ 4 and does not contain 0.

    If s is empty the inequality is trivial. If s is nonempty, choose x ∈ s; then 1 ≤ x ≤ 3, so N_Y(s) contains Y ∖ {14, 21}, which has size at least |Y| - 2. Since all elements of s are in {1, 2, 3}, |s| ≤ 3. Since |Y| = |X| ≥ 5, |Y| - 2 ≥ 3 ≥ |s|.

    lines 141–175

    uses Fin.ext, Finset.card_le_card, Finset.mem_biUnion, Finset.mem_erase, Finset.mem_filter, Finset.nonempty_iff_ne_empty, Finset.pred_card_le_card_erase, in1277_seven_control_large_balanced_cross_match_adj_low, in1277_seven_control_large_balanced_cross_match_card_le_three

        · by_cases hs : s = ∅
          · simp [hs]
          · obtain ⟨x, hxs⟩ := Finset.nonempty_iff_ne_empty.mpr hs
            have hxne : x.val.val ≠ 0 := fun he => h0 ⟨x, hxs, he⟩
            have hxlt : x.val.val ≤ 3 := by
              by_contra hc
              exact hA ⟨x, hxs, by omega⟩
            have hsub : (Y.erase (14 : Fin 28)).erase (21 : Fin 28) ⊆
                s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) := by
              intro y hy
              rw [Finset.mem_erase, Finset.mem_erase] at hy
              obtain ⟨hy21, hy14, hyY⟩ := hy
              rw [Finset.mem_biUnion]
              refine ⟨x, hxs, ?_⟩
              rw [Finset.mem_filter]
              refine ⟨hyY, ?_⟩
              rw [in1277_seven_control_large_balanced_cross_match_adj_low x.val y (by omega) hxlt
                (hy_ge y hyY)]
              exact ⟨fun h14 => hy14 (Fin.ext (by simpa using h14)),
                     fun h21 => hy21 (Fin.ext (by simpa using h21))⟩
            have hscard3 : s.card ≤ 3 := by
              apply in1277_seven_control_large_balanced_cross_match_card_le_three
              intro x hx
              exact ⟨by by_contra hc; exact hA ⟨x, hx, by omega⟩,
                     fun he => h0 ⟨x, hx, he⟩⟩
            calc s.card ≤ 3 := hscard3
              _ ≤ X.card - 2 := by omega
              _ = Y.card - 2 := by rw [hcard]
              _ ≤ ((Y.erase (14 : Fin 28)).erase (21 : Fin 28)).card := by
                    have h1 := Finset.pred_card_le_card_erase (s := Y) (a := (14 : Fin 28))
                    have h2 := Finset.pred_card_le_card_erase (s := Y.erase (14 : Fin 28))
                      (a := (21 : Fin 28))
                    omega
              _ ≤ _ := Finset.card_le_card hsub
    
  11. Every vertex in X has value strictly less than 14.

    Unpacking the hypothesis X ⊆ {0, ..., 13} shows that every element of X is at most 13, hence < 14.

    lines 176–183

    uses Finset.mem_insert, Finset.mem_singleton

    private lemma in1277_seven_control_large_balanced_cross_match_xlt
        (X : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13}) :
        ∀ x : Fin 28, x ∈ X → x.val < 14 := by
      intro x hx
      have h := hX hx
      simp only [Finset.mem_insert, Finset.mem_singleton] at h
      omega
    
  12. Every vertex in Y has value at least 14.

    Unpacking the hypothesis Y ⊆ {14, ..., 27} shows that every element of Y is at least 14.

    lines 184–191

    uses Finset.mem_insert, Finset.mem_singleton

    private lemma in1277_seven_control_large_balanced_cross_match_yge
        (Y : Finset (Fin 28)) (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27}) :
        ∀ y : Fin 28, y ∈ Y → 14 ≤ y.val := by
      intro y hy
      have h := hY hy
      simp only [Finset.mem_insert, Finset.mem_singleton] at h
      omega
    
  13. There is a bijection eXY : X ≃ Y such that every x ∈ X is adjacent to eXY(x).

    Hall's Marriage Theorem (Finset.all_card_le_biUnion_card_iff_exists_injective) gives an injection f : X → Y with f(x) adjacent to x. Since X and Y are finite sets of the same cardinality, f is a bijection, defining an equivalence eXY : X ≃ Y.

    lines 192–208

    uses Equiv.ofBijective, Finset.all_card_le_biUnion_card_iff_exists_injective, Finset.mem_filter, Fintype.bijective_iff_injective_and_card, Fintype.card_coe, Subtype.ext_iff, in1277_seven_control_large_balanced_cross_match_hall

    theorem in1277_seven_control_large_balanced_cross_match (X Y : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13}) (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27}) (hsize : 5 ≤ X.card) (hcard : X.card = Y.card) : ∃ M : (in1261_seven_graph.induce {v | v ∈ X ∪ Y}).Subgraph, M.IsPerfectMatching := by
      classical
      obtain ⟨f, hf_inj, hf_mem⟩ :=
        Finset.all_card_le_biUnion_card_iff_exists_injective
          (fun x : ↥X => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) |>.mp
          (in1277_seven_control_large_balanced_cross_match_hall X Y hX hY hsize hcard)
      have hfY : ∀ x : ↥X, f x ∈ Y := fun x => (Finset.mem_filter.mp (hf_mem x)).1
      let fy : ↥X → ↥Y := fun x => ⟨f x, hfY x⟩
      have hfy_inj : Function.Injective fy := by
        intro a b hab
        apply hf_inj
        exact Subtype.ext_iff.mp hab
      have hfy_bij : Function.Bijective fy := by
        rw [Fintype.bijective_iff_injective_and_card]
        exact ⟨hfy_inj, by simp [Fintype.card_coe, hcard]⟩
      let eXY : ↥X ≃ ↥Y := Equiv.ofBijective fy hfy_bij
      have heapply : ∀ x : ↥X, (eXY x).val = f x := fun x => rfl
  14. There is a matching M in the ambient graph with vertex set X ∪ Y.

    Since X ⊆ {0, ..., 13} and Y ⊆ {14, ..., 27}, X and Y are disjoint. The equivalence eXY along graph edges then induces a matching M on X ∪ Y.

    lines 209–224

    uses Finset.mem_filter, Finset.mem_union, Set.disjoint_left, SimpleGraph.Subgraph.IsMatching.exists_of_disjoint_sets_of_equiv, in1277_seven_control_large_balanced_cross_match_xlt, in1277_seven_control_large_balanced_cross_match_yge

      have hadj : ∀ a : ↥(↑X : Set (Fin 28)), in1261_seven_graph.Adj a (eXY a) := by
        intro a
        have h := (Finset.mem_filter.mp (hf_mem ⟨a.val, a.property⟩)).2
        simpa [heapply] using h
      have hdisj : Disjoint (↑X : Set (Fin 28)) ↑Y := by
        rw [Set.disjoint_left]
        intro v hvx hvy
        have h1 := in1277_seven_control_large_balanced_cross_match_xlt X hX v hvx
        have h2 := in1277_seven_control_large_balanced_cross_match_yge Y hY v hvy
        omega
      obtain ⟨M, hMverts, hMmatch⟩ :=
        SimpleGraph.Subgraph.IsMatching.exists_of_disjoint_sets_of_equiv
          (G := in1261_seven_graph) hdisj eXY hadj
      have hunion : (↑X : Set (Fin 28)) ∪ ↑Y = {v : Fin 28 | v ∈ X ∪ Y} := by
        ext v
        simp [Finset.mem_union]
  15. The matching M restricts to a perfect matching of the induced subgraph on X ∪ Y.

    Restricting M to the induced subgraph on X ∪ Y yields a subgraph with all vertices (verts = univ) where each vertex has degree 1 in M, proving it is a perfect matching of the induced subgraph.

    lines 225–250

    uses Set.mem_univ, SimpleGraph.induce_adj, Subtype.ext

      refine ⟨{
        verts := Set.univ
        Adj := fun a b => M.Adj a.val b.val
        adj_sub := ?_
        edge_vert := ?_
        symm := ⟨fun a b h => M.adj_symm h⟩ }, ?_, ?_⟩
      · intro a b h
        exact SimpleGraph.induce_adj.mpr (M.adj_sub h)
      · intro a b h
        exact Set.mem_univ a
      · intro a ha
        have haM : a.val ∈ M.verts := by
          rw [hMverts, hunion]
          exact a.property
        obtain ⟨w, hw1, hw2⟩ := hMmatch haM
        have hwmem : w ∈ X ∪ Y := by
          have hw' : w ∈ (↑X : Set (Fin 28)) ∪ ↑Y := by
            have h := M.edge_vert hw1.symm
            rwa [hMverts] at h
          rw [hunion] at hw'
          simpa using hw'
        refine ⟨⟨w, hwmem⟩, hw1, ?_⟩
        intro y hy
        exact Subtype.ext (hw2 y.val hy)
      · intro v
        exact Set.mem_univ v
Nat.min_eq_left
If a ≤ b in ℕ, then min a b = a.
Nat.max_eq_right
If a ≤ b in ℕ, then max a b = b.
in1277_seven_control_large_balanced_cross_match_adj_iff
A vertex u < 14 and a vertex v ≥ 14 are adjacent in in1261_seven_graph iff they do not form the pair (0, 21) or 1 ≤ u ≤ 3 with v ∈ {14, 21}.
Or.inl
From a proof of A, infer A ∨ B.
Or.inr
From a proof of B, infer A ∨ B.
Finset.mem_image
An element b belongs to the image f(s) iff b = f(a) for some a ∈ s.
Fin.ext
Two Fin n values are equal iff their underlying natural numbers are equal.
Finset.card_image_of_injective
The image of a finite set under an injective function has the same cardinality as the set.
Subtype.val_injective
The projection mapping a subtype element to its underlying value is injective.
Finset.card_le_card
If s ⊆ t for finite sets, then |s| ≤ |t|.
Finset.mem_insert
An element belongs to insert b s iff it equals b or belongs to s.
Finset.mem_singleton
An element belongs to the singleton set {a} iff it equals a.
Finset.mem_biUnion
An element belongs to the indexed union ⋃_{x ∈ s} t(x) iff it belongs to t(x) for some x ∈ s.
Finset.mem_filter
An element belongs to the filtered set {x ∈ s | P(x)} iff it belongs to s and satisfies P.
in1277_seven_control_large_balanced_cross_match_adj_ge_four
Any vertex u with 4 ≤ u < 14 is adjacent to every vertex v with 14 ≤ v.
Finset.card_le_univ
The cardinality of a subset of a finite type is at most the cardinality of the full type.
Finset.mem_erase
An element belongs to s.erase b iff it is not equal to b and belongs to s.
in1277_seven_control_large_balanced_cross_match_adj_zero
Vertex 0 is adjacent to v ≥ 14 iff v ≠ 21.
in1277_seven_control_large_balanced_cross_match_card_le_four
Any subset of vertices whose values are strictly less than 4 has cardinality at most 4.
Finset.pred_card_le_card_erase
Removing an element from a finite set leaves a set of cardinality at least |s| - 1.
Finset.nonempty_iff_ne_empty
A finite set is nonempty iff it is not equal to the empty set.
in1277_seven_control_large_balanced_cross_match_adj_low
Any vertex u with 1 ≤ u ≤ 3 is adjacent to v ≥ 14 iff v ≠ 14 and v ≠ 21.
in1277_seven_control_large_balanced_cross_match_card_le_three
Any subset of vertices whose values satisfy 1 ≤ u ≤ 3 has cardinality at most 3.
Finset.all_card_le_biUnion_card_iff_exists_injective
Hall's Marriage Theorem for finite sets: a family of sets admits an injective system of distinct representatives iff every subcollection of size k has union of size at least k.
in1277_seven_control_large_balanced_cross_match_hall
For balanced subsets X and Y of size at least 5 from the two halves, every subset s ⊆ X has at least |s| neighbours in Y.
Subtype.ext_iff
Two subtype elements are equal iff their underlying values are equal.
Fintype.bijective_iff_injective_and_card
A map between finite types of equal cardinality is bijective iff it is injective.
Fintype.card_coe
The cardinality of a subtype formed by a finite set equals the cardinality of the finite set.
Equiv.ofBijective
A bijective function induces an equivalence (bijection).
Set.disjoint_left
Two sets are disjoint iff no element of the first belongs to the second.
in1277_seven_control_large_balanced_cross_match_xlt
Every vertex in X ⊆ {0, ..., 13} has value strictly less than 14.
in1277_seven_control_large_balanced_cross_match_yge
Every vertex in Y ⊆ {14, ..., 27} has value at least 14.
SimpleGraph.Subgraph.IsMatching.exists_of_disjoint_sets_of_equiv
An equivalence between two disjoint vertex sets whose pairs are adjacent in G induces a matching on their union.
Finset.mem_union
An element belongs to the union of two finite sets iff it belongs to at least one of them.
SimpleGraph.induce_adj
Adjacency between vertices in an induced subgraph is equivalent to adjacency in the ambient graph.
Set.mem_univ
Every element belongs to the universal set.
Subtype.ext
Two subtype elements are equal if their underlying values are equal.

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 noncomputable instance in1277_seven_control_large_balanced_cross_match_dec :    DecidableRel in1261_seven_graph.Adj := fun _ _ => Classical.propDecidable _private lemma in1277_seven_control_large_balanced_cross_match_adj_iff (u v : Fin 28)    (hu : u.val < 14) (hv : 14 ≤ v.val) :    in1261_seven_graph.Adj u v ↔      ¬ ((u.val = 0 ∧ v.val = 21) ∨          (1 ≤ u.val ∧ u.val ≤ 3 ∧ (v.val = 14 ∨ v.val = 21))) := by  have hmin : min u.val v.val = u.val := Nat.min_eq_left (by omega)  have hmax : max u.val v.val = v.val := Nat.max_eq_right (by omega)  have huv : u ≠ v := by intro h; rw [h] at hu; omega  unfold in1261_seven_graph  simp only [hmin, hmax]  have hforb : in1261_seven_forbidden_ordered u.val v.val ↔      (u.val = 0 ∧ v.val = 21) ∨        (1 ≤ u.val ∧ u.val ≤ 3 ∧ (v.val = 14 ∨ v.val = 21)) := by    unfold in1261_seven_forbidden_ordered; omega  rw [hforb]  exact ⟨fun h => h.2, fun h => ⟨huv, h⟩⟩private lemma in1277_seven_control_large_balanced_cross_match_adj_ge_four    (u v : Fin 28) (hu4 : 4 ≤ u.val) (hu : u.val < 14) (hv : 14 ≤ v.val) :    in1261_seven_graph.Adj u v := by  rw [in1277_seven_control_large_balanced_cross_match_adj_iff u v hu hv]  intro h  rcases h with ⟨h0, -⟩ | ⟨h1, h3, -⟩ <;> omegaprivate lemma in1277_seven_control_large_balanced_cross_match_adj_zero    (v : Fin 28) (hv : 14 ≤ v.val) :    in1261_seven_graph.Adj (0 : Fin 28) v ↔ v.val ≠ 21 := by  rw [in1277_seven_control_large_balanced_cross_match_adj_iff (0 : Fin 28) v (by decide) hv]  constructor  · intro h; by_contra hc; exact h (Or.inl ⟨rfl, hc⟩)  · intro h; rintro (⟨-, h21⟩ | ⟨h1, -⟩)    · exact h h21    · omegaprivate lemma in1277_seven_control_large_balanced_cross_match_adj_low    (u v : Fin 28) (hu1 : 1 ≤ u.val) (hu3 : u.val ≤ 3) (hv : 14 ≤ v.val) :    in1261_seven_graph.Adj u v ↔ v.val ≠ 14 ∧ v.val ≠ 21 := by  rw [in1277_seven_control_large_balanced_cross_match_adj_iff u v (by omega) hv]  constructor  · intro h    exact ⟨fun h14 => h (Or.inr ⟨hu1, hu3, Or.inl h14⟩),           fun h21 => h (Or.inr ⟨hu1, hu3, Or.inr h21⟩)⟩  · rintro ⟨h14, h21⟩ (⟨h0, -⟩ | ⟨-, -, h14' | h21'⟩)    · omega    · exact h14 h14'    · exact h21 h21'private lemma in1277_seven_control_large_balanced_cross_match_card_le_four    (X : Finset (Fin 28)) (s : Finset ↥X) (h : ∀ x ∈ s, x.val.val < 4) : s.card ≤ 4 := by  have himg : s.image (fun x : ↥X => x.val) ⊆ ({0,1,2,3} : Finset (Fin 28)) := by    intro v hv    rw [Finset.mem_image] at hv    obtain ⟨x, hxs, rfl⟩ := hv    have hx := h x hxs    have h4 : x.val.val = 0 ∨ x.val.val = 1 ∨ x.val.val = 2 ∨ x.val.val = 3 := by omega    rcases h4 with h0 | h1 | h2 | h3    · have : x.val = 0 := Fin.ext (by simpa using h0); simp [this]    · have : x.val = 1 := Fin.ext (by simpa using h1); simp [this]    · have : x.val = 2 := Fin.ext (by simpa using h2); simp [this]    · have : x.val = 3 := Fin.ext (by simpa using h3); simp [this]  calc s.card = (s.image (fun x : ↥X => x.val)).card :=        (Finset.card_image_of_injective s Subtype.val_injective).symm    _ ≤ ({0,1,2,3} : Finset (Fin 28)).card := Finset.card_le_card himg    _ = 4 := by decideprivate lemma in1277_seven_control_large_balanced_cross_match_card_le_three    (X : Finset (Fin 28)) (s : Finset ↥X)    (h : ∀ x ∈ s, x.val.val ≤ 3 ∧ x.val.val ≠ 0) : s.card ≤ 3 := by  have himg : s.image (fun x : ↥X => x.val) ⊆ ({1,2,3} : Finset (Fin 28)) := by    intro v hv    rw [Finset.mem_image] at hv    obtain ⟨x, hxs, rfl⟩ := hv    obtain ⟨hle, hne⟩ := h x hxs    have h4 : x.val.val = 1 ∨ x.val.val = 2 ∨ x.val.val = 3 := by omega    rcases h4 with h0 | h1 | h2    · have : x.val = 1 := Fin.ext (by simpa using h0); simp [this]    · have : x.val = 2 := Fin.ext (by simpa using h1); simp [this]    · have : x.val = 3 := Fin.ext (by simpa using h2); simp [this]  calc s.card = (s.image (fun x : ↥X => x.val)).card :=        (Finset.card_image_of_injective s Subtype.val_injective).symm    _ ≤ ({1,2,3} : Finset (Fin 28)).card := Finset.card_le_card himg    _ = 3 := by decideprivate lemma in1277_seven_control_large_balanced_cross_match_hall    (X Y : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13})    (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27})    (hsize : 5 ≤ X.card) (hcard : X.card = Y.card) :    ∀ s : Finset ↥X,      s.card ≤ (s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y))).card := by  classical  intro s  have hx_lt : ∀ x : Fin 28, x ∈ X → x.val < 14 := by    intro x hx    have h := hX hx    simp only [Finset.mem_insert, Finset.mem_singleton] at h    omega  have hy_ge : ∀ y : Fin 28, y ∈ Y → 14 ≤ y.val := by    intro y hy    have h := hY hy    simp only [Finset.mem_insert, Finset.mem_singleton] at h    omega  by_cases hA : ∃ x ∈ s, 4 ≤ x.val.val  · obtain ⟨x, hxs, hx4⟩ := hA    have hsub : Y ⊆ s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) := by      intro y hy      rw [Finset.mem_biUnion]      refine ⟨x, hxs, ?_⟩      rw [Finset.mem_filter]      exact ⟨hy, in1277_seven_control_large_balanced_cross_match_adj_ge_four        x.val y hx4 (hx_lt x.val x.property) (hy_ge y hy)⟩    calc s.card ≤ X.card := by simpa using Finset.card_le_univ s      _ = Y.card := hcard      _ ≤ _ := Finset.card_le_card hsub  · by_cases h0 : ∃ x ∈ s, x.val.val = 0    · obtain ⟨x, hxs, hx0⟩ := h0      have hx : x.val = 0 := Fin.ext (by simpa using hx0)      have hsub : Y.erase (21 : Fin 28) ⊆          s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) := by        intro y hy        rw [Finset.mem_erase] at hy        obtain ⟨hyne, hyY⟩ := hy        rw [Finset.mem_biUnion]        refine ⟨x, hxs, ?_⟩        rw [Finset.mem_filter]        refine ⟨hyY, ?_⟩        rw [hx, in1277_seven_control_large_balanced_cross_match_adj_zero y (hy_ge y hyY)]        intro hval        exact hyne (Fin.ext (by simpa using hval))      have hscard4 : s.card ≤ 4 := by        apply in1277_seven_control_large_balanced_cross_match_card_le_four        intro x hx        by_contra hc        exact hA ⟨x, hx, by omega⟩      calc s.card ≤ X.card - 1 := by omega        _ = Y.card - 1 := by rw [hcard]        _ ≤ (Y.erase (21 : Fin 28)).card := Finset.pred_card_le_card_erase        _ ≤ _ := Finset.card_le_card hsub    · by_cases hs : s = ∅      · simp [hs]      · obtain ⟨x, hxs⟩ := Finset.nonempty_iff_ne_empty.mpr hs        have hxne : x.val.val ≠ 0 := fun he => h0 ⟨x, hxs, he⟩        have hxlt : x.val.val ≤ 3 := by          by_contra hc          exact hA ⟨x, hxs, by omega⟩        have hsub : (Y.erase (14 : Fin 28)).erase (21 : Fin 28) ⊆            s.biUnion (fun x => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) := by          intro y hy          rw [Finset.mem_erase, Finset.mem_erase] at hy          obtain ⟨hy21, hy14, hyY⟩ := hy          rw [Finset.mem_biUnion]          refine ⟨x, hxs, ?_⟩          rw [Finset.mem_filter]          refine ⟨hyY, ?_⟩          rw [in1277_seven_control_large_balanced_cross_match_adj_low x.val y (by omega) hxlt            (hy_ge y hyY)]          exact ⟨fun h14 => hy14 (Fin.ext (by simpa using h14)),                 fun h21 => hy21 (Fin.ext (by simpa using h21))⟩        have hscard3 : s.card ≤ 3 := by          apply in1277_seven_control_large_balanced_cross_match_card_le_three          intro x hx          exact ⟨by by_contra hc; exact hA ⟨x, hx, by omega⟩,                 fun he => h0 ⟨x, hx, he⟩⟩        calc s.card ≤ 3 := hscard3          _ ≤ X.card - 2 := by omega          _ = Y.card - 2 := by rw [hcard]          _ ≤ ((Y.erase (14 : Fin 28)).erase (21 : Fin 28)).card := by                have h1 := Finset.pred_card_le_card_erase (s := Y) (a := (14 : Fin 28))                have h2 := Finset.pred_card_le_card_erase (s := Y.erase (14 : Fin 28))                  (a := (21 : Fin 28))                omega          _ ≤ _ := Finset.card_le_card hsubprivate lemma in1277_seven_control_large_balanced_cross_match_xlt    (X : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13}) :    ∀ x : Fin 28, x ∈ X → x.val < 14 := by  intro x hx  have h := hX hx  simp only [Finset.mem_insert, Finset.mem_singleton] at h  omegaprivate lemma in1277_seven_control_large_balanced_cross_match_yge    (Y : Finset (Fin 28)) (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27}) :    ∀ y : Fin 28, y ∈ Y → 14 ≤ y.val := by  intro y hy  have h := hY hy  simp only [Finset.mem_insert, Finset.mem_singleton] at h  omegatheorem in1277_seven_control_large_balanced_cross_match (X Y : Finset (Fin 28)) (hX : X ⊆ {0,1,2,3,4,5,6,7,8,9,10,11,12,13}) (hY : Y ⊆ {14,15,16,17,18,19,20,21,22,23,24,25,26,27}) (hsize : 5 ≤ X.card) (hcard : X.card = Y.card) : ∃ M : (in1261_seven_graph.induce {v | v ∈ X ∪ Y}).Subgraph, M.IsPerfectMatching := by  classical  obtain ⟨f, hf_inj, hf_mem⟩ :=    Finset.all_card_le_biUnion_card_iff_exists_injective      (fun x : ↥X => Y.filter (fun y => in1261_seven_graph.Adj x.val y)) |>.mp      (in1277_seven_control_large_balanced_cross_match_hall X Y hX hY hsize hcard)  have hfY : ∀ x : ↥X, f x ∈ Y := fun x => (Finset.mem_filter.mp (hf_mem x)).1  let fy : ↥X → ↥Y := fun x => ⟨f x, hfY x⟩  have hfy_inj : Function.Injective fy := by    intro a b hab    apply hf_inj    exact Subtype.ext_iff.mp hab  have hfy_bij : Function.Bijective fy := by    rw [Fintype.bijective_iff_injective_and_card]    exact ⟨hfy_inj, by simp [Fintype.card_coe, hcard]⟩  let eXY : ↥X ≃ ↥Y := Equiv.ofBijective fy hfy_bij  have heapply : ∀ x : ↥X, (eXY x).val = f x := fun x => rfl  have hadj : ∀ a : ↥(↑X : Set (Fin 28)), in1261_seven_graph.Adj a (eXY a) := by    intro a    have h := (Finset.mem_filter.mp (hf_mem ⟨a.val, a.property⟩)).2    simpa [heapply] using h  have hdisj : Disjoint (↑X : Set (Fin 28)) ↑Y := by    rw [Set.disjoint_left]    intro v hvx hvy    have h1 := in1277_seven_control_large_balanced_cross_match_xlt X hX v hvx    have h2 := in1277_seven_control_large_balanced_cross_match_yge Y hY v hvy    omega  obtain ⟨M, hMverts, hMmatch⟩ :=    SimpleGraph.Subgraph.IsMatching.exists_of_disjoint_sets_of_equiv      (G := in1261_seven_graph) hdisj eXY hadj  have hunion : (↑X : Set (Fin 28)) ∪ ↑Y = {v : Fin 28 | v ∈ X ∪ Y} := by    ext v    simp [Finset.mem_union]  refine ⟨{    verts := Set.univ    Adj := fun a b => M.Adj a.val b.val    adj_sub := ?_    edge_vert := ?_    symm := ⟨fun a b h => M.adj_symm h⟩ }, ?_, ?_⟩  · intro a b h    exact SimpleGraph.induce_adj.mpr (M.adj_sub h)  · intro a b h    exact Set.mem_univ a  · intro a ha    have haM : a.val ∈ M.verts := by      rw [hMverts, hunion]      exact a.property    obtain ⟨w, hw1, hw2⟩ := hMmatch haM    have hwmem : w ∈ X ∪ Y := by      have hw' : w ∈ (↑X : Set (Fin 28)) ∪ ↑Y := by        have h := M.edge_vert hw1.symm        rwa [hMverts] at h      rw [hunion] at hw'      simpa using hw'    refine ⟨⟨w, hwmem⟩, hw1, ?_⟩    intro y hy    exact Subtype.ext (hw2 y.val hy)  · intro v    exact Set.mem_univ v
See it in the graphDiscuss this resultChallenge it