two_color_palette_step_iff
For two distinct colors x and y in a two-element palette, y differs from z exactly when membership of z in the palette forces z=x.
Statement
theorem two_color_palette_step_iff {Ω : Type*} [DecidableEq Ω] (P : Finset Ω) (x y z : Ω) (hcard : P.card = 2) (hx : x ∈ P) (hy : y ∈ P) (hxy : x ≠ y) : y ≠ z ↔ (z ∈ P → z = x)
- Source
- Helper for the OP-874 truncation coloring campaign, related to arXiv:2610.41950; finite witnesses are checked in experiments 33310, 33357, 33358 and 33378.
- Verified
- 19 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 2
- path_two_color_palettes_of_no_common_colorA path of two-color palettes with empty total intersection admits distinct local port colors, any prescribed incoming endpoint colors, and…
- op874_path_two_palettes_avoid_endpointFor a path of two-color palettes, if the color u is absent from some palette, compatible distinct port colors can start with any specified…
The proof, explained
Because the palette P contains the distinct elements x and y and has cardinality 2, it is precisely the pair {x, y}. For the forward direction, if y ≠ z, any element z ∈ P = {x, y} cannot equal y, so it must equal x. Conversely, if membership in P forces equality with x, then y = z would imply y = x because y ∈ P, contradicting x ≠ y.
P = {x, y}
Since x ∈ P and y ∈ P, the two-element set {x, y} is a subset of P (using Finset.insert_subset). Furthermore, since x ≠ y, the pair {x, y} has cardinality 2, which matches |P| = 2. By Finset.eq_of_subset_of_card_le, a subset of a finite set with at least the same cardinality must equal the entire set, so {x, y} = P.
uses
Finset.insert_subset,Finset.eq_of_subset_of_card_lehave hsub : ({x, y} : Finset Ω) ⊆ P := by simp [Finset.insert_subset, hx, hy] have hsize : P.card ≤ ({x, y} : Finset Ω).card := by simp [hcard, hxy] have hpair : ({x, y} : Finset Ω) = P := Finset.eq_of_subset_of_card_le hsub hsize
If y ≠ z, then z ∈ P implies z = x (the forward direction)
Splitting the equivalence into two implications, we first consider the forward direction: assume y ≠ z and z ∈ P. Since P = {x, y}, the condition z ∈ P means z = x or z = y. By Ne.symm, the assumption y ≠ z implies z ≠ y, which rules out the second alternative and leaves z = x.
uses
Ne.symmconstructor · intro h hz have hz' : z = x ∨ z = y := by simpa [← hpair] using hz exact hz'.resolve_right (Ne.symm h)
If (z ∈ P → z = x), then y ≠ z (the reverse direction)
For the reverse direction, we argue by contradiction: assume that z ∈ P implies z = x, and suppose y = z. Substituting y for z shows that y ∈ P implies y = x. Since y ∈ P holds, this yields y = x, which contradicts the hypothesis that x ≠ y.
· intro h heq subst z exact hxy (h hy).symm
Finset.insert_subset- A set with an element inserted, {a} ∪ s, is a subset of t if a ∈ t and s ⊆ t.
Finset.eq_of_subset_of_card_le- If a finite set s is a subset of t and |t| ≤ |s|, then s = t.
Ne.symm- Inequality is symmetric: if a ≠ b, then b ≠ a.
- To establish that P = {x, y}, the formal proof explicitly proves subset inclusion and cardinality inequality before concluding set equality via Finset.eq_of_subset_of_card_le.
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 two_color_palette_step_iff {Ω : Type*} [DecidableEq Ω] (P : Finset Ω) (x y z : Ω) (hcard : P.card = 2) (hx : x ∈ P) (hy : y ∈ P) (hxy : x ≠ y) : y ≠ z ↔ (z ∈ P → z = x) := by have hsub : ({x, y} : Finset Ω) ⊆ P := by simp [Finset.insert_subset, hx, hy] have hsize : P.card ≤ ({x, y} : Finset Ω).card := by simp [hcard, hxy] have hpair : ({x, y} : Finset Ω) = P := Finset.eq_of_subset_of_card_le hsub hsize constructor · intro h hz have hz' : z = x ∨ z = y := by simpa [← hpair] using hz exact hz'.resolve_right (Ne.symm h) · intro h heq subst z exact hxy (h hy).symm