In the design of Very Large Scale Integration (VLSI) systems, two-level logic representations are classically used to represent and manipulate Boolean functions. Exclusive-or Sum-of-Products (ESOP) is a two-level normal form representation of a Boolean function that consists of one level of multi-input AND gates followed on the next level by one multi-input XOR gate. ESOP forms play an important role in logic synthesis due to their improved compactness for arithmetic or communication circuits with respect to other two-level representations  and their excellent testability properties . The inherent reversibility of the XOR operation, moreover, makes ESOP forms particularly suitable in applications such as security [12, 10] or quantum computation .
The ESOP representation of a Boolean function is not unique, i.e., the same Boolean function can be expressed as multiple structurally different, but semantically equivalent ESOP forms. In practice, it is important to find a small representation of an ESOP form to reduce the overall costs for realizing it in hardware or implementing it in software. The problem of synthesizing an ESOP form for a given Boolean function is to identify a set of product terms over the Boolean variables of the function such that each minterm in the OFF-set of the function is covered by the product terms an even number of times and each minterm in the ON-set of the Boolean function is covered an odd number of times.
Finding ESOP forms with a small or a minimum number of product terms is hard and numerous exact and heuristic synthesis methods[11, 6, 20, 16, 13, 14] for solving this problem have been proposed. Heuristic methods focus on finding small (but not necessarily minimum) ESOP forms; they are fast, but only examine a subset of the possible search space. Heuristic methods, e.g., the Exorcism approach , usually operate in two phases. In the first phase, an ESOP form with a sub-optimal number of product terms is derived from the Boolean function, e.g., by translating each minterm of the Boolean function into one product term or translating the function into special cases of ESOP forms such as pseudo-Kronecker expressions . In the second phase, the ESOP form is iteratively optimized and reshaped using cube transformations with the overall goal of merging as many product terms as possible. The cube transformations are applied to each pair of product terms that potentially lead to merging them or with other product terms of the ESOP form. The second phase terminates when, after several iterations, no further size reduction is achieved. Heuristic methods produce small ESOP forms in reasonable time, but suffer from local minima that cannot be easily escaped. In contrast, exact methods find an “exact” ESOP form, i.e., an ESOP form with a minimum number of product terms, but either require to store large tables of pre-computed information [16, 13] or suffer from tremendously high runtimes . For instance, the tabular-based methods described by Gaidukov  or Papakonstantinou  require pre-computed tables of all exact ESOP forms for Boolean functions over Boolean variables to derive an exact ESOP form for a Boolean function over Boolean variables. Due to the exponential growth of the number of Boolean functions with the number of Boolean variables, these methods become too time and memory consuming when
. Alternative exact synthesis approaches such as a recent formulation of the ESOP synthesis problem using non-linear programming, can take hundreds of hours for synthesizing a single exact ESOP form.
Until today, a large gap between the number of product terms optimized with heuristic methods and exact methods remains. Where exact methods hardly can deal with more than Boolean variables and a few product terms, heuristic methods nowadays, e.g., in the quantum domain, have to deal with the optimization of ESOP forms with or products terms over and more Boolean variables . Our experiments with large-scale ESOP forms showed that heuristic optimization method can often achieve a reduction of in the number of ESOP terms with respect to the size of the initial ESOP form. Due to the large combinational search space of the ESOP synthesis problem, lower bounds on the number of required product terms are only known for Boolean functions with a few Boolean variables, such that the capabilities of ESOP optimization techniques remain unclear.
In this paper, we investigate the exact synthesis of ESOP forms using Boolean satisfiability (SAT). SAT-based approaches are very successful on a variety of different verification and synthesis problems. We present an exact synthesis approach for computing ESOP forms with a minimum number of product terms. Starting from a specification in form of a possibly incompletely-specified Boolean function, our approach iteratively constructs a Boolean constraint satisfaction problem that is satisfiable if and only if an ESOP form with (initially ) product terms that implements the specification exists. The problem is then solved utilizing a SAT-solver and, if satisfiable, an ESOP form with product terms is returned. Otherwise, if unsatisfiable, is increased and the synthesis process is restarted. The synthesis approach is hardly affected by the number of Boolean variables and particularly fast if the Boolean function can be expressed by using only a few product terms. We argue that such a SAT-based exact synthesis procedure can be a backbone of a new generation of heuristic ESOP optimization methods that, instead of relying on cube transformations applied to a pair of product terms, are capable of optimizing small subsets (windows) of product terms.
The proposed approach is the first ESOP synthesis technique based on Boolean satisfiability. We further present a relaxation of the technique to compute ESOP forms with size close to minimum leveraging the SAT-solver’s conflict limit. We have implemented SAT-based exact synthesis for ESOPs and the relaxation of the approach using an off-the-shelf SAT-solver and show in the experiments that SAT-based ESOP synthesis can be readily used to synthesize ESOP forms with up to Boolean variables and up to terms. As benchmarks, we use completely-specified Boolean functions that are used as representatives of the NPN equivalence classes  as well as completely-specified Boolean functions that appeared in technology mapping using look-up tables (LUTs) with at most inputs (-LUT mapping). Moreover, we use a set of randomly-generated incompletely-specified Boolean functions with up to Boolean variables.
Exclusive-or Sum-of-Products (ESOP). Let and with the third element ‘’ which denotes don’t care. An ESOP form in Boolean variables is a Boolean expression
where the operators and denote standard addition (XOR) and multiplication (AND) in the Galois field with two-elements, respectively, each is a constant and each expression
for and . We say that is the size of the ESOP form and call each conjunction , , that appears in the ESOP form a product term. The Boolean expression in (1) is often compactly notated as a list of words
where each word is of fixed length .
Distance of product terms. Suppose that
are two product terms in Boolean variables. We define the distance of and as the number of different for and , i.e.,
where denote the Iverson brackets. We say if , that and have distance or are -distant.
ESOPs describing Boolean functions. An ESOP form semantically describes a (single-output) Boolean function , which maps assignments of the Boolean variables to truth values . Each assignment to all Boolean variables is called a minterm and can be interpreted as the decimal number when read as .
A completely-specified Boolean function in Boolean variables can be uniquely represented as a truth table, i.e., a word of length , where for . An incompletely-specified Boolean function can be represented by two completely-specified Boolean functions and , where and . We call the care function of .
Two ESOP forms are semantically equivalent if they describe the same Boolean function. An ESOP form with size is minimum if and only if no semantically equivalent ESOP form with less product terms exists. Minimum ESOP forms are in general not unique.
3 SAT-based Exact ESOP Synthesis
3.1 Exact synthesis of ESOP forms
Objective. We aim for synthesizing minimum ESOP forms in Boolean variables when a completely-specified Boolean function or incompletely-specified Boolean function is provided as specification. In case of completely-specified Boolean functions, this objective can be formally described as follows: given a single-output Boolean function over Boolean variables , find an integer and constants for and such that
and is minimum. The case of incompletely-specified Boolean functions can be addressed similarly to (6).
As an introductory example, consider the incompletely-specified Boolean function described by the truth table 0x688C802028222222111We use hexadecimal notation to shorten the string representation of the (binary) truth tables of Boolean functions. over Boolean variables with care function 0x6AAEFF3FFEBFEAA6. A minimum ESOP form, for instance, is
which requires product terms and can be equivalently written as
In general, minimum ESOPs are not unique. The same Boolean function may also be represented as the ESOP form
Finding minimum ESOP forms is, due to the large combinational search space, a challenging problem. In , a minimum ESOP form for the Boolean function in the previous example was found in roughly h using integer non-linear programming and Matlab as a solving engine. The authors, moreover, point out that decomposition-based ESOP synthesis approaches, e.g., , require up to h for synthesizing minimum ESOP forms for incompletely-specified Boolean functions over Boolean variables.
3.2 SAT-based exact synthesis procedure
In this section, we propose a SAT-based exact synthesis approach for ESOP forms. The approach is based on ideas from Kamath et al.  and our previous work on learning two-level patches to correct combinational Boolean circuits . Our approach synthesizes an ESOP form for the Boolean function in Example 1 in less than a second. We formalize the search problem as a series of Boolean constraint satisfaction problems—one for each possible ESOP size (starting with ) and employ a decision procedure for Boolean satisfiability to decide the satisfiability of the constraints. The constraints are constructed in such a way that they are satisfiable if and only if an ESOP form with product terms exists and each satisfying assignment corresponds to an ESOP form with product terms. If the constraints are unsatisfiable, then no ESOP form restricted to product terms, that is equivalent to the provided Boolean function, exists. By systematically solving the constraint satisfaction problem for increasing values of the size parameter , a minimum ESOP form is guaranteed to be found.
Formulation of the constraint satisfaction problem. Suppose that is a (single-output) Boolean function over Boolean variables. We formulate the problem of finding an ESOP form equivalent to with product terms as a constraint satisfaction problem in propositional logic using Boolean variables, , …, and , where is the number of Boolean variables of , is the size of the ESOP form, and
for and .
For each assignment of the Boolean function with the corresponding output value , we introduce auxiliary Boolean variables and add clauses
which ensure that if then the -th product term evaluates to for assignment and if then the -th product term evaluates to for assignment . The if-then-else-operator is defined as
with and , respectively. One additional XOR-constraint
per assignment guarantees that an odd number of s evaluates to if and an even number if .
This constraint satisfaction problem is satisfiable if and only if an ESOP form of size exists and each satisfying assignment and corresponds to one possible implementation.
Translating XOR-constraints to CNF. All XOR-constraints in the constraint satisfaction problem are, by construction, formulated over disjoint sets of Boolean variables such that techniques like Gaussian elimination are not effective. Instead, we translate each XOR-constraint first into an equivalent XOR-clause by flipping one of the Boolean variables if and only if , i.e.,
Then, we select two literals from the XOR-clause and apply the Tseitin transformation to generate four clauses , , , with the newly introduced Boolean variable and repeat this process until only one literal is left which is added as a unit clause.
SAT-based exact ESOP synthesis. The overall exact synthesis procedure is sketched in Algorithm 1. The function MakeCSP constructs the constraint satisfaction problem in the Boolean variables for a given Boolean function and size parameter as described above. The function SAT refers to the invocation of a decision procedure for the Boolean satisfiability problem, usually called a SAT-solver, and is assumed to decide the satisfiability of and, if satisfiable, to also provide a satisfying assignment and for variables and . The assignment to the intermediate Boolean variables is for the construction of no further interest and not returned. Finally, the function MakeESOP constructs an ESOP form from the assignment and according to the rules described in (11). Note that Algorithm 1 always terminates, but may run out of resources (memory or time) if the minimum ESOP requires many product terms. Thus in practice usually an additional termination criterion in form of an upper bound for the size parameter or maximum number of conflicts examined by the SAT-solver is provided.
Counterexample-guided abstraction-refinement. Algorithm 1 synthesizes an ESOP form in one step. Alternatively, counterexample-guided abstraction-refinement can be employed as shown in Algorithm 2. The idea of the abstraction-refinement loop is to iteratively update a candidate ESOP form (starting from the empty ESOP form ) until it eventually becomes semantically equivalent to the Boolean function to be synthesized. In each iteration, the constraints of one assignment for which and evaluate differently () are added (AddConstraints) to the constraint satisfaction problem and is resynthesized. If becomes unsatisfiable, then the constraints cannot be solved within the current restriction to product terms and needs to be relaxed. If and are equivalent, i.e., no counterexample is found by NotEquivalent, then is returned as an ESOP form semantically equivalent to . The main advantage of Algorithm 2 over Algorithm 1 lies in its ability to abstract from unnecessary constraints which keeps the constraint satisfaction problem as small as possible. The algorithm is fast mainly because modern backtrack search-based SAT-solvers support incremental solving  and are able to maintain learned information when new constraints are added to a satisfiability problem. The oracle NotEquivalent has to be capable of verifying whether a candidate ESOP form is functionally equivalent to the Boolean function . For Boolean functions with up to Boolean variables, simulation using explicit representations such as truth tables can be done very quickly. For Boolean functions with more than Boolean variables, BDD- or SAT-based procedure can be employed.
3.3 Extensions and variations
Downward vs. upward search. Algorithm 2 describes an upward search procedure to find a minimum ESOP form starting with term. This approach can be easily modified into a downward search by starting from a maximum number of terms and iteratively decreasing the number of terms by as long as the constraint system is satisfiable. If the constraint system becomes unsatisfiable for a certain number of terms, the previous terms correspond to a minimum ESOP form. In practice downward and upward search procedures are useful. An upward search procedure is fast if the expected minimum is small. Otherwise, proving unsatisfiability with a SAT-solver becomes too time consuming. A downward search procedure is fast if the expected minimum is close to the initially provided term limit .
Conflict limit. For a SAT-solver proving unsatisfiability of a set of constraints, i.e., showing that no assignment exists that satisfies the constraints, often requires labor-intensive analysis. If the search space is sufficiently large, these proofs are often not completed within reasonable time. Most modern SAT-solver provide a conflict limit to allow a user to specify a maximum number of possible solving attempts. If the SAT-solver is unable to find a satisfying assignment within the given conflict limit, the solver reports ‘unknown’ as solution. In this case, the synthesis algorithm can choose to increase or decrease the current hoping that the next is easier to solve because the corresponding constraint system is less or more constrained, respectively. When a conflict limit is employed in Algorithm 2, due to the possible ‘unknown‘ solutions, a minimum ESOP form may not be found. However, in case of a downward search, that systematically decreases , an intermediate ‘unknown‘ solution for can be safely ignored if the constraint system is later proved satisfiable for ; whereas in case of an upward search, an intermediate ‘unknown‘ solution for can be ignored if the constraint system is proved unsatisfiable for a later .
4 Experimental Evaluation
We have implemented Algorithm 2 in easy, an open-source toolkit for manipulating ESOP forms222easy, https://github.com/hriener/easy using the prominent state-of-the-art SAT-solver Glucose 4.1  as decision procedure for Boolean satisfiability.
We have evaluated the SAT-based synthesis approach in three experiments333The benchmarks and a detailed evaluation of the synthesis results can be found at https://hriener.github.io/misc/2018_easy.html:
NPN: We synthesized all ESOP forms of minimum size for the representatives of the NPN equivalence class.
LUT mapping: We synthesized one ESOP form of fixed size and one of minimum size for the Boolean functions that occurred during LUT mapping of Boolean networks.
Random: We synthesized one ESOP form of fixed size and one of minimum size for randomly generated Boolean functions.
All experiments have been conducted on a Intel® Core™ i7-7567U CPU @ GHz with GB RAM.
Correctness. All computed ESOP forms have been verified against their specifications, i.e., we simulated all ESOP forms for all possible values and compared the results of simulation with the initial truth tables of the provided Boolean functions. Note that it is not possible to verify the minimality of the ESOP forms.
NPN. We synthesized all ESOP forms of minmum size for all 222 representatives of the NPN equivalence classes . Computing one minimum ESOP form for each representatives takes s, computing all minimum ESOP forms for each representatives takes s. Fig. 1 shows the histogram of the size of the minimum ESOP forms for the representatives (on the left) and the number of ESOP forms of minimum size per representative (on the right). On average a representative has 12 structurally different minimum ESOP forms. Some representatives can have 100 or more ESOP forms of minimum size. The Boolean function 0x166A (shown in Fig. 2) has the most minimum ESOP forms (in total ) within the NPN classes.
LUT mapping. We synthesized one ESOP form for a fixed number of ESOP terms and one ESOP form of minimum size using downward and upward search, respectively, for each Boolean function that occurred in LUT mapping of the EPFL benchmark suite. For LUT mapping, we used the ABC command if -K 8 . After LUT-mapping, we applied exactmine  to extract all Boolean functions from the benchmarks. We obtained different Boolean functions with up to Boolean variables and used SAT-based ESOP synthesis to compute ESOP forms. For this experiment, we consider a fixed conflict limit of . The synthesis results are presented in Table 1: the first column (Terms) is a user-specified upper limit on the number of terms. The rest of the table is organized in three parts. The first part (fixed-size) is dedicated to synthesis of an ESOP form for the given term limit (without minimizing the number of terms). In this case, the SAT-solver’s heuristics decides whether unecessary terms are cancelled or kept. The second part (downward search) is dedicated to a synthesis procedure that iteratively synthesizes ESOP forms staring from the upper term limit and decreases the number of terms until the constraint system becomes unsatisfiable (as described in Algorithm 2). The satisfying assignment with the smallest number of terms is used for deriving an ESOP form. The last part (upward search) is similar to the second part, but starts with term and increases the number if the constraint system is unsatisfiable. The satisfying assignment with the largest number of terms is used to derive an ESOP form. For each part, we list the number of Boolean functions successfully realized (R), the number of Boolean functions that could not be synthesized because the SAT-solver’s conflict limit (C) was exceeded, the average number of terms (k) for all realizable Boolean functions, and the total run-time (T) for synthesizing all Boolean functions. The run-time includes the time for synthesizing the realizable Boolean function and the time spend in unsuccessful synthesis attempts.
|Terms||Fixed-size||Downward search||Upward search|
We illustrate the effect of the conflict limit on upward and downward search with a simple example. Consider the completely-specified Boolean function 0xF550311031100000. We attempt to synthesize an ESOP form of minimum size with at most terms and a conflict limit of using the upward and downward search procedure, respectively. Fig. 3 shows the number of conflicts explored by the SAT-solver in logarithmic scale parametrized by the number of terms (k). The colors encode the decision results: green denotes satisfiable, blue denotes unsatisfiable, and gray denotes unknown. For those for which the conflict limit of was reached, we repeated synthesis with a much higher conflict limit of to understand what conflict limit would allow us to conclude the correct result. The results for and , however, remain unknown, i.e., we do not know whether the constraints are satisfiable, because the conflict limit of was also exceeded.
The downward search starts with terms and systematically decreases the number of terms. During the search, the conflict limit is reached with for the first; the search procedure interprets this as potentially satisfiable, such that the procedure proceeds until finally is reached. For , the procedure concludes unsatisfiability, terminates, and returns the smallest constructed ESOP form with terms determined during the search process.
The upward search procedure solves the constraint system with increasing number of terms starting with . For , the SAT-solver proves unsatisfiability of the constraint system. For , the SAT-solver reaches the conflict limit, which is interpreted as potentially unsatisfiable by our search procedure, such that the search procedes until . For terms, the constraint system becomes for the first time satisfiable and the corresponding ESOP form with terms is returned.
|Var.||Terms||Fixed-size||Downward search||Upward search|
Random. We synthesized ESOP forms for randomly-generated, incompletely-specified Boolean functions over , , , and Boolean variables. Each bit in the Boolean function and its care function was chosen by flipping a fair coin. In total, we generated Boolean functions for each number of Boolean variables. Table 2 summarizes the results for synthesizing ESOP forms. The first two columns list the number of Boolean variables (Var.) and a fixed bound on the number of terms (Terms). The rest of the table is organized as Table 1. Due to the symmetric design of downward and upward search, they reached exactly the same minimum ESOP forms. Overall downward search is slower due to the fact that unsatisfiability is typically harder to prove and can only be concluded by the SAT-solver for sufficiently small . Consequently, the downward search procedure on average analyzes many more cases before unsatisfiability is reached. In contrast, upward search keeps searching until satisfiability is reached for the first time, which can occur early in the search process.
We have presented an exact synthesis approach for computing ESOP forms using Boolean satisfiability. The approach needs no pre-computed information, synthesizes one or multiple ESOP forms of minimum size, and can take completely-specified or incompletely-specified Boolean functions as specifications. We have implemented the approach using an off-the-shelf SAT-solver and have further presented an relaxation that leverages the SAT-solver’s conflict limit to find ESOP forms with almost minimum size. We have also presented evidence that the synthesis procedure can deal with small-scale ESOP forms with up to Boolean variables and up to terms. As benchmarks, we have used Boolean functions in the NPN equivalence class, Boolean functions that appeared during -LUT mapping, and randomly-generated Boolean functions. We envision that the proposed SAT-based synthesis technique can be integrated with large-scale ESOP optimization procedures, e.g., by selecting windows of terms and resynthesizing them.
This research was supported by H2020-ERC-2014-ADG 669354 CyberCare (200021-146600) and the Institutional Strategy of the University of Bremen, funded by the German Excellence Initiative.
Audemard, G., Simon, L.: On the Glucose SAT solver. International Journal on Artificial Intelligence Tools27(1), 1–25 (2018). https://doi.org/10.1142/S0218213018400018
-  Brayton, R.K., Mishchenko, A.: ABC: an academic industrial-strength verification tool. In: Computer Aided Verification, 22nd International Conference, CAV 2010, Edinburgh, UK, July 15-19, 2010. Proceedings. pp. 24–40 (2010). https://doi.org/10.1007/978-3-642-14295-6_5
-  Drechsler, R.: Preudo-Kronecker expressions for symmetric functions. IEEE Trans. Computers 48(9), 987–990 (1999). https://doi.org/10.1109/12.795226
-  Eén, N., Sörensson, N.: An extensible SAT-solver. In: Theory and Applications of Satisfiability Testing, 6th International Conference, SAT 2003. Santa Margherita Ligure, Italy, May 5-8, 2003 Selected Revised Papers. pp. 502–518 (2003). https://doi.org/10.1007/978-3-540-24605-3_37
-  Fazel, K., Thornton, M.A., Rice, J.E.: ESOP-based Toffoli gate cascade generation. In: Pacific Rim Conference on Communications, Computers and Signal Processing (2007)
-  Gaidukov, A.: Algorithm to derive minimum ESOP for 6-variable function. In: International Workshop on Boolean Problems. pp. 141–148 (2002)
-  Goto, E., Takahasi, H.: Some theorems useful in threshold logic for enumerating boolean functions. In: IFIP Congress. pp. 747–752 (1962)
-  Kalay, U., Hall, D.V., Perkowski, M.A.: A minimal universal test set for self-test of EXOR-sum-of-products circuits. IEEE Trans. Computers 49(3), 267–276 (2000). https://doi.org/10.1109/12.841130
-  Kamath, A.P., Karmarkar, N., Ramakrishnan, K.G., Resende, M.G.C.: A continuous approach to inductive inference. Math. Program. 57, 215–238 (1992). https://doi.org/10.1007/BF01581082
-  Kolesnikov, V., Schneider, T.: Improved garbled circuit: Free XOR gates and applications. In: Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings. pp. 486–498 (2008). https://doi.org/10.1007/978-3-540-70583-3_40
-  Mishchenko, A., Perkowski, M.A.: Fast heuristic minimization of exclusive-sums-of-products. In: Reed-Muller Workshop (2001)
-  Mizuki, T., Otagiri, T., Sone, H.: An application of ESOP expressions to secure computations. Journal of Circuits, Systems, and Computers 16(2), 191–198 (2007). https://doi.org/10.1142/S0218126607003605
-  Papakonstantinou, G.K.: A parallel algorithm for minimizing ESOP expressions. Journal of Circuits, Systems, and Computers 23(1) (2014). https://doi.org/10.1142/S0218126614500157
-  Papakonstantinou, K.G., Papakonstantinou, G.: A nonlinear integer programming approach for the minimization of Boolean expressions. Journal of Circuits, Systems, and Computers 29(10) (2018)
-  Riener, H., Ehlers, R., Fey, G.: CEGAR-based EF synthesis of Boolean functions with an application to circuit rectification. In: 22nd Asia and South Pacific Design Automation Conference, ASP-DAC 2017, Chiba, Japan, January 16-19, 2017. pp. 251–256 (2017). https://doi.org/10.1109/ASPDAC.2017.7858328
-  Sampson, M., Kalathas, M., Voudouris, D., Papakonstantinou, G.K.: Exact ESOP expressions for incompletely specified functions. Integration 45(2), 197–204 (2012). https://doi.org/10.1016/j.vlsi.2011.10.001
-  Sasao, T., Fujita, M. (eds.): Representations of Logic Functions Using EXOR Operators, pp. 29–54. Springer US (1996). https://doi.org/10.1007/978-1-4613-1385-42
-  Soeken, M., Riener, H., Haaswijk, W., De Micheli, G.: The EPFL logic synthesis libraries. ArXiv e-prints 1805.05121 (2018)
-  Soeken, M., Roetteler, M., Wiebe, N., De Micheli, G.: Design automation and design space exploration for quantum computers. In: Design, Automation and Test in Europe. pp. 470–475 (2017). https://doi.org/10.23919/DATE.2017.7927035
-  Stergiou, S., Papakonstantinou, G.K.: Exact minimization of ESOP expressions with less than eight product terms. Journal of Circuits, Systems, and Computers 13(1), 1–15 (2004). https://doi.org/10.1142/S0218126604001295