AFTD Auto-Formalizing Theoretical Domains

two_color_palette_step_iff

theoremverified

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

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.

  1. 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.

    lines 5–9

    uses Finset.insert_subset, Finset.eq_of_subset_of_card_le

      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
  2. 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.

    lines 10–13

    uses Ne.symm

      constructor
      · intro h hz
        have hz' : z = x ∨ z = y := by simpa [← hpair] using hz
        exact hz'.resolve_right (Ne.symm h)
  3. 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.

    lines 14–16

      · 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.

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 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
See it in the graphDiscuss this resultChallenge it