trifferent_is_bad_of_eq
For any ternary words $x, y \in (\mathrm{Fin}\,3)^n$, the triple $(x, x, y)$ has no rainbow coordinate, and is therefore bad.
Statement
lemma trifferent_is_bad_of_eq {n : ℕ} (x y : Fin n → Fin 3) : trifferent_is_bad x x y- Source
- arXiv:2611.33212, Section 2.1
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- trifferent_is_badA triple of ternary words $x, y, z \in (\mathrm{Fin}\,3)^n$ of blocklength $n$ is bad if it has no rainbow coordinate, that is, for every…
- Used by 1
- trifferent_code_alteration_lemmaLet $n$ be an implicit natural number, $\mu$ a probability measure on $\mathrm{Fin}\,n \to \mathrm{Fin}\,3$, and $M$ a natural number with…
Read back from the Lean
For any natural number n, and any two functions x, y : Fin n → Fin 3, the triple (x, x, y) satisfies trifferent_is_bad. That is, for every index i : Fin n, the finset {x i, x i, y i} has cardinality at most 2.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
By definition, a triple of words is bad if at every coordinate the set of symbols appearing among them has cardinality at most 2. For any triple of the form $(x, x, y)$, the repetition of $x$ means that at each coordinate $i$, the set of symbols is just $\{x(i), y(i)\}$. Since a set of at most two elements cannot have cardinality greater than 2, the triple is bad.
It suffices to show that at an arbitrary coordinate $i$, the set of values $\{x(i), x(i), y(i)\}$ has size at most 2.
By definition, a triple of ternary words is bad if at every coordinate $i$, the set of values appearing in the triple has cardinality at most 2. We fix an arbitrary coordinate $i$.
intro i$\{x(i), x(i), y(i)\} = \{x(i), y(i)\}$
Because the first two words are identical, the value $x(i)$ is repeated, so simplification reduces the three-element set to the two-element set $\{x(i), y(i)\}$.
have h : ({x i, x i, y i} : Finset (Fin 3)) = {x i, y i} := by simp
$|\{x(i), x(i), y(i)\}| \le 2$, which completes the proof.
Rewriting with the identity from the previous step replaces the set with $\{x(i), y(i)\}$. Any set defined by two elements has cardinality at most 2, which finishes the goal via `Finset.card_le_two`.
uses
Finset.card_le_tworw [h] exact Finset.card_le_two
Finset.card_le_two- A finite set containing at most two specified elements has cardinality at most 2.
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.
/-- A triple of ternary words in which two words coincide is always bad. -/lemma trifferent_is_bad_of_eq {n : ℕ} (x y : Fin n → Fin 3) : trifferent_is_bad x x y := by intro i have h : ({x i, x i, y i} : Finset (Fin 3)) = {x i, y i} := by simp rw [h] exact Finset.card_le_two