BanditRLlib
Lean gate passed before this site build; local proof declarations are shown as compiled.Lean-verified build · exact declarations linked.

Teaching chapter 04 of 31 · Canonical route compiled

Projected OGD for the squared-loss guessing game

The actual projected square-loss OGD has a2sqrtT upper bound; a derived zero-stream construction compares its loss with the strict-prefix mean predictor.

How to read the status. It describes this page's canonical local Lean route, not completion of the cited textbook chapter or every extension listed below.

Orientation

Who should read this. Readers of Orabona Chapter 2 convex-analysis foundations.

Learning goals

  • Identify the actual interval projection with a clamp.
  • Derive square-loss regularity and gradient bounds.
  • Apply the shared OGD theorem to the same feasible trajectory.
  • Distinguish an upper-bound guarantee from an actual lower witness.
  • Produce both actual losses and a later natural witness for every prescribed loss-gap threshold.

Textbook crosswalk

Read the mathematics before the Lean interface

This reading follows Online Learning: A Modern Introduction Using Convex Optimization. Teaching routes group mathematical dependencies across the shared library. Visible page labels use the cited source's numbered pages; source buttons use the PDF viewer's physical page index, including front matter. Companion papers cover algorithm-specific results.

Primary spine · arXiv:1912.13213v10, 21 June 2026

Online Learning: A Modern Introduction Using Convex Optimization

Francesco Orabona

Location
Section2.1.2, Example2.14 and Equation(2.1); Chapter1 mean predictor
Pages
printedp15/PDF27
Open at the cited pages
causal projected update · ordered flow

Same shared OGD recursion

Read top to bottom to follow the argument or procedure.

  1. Predict before the current label

    The actual OGD iterate at time t uses only strict-prefix losses; every feasible initial point and comparator is allowed for the upper guarantee.

  2. Differentiate and project the actual square loss

    Its ambient gradient is2(x-y_t); global square regularity is proved, and actual projection clamps x-2eta(x-y_t) into[0,1]. Feasibility produces gradient norm<=2.

  3. Use a horizon known in advance

    For T>0 the shared same-trajectory tuned bound gives2sqrtT with eta1/(2sqrtT). This is a derived constant for the printed O(sqrtT), not future-gradient optimization.

  4. Compare actual algorithms on the same zero stream

    For square horizons, the actual OGD initial1 learns geometrically slowly. The source mean predictor starts1/2 and then predicts the zero strict-prefix average. Subtract their produced losses, rather than comparing two upper bounds.

3 distinct theory routes, one frontier.Open the statement you want to compare; the other routes stay compact.
Derived instantiation of source guaranteeExample 2.14: square-loss OGD, with a derived constantConcrete square-loss OGD source instanceprintedp15
Derived instantiation of source guarantee

Example 2.14: square-loss OGD, with a derived constant

Source context at printedp15 ↗
Concrete square-loss OGD source instanceOne square-loss OGD source instance and an explicit derived zero-stream comparison. The upper bound allows every feasible initial point; the comparison fixes OGD initialization1 and mean initialization1/2. Steps are tuned separately to known positive horizons. Other Chapter1/2 obligations and whole-book acceptance remain separate.

The square-loss gradient bound and clamp are derived for the actual OGD algorithm.

Model
Predictions, observations and comparator in[0,1]; squared loss.
Assumptions
Arbitrary feasible initial value, T>=1, observations feasible for all rounds before T.
Algorithm parameters
One horizon-tuned fixed step1/(2sqrtT).
Regret notion
Actual shared OGD recurrence versus every fixed feasible comparator.
Guarantee
At most2sqrtT, with exact gradient and projection identities.
Derived explicit guarantee. The source O(sqrtT) upper-regret claim is established with an explicit valid constant2.

BanditRLlib relationship. Example2.14 prints the gradient and projection formulas and an O(sqrtT) rate. Instantiating Equation(2.1) with interval diameter1 and gradient bound2 gives the displayed constant2 and step1/(2sqrtT). Square regularity is proved globally, so the historical stronger regularity API adds no hypothesis to the public upper theorem. The theorem quantifies over each feasible comparator; the source best-fixed interpretation additionally uses a feasible hindsight minimizer, never knowledge of that minimizer before prediction.

Derived library resultDerived zero-stream lower witnessActual lower witness for the comparisonprintedp15
Derived library result

Derived zero-stream lower witness

Source context at printedp15 ↗
Actual lower witness for the comparisonPositive n only; the separate eta identity at n0 is total-division algebra, not a legal zero-horizon guarantee. At n1 the displayed gap lower bound is zero, not strict superiority.

The actual geometric OGD trajectory has loss at least n/4; the actual source mean predictor has loss1/4 on the same zero stream, so their gap is at least n/4-1/4.

