This paper describes a purely functional library for computing level-$p$-complexity of Boolean functions, and applies it to two-level iterated majority. Boolean functions are simply functions from $n$ bits to one bit, and they can describe digital circuits, voting systems, etc. An example of a Boolean function is majority, which returns the value that has majority among the $n$ input bits for odd $n$. The complexity of a Boolean function $f$ measures the cost of evaluating it: how many bits of the input are needed to be certain about the result of $f$. There are many competing complexity measures but we focus on level-$p$-complexity -- a function of the probability $p$ that a bit is 1. The level-$p$-complexity $D_p(f)$ is the minimum expected cost when the input bits are independent and identically distributed with Bernoulli($p$) distribution. We specify the problem as choosing the minimum expected cost of all possible decision trees -- which directly translates to a clearly correct, but very inefficient implementation. The library uses thinning and memoization for efficiency and type classes for separation of concerns. The complexity is represented using polynomials, and the order relation used for thinning is implemented using polynomial factorisation and root-counting. Finally we compute the complexity for two-level iterated majority and improve on an earlier result by J.~Jansson.
翻译:本文描述一个纯功能图书馆, 用于计算布尔函数的美元- p$复杂度, 并将其应用于两个层次的重复多数。 布尔函数只是从 $ 位数到 1 位数的函数, 它们可以描述数字电路、 投票系统等。 布林函数的示例是 多数 。 布林函数返回在美元输入位数中占多数的值, 奇数美元。 布林函数的复杂性 $f f 测量了评估成本: 投入中有多少部分需要确定 $f 的复杂度。 有许多相竞的复杂度措施, 但我们侧重于 水平- 美元- complus- Commonlication 的功能。 当输入位数独立且与 Bernoulli( p$) 分布相同时, 问题在于选择所有可能的决定树的最低预期成本 - 直接转换为 J- p- commoncial- commol- complain real real realalational- lax the libal- listal lavemental- listal listal- list and listal- list listal- listal- listal listal- listal- listal- listal- lagal- listal- lactions list lagal- lical- used- lagal- li- lagal- li- li- li- li- li- li- li- li- li- 和 ladal- li- li- li- li- li- 和 li- li- li- 和 li- li- 和 和 or- or- 和 和 和 和 和 和 缩 缩 缩缩缩缩缩缩 缩缩缩缩缩缩 缩 缩 缩 缩 缩 和 和 缩 缩 缩 缩 和 和 缩 缩 缩 缩 缩 缩 缩和 缩和 缩和 缩和 缩和 缩和 缩和 缩 缩和 缩和