AFTD Auto-Formalizing Theoretical Domains

four_values_covering_fin_four_are_distinct

theoremverified

Four values that cover a four-element palette are pairwise distinct.

Statement

theorem four_values_covering_fin_four_are_distinct
    (a b c d : Fin 4) (h : ∀ k : Fin 4, k = a ∨ k = b ∨ k = c ∨ k = d) :
    a ≠ b ∧ a ≠ c ∧ a ≠ d ∧ b ≠ c ∧ b ≠ d ∧ c ≠ d
Source
Seven-cycle palette counting kernel for the OP-874 campaign.
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 2

The proof, explained

We define a function $f : \mathrm{Fin}\,4 \to \mathrm{Fin}\,4$ sending $0, 1, 2, 3$ to $a, b, c, d$ respectively. Because $a, b, c, d$ cover all of $\mathrm{Fin}\,4$, the function $f$ is surjective. For a function from a finite set to itself, surjectivity implies injectivity, so $f$ is injective. If any two of $a, b, c, d$ were equal, injectivity would force the equality of two distinct indices in $\{0, 1, 2, 3\}$, a contradiction in each case.

  1. The function $f : \mathrm{Fin}\,4 \to \mathrm{Fin}\,4$ sending $0 \mapsto a$, $1 \mapsto b$, $2 \mapsto c$, and $3 \mapsto d$ is surjective.

    We define $f$ as the tuple $[a, b, c, d]$. Given any element $k \in \mathrm{Fin}\,4$, the covering hypothesis guarantees that $k = a$, $k = b$, $k = c$, or $k = d$. In each case, $k$ is the image under $f$ of $0, 1, 2$, or $3$ respectively, showing that $f$ is surjective.

    lines 4–11

      let f : Fin 4 → Fin 4 := ![a,b,c,d]
      have hs : Function.Surjective f := by
        intro k
        rcases h k with ha | hb | hc | hd
        · exact ⟨0, by simpa [f] using ha.symm⟩
        · exact ⟨1, by simpa [f] using hb.symm⟩
        · exact ⟨2, by simpa [f] using hc.symm⟩
        · exact ⟨3, by simpa [f] using hd.symm⟩
  2. $f$ is injective.

    Because $\mathrm{Fin}\,4$ is a finite type, any surjective function from $\mathrm{Fin}\,4$ to itself is injective by `Finite.injective_iff_surjective.mpr`.

    line 12

    uses Finite.injective_iff_surjective.mpr

      have hi : Function.Injective f := Finite.injective_iff_surjective.mpr hs
  3. It suffices to prove each of the six pairwise inequalities: $a \ne b$, $a \ne c$, $a \ne d$, $b \ne c$, $b \ne d$, and $c \ne d$.

    We split the conjunction of the six distinctness conditions into six separate goals.

    line 13

      refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩
  4. $a \ne b$

    Suppose for contradiction that $a = b$. By definition of $f$, this means $f(0) = f(1)$. Since $f$ is injective, this implies $0 = 1$, which contradicts the fact that $0 \ne 1$ in $\mathrm{Fin}\,4$.

    lines 14–15

      · intro heq
        exact (by decide : (0 : Fin 4) ≠ 1) (hi (by simpa [f] using heq))
  5. $a \ne c$

    Suppose for contradiction that $a = c$. Then $f(0) = f(2)$, so injectivity of $f$ implies $0 = 2$, contradicting $0 \ne 2$ in $\mathrm{Fin}\,4$.

    lines 16–17

      · intro heq
        exact (by decide : (0 : Fin 4) ≠ 2) (hi (by simpa [f] using heq))
  6. $a \ne d$

    Suppose for contradiction that $a = d$. Then $f(0) = f(3)$, so injectivity of $f$ implies $0 = 3$, contradicting $0 \ne 3$ in $\mathrm{Fin}\,4$.

    lines 18–19

      · intro heq
        exact (by decide : (0 : Fin 4) ≠ 3) (hi (by simpa [f] using heq))
  7. $b \ne c$

    Suppose for contradiction that $b = c$. Then $f(1) = f(2)$, so injectivity of $f$ implies $1 = 2$, contradicting $1 \ne 2$ in $\mathrm{Fin}\,4$.

    lines 20–21

      · intro heq
        exact (by decide : (1 : Fin 4) ≠ 2) (hi (by simpa [f] using heq))
  8. $b \ne d$

    Suppose for contradiction that $b = d$. Then $f(1) = f(3)$, so injectivity of $f$ implies $1 = 3$, contradicting $1 \ne 3$ in $\mathrm{Fin}\,4$.

    lines 22–23

      · intro heq
        exact (by decide : (1 : Fin 4) ≠ 3) (hi (by simpa [f] using heq))
  9. $c \ne d$

    Suppose for contradiction that $c = d$. Then $f(2) = f(3)$, so injectivity of $f$ implies $2 = 3$, contradicting $2 \ne 3$ in $\mathrm{Fin}\,4$.

    lines 24–25

      · intro heq
        exact (by decide : (2 : Fin 4) ≠ 3) (hi (by simpa [f] using heq))
Finite.injective_iff_surjective.mpr
A surjective function from a finite type to itself is injective.

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 four_values_covering_fin_four_are_distinct    (a b c d : Fin 4) (h : ∀ k : Fin 4, k = a ∨ k = b ∨ k = c ∨ k = d) :    a ≠ b ∧ a ≠ c ∧ a ≠ d ∧ b ≠ c ∧ b ≠ d ∧ c ≠ d := by  let f : Fin 4 → Fin 4 := ![a,b,c,d]  have hs : Function.Surjective f := by    intro k    rcases h k with ha | hb | hc | hd    · exact ⟨0, by simpa [f] using ha.symm⟩    · exact ⟨1, by simpa [f] using hb.symm⟩    · exact ⟨2, by simpa [f] using hc.symm⟩    · exact ⟨3, by simpa [f] using hd.symm⟩  have hi : Function.Injective f := Finite.injective_iff_surjective.mpr hs  refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩  · intro heq    exact (by decide : (0 : Fin 4) ≠ 1) (hi (by simpa [f] using heq))  · intro heq    exact (by decide : (0 : Fin 4) ≠ 2) (hi (by simpa [f] using heq))  · intro heq    exact (by decide : (0 : Fin 4) ≠ 3) (hi (by simpa [f] using heq))  · intro heq    exact (by decide : (1 : Fin 4) ≠ 2) (hi (by simpa [f] using heq))  · intro heq    exact (by decide : (1 : Fin 4) ≠ 3) (hi (by simpa [f] using heq))  · intro heq    exact (by decide : (2 : Fin 4) ≠ 3) (hi (by simpa [f] using heq))
See it in the graphDiscuss this resultChallenge it