Index of theproofnetwork/open-problems@860a535/Prove2Me/Definitions/Def_AJOnline_CostedGame.lean
qedmarket’s copy of theproofnetwork/open-problems@860a535, 1 Dec 2026original source ↗
/-From Prove2Me, definition `AJOnline_CostedGame` (https://prove2.me/definitions/64891a06-e796-4b6c-b2f2-d2bf252fa091). Apache-2.0 per Prove2Me's terms.-/import Mathlibimport Prove2Me.Definitions.Def_AJGames_Behaviour /-!# Online problems as Abramsky–Jagadeesan games An online problem is read as an AJ game in which Opponent issues requests and Player serves them.A *costed game* attaches to every finite play `s` the cost `alg s` that Player has paid along `s`,and the offline optimum `opt s` for the requests that occur in `s`. A Player strategy is`(ρ, β)`-competitive when every play it allows satisfies `alg s ≤ ρ · opt s + β` (Borodin andEl-Yaniv, *Online Computation and Competitive Analysis*, CUP 1998, Definition 1.1, for an obliviousadversary; here the adversary's moves are the Opponent moves of the game). **Formalization Note.** Costs are `ℝ≥0∞`-valued functions of finite plays, so the finite-play(safety) fragment of AJ games suffices. In the tensor `A ⊗ B` the two problems run side by side andOpponent decides which one receives the next request (AJ: only Opponent switches component).Costs and offline optima add over the components: the two instances are independent.-/ namespace AJOnline open AJGamesopen scoped ENNReal NNReal universe u /-- An online problem as an AJ game with costs on finite plays. -/structure CostedGame where G : AJGames.Game.{u} alg : List G.M → ℝ≥0∞ opt : List G.M → ℝ≥0∞ /-- `σ` is `(ρ, β)`-competitive: on every finite play it allows, its cost is at most`ρ` times the offline optimum plus `β`. -/def Competitive (C : CostedGame.{u}) (σ : Strategy C.G) (ρ β : ℝ≥0) : Prop := ∀ s ∈ σ.carrier, C.alg s ≤ (ρ : ℝ≥0∞) * C.opt s + β /-- Two independent online problems side by side: the AJ tensor of the games, with costs andoffline optima added over the components. -/def CostedGame.tensor (C D : CostedGame.{u}) : CostedGame.{u} where G := AJGames.Game.tensor C.G D.G alg s := C.alg (projL s) + D.alg (projR s) opt s := C.opt (projL s) + D.opt (projR s) /-- Expected cost to Player of the behaviour strategy `β` against the oblivious script `rs`(stop-counts semantics, `AJGames.playOut`). -/noncomputable def expAlg (C : CostedGame.{u}) (β : BehStrategy C.G) (rs : List C.G.M) : ℝ≥0∞ := ∑' s, playOut β [] rs s * C.alg s /-- Expected offline optimum over the same outcomes. -/noncomputable def expOpt (C : CostedGame.{u}) (β : BehStrategy C.G) (rs : List C.G.M) : ℝ≥0∞ := ∑' s, playOut β [] rs s * C.opt s /-- `β` is `(ρ, b)`-competitive against oblivious adversaries: for every script,`E[alg] ≤ ρ · E[opt] + b`. -/def RandCompetitive (C : CostedGame.{u}) (β : BehStrategy C.G) (ρ b : ℝ≥0) : Prop := ∀ rs : List C.G.M, expAlg C β rs ≤ (ρ : ℝ≥0∞) * expOpt C β rs + b end AJOnline