Documentation

CslibFrontier.GameTheory.Strategic.RegretMatching

Empirical play, internal/swap regret bridges, and Hart–Mas-Colell regret-matching dynamics #

This module connects external, internal, and swap regret to approximate coarse correlated and correlated equilibria of repeated normal-form games ([HMC00] §§2–4, pp. 1129–1139; [BM07b] §4.4, Theorems 4.12 and 4.13), extending CslibFrontier.GameTheory.Strategic.Correlated, NoRegret, and SwapRegretDynamics without duplication:

  1. Approximate coarse correlated and pairwise correlated equilibria: complements CostGame.IsApproxCorrelatedEquilibrium (Correlated.lean, [BM07b] Definition 4.11) with CostGame.IsApproxCoarseCorrelatedEquilibrium (ε-CCE) and CostGame.IsApproxInternalCorrelatedEquilibrium (Hart and Mas-Colell's pairwise correlated ε-equilibrium, [HMC00] §2, p. 1129). At ε = 0, both reduce to their exact counterparts (IsCoarseCorrelatedEquilibrium and IsCorrelatedEquilibrium), while for general slack ε, swap-ε-CE implies internal-ε-CE and internal-ε-CE implies (|S i| * ε i)-CE (IsApproxInternalCorrelatedEquilibrium.isApproxCorrelatedEquilibrium).
  2. Empirical joint distribution of pure play and exact deterministic bridges: for a pure action trajectory s : ℕ → ∀ i, S i and 0 < T, empiricalDist s T hT ([HMC00] eq. (2.3), p. 1131) is the uniform time average of the point masses at s 0, …, s (T - 1). We prove:
  3. Elimination of ε-strictly dominated strategies ([BM07b] Theorem 4.13): if player i incurs cumulative swap regret at most R over T > 0 rounds, the time-averaged probability mass placed on the set of ε-dominated actions (0 < ε) is at most R / (ε * T) (CostGame.average_epsDominated_le_div).
  4. Coupled anytime multi-player regret-matching dynamics: unlike hedgeProb (Hedge.lean) and blumMansourDynamics (SwapRegretDynamics.lean), which depend on a pre-selected horizon T and require T ≥ m_i ln m_i, both extRegretMatchingDynamics ([HMC00] (4.2), Theorem B) and intRegretMatchingDynamics ([HMC00] (3.1), Theorem A & Corollary) define a single horizon-free, parameter-free trajectory whose product-distribution time average at every T > 0 is respectively a 2 M √(|S i| / T)-CCE and a 2 M √(|S i| (|S i| - 1) / T)-CE (and 2 M √((|S i| - 1) / T) pairwise correlated ε-equilibrium) whenever |G.cost i s| ≤ M.

Main definitions #

Main results #

References #

Empirical joint distribution of pure play #

noncomputable def Cslib.GameTheory.empiricalDist {X : Type u_1} (s : ℕ → X) (T : ℕ) (hT : 0 < T) :

The empirical joint distribution (1 / T) ∑_{t < T} δ_{s t} of a pure-outcome sequence s : ℕ → X over T > 0 rounds ([HMC00] §2, eq. (2.3), p. 1131).

theorem Cslib.GameTheory.empiricalDist_sum {X : Type u_1} (s : ℕ → X) {T : ℕ} (hT : 0 < T) (f : X → ℝ) :
((empiricalDist s T hT).sum fun (x : X) (w : ℝ) => w * f x) = (∑ t ∈ Finset.range T, f (s t)) / ↑T

Expectation under empiricalDist s T hT equals the sample mean (∑ t ∈ range T, f (s t)) / T.

Approximate coarse correlated and pairwise correlated equilibria #

def Cslib.GameTheory.CostGame.IsApproxCoarseCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] (G : CostGame ι S) (ε : ι → ℝ) (σ : Convexity.StdSimplex ℝ ((i : ι) → S i)) :

A finitely supported distribution σ on profiles is an ε-approximate coarse correlated equilibrium (ε-CCE) if committing to any fixed strategy a : S i reduces player i's expected cost by at most ε i.

