Documentation

CslibFrontier.GameTheory.PredictionMarket.OrderMatching

Compound Prediction Market Order Matching and coNP-Completeness #

This module formalizes compound conditional securities, indivisible and divisible order matching, the linear-programming and small-support Farkas dual characterizations, and the native coNP-completeness of divisible compound order matching from [PennockSami2007, §26.3–§26.3.1, pp. 658–661].

Model and conventions #

Base events are indexed by natural numbers (ℕ), so a state of the world is a Boolean assignment ω : ℕ → Bool. Following the library's canonical SAT representation (Cslib.Logic.PL.CNF ℕ, Cslib.Complexity.encCNF), each conditional security S_{φ|ψ} in a CompoundOrder specifies an event formula φ : CNF ℕ and a conditioning formula ψ : CNF ℕ (with [] : CNF ℕ representing the unconditional tautology ⊤), together with rational quantity q : ℚ (q > 0 for a buy order, q < 0 for a sell order) and rational unit limit price p : ℚ.

Theorem 26.6(i) and Theorem 26.6(ii) #

Main definitions #

Main results #

References #

Compound conditional orders and payoffs (§26.3.1.1–26.3.1.2, pp. 659–660) #

A compound conditional order "quantity units of security S_{event | condition} at unit limit price price" [PennockSami2007, §26.3.1.1, p. 659]. Positive quantity represents a buy order and negative quantity represents a sell order; condition = [] represents the unconditional tautology ⊤.

  • quantity : ℚ

    Signed order quantity q (q > 0 buy, q < 0 sell).

  • price : ℚ

    Unit limit price p.

  • Event formula φ paying $1 when satisfied under condition.

  • condition : Logic.PL.CNF ℕ

    Conditioning formula ψ (the order is cancelled and refunded if ψ is false).