Model
Same unit-interval squared-loss OGD, all labels0, initial1, comparator0.
Assumptions
n>=1, T=(2n)^2 and the same source step1/(2sqrtT)=1/(4n).
Algorithm parameters
Arbitrarily large square horizons.
Regret notion
Actual causal OGD regret, not a postulated prediction sequence.
Guarantee
Exact OGD trajectory and regret>=n/4, actual mean cumulative loss1/4, gap>=n/4-1/4; for every real C and natural N, some n>N has gap>C.
Derived mathematical statement. All labels0 and initial1 produce square-root regret on arbitrarily large square horizons under the same tuned step.

BanditRLlib relationship. This is a proved refinement supporting the source informal comparison, not a lower-bound theorem printed in Example2.14. It fixes OGD initial1, all-zero labels, comparator0 and positive square horizons. The numerical lower bound does not concern all streams, initializations, algorithms or Chapter4 optimality.

Derived library resultDerived comparison with the actual mean predictorActual direct same-stream comparisonprintedp15; source mean predictor printedp4
Derived library result

Derived comparison with the actual mean predictor

Source context at printedp15; source mean predictor printedp4 ↗
Actual direct same-stream comparisonOne square-loss OGD source instance and an explicit derived zero-stream comparison. The upper bound allows every feasible initial point; the comparison fixes OGD initialization1 and mean initialization1/2. Steps are tuned separately to known positive horizons. Other Chapter1/2 obligations and whole-book acceptance remain separate. The comparison is not an equal-initialization or uniform-over-streams claim.

This is a direct comparison of two actual causal algorithms, with different disclosed fixed initializations.

Model
Same deterministic real zero stream/unit interval/squared losses.
Assumptions
Mean initial1/2; OGD initial1/comparator0; n>0 and T=(2n)^2. Zero comparator has zero optimal loss on this stream.
Algorithm parameters
Known-horizon OGD family eta=1/(4n); C any real and N any natural, with no extra positivity assumption on C.
Regret notion
OGD comparator0 regret equals its cumulative loss; subtract the actual mean-predictor cumulative loss, also its comparator0 regret on this stream.
Guarantee
Produced exact mean loss and actual lower gap, then an actual natural witness n>N with strict gap>C.
Derived mathematical statement. The same zero labels yield exact mean-predictor loss one quarter and an OGD loss gap exceeding every threshold at some index beyond every cutoff.

BanditRLlib relationship. These are three derived statements, not three source-numbered results. The mean predictor definition uses the Chapter1 initial1/2 and strict-prefix average. The loss1/4 is proved directly from that definition, without using its general logarithmic regret theorem as a proof dependency. The terminal theorem is literal exists n>N, not a compiled Tendsto theorem or an anytime run.

Natural-language and Lean side by side

The mathematical readings are explanatory summaries. The exact generated Lean statement and its source link remain authoritative for hypotheses, types, constants, and indexing.

A curated route through definitions, key bridges, and canonical terminals stays visible. 4 additional dependency, extension, or research-frontier notes are grouped below.

Mathematics ↔ Lean

Interval projection equals clamp

Lean declarationBanditRL.OnlineGradientDescent.project_unitInterval

Compiled

Plain-English statement. Interval projection equals clamp

Mathematical reading. Interval projection equals clamp
Intuition
Use the variational projection identity in the below/inside/above cases.
Why it is needed
Instantiates the source example in the same shared causal OGD library.
Place in the proof
Orabona v10 printedp15/PDF27.
Proof and Lean reading notes
Proof idea
Use the variational projection identity in the below/inside/above cases.
Lean reading notes
No regularity or gradient bound is assumed as a consumer premise; both are derived from squared loss and feasibility.
Teaching dependencies
BanditRL.OnlineGradientDescent.project_eq_of_variational
Exact Lean statement
theorem project_unitInterval (z : ℝ) : project unitInterval z = min (max z 0) 1
Mathematics ↔ Lean

Concrete projected square-loss update

Lean declarationBanditRL.OnlineGradientDescent.square_step_clamp

Compiled

Plain-English statement. Concrete projected square-loss update

Mathematical reading. Concrete projected square-loss update
Intuition
Rewrite the shared step with its proved gradient and interval projection.
Why it is needed
Instantiates the source example in the same shared causal OGD library.
Place in the proof
Orabona v10 printedp15/PDF27.
Proof and Lean reading notes
Proof idea
Rewrite the shared step with its proved gradient and interval projection.
Lean reading notes
No regularity or gradient bound is assumed as a consumer premise; both are derived from squared loss and feasibility.
Teaching dependencies
BanditRL.OnlineGradientDescent.project_unitInterval, BanditRL.OnlineGradientDescent.gradient_square
Exact Lean statement
theorem square_step_clamp (η y x : ℝ) : step unitInterval η (fun x : ℝ => (x-y)^2) x = min (max (x - 2 * η * (x-y)) 0) 1
Mathematics ↔ Lean