def Cslib.GameTheory.CostGame.IsApproxInternalCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] (G : CostGame ι S) [(i : ι) → DecidableEq (S i)] (ε : ι → ℝ) (σ : Convexity.StdSimplex ℝ ((i : ι) → S i)) :

A finitely supported distribution σ on profiles is a pairwise approximate correlated equilibrium (a correlated ε-equilibrium in [HMC00] §2, p. 1129; cf. [BM07b] Definition 4.10) if replacing recommendation a by b reduces player i's expected cost on the event s i = a by at most ε i.

Every ε-approximate correlated equilibrium is an ε-approximate coarse correlated equilibrium, via constant switching functions fun _ => a.

theorem Cslib.GameTheory.CostGame.isApproxInternalCorrelatedEquilibrium_iff_switchAction {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} [(i : ι) → DecidableEq (S i)] {ε : ι → ℝ} {σ : Convexity.StdSimplex ℝ ((i : ι) → S i)} :
G.IsApproxInternalCorrelatedEquilibrium ε σ ↔ ∀ (i : ι) (a b : S i), (σ.sum fun (s : (i : ι) → S i) (w : ℝ) => w * G.cost i s) ≤ (σ.sum fun (s : (i : ι) → S i) (w : ℝ) => w * G.cost i (Function.update s i (MachineLearning.OnlineLearning.Experts.switchAction a b (s i)))) + ε i

Pairwise correlated ε-equilibrium is equivalent to bounding unilateral deviations of the form switchAction a b by ε i.

At zero slack, Hart and Mas-Colell's pairwise correlated 0-equilibrium coincides with IsCorrelatedEquilibrium.

Every ε-approximate correlated equilibrium is a pairwise correlated ε-equilibrium.

theorem Cslib.GameTheory.CostGame.IsApproxInternalCorrelatedEquilibrium.isApproxCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} [(i : ι) → DecidableEq (S i)] [(i : ι) → Fintype (S i)] {ε : ι → ℝ} {σ : Convexity.StdSimplex ℝ ((i : ι) → S i)} (h : G.IsApproxInternalCorrelatedEquilibrium ε σ) :
G.IsApproxCorrelatedEquilibrium (fun (i : ι) => ↑(Fintype.card (S i)) * ε i) σ

Every pairwise correlated ε-equilibrium is a (|S i| * ε i)-approximate correlated equilibrium against all |S i| ^ |S i| switching functions ([BM07b] Exercise 4.1).

Deterministic bridges from swap, internal, and external regret to ε-CE and ε-CCE #

theorem Cslib.GameTheory.CostGame.timeAverage_isApproxCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} {σ : ℕ → Convexity.StdSimplex ℝ ((i : ι) → S i)} {T : ℕ} (hT : 0 < T) {R : ι → ℝ} (hR : ∀ (i : ι) (δ : S i → S i), (∑ t ∈ Finset.range T, (σ t).sum fun (s : (i : ι) → S i) (w : ℝ) => w * G.cost i s) ≤ (∑ t ∈ Finset.range T, (σ t).sum fun (s : (i : ι) → S i) (w : ℝ) => w * G.cost i (Function.update s i (δ (s i)))) + R i) :
G.IsApproxCorrelatedEquilibrium (fun (i : ι) => R i / ↑T) (timeAverage σ T hT)

Theorem 4.12 of [BM07b] (§4.4) for arbitrary sequences of joint distributions: if over T > 0 rounds each player i has cumulative swap regret at most R i, then timeAverage σ T hT is an (R i / T)-approximate correlated equilibrium.

theorem Cslib.GameTheory.CostGame.timeAverage_isApproxCoarseCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} {σ : ℕ → Convexity.StdSimplex ℝ ((i : ι) → S i)} {T : ℕ} (hT : 0 < T) {R : ι → ℝ} (hR : ∀ (i : ι) (a : S i), (∑ t ∈ Finset.range T, (σ t).sum fun (s : (i : ι) → S i) (w : ℝ) => w * G.cost i s) ≤ (∑ t ∈ Finset.range T, (σ t).sum fun (s : (i : ι) → S i) (w : ℝ) => w * G.cost i (Function.update s i a)) + R i) :
G.IsApproxCoarseCorrelatedEquilibrium (fun (i : ι) => R i / ↑T) (timeAverage σ T hT)

