trifferent_code_alteration_lemma
Let $n$ be an implicit natural number, $\mu$ a probability measure on $\mathrm{Fin}\,n \to \mathrm{Fin}\,3$, and $M$ a natural number with $1 \le M$ and $3 \le (M : \mathbb{R}) - \binom{M}{3} \cdot \mathrm{trifferent\_error}\,\mu$. Then there exists a finite code $C : \mathrm{Finset}\,(\mathrm{Fin}\,n \to \mathrm{Fin}\,3)$ such that $\mathrm{IsTrifferentCode}\,C$ and $(M : \mathbb{R}) - \binom{M}{3} \cdot \mathrm{trifferent\_error}\,\mu \le C.\mathrm{card}$.
Statement
theorem trifferent_code_alteration_lemma {n : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] (M : ℕ) (hM : 1 ≤ M) (h_bound : 3 ≤ (M : ℝ) - (M.choose 3 : ℝ) * trifferent_error μ) : ∃ C : Finset (Fin n → Fin 3), IsTrifferentCode C ∧ (M : ℝ) - (M.choose 3 : ℝ) * trifferent_error μ ≤ C.card- Formalizes
- arXiv:2611.33212 Lemma 2.2
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- 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…
- IsTrifferentCodeFor an implicit natural number $n$, a finite set of ternary words $C : \mathrm{Finset}\,(\mathrm{Fin}\,n \to \mathrm{Fin}\,3)$ satisfies…
- trifferent_errorFor an implicit natural number $n$ and a measure $\mu$ on $\mathrm{Fin}\,n \to \mathrm{Fin}\,3$,
trifferent_error$\mu$ is the real… - trifferent_is_bad_of_eqFor any ternary words $x, y \in (\mathrm{Fin}\,3)^n$, the triple $(x, x, y)$ has no rainbow coordinate, and is therefore bad.
Read back from the Lean
For any natural number $n$, any probability measure $\mu$ on the space of functions $\mathrm{Fin}\ n \to \mathrm{Fin}\ 3$, and any natural number $M$ satisfying $1 \le M$, if $3 \le M - \binom{M}{3} \cdot \mathrm{trifferent\_error}(\mu)$ (evaluated in $\mathbb{R}$), then there exists a finite set $C \subseteq (\mathrm{Fin}\ n \to \mathrm{Fin}\ 3)$ such that $C$ is a trifferent code and the cardinality of $C$ satisfies $|C| \ge M - \binom{M}{3} \cdot \mathrm{trifferent\_error}(\mu)$.
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
The theorem proves the existence of a trifferent code of size at least M - choose(M,3) * trifferent_error(μ) using the probabilistic alteration method. First, by linearity of expectation, there exists a sequence of M words with at most choose(M,3) * trifferent_error(μ) bad triples. Then, by deleting one word from each bad triple, all bad triples are eliminated, leaving a valid trifferent code of the desired size.
Measure of a cylinder set specified at three distinct coordinates a, b, c is the product of their individual measures.
We rewrite the cylinder set as a product set over the three indices {a, b, c} and apply the product measure formula.
uses
MeasureTheory.Measure.pi_pi_finsethave hset : {t : Fin M → (Fin n → Fin 3) | t a = x ∧ t b = y ∧ t c = z} = Set.pi (({a, b, c} : Finset (Fin M)) : Set (Fin M)) (fun i => if i = a then {x} else if i = b then {y} else {z}) := by ext t; simp only [Set.mem_ofPred_eq, Set.mem_pi, Finset.mem_coe, Finset.mem_insert, Finset.mem_singleton] constructor · rintro ⟨h1, h2, h3⟩ i (rfl | h | h) · simp [h1] · subst h; simp [Ne.symm hab, h2] · subst h; simp [Ne.symm hac, Ne.symm hbc, h3] · intro h refine ⟨?_, ?_, ?_⟩ · have := h a (by simp); simpa using this · have := h b (by simp); simp only [Ne.symm hab, if_false, if_true] at this; simpa using this · have := h c (by simp); simp only [Ne.symm hac, Ne.symm hbc, if_false] at this simpa using this rw [hset, MeasureTheory.Measure.pi_pi_finset] simp [hab, hab.symm, hbc, hbc.symm, hac, hac.symm]
Being a bad triple depends only on the set of three elements.
The condition trifferent_is_bad depends only on coordinate-wise sets of size at most 2, which are invariant under permuting the three elements.
uses
trifferent_is_bad,forall_congr',congrArg,Finset.image,Finset.image_insert,Finset.image_singletonsimp only [trifferent_is_bad] exact forall_congr' (fun i => by have hi : ({x i, y i, z i} : Finset (Fin 3)) = {x' i, y' i, z' i} := by have := congrArg (Finset.image (fun f : Fin n → Fin 3 => f i)) h simpa [Finset.image_insert, Finset.image_singleton] using this rw [hi])
- Unresolved check: no step explains line(s) 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 61, 62 -- every tactic of the proof has to belong to some step
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.
lemma trifferent_code_alteration_lemma_rect {n M : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] (a b c : Fin M) (hab : a ≠ b) (hbc : b ≠ c) (hac : a ≠ c) (x y z : Fin n → Fin 3) : MeasureTheory.Measure.pi (fun _ : Fin M => μ) {t | t a = x ∧ t b = y ∧ t c = z} = μ {x} * (μ {y} * μ {z}) := by have hset : {t : Fin M → (Fin n → Fin 3) | t a = x ∧ t b = y ∧ t c = z} = Set.pi (({a, b, c} : Finset (Fin M)) : Set (Fin M)) (fun i => if i = a then {x} else if i = b then {y} else {z}) := by ext t; simp only [Set.mem_ofPred_eq, Set.mem_pi, Finset.mem_coe, Finset.mem_insert, Finset.mem_singleton] constructor · rintro ⟨h1, h2, h3⟩ i (rfl | h | h) · simp [h1] · subst h; simp [Ne.symm hab, h2] · subst h; simp [Ne.symm hac, Ne.symm hbc, h3] · intro h refine ⟨?_, ?_, ?_⟩ · have := h a (by simp); simpa using this · have := h b (by simp); simp only [Ne.symm hab, if_false, if_true] at this; simpa using this · have := h c (by simp); simp only [Ne.symm hac, Ne.symm hbc, if_false] at this simpa using this rw [hset, MeasureTheory.Measure.pi_pi_finset] simp [hab, hab.symm, hbc, hbc.symm, hac, hac.symm]lemma trifferent_code_alteration_lemma_bad_of_set_eq {n : ℕ} {x y z x' y' z' : Fin n → Fin 3} (h : ({x, y, z} : Finset (Fin n → Fin 3)) = {x', y', z'}) : trifferent_is_bad x y z ↔ trifferent_is_bad x' y' z' := by simp only [trifferent_is_bad] exact forall_congr' (fun i => by have hi : ({x i, y i, z i} : Finset (Fin 3)) = {x' i, y' i, z' i} := by have := congrArg (Finset.image (fun f : Fin n → Fin 3 => f i)) h simpa [Finset.image_insert, Finset.image_singleton] using this rw [hi])set_option maxHeartbeats 400000 inlemma trifferent_code_alteration_lemma_marginal {n M : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] (a b c : Fin M) (hab : a ≠ b) (hbc : b ≠ c) (hac : a ≠ c) : (MeasureTheory.Measure.pi (fun _ : Fin M => μ)).real {t | trifferent_is_bad (t a) (t b) (t c)} = trifferent_error μ := by classical set ν := MeasureTheory.Measure.pi (fun _ : Fin M => μ) let φ : (Fin M → (Fin n → Fin 3)) → (Fin n → Fin 3) × ((Fin n → Fin 3) × (Fin n → Fin 3)) := fun t => (t a, (t b, t c)) have hφmeas : Measurable φ := by fun_prop have hmap : ν.map φ = μ.prod (μ.prod μ) := by apply MeasureTheory.Measure.ext_of_singleton intro p obtain ⟨x, yz⟩ := p obtain ⟨y, z⟩ := yz rw [MeasureTheory.Measure.map_apply hφmeas (measurableSet_singleton _)] have hpre : φ ⁻¹' {(x, (y, z))} = {t : Fin M → (Fin n → Fin 3) | t a = x ∧ t b = y ∧ t c = z} := by ext t; simp [φ] rw [hpre, trifferent_code_alteration_lemma_rect μ a b c hab hbc hac] rw [show ({(x, (y, z))} : Set ((Fin n → Fin 3) × ((Fin n → Fin 3) × (Fin n → Fin 3)))) = {x} ×ˢ ({y} ×ˢ {z}) by ext q; simp] rw [MeasureTheory.Measure.prod_prod, MeasureTheory.Measure.prod_prod] have hBmeas : MeasurableSet {p : (Fin n → Fin 3) × ((Fin n → Fin 3) × (Fin n → Fin 3)) | trifferent_is_bad p.1 p.2.1 p.2.2} := Set.Finite.measurableSet (Set.toFinite _) have hmeasure : ν {t | trifferent_is_bad (t a) (t b) (t c)} = (μ.prod (μ.prod μ)) {p | trifferent_is_bad p.1 p.2.1 p.2.2} := by have hpre : {t | trifferent_is_bad (t a) (t b) (t c)} = φ ⁻¹' {p | trifferent_is_bad p.1 p.2.1 p.2.2} := by ext t; simp [φ] rw [hpre, ← MeasureTheory.Measure.map_apply hφmeas hBmeas, hmap] have := congrArg ENNReal.toReal hmeasure simpa [MeasureTheory.Measure.real, trifferent_error] using thisdef trifferent_code_alteration_lemma_badOn {n M : ℕ} (t : Fin M → Fin n → Fin 3) (s : Finset (Fin M)) : Prop := ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ b ≠ c ∧ a ≠ c ∧ trifferent_is_bad (t a) (t b) (t c)noncomputable instance trifferent_code_alteration_lemma_badOn_instDecidable {n M : ℕ} (t : Fin M → Fin n → Fin 3) (s : Finset (Fin M)) : Decidable (trifferent_code_alteration_lemma_badOn t s) := Classical.propDecidable _noncomputable instance trifferent_code_alteration_lemma_badOn_instDecidablePred {n M : ℕ} (t : Fin M → Fin n → Fin 3) : DecidablePred (fun s => trifferent_code_alteration_lemma_badOn t s) := fun s => Classical.propDecidable _set_option maxHeartbeats 400000 inlemma trifferent_code_alteration_lemma_per_subset {n M : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] (s : Finset (Fin M)) (hs : s.card = 3) : (MeasureTheory.Measure.pi (fun _ : Fin M => μ)).real {t | trifferent_code_alteration_lemma_badOn t s} = trifferent_error μ := by classical obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := Finset.card_eq_three.mp hs have hset : {t : Fin M → Fin n → Fin 3 | trifferent_code_alteration_lemma_badOn t {a,b,c}} = {t | trifferent_is_bad (t a) (t b) (t c)} := by ext t constructor · rintro ⟨a', ha', b', hb', c', hc', h1, h2, h3, hbad⟩ simp only [Finset.mem_insert, Finset.mem_singleton] at ha' hb' hc' have hsub : ({a', b', c'} : Finset (Fin M)) ⊆ {a, b, c} := by intro x hx simp only [Finset.mem_insert, Finset.mem_singleton] at hx ⊢ rcases hx with rfl | rfl | rfl <;> tauto have hcard3 : ({a', b', c'} : Finset (Fin M)).card = 3 := Finset.card_eq_three.mpr ⟨a', b', c', h1, h3, h2, rfl⟩ have hfeq : ({a', b', c'} : Finset (Fin M)) = {a, b, c} := Finset.eq_of_subset_of_card_le hsub (by rw [hs, hcard3]) have himg : ({t a', t b', t c'} : Finset (Fin n → Fin 3)) = {t a, t b, t c} := by have := congrArg (Finset.image t) hfeq simpa [Finset.image_insert, Finset.image_singleton] using this exact (trifferent_code_alteration_lemma_bad_of_set_eq himg).mp hbad · rintro hbad exact ⟨a, by simp, b, by simp, c, by simp, hab, hbc, hac, hbad⟩ rw [hset] exact trifferent_code_alteration_lemma_marginal μ a b c hab hbc hacnoncomputable def trifferent_code_alteration_lemma_ind {n M : ℕ} (s : Finset (Fin M)) : (Fin M → Fin n → Fin 3) → ℝ := {t | trifferent_code_alteration_lemma_badOn t s}.indicator (fun _ => (1:ℝ))noncomputable def trifferent_code_alteration_lemma_badCard {n M : ℕ} (t : Fin M → Fin n → Fin 3) : ℕ := (((Finset.univ : Finset (Fin M)).powersetCard 3).filter (fun s => trifferent_code_alteration_lemma_badOn t s)).cardlemma trifferent_code_alteration_lemma_ind_integral {n M : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] (s : Finset (Fin M)) (hs : s.card = 3) : ∫ t, trifferent_code_alteration_lemma_ind s t ∂(MeasureTheory.Measure.pi (fun _ : Fin M => μ)) = trifferent_error μ := by rw [show (∫ t, trifferent_code_alteration_lemma_ind s t ∂(MeasureTheory.Measure.pi (fun _ : Fin M => μ))) = (MeasureTheory.Measure.pi (fun _ : Fin M => μ)).real {t | trifferent_code_alteration_lemma_badOn t s} by rw [trifferent_code_alteration_lemma_ind, MeasureTheory.integral_indicator (Set.Finite.measurableSet (Set.toFinite _)), MeasureTheory.setIntegral_one_eq_measureReal]] rw [trifferent_code_alteration_lemma_per_subset μ s hs]lemma trifferent_code_alteration_lemma_card_cast {n M : ℕ} (t : Fin M → Fin n → Fin 3) : (trifferent_code_alteration_lemma_badCard t : ℝ) = ∑ s ∈ (Finset.univ : Finset (Fin M)).powersetCard 3, trifferent_code_alteration_lemma_ind s t := by simp only [trifferent_code_alteration_lemma_badCard, trifferent_code_alteration_lemma_ind, Set.indicator_apply] rw [Finset.card_filter] push_cast apply Finset.sum_congr rfl intro s _ by_cases h : trifferent_code_alteration_lemma_badOn t s <;> simp [h]set_option maxHeartbeats 800000 inlemma trifferent_code_alteration_lemma_exists_good {n M : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] : ∃ t : Fin M → Fin n → Fin 3, (trifferent_code_alteration_lemma_badCard t : ℝ) ≤ (M.choose 3 : ℝ) * trifferent_error μ := by classical set ν := MeasureTheory.Measure.pi (fun _ : Fin M => μ) have hInt : ∫ t : (Fin M → Fin n → Fin 3), (∑ s ∈ (Finset.univ : Finset (Fin M)).powersetCard 3, trifferent_code_alteration_lemma_ind s t) ∂ν = (M.choose 3 : ℝ) * trifferent_error μ := by rw [show (∫ t, (∑ s ∈ (Finset.univ : Finset (Fin M)).powersetCard 3, trifferent_code_alteration_lemma_ind s t) ∂ν) = ∑ s ∈ (Finset.univ : Finset (Fin M)).powersetCard 3, ∫ t, trifferent_code_alteration_lemma_ind s t ∂ν from MeasureTheory.integral_finset_sum _ (fun i _ => MeasureTheory.Integrable.of_finite)] rw [Finset.sum_congr rfl (fun s hs => trifferent_code_alteration_lemma_ind_integral μ s (Finset.mem_powersetCard.mp hs).2)] rw [Finset.sum_const, Finset.card_powersetCard, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hex : ∃ t, (∑ s ∈ (Finset.univ : Finset (Fin M)).powersetCard 3, trifferent_code_alteration_lemma_ind s t) ≤ ∫ t : (Fin M → Fin n → Fin 3), (∑ s ∈ (Finset.univ : Finset (Fin M)).powersetCard 3, trifferent_code_alteration_lemma_ind s t) ∂ν := MeasureTheory.exists_le_integral MeasureTheory.Integrable.of_finite obtain ⟨t, ht⟩ := hex refine ⟨t, ?_⟩ rw [trifferent_code_alteration_lemma_card_cast t] rw [hInt] at ht exact htset_option maxHeartbeats 800000 inlemma trifferent_code_alteration_lemma_alteration {n M : ℕ} (E : ℝ) (hE : 0 ≤ E) (hM : 1 ≤ M) (t : Fin M → Fin n → Fin 3) (ht : (trifferent_code_alteration_lemma_badCard t : ℝ) ≤ (M.choose 3 : ℝ) * E) (h_bound : 3 ≤ (M : ℝ) - (M.choose 3 : ℝ) * E) : ∃ C : Finset (Fin n → Fin 3), IsTrifferentCode C ∧ (M : ℝ) - (M.choose 3 : ℝ) * E ≤ C.card := by classical set P := (Finset.univ : Finset (Fin M)).powersetCard 3 with hP set B := P.filter (fun s => trifferent_code_alteration_lemma_badOn t s) with hB have hBcard : (B.card : ℝ) ≤ (M.choose 3 : ℝ) * E := by simpa only [hB, hP, trifferent_code_alteration_lemma_badCard] using ht set pick : Finset (Fin M) → Fin M := fun s => if h : s.Nonempty then s.min' h else ⟨0, hM⟩ with hpick set D : Finset (Fin M) := B.image pick with hD set R : Finset (Fin M) := (Finset.univ : Finset (Fin M)) \ D with hR have hpick_mem : ∀ s ∈ B, pick s ∈ s := by intro s hs have hsP : s ∈ P := (Finset.mem_filter.mp hs).1 have hcard : s.card = 3 := (Finset.mem_powersetCard.mp hsP).2 have hne : s.Nonempty := Finset.card_pos.mp (by omega) rw [hpick]; simp only [dif_pos hne] exact Finset.min'_mem s hne have hDle : D.card ≤ B.card := by rw [hD]; exact Finset.card_image_le have hDreal : (D.card : ℝ) ≤ (M.choose 3 : ℝ) * E := by have h1 : (D.card : ℝ) ≤ (B.card : ℝ) := by exact_mod_cast hDle linarith [hBcard] have hME : (M.choose 3 : ℝ) * E ≤ (M : ℝ) - 3 := by linarith [h_bound] have hMge3 : 3 ≤ M := by have h3 : (3:ℝ) ≤ (M:ℝ) := by have h0 : (0:ℝ) ≤ (M.choose 3 : ℝ) := by positivity nlinarith [h_bound, mul_nonneg h0 hE] exact_mod_cast h3 have hD3 : D.card ≤ M - 3 := by have hreal : (D.card : ℝ) ≤ ((M - 3 : ℕ) : ℝ) := by rw [Nat.cast_sub hMge3] exact le_trans hDreal hME exact_mod_cast hreal have hDleM : D.card ≤ M := by omega have hRcard : R.card = M - D.card := by rw [hR, Finset.card_sdiff, Finset.inter_univ, Finset.card_univ, Fintype.card_fin] have hRcard3 : 3 ≤ R.card := by rw [hRcard]; omega have hno_bad : ∀ s, s ⊆ R → s.card = 3 → ¬ trifferent_code_alteration_lemma_badOn t s := by intro s hs hcard3 hbad have hsP : s ∈ P := Finset.mem_powersetCard.mpr ⟨Finset.subset_univ s, hcard3⟩ have hsB : s ∈ B := Finset.mem_filter.mpr ⟨hsP, hbad⟩ have hp : pick s ∈ s := hpick_mem s hsB have hpD : pick s ∈ D := Finset.mem_image.mpr ⟨s, hsB, rfl⟩ have hpR : pick s ∈ R := hs hp rw [hR, Finset.mem_sdiff] at hpR exact hpR.2 hpD have hinj : ∀ i ∈ R, ∀ j ∈ R, t i = t j → i = j := by intro i hiR j hjR heq by_contra hne have hcard_erase : 1 < (R.erase i).card := by rw [Finset.card_erase_of_mem hiR]; omega obtain ⟨k, hk, hkj⟩ := Finset.exists_mem_ne hcard_erase j rw [Finset.mem_erase] at hk obtain ⟨hki, hkR⟩ := hk have hsub : ({i,j,k} : Finset (Fin M)) ⊆ R := by intro x hx; simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl exacts [hiR, hjR, hkR] have hcard3 : ({i,j,k} : Finset (Fin M)).card = 3 := Finset.card_eq_three.mpr ⟨i, j, k, hne, hki.symm, hkj.symm, rfl⟩ have hbadOn : trifferent_code_alteration_lemma_badOn t {i,j,k} := by refine ⟨i, by simp, j, by simp, k, by simp, hne, hkj.symm, hki.symm, ?_⟩ simpa [heq] using trifferent_is_bad_of_eq (t i) (t k) exact (hno_bad {i,j,k} hsub hcard3) hbadOn refine ⟨R.image t, ?_, ?_⟩ · intro x hx y hy z hz hxy hyz hxz hbad obtain ⟨i, hiR, rfl⟩ := Finset.mem_image.mp hx obtain ⟨j, hjR, rfl⟩ := Finset.mem_image.mp hy obtain ⟨k, hkR, rfl⟩ := Finset.mem_image.mp hz have hij : i ≠ j := fun h => hxy (by rw [h]) have hjk : j ≠ k := fun h => hyz (by rw [h]) have hik : i ≠ k := fun h => hxz (by rw [h]) have hsub : ({i,j,k} : Finset (Fin M)) ⊆ R := by intro x hx; simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl exacts [hiR, hjR, hkR] have hcard3 : ({i,j,k} : Finset (Fin M)).card = 3 := Finset.card_eq_three.mpr ⟨i, j, k, hij, hik, hjk, rfl⟩ exact (hno_bad {i,j,k} hsub hcard3) ⟨i, by simp, j, by simp, k, by simp, hij, hjk, hik, hbad⟩ · have hcardC : (R.image t).card = R.card := Finset.card_image_of_injOn (fun i hi j hj heq => hinj i hi j hj heq) have hRreal : (R.card : ℝ) = (M : ℝ) - (D.card : ℝ) := by rw [hRcard, Nat.cast_sub hDleM] rw [hcardC, hRreal] linarith [hDreal]/-- Alteration lemma: existence of a trifferent code of size at least M - choose(M,3) * E_n(μ). -/theorem trifferent_code_alteration_lemma {n : ℕ} (μ : MeasureTheory.Measure (Fin n → Fin 3)) [MeasureTheory.IsProbabilityMeasure μ] (M : ℕ) (hM : 1 ≤ M) (h_bound : 3 ≤ (M : ℝ) - (M.choose 3 : ℝ) * trifferent_error μ) : ∃ C : Finset (Fin n → Fin 3), IsTrifferentCode C ∧ (M : ℝ) - (M.choose 3 : ℝ) * trifferent_error μ ≤ C.card := by have hE0 : 0 ≤ trifferent_error μ := by rw [trifferent_error] exact MeasureTheory.measureReal_nonneg obtain ⟨t, ht⟩ := trifferent_code_alteration_lemma_exists_good (M := M) μ exact trifferent_code_alteration_lemma_alteration (trifferent_error μ) hE0 hM t ht h_bound