linear_objective_lexicographic_perturbation_unique_maximizer
Lemma 5.1 of arXiv:2611.28757 (class-independent lexicographic perturbation). For every natural number L and every weight vector w : Fin L → ℝ there is a real δ > 0 (chosen before, hence independent of, the set K below) with the following properties, where the score of a word x : Fin L → Bool under weights v is ∑ i, v i * (if x i then 1 else 0) and the refined weights are w i - δ * (1/2)^(i+1) for the 0-based index i (the paper's w_i - δ 2^{-i}, i = 1..L). (a) Any two distinct words have different refined scores. (b) For every nonempty set K of words there is x in K such that: every y in K with y ≠ x has strictly smaller refined score than x (x is the unique maximizer of the refined objective over K); x maximizes the original w-score over K; and every y in K with y ≠ x that also maximizes the w-score over K is lexicographically larger than x, i.e. there is an index k with x j = y j for all j < k, x k = false and y k = true (so x is the lexicographically smallest w-maximizer, the paper's ERM_K(w)).
Statement
theorem linear_objective_lexicographic_perturbation_unique_maximizer (L : ℕ) (w : Fin L → ℝ) : ∃ δ : ℝ, 0 < δ ∧ (∀ x y : Fin L → Bool, x ≠ y → ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) ≠ ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0)) ∧ ∀ K : Set (Fin L → Bool), K.Nonempty → ∃ x ∈ K, (∀ y ∈ K, y ≠ x → ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) < ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0)) ∧ (∀ y ∈ K, ∑ i, w i * (if y i then (1:ℝ) else 0) ≤ ∑ i, w i * (if x i then (1:ℝ) else 0)) ∧ (∀ y ∈ K, (∀ z ∈ K, ∑ i, w i * (if z i then (1:ℝ) else 0) ≤ ∑ i, w i * (if y i then (1:ℝ) else 0)) → y ≠ x → ∃ k, (∀ j, j < k → x j = y j) ∧ x k = false ∧ y k = true)
- Formalizes
- arXiv:2611.28757, Lemma 5.1
- Verified
- 28 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
Read back from the Lean
For every natural number $L$ and every weight vector $w : \text{Fin } L \to \mathbb{R}$, there exists a real number $\delta > 0$ such that:
1. For all distinct functions $x, y : \text{Fin } L \to \text{Bool}$ ($x \neq y$), the perturbed linear objectives are distinct:
$$\sum_{i : \text{Fin } L} \left(w(i) - \delta \left(\frac{1}{2}\right)^{i.\text{val} + 1}\right) (\text{if } x(i) \text{ then } 1 \text{ else } 0) \neq \sum_{i : \text{Fin } L} \left(w(i) - \delta \left(\frac{1}{2}\right)^{i.\text{val} + 1}\right) (\text{if } y(i) \text{ then } 1 \text{ else } 0)$$
2. For every nonempty subset $K \subseteq (\text{Fin } L \to \text{Bool})$, there exists an element $x \in K$ such that:
a. $x$ strictly maximizes the perturbed linear objective on $K$: for all $y \in K$ with $y \neq x$,
$$\sum_{i : \text{Fin } L} \left(w(i) - \delta \left(\frac{1}{2}\right)^{i.\text{val} + 1}\right) (\text{if } y(i) \text{ then } 1 \text{ else } 0) < \sum_{i : \text{Fin } L} \left(w(i) - \delta \left(\frac{1}{2}\right)^{i.\text{val} + 1}\right) (\text{if } x(i) \text{ then } 1 \text{ else } 0)$$
b. $x$ maximizes the unperturbed linear objective on $K$: for all $y \in K$,
$$\sum_{i : \text{Fin } L} w(i) (\text{if } y(i) \text{ then } 1 \text{ else } 0) \leq \sum_{i : \text{Fin } L} w(i) (\text{if } x(i) \text{ then } 1 \text{ else } 0)$$
c. (Lexicographic tie-breaking preferring false over true at the earliest differing index): for all $y \in K$, if $y$ also maximizes the unperturbed linear objective on $K$ (i.e., $\forall z \in K, \sum_i w(i)(\text{if } z(i) \text{ then } 1 \text{ else } 0) \leq \sum_i w(i)(\text{if } y(i) \text{ then } 1 \text{ else } 0)$) and $y \neq x$, then there exists an index $k : \text{Fin } L$ such that $x(j) = y(j)$ for all $j < k$, with $x(k) = \text{false}$ and $y(k) = \text{true}$.
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
To break ties in a linear objective over binary words in favor of the lexicographically first maximizer, we perturb each weight w_i by subtracting δ * (1/2)^(i+1). We choose δ = γ / 2, where γ > 0 is the minimum positive gap between any two original scores, ensuring that original score differences strictly dominate the perturbation. When two words tie under the original objective, their perturbed score difference is determined by their perturbation sums, which separate lexicographical orderings by at least (1/2)^L. Consequently, the perturbed objective is injective, and on any non-empty set of words K it possesses a unique maximizer that maximizes the original score and is lexicographically smaller than every other original maximizer.
For any binary word x of length L, the weighted sum ∑_{i=0}^{L-1} (1/2)^(i+1) x_i lies in [0, 1 - (1/2)^L].
By induction on the length L. For L = 0, the empty sum is 0, which equals 1 - (1/2)^0. For L = n + 1, we isolate the final term from the prefix sum of length n using Fin.sum_univ_castSucc. By the induction hypothesis, the prefix sum lies in [0, 1 - (1/2)^n]. Since the last term is (1/2)^(n+1) * x_n, which is either 0 or (1/2)^(n+1), adding it maintains non-negativity and bounds the total sum from above by (1 - (1/2)^n) + (1/2)^(n+1) = 1 - (1/2)^(n+1).
uses
Fin.sum_univ_castSucc,Fin.val_castSucc,Fin.val_last,pow_succintro L induction L with | zero => intro x; simp | succ n ih => intro x rw [Fin.sum_univ_castSucc] obtain ⟨h0, h1⟩ := ih (fun i => x (Fin.castSucc i)) simp only [Fin.val_castSucc, Fin.val_last] have hp : (0:ℝ) < (1/2:ℝ)^n := by positivity have e : (1/2:ℝ)^(n+1) = (1/2:ℝ)^n / 2 := by rw [pow_succ]; ring constructor · split_ifs <;> linarith · split_ifs <;> linarith
If word x is lexicographically strictly smaller than y (differing first at index k with x k = false and y k = true), their perturbation sums differ by at least (1/2)^L.
By induction on L. The base case L = 0 is vacuous since Fin 0 is empty. For L = n + 1, we split both sums at the last index. If the first differing index k is the last index n, the prefix sums are identical and cancel out, leaving (1/2)^(n+1) * (1 - 0) = (1/2)^(n+1). If k < n, the induction hypothesis ensures that the difference on the prefix of length n is at least (1/2)^n; even in the worst case where the last terms subtract (1/2)^(n+1), the net difference remains at least (1/2)^n - (1/2)^(n+1) = (1/2)^(n+1).
uses
Fin.sum_univ_castSucc,Fin.val_castSucc,Fin.val_last,pow_succ,Fin.lastCases,Finset.sum_congr,Fin.castSucc_lt_last,Fin.castSucc_lt_castSucc_iff.mprintro L induction L with | zero => intro x y k; exact k.elim0 | succ n ih => intro x y k hlt hx hy rw [Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] simp only [Fin.val_castSucc, Fin.val_last] have e : (1/2:ℝ)^(n+1) = (1/2:ℝ)^n / 2 := by rw [pow_succ]; ring have hp : (0:ℝ) < (1/2:ℝ)^n := by positivity induction k using Fin.lastCases with | last => have hsum : ∑ i : Fin n, (1/2:ℝ)^(i.val+1) * (if y (Fin.castSucc i) then (1:ℝ) else 0) = ∑ i : Fin n, (1/2:ℝ)^(i.val+1) * (if x (Fin.castSucc i) then (1:ℝ) else 0) := by refine Finset.sum_congr rfl (fun i _ => ?_) rw [hlt (Fin.castSucc i) (Fin.castSucc_lt_last i)] rw [hsum, hx, hy] simp | cast k' => have := ih (fun i => x (Fin.castSucc i)) (fun i => y (Fin.castSucc i)) k' (fun j hj => hlt _ (Fin.castSucc_lt_castSucc_iff.mpr hj)) hx hy split_ifs <;> linarith
Any two distinct binary words x ≠ y are strictly comparable in the lexicographic order.
Because x ≠ y, the set of indices where they differ is non-empty. Let k be the minimum index in this set. By minimality of k, x j = y j for all j < k. Since x k ≠ y k, a case analysis on the boolean values shows that either x k = false and y k = true (so x is lexicographically smaller than y) or x k = true and y k = false (so y is lexicographically smaller than x).
uses
Function.ne_iff.mp,Finset.min'_mem,Finset.min'_le,not_lt.mpr,Or.inl,Or.inrhave hS : (Finset.univ.filter (fun i => x i ≠ y i)).Nonempty := by obtain ⟨i, hi⟩ := Function.ne_iff.mp h exact ⟨i, by simp [hi]⟩ have hk := Finset.min'_mem _ hS have hne : x ((Finset.univ.filter (fun i => x i ≠ y i)).min' hS) ≠ y ((Finset.univ.filter (fun i => x i ≠ y i)).min' hS) := (Finset.mem_filter.mp hk).2 have hlt : ∀ j, j < (Finset.univ.filter (fun i => x i ≠ y i)).min' hS → x j = y j := by intro j hj by_contra hc have : (Finset.univ.filter (fun i => x i ≠ y i)).min' hS ≤ j := Finset.min'_le _ j (by simp [hc]) exact absurd hj (not_lt.mpr this) generalize (Finset.univ.filter (fun i => x i ≠ y i)).min' hS = k at hne hlt cases hxk : x k <;> cases hyk : y k · exact absurd (hxk.trans hyk.symm) hne · exact Or.inl ⟨k, hlt, hxk, hyk⟩ · exact Or.inr ⟨k, fun j hj => (hlt j hj).symm, hyk, hxk⟩ · exact absurd (hxk.trans hyk.symm) hne
There is a positive lower bound γ > 0 separating any two distinct original scores of words under w.
We consider the finite set of positive score differences between pairs of words. If this set is non-empty, its minimum element γ exists, is strictly positive, and bounds every positive score difference from below. If the set is empty (meaning all words have identical scores), γ = 1 > 0 vacuously satisfies the condition.
uses
Finset.min'_mem,Finset.mem_filter.mp,Finset.min'_le,Finset.mem_filter.mpr,Finset.mem_image.mpr,Finset.mem_univ,one_posclassical obtain ⟨γ, hγ, hgap⟩ : ∃ γ : ℝ, 0 < γ ∧ ∀ x y : Fin L → Bool, ∑ i, w i * (if y i then (1:ℝ) else 0) < ∑ i, w i * (if x i then (1:ℝ) else 0) → γ ≤ ∑ i, w i * (if x i then (1:ℝ) else 0) - ∑ i, w i * (if y i then (1:ℝ) else 0) := by by_cases hD : ((Finset.univ.image (fun p : (Fin L → Bool) × (Fin L → Bool) => ∑ i, w i * (if p.1 i then (1:ℝ) else 0) - ∑ i, w i * (if p.2 i then (1:ℝ) else 0))).filter (fun d => 0 < d)).Nonempty · refine ⟨_, (Finset.mem_filter.mp (Finset.min'_mem _ hD)).2, fun x y hxy => Finset.min'_le _ _ ?_⟩ exact Finset.mem_filter.mpr ⟨Finset.mem_image.mpr ⟨(x, y), Finset.mem_univ _, rfl⟩, by linarith⟩ · refine ⟨1, one_pos, fun x y hxy => absurd ⟨_, Finset.mem_filter.mpr ⟨Finset.mem_image.mpr ⟨(x, y), Finset.mem_univ _, rfl⟩, by linarith⟩⟩ hD⟩
Choose the perturbation parameter δ = γ / 2 > 0.
Because γ > 0, setting δ = γ / 2 yields a strictly positive parameter strictly smaller than γ, ensuring that the perturbation never overcomes a non-zero gap between original scores.
refine ⟨γ / 2, by positivity, ?_⟩
The perturbed score decomposes into the original score minus δ times the perturbation sum, and (1/2)^L > 0.
Distributing multiplication and subtraction across the sum shows that the perturbed score of x equals ∑_i w_i x_i - δ ∑_i (1/2)^(i+1) x_i. Positivity of (1/2)^L follows from 0 < 1/2.
uses
Finset.mul_sum,Finset.sum_sub_distrib,Finset.sum_congrhave hpert : ∀ x : Fin L → Bool, ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) = ∑ i, w i * (if x i then (1:ℝ) else 0) - γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) := by intro x rw [Finset.mul_sum, ← Finset.sum_sub_distrib] exact Finset.sum_congr rfl (fun i _ => by ring) have hpL : (0:ℝ) < (1/2:ℝ)^L := by positivity
Words with strictly higher original score have strictly higher perturbed score (hA).
By pr1640_kappa_bounds, the perturbation sum lies in [0, 1]. Thus the perturbation term δ ∑_i (1/2)^(i+1) x_i alters scores by at most δ = γ / 2. Since any positive original score gap is at least γ, the perturbed score difference is at least γ - γ / 2 = γ / 2 > 0, preserving the strict ordering of the original scores.
uses
pr1640_kappa_bounds,mul_le_mul_of_nonneg_left,mul_nonneghave hA : ∀ x y : Fin L → Bool, ∑ i, w i * (if y i then (1:ℝ) else 0) < ∑ i, w i * (if x i then (1:ℝ) else 0) → ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) < ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) := by intro x y hxy rw [hpert, hpert] have h1 := hgap x y hxy obtain ⟨-, hx1⟩ := pr1640_kappa_bounds L x obtain ⟨hy0, -⟩ := pr1640_kappa_bounds L y have h2 : γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) ≤ γ / 2 * 1 := mul_le_mul_of_nonneg_left (by linarith) (by positivity) have h3 : 0 ≤ γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if y i then (1:ℝ) else 0) := mul_nonneg (by positivity) hy0 linarith
Among words with equal original score, the lexicographically smaller word has strictly higher perturbed score (hB).
When original scores are equal, the perturbed score difference reduces to δ times the difference of their perturbation sums. By pr1640_kappa_lex, if x is lexicographically smaller than y, the perturbation sum of y exceeds that of x by at least (1/2)^L > 0. Multiplying by δ > 0 preserves strict positivity, making the perturbed score of x strictly greater than that of y.
uses
pr1640_kappa_lex,mul_lt_mul_of_pos_lefthave hB : ∀ x y : Fin L → Bool, ∑ i, w i * (if x i then (1:ℝ) else 0) = ∑ i, w i * (if y i then (1:ℝ) else 0) → (∃ k, (∀ j, j < k → x j = y j) ∧ x k = false ∧ y k = true) → ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) < ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) := by rintro x y hxy ⟨k, hlt, hxk, hyk⟩ rw [hpert, hpert, hxy] have h1 := pr1640_kappa_lex L x y k hlt hxk hyk have h2 : γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) < γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if y i then (1:ℝ) else 0) := mul_lt_mul_of_pos_left (by linarith) (by positivity) linarith
Any two distinct words have distinct perturbed scores (hinj).
For any x ≠ y, trichotomy on their original scores gives three cases: if their original scores differ, hA shows their perturbed scores strictly differ; if their original scores are equal, lexicographic totality (pr1640_lex_total) together with hB shows their perturbed scores strictly differ. Hence perturbed scores are injective.
uses
lt_trichotomy,pr1640_lex_totalhave hinj : ∀ x y : Fin L → Bool, x ≠ y → ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) ≠ ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) := by intro x y hne rcases lt_trichotomy (∑ i, w i * (if x i then (1:ℝ) else 0)) (∑ i, w i * (if y i then (1:ℝ) else 0)) with h | h | h · exact (hA y x h).ne · rcases pr1640_lex_total L x y hne with hl | hl · exact (hB x y h hl).ne' · exact (hB y x h.symm hl).ne · exact (hA x y h).ne'
Every non-empty set of words K has a unique maximizer x ∈ K of the perturbed score, and x maximizes the original w-score over K.
Since the space of words is finite, K is finite, so the perturbed objective attains its maximum on K at some x ∈ K (Set.exists_max_image). Uniqueness of this maximizer follows from injectivity of the perturbed objective (hinj). Furthermore, x must maximize the original score w on K: if some y ∈ K had a strictly larger original score than x, hA would imply that y has a strictly larger perturbed score than x, contradicting the maximality of x.
uses
Set.exists_max_image,Set.toFinite,not_le.mp,not_lt.mpr,lt_of_le_of_nerefine ⟨hinj, fun K hK => ?_⟩ obtain ⟨x, hxK, hmax⟩ := Set.exists_max_image K (fun x => ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0)) (Set.toFinite K) hK have hwmax : ∀ y ∈ K, ∑ i, w i * (if y i then (1:ℝ) else 0) ≤ ∑ i, w i * (if x i then (1:ℝ) else 0) := by intro y hy by_contra hc exact absurd (hA y x (not_le.mp hc)) (not_lt.mpr (hmax y hy)) refine ⟨x, hxK, fun y hy hne => lt_of_le_of_ne (hmax y hy) (hinj y x hne), hwmax, ?_⟩
Any other word y ∈ K maximizing the original score is lexicographically strictly larger than x.
If y ∈ K also maximizes the original score w over K, then w(y) = w(x) by antisymmetry (le_antisymm). By lexicographic totality, either x is lexicographically smaller than y or y is lexicographically smaller than x. If y were lexicographically smaller than x, hB would imply that y has a strictly larger perturbed score than x, contradicting the maximality of x. Therefore, x is lexicographically strictly smaller than y.
uses
le_antisymm,pr1640_lex_total,Ne.symm,not_lt.mprintro y hy hymax hne have heq := le_antisymm (hymax x hxK) (hwmax y hy) rcases pr1640_lex_total L x y (Ne.symm hne) with hl | hl · exact hl · exact absurd (hB y x heq.symm hl) (not_lt.mpr (hmax y hy))
lt_of_le_of_ne- In a partial order, if a ≤ b and a ≠ b, then a < b.
le_antisymm- In a partial order, if a ≤ b and b ≤ a, then a = b.
Ne.symm- Inequality is symmetric: if a ≠ b, then b ≠ a.
not_le.mp- If it is not the case that a ≤ b, then b < a.
not_lt.mpr- If b ≤ a, then it is not the case that a < b.
Fin.sum_univ_castSucc- Splits a sum over Fin (n + 1) into the sum over the first n elements plus the value at the last element.
Fin.val_castSucc- The numerical value of i.castSucc equals the numerical value of i.
Fin.val_last- The numerical value of Fin.last n equals n.
pow_succ- In any monoid, a^(n+1) = a^n * a.
Fin.lastCases- Case analysis on Fin (n + 1): any element is either Fin.last n or castSucc of an element of Fin n.
Finset.sum_congr- Two finite sums are equal if their index sets and summands coincide.
Fin.castSucc_lt_last- For any i in Fin n, i.castSucc is strictly less than Fin.last n.
Fin.castSucc_lt_castSucc_iff.mpr- The castSucc map strictly preserves the ordering on Fin.
Function.ne_iff.mp- Two functions are unequal if and only if they differ at some input.
Finset.min'_mem- The minimum element of a non-empty finite set belongs to the set.
Finset.min'_le- The minimum element of a finite set is less than or equal to any element in the set.
Or.inl- Introduces a disjunction from a proof of the left disjunct.
Or.inr- Introduces a disjunction from a proof of the right disjunct.
Finset.mem_filter.mp- An element in a filtered finite set belongs to the base set and satisfies the predicate.
Finset.mem_filter.mpr- An element in the base set satisfying the predicate belongs to the filtered finite set.
Finset.mem_image.mpr- An element is in the image of a set under f if it is f(a) for some a in the domain set.
Finset.mem_univ- Every element of a finite type belongs to the universal finite set Finset.univ.
one_pos- In any non-trivial ordered semiring, 0 < 1.
Finset.mul_sum- Distributivity of multiplication over a finite sum: a * ∑ x_i = ∑ a * x_i.
Finset.sum_sub_distrib- Distributivity of subtraction over finite sums: ∑ (f_i - g_i) = ∑ f_i - ∑ g_i.
pr1640_kappa_bounds- For any binary word x of length L, the sum ∑_{i=0}^{L-1} (1/2)^(i+1) x_i lies in [0, 1 - (1/2)^L].
mul_le_mul_of_nonneg_left- Multiplying an inequality b ≤ c on the left by a non-negative number a ≥ 0 yields a * b ≤ a * c.
mul_nonneg- The product of two non-negative real numbers is non-negative.
pr1640_kappa_lex- If word x is lexicographically strictly smaller than word y, their perturbation sums differ by at least (1/2)^L.
mul_lt_mul_of_pos_left- Multiplying a strict inequality b < c on the left by a strictly positive number a > 0 yields a * b < a * c.
lt_trichotomy- Any two real numbers a and b satisfy a < b, a = b, or b < a.
pr1640_lex_total- Any two distinct binary words of length L are strictly comparable in the lexicographic order.
Set.exists_max_image- Any non-empty finite set has an element maximizing a given real-valued function.
Set.toFinite- A subset of a finite type is finite.
- Linear inequalities and boolean branch splits in the helper lemmas (lines 15, 16, 42) are resolved automatically by linarith and split_ifs.
- The existence of a positive gap γ between distinct original scores branches classically on whether the set of positive differences is non-empty.
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 pr1640_kappa_bounds : ∀ (L : ℕ) (x : Fin L → Bool), 0 ≤ ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) ∧ ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) ≤ 1 - (1/2:ℝ)^L := by intro L induction L with | zero => intro x; simp | succ n ih => intro x rw [Fin.sum_univ_castSucc] obtain ⟨h0, h1⟩ := ih (fun i => x (Fin.castSucc i)) simp only [Fin.val_castSucc, Fin.val_last] have hp : (0:ℝ) < (1/2:ℝ)^n := by positivity have e : (1/2:ℝ)^(n+1) = (1/2:ℝ)^n / 2 := by rw [pow_succ]; ring constructor · split_ifs <;> linarith · split_ifs <;> linariththeorem pr1640_kappa_lex : ∀ (L : ℕ) (x y : Fin L → Bool) (k : Fin L), (∀ j, j < k → x j = y j) → x k = false → y k = true → (1/2:ℝ)^L ≤ ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if y i then (1:ℝ) else 0) - ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) := by intro L induction L with | zero => intro x y k; exact k.elim0 | succ n ih => intro x y k hlt hx hy rw [Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] simp only [Fin.val_castSucc, Fin.val_last] have e : (1/2:ℝ)^(n+1) = (1/2:ℝ)^n / 2 := by rw [pow_succ]; ring have hp : (0:ℝ) < (1/2:ℝ)^n := by positivity induction k using Fin.lastCases with | last => have hsum : ∑ i : Fin n, (1/2:ℝ)^(i.val+1) * (if y (Fin.castSucc i) then (1:ℝ) else 0) = ∑ i : Fin n, (1/2:ℝ)^(i.val+1) * (if x (Fin.castSucc i) then (1:ℝ) else 0) := by refine Finset.sum_congr rfl (fun i _ => ?_) rw [hlt (Fin.castSucc i) (Fin.castSucc_lt_last i)] rw [hsum, hx, hy] simp | cast k' => have := ih (fun i => x (Fin.castSucc i)) (fun i => y (Fin.castSucc i)) k' (fun j hj => hlt _ (Fin.castSucc_lt_castSucc_iff.mpr hj)) hx hy split_ifs <;> linariththeorem pr1640_lex_total (L : ℕ) (x y : Fin L → Bool) (h : x ≠ y) : (∃ k, (∀ j, j < k → x j = y j) ∧ x k = false ∧ y k = true) ∨ (∃ k, (∀ j, j < k → y j = x j) ∧ y k = false ∧ x k = true) := by have hS : (Finset.univ.filter (fun i => x i ≠ y i)).Nonempty := by obtain ⟨i, hi⟩ := Function.ne_iff.mp h exact ⟨i, by simp [hi]⟩ have hk := Finset.min'_mem _ hS have hne : x ((Finset.univ.filter (fun i => x i ≠ y i)).min' hS) ≠ y ((Finset.univ.filter (fun i => x i ≠ y i)).min' hS) := (Finset.mem_filter.mp hk).2 have hlt : ∀ j, j < (Finset.univ.filter (fun i => x i ≠ y i)).min' hS → x j = y j := by intro j hj by_contra hc have : (Finset.univ.filter (fun i => x i ≠ y i)).min' hS ≤ j := Finset.min'_le _ j (by simp [hc]) exact absurd hj (not_lt.mpr this) generalize (Finset.univ.filter (fun i => x i ≠ y i)).min' hS = k at hne hlt cases hxk : x k <;> cases hyk : y k · exact absurd (hxk.trans hyk.symm) hne · exact Or.inl ⟨k, hlt, hxk, hyk⟩ · exact Or.inr ⟨k, fun j hj => (hlt j hj).symm, hyk, hxk⟩ · exact absurd (hxk.trans hyk.symm) hnetheorem linear_objective_lexicographic_perturbation_unique_maximizer (L : ℕ) (w : Fin L → ℝ) : ∃ δ : ℝ, 0 < δ ∧ (∀ x y : Fin L → Bool, x ≠ y → ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) ≠ ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0)) ∧ ∀ K : Set (Fin L → Bool), K.Nonempty → ∃ x ∈ K, (∀ y ∈ K, y ≠ x → ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) < ∑ i, (w i - δ * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0)) ∧ (∀ y ∈ K, ∑ i, w i * (if y i then (1:ℝ) else 0) ≤ ∑ i, w i * (if x i then (1:ℝ) else 0)) ∧ (∀ y ∈ K, (∀ z ∈ K, ∑ i, w i * (if z i then (1:ℝ) else 0) ≤ ∑ i, w i * (if y i then (1:ℝ) else 0)) → y ≠ x → ∃ k, (∀ j, j < k → x j = y j) ∧ x k = false ∧ y k = true) := by classical obtain ⟨γ, hγ, hgap⟩ : ∃ γ : ℝ, 0 < γ ∧ ∀ x y : Fin L → Bool, ∑ i, w i * (if y i then (1:ℝ) else 0) < ∑ i, w i * (if x i then (1:ℝ) else 0) → γ ≤ ∑ i, w i * (if x i then (1:ℝ) else 0) - ∑ i, w i * (if y i then (1:ℝ) else 0) := by by_cases hD : ((Finset.univ.image (fun p : (Fin L → Bool) × (Fin L → Bool) => ∑ i, w i * (if p.1 i then (1:ℝ) else 0) - ∑ i, w i * (if p.2 i then (1:ℝ) else 0))).filter (fun d => 0 < d)).Nonempty · refine ⟨_, (Finset.mem_filter.mp (Finset.min'_mem _ hD)).2, fun x y hxy => Finset.min'_le _ _ ?_⟩ exact Finset.mem_filter.mpr ⟨Finset.mem_image.mpr ⟨(x, y), Finset.mem_univ _, rfl⟩, by linarith⟩ · refine ⟨1, one_pos, fun x y hxy => absurd ⟨_, Finset.mem_filter.mpr ⟨Finset.mem_image.mpr ⟨(x, y), Finset.mem_univ _, rfl⟩, by linarith⟩⟩ hD⟩ refine ⟨γ / 2, by positivity, ?_⟩ have hpert : ∀ x : Fin L → Bool, ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) = ∑ i, w i * (if x i then (1:ℝ) else 0) - γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) := by intro x rw [Finset.mul_sum, ← Finset.sum_sub_distrib] exact Finset.sum_congr rfl (fun i _ => by ring) have hpL : (0:ℝ) < (1/2:ℝ)^L := by positivity have hA : ∀ x y : Fin L → Bool, ∑ i, w i * (if y i then (1:ℝ) else 0) < ∑ i, w i * (if x i then (1:ℝ) else 0) → ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) < ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) := by intro x y hxy rw [hpert, hpert] have h1 := hgap x y hxy obtain ⟨-, hx1⟩ := pr1640_kappa_bounds L x obtain ⟨hy0, -⟩ := pr1640_kappa_bounds L y have h2 : γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) ≤ γ / 2 * 1 := mul_le_mul_of_nonneg_left (by linarith) (by positivity) have h3 : 0 ≤ γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if y i then (1:ℝ) else 0) := mul_nonneg (by positivity) hy0 linarith have hB : ∀ x y : Fin L → Bool, ∑ i, w i * (if x i then (1:ℝ) else 0) = ∑ i, w i * (if y i then (1:ℝ) else 0) → (∃ k, (∀ j, j < k → x j = y j) ∧ x k = false ∧ y k = true) → ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) < ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) := by rintro x y hxy ⟨k, hlt, hxk, hyk⟩ rw [hpert, hpert, hxy] have h1 := pr1640_kappa_lex L x y k hlt hxk hyk have h2 : γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if x i then (1:ℝ) else 0) < γ / 2 * ∑ i : Fin L, (1/2:ℝ)^(i.val+1) * (if y i then (1:ℝ) else 0) := mul_lt_mul_of_pos_left (by linarith) (by positivity) linarith have hinj : ∀ x y : Fin L → Bool, x ≠ y → ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0) ≠ ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if y i then (1:ℝ) else 0) := by intro x y hne rcases lt_trichotomy (∑ i, w i * (if x i then (1:ℝ) else 0)) (∑ i, w i * (if y i then (1:ℝ) else 0)) with h | h | h · exact (hA y x h).ne · rcases pr1640_lex_total L x y hne with hl | hl · exact (hB x y h hl).ne' · exact (hB y x h.symm hl).ne · exact (hA x y h).ne' refine ⟨hinj, fun K hK => ?_⟩ obtain ⟨x, hxK, hmax⟩ := Set.exists_max_image K (fun x => ∑ i, (w i - γ / 2 * (1/2:ℝ)^(i.val+1)) * (if x i then (1:ℝ) else 0)) (Set.toFinite K) hK have hwmax : ∀ y ∈ K, ∑ i, w i * (if y i then (1:ℝ) else 0) ≤ ∑ i, w i * (if x i then (1:ℝ) else 0) := by intro y hy by_contra hc exact absurd (hA y x (not_le.mp hc)) (not_lt.mpr (hmax y hy)) refine ⟨x, hxK, fun y hy hne => lt_of_le_of_ne (hmax y hy) (hinj y x hne), hwmax, ?_⟩ intro y hy hymax hne have heq := le_antisymm (hymax x hxK) (hwmax y hy) rcases pr1640_lex_total L x y (Ne.symm hne) with hl | hl · exact hl · exact absurd (hB y x heq.symm hl) (not_lt.mpr (hmax y hy))