Documentation

CslibFrontier.Computability.QueryComplexity.AndOrTree

The AND–OR tree is evasive #

The complete binary NAND tree of depth d (QueryComplexity.nandTree d) has n = 2 ^ d leaves, addressed by their root-to-leaf paths Fin d → Bool (false for the left child). A leaf reads its input bit, and an internal node outputs the NAND of its two children.

The complete binary AND–OR tree T_{2,k} of depth 2k (QueryComplexity.andOrTree k) has n = 4 ^ k leaves and alternating levels of gates, AND (MIN) at even distance from the root and OR (MAX) at odd distance Motwani and Raghavan, Section 2.1. The OR–AND tree of depth 2k (QueryComplexity.orAndTree k), with OR at the root, is the NAND tree of depth 2k, since NAND(NAND(a, b), NAND(c, d)) = (a ∧ b) ∨ (c ∧ d) (QueryComplexity.orAndTree_eq_nandTree). By De Morgan duality the AND–OR tree is the dual x ↦ ¬ g(¬ x) of the OR–AND tree g (QueryComplexity.andOrTree_eq_not_orAndTree), so results transfer between the two orientations through dual decision trees (DecisionTree.dual).

Every deterministic decision tree computing the NAND tree queries all n leaves on some input (QueryComplexity.exists_queries_eq_univ_of_computes_nandTree), so D = n (QueryComplexity.complexity_nandTree), and likewise for the AND–OR and OR–AND trees (QueryComplexity.exists_queries_eq_univ_of_computes_andOrTree, QueryComplexity.complexity_andOrTree). This follows from the parity criterion (DecisionTree.exists_queries_eq_univ_of_fourierCoeff_univ_ne_zero): the sum over the inputs of (-1) ^ f(x) χ_{[n]}(x) is 2 at every depth (QueryComplexity.sum_signVal_nandTree_mul_chi), because splitting the input of a node into those of its two subtrees gives the recurrence s ↦ s² / 2.

Main definitions #

Main results #

References #

def Cslib.QueryComplexity.nandTree (d : ℕ) :
((Fin d → Bool) → Bool) → Bool

The complete binary NAND tree of depth d, on the 2 ^ d leaves addressed by root-to-leaf paths (false for the left child): a leaf reads its bit, and a node is the NAND of its children.

def Cslib.QueryComplexity.andOrTree (k : ℕ) :
((Fin (2 * k) → Bool) → Bool) → Bool

The complete binary AND–OR tree T_{2,k} of depth 2k Motwani and Raghavan, Section 2.1: an AND of two ORs at the root, each OR of two copies of T_{2,k-1}, with leaves addressed by root-to-leaf paths.

def Cslib.QueryComplexity.orAndTree (k : ℕ) :
((Fin (2 * k) → Bool) → Bool) → Bool

The complete binary OR–AND tree of depth 2k: an OR of two ANDs at the root, each AND of two copies of the OR–AND tree of depth 2k - 2, with leaves addressed by root-to-leaf paths.

theorem Cslib.QueryComplexity.nandTree_succ (d : ℕ) (x : (Fin (d + 1) → Bool) → Bool) :
nandTree (d + 1) x = !((nandTree d fun (p : Fin d → Bool) => x (Fin.cons false p)) && nandTree d fun (p : Fin d → Bool) => x (Fin.cons true p))

The OR–AND tree of depth 2k is the NAND tree of depth 2k.

theorem Cslib.QueryComplexity.andOrTree_eq_not_orAndTree (k : ℕ) (x : (Fin (2 * k) → Bool) → Bool) :
andOrTree k x = !orAndTree k fun (p : Fin (2 * k) → Bool) => !x p

De Morgan duality: the AND–OR tree is the dual of the OR–AND tree.

The character of all leaves splits as the product of the characters of the leaves of the two subtrees.

The top Fourier coefficient of the NAND tree, unnormalized: the sum over the inputs of (-1) ^ f(x) χ_{[n]}(x) is 2 at every depth.

The top Fourier coefficient of the NAND tree, read as signs, is nonzero.

The NAND tree is evasive: every decision tree computing it queries all 2 ^ d leaves on some input.

D = n for the NAND tree on n = 2 ^ d leaves.

Every decision tree computing the OR–AND tree queries all 4 ^ k leaves on some input.

D = 4 ^ k for the OR–AND tree of depth 2k.

The AND–OR tree is evasive Motwani and Raghavan, Section 2.1: every deterministic decision tree computing T_{2,k} queries all 4 ^ k leaves on some input.

D(T_{2,k}) = 4 ^ k: the deterministic decision tree complexity of the AND–OR tree is its number of leaves.