Documentation

CslibFrontier.GameTheory.Market.BalancedFlow

Equality networks, tight sets, balanced flows, and rational equilibria in linear Fisher markets #

This module formalizes the combinatorial network-flow infrastructure of the Devanur–Papadimitriou– Saberi–Vazirani (DPSV) algorithm for linear Fisher markets ([Vaz07], Chapter 5):

The full DPSV phase loop, potential drop analysis, and polynomial max-flow termination theorem ([Vaz07], Sections 5.8 and 5.10, Theorem 5.22) are formalized in CslibFrontier.GameTheory.Market.DPSVAlgorithm.

References #

Bipartite flow-network vertices and generic RealFlow bridge #

inductive Cslib.GameTheory.Market.LinearFisherMarket.FlowVertex (I : Type u_1) (G : Type u_2) :
Type (max u_1 u_2)

Vertices of the bipartite money-flow network N(p) ([Vaz07], Section 5.3.1, p. 108): source source, goods good g, buyers buyer i, and sink sink.

Instances For
    @[instance_reducible]
    def Cslib.GameTheory.Market.LinearFisherMarket.instDecidableEqFlowVertex.decEq {I✝ : Type u_1} {G✝ : Type u_2} [DecidableEq I✝] [DecidableEq G✝] (x✝ x✝¹ : FlowVertex I✝ G✝) :
    Decidable (x✝ = x✝¹)
    def Cslib.GameTheory.Market.LinearFisherMarket.ofRealFlow {I : Type u_1} {G : Type u_2} (F : FlowVertex I G × FlowVertex I G → ℝ) (g : G) (i : I) :

    Extract the bipartite money flow g i ↦ F (.good g, .buyer i) from a RealFlow F.

    Section 5.3: Equality subgraph, network N(p), and Lemma 5.2 #

    def Cslib.GameTheory.Market.LinearFisherMarket.IsEqualityEdge {I : Type u_1} {G : Type u_2} (M : LinearFisherMarket I G) (p : G → ℝ) (i : I) (g : G) :

    An equality edge between buyer i and good g at prices p ([Vaz07], Section 5.3, p. 108): good g maximizes buyer i's bang-per-buck M.bangPerBuck p i g = M.utility i g / p g.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.isEqualityEdge_smul {I : Type u_1} {G : Type u_2} {M : LinearFisherMarket I G} {p : G → ℝ} {c : ℝ} (hc : 0 < c) (i : I) (g : G) :
    M.IsEqualityEdge (c • p) i g ↔ M.IsEqualityEdge p i g
    theorem Cslib.GameTheory.Market.LinearFisherMarket.utility_pos_of_isEqualityEdge {I : Type u_1} {G : Type u_2} {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 < p g) {i : I} (hbuyer : ∃ (g : G), 0 < M.utility i g) {g : G} (he : M.IsEqualityEdge p i g) :
    0 < M.utility i g

    Under hbuyer : ∃ g, 0 < M.utility i g and positive prices hp, every equality edge incident to buyer i has strictly positive marginal utility.

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.equalityNetwork {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] (M : LinearFisherMarket I G) (p : G → ℝ) :
    FlowVertex I G → FlowVertex I G → ℝ

    The bipartite money-flow network N(p) ([Vaz07], Section 5.3.1, p. 108), with capacity p g * M.supply g on (.source, .good g), capacity M.budget i on (.buyer i, .sink), and a non-binding finite capacity ∑ g, p g * M.supply g + ∑ i, M.budget i + 1 on equality arcs (.good g, .buyer i). For unitSupply (M.supply g = 1), source arcs have capacity p g.

    def Cslib.GameTheory.Market.LinearFisherMarket.IsEqualityFlow {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] (M : LinearFisherMarket I G) (p : G → ℝ) (f : G → I → ℝ) :

    Feasible bipartite money flow f : G → I → ℝ in N(p): nonnegative, supported on equality edges, sending at most p g * M.supply g out of each good g, and sending at most M.budget i into each buyer i.

    def Cslib.GameTheory.Market.LinearFisherMarket.flowValue {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] (f : G → I → ℝ) :

    Total money value ∑ g, ∑ i, f g i routed by a bipartite money flow f.

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.moneyFlowToAlloc {I : Type u_1} {G : Type u_2} (f : G → I → ℝ) (p : G → ℝ) (i : I) (g : G) :

    Allocation x i g = f g i / p g induced by a bipartite money flow f in N(p) ([Vaz07], Section 5.3.1, p. 109).

    def Cslib.GameTheory.Market.LinearFisherMarket.IsMaxEqualityFlow {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] (M : LinearFisherMarket I G) (p : G → ℝ) (f : G → I → ℝ) :

    A bipartite equality flow f is a maximum equality flow in N(p) if it is feasible and maximizes flowValue over all feasible equality flows.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.equalityNetwork_nonneg {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) (u v : FlowVertex I G) :

    Lemma 5.2 (allocation recovery) ([Vaz07], Section 5.3.1, p. 109): if both cuts ({.source}, A ∪ B ∪ {.sink}) and ({.source} ∪ A ∪ B, {.sink}) are min-cuts in N(p) at positive prices p, then the allocation moneyFlowToAlloc (ofRealFlow F) p induced by any maximum flow F in N(p) is a market equilibrium allocation.

    Lemma 5.2 (equilibrium price test) ([Vaz07], Section 5.3.1, p. 109): positive prices p are equilibrium prices of a linear Fisher market (where every buyer desires some good and every good is desired by some buyer) if and only if both ({.source}, A ∪ B ∪ {.sink}) and ({.source} ∪ A ∪ B, {.sink}) are minimum s–t cuts in N(p).

    Section 5.6: Tight sets, the Invariant, Lemma 5.3, and the maximal tight set #

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.buyerNeighborhood {I : Type u_1} {G : Type u_2} [Fintype I] (M : LinearFisherMarket I G) (p : G → ℝ) (S : Finset G) :

    Equality-subgraph neighborhood Γ(S) of a set of goods S ⊆ G: buyers having an equality edge to at least one good in S ([Vaz07], Section 5.6, p. 111).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.mem_buyerNeighborhood {I : Type u_1} {G : Type u_2} [Fintype I] {M : LinearFisherMarket I G} {p : G → ℝ} {S : Finset G} {i : I} :
    i ∈ M.buyerNeighborhood p S ↔ ∃ g ∈ S, M.IsEqualityEdge p i g
    def Cslib.GameTheory.Market.LinearFisherMarket.goodValue {I : Type u_1} {G : Type u_2} (M : LinearFisherMarket I G) (p : G → ℝ) (S : Finset G) :

    Total money value ∑ g ∈ S, p g * M.supply g of the goods in S (∑ g ∈ S, p g for unit supply; [Vaz07], Section 5.6, p. 111).

    Total money budget ∑ i ∈ T, M.budget i of buyers in T ([Vaz07], Section 5.6, p. 111).

    def Cslib.GameTheory.Market.LinearFisherMarket.IsTightSet {I : Type u_1} {G : Type u_2} [Fintype I] (M : LinearFisherMarket I G) (p : G → ℝ) (S : Finset G) :

    A subset of goods S is a tight set at prices p if its total value equals the total budget of its equality-subgraph neighborhood Γ(S) ([Vaz07], Section 5.6, p. 111).

    The Invariant ([Vaz07], Section 5.6, p. 111): prices p satisfy the Invariant when the source cut ({.source}, A ∪ B ∪ {.sink}) is a minimum s–t cut in N(p).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.satisfiesInvariant_iff {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) :

    Lemma 5.3 ([Vaz07], Section 5.6, p. 111): for nonnegative prices p, N(p) satisfies the Invariant if and only if M.goodValue p S ≤ M.budgetSum (M.buyerNeighborhood p S) for every subset S of goods.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.isTightSet_union_and_inter {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) (hinv : M.SatisfiesInvariant p) {S₁ S₂ : Finset G} (h₁ : M.IsTightSet p S₁) (h₂ : M.IsTightSet p S₂) :
    M.IsTightSet p (S₁ ∪ S₂) ∧ M.IsTightSet p (S₁ ∩ S₂)

    Under the Invariant, tight sets are closed under union and intersection ([Vaz07], Section 5.8, p. 115).

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.maximalTightSet {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq G] (M : LinearFisherMarket I G) (p : G → ℝ) :

    The union of all tight sets at prices p ([Vaz07], Section 5.8, p. 115). Under SatisfiesInvariant M p, this is the unique maximal tight set.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.isTightSet_maximalTightSet {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) (hinv : M.SatisfiesInvariant p) :
    theorem Cslib.GameTheory.Market.LinearFisherMarket.subset_maximalTightSet {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} {S : Finset G} (hS : M.IsTightSet p S) :
    S ⊆ M.maximalTightSet p
    theorem Cslib.GameTheory.Market.LinearFisherMarket.IsMaxEqualityFlow.sum_buyer_eq {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) (hinv : M.SatisfiesInvariant p) {f : G → I → ℝ} (hf : M.IsMaxEqualityFlow p f) (g : G) :
    ∑ i : I, f g i = p g * M.supply g

    Under the Invariant (M.SatisfiesInvariant p) at nonnegative prices p, every maximum equality flow f in N(p) saturates every good (∑ i, f g i = p g * M.supply g).

    Section 5.7: Balanced flows, Lemma 5.4, and Theorem 5.5 #

    def Cslib.GameTheory.Market.LinearFisherMarket.surplus {I : Type u_1} {G : Type u_2} [Fintype G] (M : LinearFisherMarket I G) (f : G → I → ℝ) (i : I) :

    Buyer i's surplus money M.budget i - ∑ g, f g i under a bipartite money flow f ([Vaz07], Section 5.7, pp. 111–112).

    def Cslib.GameTheory.Market.LinearFisherMarket.surplusSqNorm {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] (M : LinearFisherMarket I G) (f : G → I → ℝ) :

    Squared ℓ₂ norm ∑ i, (M.surplus f i) ^ 2 of the surplus vector ([Vaz07], Section 5.5, p. 110; Section 5.7, p. 112). Minimizing surplusSqNorm is equivalent to minimizing the ℓ₂ norm √(surplusSqNorm).

    def Cslib.GameTheory.Market.LinearFisherMarket.IsBalancedFlow {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] (M : LinearFisherMarket I G) (p : G → ℝ) (f : G → I → ℝ) :

    A balanced flow in N(p) ([Vaz07], Section 5.7, p. 112): a feasible equality money flow minimizing surplusSqNorm M f (equivalently, the ℓ₂ norm of the surplus vector) over all feasible equality flows.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.isBalancedFlow_iff_sqrt {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} {p : G → ℝ} {f : G → I → ℝ} :
    M.IsBalancedFlow p f ↔ M.IsEqualityFlow p f ∧ ∀ (f' : G → I → ℝ), M.IsEqualityFlow p f' → √(M.surplusSqNorm f) ≤ √(M.surplusSqNorm f')

    Minimizing surplusSqNorm is equivalent to minimizing the Euclidean ℓ₂ norm Real.sqrt (surplusSqNorm).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.exists_isBalancedFlow {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) :
    ∃ (f : G → I → ℝ), M.IsBalancedFlow p f

    Existence of a balanced flow: for nonnegative prices p, N(p) always admits a balanced flow (compactness of the feasible polytope and continuity of surplusSqNorm).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.surplus_eq_of_isBalancedFlow {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} {p : G → ℝ} {f₁ f₂ : G → I → ℝ} (h₁ : M.IsBalancedFlow p f₁) (h₂ : M.IsBalancedFlow p f₂) :
    M.surplus f₁ = M.surplus f₂

    Lemma 5.4 ([Vaz07], Section 5.7, p. 112): all balanced flows in N(p) have the exact same buyer surplus vector. Note that [Vaz07], p. 112 prints "strictly concave" for the strictly convex objective surplusSqNorm.

    def Cslib.GameTheory.Market.LinearFisherMarket.ResidualReachable {I : Type u_1} {G : Type u_2} (M : LinearFisherMarket I G) (p : G → ℝ) (f : G → I → ℝ) (j i : I) :

    Residual reachability in R(f) - {s, t} ([Vaz07], Section 5.7, p. 112): buyer i is reachable from buyer j along alternating backward flow edges (b, g) (f g b > 0) and forward equality edges (g, b') (M.IsEqualityEdge p b' g).

    def Cslib.GameTheory.Market.LinearFisherMarket.SatisfiesPropertyOne {I : Type u_1} {G : Type u_2} [Fintype G] (M : LinearFisherMarket I G) (p : G → ℝ) (f : G → I → ℝ) :

    Property 1 of balanced flows ([Vaz07], Section 5.7, p. 112): whenever buyer j has strictly smaller surplus than buyer i, there is no path from j to i in R(f) - {s, t}.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.IsBalancedFlow.isMaxEqualityFlow {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) {f : G → I → ℝ} (hbal : M.IsBalancedFlow p f) :

    Every balanced flow in N(p) is a maximum flow in N(p) ([Vaz07], Section 5.7, p. 112).

    Theorem 5.5 ([Vaz07], Section 5.7, pp. 112–113): a maximum equality money flow f in N(p) is balanced if and only if it satisfies Property 1 (M.SatisfiesPropertyOne p f).

    Section 5.7.1: Divide-and-conquer balanced-flow algorithm (Theorem 5.8) #

    Oracle query signature for single maximum-flow computations on bipartite networks over FlowVertex I G. Used with Cslib.FreeM to count exact max-flow oracle calls in Theorem 5.8 ([Vaz07], Section 5.7.1, p. 115) and Lemma 5.11 ([Vaz07], Section 5.9, p. 118).

    Validity predicate for a MaxFlowQuery oracle: on every nonnegative capacity matrix W, oracle (.maxFlow W) returns a feasible maximum source–sink flow.

    Canonical valid MaxFlowQuery oracle backed by exists_isMaxRealFlow.

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.balancedFlowProgram {I G : Type u} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] (M : LinearFisherMarket I G) (p : G → ℝ) :
    FreeM (MaxFlowQuery I G) (G → I → ℝ)

    Divide-and-conquer balanced-flow program ([Vaz07], Section 5.7.1, pp. 113–115): runs balancedFlowLoop for at most Fintype.card G max-flow oracle queries on N(p), computing each active piece's uniform buyer-capacity shift explicitly from its sorted buyer capacities.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.balancedFlowProgram_spec {I G : Type u} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} (hp : ∀ (g : G), 0 ≤ p g) (hinv : M.SatisfiesInvariant p) {oracle : {ι : Type u} → MaxFlowQuery I G ι → ι} (horacle : IsValidMaxFlowOracle fun {ι : Type u} => oracle) :
    have f := FreeM.eval (fun {ι : Type u} => oracle) (M.balancedFlowProgram p); M.IsMaxEqualityFlow p f ∧ M.IsBalancedFlow p f ∧ FreeM.countQueries (fun {ι : Type u} => oracle) (M.balancedFlowProgram p) ≤ Fintype.card G

    Theorem 5.8 (together with Lemmas 5.6 and 5.7) ([Vaz07], Section 5.7.1, pp. 113–115): when N(p) satisfies the Invariant (M.SatisfiesInvariant p) at nonnegative prices p, the divide-and-conquer program M.balancedFlowProgram p evaluated with any valid max-flow oracle outputs a balanced maximum flow in N(p) while making at most Fintype.card G max-flow oracle calls.

    Section 5.9: Finding tight sets (Lemmas 5.9–5.11) #

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.scaledSubnetwork {I G : Type u} [Fintype I] (M : LinearFisherMarket I G) (p : G → ℝ) (A : Finset G) (x : ℝ) :
    FlowVertex I G → FlowVertex I G → ℝ

    Scaled bipartite equality subnetwork N(x · p) restricted to active goods A and their equality neighborhood M.buyerNeighborhood p A ([Vaz07], Section 5.9, pp. 117–118). When 0 < x, A = Finset.univ, and M.buyerNeighborhood p Finset.univ = Finset.univ, this coincides with M.equalityNetwork (x • p).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.scaledSubnetwork_nonneg {I G : Type u} [Fintype I] {M : LinearFisherMarket I G} {p : G → ℝ} {A : Finset G} {x : ℝ} (hx : 0 ≤ x) (hp : ∀ g ∈ A, 0 ≤ p g) (u v : FlowVertex I G) :
    0 ≤ M.scaledSubnetwork p A x u v
    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.minTightRatio {I G : Type u} [Fintype I] (M : LinearFisherMarket I G) (p : G → ℝ) (A : Finset G) (hA : A.Nonempty) :

    Minimum ratio x* = min_{∅ ≠ S ⊆ A} m(Γ(S)) / p(S) at which a nonempty subset of A goes tight under uniform price scaling ([Vaz07], Section 5.9, p. 117).

    noncomputable def Cslib.GameTheory.Market.LinearFisherMarket.tightSetAtMinRatio {I G : Type u} [Fintype I] [DecidableEq G] (M : LinearFisherMarket I G) (p : G → ℝ) (A : Finset G) (hA : A.Nonempty) :

    Unique maximal subset S* ⊆ A going tight at scale x* = M.minTightRatio p A hA ([Vaz07], Section 5.9, p. 117).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.minTightRatio_nonneg {I G : Type u} [Fintype I] {M : LinearFisherMarket I G} {p : G → ℝ} {A : Finset G} (hA : A.Nonempty) (hp : ∀ g ∈ A, 0 < p g * M.supply g) :
    0 ≤ M.minTightRatio p A hA
    theorem Cslib.GameTheory.Market.LinearFisherMarket.minTightRatio_mul_goodValue_le {I G : Type u} [Fintype I] {M : LinearFisherMarket I G} {p : G → ℝ} {A : Finset G} (hA : A.Nonempty) (hp : ∀ g ∈ A, 0 < p g * M.supply g) {S : Finset G} (hSA : S ⊆ A) :
    theorem Cslib.GameTheory.Market.LinearFisherMarket.tightSetAtMinRatio_spec {I G : Type u} [Fintype I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} {A : Finset G} (hA : A.Nonempty) (hp : ∀ g ∈ A, 0 < p g * M.supply g) :
    have xStar := M.minTightRatio p A hA; have SStar := M.tightSetAtMinRatio p A hA; SStar ⊆ A ∧ SStar.Nonempty ∧ xStar * M.goodValue p SStar = M.budgetSum (M.buyerNeighborhood p SStar) ∧ ∀ S ⊆ A, xStar * M.goodValue p S = M.budgetSum (M.buyerNeighborhood p S) → S ⊆ SStar

    Lemma 5.9 (part 1) ([Vaz07], Section 5.9, p. 117): if 0 ≤ x ≤ x*, then the source cut ({.source}, A ∪ Γ(A) ∪ {.sink}) is a minimum s–t cut in N(x · p).

    Lemma 5.9 (part 2) ([Vaz07], Section 5.9, pp. 117–118): if x > x*, then ({.source}, A ∪ Γ(A) ∪ {.sink}) is not a minimum s–t cut in N(x · p), and for every minimum s–t cut X in N(x · p), the maximal tight set S* is contained in the goods on the source side of X (S* ⊆ A.filter (fun g => .good g ∈ X)).

    Lemma 5.10 ([Vaz07], Section 5.9, p. 118): at x = m(Γ(A)) / p(A) > x*, for any minimum s–t cut X in N(x · p), the source-side goods A₁ = A.filter (fun g => .good g ∈ X) form a proper subset of A (A₁ ⊂ A).

    Tight-set search program ([Vaz07], Section 5.9, Lemma 5.11, p. 118): finds the minimum tight ratio x* and maximal tight set S* on (A, Γ(A)) using at most A.card max-flow oracle calls.

    theorem Cslib.GameTheory.Market.LinearFisherMarket.findTightSetProgram_spec {I G : Type u} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} {p : G → ℝ} {A : Finset G} (hA : A.Nonempty) (hp : ∀ g ∈ A, 0 < p g * M.supply g) {oracle : {ι : Type u} → MaxFlowQuery I G ι → ι} (horacle : IsValidMaxFlowOracle fun {ι : Type u} => oracle) :
    FreeM.eval (fun {ι : Type u} => oracle) (M.findTightSetProgram p A) = (M.minTightRatio p A hA, M.tightSetAtMinRatio p A hA) ∧ FreeM.countQueries (fun {ι : Type u} => oracle) (M.findTightSetProgram p A) ≤ A.card

    Lemma 5.11 ([Vaz07], Section 5.9, p. 118): for any nonempty A : Finset G with positive good values ∀ g ∈ A, 0 < p g * M.supply g and any valid max-flow oracle oracle, M.findTightSetProgram p A computes (M.minTightRatio p A hA, M.tightSetAtMinRatio p A hA) using at most A.card (hence at most Fintype.card G) max-flow oracle calls.

    Section 5.10 (Lemma 5.12) & Section 5.2 (Theorem 5.1 part 4): Rationality #

    theorem Cslib.GameTheory.Market.LinearFisherMarket.exists_rat_price_of_isTightSet {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] {M : LinearFisherMarket I G} (hsup : ∀ (g : G), M.supply g = 1) {u : I → G → ℕ} (hu : ∀ (i : I) (g : G), M.utility i g = ↑(u i g)) {U : ℕ} (hU : ∀ (i : I) (g : G), u i g ≤ U) {e : I → ℕ} (he : ∀ (i : I), M.budget i = ↑(e i)) (hbuyer : ∀ (i : I), ∃ (g : G), 0 < M.utility i g) {p : G → ℝ} (hp : ∀ (g : G), 0 < p g) (hinv : M.SatisfiesInvariant p) {S : Finset G} (hStight : M.IsTightSet p S) {g : G} (hg : g ∈ S) :
    ∃ (q : ℚ), ↑q = p g ∧ q.den ≤ S.card * U ^ (S.card - 1) ∧ q.den ≤ Fintype.card G * U ^ Fintype.card G

    Lemma 5.12 ([Vaz07], Section 5.10, pp. 118–119): in a unit-supply linear Fisher market with integer utilities u i g ≤ U and integer budgets e i, at any positive price vector p satisfying the Invariant, every good g in a tight set S has a rational price q : ℚ with denominator at most S.card * U ^ (S.card - 1) (hence at most Fintype.card G * U ^ Fintype.card G, matching Δ = n U ^ n in [Vaz07], p. 118).

    theorem Cslib.GameTheory.Market.LinearFisherMarket.exists_rational_equilibrium_of_nat {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} (hnd : M.IsNonDegenerate) (hsup : ∀ (g : G), M.supply g = 1) {u : I → G → ℕ} (hu : ∀ (i : I) (g : G), M.utility i g = ↑(u i g)) {U : ℕ} (hU : ∀ (i : I) (g : G), u i g ≤ U) {e : I → ℕ} (he : ∀ (i : I), M.budget i = ↑(e i)) :
    have n := Fintype.card G; have E := ∑ i : I, e i; ∃ (xQ : I → G → ℚ) (pQ : G → ℚ), (M.IsEquilibrium (fun (i : I) (g : G) => ↑(xQ i g)) fun (g : G) => ↑(pQ g)) ∧ (∀ (g : G), (pQ g).den ≤ n * U ^ n ∧ (pQ g).num.natAbs ≤ E * U ^ n) ∧ ∀ (i : I) (g : G), (xQ i g).den ≤ E * U ^ n ∧ (xQ i g).num.natAbs ≤ E * U ^ n

    Theorem 5.1, part 4 (integer inputs) ([Vaz07], Section 5.2, p. 107; Section 5.10, Lemma 5.12, pp. 118–119): every non-degenerate unit-supply linear Fisher market with integer utilities u i g ≤ U and integer budgets e i (total budget E = ∑ i, e i) admits a rational equilibrium (xQ, pQ) with explicit polynomial-bit bounds:

    • (pQ g).den ≤ n * U ^ n and (pQ g).num.natAbs ≤ E * U ^ n,
    • (xQ i g).den ≤ E * U ^ n and (xQ i g).num.natAbs ≤ E * U ^ n, where n = Fintype.card G.
    theorem Cslib.GameTheory.Market.LinearFisherMarket.exists_rational_equilibrium_of_rat {I : Type u_1} {G : Type u_2} [Fintype I] [Fintype G] {M : LinearFisherMarket I G} (hnd : M.IsNonDegenerate) (hsup : ∀ (g : G), M.supply g = 1) {uQ : I → G → ℚ} (hu : ∀ (i : I) (g : G), M.utility i g = ↑(uQ i g)) {eQ : I → ℚ} (he : ∀ (i : I), M.budget i = ↑(eQ i)) {B_num B_den : ℕ} (hnum_u : ∀ (i : I) (g : G), (uQ i g).num.natAbs ≤ B_num) (hden_u : ∀ (i : I) (g : G), (uQ i g).den ≤ B_den) (hnum_e : ∀ (i : I), (eQ i).num.natAbs ≤ B_num) (hden_e : ∀ (i : I), (eQ i).den ≤ B_den) :
    have m := Fintype.card I; have n := Fintype.card G; have U := B_num * B_den ^ n; have E := m * B_num * B_den ^ m; ∃ (xQ : I → G → ℚ) (pQ : G → ℚ), (M.IsEquilibrium (fun (i : I) (g : G) => ↑(xQ i g)) fun (g : G) => ↑(pQ g)) ∧ (∀ (g : G), (pQ g).den ≤ n * U ^ n * B_den ^ m ∧ (pQ g).num.natAbs ≤ E * U ^ n) ∧ ∀ (i : I) (g : G), (xQ i g).den ≤ E * U ^ n ∧ (xQ i g).num.natAbs ≤ E * U ^ n

    Theorem 5.1, part 4 (general rational inputs) ([Vaz07], Section 5.2, pp. 107–108; Section 5.10, Lemma 5.12, pp. 118–119): every non-degenerate unit-supply linear Fisher market with rational utilities uQ i g and rational budgets eQ i whose numerators are bounded by B_num and denominators by B_den admits a rational equilibrium (xQ, pQ) whose numerators and denominators satisfy explicit polynomial-bit bounds in m = Fintype.card I, n = Fintype.card G, B_num, and B_den.