Hostname: page-component-89b8bd64d-rbxfs Total loading time: 0 Render date: 2026-05-09T00:13:03.418Z Has data issue: false hasContentIssue false

Level-p-complexity of Boolean functions using thinning, memoization, and polynomials

Published online by Cambridge University Press:  12 December 2023

JULIA JANSSON
Affiliation:
Chalmers University of Technology and University of Gothenburg, Göteborg, Sweden (e-mail: juljans@chalmers.se)
PATRIK JANSSON
Affiliation:
Chalmers University of Technology and University of Gothenburg, Göteborg, Sweden (e-mail: patrikj@chalmers.se)
Rights & Permissions [Opens in a new window]

Abstract

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 (sets of) polynomials, and the order relation used for thinning is implemented using polynomial factorization and root counting. Finally, we compute the complexity for two-level iterated majority and improve on an earlier result by J. Jansson.

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2023. Published by Cambridge University Press
Figure 0

Fig. 1. The four polynomials computed by ${\mathit{genAlgThinMemo}\;\mathrm{5}\;\mathit{sim}_{5}}$.

Figure 1

Fig. 2. Expected costs of the two different decision trees. Because they are very close we also show their difference in Figure 3.

Figure 2

Fig. 3. Difference between the conjectured ($P_t$) and the true ($P_*$) complexity of $\mathit{maj}_3^2$.

Figure 3

Fig. 4. The tree of subfunctions of a Boolean function ${\mathit{f}}$. This tree structure is also the call graph for our generation of decision trees. Note that this tree structure is related to, but not the same as, the decision trees.

Figure 4

Fig. 5. The tree of subfunctions of the ${{\mathit{dict}_{\mathit{n}\mathbin{+}\mathrm{1}}}}$ function.

Figure 5

Fig. 6. An example of a decision tree for ${\mathit{maj}_{3}}$. The root node branches on the value of bit 0. If it is ${\mathbf{0}}$, it picks bit 2, while if it is ${\mathbf{1}}$, it picks bit 1. It then picks the last remaining bit if necessary.

Figure 6

Fig. 7. The recursive structure of the parity function (${\mathit{par}_{\!\mathit{n}}}$). The pattern repeats all the way down to ${\mathit{par}_{\!\mathrm{0}}\mathrel{=}{\mathit{const}_{\mathrm{0}}}\;{\mathbf{0}}{}}$.

Figure 7

Fig. 8. A simplified computation tree of ${genAlg}_{\mathrm{3}}\;{maj}_{3}$. In each node, ${f}\mapsto {ps}$ shows the input f and output ${ps}={genAlg}_{n}\;{f}$ of each local call. As all the functions involved are “symmetric” in the index (${setBit}\;{i}\;{b}\;{f} == {setBit}\;{j}\;{b}\;{f}$ for all i and j), we only show edges for 0 and 1 from each level.

Figure 8

Fig. 9. To compare two polynomials ${\mathit{p}}$ and ${\mathit{q}}$ we use root counting for ${\mathit{q}\mathbin{-}\mathit{p}}$ and these are the three main cases to consider.

Figure 9

Fig. 10. Fig. 10. Level-${\mathit{p}}$-complexity of ${\mathit{sim}_{5}}$, where the dots show the intersections of the costs of the decision trees.

Submit a response

Discussions

No Discussions have been published for this article.