Documentation

CslibFrontier.Computability.QueryComplexity.Randomized.ZeroError

Zero-error randomized decision trees and expected query cost #

A randomized decision tree μ (RandomizedDecisionTree) draws a deterministic decision tree and runs it. Its expected cost on an input x is the expected number of queries the drawn tree makes on x (RandomizedDecisionTree.expectedCost). The zero-error (Las Vegas) randomized decision tree complexity R₀(f) is the least c such that some randomized decision tree that is always correct (μ.Computes 0 f) makes at most c queries in expectation on every input (QueryComplexity.zeroErrorComplexity) [BdW02], [MR95].

This differs from QueryComplexity.randomizedComplexity 0 f, which charges the worst case over the coins and equals the deterministic complexity D(f). Expected cost can be much smaller: for the complete binary AND–OR tree on n = 4 ^ k leaves D = n while R₀ ≤ n ^ (log₄ 3) (CslibFrontier.Computability.QueryComplexity.AndOrTree.Randomized). Always R₀(f) ≤ D(f) (QueryComplexity.zeroErrorComplexity_le_complexity).

The uniform mixture of a finite family of trees (RandomizedDecisionTree.uniformMixture) draws a member of the family uniformly; its expected cost is the average of the costs (RandomizedDecisionTree.expectedCost_uniformMixture). This describes a randomized algorithm whose coin tosses select a deterministic tree.

Main definitions #

Main results #

References #

noncomputable def Cslib.RandomizedDecisionTree.expectedCost {ι : Type u_1} {β : Type u_2} (μ : RandomizedDecisionTree ι β) (x : ι → Bool) :

The expected number of queries that the tree drawn from μ makes on the input x.

theorem Cslib.RandomizedDecisionTree.expectedCost_eq_sum {ι : Type u_1} {β : Type u_2} (μ : RandomizedDecisionTree ι β) (x : ι → Bool) :
μ.expectedCost x = μ.sum fun (t : DecisionTree ι β) (w : ℝ) => w * ↑(t.cost x)

Express expected cost as the finite weighted sum over the sampled trees.

theorem Cslib.RandomizedDecisionTree.expectedCost_map {ι : Type u_1} {β : Type u_2} {C : Type u_3} (p : Convexity.StdSimplex ℝ C) (g : C → DecisionTree ι β) (x : ι → Bool) :
expectedCost (Convexity.StdSimplex.map g p) x = p.sum fun (c : C) (w : ℝ) => w * ↑((g c).cost x)

Sampling an index and running its associated tree averages the costs over the indices.

theorem Cslib.RandomizedDecisionTree.expectedCost_nonneg {ι : Type u_1} {β : Type u_2} {μ : RandomizedDecisionTree ι β} {x : ι → Bool} :
@[simp]
theorem Cslib.RandomizedDecisionTree.expectedCost_single {ι : Type u_1} {β : Type u_2} (t : DecisionTree ι β) (x : ι → Bool) :

A deterministic tree makes its own number of queries.

theorem Cslib.RandomizedDecisionTree.expectedCost_le_depth {ι : Type u_1} {β : Type u_2} {μ : RandomizedDecisionTree ι β} {x : ι → Bool} :

The expected cost is at most the depth, the worst case over the inputs and the coins.

noncomputable def Cslib.RandomizedDecisionTree.uniformMixture {ι : Type u_1} {β : Type u_2} {C : Type u_3} [Fintype C] [Nonempty C] (g : C → DecisionTree ι β) :

The uniform mixture of a finite family g of decision trees: draw c uniformly from C and run g c.

theorem Cslib.RandomizedDecisionTree.exists_eq_of_mem_support_uniformMixture {ι : Type u_1} {β : Type u_2} {C : Type u_3} [Fintype C] [Nonempty C] {g : C → DecisionTree ι β} {t : DecisionTree ι β} (ht : t ∈ (uniformMixture g).support) :
∃ (c : C), g c = t

Every tree that the uniform mixture can draw is a member of the family.

theorem Cslib.RandomizedDecisionTree.computes_uniformMixture {ι : Type u_1} {β : Type u_2} {C : Type u_3} [Fintype C] [Nonempty C] {g : C → DecisionTree ι β} {f : (ι → Bool) → β} (hg : ∀ (c : C), (g c).Computes f) :

The uniform mixture of trees computing f computes f with error 0.

theorem Cslib.RandomizedDecisionTree.expectedCost_uniformMixture {ι : Type u_1} {β : Type u_2} {C : Type u_3} [Fintype C] [Nonempty C] (g : C → DecisionTree ι β) (x : ι → Bool) :
(uniformMixture g).expectedCost x = Finset.univ.expect fun (c : C) => ↑((g c).cost x)

The expected cost of the uniform mixture of g is the average over c of the cost of g c.

theorem Cslib.RandomizedDecisionTree.errorProb_uniformMixture {ι : Type u_1} {β : Type u_2} {C : Type u_3} [Fintype C] [Nonempty C] [DecidableEq β] (g : C → DecisionTree ι β) (f : (ι → Bool) → β) (x : ι → Bool) :
(uniformMixture g).errorProb f x = ↑{c : C | (g c).eval x ≠ f x}.card / ↑(Fintype.card C)

The error probability of the uniform mixture of g on x is the fraction of the members of the family that answer wrongly on x.

noncomputable def Cslib.QueryComplexity.zeroErrorComplexity {ι : Type u_1} {β : Type u_2} [Finite ι] (f : (ι → Bool) → β) :

The zero-error (Las Vegas) randomized decision tree complexity R₀(f): the least c such that some randomized decision tree computing f with error 0 makes at most c queries in expectation on every input. The finite coordinate space guarantees a correct deterministic tree, so the feasible set is nonempty.

theorem Cslib.QueryComplexity.zeroErrorComplexity_le {ι : Type u_1} {β : Type u_2} {f : (ι → Bool) → β} [Finite ι] {μ : RandomizedDecisionTree ι β} {c : ℝ} (hμ : μ.Computes 0 f) (hc : ∀ (x : ι → Bool), μ.expectedCost x ≤ c) :

An always-correct randomized decision tree making at most c queries in expectation on every input bounds R₀(f) by c.

theorem Cslib.QueryComplexity.le_zeroErrorComplexity {ι : Type u_1} {β : Type u_2} {f : (ι → Bool) → β} [Finite ι] {c : ℝ} (hc : ∀ (μ : RandomizedDecisionTree ι β) (d : ℝ), μ.Computes 0 f → (∀ (x : ι → Bool), μ.expectedCost x ≤ d) → c ≤ d) :

A lower bound valid for every feasible randomized expected-cost bound also bounds R₀.

theorem Cslib.QueryComplexity.zeroErrorComplexity_nonneg {ι : Type u_1} {β : Type u_2} {f : (ι → Bool) → β} [Finite ι] :

Randomness with zero error does not hurt: R₀(f) ≤ D(f).

theorem Cslib.QueryComplexity.one_le_zeroErrorComplexity {ι : Type u_1} {β : Type u_2} {f : (ι → Bool) → β} [Finite ι] (hf : ∃ (x : ι → Bool) (y : ι → Bool), f x ≠ f y) :

A nonconstant function needs at least one query in expectation: 1 ≤ R₀(f). Every tree computing f is a node, so it makes at least one query on every input.