Instances For
    theorem Cslib.GameTheory.PredictionMarket.CompoundOrder.ext {x y : CompoundOrder} (quantity : x.quantity = y.quantity) (price : x.price = y.price) (event : x.event = y.event) (condition : x.condition = y.condition) :
    x = y
    theorem Cslib.GameTheory.PredictionMarket.encCompoundOrder_condition_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CompoundOrder} :

    Framed encRat (quantity), framed encRat (price), framed encCNF (event), and encCNF (condition), encoding CompoundOrder.

    theorem Cslib.GameTheory.PredictionMarket.encCompoundOrder_event_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CompoundOrder} :
    theorem Cslib.GameTheory.PredictionMarket.encCompoundOrder_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → ℚ} {T0 S0 : γ → ℕ} {x1 : γ → ℚ} {T1 S1 : γ → ℕ} {x2 : γ → Logic.PL.CNF ℕ} {T2 S2 : γ → ℕ} {x3 : γ → Logic.PL.CNF ℕ} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encRat T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encRat T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Complexity.encCNF T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Complexity.encCNF T3 S3) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { quantity := x0 x, price := x1 x, event := x2 x, condition := x3 x }) encIn encCompoundOrder (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
    theorem Cslib.GameTheory.PredictionMarket.encCompoundOrder_quantity_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CompoundOrder} :
    theorem Cslib.GameTheory.PredictionMarket.encCompoundOrder_price_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CompoundOrder} :
    theorem Cslib.GameTheory.PredictionMarket.encCompoundOrder_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 : γ → ℚ} {x2 x3 : γ → Logic.PL.CNF ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encRat budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encRat budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Complexity.encCNF budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Complexity.encCNF budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { quantity := x0 x, price := x1 x, event := x2 x, condition := x3 x }) encIn encCompoundOrder budget
    @[reducible, inline]

    Encoded list of compound orders: encList encCompoundOrder.

    Trader payoff ϒ^ω = q · 1_{ω ∈ ψ} · (1_{ω ∈ φ} - p) of compound order o in state ω [PennockSami2007, §26.3.1.1, p. 659].

    Auctioneer payoff (surplus) ϒ_auc^ω = ∑ i, -(α i) * ϒ_i^ω under acceptance vector α in state ω [PennockSami2007, §26.3.1.2, p. 659].

    Indivisible matching problem [PennockSami2007, Definition 26.3, p. 659]: there exist α_i ∈ {0, 1}, not all zero, such that the auctioneer never loses money in any state ω.

    Divisible matching problem [PennockSami2007, Definition 26.5, p. 660]: there exist α_i ∈ [0, 1], not all zero, such that the auctioneer never loses money in any state ω.

    Divisible matching restricted to a finite set S of states: the auctioneer breaks even on every state ω ∈ S.

    Decision problem Divisible Compound Order Matching [PennockSami2007, Definition 26.5 & Theorem 26.6, pp. 660–661]: lists of compound orders admitting a divisible match.

    Linear-programming characterizations (Theorem 26.6(i), pp. 660–661) #

    theorem Cslib.GameTheory.PredictionMarket.hasDivisibleMatch_iff_exists_pos_sum (O : List CompoundOrder) :
    HasDivisibleMatch O ↔ ∃ (α : Fin O.length → ℝ), (∀ (i : Fin O.length), 0 ≤ α i ∧ α i ≤ 1) ∧ (∀ (ω : ℕ → Bool), 0 ≤ auctioneerPayoff O α ω) ∧ 0 < ∑ i : Fin O.length, α i

    LP objective equivalence [PennockSami2007, Theorem 26.6(i) proof, pp. 660–661]: HasDivisibleMatch O holds if and only if the linear program 0 ≤ α i ≤ 1, ∀ ω, 0 ≤ auctioneerPayoff O α ω attains a strictly positive total volume 0 < ∑ i, α i.

    theorem Cslib.GameTheory.PredictionMarket.hasDivisibleMatch_iff_exists_unit_sum (O : List CompoundOrder) :
    HasDivisibleMatch O ↔ ∃ (α : Fin O.length → ℝ), (∀ (i : Fin O.length), 0 ≤ α i) ∧ ∑ i : Fin O.length, α i = 1 ∧ ∀ (ω : ℕ → Bool), 0 ≤ auctioneerPayoff O α ω

    Simplex-normalized LP feasibility equivalence: by homogeneity of auctioneerPayoff, HasDivisibleMatch O holds if and only if there exists a probability vector α ≥ 0 with ∑ i, α i = 1 and ∀ ω, 0 ≤ auctioneerPayoff O α ω.

    Finite-variable projection, Farkas duality, and small integer certificates #

    All variable occurrences across all event and conditioning formulas of O.

    Assignment described by a certificate bit-list bits along the variable occurrences orderVars O (analogous to SAT.assignment).

    Integer-scaled trader payoff (q.den * p.den) * orderPayoff o ω, avoiding rational division during certificate verification.

    theorem Cslib.GameTheory.PredictionMarket.orderPayoff_congr {o : CompoundOrder} {ω₁ ω₂ : ℕ → Bool} (h : ∀ v ∈ o.event.vars ++ o.condition.vars, ω₁ v = ω₂ v) :
    orderPayoff o ω₁ = orderPayoff o ω₂

    Small-support Farkas & subset-infeasibility characterizations (p. 661) #

    theorem Cslib.GameTheory.PredictionMarket.not_hasDivisibleMatch_iff_exists_small_farkas (O : List CompoundOrder) :
    ¬HasDivisibleMatch O ↔ ∃ (S : Finset (ℕ → Bool)) (w : (ℕ → Bool) → ℚ), S.card ≤ O.length ∧ (∀ ω ∈ S, 0 ≤ w ω) ∧ ∀ (i : Fin O.length), 0 < ∑ ω ∈ S, ↑(w ω) * orderPayoff O[i] ω

    Small-support rational Farkas certificate [PennockSami2007, Theorem 26.6(ii) proof, p. 661]: a list of m = O.length compound orders admits no divisible match if and only if there exist at most m states S (hence S.card ≤ m + 1) and nonnegative rational weights w : (ℕ → Bool) → ℚ such that every order has strictly positive weighted payoff on S.

    Small-constraint infeasibility characterization [PennockSami2007, Theorem 26.6(ii) proof, p. 661]: no divisible match exists for m = O.length orders if and only if there exists a subset S of at most m states (hence at most m + 1 state constraints) that already forbids every divisible match (¬ HasDivisibleMatchOn O S).

    Native coNP-membership of DivisibleOrderMatching (Theorem 26.6(ii) upper bound) #

    Divisible compound order matching belongs to coNP [PennockSami2007, Theorem 26.6(ii), pp. 660–661]: every non-matchable order list has a polynomial-size integer Farkas certificate supported on at most O.length states, verified natively in polynomial time on multi-tape Turing machines.

    Native coNP-hardness and coNP-completeness (Theorem 26.6(ii), p. 661) #

    Divisible compound order matching is coNP-hard [PennockSami2007, Theorem 26.6(ii), pp. 660–661].

    Theorem 26.6(ii) ([PennockSami2007, pp. 660–661]): the divisible order-matching problem for compound conditional securities with unlimited base events is coNP-complete.