Theorem 1.1 — No deterministic algorithm beats 2L mistakes
ProvedOnlineConvexOpt.Introduction.no_deterministic_algorithm_beats_double_mistakesTheorem 1.1 (Hazan, p. 8). Let denote the number of mistakes made by the best expert in hindsight. Then there does not exist a deterministic algorithm that can guarantee less than mistakes.
This is formalized via the book's own two-expert adversary construction (the proof Hazan
gives): one expert always predicts the book's action (true), the other always predicts
(false). A deterministic algorithm is modelled as a causal map
alg : (ℕ → Bool) → ℕ → Bool from an outcome sequence to its own prediction sequence, where the
prediction at round depends only on the outcomes strictly before (causality is what
makes the adversary construction — choosing each outcome after seeing the algorithm's
prediction — well-defined). For every causal alg and every horizon T, the theorem exhibits
an outcome sequence on which alg errs on every round (algMistakes = T) while the best
expert's mistake count L is at most T/2 — since the two experts' mistake counts always sum
to T, this single witness shows T ≥ 2L, matching the book's "cannot guarantee fewer than
mistakes":
Formalization Note. A direct transcription of the book's sentence as
¬∃ alg, ∀ outcome, mistakes(outcome) < 2L(outcome) is a trivializing formalization: any
constant outcome sequence gives L = 0, so that negation is provable in one line from
mistakes ≥ 0, without using causality or the adversary construction at all. The
algMistakes = T conjunct blocks this shortcut — it is false on an outcome sequence the
algorithm predicts correctly, so proving it for a specific alg forces the actual
causality-driven adversary construction the book gives. This instantiates the book's proof at
its own two-expert construction rather than a fully general -expert adversary claim — the
exact scope the book's argument establishes.
import Mathlib import Definitions.Def_OnlineConvexOpt_Introduction_MistakeCounts
namespace OnlineConvexOpt.Introduction
/-- **Theorem 1.1**, Hazan, *Introduction to Online Convex Optimization*, 2nd ed.,
arXiv:1909.05207v3, p. 8.
"Let `L ≤ T/2` denote the number of mistakes made by the best expert in hindsight. Then there
does not exist a deterministic algorithm that can guarantee less than `2L` mistakes."
The theorem is stated as the book's proof actually establishes it: for every causal `alg`
and every horizon `T`, the adversary (which plays, at each round, whichever outcome `alg` did
*not* predict — well-defined by causality, since `alg`'s round-`t` prediction depends only on
already-fixed earlier outcomes) forces `alg` to err on literally every round, `algMistakes = T`;
since the two experts' mistake counts always sum to `T`, their minimum `L` is always `≤ T/2`, so
this single witness shows `T ≥ 2 L`, i.e. `alg`'s own mistake count is at least twice the best
expert's, matching the book's "cannot guarantee fewer than `2L` mistakes" (a bound that must
hold against every possible outcome sequence, refuted by exhibiting one on which it fails).
A direct transcription of "`¬∃ alg, ∀ outcome, mistakes(outcome) < 2 L(outcome)`" is a
trivializing formalization: any *constant* outcome sequence gives `L = 0`, so any such
transcription is provable in one line from `mistakes ≥ 0`, without using causality or the
adversary construction at all (Nat-valued mistake counts can never satisfy `< 0`). The
`algMistakes _ _ T = T` conjunct below blocks that shortcut: it is false for an arbitrary
outcome (an algorithm that happens to predict a constant outcome correctly makes zero mistakes
on it), so establishing it for a *specific* algorithm requires actually building the
causality-driven adversarial sequence. -/
theorem no_deterministic_algorithm_beats_double_mistakes
(alg : (ℕ → Bool) → ℕ → Bool)
(halg : ∀ outcome₁ outcome₂ : ℕ → Bool, ∀ t : ℕ,
(∀ s, s < t → outcome₁ s = outcome₂ s) → alg outcome₁ t = alg outcome₂ t)
(T : ℕ) :
∃ outcome : ℕ → Bool,
algMistakes (alg outcome) outcome T = T ∧
(T : ℝ) ≥
2 * (min ((Finset.range T).filter (fun t => outcome t = false)).card
((Finset.range T).filter (fun t => outcome t = true)).card : ℝ) := by sorry
end OnlineConvexOpt.Introduction
Read-back
What the Lean code literally says, in plain math · claude-fable-5-1
Fix a function that takes an infinite outcome sequence and a round index and returns a Boolean (the algorithm's prediction for round , given the whole sequence as input). Assume is causal in the following sense: for every pair of sequences and every round , if for all , then . (In particular, for the hypothesis is vacuous, so for all : the round- prediction is a constant.) Fix also a horizon , which may be .
The theorem asserts that there exists an outcome sequence such that both of the following hold:
-
, where is a function from the imported definitions file (
Def_OnlineConvexOpt_Introduction_MistakeCounts) whose body is not shown in the code given to me; it is applied to the prediction sequence , the outcome sequence , and the horizon , and returns a natural number. The claim is only that this natural number equals . Whatever counts (its definition must be checked separately), this conjunct says that count is exactly on the witness . -
Writing
i.e. the smaller of the number of rounds in on which is and the number on which it is (both are natural numbers; the minimum is taken in and then cast to ), the inequality
holds as real numbers. Note this second conjunct involves only and , not , and since the two set cardinalities always sum to , it is satisfied by every sequence regardless of how it is chosen.
Thus the whole statement reads: for every causal and every horizon (including , where both conjuncts hold trivially for any : must then equal , and ), some outcome sequence makes the -count of equal to while . The statement does not assert in any form other than through the two separate conjuncts above, does not quantify over all outcome sequences, does not say anything about randomized algorithms, and only constrains on the rounds through the cardinalities (its values for are unconstrained by conjunct 2 and constrained by conjunct 1 only insofar as depends on them).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.