Documentation

CslibFrontier.GameTheory.PredictionMarket.QSR

General Market Scoring Rule Duality and the Quadratic Market Scoring Rule (QSR) #

This module formalizes two results from [PennockSami2007, §26.4.1, pp. 663–664] and [Han03]:

  1. General equivalence between cost-function market makers and sequential shared proper scoring rules: given any proper scoring rule S on a domain P ⊆ probSimplex Ω, its Fenchel-conjugate cost function msrCost S P q = sSup { r ⬝ᵥ q - S.expectedScore r r | r ∈ P } evaluates exactly to c on every share vector of the form q ω = S.score p ω + c (p ∈ P), satisfies q ω - msrCost S P q = S.score p ω, obeys the first-order subgradient (no-arbitrage) inequality, and yields pointwise and sequential trading payoffs identical to Hanson's sequential shared scoring rule msrStepPayoff S / msrTotalPayoff S.

  2. Hanson's Quadratic Market Scoring Rule (QSR) [PennockSami2007, §26.4.1, p. 664]: the cost function

    qsrCost b q = (∑ j, q j) / |Ω| + (∑ j, q j ^ 2) / (4 * b) - (∑ j, q j) ^ 2 / (4 * b * |Ω|) - b / |Ω|

    has gradient qsrPrice b q ω = 1 / |Ω| + q ω / (2 * b) - (∑ j, q j) / (2 * b * |Ω|), global convexity (via an exact squared-Euclidean Bregman divergence identity), exact equivalence with the b-scaled quadratic market scoring rule ((quadraticScore Ω).affine b 0) (coinciding on qsrValidDomain b with msrCost), and tight worst-case market-maker loss b * (1 - 1 / |Ω|). Unlike LMSR, QSR enforces finite per-security buy limits: every valid share vector satisfies q k - q j ≤ 2 * b, from zero shares at most 2 * b units of any single security can be bought, and once any outcome reaches price 0 (in particular, once any security hits its upper limit qsrPrice b q k = 1 when 3 ≤ |Ω|), no positive single-security purchase of another security remains in the valid simplex domain [PennockSami2007, §26.4.1, p. 664].

Main definitions #

Main results #

References #

def Cslib.GameTheory.PredictionMarket.costMarketPayoff {Ω : Type u_1} (C : (Ω → ℝ) → ℝ) (q₁ q₂ : Ω → ℝ) (ω : Ω) :

