Documentation

CslibFrontier.Computability.RandomizedCost

Model-generic public-coin randomized cost, minimax duality, and amplification #

Many concrete models of randomized computation — two-party communication protocols, number-on-forehead multiparty protocols, randomized decision trees, and coin-fixed cell-probe schemes — share the same relationship between deterministic strategies, public-coin mixtures, input distributions, and repetition. A deterministic model is given by an evaluation map eval : M → X → Z and a worst-case natural-number cost cost : M → ℕ (Cslib.RandomizedCost).

This module provides that model-independent library infrastructure once (background: [Yao1977, vonNeumann1928]):

Main definitions #

Main results #

References #

structure Cslib.RandomizedCost (M : Type u) (X : Type v) (Z : Type w) :
Type (max (max u v) w)

A deterministic model of strategies M from inputs X to outputs Z with worst-case natural-number cost cost : M → ℕ.

  • eval : M → X → Z

    Output of strategy m on input x.

  • cost : M → ℕ

    Worst-case natural-number cost of strategy m.

Instances For
    def Cslib.RandomizedCost.DetSolves {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (m : M) (R : X → Z → Prop) (A : Set X) :

    Deterministic strategy m solves R on promise set A.

    Instances For
      noncomputable def Cslib.RandomizedCost.detComplexity {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (R : X → Z → Prop) (A : Set X) :

      Least cost in ℕ∞ of a deterministic strategy solving R on A, or ⊤ if none exists.

      Instances For
        noncomputable def Cslib.RandomizedCost.distributionalError {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (m : M) (ν : PMF X) (R : X → Z → Prop) :

        Probability that deterministic strategy m errs against R on an input drawn from ν.

        Instances For
          noncomputable def Cslib.RandomizedCost.distributionalComplexity {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (ε : ℝ) (R : X → Z → Prop) (ν : PMF X) :

          Least cost in ℕ∞ of a deterministic strategy erring with probability at most ε under ν.

          Instances For
            noncomputable def Cslib.RandomizedCost.errorProb {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (μ : PMF M) (R : X → Z → Prop) (x : X) :

            Probability that a strategy drawn from μ errs against R on input x.

            Instances For
              def Cslib.RandomizedCost.Solves {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (μ : PMF M) (ε : ℝ) (R : X → Z → Prop) (A : Set X) :

              Public-coin mixture μ solves R on A with worst-case error at most ε.

              Instances For
                noncomputable def Cslib.RandomizedCost.ecomplexity {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (ε : ℝ) (R : X → Z → Prop) (A : Set X) :

                Least worst-case support cost in ℕ∞ of a public-coin mixture solving R on A with error ε, or ⊤ if none exists.

                Instances For
                  noncomputable def Cslib.RandomizedCost.ecomplexityFun {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (ε : ℝ) (f : X → Z) :

                  Public-coin complexity of computing a total function f : X → Z with error ε.

                  Instances For
                    theorem Cslib.RandomizedCost.distributionalComplexity_le_cost {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {m : M} {R : X → Z → Prop} {ν : PMF X} {ε : ℝ} (hm : C.distributionalError m ν R ≤ ε) :
                    C.distributionalComplexity ε R ν ≤ ↑(C.cost m)
                    theorem Cslib.RandomizedCost.le_distributionalComplexity_iff {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ν : PMF X} {ε : ℝ} {k : ℕ∞} :
                    k ≤ C.distributionalComplexity ε R ν ↔ ∀ (m : M), C.distributionalError m ν R ≤ ε → k ≤ ↑(C.cost m)
                    theorem Cslib.RandomizedCost.distributionalComplexity_le_iff {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ν : PMF X} {ε : ℝ} {k : ℕ} :
                    C.distributionalComplexity ε R ν ≤ ↑k ↔ ∃ (m : M), C.distributionalError m ν R ≤ ε ∧ C.cost m ≤ k
                    theorem Cslib.RandomizedCost.distributionalComplexity_anti {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ν : PMF X} {ε ε' : ℝ} (hε : ε ≤ ε') :
                    theorem Cslib.RandomizedCost.errorProb_nonneg {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {μ : PMF M} {R : X → Z → Prop} {x : X} :
                    0 ≤ C.errorProb μ R x
                    theorem Cslib.RandomizedCost.errorProb_le_one {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {μ : PMF M} {R : X → Z → Prop} {x : X} :
                    C.errorProb μ R x ≤ 1
                    theorem Cslib.RandomizedCost.errorProb_pure {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (m : M) (R : X → Z → Prop) (x : X) :
                    C.errorProb (PMF.pure m) R x = if R x (C.eval m x) then 0 else 1
                    theorem Cslib.RandomizedCost.Solves.mono {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {μ : PMF M} {R : X → Z → Prop} {A A' : Set X} {ε ε' : ℝ} (h : C.Solves μ ε R A) (hε : ε ≤ ε') (hA : A' ⊆ A) :
                    C.Solves μ ε' R A'
                    theorem Cslib.RandomizedCost.solves_pure {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {m : M} {R : X → Z → Prop} {A : Set X} {ε : ℝ} (hm : C.DetSolves m R A) (hε : 0 ≤ ε) :
                    C.Solves (PMF.pure m) ε R A

                    A deterministic strategy solving R on A solves it as a point-mass mixture with any nonnegative error budget.

                    theorem Cslib.RandomizedCost.ecomplexity_le_maxCost {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {μ : PMF M} {R : X → Z → Prop} {A : Set X} {ε : ℝ} (h : C.Solves μ ε R A) :
                    theorem Cslib.RandomizedCost.le_ecomplexity_iff {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε : ℝ} {k : ℕ∞} :
                    k ≤ C.ecomplexity ε R A ↔ ∀ (μ : PMF M), C.Solves μ ε R A → k ≤ Probability.PMF.maxCost C.cost μ
                    theorem Cslib.RandomizedCost.ecomplexity_le_iff {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε : ℝ} {k : ℕ} :
                    C.ecomplexity ε R A ≤ ↑k ↔ ∃ (μ : PMF M), C.Solves μ ε R A ∧ Probability.PMF.maxCost C.cost μ ≤ ↑k
                    theorem Cslib.RandomizedCost.ecomplexity_anti {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε ε' : ℝ} (hε : ε ≤ ε') :
                    C.ecomplexity ε' R A ≤ C.ecomplexity ε R A

                    Allowing larger error cannot increase public-coin complexity.

                    theorem Cslib.RandomizedCost.ecomplexity_mono {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A A' : Set X} {ε : ℝ} (hA : A' ⊆ A) :
                    C.ecomplexity ε R A' ≤ C.ecomplexity ε R A

                    Restricting the promise set cannot increase public-coin complexity.

                    theorem Cslib.RandomizedCost.ecomplexity_le_detComplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε : ℝ} (hε : 0 ≤ ε) :

                    Public-coin mixtures with nonnegative error are at least as cheap as deterministic strategies.

                    theorem Cslib.RandomizedCost.ecomplexity_comap_le {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {A : Set X} {ε : ℝ} {M' : Type u_1} {X' : Type u_2} {C' : RandomizedCost M' X' Z} (φ : M' → M) (g : X → X') (heval : ∀ (m' : M') (x : X), C.eval (φ m') x = C'.eval m' (g x)) (hcost : ∀ (m' : M'), C.cost (φ m') ≤ C'.cost m') {S : X' → Z → Prop} {B : Set X'} (hg : Set.MapsTo g A B) :
                    C.ecomplexity ε (fun (x : X) (z : Z) => S (g x) z) A ≤ C'.ecomplexity ε S B

                    Translating strategies along φ : M' → M and inputs along g : X → X' without increasing cost bounds public-coin complexity under C by that under C'.

                    theorem Cslib.RandomizedCost.Solves.exists_distributionalError_le {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {μ : PMF M} {R : X → Z → Prop} {A : Set X} {ε : ℝ} (h : C.Solves μ ε R A) (ν : PMF X) (hν : ∀ x ∈ ν.support, x ∈ A) :
                    ∃ m ∈ μ.support, C.distributionalError m ν R ≤ ε

                    Averaging lower-bound step: if μ solves R on A with error ε, then for every input distribution ν supported on A some strategy in μ.support has distributional error at most ε under ν.

                    theorem Cslib.RandomizedCost.distributionalComplexity_le_ecomplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ν : PMF X} {ε : ℝ} (hν : ∀ x ∈ ν.support, x ∈ A) :

                    Under every input distribution ν supported on A, distributional complexity is at most public-coin complexity on A.

                    theorem Cslib.RandomizedCost.ecomplexity_le_of_forall_distributionalComplexity_le {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε : ℝ} [Finite ↑A] {c : ℕ} (hc : ∃ (m : M), C.cost m ≤ c) (h : ∀ (ν : PMF X), (∀ x ∈ ν.support, x ∈ A) → C.distributionalComplexity ε R ν ≤ ↑c) :
                    C.ecomplexity ε R A ≤ ↑c

                    Minimax converse on a finite promise set A: if at least one strategy has cost at most c and every input distribution supported on A admits a deterministic strategy of cost at most c and error at most ε, then C.ecomplexity ε R A ≤ c.

                    theorem Cslib.RandomizedCost.ecomplexity_le_iff_forall_distributionalComplexity_le {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε : ℝ} [Finite ↑A] {c : ℕ} (hc : ∃ (m : M), C.cost m ≤ c) :
                    C.ecomplexity ε R A ≤ ↑c ↔ ∀ (ν : PMF X), (∀ x ∈ ν.support, x ∈ A) → C.distributionalComplexity ε R ν ≤ ↑c

                    Budget-c minimax equivalence on a finite promise set A: when a strategy of cost at most c exists, public-coin complexity is at most c iff distributional complexity is at most c under every distribution supported on A.

                    theorem Cslib.RandomizedCost.ecomplexity_eq_iSup_distributionalComplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {A : Set X} {ε : ℝ} [Finite ↑A] (h0 : ∃ (m : M), C.cost m = 0) :
                    C.ecomplexity ε R A = ⨆ (ν : PMF X), ⨆ (_ : ∀ x ∈ ν.support, x ∈ A), C.distributionalComplexity ε R ν

                    Minimax supremum characterization on a finite promise set A: when a zero-cost strategy exists, public-coin complexity equals the supremum of distributional complexities over input distributions supported on A.

                    theorem Cslib.RandomizedCost.ecomplexityFun_eq_iSup_distributionalComplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {ε : ℝ} [Finite X] (h0 : ∃ (m : M), C.cost m = 0) (f : X → Z) :
                    C.ecomplexityFun ε f = ⨆ (ν : PMF X), C.distributionalComplexity ε (fun (x : X) (z : Z) => f x = z) ν

                    Minimax supremum characterization for computing a total function f : X → Z on a finite input type.

                    Majority error amplification for Boolean strategies #

                    noncomputable def Cslib.RandomizedCost.amplify {M : Type u} {X : Type v} :
                    RandomizedCost M X Bool → (runAll : {k : ℕ} → (Fin k → M) → ((Fin k → Bool) → Bool) → M) → (μ : PMF M) → (r : ℕ) → PMF M

                    Strict majority of 2 r independent draws from μ, sequenced by runAll.

                    Instances For
                      theorem Cslib.RandomizedCost.maxCost_amplify_le {M : Type u} {X : Type v} {C : RandomizedCost M X Bool} {runAll : {k : ℕ} → (Fin k → M) → ((Fin k → Bool) → Bool) → M} {μ : PMF M} (hcost : ∀ {k d : ℕ} {ms : Fin k → M} {g : (Fin k → Bool) → Bool}, (∀ (i : Fin k), C.cost (ms i) ≤ d) → C.cost (runAll ms g) ≤ k * d) {c : ℕ} (hμ : Probability.PMF.maxCost C.cost μ ≤ ↑c) (r : ℕ) :
                      Probability.PMF.maxCost C.cost (C.amplify (fun {k : ℕ} => runAll) μ r) ≤ 2 * ↑r * ↑c

                      Sequencing 2 r draws of cost at most c has support cost at most 2 r c.

                      theorem Cslib.RandomizedCost.Solves.amplify {M : Type u} {X : Type v} {C : RandomizedCost M X Bool} {runAll : {k : ℕ} → (Fin k → M) → ((Fin k → Bool) → Bool) → M} {μ : PMF M} {f : X → Bool} {A : Set X} {ε : ℝ} (heval : ∀ {k : ℕ} (ms : Fin k → M) (g : (Fin k → Bool) → Bool) (x : X), C.eval (runAll ms g) x = g fun (i : Fin k) => C.eval (ms i) x) (hμ : C.Solves μ ε (fun (x : X) (b : Bool) => f x = b) A) (hε : ε ≤ 1 / 2) (r : ℕ) :
                      C.Solves (C.amplify (fun {k : ℕ} => runAll) μ r) ((4 * ε * (1 - ε)) ^ r) (fun (x : X) (b : Bool) => f x = b) A

                      Strict-majority error reduction: if μ computes f on A with error ε ≤ 1 / 2, then the strict majority of 2 r independent runs computes f on A with error (4 ε (1 - ε)) ^ r.

                      theorem Cslib.RandomizedCost.ecomplexity_le_two_mul_mul {M : Type u} {X : Type v} {C : RandomizedCost M X Bool} {runAll : {k : ℕ} → (Fin k → M) → ((Fin k → Bool) → Bool) → M} {f : X → Bool} {A : Set X} {ε : ℝ} (heval : ∀ {k : ℕ} (ms : Fin k → M) (g : (Fin k → Bool) → Bool) (x : X), C.eval (runAll ms g) x = g fun (i : Fin k) => C.eval (ms i) x) (hcost : ∀ {k d : ℕ} {ms : Fin k → M} {g : (Fin k → Bool) → Bool}, (∀ (i : Fin k), C.cost (ms i) ≤ d) → C.cost (runAll ms g) ≤ k * d) (h0 : ∃ (m : M), C.cost m = 0) (hε : ε ≤ 1 / 2) (r : ℕ) :
                      C.ecomplexity ((4 * ε * (1 - ε)) ^ r) (fun (x : X) (b : Bool) => f x = b) A ≤ 2 * ↑r * C.ecomplexity ε (fun (x : X) (b : Bool) => f x = b) A

                      Public-coin cost bound under majority repetition on A: reducing error ε ≤ 1 / 2 to (4 ε (1 - ε)) ^ r multiplies complexity by at most 2 r.

                      theorem Cslib.RandomizedCost.ecomplexityFun_le_two_mul_mul {M : Type u} {X : Type v} {C : RandomizedCost M X Bool} {runAll : {k : ℕ} → (Fin k → M) → ((Fin k → Bool) → Bool) → M} {f : X → Bool} {ε : ℝ} (heval : ∀ {k : ℕ} (ms : Fin k → M) (g : (Fin k → Bool) → Bool) (x : X), C.eval (runAll ms g) x = g fun (i : Fin k) => C.eval (ms i) x) (hcost : ∀ {k d : ℕ} {ms : Fin k → M} {g : (Fin k → Bool) → Bool}, (∀ (i : Fin k), C.cost (ms i) ≤ d) → C.cost (runAll ms g) ≤ k * d) (h0 : ∃ (m : M), C.cost m = 0) (hε : ε ≤ 1 / 2) (r : ℕ) :
                      C.ecomplexityFun ((4 * ε * (1 - ε)) ^ r) f ≤ 2 * ↑r * C.ecomplexityFun ε f

                      Public-coin cost bound under majority repetition for a total Boolean function f : X → Bool.

                      theorem Cslib.RandomizedCost.ecomplexityFun_le_two_mul_mul_one_third {M : Type u} {X : Type v} {C : RandomizedCost M X Bool} {runAll : {k : ℕ} → (Fin k → M) → ((Fin k → Bool) → Bool) → M} {f : X → Bool} (heval : ∀ {k : ℕ} (ms : Fin k → M) (g : (Fin k → Bool) → Bool) (x : X), C.eval (runAll ms g) x = g fun (i : Fin k) => C.eval (ms i) x) (hcost : ∀ {k d : ℕ} {ms : Fin k → M} {g : (Fin k → Bool) → Bool}, (∀ (i : Fin k), C.cost (ms i) ≤ d) → C.cost (runAll ms g) ≤ k * d) (h0 : ∃ (m : M), C.cost m = 0) (r : ℕ) :
                      C.ecomplexityFun ((8 / 9) ^ r) f ≤ 2 * ↑r * C.ecomplexityFun (1 / 3) f

                      Specialization of ecomplexityFun_le_two_mul_mul from error 1 / 3 to (8 / 9) ^ r in 2 r runs.

                      Finitely supported mixtures (StdSimplex) and ℕ-valued Yao minimax #

                      noncomputable def Cslib.RandomizedCost.simplexComplexity {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (ε : NNReal) (R : X → Z → Prop) :

                      Least worst-case support cost in ℕ of a finitely supported mixture (StdSimplex ℝ M) solving R on all inputs with nonnegative error budget ε.

                      Instances For
                        noncomputable def Cslib.RandomizedCost.simplexDistributionalComplexity {M : Type u} {X : Type v} {Z : Type w} (C : RandomizedCost M X Z) (ε : NNReal) (ν : Convexity.StdSimplex ℝ X) (R : X → Z → Prop) :

                        Least cost in ℕ of a deterministic strategy erring with probability at most ε under a finitely supported input distribution ν : StdSimplex ℝ X.

                        Instances For
                          theorem Cslib.RandomizedCost.simplexComplexity_le_maxCost {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} {μ : Convexity.StdSimplex ℝ M} (h : ∀ (x : X), Convexity.StdSimplex.errorProb (fun (m : M) => R x (C.eval m x)) μ ≤ ↑ε) :
                          theorem Cslib.RandomizedCost.simplexDistributionalComplexity_le_cost {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ν : Convexity.StdSimplex ℝ X} {ε : NNReal} {m : M} (h : Convexity.StdSimplex.errorProb (fun (x : X) => R x (C.eval m x)) ν ≤ ↑ε) :
                          theorem Cslib.RandomizedCost.exists_simplexComplexity_eq {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} (hex : ∃ (m : M), ∀ (x : X), R x (C.eval m x)) :
                          ∃ (μ : Convexity.StdSimplex ℝ M), (∀ (x : X), Convexity.StdSimplex.errorProb (fun (m : M) => R x (C.eval m x)) μ ≤ ↑ε) ∧ Convexity.StdSimplex.maxCost C.cost μ = C.simplexComplexity ε R

                          When some deterministic strategy solves R everywhere, simplexComplexity is attained.

                          theorem Cslib.RandomizedCost.exists_simplexDistributionalComplexity_eq {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} (ν : Convexity.StdSimplex ℝ X) (hex : ∃ (m : M), ∀ (x : X), R x (C.eval m x)) :
                          ∃ (m : M), Convexity.StdSimplex.errorProb (fun (x : X) => R x (C.eval m x)) ν ≤ ↑ε ∧ C.cost m = C.simplexDistributionalComplexity ε ν R

                          When some deterministic strategy solves R everywhere, simplexDistributionalComplexity is attained.

                          theorem Cslib.RandomizedCost.simplexDistributionalComplexity_le_simplexComplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} (ν : Convexity.StdSimplex ℝ X) (hex : ∃ (m : M), ∀ (x : X), R x (C.eval m x)) :

                          Averaging lower bound on StdSimplex: distributional complexity under any ν is at most randomized complexity.

                          theorem Cslib.RandomizedCost.simplexComplexity_le_iff_forall_simplexDistributionalComplexity_le {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} {d : ℕ} [Finite X] [Nonempty X] (hex : ∃ (m : M), ∀ (x : X), R x (C.eval m x)) :

                          Budget-d minimax equivalence on StdSimplex over a finite nonempty input space.

                          theorem Cslib.RandomizedCost.simplexComplexity_eq_iSup_simplexDistributionalComplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} [Finite X] [Nonempty X] (hex : ∃ (m : M), ∀ (x : X), R x (C.eval m x)) :

                          Minimax supremum characterization on StdSimplex: randomized complexity equals the supremum of distributional complexities over input distributions.

                          theorem Cslib.RandomizedCost.exists_simplexDistributionalComplexity_eq_simplexComplexity {M : Type u} {X : Type v} {Z : Type w} {C : RandomizedCost M X Z} {R : X → Z → Prop} {ε : NNReal} [Finite X] [Nonempty X] (hex : ∃ (m : M), ∀ (x : X), R x (C.eval m x)) :

                          Attainment of a hardest input distribution on StdSimplex.

                          Coin-fixed zero-error expected cost and Yao averaging #

                          theorem Cslib.RandomizedCost.tsum_pure_snd_natCast {Y : Type w} (p : Y × ℕ) :
                          ∑' (z : Y × ℕ), (PMF.pure p) z * ↑z.2 = ↑p.2

                          Expected second component of a point-mass (output, cost) law PMF.pure p.

                          theorem Cslib.RandomizedCost.tsum_snd_eq_of_bind_pure {M : Type u} {Y : Type w} (μ : PMF M) (out : M → Y) (c : M → ℕ) {run : PMF (Y × ℕ)} (hrun : run = μ.bind fun (m : M) => PMF.pure (out m, c m)) :
                          ∑' (z : Y × ℕ), run z * ↑z.2 = ∑' (m : M), μ m * ↑(c m)

                          When a joint (output, cost) law run is a mixture μ.bind fun m => PMF.pure (out m, c m) of deterministic outcomes, its expected cost is the μ-average of c.

                          theorem Cslib.RandomizedCost.good_of_mem_support_coinFixing {M : Type u} {X : Type v} {Y : Type w} {μ : PMF M} {run : X → PMF (Y × ℕ)} {evalOut : M → X → Y} {costAt : M → X → ℕ} {A : Set X} {Good : X → Y → Prop} (hcorr : ∀ x ∈ A, ∀ y ∈ (PMF.map Prod.fst (run x)).support, Good x y) (hlaw : ∀ x ∈ A, run x = μ.bind fun (m : M) => PMF.pure (evalOut m x, costAt m x)) {m : M} (hm : m ∈ μ.support) (x : X) :
                          x ∈ A → Good x (evalOut m x)

                          Every strategy in the support of a coin-fixing law μ inherits any zero-error output property Good satisfied across the supported outputs of run x.

                          theorem Cslib.RandomizedCost.exists_mem_support_of_coinFixing {M : Type u} {X : Type v} {Y : Type w} (μ : PMF M) (ν : PMF X) (run : X → PMF (Y × ℕ)) (evalOut : M → X → Y) (costAt : M → X → ℕ) (A : Set X) (Good : X → Y → Prop) (hcorr : ∀ x ∈ A, ∀ y ∈ (PMF.map Prod.fst (run x)).support, Good x y) (hlawA : ∀ x ∈ A, run x = μ.bind fun (m : M) => PMF.pure (evalOut m x, costAt m x)) (hlawν : ∀ x ∈ ν.support, run x = μ.bind fun (m : M) => PMF.pure (evalOut m x, costAt m x)) :
                          ∃ m ∈ μ.support, (∀ x ∈ A, Good x (evalOut m x)) ∧ ∑' (x : X), ν x * ↑(costAt m x) ≤ ∑' (x : X), ν x * ∑' (z : Y × ℕ), (run x) z * ↑z.2

                          Coin-fixing averaging for zero-error computations: if run x decomposes through a coin law μ on A and on ν.support, and every supported output on A satisfies Good x, then some deterministic m ∈ μ.support satisfies Good x (evalOut m x) for all x ∈ A and has ν-expected cost at most the ν-expected cost of run.

                          theorem Cslib.RandomizedCost.exists_mem_support_tsum_mul_le_of_coinFixing {M : Type u} {X : Type v} {Y : Type w} (μ : PMF M) (ν : PMF X) (run : X → PMF (Y × ℕ)) (evalOut : M → X → Y) (costAt : M → X → ℕ) (A : Set X) (Good : X → Y → Prop) (hcorr : ∀ x ∈ A, ∀ y ∈ (PMF.map Prod.fst (run x)).support, Good x y) (hlawA : ∀ x ∈ A, run x = μ.bind fun (m : M) => PMF.pure (evalOut m x, costAt m x)) (hlawν : ∀ x ∈ ν.support, run x = μ.bind fun (m : M) => PMF.pure (evalOut m x, costAt m x)) {ε : ENNReal} (hε : ∀ x ∈ ν.support, ∑' (z : Y × ℕ), (run x) z * ↑z.2 ≤ ε) :
                          ∃ m ∈ μ.support, (∀ x ∈ A, Good x (evalOut m x)) ∧ ∑' (x : X), ν x * ↑(costAt m x) ≤ ε

                          Uniform-budget specialization of exists_mem_support_of_coinFixing: when expected cost on every x ∈ ν.support is at most ε, some m ∈ μ.support preserves Good on A and has ν-expected cost at most ε.