Documentation

CslibFrontier.Probability.Minimax

Averaging and the minimax principle for finite distributions #

Think of a two-player game in which one player picks a strategy a and the other an input b, with loss loss a b; for an algorithm, loss a b may be whether a errs on b. Drawing the strategy from a distribution μ and the input from a distribution ν relates the two classical guarantees of randomized algorithms [Yao77]. Distributions appear in two forms: finitely supported ones as points of the standard simplex (Convexity.StdSimplex), and probability mass functions (PMF), whose supports may be infinite. On a finite type the two correspond (Probability.PMF.ofStdSimplex, Probability.PMF.toStdSimplex).

Main definitions #

Main results #

References #

Finitely supported distributions #

theorem Convexity.StdSimplex.sum_mul_le_of_forall_le {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {α : Type u_2} {μ : StdSimplex K α} {g : α → K} {c : K} (h : ∀ a ∈ μ.support, g a ≤ c) :
(μ.sum fun (a : α) (w : K) => w * g a) ≤ c

An average under a finitely supported distribution is at most any bound on the support.

theorem Convexity.StdSimplex.exists_mem_support_le_sum_mul {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {α : Type u_2} (μ : StdSimplex K α) (g : α → K) :
∃ a ∈ μ.support, g a ≤ μ.sum fun (a : α) (w : K) => w * g a

The averaging argument: some point of the support of a finitely supported distribution is at most the average.

The minimax theorem for finite games #

theorem Convexity.StdSimplex.exists_forall_sum_le_of_forall_exists_sum_le {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {I : Type u_2} {J : Type u_3} [Fintype I] [Fintype J] [Nonempty I] (M : I → J → K) {c : K} (h : ∀ (q : StdSimplex K J), ∃ (i : I), ∑ j : J, q.weights j * M i j ≤ c) :
∃ (p : StdSimplex K I), ∀ (j : J), ∑ i : I, p.weights i * M i j ≤ c

The minimax theorem for finite two-player zero-sum games [vN28], over every linearly ordered field K, in the form used by Yao's principle. A row player picks i : I, a column player picks j : J, and the row player pays M i j. If against every mixed strategy q of the column player some row i has expected payment at most c, then some mixed strategy p of the row player has expected payment at most c against every column j. It follows from the existence of the value (Cslib.Probability.exists_isMinimaxValue), so the proof is linear-programming duality, with no topology.

Randomized strategies and distributional error on StdSimplex #

def Convexity.StdSimplex.maxCost {α : Type u_2} (cost : α → ℕ) (μ : StdSimplex ℝ α) :

The maximum of cost over the support of a finitely supported distribution μ.

Instances For
    theorem Convexity.StdSimplex.maxCost_le_iff {α : Type u_2} {cost : α → ℕ} {μ : StdSimplex ℝ α} {d : ℕ} :
    maxCost cost μ ≤ d ↔ ∀ a ∈ μ.support, cost a ≤ d
    theorem Convexity.StdSimplex.le_maxCost {α : Type u_2} {cost : α → ℕ} {μ : StdSimplex ℝ α} {a : α} (ha : a ∈ μ.support) :
    cost a ≤ maxCost cost μ
    @[simp]
    theorem Convexity.StdSimplex.maxCost_single {α : Type u_2} (cost : α → ℕ) (a : α) :
    maxCost cost (single a) = cost a
    theorem Convexity.StdSimplex.exists_of_mem_support_map {α : Type u_2} {β : Type u_3} {φ : α → β} {μ : StdSimplex ℝ α} {b : β} (hb : b ∈ (map φ μ).support) :
    ∃ a ∈ μ.support, φ a = b

    Every element in the support of StdSimplex.map φ μ is the image of some element in the support of μ.

    theorem Convexity.StdSimplex.maxCost_map_le {α : Type u_2} {β : Type u_3} (cost : α → ℕ) (cost' : β → ℕ) (φ : α → β) (μ : StdSimplex ℝ α) {d : ℕ} (hφ : ∀ (a : α), cost' (φ a) ≤ cost a + d) :
    maxCost cost' (map φ μ) ≤ maxCost cost μ + d

    If φ adds at most d to the cost of every strategy in the support, so does map φ.

    noncomputable def Convexity.StdSimplex.errorProb {α : Type u_2} (Acc : α → Prop) (μ : StdSimplex ℝ α) :

    The probability under μ that Acc fails.

    Instances For
      theorem Convexity.StdSimplex.errorProb_eq_sum {α : Type u_2} (Acc : α → Prop) [DecidablePred Acc] (μ : StdSimplex ℝ α) :
      errorProb Acc μ = μ.sum fun (a : α) (w : ℝ) => w * if Acc a then 0 else 1

      errorProb with any decidable predicate Acc.

      theorem Convexity.StdSimplex.errorProb_nonneg {α : Type u_2} {Acc : α → Prop} {μ : StdSimplex ℝ α} :
      0 ≤ errorProb Acc μ
      theorem Convexity.StdSimplex.errorProb_le_one {α : Type u_2} {Acc : α → Prop} {μ : StdSimplex ℝ α} :
      errorProb Acc μ ≤ 1
      theorem Convexity.StdSimplex.errorProb_eq_zero_iff {α : Type u_2} {Acc : α → Prop} {μ : StdSimplex ℝ α} :
      errorProb Acc μ = 0 ↔ ∀ a ∈ μ.support, Acc a
      @[simp]
      theorem Convexity.StdSimplex.errorProb_single {α : Type u_2} (Acc : α → Prop) (a : α) :
      errorProb Acc (single a) = if Acc a then 0 else 1
      theorem Convexity.StdSimplex.errorProb_single_of_pos {α : Type u_2} {Acc : α → Prop} {a : α} (ha : Acc a) :
      errorProb Acc (single a) = 0
      theorem Convexity.StdSimplex.errorProb_single_of_neg {α : Type u_2} {Acc : α → Prop} {a : α} (ha : ¬Acc a) :
      errorProb Acc (single a) = 1
      theorem Convexity.StdSimplex.errorProb_map_le {α : Type u_2} {β : Type u_3} (Acc : α → Prop) (Acc' : β → Prop) (φ : α → β) (μ : StdSimplex ℝ α) (hφ : ∀ (a : α), Acc a → Acc' (φ a)) :
      errorProb Acc' (map φ μ) ≤ errorProb Acc μ

      Mapping strategies by φ that preserves acceptance cannot increase the failure probability.

      theorem Convexity.StdSimplex.exists_errorProb_le {α : Type u_2} {β : Type u_3} (Acc : α → β → Prop) (μ : StdSimplex ℝ α) (ν : StdSimplex ℝ β) {ε : ℝ} (h : ∀ (b : β), errorProb (fun (a : α) => Acc a b) μ ≤ ε) :
      ∃ a ∈ μ.support, errorProb (fun (b : β) => Acc a b) ν ≤ ε

      The averaging argument for failure probabilities under StdSimplex: if μ fails on every input b with probability at most ε, then for every input distribution ν some strategy in the support of μ fails on ν with probability at most ε.

      theorem Convexity.StdSimplex.exists_forall_errorProb_le {α : Type u_2} {β : Type u_3} [Finite β] [Nonempty α] (Acc : α → β → Prop) {ε : ℝ} (h : ∀ (ν : StdSimplex ℝ β), ∃ (a : α), errorProb (fun (b : β) => Acc a b) ν ≤ ε) :
      ∃ (μ : StdSimplex ℝ α), ∀ (b : β), errorProb (fun (a : α) => Acc a b) μ ≤ ε

      Yao's minimax principle for failure probabilities on a finite input space: if against every input distribution ν some strategy in α fails with probability at most ε, then some finitely supported distribution μ on α fails with probability at most ε on every input. Strategies with the same failure set on β are interchangeable, so only finitely many representative strategies are needed even when α is infinite.

      theorem Convexity.StdSimplex.exists_maxCost_le_and_forall_errorProb_le {α : Type u_2} {β : Type u_3} [Finite β] [Nonempty β] (cost : α → ℕ) (Acc : α → β → Prop) {d : ℕ} {ε : ℝ} (h : ∀ (ν : StdSimplex ℝ β), ∃ (a : α), cost a ≤ d ∧ errorProb (fun (b : β) => Acc a b) ν ≤ ε) :
      ∃ (μ : StdSimplex ℝ α), (∀ (b : β), errorProb (fun (a : α) => Acc a b) μ ≤ ε) ∧ maxCost cost μ ≤ d

      Yao's minimax principle for bounded-cost finitely supported randomized strategies on a finite nonempty input space: if against every input distribution ν some strategy of cost at most d fails with probability at most ε, then some finitely supported distribution μ over strategies of cost at most d fails with probability at most ε on every input.

      Probability mass functions #

      theorem Cslib.Probability.PMF.exists_mem_support_le_tsum_mul {α : Type u_1} (μ : PMF α) (g : α → ENNReal) :
      ∃ a ∈ μ.support, g a ≤ ∑' (a : α), μ a * g a

      Some possible outcome is at most the mean: for every distribution μ and every function g with values in [0, ∞], some outcome a that μ can produce has g a at most the mean of g under μ. The sample space may be infinite.

      theorem Cslib.Probability.PMF.exists_mem_support_tsum_mul_le_tsum_mul {α : Type u_1} {β : Type u_2} (μ : PMF α) (ν : PMF β) (loss : α → β → ENNReal) :
      ∃ a ∈ μ.support, ∑' (b : β), ν b * loss a b ≤ ∑' (b : β), ν b * ∑' (a : α), μ a * loss a b

      The averaging argument, the easy direction of Yao's principle: for any strategy distribution μ, input distribution ν, and [0, ∞]-valued loss loss, some strategy in the support of μ has ν-expected loss at most the ν-expectation of the μ-expected loss. The sample spaces may be infinite.

      theorem Cslib.Probability.PMF.exists_mem_support_tsum_mul_le {α : Type u_1} {β : Type u_2} (μ : PMF α) (ν : PMF β) (loss : α → β → ENNReal) {ε : ENNReal} (h : ∀ b ∈ ν.support, ∑' (a : α), μ a * loss a b ≤ ε) :
      ∃ a ∈ μ.support, ∑' (b : β), ν b * loss a b ≤ ε

      The averaging argument, the easy direction of Yao's principle. Let loss a b be the loss of a strategy a on an input b. If drawing the strategy from μ has expected loss at most ε on every input that ν can produce, then some strategy that μ can produce has expected loss at most ε on inputs drawn from ν. The sample spaces may be infinite.

      theorem Cslib.Probability.PMF.exists_mem_support_toOuterMeasure_le {α : Type u_1} {β : Type u_2} (μ : PMF α) (ν : PMF β) (E : α → β → Prop) {ε : ℝ} (h : ∀ b ∈ ν.support, (μ.toOuterMeasure {a : α | E a b}).toReal ≤ ε) :
      ∃ a ∈ μ.support, (ν.toOuterMeasure {b : β | E a b}).toReal ≤ ε

      The averaging argument for events, the easy direction of Yao's principle: if a strategy drawn from μ fails on every input that ν can produce with probability at most ε, then some strategy that μ can produce fails on an input drawn from ν with probability at most ε. The sample spaces may be infinite.

      The minimax theorem for probability mass functions #

      noncomputable def Cslib.Probability.PMF.ofStdSimplex {I : Type u_5} (p : Convexity.StdSimplex ℝ I) :
      PMF I

      The finitely supported distribution whose probabilities are the weights of a point of the standard simplex on an arbitrary type I.

      Instances For

        The probability of i under ofStdSimplex p is the weight of i in p.

        Every distribution obtained from StdSimplex has finite support.

        The real-valued outer measure of {i | P i} under ofStdSimplex p equals p.errorProb (fun i => ¬P i).

        noncomputable def Cslib.Probability.PMF.toStdSimplex {I : Type u_3} [Fintype I] (μ : PMF I) :

        The point of the standard simplex whose weights are the probabilities of a distribution on a finite type.

        Instances For
          @[simp]
          theorem Cslib.Probability.PMF.weights_toStdSimplex {I : Type u_3} [Fintype I] (μ : PMF I) (i : I) :

          The weight of i in toStdSimplex μ is the probability of i, as a real number.

          @[simp]

          Passing from a distribution to the simplex and back returns the distribution.

          theorem Cslib.Probability.PMF.exists_mem_support_sum_mul_le {I : Type u_3} [Fintype I] (μ : PMF I) (g : I → ℝ) :
          ∃ i ∈ μ.support, ∑ j : I, (μ j).toReal * g j ≤ g i

          Some possible outcome is at least the mean of a real-valued function on a finite type: the averaging argument that fixes a choice at least as good as a random one. This is Convexity.StdSimplex.exists_mem_support_le_sum_mul applied to -g.

          theorem Cslib.Probability.PMF.exists_forall_sum_mul_le {I : Type u_3} {J : Type u_4} [Fintype I] [Fintype J] [Nonempty I] (M : I → J → ℝ) {ε : ℝ} (h : ∀ (ν : PMF J), ∃ (i : I), ∑ j : J, (ν j).toReal * M i j ≤ ε) :
          ∃ (μ : PMF I), ∀ (j : J), ∑ i : I, (μ i).toReal * M i j ≤ ε

          The minimax theorem for finite games [vN28], for distributions. Let M i j be the loss of a strategy i on an input j. If against every distribution ν on the inputs some strategy has expected loss at most ε, then some distribution μ on the strategies has expected loss at most ε on every input. This is the hard direction of Yao's principle; it is Convexity.StdSimplex.exists_forall_sum_le_of_forall_exists_sum_le read through ofStdSimplex.

          theorem Cslib.Probability.PMF.exists_forall_toOuterMeasure_le {I : Type u_5} {J : Type u_6} [Finite J] [Nonempty I] (E : I → J → Prop) {ε : ℝ} (h : ∀ (ν : PMF J), ∃ (i : I), (ν.toOuterMeasure {j : J | E i j}).toReal ≤ ε) :
          ∃ (μ : PMF I), μ.support.Finite ∧ ∀ (j : J), (μ.toOuterMeasure {i : I | E i j}).toReal ≤ ε

          Yao's minimax principle for finite sets of inputs. Let E i j say that a strategy i fails on an input j, where there may be infinitely many strategies but only finitely many inputs. If against every distribution ν on the inputs some strategy fails with probability at most ε, then some distribution μ on finitely many strategies fails with probability at most ε on every input. This is Convexity.StdSimplex.exists_forall_errorProb_le read through ofStdSimplex.

          Public-coin cost, error probability, and Yao's minimax bridge on PMF #

          noncomputable def Cslib.Probability.PMF.maxCost {α : Type u_1} (cost : α → ℕ) (μ : PMF α) :

          The supremum of cost over the support of μ, in ℕ∞.

          Instances For
            theorem Cslib.Probability.PMF.maxCost_le_iff {α : Type u_1} {cost : α → ℕ} {μ : PMF α} {c : ℕ∞} :
            maxCost cost μ ≤ c ↔ ∀ a ∈ μ.support, ↑(cost a) ≤ c
            theorem Cslib.Probability.PMF.le_maxCost {α : Type u_1} {cost : α → ℕ} {μ : PMF α} {a : α} (ha : a ∈ μ.support) :
            ↑(cost a) ≤ maxCost cost μ
            @[simp]
            theorem Cslib.Probability.PMF.maxCost_pure {α : Type u_1} (cost : α → ℕ) (a : α) :
            maxCost cost (PMF.pure a) = ↑(cost a)
            theorem Cslib.Probability.PMF.maxCost_map_le {α : Type u_1} {γ : Type u_3} (cost : α → ℕ) (cost' : γ → ℕ) (f : γ → α) (μ : PMF γ) (hf : ∀ c ∈ μ.support, cost (f c) ≤ cost' c) :
            maxCost cost (PMF.map f μ) ≤ maxCost cost' μ
            theorem Cslib.Probability.PMF.maxCost_map_le_of_le {α : Type u_1} {γ : Type u_3} (cost : α → ℕ) (f : γ → α) (μ : PMF γ) {c : ℕ} (hf : ∀ x ∈ μ.support, cost (f x) ≤ c) :
            maxCost cost (PMF.map f μ) ≤ ↑c
            noncomputable def Cslib.Probability.PMF.errorProb {α : Type u_1} {β : Type u_2} (Acc : α → β → Prop) (μ : PMF α) (b : β) :

            The real-valued probability that a strategy a drawn from μ fails Acc a b on input b.

            Instances For
              theorem Cslib.Probability.PMF.errorProb_eq_sum {α : Type u_1} {β : Type u_2} [Fintype α] (Acc : α → β → Prop) (μ : PMF α) (b : β) [DecidablePred fun (a : α) => Acc a b] :
              errorProb Acc μ b = ∑ a : α, if Acc a b then 0 else (μ a).toReal
              theorem Cslib.Probability.PMF.errorProb_nonneg {α : Type u_1} {β : Type u_2} {Acc : α → β → Prop} {μ : PMF α} {b : β} :
              0 ≤ errorProb Acc μ b
              theorem Cslib.Probability.PMF.errorProb_le_one {α : Type u_1} {β : Type u_2} {Acc : α → β → Prop} {μ : PMF α} {b : β} :
              errorProb Acc μ b ≤ 1
              theorem Cslib.Probability.PMF.errorProb_pure {α : Type u_1} {β : Type u_2} (Acc : α → β → Prop) (a : α) (b : β) :
              errorProb Acc (PMF.pure a) b = if Acc a b then 0 else 1
              theorem Cslib.Probability.PMF.errorProb_pure_le {α : Type u_1} {β : Type u_2} (Acc : α → β → Prop) {a : α} {b : β} {ε : ℝ} (ha : Acc a b) (hε : 0 ≤ ε) :
              errorProb Acc (PMF.pure a) b ≤ ε
              theorem Cslib.Probability.PMF.errorProb_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} (Acc : α → β → Prop) (f : γ → α) (μ : PMF γ) (b : β) :
              errorProb Acc (PMF.map f μ) b = errorProb (fun (c : γ) (b : β) => Acc (f c) b) μ b
              theorem Cslib.Probability.PMF.exists_errorProb_le {α : Type u_1} {β : Type u_2} {Acc : α → β → Prop} {μ : PMF α} (ν : PMF β) {ε : ℝ} (h : ∀ b ∈ ν.support, errorProb Acc μ b ≤ ε) :
              ∃ a ∈ μ.support, errorProb (fun (b : β) (a : α) => Acc a b) ν a ≤ ε

              The averaging argument in terms of errorProb: if μ errs with probability at most ε on every input in the support of ν, then some strategy in the support of μ errs with probability at most ε on inputs drawn from ν.

              theorem Cslib.Probability.PMF.exists_maxCost_le_and_forall_errorProb_le {α : Type u_1} {β : Type u_2} {cost : α → ℕ} {Acc : α → β → Prop} {D : Set β} [Finite ↑D] {c : ℕ} [Nonempty { a : α // cost a ≤ c }] {ε : ℝ} (h : ∀ (ν : PMF β), (∀ b ∈ ν.support, b ∈ D) → ∃ (a : α), cost a ≤ c ∧ errorProb (fun (b : β) (a : α) => Acc a b) ν a ≤ ε) :
              ∃ (μ : PMF α), (∀ b ∈ D, errorProb Acc μ b ≤ ε) ∧ maxCost cost μ ≤ ↑c

              Yao's minimax principle for bounded-cost PMF strategies on a finite input domain D: if under every distribution ν supported on D some strategy of cost at most c errs with probability at most ε, then some distribution μ over strategies of cost at most c errs with probability at most ε on every input of D.