odd_anticomplete_union_has_no_perfect_matching
If two disjoint finite vertex sets are anticomplete and the first has odd size, the graph induced by their union has no perfect matching.
Statement
theorem odd_anticomplete_union_has_no_perfect_matching : ∀ {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (A B : Finset V), Disjoint A B → Odd A.card → (∀ a ∈ A, ∀ b ∈ B, ¬ G.Adj a b) → ¬ ∃ P : (G.induce {v | v ∈ A ∨ v ∈ B}).Subgraph, P.IsPerfectMatching
- Source
- Factor-critical crossing-cut parity ingredient in the OP-1957 campaign.
- Verified
- 20 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
The proof, explained
We argue by contradiction: suppose the induced subgraph on $A \cup B$ has a perfect matching $P$. Restricting $P$ to the vertices in $A$ gives a subgraph $R$, which is itself a matching because there are no edges between $A$ and $B$, forcing every vertex in $A$ to be matched to another vertex in $A$. Since every finite matching has an even number of vertices, $|A|$ must be even, contradicting the hypothesis that $|A|$ is odd.
Assume for contradiction that the graph induced by $A \cup B$ has a perfect matching $P$.
We introduce the graph and hypotheses into scope, then assume for contradiction that there exists a subgraph $P$ of the induced subgraph on $A \cup B$ such that $P$ is a perfect matching.
intro V instF instD G A B hAB hodd hcross classical rintro ⟨P, hP⟩Define $R$ as the subgraph of $P$ induced by the vertices of $A$.
We identify the subset $C$ of vertices in $A \cup B$ that belong to $A$, and define $R$ to be the induced subgraph of $P$ on $C$.
let C : Set {v : V // v ∈ A ∨ v ∈ B} := {v | v.val ∈ A} let R := P.induce C
The induced subgraph $R$ is a matching.
To show that $R$ is a matching, we show that every vertex $a \in A$ has a unique neighbor in $R$. Since $P$ is a perfect matching, $a$ has a unique neighbor $b$ in $P$. The vertex $b$ belongs to $A \cup B$; if it were in $B$, the edge between $a$ and $b$ would contradict the hypothesis that $A$ and $B$ are anticomplete (`False.elim`). Hence $b \in A$, so $b$ is a neighbor of $a$ in $R$. Moreover, any neighbor of $a$ in $R$ is also a neighbor in $P$, so uniqueness of $b$ in $P$ ensures uniqueness in $R$.
uses
False.elimhave hRmatch : R.IsMatching := by intro a ha have haA : a.val ∈ A := ha obtain ⟨b, hab, huniq⟩ := hP.1 (hP.2 a) have hbA : b.val ∈ A := by rcases b.property with hbA | hbB · exact hbA · exact False.elim (hcross a.val haA b.val hbB (P.adj_sub hab)) refine ⟨b, ⟨haA, hbA, hab⟩, ?_⟩ intro c hc exact huniq c hc.2.2
There is a canonical bijection between the vertices of $R$ and the set $A$.
We define an equivalence $e$ mapping a vertex of $R$ to its underlying vertex in $A$ and vice versa, using `Or.inl` to lift an element of $A$ into $A \cup B$. We verify that the maps are mutually inverse by extensionality on subtypes (`Subtype.ext`).
uses
Or.inl,Subtype.extlet e : R.verts ≃ {v : V // v ∈ A} := { toFun := fun ⟨⟨v, hv⟩, ha⟩ => ⟨v, ha⟩ invFun := fun ⟨v, hv⟩ => ⟨⟨v, Or.inl hv⟩, hv⟩ left_inv := by intro v; apply Subtype.ext; apply Subtype.ext; rfl right_inv := by intro v; apply Subtype.ext; rfl }
The number of vertices in $R$ is equal to $|A|$. automation
By `Set.toFinset_card`, the size of the vertex finset of $R$ equals the cardinality of its underlying subtype. The equivalence $e$ between the vertices of $R$ and $A$ implies by `Fintype.card_congr` that their cardinalities are equal, which `simpa` simplifies to $|V(R)| = |A|$.
uses
Set.toFinset_card,Fintype.card_congrhave hcard : R.verts.toFinset.card = A.card := by rw [Set.toFinset_card] have he := Fintype.card_congr e simpa using he
$|A|$ is both even and odd, which is a contradiction.
Since $R$ is a matching, its vertex set has even cardinality. Because $|V(R)| = |A|$, $|A|$ is even. By `Nat.not_odd_iff_even.mpr`, an even number cannot be odd, contradicting the assumption that $|A|$ is odd.
uses
Nat.not_odd_iff_even.mprhave heven := hRmatch.even_card rw [hcard] at heven exact (Nat.not_odd_iff_even.mpr heven) hodd
False.elim- from a false hypothesis, any statement follows
Or.inl- if a proposition $p$ holds, then $p \lor q$ holds
Subtype.ext- two subtype elements are equal if their underlying values are equal
Set.toFinset_card- the cardinality of a set coerced to a finset equals the cardinality of the corresponding subtype
Fintype.card_congr- a bijection between two finite types implies they have the same cardinality
Nat.not_odd_iff_even.mpr- an even natural number is not odd
- The induced subgraph on the union of $A$ and $B$ is formalized using the subtype $\{v : V // v \in A \lor v \in B\}$. As a result, restricting the graph to $A$ requires defining an explicit equivalence $e$ between the subtype of vertices of $R$ and the subtype $\{v : V // v \in A\}$ (lines 21–25), which is a formal bookkeeping step with no paper counterpart.
- In step 5 (line 29), the `simpa` tactic automatically handles the conversion between the cardinality of the subtype `↥A` and `A.card`.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem odd_anticomplete_union_has_no_perfect_matching : ∀ {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (A B : Finset V), Disjoint A B → Odd A.card → (∀ a ∈ A, ∀ b ∈ B, ¬ G.Adj a b) → ¬ ∃ P : (G.induce {v | v ∈ A ∨ v ∈ B}).Subgraph, P.IsPerfectMatching := by intro V instF instD G A B hAB hodd hcross classical rintro ⟨P, hP⟩ let C : Set {v : V // v ∈ A ∨ v ∈ B} := {v | v.val ∈ A} let R := P.induce C have hRmatch : R.IsMatching := by intro a ha have haA : a.val ∈ A := ha obtain ⟨b, hab, huniq⟩ := hP.1 (hP.2 a) have hbA : b.val ∈ A := by rcases b.property with hbA | hbB · exact hbA · exact False.elim (hcross a.val haA b.val hbB (P.adj_sub hab)) refine ⟨b, ⟨haA, hbA, hab⟩, ?_⟩ intro c hc exact huniq c hc.2.2 let e : R.verts ≃ {v : V // v ∈ A} := { toFun := fun ⟨⟨v, hv⟩, ha⟩ => ⟨v, ha⟩ invFun := fun ⟨v, hv⟩ => ⟨⟨v, Or.inl hv⟩, hv⟩ left_inv := by intro v; apply Subtype.ext; apply Subtype.ext; rfl right_inv := by intro v; apply Subtype.ext; rfl } have hcard : R.verts.toFinset.card = A.card := by rw [Set.toFinset_card] have he := Fintype.card_congr e simpa using he have heven := hRmatch.even_card rw [hcard] at heven exact (Nat.not_odd_iff_even.mpr heven) hodd