Explicit square-root regret bound

Lean declarationBanditRL.OnlineGradientDescent.example_2_14

Compiled

Plain-English statement. Explicit square-root regret bound

Mathematical reading. Explicit square-root regret bound
Intuition
Bound actual iterate gradients by feasibility and instantiate the shared tuned OGD theorem.
Why it is needed
Instantiates the source example in the same shared causal OGD library.
Place in the proof
Orabona v10 printedp15/PDF27.
Proof and Lean reading notes
Proof idea
Bound actual iterate gradients by feasibility and instantiate the shared tuned OGD theorem.
Lean reading notes
No regularity or gradient bound is assumed as a consumer premise; both are derived from squared loss and feasibility.
Teaching dependencies
BanditRL.OnlineGradientDescent.square_regular, BanditRL.OnlineGradientDescent.gradient_square_bound, BanditRL.OnlineGradientDescent.equation_2_1
Exact Lean statement
theorem example_2_14 (y : ℕ → ℝ) (x0 : ℝ) (hx0 : x0 ∈ Icc (0 : ℝ) 1) (T : ℕ) (hT : 0 < T) (hy : ∀ t < T, y t ∈ Icc (0 : ℝ) 1) : ∀ u ∈ Icc (0 : ℝ) 1, regret unitInterval (1 / (2 * Real.sqrt T)) (fun t x => (x-y t)^2) x0 u T ≤ 2 * Real.sqrt T
Mathematics ↔ Lean

Actual unbounded gap beyond each cutoff

Lean declarationBanditRL.OnlineGradientDescent.guessing_vs_mean_unbounded

Compiled

Plain-English statement. Actual unbounded gap beyond each cutoff

Mathematical reading. Actual unbounded gap beyond each cutoff
Intuition
Choose n>max(4C+1,N) using the actual Archimedean API, then use the produced lower gap.
Why it is needed
Directly supports source Example2.14 comparison with produced losses.
Place in the proof
Derived refinement supporting Example2.14, printed page15 / PDF page27; mean predictor defined on printed page4 / PDF page16.
Proof and Lean reading notes
Proof idea
Choose n>max(4C+1,N) using the actual Archimedean API, then use the produced lower gap.
Lean reading notes
Tail-existence for separately known-horizon runs, same zero stream/different fixed initializations; not a Tendsto/anytime/every-stream result.
Teaching dependencies
BanditRL.OnlineGradientDescent.guessing_vs_mean_lower
Exact Lean statement
theorem guessing_vs_mean_unbounded (C : ℝ) (N : ℕ) : ∃ n : ℕ, N < n ∧ C < regret unitInterval (1/(2*Real.sqrt (((2*n)^2 : ℕ) : ℝ))) (fun _ x => (x-0)^2) 1 0 ((2*n)^2) - (∑ t ∈ range ((2*n)^2), (BanditRL.OnlineLearning.meanPredict (fun _ : ℕ => (0 : ℝ)) t)^2)
Explore 4 additional Lean teaching notes
Mathematics ↔ Lean

Exact square-loss gradient

Lean declarationBanditRL.OnlineGradientDescent.gradient_square

Compiled

Plain-English statement. Exact square-loss gradient

Mathematical reading. Exact square-loss gradient
Intuition
Differentiate the actual squared residual and identify its gradient.
Why it is needed
Instantiates the source example in the same shared causal OGD library.
Place in the proof
Orabona v10 printedp15/PDF27.
Proof and Lean reading notes
Proof idea
Differentiate the actual squared residual and identify its gradient.
Lean reading notes
No regularity or gradient bound is assumed as a consumer premise; both are derived from squared loss and feasibility.
Teaching dependencies
No direct teaching dependency recorded.
Exact Lean statement
theorem gradient_square (y x : ℝ) : gradient (fun x : ℝ => (x-y)^2) x = 2 * (x-y)
Mathematics ↔ Lean

A true square-root lower witness

Lean declarationBanditRL.OnlineGradientDescent.guessing_squared_horizon_lower

Compiled

Plain-English statement. Constant zero labels yield a square-root regret lower bound for the tuned OGD.