External-regret counterpart of timeAverage_isApproxCorrelatedEquilibrium (packaging NoRegret.timeAverage_le_add into IsApproxCoarseCorrelatedEquilibrium): cumulative external regret at most R i makes timeAverage σ T hT an (R i / T)-CCE.

theorem Cslib.GameTheory.CostGame.empiricalDist_isApproxCorrelatedEquilibrium_iff {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} {s : ℕ → (i : ι) → S i} {T : ℕ} (hT : 0 < T) {ε : ι → ℝ} :
G.IsApproxCorrelatedEquilibrium ε (empiricalDist s T hT) ↔ ∀ (i : ι) (δ : S i → S i), (∑ t ∈ Finset.range T, (G.cost i (s t) - G.cost i (Function.update (s t) i (δ (s t i))))) / ↑T ≤ ε i

Exact deterministic swap-regret bridge: for any pure-play trajectory s : ℕ → ∀ i, S i and 0 < T, the empirical joint distribution empiricalDist s T hT is an ε-correlated equilibrium if and only if every player i's time-averaged swap regret along s is at most ε i.

theorem Cslib.GameTheory.CostGame.empiricalDist_isCorrelatedEquilibrium_iff {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} {s : ℕ → (i : ι) → S i} {T : ℕ} (hT : 0 < T) :
G.IsCorrelatedEquilibrium (empiricalDist s T hT) ↔ ∀ (i : ι) (δ : S i → S i), ∑ t ∈ Finset.range T, G.cost i (s t) ≤ ∑ t ∈ Finset.range T, G.cost i (Function.update (s t) i (δ (s t i)))

Zero-slack specialization: empiricalDist s T hT is an exact correlated equilibrium iff every player has nonpositive swap regret along s 0, …, s (T - 1).

theorem Cslib.GameTheory.CostGame.empiricalDist_isApproxInternalCorrelatedEquilibrium_iff {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} [(i : ι) → DecidableEq (S i)] {s : ℕ → (i : ι) → S i} {T : ℕ} (hT : 0 < T) {ε : ι → ℝ} :
G.IsApproxInternalCorrelatedEquilibrium ε (empiricalDist s T hT) ↔ ∀ (i : ι) (a b : S i), (∑ t ∈ Finset.range T, if s t i = a then G.cost i (s t) - G.cost i (Function.update (s t) i b) else 0) / ↑T ≤ ε i

Finite-horizon Proposition of [HMC00] (§3, pp. 1133–1134): empiricalDist s T hT is a pairwise correlated ε-equilibrium if and only if every player i's time-averaged internal regret D_T^i(a, b) along s is at most ε i for all actions a, b : S i.

theorem Cslib.GameTheory.CostGame.empiricalDist_isApproxCoarseCorrelatedEquilibrium_iff {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} {s : ℕ → (i : ι) → S i} {T : ℕ} (hT : 0 < T) {ε : ι → ℝ} :
G.IsApproxCoarseCorrelatedEquilibrium ε (empiricalDist s T hT) ↔ ∀ (i : ι) (a : S i), (∑ t ∈ Finset.range T, (G.cost i (s t) - G.cost i (Function.update (s t) i a))) / ↑T ≤ ε i

Exact deterministic external-regret bridge: empiricalDist s T hT is an ε-coarse correlated equilibrium if and only if every player i's time-averaged external regret along s is at most ε i.

theorem Cslib.GameTheory.CostGame.empiricalDist_isCoarseCorrelatedEquilibrium_iff {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} {s : ℕ → (i : ι) → S i} {T : ℕ} (hT : 0 < T) :
G.IsCoarseCorrelatedEquilibrium (empiricalDist s T hT) ↔ ∀ (i : ι) (a : S i), ∑ t ∈ Finset.range T, G.cost i (s t) ≤ ∑ t ∈ Finset.range T, G.cost i (Function.update (s t) i a)

