{"title":"Level-p-complexity of Boolean functions using thinning, memoization, and polynomials","authors":"JULIA JANSSON, PATRIK JANSSON","doi":"10.1017/s0956796823000102","DOIUrl":null,"url":null,"abstract":"<p>This paper describes a purely functional library for computing level-<span>p</span>-complexity of Boolean functions and applies it to two-level iterated majority. Boolean functions are simply functions from <span>n</span> 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 <span>n</span> input bits for odd <span>n</span>. The complexity of a Boolean function <span>f</span> measures the <span>cost</span> of evaluating it: how many bits of the input are needed to be certain about the result of <span>f</span>. There are many competing complexity measures, but we focus on level-<span>p</span>-complexity — a function of the probability <span>p</span> that a bit is 1. The level-<span>p</span>-complexity <span><span><img data-mimesubtype=\"png\" data-type=\"\" src=\"https://static.cambridge.org/binary/version/id/urn:cambridge.org:id:binary:20231209151452171-0101:S0956796823000102:S0956796823000102_inline1.png\"><span data-mathjax-type=\"texmath\"><span>$D_p(f)$</span></span></img></span></span> is the minimum expected cost when the input bits are independent and identically distributed with Bernoulli(<span>p</span>) 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.</p>","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":"10 1","pages":""},"PeriodicalIF":1.1000,"publicationDate":"2023-12-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Functional Programming","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1017/s0956796823000102","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0
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.
本文描述了一个用于计算布尔函数级数-p 复杂性的纯函数库,并将其应用于两级迭代多数。布尔函数是简单的从 n 位到 1 位的函数,可以描述数字电路、投票系统等。布尔函数的一个例子是多数函数,它返回奇数 n 的 n 个输入比特中的多数值。布尔函数 f 的复杂度衡量的是求值的成本:需要多少比特的输入才能确定 f 的结果。有许多相互竞争的复杂度度量,但我们关注的是水平-比特复杂度--一个比特为 1 的概率 p 的函数。水平-比特复杂度 $D_p(f)$ 是当输入比特是独立且相同的伯努利(p)分布时的最小预期成本。我们将问题定义为从所有可能的决策树中选择最小的预期成本--这直接转化为一个明显正确但效率极低的实现方法。为了提高效率,库使用了精简和 memoization,并使用类型类来分离关注点。复杂度使用(多项式集)表示,而用于稀疏化的阶次关系则使用多项式因式分解和根计数来实现。最后,我们计算了两级迭代多数的复杂度,并改进了 J. Jansson 早期的一个结果。
期刊介绍:
Journal of Functional Programming is the only journal devoted solely to the design, implementation, and application of functional programming languages, spanning the range from mathematical theory to industrial practice. Topics covered include functional languages and extensions, implementation techniques, reasoning and proof, program transformation and synthesis, type systems, type theory, language-based security, memory management, parallelism and applications. The journal is of interest to computer scientists, software engineers, programming language researchers and mathematicians interested in the logical foundations of programming.