Net payoff (q₂ ω - q₁ ω) - (C q₂ - C q₁) to a trader moving a cost-function market maker C from share vector q₁ to q₂ when outcome ω realizes (equally the market maker's net loss on that trade) [PennockSami2007, §26.4.1, p. 663].

@[simp]
theorem Cslib.GameTheory.PredictionMarket.costMarketPayoff_apply {Ω : Type u_1} (C : (Ω → ℝ) → ℝ) (q₁ q₂ : Ω → ℝ) (ω : Ω) :
costMarketPayoff C q₁ q₂ ω = q₂ ω - q₁ ω - (C q₂ - C q₁)
theorem Cslib.GameTheory.PredictionMarket.sum_costMarketPayoff_eq_endpoints {Ω : Type u_1} (C : (Ω → ℝ) → ℝ) (qs : ℕ → Ω → ℝ) (T : ℕ) (ω : Ω) :
∑ t ∈ Finset.range T, costMarketPayoff C (qs t) (qs (t + 1)) ω = costMarketPayoff C (qs 0) (qs T) ω

Path independence of any cost-function market maker: cumulative net payoff across any sequence of share updates qs 0, …, qs T depends only on the endpoints qs 0 and qs T.

noncomputable def Cslib.GameTheory.PredictionMarket.msrCost {Ω : Type u_1} [Fintype Ω] (S : ScoringRule Ω) (P : Set (Ω → ℝ)) (q : Ω → ℝ) :

The Fenchel-conjugate cost function associated with a scoring rule S on a domain P ⊆ probSimplex Ω: C(q) = sup_{r ∈ P} (r ⬝ᵥ q - S.expectedScore r r) [Hanson2003; PennockSami2007, §26.4.1, p. 664].

theorem Cslib.GameTheory.PredictionMarket.msrCost_score_add_const {Ω : Type u_1} [Fintype Ω] {S : ScoringRule Ω} {P : Set (Ω → ℝ)} (hP : P ⊆ probSimplex Ω) (hS : S.IsProperOn P) {p : Ω → ℝ} (hp : p ∈ P) (c : ℝ) :
(msrCost S P fun (ω : Ω) => S.score p ω + c) = c

For any proper scoring rule S on P ⊆ probSimplex Ω, the dual cost function evaluates exactly to c on every shifted score vector ω ↦ S.score p ω + c (p ∈ P).

theorem Cslib.GameTheory.PredictionMarket.msrCost_subgradient_le {Ω : Type u_1} [Fintype Ω] {S : ScoringRule Ω} {P : Set (Ω → ℝ)} (hP : P ⊆ probSimplex Ω) (hS : S.IsProperOn P) {p₁ : Ω → ℝ} (hp₁ : p₁ ∈ P) (c₁ : ℝ) {q₂ : Ω → ℝ} (hbdd : BddAbove {v : ℝ | ∃ r ∈ P, v = r ⬝ᵥ q₂ - S.expectedScore r r}) :
(msrCost S P fun (ω : Ω) => S.score p₁ ω + c₁) + (q₂ - fun (ω : Ω) => S.score p₁ ω + c₁) ⬝ᵥ p₁ ≤ msrCost S P q₂

Subgradient (no-arbitrage) inequality for msrCost S P at every realized share vector q₁ = S.score p₁ + c₁.

theorem Cslib.GameTheory.PredictionMarket.costMarketPayoff_msrCost_eq_msrStepPayoff {Ω : Type u_1} [Fintype Ω] {S : ScoringRule Ω} {P : Set (Ω → ℝ)} (hP : P ⊆ probSimplex Ω) (hS : S.IsProperOn P) {p₁ p₂ : Ω → ℝ} (hp₁ : p₁ ∈ P) (hp₂ : p₂ ∈ P) (c₁ c₂ : ℝ) (ω : Ω) :
costMarketPayoff (msrCost S P) (fun (i : Ω) => S.score p₁ i + c₁) (fun (i : Ω) => S.score p₂ i + c₂) ω = msrStepPayoff S p₁ p₂ ω

General single-step cost-function / MSR equivalence [PennockSami2007, §26.4.1, p. 664; Hanson2003]: for any proper scoring rule S on P ⊆ probSimplex Ω, moving msrCost S P between share vectors S.score p₁ + c₁ and S.score p₂ + c₂ yields net payoff identically equal to msrStepPayoff S p₁ p₂ ω.

theorem Cslib.GameTheory.PredictionMarket.exists_shares_costMarketPayoff_msrCost_eq {Ω : Type u_1} [Fintype Ω] {S : ScoringRule Ω} {P : Set (Ω → ℝ)} (hP : P ⊆ probSimplex Ω) (hS : S.IsProperOn P) {ps : ℕ → Ω → ℝ} (hps : ∀ (t : ℕ), ps t ∈ P) :
∃ (qs : ℕ → Ω → ℝ), (∀ (t : ℕ) (ω : Ω), costMarketPayoff (msrCost S P) (qs t) (qs (t + 1)) ω = msrStepPayoff S (ps t) (ps (t + 1)) ω) ∧ ∀ (T : ℕ) (ω : Ω), ∑ t ∈ Finset.range T, costMarketPayoff (msrCost S P) (qs t) (qs (t + 1)) ω = msrTotalPayoff S ps T ω

General sequential realizability of any proper MSR as a cost-function market maker [PennockSami2007, §26.4.1, p. 664; Hanson2003]: every sequence of probability reports ps in P is realized by share vectors qs t = S.score (ps t) under msrCost S P with identical step-by-step and cumulative payoffs.

noncomputable def Cslib.GameTheory.PredictionMarket.qsrCost {Ω : Type u_1} [Fintype Ω] (b : ℝ) (q : Ω → ℝ) :

Hanson's Quadratic Market Scoring Rule (QSR) cost function with liquidity parameter b: C(q) = (∑ j, q j) / |Ω| + (∑ j, q j ^ 2) / (4 * b) - (∑ j, q j) ^ 2 / (4 * b * |Ω|) - b / |Ω| [PennockSami2007, §26.4.1, p. 664].

noncomputable def Cslib.GameTheory.PredictionMarket.qsrPrice {Ω : Type u_1} [Fintype Ω] (b : ℝ) (q : Ω → ℝ) (ω : Ω) :

Instantaneous QSR price vector ∂C / ∂q_ω: p_ω(q) = 1 / |Ω| + q ω / (2 * b) - (∑ j, q j) / (2 * b * |Ω|) [PennockSami2007, §26.4.1, p. 664].

Valid QSR share-vector domain: share vectors q whose instantaneous QSR prices form a probability distribution in probSimplex Ω [PennockSami2007, §26.4.1, p. 664].

@[simp]
theorem Cslib.GameTheory.PredictionMarket.qsrCost_apply {Ω : Type u_1} [Fintype Ω] (b : ℝ) (q : Ω → ℝ) :
qsrCost b q = (∑ j : Ω, q j) / ↑(Fintype.card Ω) + (∑ j : Ω, q j ^ 2) / (4 * b) - (∑ j : Ω, q j) ^ 2 / (4 * b * ↑(Fintype.card Ω)) - b / ↑(Fintype.card Ω)
@[simp]
theorem Cslib.GameTheory.PredictionMarket.qsrPrice_apply {Ω : Type u_1} [Fintype Ω] (b : ℝ) (q : Ω → ℝ) (ω : Ω) :
qsrPrice b q ω = 1 / ↑(Fintype.card Ω) + q ω / (2 * b) - (∑ j : Ω, q j) / (2 * b * ↑(Fintype.card Ω))
theorem Cslib.GameTheory.PredictionMarket.sum_qsrPrice {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q : Ω → ℝ) :
∑ ω : Ω, qsrPrice b q ω = 1

Instantaneous QSR prices always sum to 1 for any b ≠ 0 and nonempty Ω.

theorem Cslib.GameTheory.PredictionMarket.mem_qsrValidDomain_iff {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) {q : Ω → ℝ} :
q ∈ qsrValidDomain b ↔ ∀ (ω : Ω), 0 ≤ qsrPrice b q ω

A share vector q lies in qsrValidDomain b if and only if every instantaneous QSR price is nonnegative.

theorem Cslib.GameTheory.PredictionMarket.qsrPrice_zero {Ω : Type u_1} [Fintype Ω] (b : ℝ) (ω : Ω) :
qsrPrice b 0 ω = (↑(Fintype.card Ω))⁻¹

At zero shares, QSR prices are uniform over Ω.

Zero shares lie in the valid QSR domain whenever b ≠ 0.

At zero shares, the QSR cost equals -b / |Ω|.

theorem Cslib.GameTheory.PredictionMarket.qsrPrice_add_const {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q : Ω → ℝ) (c : ℝ) :
(qsrPrice b fun (ω : Ω) => q ω + c) = qsrPrice b q

Translation invariance of qsrPrice: adding a constant share bundle leaves QSR prices unchanged.

theorem Cslib.GameTheory.PredictionMarket.qsrCost_add_const {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q : Ω → ℝ) (c : ℝ) :
(qsrCost b fun (ω : Ω) => q ω + c) = qsrCost b q + c

Translation equivariance of qsrCost: adding c shares of every outcome increases the QSR cost by exactly c (no-arbitrage for risk-free constant bundles).

theorem Cslib.GameTheory.PredictionMarket.qsrPrice_of_prob {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) {p : Ω → ℝ} (hp : ∑ ω : Ω, p ω = 1) :
(qsrPrice b fun (ω : Ω) => 2 * b * (p ω - 1 / ↑(Fintype.card Ω))) = p

Inversion of QSR prices: for any p summing to 1, the share vector ω ↦ 2 * b * (p ω - 1 / |Ω|) induces instantaneous QSR price vector p.

Gradient, Bregman identity, and global convexity of QSR #

theorem Cslib.GameTheory.PredictionMarket.hasFDerivAt_qsrCost {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q : Ω → ℝ) :

Gradient identity for QSR [PennockSami2007, §26.4.1, p. 664]: the Fréchet derivative of qsrCost b at q is v ↦ v ⬝ᵥ qsrPrice b q.

theorem Cslib.GameTheory.PredictionMarket.hasDerivAt_qsrCost_update {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] [DecidableEq Ω] {b : ℝ} (hb : b ≠ 0) (q : Ω → ℝ) (ω : Ω) :
HasDerivAt (fun (t : ℝ) => qsrCost b (Function.update q ω t)) (qsrPrice b q ω) (q ω)

Coordinate partial derivative of qsrCost b: ∂C / ∂q_ω = qsrPrice b q ω [PennockSami2007, §26.4.1, p. 664].

theorem Cslib.GameTheory.PredictionMarket.sub_qsrCost_eq_mul_quadraticScore {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q : Ω → ℝ) (ω : Ω) :
q ω - qsrCost b q = b * (quadraticScore Ω).score (qsrPrice b q) ω

Fundamental QSR identity: q ω - C(q) = b * (quadraticScore Ω).score (qsrPrice b q) ω [PennockSami2007, §26.4.1, p. 664].

theorem Cslib.GameTheory.PredictionMarket.qsrCost_bregmanDivergence_eq {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q₁ q₂ : Ω → ℝ) :
bregmanDivergence (qsrCost b) (qsrPrice b) q₂ q₁ = b * ∑ ω : Ω, (qsrPrice b q₂ ω - qsrPrice b q₁ ω) ^ 2

Exact Bregman divergence identity for QSR (original mathematical companion): the Bregman divergence bregmanDivergence (qsrCost b) (qsrPrice b) q₂ q₁ equals b times the squared Euclidean distance between the induced QSR price vectors qsrPrice b q₂ and qsrPrice b q₁.

theorem Cslib.GameTheory.PredictionMarket.qsrCost_subgradient_le {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : 0 < b) (q₁ q₂ : Ω → ℝ) :
qsrCost b q₁ + (q₂ - q₁) ⬝ᵥ qsrPrice b q₁ ≤ qsrCost b q₂

First-order subgradient inequality for qsrCost b: every trade costs at least its instantaneous price valuation (q₂ - q₁) ⬝ᵥ qsrPrice b q₁.

Global convexity of qsrCost b on ℝ^Ω (original mathematical companion deduced from qsrCost_subgradient_le and convexOn_of_forall_add_le).

Equivalence with the quadratic market scoring rule and worst-case loss #

theorem Cslib.GameTheory.PredictionMarket.qsrTraderPayoff_eq_msrStepPayoff {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (q₁ q₂ : Ω → ℝ) (ω : Ω) :
costMarketPayoff (qsrCost b) q₁ q₂ ω = msrStepPayoff ((quadraticScore Ω).affine b 0) (qsrPrice b q₁) (qsrPrice b q₂) ω

Single-step QSR / MSR equivalence [PennockSami2007, §26.4.1, p. 664]: the net payoff of moving qsrCost b from q₁ to q₂ equals the payoff of updating the b-scaled quadratic market scoring rule from qsrPrice b q₁ to qsrPrice b q₂.

theorem Cslib.GameTheory.PredictionMarket.sum_qsrTraderPayoff_eq_msrTotalPayoff {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) (qs : ℕ → Ω → ℝ) (T : ℕ) (ω : Ω) :
∑ t ∈ Finset.range T, costMarketPayoff (qsrCost b) (qs t) (qs (t + 1)) ω = msrTotalPayoff ((quadraticScore Ω).affine b 0) (fun (t : ℕ) => qsrPrice b (qs t)) T ω

Sequential QSR / MSR equivalence [PennockSami2007, §26.4.1, p. 664]: across any finite sequence of share updates qs 0, …, qs T, cumulative QSR trading payoffs equal cumulative quadratic MSR payoffs.

theorem Cslib.GameTheory.PredictionMarket.exists_shares_qsrTraderPayoff_eq_msrStepPayoff {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : b ≠ 0) {ps : ℕ → Ω → ℝ} (hps : ∀ (t : ℕ), ps t ∈ probSimplex Ω) :
∃ (qs : ℕ → Ω → ℝ), (∀ (t : ℕ), qs t ∈ qsrValidDomain b ∧ qsrPrice b (qs t) = ps t) ∧ ∀ (t : ℕ) (ω : Ω), costMarketPayoff (qsrCost b) (qs t) (qs (t + 1)) ω = msrStepPayoff ((quadraticScore Ω).affine b 0) (ps t) (ps (t + 1)) ω

Realizability of any sequential quadratic MSR trajectory on the closed simplex [PennockSami2007, §26.4.1, p. 664]: every sequence of probability distributions ps in probSimplex Ω is realized by explicit share vectors in qsrValidDomain b with identical prices and identical step-by-step payoffs.

theorem Cslib.GameTheory.PredictionMarket.qsrCost_eq_msrCost {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : 0 < b) {q : Ω → ℝ} (hq : q ∈ qsrValidDomain b) :

On qsrValidDomain b, the explicit quadratic cost function qsrCost b q coincides identically with the Fenchel-conjugate cost function msrCost ((quadraticScore Ω).affine b 0) (probSimplex Ω) [PennockSami2007, §26.4.1, p. 664].

theorem Cslib.GameTheory.PredictionMarket.qsrTraderPayoff_zero_le {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : 0 < b) {q : Ω → ℝ} (hq : q ∈ qsrValidDomain b) (ω : Ω) :
costMarketPayoff (qsrCost b) 0 q ω ≤ b * (1 - 1 / ↑(Fintype.card Ω))

Worst-case QSR market-maker loss bound [PennockSami2007, §26.4.1, p. 664]: starting from zero shares (q₀ = 0, uniform initial prices), for every valid final share vector q ∈ qsrValidDomain b and every outcome ω, the market maker loses at most b * (1 - 1 / |Ω|).

theorem Cslib.GameTheory.PredictionMarket.exists_qsrTraderPayoff_zero_eq {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] {b : ℝ} (hb : 0 < b) (ω : Ω) :
∃ q ∈ qsrValidDomain b, costMarketPayoff (qsrCost b) 0 q ω = b * (1 - 1 / ↑(Fintype.card Ω))

Tightness of the QSR worst-case loss bound: for every outcome ω, the bound b * (1 - 1 / |Ω|) is attained with equality by a valid share vector q ∈ qsrValidDomain b.

Finite purchase bounds and buy-limit saturation (§26.4.1, p. 664) #

theorem Cslib.GameTheory.PredictionMarket.qsrValidDomain_sub_le {Ω : Type u_1} [Fintype Ω] {b : ℝ} (hb : 0 < b) {q : Ω → ℝ} (hq : q ∈ qsrValidDomain b) (j k : Ω) :
q k - q j ≤ 2 * b

Bounded share spread in QSR [PennockSami2007, §26.4.1, p. 664]: for any valid QSR share vector q ∈ qsrValidDomain b (0 < b), no outcome can exceed any other outcome's share count by more than 2 * b.

theorem Cslib.GameTheory.PredictionMarket.qsrValidDomain_single_iff {Ω : Type u_1} [Fintype Ω] [DecidableEq Ω] {b : ℝ} (hb : 0 < b) (hcard : 2 ≤ Fintype.card Ω) (ω : Ω) (δ : ℝ) :
Pi.single ω δ ∈ qsrValidDomain b ↔ -(2 * b / (↑(Fintype.card Ω) - 1)) ≤ δ ∧ δ ≤ 2 * b

Exact single-security purchase limit from zero shares [PennockSami2007, §26.4.1, p. 664]: when 2 ≤ |Ω| and 0 < b, buying δ shares of a single outcome ω starting from q = 0 remains in qsrValidDomain b if and only if -2 * b / (|Ω| - 1) ≤ δ ≤ 2 * b.

theorem Cslib.GameTheory.PredictionMarket.not_mem_qsrValidDomain_add_single_of_price_eq_zero {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] [DecidableEq Ω] {b : ℝ} (hb : 0 < b) {q : Ω → ℝ} {i j : Ω} (hij : j ≠ i) (hpj : qsrPrice b q j = 0) {δ : ℝ} (hδ : 0 < δ) :

Upper-limit buy-blocking in QSR [PennockSami2007, §26.4.1, p. 664]: whenever any outcome j has reached zero price qsrPrice b q j = 0, buying any positive quantity δ > 0 of any other outcome i ≠ j pushes outcome j's price strictly below zero and exits qsrValidDomain b.

theorem Cslib.GameTheory.PredictionMarket.not_mem_qsrValidDomain_add_single_of_price_eq_one {Ω : Type u_1} [Fintype Ω] [DecidableEq Ω] {b : ℝ} (hb : 0 < b) (hcard : 3 ≤ Fintype.card Ω) {q : Ω → ℝ} (hq : q ∈ qsrValidDomain b) {k : Ω} (hpk : qsrPrice b q k = 1) (i : Ω) {δ : ℝ} (hδ : 0 < δ) :

Complete buy freeze at an upper limit for |Ω| ≥ 3 [PennockSami2007, §26.4.1, p. 664]: once any security k reaches price 1 (so every other security has price 0), the QSR market maker cannot accept a positive single-security purchase of any security i : Ω.