Zero-slack specialization: empiricalDist s T hT is an exact coarse correlated equilibrium iff every player has nonpositive external regret along s 0, …, s (T - 1).

Elimination of ε-strictly dominated strategies (NRTV Theorem 4.13) #

def Cslib.GameTheory.CostGame.IsEpsDominated {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] (G : CostGame ι S) (i : ι) (ε : ℝ) (a : S i) :

Strategy a : S i of player i is ε-dominated ([BM07b] §4.4) if some pure strategy b : S i beats a by at least ε in cost against every opponent profile.

theorem Cslib.GameTheory.CostGame.average_epsDominated_le_div {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] {G : CostGame ι S} [(j : ι) → DecidableEq (S j)] {σ : ℕ → Convexity.StdSimplex ℝ ((j : ι) → S j)} {T : ℕ} (hT : 0 < T) {i : ι} {ε R : ℝ} (hε : 0 < ε) {D : Finset (S i)} (hD : ∀ a ∈ D, G.IsEpsDominated i ε a) (hR : ∀ (δ : S i → S i), (∑ t ∈ Finset.range T, (σ t).sum fun (s : (j : ι) → S j) (w : ℝ) => w * G.cost i s) ≤ (∑ t ∈ Finset.range T, (σ t).sum fun (s : (j : ι) → S j) (w : ℝ) => w * G.cost i (Function.update s i (δ (s i)))) + R) :
(∑ t ∈ Finset.range T, (σ t).sum fun (s : (j : ι) → S j) (w : ℝ) => w * if s i ∈ D then 1 else 0) / ↑T ≤ R / (ε * ↑T)

Theorem 4.13 of [BM07b] (§4.4): if player i incurs cumulative swap regret at most R over T > 0 rounds of a joint outcome sequence σ, then the time-averaged probability mass that player i places on any finite set D of ε-dominated strategies (0 < ε) is at most R / (ε * T).

Coupled anytime multi-player regret-matching dynamics #

noncomputable def Cslib.GameTheory.CostGame.extRegretMatchingDynamics {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) :
ℕ → (i : ι) → S i → ℝ

Coupled horizon-free Blackwell external regret-matching dynamics ([HMC00] §4(c), eqs. (4.2a)–(4.2b), Theorem B, p. 1139): in round t, each player i runs regretMatchingProb against its realized expected cost vectors from rounds < t.

Each player in extRegretMatchingDynamics runs the single-learner regretMatchingProb against its realized expected cost sequence.

theorem Cslib.GameTheory.CostGame.extRegretMatchingDynamics_nonneg {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) (t : ℕ) (i : ι) (a : S i) :
theorem Cslib.GameTheory.CostGame.sum_extRegretMatchingDynamics {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) [∀ (i : ι), Nonempty (S i)] (t : ℕ) (i : ι) :
∑ a : S i, G.extRegretMatchingDynamics t i a = 1
noncomputable def Cslib.GameTheory.CostGame.extRegretMatchingDist {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) [∀ (i : ι), Nonempty (S i)] (t : ℕ) :
Convexity.StdSimplex ℝ ((i : ι) → S i)

Outcome distribution in round t of extRegretMatchingDynamics.

noncomputable def Cslib.GameTheory.CostGame.intRegretMatchingDynamics {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) [(i : ι) → DecidableEq (S i)] :
ℕ → (i : ι) → S i → ℝ

Coupled horizon-free Hart–Mas-Colell stationary internal regret-matching dynamics ([HMC00] §3, eq. (3.1), Theorem A and Corollary, pp. 1133–1134): in round t, each player i runs internalRegretMatchingProb against its realized expected cost vectors from rounds < t.

Each player in intRegretMatchingDynamics runs the single-learner internalRegretMatchingProb against its realized expected cost sequence.

