fin_five_three_subset_avoids_two
A five-element set has a three-element subset different from either of two prescribed subsets.
Statement
theorem fin_five_three_subset_avoids_two (A B : Finset (Fin 5)) :
∃ S : Finset (Fin 5), S.card = 3 ∧ S ≠ A ∧ S ≠ B- Source
- Exceptional five-vertex contraction case in the OP-874 matching-cut reduction.
- Verified
- 19 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
The proof, explained
The theorem is proved by constructing three explicit 3-element subsets of Fin 5—namely X = {0, 1, 2}, Y = {0, 1, 3}, and Z = {0, 1, 4}—and verifying by computation that they are pairwise distinct. Since there are three distinct candidates and only two sets A and B to avoid, at least one candidate must differ from both. The formal proof establishes this through an exhaustive case analysis on whether X and Y equal A or B, showing in each case that transitivity of equality rules out collisions with the chosen candidate.
Define three candidate 3-element subsets X = {0, 1, 2}, Y = {0, 1, 3}, and Z = {0, 1, 4} of Fin 5.
We define three concrete subsets X, Y, and Z of {0, 1, 2, 3, 4} as candidates for the required witness S.
let X : Finset (Fin 5) := {0,1,2} let Y : Finset (Fin 5) := {0,1,3} let Z : Finset (Fin 5) := {0,1,4}
The subsets X, Y, and Z each have cardinality 3 and are pairwise distinct.
Each candidate set contains three distinct elements, and any two sets differ on their last element (2, 3, or 4). All six facts (X ≠ Y, X ≠ Z, Y ≠ Z, |X| = 3, |Y| = 3, and |Z| = 3) are proven by computation using `decide`.
have hXY : X ≠ Y := by decide have hXZ : X ≠ Z := by decide have hYZ : Y ≠ Z := by decide have hX : X.card = 3 := by decide have hY : Y.card = 3 := by decide have hZ : Z.card = 3 := by decide
If X = A and Y = B, then Z is a 3-element subset distinct from both A and B.
We branch on whether X = A, and within that branch on whether Y = B. In the subcase where X = A and Y = B, we propose Z. If Z = A, then X = A = Z, contradicting X ≠ Z. Similarly, if Z = B, then Y = B = Z, contradicting Y ≠ Z. Thus Z avoids both A and B.
by_cases hXA : X = A · by_cases hYB : Y = B · refine ⟨Z, hZ, ?_, ?_⟩ · intro hZA exact hXZ (hXA.trans hZA.symm) · intro hZB exact hYZ (hYB.trans hZB.symm)
If X = A and Y ≠ B, then Y is a 3-element subset distinct from both A and B.
Here Y ≠ B holds by assumption. If Y = A, then X = A = Y, which contradicts X ≠ Y. Hence Y ≠ A as well, so Y avoids both A and B.
· refine ⟨Y, hY, ?_, hYB⟩ intro hYA exact hXY (hXA.trans hYA.symm)
If X ≠ A, X = B, and Y = A, then Z is a 3-element subset distinct from both A and B.
In the branch where X ≠ A, we branch on whether X = B and then on whether Y = A. When both X = B and Y = A hold, we choose Z. If Z = A, then Y = A = Z, contradicting Y ≠ Z. If Z = B, then X = B = Z, contradicting X ≠ Z. Thus Z avoids both A and B.
· by_cases hXB : X = B · by_cases hYA : Y = A · refine ⟨Z, hZ, ?_, ?_⟩ · intro hZA exact hYZ (hYA.trans hZA.symm) · intro hZB exact hXZ (hXB.trans hZB.symm)
If X ≠ A, X = B, and Y ≠ A, then Y is a 3-element subset distinct from both A and B.
Here Y ≠ A is given. If Y = B, then X = B = Y, which contradicts X ≠ Y. Thus Y ≠ B as well, so Y avoids both A and B.
· refine ⟨Y, hY, hYA, ?_⟩ intro hYB exact hXY (hXB.trans hYB.symm)
If X ≠ A and X ≠ B, then X is a 3-element subset distinct from both A and B.
In the remaining subcase, X is already known to differ from both A and B, so X itself satisfies all the conditions.
· exact ⟨X, hX, hXA, hXB⟩
- On paper, the result is an immediate consequence of the pigeonhole principle: three pairwise distinct subsets cannot all belong to a two-element collection {A, B}. The formal proof replaces this with an exhaustive case analysis on which candidate equals A or B.
- The cardinality and inequality facts for the three candidate subsets (lines 6–11) are established by `decide` via finite evaluation of explicit finite sets.
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 fin_five_three_subset_avoids_two (A B : Finset (Fin 5)) : ∃ S : Finset (Fin 5), S.card = 3 ∧ S ≠ A ∧ S ≠ B := by let X : Finset (Fin 5) := {0,1,2} let Y : Finset (Fin 5) := {0,1,3} let Z : Finset (Fin 5) := {0,1,4} have hXY : X ≠ Y := by decide have hXZ : X ≠ Z := by decide have hYZ : Y ≠ Z := by decide have hX : X.card = 3 := by decide have hY : Y.card = 3 := by decide have hZ : Z.card = 3 := by decide by_cases hXA : X = A · by_cases hYB : Y = B · refine ⟨Z, hZ, ?_, ?_⟩ · intro hZA exact hXZ (hXA.trans hZA.symm) · intro hZB exact hYZ (hYB.trans hZB.symm) · refine ⟨Y, hY, ?_, hYB⟩ intro hYA exact hXY (hXA.trans hYA.symm) · by_cases hXB : X = B · by_cases hYA : Y = A · refine ⟨Z, hZ, ?_, ?_⟩ · intro hZA exact hYZ (hYA.trans hZA.symm) · intro hZB exact hXZ (hXB.trans hZB.symm) · refine ⟨Y, hY, hYA, ?_⟩ intro hYB exact hXY (hXB.trans hYB.symm) · exact ⟨X, hX, hXA, hXB⟩