Documentation

EconCSLib.Math.Simplex

EconCSLib.Math.Simplex #

Generic utilities for working with the standard simplex stdSimplex ๐•œ I.

This module is neutral shared infrastructure: it provides simplex-indexed affine combinations and weighted sums, without any game-specific interpretation. Strategic games, lotteries, and utility theory all build on these lemmas.

Main definitions #

Main results #

Attribution #

Adapted from GameTheory/Simplex.lean and helper lemmas in GameTheory/Zerosum.lean from math-xmum/gametheory.

noncomputable def stdSimplex.affineCombination {k : Type u_3} {V : Type u_4} {P : Type u_5} {I : Type u_6} [Ring k] [PartialOrder k] [Fintype I] [AddCommGroup V] [Module k V] [AddTorsor V P] (x : โ†‘(stdSimplex k I)) (p : I โ†’ P) :
P

Affine combination of a finite family of points using simplex weights.

This is a thin wrapper around Mathlib's Finset.affineCombination, specialized to weights coming from stdSimplex.

Equations
Instances For
    @[simp]
    theorem stdSimplex.affineCombination_eq_linearCombination {k : Type u_3} {V : Type u_4} {I : Type u_5} [Ring k] [PartialOrder k] [Fintype I] [AddCommGroup V] [Module k V] (x : โ†‘(stdSimplex k I)) (p : I โ†’ V) :

    In a module, simplex affine combinations are Mathlib finite linear combinations.

    @[reducible, inline]
    abbrev wsum {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) (f : I โ†’ ๐•œ) :
    ๐•œ

    Weighted sum of f with weights from a simplex element x. Thin abbrev over Mathlib's finite dot product โฌแตฅ: definitionally equal, so simp [wsum] (or no unfold at all) switches between the two forms. Kept as a named concept because the simplex-specific lemmas below (wsum_const, wsum_le_wsum, wsum_nonneg, wsum_pure) depend on โˆ‘ x = 1 or x โ‰ฅ 0 and have no generic dotProduct analogue.

    Equations
    Instances For
      theorem wsum_const {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) (c : ๐•œ) :
      (wsum x fun (x : I) => c) = c

      Weighted sum of a constant equals the constant.

      theorem wsum_le_wsum {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) {f g : I โ†’ ๐•œ} (h : โˆ€ (i : I), f i โ‰ค g i) :

      Weighted sum is monotone: pointwise โ‰ค implies wsum โ‰ค.

      theorem wsum_nonneg {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) {f : I โ†’ ๐•œ} (h : โˆ€ (i : I), 0 โ‰ค f i) :

      Weighted sum of non-negative values is non-negative.

      theorem wsum_pos {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) {f : I โ†’ ๐•œ} (hf : โˆ€ (i : I), 0 < f i) :
      0 < wsum x f

      Weighted sum of strictly-positive values is strictly positive.

      Some coordinate a of any simplex point is strictly positive (since โˆ‘ x = 1), and the corresponding x_a ยท f a summand is strictly positive while every other summand is non-negative.

      theorem wsum_ge_wsum {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) {f g : I โ†’ ๐•œ} (h : โˆ€ (i : I), f i โ‰ฅ g i) :

      Weighted sum respects โ‰ฅ.

      theorem wsum_add {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) (f g : I โ†’ ๐•œ) :
      wsum x (f + g) = wsum x f + wsum x g

      Weighted sum is linear over addition.

      theorem wsum_smul {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (x : โ†‘(stdSimplex ๐•œ I)) (c : ๐•œ) (f : I โ†’ ๐•œ) :
      wsum x (c โ€ข f) = c * wsum x f

      Weighted sum commutes with scalar multiplication.

      Convex combination of two simplex points (mix) #

      def stdSimplex.mix {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (ฮฑ : ๐•œ) (hฮฑโ‚€ : 0 โ‰ค ฮฑ) (hฮฑโ‚ : ฮฑ โ‰ค 1) (x y : โ†‘(stdSimplex ๐•œ I)) :
      โ†‘(stdSimplex ๐•œ I)

      Convex combination of two simplex points: mix ฮฑ hฮฑโ‚€ hฮฑโ‚ x y = ฮฑยทx + (1-ฮฑ)ยทy.

      This is the basic vocabulary for compound lotteries and for any inductive argument that interpolates between two mixed strategies (Loomis, Sion, fictitious play). The hypotheses are passed as plain (ฮฑ : ๐•œ) (hฮฑโ‚€ : 0 โ‰ค ฮฑ) (hฮฑโ‚ : ฮฑ โ‰ค 1) rather than via a unit-interval subtype to match Mathlib idioms and to keep call sites lightweight.

      Equations
      Instances For
        @[simp]
        theorem stdSimplex.mix_apply {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (ฮฑ : ๐•œ) (hฮฑโ‚€ : 0 โ‰ค ฮฑ) (hฮฑโ‚ : ฮฑ โ‰ค 1) (x y : โ†‘(stdSimplex ๐•œ I)) (i : I) :
        โ†‘(mix ฮฑ hฮฑโ‚€ hฮฑโ‚ x y) i = ฮฑ * โ†‘x i + (1 - ฮฑ) * โ†‘y i
        theorem wsum_mix {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] (ฮฑ : ๐•œ) (hฮฑโ‚€ : 0 โ‰ค ฮฑ) (hฮฑโ‚ : ฮฑ โ‰ค 1) (x y : โ†‘(stdSimplex ๐•œ I)) (f : I โ†’ ๐•œ) :
        wsum (stdSimplex.mix ฮฑ hฮฑโ‚€ hฮฑโ‚ x y) f = ฮฑ * wsum x f + (1 - ฮฑ) * wsum y f

        Bilinearity of wsum over stdSimplex.mix: wsum (mix ฮฑ x y) f = ฮฑ ยท wsum x f + (1-ฮฑ) ยท wsum y f.

        Ordered-field arithmetic helpers about convex combinations #

        These work directly on the scalar expression ฮฑ ยท x + (1-ฮฑ) ยท y without reference to stdSimplex. They are the algebraic ingredients used to derive strict-monotonicity facts about wsum_mix below.

        theorem linear_comb_gt_left {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {x y : ๐•œ} (H : x < y) {ฮฑ : ๐•œ} (Hฮฑ : ฮฑ < 1) :
        x < ฮฑ * x + (1 - ฮฑ) * y

        If x < y and ฮฑ < 1, then ฮฑยทx + (1-ฮฑ)ยทy > x.

        theorem linear_comb_gt_right {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {x y : ๐•œ} (H : y < x) {ฮฑ : ๐•œ} (Hฮฑ : 0 < ฮฑ) :
        y < ฮฑ * x + (1 - ฮฑ) * y

        If y < x and 0 < ฮฑ, then ฮฑยทx + (1-ฮฑ)ยทy > y.

        theorem linear_comb_gt_of_ge_gt {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] (x y c : ๐•œ) (H1 : c โ‰ค x) (H2 : c < y) {ฮฑ : ๐•œ} (hฮฑโ‚€ : 0 โ‰ค ฮฑ) (hฮฑโ‚ : ฮฑ < 1) :
        c < ฮฑ * x + (1 - ฮฑ) * y

        Convex combination of "โ‰ฅ c" and "> c" stays "> c" (provided ฮฑ โ‰ฅ 0 and ฮฑ < 1).

        theorem linear_comb_lt_of_le_lt {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] (x y c : ๐•œ) (H1 : x โ‰ค c) (H2 : y < c) {ฮฑ : ๐•œ} (hฮฑโ‚€ : 0 โ‰ค ฮฑ) (hฮฑโ‚ : ฮฑ < 1) :
        ฮฑ * x + (1 - ฮฑ) * y < c

        Convex combination of "โ‰ค c" and "< c" stays "< c" (provided ฮฑ โ‰ฅ 0 and ฮฑ < 1).

        Strict monotonicity of wsum_mix #

        theorem wsum_mix_gt_of_ge_gt {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_3} [Fintype I] (f : I โ†’ ๐•œ) (x y : โ†‘(stdSimplex ๐•œ I)) (c : ๐•œ) (H1 : c โ‰ค wsum x f) (H2 : c < wsum y f) {t : ๐•œ} (htโ‚€ : 0 โ‰ค t) (htโ‚ : t โ‰ค 1) (Ht : t < 1) :
        c < wsum (stdSimplex.mix t htโ‚€ htโ‚ x y) f

        wsum version of linear_comb_gt_of_ge_gt.

        theorem wsum_mix_lt_of_le_lt {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_3} [Fintype I] (f : I โ†’ ๐•œ) (x y : โ†‘(stdSimplex ๐•œ I)) (c : ๐•œ) (H1 : wsum x f โ‰ค c) (H2 : wsum y f < c) {t : ๐•œ} (htโ‚€ : 0 โ‰ค t) (htโ‚ : t โ‰ค 1) (Ht : t < 1) :
        wsum (stdSimplex.mix t htโ‚€ htโ‚ x y) f < c

        wsum version of linear_comb_lt_of_le_lt.

        Neighborhood existential for convex combinations #

        If c < x, then there is an interior t โˆˆ (0,1) with c < tยทx + (1-t)ยทy. Over a general ordered field this is the elementary fact that the segment s โ†ฆ sยทx + (1-s)ยทy from y to x stays above c near s = 1; we pick t explicitly (no continuity), so it holds for any [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ]. This is the key ingredient for the Loomis-style inductive step (perturbing the optimiser a little in the y-direction).

        theorem mix_gt_of_gt_nbh {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] (x y c : ๐•œ) (H : c < x) :
        โˆƒ (t : ๐•œ), 0 < t โˆง t < 1 โˆง c < t * x + (1 - t) * y

        Existence of a strictly interior t keeping tยทx + (1-t)ยทy > c, given c < x. Constructive over any ordered field: pick t just above the crossing threshold (c-y)/(x-y) (clamped to 0) when y < x, or any interior t when x โ‰ค y.

        theorem mix_lt_of_lt_nbh {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] (x y c : ๐•œ) (H : x < c) :
        โˆƒ (t : ๐•œ), 0 < t โˆง t < 1 โˆง t * x + (1 - t) * y < c

        Dual: strictly interior t keeping tยทx + (1-t)ยทy < c, given x < c. Obtained from mix_gt_of_gt_nbh by negating x, y, c.

        theorem wsum_wsum_comm {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] {J : Type u_3} [Fintype J] (x : โ†‘(stdSimplex ๐•œ I)) (y : โ†‘(stdSimplex ๐•œ J)) (A : I โ†’ J โ†’ ๐•œ) :
        (wsum x fun (i : I) => wsum y (A i)) = wsum y fun (j : J) => wsum x fun (i : I) => A i j

        Exchange order of double weighted sums.

        def stdSimplex.pure {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] [DecidableEq I] (iโ‚€ : I) :
        โ†‘(stdSimplex ๐•œ I)

        Point-mass simplex element at iโ‚€.

        Equations
        Instances For
          @[simp]
          theorem stdSimplex.pure_apply {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] [DecidableEq I] (iโ‚€ i : I) :
          โ†‘(pure iโ‚€) i = if i = iโ‚€ then 1 else 0
          @[simp]
          theorem wsum_pure_apply {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] [DecidableEq I] (iโ‚€ : I) (f : I โ†’ ๐•œ) :
          wsum (stdSimplex.pure iโ‚€) f = f iโ‚€

          Weighted sum at a point mass evaluates the chosen coordinate.

          theorem wsum_pure {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] [DecidableEq I] (iโ‚€ : I) (f : I โ†’ ๐•œ) :
          wsum โŸจfun (i : I) => if i = iโ‚€ then 1 else 0, โ‹ฏโŸฉ f = f iโ‚€

          Weighted sum with point mass at iโ‚€ equals f iโ‚€. Legacy form using the inline anonymous-structure point mass. New code should prefer stdSimplex.pure together with wsum_pure_apply.

          Order characterization of wsum ranges #

          These lemmas turn pointwise bounds on f : I โ†’ ๐•œ into bounds on the weighted sum wsum x f over all simplex points x. They are the bridge that lets Loomis-style arguments reduce a quantification over mixed strategies to a quantification over pure responses.

          theorem ge_iff_simplex_ge {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] {f : I โ†’ ๐•œ} {v : ๐•œ} :
          (โˆ€ (i : I), v โ‰ค f i) โ†” โˆ€ (x : โ†‘(stdSimplex ๐•œ I)), v โ‰ค wsum x f

          f โ‰ฅ v pointwise iff every simplex weighted sum is โ‰ฅ v.

          theorem le_iff_simplex_le {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] {f : I โ†’ ๐•œ} {v : ๐•œ} :
          (โˆ€ (i : I), f i โ‰ค v) โ†” โˆ€ (x : โ†‘(stdSimplex ๐•œ I)), wsum x f โ‰ค v

          f โ‰ค v pointwise iff every simplex weighted sum is โ‰ค v.

          Continuity (over โ„) #

          For the simplified Loomis route we need that x โ†ฆ wsum x f is continuous on stdSimplex โ„ I. The Mathlib instance stdSimplex.instCompactSpace_coe then hands us compactness "for free", which is the workhorse for existence of optimal mixed strategies.

          theorem stdSimplex.continuous_coord {I : Type u_3} [Fintype I] (i : I) :
          Continuous fun (x : โ†‘(stdSimplex โ„ I)) => โ†‘x i

          The i-th coordinate projection on stdSimplex โ„ I is continuous.

          theorem wsum_continuous {I : Type u_3} [Fintype I] (f : I โ†’ โ„) :
          Continuous fun (x : โ†‘(stdSimplex โ„ I)) => wsum x f

          wsum (ยท) f is continuous on the standard simplex over โ„.

          Matrix-game expected payoff #

          expectedPayoffMatrix was previously in StrategicGame.Simplex. It is placed here because it is a purely arithmetic definition (bilinear evaluation on the simplex) with no strategic-game vocabulary.

          def expectedPayoffMatrix {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] {I : Type u_2} [Fintype I] {J : Type u_3} (A : I โ†’ J โ†’ ๐•œ) [Fintype J] (x : โ†‘(stdSimplex ๐•œ I)) (y : โ†‘(stdSimplex ๐•œ J)) :
          ๐•œ

          Expected payoff in a matrix game A : I โ†’ J โ†’ ๐•œ under mixed strategies.

          Equations
          Instances For
            theorem expectedPayoffMatrix_comm {๐•œ : Type u_1} [Field ๐•œ] [LinearOrder ๐•œ] [IsStrictOrderedRing ๐•œ] {I : Type u_2} [Fintype I] {J : Type u_4} [Fintype J] (A : I โ†’ J โ†’ ๐•œ) (x : โ†‘(stdSimplex ๐•œ I)) (y : โ†‘(stdSimplex ๐•œ J)) :
            expectedPayoffMatrix A x y = โ‡‘y โฌแตฅ fun (j : J) => โ‡‘x โฌแตฅ fun (i : I) => A i j

            Expected payoff is commutative in the summation order.