Mathematical reading. Constant zero labels yield a square-root regret lower bound for the tuned OGD.
Intuition
A small fixed step learns a constant target slowly.
Why it is needed
Substantiates the source comparison with an actual lower witness.
Place in the proof
Derived refinement supporting Example2.14, printed page15 / PDF page27; mean predictor defined on printed page4 / PDF page16.
Proof and Lean reading notes
Proof idea
Prove the exact geometric trajectory, apply Bernoulli to its first n terms, and sum their squared losses.
Lean reading notes
The exact horizon-selected step is identified separately; the initial point1 and comparator0 are fixed admissible choices.
Teaching dependencies
BanditRL.OnlineGradientDescent.guessing_zero_trajectory, BanditRL.OnlineGradientDescent.guessing_tuned_eta_square
Exact Lean statement
theorem guessing_squared_horizon_lower (n : ℕ) (hn : 0 < n) : (n:ℝ)/4 ≤ regret unitInterval (1/(2*Real.sqrt (((2*n)^2 : ℕ) : ℝ))) (fun _ x => (x-0)^2) 1 0 ((2*n)^2)
Mathematics ↔ Lean

Actual mean-predictor loss on zero labels

Lean declarationBanditRL.OnlineGradientDescent.meanPredict_zero_cumulativeLoss

Compiled

Plain-English statement. Actual mean-predictor loss on zero labels

Mathematical reading. Actual mean-predictor loss on zero labels
Intuition
Unfold the true initial1/2 and strict-prefix empirical mean0; only the first finite-sum term survives.
Why it is needed
Directly supports source Example2.14 comparison with produced losses.
Place in the proof
Derived refinement supporting Example2.14, printed page15 / PDF page27; mean predictor defined on printed page4 / PDF page16.
Proof and Lean reading notes
Proof idea
Unfold the true initial1/2 and strict-prefix empirical mean0; only the first finite-sum term survives.
Lean reading notes
Positive horizon needed; zero comparator is optimal on this stream.
Teaching dependencies
BanditRL.OnlineLearning.meanPredict, BanditRL.OnlineLearning.empiricalMean
Exact Lean statement
theorem meanPredict_zero_cumulativeLoss (T : ℕ) (hT : 0 < T) : (∑ t ∈ range T, (BanditRL.OnlineLearning.meanPredict (fun _ : ℕ => (0 : ℝ)) t)^2) = 1/4
Mathematics ↔ Lean

Produced two-algorithm loss-gap lower

Lean declarationBanditRL.OnlineGradientDescent.guessing_vs_mean_lower

Compiled

Plain-English statement. Produced two-algorithm loss-gap lower

Mathematical reading. Produced two-algorithm loss-gap lower
Intuition
Subtract produced exact mean loss from the actual OGD lower at the same positive square horizon.
Why it is needed
Directly supports source Example2.14 comparison with produced losses.
Place in the proof
Derived refinement supporting Example2.14, printed page15 / PDF page27; mean predictor defined on printed page4 / PDF page16.
Proof and Lean reading notes
Proof idea
Subtract produced exact mean loss from the actual OGD lower at the same positive square horizon.
Lean reading notes
At n1 displayed gap lower is0; fixed initializations differ.
Teaching dependencies
BanditRL.OnlineGradientDescent.guessing_squared_horizon_lower, BanditRL.OnlineGradientDescent.meanPredict_zero_cumulativeLoss
Exact Lean statement
theorem guessing_vs_mean_lower (n : ℕ) (hn : 0 < n) : (n : ℝ)/4 - 1/4 ≤ regret unitInterval (1/(2*Real.sqrt (((2*n)^2 : ℕ) : ℝ))) (fun _ x => (x-0)^2) 1 0 ((2*n)^2) - (∑ t ∈ range ((2*n)^2), (BanditRL.OnlineLearning.meanPredict (fun _ : ℕ => (0 : ℝ)) t)^2)

Maintainer contract

Open the canonical completion definition and blockers

One source Example2.14 instance plus derived lower and direct-comparison refinements:12 theorem statements and one domain definition, with all three original canary modules. Chapter2 mandatory total remains null; not completion of Chapter2 or Chapter1 migration.

Remaining blockers

  • Other source, appendix and legacy obligations require separate target-level acceptance; compiled supporting code alone does not close them.

Chapter implementation status

The compact summary keeps the reading route visible. Open it for source-linked declarations and exact remaining gaps.

Open 0 implementation records0 compiled · 0 partial · 0 blocked · 0 planned
MilestoneStatusLean declarationRemaining gap

Open boundaries

  • The direct loss comparison fixes different disclosed initializations and a zero-label stream; it is not uniform over all streams or algorithms.
  • Whole-chapter source acceptance and full purification remain separate.

All Lean modules in this chapter

Open the complete module list (3 modules)
ModuleDeclarationsProject importsStatus
BanditRLProof.OnlineGuessingComparison32Compiled
BanditRLProof.OnlineGuessingLower31Compiled
BanditRLProof.OnlineGuessingOGD71Compiled