theorem Cslib.GameTheory.CostGame.intRegretMatchingDynamics_nonneg {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) [(i : ι) → DecidableEq (S i)] [∀ (i : ι), Nonempty (S i)] (t : ℕ) (i : ι) (a : S i) :
theorem Cslib.GameTheory.CostGame.sum_intRegretMatchingDynamics {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) [(i : ι) → DecidableEq (S i)] [∀ (i : ι), Nonempty (S i)] (t : ℕ) (i : ι) :
∑ a : S i, G.intRegretMatchingDynamics t i a = 1
noncomputable def Cslib.GameTheory.CostGame.intRegretMatchingDist {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] (G : CostGame ι S) [(i : ι) → DecidableEq (S i)] [∀ (i : ι), Nonempty (S i)] (t : ℕ) :
Convexity.StdSimplex ℝ ((i : ι) → S i)

Outcome distribution in round t of intRegretMatchingDynamics.

theorem Cslib.GameTheory.CostGame.extRegretMatching_isApproxCoarseCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] {G : CostGame ι S} [∀ (i : ι), Nonempty (S i)] {M : ℝ} (hM : 0 ≤ M) (hc : ∀ (i : ι) (s : (i : ι) → S i), |G.cost i s| ≤ M) {T : ℕ} (hT : 0 < T) :
G.IsApproxCoarseCorrelatedEquilibrium (fun (i : ι) => 2 * M * √(↑(Fintype.card (S i)) / ↑T)) (timeAverage G.extRegretMatchingDist T hT)

Anytime O(1 / √T) convergence of external regret-matching to ε-CCE ([HMC00] §4(c), Theorem B, p. 1139): if game costs satisfy |G.cost i s| ≤ M (0 ≤ M), then at every horizon T > 0 (without any lower bound on T), the time average of extRegretMatchingDist is a (fun i => 2 * M * √(|S i| / T))-approximate coarse correlated equilibrium.

theorem Cslib.GameTheory.CostGame.intRegretMatching_isApproxInternalCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] {G : CostGame ι S} [(i : ι) → DecidableEq (S i)] [∀ (i : ι), Nonempty (S i)] {M : ℝ} (hM : 0 ≤ M) (hc : ∀ (i : ι) (s : (i : ι) → S i), |G.cost i s| ≤ M) {T : ℕ} (hT : 0 < T) :
G.IsApproxInternalCorrelatedEquilibrium (fun (i : ι) => 2 * M * √(↑(Fintype.card (S i) - 1) / ↑T)) (timeAverage G.intRegretMatchingDist T hT)

Quantitative Theorem A and Corollary of [HMC00] (§3, pp. 1133–1134, 1138): if |G.cost i s| ≤ M (0 ≤ M), then at every horizon T > 0, the time average of intRegretMatchingDist is a (fun i => 2 * M * √((|S i| - 1) / T)) pairwise correlated ε-equilibrium.

theorem Cslib.GameTheory.CostGame.intRegretMatching_isApproxCorrelatedEquilibrium {ι : Type u_1} {S : ι → Type u_2} [DecidableEq ι] [Fintype ι] [(i : ι) → Fintype (S i)] {G : CostGame ι S} [(i : ι) → DecidableEq (S i)] [∀ (i : ι), Nonempty (S i)] {M : ℝ} (hM : 0 ≤ M) (hc : ∀ (i : ι) (s : (i : ι) → S i), |G.cost i s| ≤ M) {T : ℕ} (hT : 0 < T) :
G.IsApproxCorrelatedEquilibrium (fun (i : ι) => 2 * M * √(↑(Fintype.card (S i)) * ↑(Fintype.card (S i) - 1) / ↑T)) (timeAverage G.intRegretMatchingDist T hT)

Anytime O(1 / √T) convergence of Hart–Mas-Colell stationary regret-matching to ε-CE (full swap-regret correlated equilibrium, [BM07b] Definition 4.11 & Theorem 4.12): if |G.cost i s| ≤ M (0 ≤ M), then at every horizon T > 0, the time average of intRegretMatchingDist is a (fun i => 2 * M * √(|S i| * (|S i| - 1) / T))-approximate correlated equilibrium.