A lower bound on CNF encodings of the at-most-one constraint
Petr Ku\v{c}era, Petr Savick\'y, Vojt\v{e}ch Vorel

TL;DR
This paper establishes a near-tight lower bound on the size of propagation complete CNF encodings for the at-most-one constraint, crucial for efficient problem translation in SAT solving.
Contribution
It provides the first lower bound on clause size for propagation complete encodings of the at-most-one constraint, nearly matching existing best encodings.
Findings
Lower bound nearly matches the size of known encodings
Slightly improved lower bounds for 2-CNF encodings
Bounds also apply to the exactly-one constraint
Abstract
Constraint "at most one" is a basic cardinality constraint which requires that at most one of its boolean inputs is set to . This constraint is widely used when translating a problem into a conjunctive normal form (CNF) and we investigate its CNF encodings suitable for this purpose. An encoding differs from a CNF representation of a function in that it can use auxiliary variables. We are especially interested in propagation complete encodings which have the property that unit propagation is strong enough to enforce consistency on input variables. We show a lower bound on the number of clauses in any propagation complete encoding of the "at most one" constraint. The lower bound almost matches the size of the best known encodings. We also study an important case of 2-CNF encodings where we show a slightly better lower bound. The lower bound holds also for a related "exactly one"…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
A Lower Bound on CNF Encodings of the At-Most-One Constraint
Petr Kučera Department of Theoretical Computer Science and Mathematical Logic, Faculty of Mathematics and Physics, Charles University, Czech Republic, [email protected]
Petr Savický Institute of Computer Science, The Czech Academy of Sciences, Czech Republic, [email protected]
Vojtěch Vorel Department of Theoretical Computer Science and Mathematical Logic, Faculty of Mathematics and Physics, Charles University, Czech Republic, [email protected]
Abstract
Constraint “at most one” is a basic cardinality constraint which requires that at most one of its boolean inputs is set to . This constraint is widely used when translating a problem into a conjunctive normal form (CNF) and we investigate its CNF encodings suitable for this purpose. An encoding differs from a CNF representation of a function in that it can use auxiliary variables. We are especially interested in propagation complete encodings which have the property that unit propagation is strong enough to enforce consistency on input variables. We show a lower bound on the number of clauses in any propagation complete encoding of the “at most one” constraint. The lower bound almost matches the size of the best known encodings. We also study an important case of 2-CNF encodings where we show a slightly better lower bound. The lower bound holds also for a related “exactly one” constraint.
1 Introduction
In this paper we study the properties of one of the most basic cardinality constraints — the “at most one” constraint on boolean variables which requires that at most one input variable is set to . This constraint is widely used when translating a problem into a conjunctive normal form (CNF). Since the “at most one” constraint is anti-monotone, it has a unique minimal prime CNF representation which requires negative clauses, where is the number of input variables. However, there are CNF encodings of size which use additional auxiliary variables. Several encodings for this constraint were considered in the literature. Let us mention sequential encoding [21] which addresses also more general cardinality constraints. The same encoding was also called ladder encoding in [17], and it forms the smallest variant of the commander-variable encodings [18]. After a minor simplification, it requires clauses and auxiliary variables. Similar, but not smaller encodings can also be obtained as special cases of totalizers [5] and cardinality networks [1]. Currently the smallest known encoding is the product encoding introduced by Chen [10]. It consists of clauses and uses auxiliary variables. The sequential and the product encodings are described in Section 3.1 and Section 3.2 with some modifications. It is worth noting that the product encoding can be derived using the monotone circuit of size for the function described in [14] and in [22], if . Section 3.3 provides more detail on this.
Other encodings introduced in the literature for the “at most one” constraint use more clauses than either sequential or product encoding does. These include the binary encoding [6, 16] and the bimander encoding [17].
All the encodings for the “at most one” constraint we have mentioned are in the form of a 2-CNF formula which is a CNF formula where all clauses consist of at most two literals. This restricted structure guarantees that the encodings are propagation complete. The notion of propagation completeness was introduced by [8] as a generalization of unit refutation completeness introduced by [13]. We say that a formula is propagation complete if for any set of literals , the following property holds: either is contradictory and this can be detected by unit propagation, or unit propagation started with derives all literals that logically follow from this formula. It was shown in [3] that a prime 2-CNF formula is always propagation complete. Since unit propagation is a standard tool used in state-of-the-art SAT solvers [7], this makes 2-CNF formulas as a part of a larger instance simple for them.
When encoding a constraint into a CNF formula, a weaker condition than propagation completeness of the resulting formula is often required. Namely, we require that unit propagation on the encoding is strong enough to enforce some kind of local consistency, for instance generalized arc consistency (GAC), see for example [4]. In this case we only care about propagation completeness with respect to input variables and not necessarily about behaviour on auxiliary variables. Later we formalize this notion as propagation complete encoding (PC encoding). Let us note that this name was also used in [9] to denote an encoding of a given constraint which is propagation complete with respect to all variables including the auxiliary ones.
Chen [10] conjectures that the product encoding is the smallest possible PC encoding of the “at most one” constraint. In this paper we provide support for the positive answer to this conjecture. Our lower bound almost matches the size of the product encoding. We show that any propagation complete encoding of the “at most one” constraint on variables requires at least clauses. The lower bound actually holds for a related constraint “exactly one” as well. We also consider the important special case of 2-CNF encodings for which we achieve a better lower bound, namely, any 2-CNF encoding of the “at most one” constraint on variables requires at least clauses.
We should note that having a smaller encoding is not necessarily an advantage when a SAT solver is about to be used. Adding auxiliary variables can be costly because the SAT solver has to deal with them and possibly use them for decisions. However, encodings using auxiliary variables can be useful for constraints whose CNF representation is too large. Moreover, the experimental results in [20] suggest that a SAT solver can be modified to minimize the disadvantage of introducing auxiliary variables. Another experimental evaluation of various cardinality constraints and their encodings appears in [15]. A propagation complete encoding can also be used as a part of a general purpose CSP solver where unit propagation can serve as a propagator of GAC, see [4].
The paper is organized as follows. In Section 2, we give the necessary definitions and formulate the main result in Theorem 2.8. In particular, we introduce the notion of a P-encoding that captures the common properties of propagation complete encodings of the “at most one” and the “exactly one” constraints used for the lower bounds. Moreover, we define a specific form of a P-encoding which we call a regular form and formulate Theorem 2.10 that is the basis of the proofs of the lower bounds by considering separately the encodings in the regular form and the encodings not in this form. We also prove that Theorem 2.10 is sufficient for the lower bound on the size of the considered encodings. In Section 3, we recall the known results and present some auxiliary results we use in the rest of the paper. In Section 4, we prove the properties of the encodings not in the regular form that imply Theorem 2.10. Section 5 contains the proof of a lower bound on the size of any propagation complete encoding of the “at most one” and the “exactly one” constraints obtained by analysis of the encodings in the regular form. In Section 6 we prove a lower bound on the size of 2-CNF encodings of the “at most one” constraint by a different analysis of the encodings in the regular form. We close the paper with notes on possible directions for further research in Section 7 and concluding remarks in Section 8.
A preliminary version of this paper appeared in [19]. Due to page limitations, several proofs were omitted or only sketched in the conference version. In this version of the paper, we have included all proofs and improved their readability. The lower bounds were slightly improved since the conference version as well.
2 Definitions and Results
In this section we introduce the notions used throughout the paper, state the main results and give an overview of their proof. We use to denote strict inclusion.
2.1 At-Most-One and Exactly-One Functions
In this paper we are interested in two special cases of cardinality constraints represented by “at most one” and “exactly one” functions. These functions differ only on the zero input.
Definition 2.1**.**
For every , the function (at most one) is defined as follows: Given an assignment , the value is if and only if there is at most one index for which .
Definition 2.2**.**
For every , the function (exactly one) is defined as follows: Given an assignment , the value is if and only if there is exactly one index for which .
We study propagation complete encodings of these two functions using their common generalization called P-encoding introduced in Definition 2.5.
2.2 CNF Encoding
We work with formulas in conjunctive normal form (CNF formulas). For a standard notation see e.g. [11]. Namely, a literal is a variable (positive literal), or its negation (negative literal). If is a variable, then let . If is a vector of variables, then we denote by the union of over . For simplicity, we write if is a variable that occurs in , so is considered as a set here, although, the order of the variables in is important. Given a literal , the term denotes the variable in the literal , that is, for . Given a set of literals , .
A clause is a disjunction of a set of literals which does not contain a complementary pair of literals. A formula is in conjunctive normal form (CNF) if it is a conjunction of a set of clauses. In this paper, we consider only formulas in conjunctive normal form and we often simply refer to a formula, by which we mean a CNF formula. We treat clauses as sets of literals and formulas as sets of clauses. In particular, the order of the literals in a clause or clauses in a formula is not important and we use common set relations and operations (set membership, inclusion, set difference, etc.) on clauses and formulas. The empty clause (the contradiction) is denoted and the empty formula (the tautology) is denoted .
A unit clause consists of a single literal. A binary clause consists of two literals. A CNF formula, each clause of which contains at most literals, is said to be a -CNF formula.
A partial assignment of variables is a subset of that does not contain a complementary pair of literals, so we have for each . By we denote the formula obtained from by the partial setting of the variables defined by .
A CNF formula represents a boolean function on the variables in . We say that a clause is an implicate of a formula if any satisfying assignment of satisfies as well, i.e. implies for every assignment . We denote this property with . We say that is a prime implicate of if none is an implicate of . Note that whether a clause is a (prime) implicate of depends only on the function represented by and we can therefore speak about implicates of as well. We say that CNF is prime if it consists only of prime implicates of . By the size of the formula we mean the number of clauses in , it is denoted as which is consistent with considering a CNF formula as a set of clauses.
In this paper we also consider encodings of boolean functions defined as follows.
Definition 2.3** (Encoding).**
Let be a boolean function on variables . Let be a CNF formula on variables, where . We call an encoding of if for every we have
[TABLE]
The variables in and are called input variables and auxiliary variables, respectively.
2.3 Propagation Complete Encoding
We are interested in encodings which are propagation complete. This notion relies on unit resolution which is a special case of general resolution. We say that two clauses are resolvable, if there is exactly one literal such that and . The resolvent of these clauses is then defined as . If one of and is a unit clause, we say that is derived by unit resolution from and . We say that a clause can be derived from by unit resolution (or unit propagation), if can be derived from by a series of unit resolutions. We denote this fact with .
Definition 2.4** (Propagation complete encoding).**
Let be a boolean function on variables . Let be a CNF formula on variables, where . We call a propagation complete encoding (PC encoding) of if it is an encoding of and for any , and for each , such that
[TABLE]
we have
[TABLE]
If is a prime CNF formula, we call it prime PC encoding.
Note that the definition of a propagation complete encoding is less restrictive than requiring that formula is propagation complete as defined in [8]. The difference is that in a PC encoding we only consider literals on input variables as assumptions and consequences of unit propagation. The definition of a propagation complete formula [8] does not distinguish input and auxiliary variables and the implication from (2) to (3) is required for all literals on all variables.
The following notation is used in the rest of the paper. Let be literals on variables in . Then denotes the set of literals that can be derived by unit resolution from that is
[TABLE]
2.4 Propagation Complete Encodings of and
Propagation complete encodings of and share two common properties which we capture under the notion of P-encoding.
Definition 2.5** (P-encoding).**
Let be a formula with , , , . We say that is a P-encoding if it satisfies the following two conditions.
- (P1)
is satisfiable for each , 2. (P2)
holds for each with ,
One can easily verify that being a P-encoding is a necessary condition for a formula to be a propagation complete encoding of or .
Lemma 2.6**.**
Let be a PC encoding of or . Then is a P-encoding.
It turns out that conditions (P1) and (P2) are enough to show the lower bounds on the size of PC encodings of and and these lower bounds are derived in the following sections by proving a lower bound on the size of P-encodings.
Every P-encoding with input variables is an encoding of either or , however, if it is an encoding of , it may not be propagation complete. In particular, this means that the converse of Lemma 2.6 is not true, see Section 3.4 for more detail.
2.5 The Main Result
Let us introduce the following notation.
Definition 2.7**.**
We denote the minimum size of a P-encoding with input variables by and the minimum size of a 2-CNF P-encoding with input variables by .
We pay special attention to 2-CNF encodings of . The minimum size of these encodings is as explained in Section 6. One can prove by contradiction that there are no 2-CNF encodings of of input variables as follows. Given an encoding of , we can eliminate an auxiliary variable from by removing clauses containing or and replacing them with the resolvents of all pairs of these clauses resolvable using the variable . We call this step DP-elimination of , since its repetition for all variables is one of the parts of Davis-Putnam algorithm [12] (see also [7]). After eliminating all auxiliary variables, the remaining formula is a 2-CNF representation of , since 2-CNF formulas are closed under resolution. This is a contradiction, since is a prime implicate of .
We are now ready to state the main result of this paper.
Theorem 2.8**.**
Every PC encoding of or has size at least , the smallest size of a 2-CNF encoding of is equal to , and
For we have . 2. 2.
For we have . 3. 3.
For we have .
The lower bound for is tight, since for every , there is a 2-CNF encoding of of size and it is a P-encoding. The lower bound for is almost tight, since for every sufficiently large , the product encoding [10] of has size and is a 2-CNF P-encoding. Moreover, in Section 3.4, we prove that is a close estimate of the minimum size of PC encodings of the functions and . Namely, for each of these functions, there is a PC encoding of size at most .
The first part of Theorem 2.8 follows from Lemma 2.6 and Lemma 6.1. Our proof of parts 2 and 3 relies on the notion of P-encodings in regular form we define below. Let be a P-encoding with input variables . Given a variable , , unit propagation on formula starts with clauses which contain the negative literal . It is important to distinguish different types of P-encodings according to the structure of these clauses. For each let us denote
[TABLE]
Definition 2.9**.**
Let be a P-encoding with input variables . We say that is in regular form if the following holds for each :
- (R1)
. 2. (R2)
Clauses in contain no input variables other than . 3. (R3)
Clauses in are binary.
It is interesting to note that the construction of the product encoding introduced by Chen [10] leads to an encoding in regular form and this form is probably the best for most values of . On the other hand, there are infinitely many rare values of , for which using a P-encoding not in regular form allows to slightly reduce the size. This is used to describe the product encoding in Section 3.2.
The following theorem is used later to reduce the analysis of the minimum size P-encodings to the analysis of P-encodings in regular form and an induction argument. The theorem will be used for both general CNF and 2-CNF formulas. Since the minimum size of a P-encoding can be different in these two classes of formulas, we do not use the assumption that is a minimum size P-encoding and include condition (a) that has the same effect and can be used for both general CNF and 2-CNF formulas.
Theorem 2.10**.**
If is a prime P-encoding with input variables , , then at least one of the following holds:
- (a)
There is a P-encoding with input variables, such that . 2. (b)
There is a P-encoding with input variables, such that . 3. (c)
Formula is in regular form.
Moreover if is a 2-CNF formula, then so is in cases (a) and (b).
We give a proof of Theorem 2.10 in Section 4. This theorem allows the following approach to proving a lower bound. If a given P-encoding is not in regular form, we use induction on , and if it is in regular form, we prove a lower bound directly. Although we combine Theorem 2.10 later with additional arguments to prove stronger lower bounds, the following simple corollary of this theorem already gives the main term of the lower bound.
Corollary 2.11**.**
Let be a P-encoding with input variables , . Then consists of at least clauses.
Proof.
Assume that is a minimum size P-encoding for input variables. Without loss of generality, we can assume that it is a prime P-encoding (see also Lemma 3.5 below). We prove by induction on that . For , this implies the stated lower bound. For , one can check (see also Lemma 5.1 below) that must contain at least three clauses, thus . Now let us assume that . Since is of minimum size, no P-encoding with input variables with fewer clauses exists and item (a) of Theorem 2.10 does not apply. If is not in regular form then by item (b) of Theorem 2.10, there is a P-encoding with input variables such that . By induction hypothesis , thus
[TABLE]
If is in regular form, then we have , since by definition, the union of , , contains clauses. ∎
In order to prove the lower bounds presented in Theorem 2.8, we perform a more careful analysis of P-encodings in regular form. In particular, in Section 5 we show the lower bound on and in Section 6 we show the lower bound on .
3 Known and Auxiliary Results
In this section we state known and preliminary results used throughout the paper. We start by recalling some of the known good encodings of with some modifications.
3.1 Sequential Encoding
Let us present a variant of the sequential encoding [21], which addresses also more general cardinality constraints. This construction has also been called ladder encoding in [17]. The following recurrence describes the sequential encoding of with a minor simplification which reduces its size to and the number of auxiliary variables to . The base case is
[TABLE]
and for each , let
[TABLE]
where is an auxiliary variable not used in . By induction on , one can verify that is an encoding of with auxiliary variables and of size . Since it is a prime 2-CNF, it is propagation complete, see [3]. Hence, we have the following.
Lemma 3.1**.**
For every , there is a 2-CNF PC encoding of of size .
Since is a symmetric function, the order of the variables in the formula for this function can be chosen arbitrarily without changing the function. When a different order of the variables is used in a recurrence, the obtained formula has a different form. Let us introduce the tree encoding by the following recurrence. The base case is
[TABLE]
and for each , let
[TABLE]
where is an auxiliary variable not used in . By a similar argument as above, is a PC encoding of .
The size of the formulas and is the same and both are 2-CNF formulas. Let us consider a graph, whose vertices are variables and edges are the two-element sets , where is a clause in the formula. Both the formulas and can be decomposed into triples of clauses which correspond to triangles in their graph and the triangles are connected via their vertices into a tree structure. In the graph for , these triangles form a path of length and in the graph for , they form a tree with diameter .
3.2 Product Encoding
Chen [10] introduced the product encoding of which has size . It turns out that is the smallest number of the variables, for which the product encoding outperforms the sequential encoding ( vs. clauses). On the other hand, we show below that the sequential encoding is the smallest possible for . It is not clear whether this holds also for .
Let us present a slightly optimized version of the product encoding using a combination with sequential encoding for some values of . The combination is obtained by considering two candidates for the recursive construction of the product encoding and using the better of them for each . The base case for is
[TABLE]
If , the first candidate formula for is
[TABLE]
as in the recurrence used for the sequential encoding. If , let be (5). If , we use the formula described by Chen [10]. Let and . Clearly, we have . Arrange the input variables in pairwise different cells of a rectangular array of dimension . Let and be the functions, such that is the row index and the column index of the cell containing . Let , and , be new auxiliary variables. Then, the second candidate for is the formula
[TABLE]
It is worth noting that formula (6) is in regular form, see Definition 2.9. The size of (5) is and the size of (6) is . Let be the smaller of these formulas, where any of the candidates can be used, if their sizes are the same. It appears that formula (5) is smaller than (6) for and for infinitely many other numbers, in particular, for the numbers and , where is an integer. This can be explained as follows. If or , then is given by (6). In this case, the size of the candidate for given by (6) is at least and the size of the candidate for given by (5) is .
Clearly, the size of is at most which is the size of (5) and using this, one can prove by induction on that for all , we have
[TABLE]
Asymptotically, a better bound was proven by Chen [10]. We present here a proof of this bound for completeness.
Lemma 3.2** (Chen [10]).**
We have .
Proof.
If and , the size of the product encoding satisfies
[TABLE]
By (7), we have . Together with (8) we obtain
[TABLE]
Using this bound for and using (8) again, we obtain
[TABLE]
as required. ∎
3.3 Relationship to Monotone Circuits
Let us briefly describe a connection between the product encoding and the monotone circuit of the size for the function , described in [14] and in Section 6, Theorem 2.3 in [22]. If , the construction yields the product encoding for . More generally, if is any constant, we obtain a PC encoding of “at most ” of size . This is the smallest known encoding for this constraint, if . On the other hand, for every , a smaller encoding can be obtained using Batcher’s sorting network. For large , an even smaller encoding of size , where , can be obtained using AKS sorting networks.
Let be the threshold function “at least ” of variables. By the results cited above, there is a monotone circuit for this function consisting of binary AND and OR gates. In order to obtain asymptotically the same number of clauses in an encoding, the circuit has to be transformed in such a way that we replace groups of binary OR gates computing a disjunction of several previous gates by a single OR gate with multiple inputs. The Horn part of the Tseitin encoding of the circuit after this transformation consists of clauses. If we add a negative unit clause on the output of the circuit, we obtain an encoding of the “at most ” constraint. Moreover, using the specific structure of the circuit, one can verify that this encoding is propagation complete. In particular, if , the obtained encoding is the product encoding of the constraint “at most one”.
3.4 P-Encodings and Encodings of and
We use P-encodings as a representation of common properties of PC encodings of and . Although the converse of Lemma 2.6 is not true (see below for an example) a partial converse is valid.
Lemma 3.3**.**
A P-encoding with input variables is an encoding (not necessarily propagation complete) of either or .
Proof.
Consider a P-encoding where . The functions and differ only on the zero assignment. In order to prove the statement, it is sufficient to prove that the function encoded by agrees with and on the remaining assignments.
Consider a non-zero assignment of the input variables. First, assume that for two indices . Such is a falsifying assignment of both functions and . By condition (P2) cannot be extended to a model of . For the remaining case assume that for some and for all . Such is a satisfying assignment of both the functions and . By condition (P1) we have that is satisfiable and condition (P2) implies that any satisfying assignment of sets all other input variables to [math]. This means that can be extended to a satisfying assignment of . ∎
Consider the formula
[TABLE]
where is the prime representation of and is an auxiliary variable. One can verify that this formula is a P-encoding, is an encoding of , however, is not a PC encoding of , since . This implies that the converse of Lemma 2.6 is not true.
Although we believe that the size of the smallest PC encoding of is and the size of the smallest PC encoding of is , we can prove only the following bounds.
Proposition 3.4**.**
Let , let be a smallest PC encoding of and let be a smallest PC encoding of . Then
[TABLE]
Proof.
The lower bounds follow from Lemma 2.6. Let be a P-encoding of size . One can verify that
[TABLE]
where is a new auxiliary variable, is a PC encoding of . This implies . Moreover, one can verify that
[TABLE]
is a PC encoding of . This implies . ∎
3.5 Simple Reductions of Encodings
In this section we present additional properties of encodings that can be assumed without loss of generality, since every encoding can be modified to satisfy them without increase of the size.
Lemma 3.5**.**
The prime CNF formula obtained from a given P-encoding by replacing every clause by a prime implicate contained in it, is also a P-encoding.
Proof.
Consider a clause in the original formula and a prime implicate contained in it. Replacing by does not change the function represented by the formula and one can verify that the conditions (P1) and (P2) remain satisfied. Repeating this for all clauses of proves the lemma. ∎
If the number of occurrences of an auxiliary variable in an encoding is at most 4, then DP-elimination of does not increase the size of the formula (see Section 2.5 for definition of DP-elimination) and leads to an encoding of the same function with a smaller number of auxiliary variables. This allows us to make the following observation.
Lemma 3.6**.**
Let be an encoding of a function of minimum size that, moreover, has the minimum number of auxiliary variables among such encodings. Then any auxiliary variable occurs in at least 5 clauses of .
With a little effort one can show that DP-elimination also preserves propagation completeness of an encoding. In particular, Lemma 3.6 holds also for a PC encoding of minimum size, however, this is not used in this paper.
3.6 Substituting Variables in Unit Propagation
One of the reduction steps we use later to simplify an encoding is the substitution of a variable with a literal on a variable already present in the formula. If is a formula and , we denote by the formula obtained from using the substitution . More precisely, if the literal is positive, then the variable is substituted by the literal . If is negative, then the variable is substituted by the literal . An important property of this operation is that this kind of substitution preserves unit propagation.
Lemma 3.7**.**
Let be a formula, let , such that and assume, is satisfiable. Then
[TABLE]
Lemma 3.7 is a consequence of a more general statement with an essentially the same proof which we are going to show first. Let us consider a substitution of the variables in by literals on the same set of the variables. The substitution extends to the literals so that for every , we have . Moreover, the substitution extends to the clauses and the formulas in CNF as follows. If is a clause with variables from then is defined as , if there is no complementary pair of literals among , and otherwise. If is a CNF formula, then , where in case for all . In particular, where is a map on the literals defined for every literal as
[TABLE]
Applying a substitution to a formula preserves resolution proofs as we show in the following lemma.
Lemma 3.8**.**
Let be a formula on the variables and let be a resolution proof of from . If is a substitution as above, then there is a sequence , where each is a clause or , such that the following implications are satisfied
[TABLE]
and the sequence of clauses contained in is a resolution proof of the clauses contained in it from the clauses in . If the original proof is a unit resolution proof, so is the derived proof.
Proof.
For each , we have either or , where . In order to prove the claim, let us construct by induction on . Some of the clauses can repeat in the constructed sequence. Assume, the sequence is constructed and is empty or satisfies the requirements formulated above. If , choose . If , then , where and , , and for some literal and sets of literals and . If , then choose . Otherwise, there is no conflict in .
If, moreover, the variable has no occurence in , then and are clauses and are resolvable using the literals and . This implies , , and . If and are resolvable, then and we can choose . Otherwise, either and we have or and we have . Hence, we can choose or so that .
Assume, some of the literals and has an occurence in . Since is a clause, only one of the literals and is contained in it. If , then and we can choose . Similarly, if , we can choose .
If is a unit clause, then is a unit clause. This implies the last statement of the lemma. ∎
Lemma 3.7 now easily follows from Lemma 3.8.
Proof of Lemma 3.7.
If is defined as in (10), then and . Lemma 3.8 implies or . The first is excluded because is satisfiable. Hence, we have as required. ∎
4 Reducing to Regular Form
This section is devoted to the proof of Theorem 2.10. We start with basic properties of P-encodings.
Lemma 4.1**.**
Let and let be a P-encoding with input variables and auxiliary variables . For each distinct it holds that
- (a)
, 2. (b)
, 3. (c)
* contains a binary clause containing the literal .*
Proof.
Suppose that satisfies the assumption. The claims of the lemma can be proven as follows.
- (a)
If , then , since by condition (P2). This contradicts condition (P1). 2. (b)
If , then , since by condition (P2). This contradicts condition (P1). 3. (c)
Since , there is a series of unit resolutions starting from , whose first step uses a binary clause containing . ∎
The following lemma shows that fixing any set of input variables to zero in a P-encoding gives us a P-encoding on the remaining input variables.
Lemma 4.2**.**
Let be a P-encoding and let be a non-empty set of indices and consider the partial assignment . Then is a P-encoding with the input variables , .
Proof.
If , then derives all the literals for including all the literals in and does not derive a contradiction. Hence, the propagation from cannot derive a contradiction and derives for all . It follows that with the input variables satisfies (P1) and (P2). ∎
We now concentrate on clauses with negative literals on input variables.
Lemma 4.3**.**
Let be a prime P-encoding, , and . Then one of the following is satisfied
- (i)
, where , 2. (ii)
* for some .*
Proof.
We have for a non-empty set of literals . If contains a literal on an input variable, consider the following two cases.
- •
If there is a literal for some , consider the clause . This clause is an implicate of due to property (P2) and it is prime due to property (P1). Hence, necessarily .
- •
If for some then is an implicate as well which is in contradiction with primality of .
Otherwise, . ∎
The following proposition shows that for every input variable in a minimum size P-encoding .
Proposition 4.4**.**
Let and let be a P-encoding with input variables . Let and suppose that . Then there is another P-encoding with input variables and satisfying . Moreover, if is a 2-CNF formula, then so is .
Proof.
Using Lemma 3.5, we can assume that is a prime formula. By Lemma 4.1, there is a binary clause with some . Let us assume for a contradiction that with . By Lemma 4.3, . Let . We have that . Since is the only clause of containing , unit resolution uses to derive and does not use in any of the later steps. Hence, we have , which is a contradiction with Lemma 4.1(b). This implies .
Consider the substitution and let us show that satisfies the conditions (P1) and (P2).
- (P1)
Let us show that is a satisfiable formula for each . If , we have that is satisfiable and that using the clause . Thus, the formula is satisfiable and both literals and get value in each of its satisfying assignments. It follows that is satisfiable as well.
If , we have . Since is the only clause in that contains , it holds that . Thus, both literals and get value [math] in any satisfying assignment of . It follows that is satisfiable as well. 2. (P2)
Follows from Lemma 3.7 for the formula and , where , .
The substitution changes to which is omitted in . Hence has size smaller than . This completes the proof. ∎
Let us present an example of a formula which shows that Proposition 4.4 does not hold for PC encodings of instead of P-encodings. The formula (9) with auxiliary variables is a PC encoding of with a single occurence of , for which the construction in Proposition 4.4 provides a formula which is a PC encoding of .
P-encodings that are not in regular form can be reduced to P-encodings with a smaller number of input variables by the following statements. We start with P-encodings which violate Condition (R1) of Definition 2.9. Recall that this condition requires that for every input variable of a P-encoding in regular form.
Proposition 4.5**.**
Let be a P-encoding with input variables , such that for some . Then, there is a formula , which satisfies one of the following
- (a)
* is a P-encoding with input variables and ,* 2. (b)
* is a P-encoding with input variables and .*
Moreover, if is 2-CNF, then so is .
Proof.
Assume, for some . Lemma 4.1 implies that . Assume, . According to Proposition 4.4, there is a P-encoding satisfying condition (a) of the conclusion. If , then setting yields a formula of size at most and this formula is a P-encoding with input variables by Lemma 4.2. Hence, condition (b) of the conclusion is satisfied. In both cases, is obtained from by a substitution that does not increase the size of clauses, so also the last part of the statement is satisfied. ∎
Now, we look at P-encodings which satisfy Condition (R1) but do not satisfy Condition (R2) of Definition 2.9. For this purpose, we use the following auxiliary lemma.
Lemma 4.6**.**
Let be a P-encoding with input variables and let be three different indices. Then .
Proof.
Let . We have . Assume, consists of the two clauses and . Then, we have . This implies that is an implicate of which is in contradiction with the conditions (P1) and (P2) used for the formula . ∎
Let be a P-encoding with input variables . Recall that Condition (R2) of Definition 2.9 states that clauses in do not contain other input variables than for every , if is in regular form.
Proposition 4.7**.**
Let be a prime P-encoding with input variables , such that (R1) is satisfied and (R2) is not satisfied. Then there is a P-encoding with input variables, such that . If is a 2-CNF formula, then so is .
Proof.
Let be an index, for which (R2) is not satisfied which means that some clause contains another input variable , in addition to the literal . By Lemma 4.3 we get that . Without loss of generality, assume , , so contains clauses , , for some sets of literals . By Lemma 4.3 and Lemma 4.6, both and are sets of auxiliary literals. By Lemma 4.2 we have that is a P-encoding with input variables . Since satisfies (R1), we have that and thus
[TABLE]
Since satisfies (R1), the literal occurs only once in . Hence, Proposition 4.4 implies that there is a P-encoding with input variables satisfying . Together with (11) we get
[TABLE]
as required. ∎
We are now ready to give a proof of Theorem 2.10. Since we have already analyzed encodings not satisfying some of the conditions (R1) and (R2), the main step of the proof is to deal with encodings not satisfying Condition (R3). Let us recall that (R3) requires that for every the set consists of two binary clauses. Let us also recall that denotes the set of literals that can be derived by unit resolution from .
Proof of Theorem 2.10.
Let be a prime P-encoding with input variables . If is in regular form, we are done. If some of the conditions (R1) and (R2) is not satisfied, the conclusion follows from propositions 4.5 and 4.7. For the rest of the proof assume that satisfies (R1) and (R2). If is a 2-CNF, the condition (R3) is satisfied and we are done.
If is not a 2-CNF, assume that does not satisfy (R3) for some . By Lemma 4.1 we have that one of the clauses in is a binary clause. By (R1), we have and since does not satisfy (R3), the other clause consists of at least three literals. Moreover, due to (R2) the only input variable which appears in some clause in is . Thus we can write
[TABLE]
for some literals on auxiliary variables where . We claim that for every we have
[TABLE]
and
[TABLE]
Let us assume for a contradiction that there is satisfying the negation of (12) or the negation of (13). If , then , since . Hence, we can assume . This implies that is an implicate of . However, the resolvent is a strict subclause of which is in contradiction with primality of .
Consider any input variable , . Since satisfies (P2) we have that . Clause is the only one in that becomes unit when resolved with . Moreover, we can observe that clause is not used in the derivation . This follows by (12), because in order for to be used in a unit resolution derivation, at least one of must be derived first. Thus necessarily
[TABLE]
and in particular
[TABLE]
Let , where . We prove below that is a P-encoding with input variables . Since and contains only one occurrence of , Proposition 4.4 implies that there is a P-encoding with input variables satisfying thus satisfying condition (a). According to Definition 2.5 it remains to show that satisfies conditions (P1) and (P2).
- (P1)
Let , be an arbitrary input variable and let us show that is satisfiable.
- •
If , we have , since is contained in . Consequently, .
- •
If , we have by (15). Hence, and .
In both cases, since is satisfiable, so is , and satisfies (P1). 2. (P2)
Let be two different indices of input variables and let us show that . Let us look at derivation of .
- •
If , then clause is not used in the derivation . This follows by (12), because in order for to be used in a unit resolution derivation, at least one of must be derived first. It follows that as well.
- •
Assume . If is not used in the derivation , then also and we are done. Assume, is used in the derivation . If is used to derive some of the literals , then in order to do that we need , which is not true. Hence, we can assume that is used to derive . Before that we have for all and these derivations are possible in as well. Hence, for all . Moreover, we obtain because we can replace the step using in the original unit resolution derivation with two steps using to derive and then to derive . Together, we get that also in this case .
This concludes the proof of Theorem 2.10. ∎
The following notation will be used in the subsequent sections. Assume, is a P-encoding with input variables in regular form. For each , let
[TABLE]
Clearly, for all , we have , Moreover, since is not an implicate of , the set does not contain complementary literals and we have . The following is now an easy observation.
Lemma 4.8**.**
If are two different indices of input variables, then .
Proof.
Assuming , we get a contradiction with conditions (P1) and (P2) as follows. The formula is satisfiable and derives both literals in . Hence, it is not possible to have . ∎
Note that it follows from Lemma 4.8 that contains at least auxiliary variables in . This is because if the number of auxiliary variables is , then we have at most sets . It follows that and and this gives a hint on how gets into the lower bound. In order to obtain a corresponding term in the lower bound on the number of clauses, we distinguish two types of clauses in a P-encoding in regular form as follows:
- •
Clauses from are of type Q.
- •
The remaining clauses in are of type R.
A P-encoding in regular form with input variables contains clauses of type Q. This was used in Corollary 2.11 to prove a lower bound on the size of every P-encoding with a sufficiently large number of input variables. In order to prove the lower bounds stated in the introduction, we prove in the next two sections lower bounds on the number of clauses of type R in cases of general CNF P-encodings and 2-CNF P-encodings.
5 A Lower Bound For General P-Encodings
This section is devoted to the proof of a lower bound on , i.e. the proof of statement 1 for and statement 2 of Theorem 2.8. The proof consists of a lower bound on the size of a P-encoding in regular form and an inductive argument based on Theorem 2.10. We have observed at the end of Section 4 that if is a P-encoding with input variables in regular form, then the number of auxiliary variables is at least . We improve this bound and, moreover, we show that there must be an input variable such that unit propagation starting from derives at least literals on auxiliary variables. This implies that there must be almost as many R clauses in implying the lower bound.
We start with the base cases for induction. By CNF complexity of a boolean function, we mean the minimum size of a CNF formula expressing the function. Clearly, this is also the minimum size of an encoding of the function without auxiliary variables. One can easily verify that the CNF complexity of is and the CNF complexity of is .
Lemma 5.1**.**
Let denote the minimum size of a PC encoding of and let denote the minimum size of a PC encoding of . Then, we have
[TABLE]
Proof.
Representations of and containing all the prime implicates achieve these bounds, are the smallest possible, and are propagation complete. This implies the required upper bounds on , , and for .
Lemma 3.6 implies that if a function has a representation of size at most , then the size of the smallest encoding (not necessarily propagation complete) is equal to the size of the smallest representation. This implies the stated values of and .
As explained in Section 3.4, every P-encoding with input variables is either an encoding of or an encoding of . Hence, the lower bounds from the previous paragraph hold also for P-encodings and this implies the stated values of . ∎
Let us prove additional properties of sets introduced at the end of Section 4.
Lemma 5.2**.**
Let be a P-encoding with input variables in regular form. Let be different indices with , , and for . Then variables , , and are pairwise different.
Proof.
Let us show by contradiction that . To this end, assume . Since by Lemma 4.8, we have . By condition (P2), and . Since , necessarily and . However, then which is in contradiction with (P1).
The remaining cases, i.e. and are symmetrical. ∎
Using Lemma 5.2 for all triples of indices of input variables, we obtain the following.
Corollary 5.3**.**
Assume, is a P-encoding with input variables in regular form. Let
[TABLE]
where , and define
[TABLE]
If , then contains literals on different variables and .
Proof.
This is a corollary of Lemma 5.2. If we remove literal from each , , then the remaining literals are on pairwise different variables different from . ∎
We are now ready to show the lower bound on the size of a P-encoding in regular form.
Lemma 5.4**.**
If is a P-encoding with input variables in regular form, then .
Proof.
Since the formula contains clauses of type Q, it is sufficient to prove that it contains at least clauses of type R.
Let be the set of auxiliary literals in clauses of type Q. For each , let and be defined as in Corollary 5.3. Choose that maximizes , fix some and denote . Each literal in is derived by unit propagation from using a different clause of type R. Hence, the number of the clauses of type R is at least .
For each , the literal must be derived from some using a clause of type Q containing . As for every , each can derive for at most values of . Thus,
[TABLE]
If , then according to Corollary 5.3, we get . In order to derive all , from , has to contain the negations of the literals in . Since contains also and these literals are on variables not in , we have
[TABLE]
Combining the two bounds, we get
[TABLE]
as follows. If , the claims (21) and (20) apply. If , observe that by (20), , since .
For , the smallest value of the function is for , such that . Hence, we have and the number of clauses of type R is at least . ∎
Let us conclude the section with the following theorem which represents the statement 1 for and statement 2 of Theorem 2.8.
Theorem 5.5**.**
For , the minimum size of a P-encoding with input variables satisfies
If , then . 2. 2.
If , then .
Proof.
We treat the two claims separately:
It was shown in Lemma 3.1 and Lemma 2.6 that . To show that for , we proceed by induction on . The basis is given by Lemma 5.1. Let be a prime P-encoding with input variables of size . Theorem 2.10 implies that either or is in regular form. In the first case, the induction hypothesis implies
[TABLE]
If is in regular form and , then the structure of the regular form implies . If is in regular form and , then Lemma 5.4 implies
[TABLE] 2. 2.
We proceed by induction on using the previous case as the basis. Let be a prime P-encoding with input variables of size . It follows from Theorem 2.10 that either or is in regular form. In the first case, observe that:
- •
If , we obtain by the first claim of this theorem.
- •
If , the induction hypothesis and imply
[TABLE]
as required.
If is in regular form, Lemma 5.4 implies
[TABLE]
as required.
∎
Note that the upper bound in Theorem 5.5 for is achieved by the sequential encoding of described in Section 3.1. It follows that actually in this case where denotes the minimum size of a PC encoding of .
6 A Lower Bound For 2-CNF P-Encodings
In this section we prove the remaining parts of Theorem 2.8. In particular, we prove a lower bound on and prove that is equal to the minimum size of a 2-CNF encoding of , even if we do not require propagation completeness. Importance of the special case of 2-CNF encodings for comes from the fact that the smallest known encodings are in 2-CNF as well as all the other encodings suggested in the literature.
We have already argued at the beginning of Section 2.5 that a 2-CNF P-encoding with input variables cannot encode . It follows by Lemma 3.3 that is an encoding of . The correspondence holds also in the opposite direction in the following sense.
Lemma 6.1**.**
A minimum size 2-CNF encoding of does not have unit implicates, is a prime P-encoding, and its size is equal to .
Proof.
Let be a minimum size 2-CNF encoding of . Since does not have unit implicates, does not have a unit implicate on an input variable. Assume for a contradiction that has a unit implicate on an auxiliary variable. Setting this variable, so that is satisfied, leads to a PC encoding of . Moreover, since the literal has at least one occurence in , at least one clause can be removed and this contradicts the assumption. Hence, does not have unit implicates. It follows that is a prime 2-CNF and by results of [3] we get that is propagation complete. It follows that it is a P-encoding and thus . On the other hand, we have observed above that a 2-CNF P-encoding with inputs is an encoding of and thus . Hence, we have for all , since the cases can easily be verified. ∎
It follows that refering to minimum size 2-CNF encodings of is the same as refering to minimum size 2-CNF P-encodings. In order to prove a lower bound on the size of a 2-CNF encoding of , we use Theorem 2.10 similarly as in Section 5 to handle encodings, which are not in regular form. However, the analysis of encodings in regular form is different and implies a stronger lower bound.
One of the differences in case of 2-CNF formulas is that a unit resolution derivation can be reversed in the following sense. If one step of unit propagation can derive from , then we can also derive from in one step, since both these steps are possible if and only if the clause is contained in the formula. Due to this, it is useful to represent a 2-CNF formula with an implication graph introduced in [2] as follows. For a formula , let be a directed graph with the set of vertices and with the set of directed edges containing and for each clause . These two directed edges (arcs) represent the implications and , respectively. This graph is skew-symmetric (also called duality property in [12] and mirror property in [11]), meaning that if and only if . We can exploit the properties of the implication graph to show stronger properties of the sets of literals defined in (16) than in the case of general CNF encodings. In particular, we show that the part of the analysis that determines the constant of the term in the lower bound can be reduced to the case where the sets are pairwise different for . Recall that in the general case we were only able to show in Lemma 4.8 that the sets are pairwise different.
The following two basic properties of 2-CNF formulas are used implicitly throughout this section. See, e.g., Theorem 5.6 in [11] for the omitted proof of Lemma 6.2.
Lemma 6.2**.**
Let be a 2-CNF formula. Then, for each , we have if and only if there is a literal which forms a unit clause in and there is a path from to in .
We are mainly interested in the properties of the minimum size 2-CNF encodings of and these encodings do not contain unit clauses by Lemma 6.1.
Lemma 6.3**.**
Let be a 2-CNF formula not containing unit clauses and let . Then the following conditions are equivalent:
- (i)
, 2. (ii)
.
Proof.
Assume (i). By Lemma 6.2, there is a path in from a unit clause in the formula to . By the assumption, this path starts in . Since is skew-symmetric, it contains also a path from to and, hence, we have (ii). By symmetry, also (ii) implies (i). ∎
The following series of statements analyze properties of minimum size 2-CNF encodings of and finally leads to Theorem 6.10.
Lemma 6.4**.**
Let be a minimum size 2-CNF encoding of and let , . Then there exist literals , , such that:
- (i)
, , and form a path in , 2. (ii)
* are pairwise distinct literals from .*
Proof.
By assumption, and . Hence, by Lemma 6.2, there is a path from to in . Let be a shortest such path. If , the proof is finished. Suppose that and let us show that the path meets (ii). Since the sequence is the shortest possible and , the literals are on pairwise different variables. Assume for a contradiction that there is a literal on an input variable , . If , then and if , then . Both these cases contradict Lemma 4.1. ∎
The following proposition shows that we can restrict our consideration to 2-CNF encodings of with no positive occurrences of input variables. This is a difference from the case of general PC encodings of . In Section 7, we present an example of an irredundant prime PC encoding of of size containing positive occurrences of input variables. We believe that positive occurrences of input variables cannot occur in a minimum size prime PC encoding of , however, we do not have a proof of this conjecture.
Lemma 6.5**.**
A minimum size 2-CNF encoding of contains no positive occurrence of an input variable.
Proof.
Assume, is a 2-CNF encoding of of minimum size and contains a clause containing a positive literal on an input variable. Let be the formula obtained by removing all such clauses from . Since is a subset of , it satisfies (P1). Moreover, by Lemma 6.4, for every , there is a series of resolutions witnessing that does not derive any literal on an input variable except of . The clauses used in this series of resolutions contain only the literals , , and literals on auxiliary variables. Hence, this series of resolutions can be used also in and this implies that satisfies (P2). This is a contradiction with minimality of . ∎
Using Lemma 6.1 and Theorem 2.10, we obtain that a minimum size 2-CNF encoding of either satisfies or it is in regular form introduced in Definition 2.9. The purpose of several following propositions concluded by Proposition 6.9 is to show that in case of 2-CNF encodings we can reduce the analysis to an even more restricted form. Recall the notation from (16). In addition to the conditions of the regular form this restricted regular form requires that the following two conditions are satisfied.
- •
The sets are pairwise distinct.
- •
For any three different indices we have .
Lemma 6.6 and Proposition 6.7 show how to deal with encodings not satisfying the first of these conditions.
Lemma 6.6**.**
Let be a minimum size 2-CNF encoding of in regular form, . Let be different and let us suppose and for . Then .
Proof.
Assume without loss of generality and . Hence, we have . By Lemma 4.8, . In order to prove the lemma, it is sufficient to exclude the cases and . Since these cases are symmetrical, we consider only the first of them.
Assume and let
[TABLE]
We show that satisfies the conditions (P1) and (P2), thus it encodes , which contradicts minimality of .
- (P1)
For every , the formula is satisfiable. Since the added clause is an implicate of and removing clauses preserves any satisfying assignments, the formula is satisfiable as well. 2. (P2)
Let us prove for every , . Due to Lemma 6.3, we can assume . If , then using the chain provided by Lemma 6.4 applied to . This chain is not affected by (22) and can thus be used in as well. Let . The case is trivial, so let . The set contains a negation of a literal from each of the sets and . Since it cannot contain both and , it contains and by Lemma 6.4, there is a path in from to that does not contain a literal on an input variable except of the starting node. By Lemma 6.3, this implies that by a path that does not use the clauses omitted in , so we have .
∎
The size of an encoding not satisfying the first condition of restricted regular form can be estimated as follows.
Proposition 6.7**.**
Let and let be a minimum size 2-CNF encoding of with the minimum number of auxiliary variables and, moreover, assume that is in regular form. If there are two different indices , such that and for , then .
Proof.
Without loss of generality, assume and . Hence, and . Denote
[TABLE]
For a proof of , assume . The set contains a negation of a literal from each of the sets and , however, it cannot contain complementary literals. It follows that either or , so .
Let us prove that and by contradiction. If , we prove that the formula encodes by verifying the conditions (P1) and (P2) in contradiction to minimality of :
- (P1)
For every , is satisfiable, since is satisfiable and is a subset of . 2. (P2)
Let us verify for each , . Due to Lemma 6.3, we can assume .
- •
If , then . Thus, and . By Lemma 6.3 we get and, hence, .
- •
If , then Lemma 6.4 guarantees that is witnessed by a series of unit resolutions not using the clause .
Similarly, if , then encodes in contradiction to minimality of . Altogether, and .
For the last step of the proof, consider the formula
[TABLE]
where . By Lemma 3.6 we get that and . Let us show that encodes by verifying the conditions (P1) and (P2).
- (P1)
For every , is satisfiable, since is satisfiable and is a subset of . 2. (P2)
Let us verify for each . Each of the sets , , , is a subset of for some . Hence, each of the formulas
[TABLE]
is satisfiable. Distinguish the following cases:
- •
If and , let be a chain of literals derived in a series of unit resolutions witnessing . If for some , then , which contradicts being satisfiable. Thus, the chain is present in as well and we have . On the other hand, we have and by a similar argument, we obtain . This implies and thus .
- •
The case of , follows from the previous one by Lemma 6.3.
- •
If , let be a chain of literals derived in a series of unit resolutions witnessing according to Lemma 6.4 that does not use the clauses and . Assume, for a contradiction, for some . Then, we have either or by Lemma 6.3. This is not possible, since implies and . Thus, the chain is present in as well and we have .
- •
The case of is analogous to case . In this case, we use that implies and .
Hence, encodes and as required. ∎
The following proposition will be used in the proof of Theorem 6.10 to handle the encodings not satisfying the second condition of the restricted regular form. These are encodings, for which there is a triangle in the graph whose vertices are auxiliary variables and the edges are the sets for .
Proposition 6.8**.**
Let and let be a minimum size 2-CNF encoding of with the minimum number of auxiliary variables and, moreover, assume that is in regular form. If there are different indices , such that
, , and are pairwise distinct, 2. 2.
,
then .
Proof.
Without loss of generality, let us assume that , , and and let . Since is in regular form, we have . Let us distinguish four cases according to the size of . Note that there are variables in that occur with both signs in .
If , then
[TABLE]
for some . The clause is an implicate of because is unsatisfiable. Indeed, any satisfying assignment of would remain satisfying even if any two of the variables are changed to 1 which would be in contradiction with the fact that encodes . On the other hand, since satisfies (P1), any two of the literals can be satisfied in a satisfying assignment of . Hence, is a prime implicate, which contradicts being a 2-CNF formula. 2. 2.
If , we can assume due to symmetry that
[TABLE]
for some . The set contains the literals and and has a non-empty intersection with each of the sets , . One can verify that this implies that for some , the set contains both and . This is a contradiction with (P1). 3. 3.
If , we can assume due to symmetry that
[TABLE]
for some . Consider the formula obtained from by omitting all clauses containing variables , , and . Let be a new input variable and consider the formula
[TABLE]
Since has no occurence in , this substitution is the same as renaming to or to , so that the literal becomes equal to . Formula has input variables and . Let us check the conditions (P1) and (P2) to show that is an encoding of :
- (P1)
If , a satisfying assignment of is a satisfying assignment of . Moreover, any satisfying assignment of satisfies and, hence, also . Renaming to as described above in and yields the formulas and , so these formulas are satisfiable as well. 2. (P2)
Let us check for each , . If , observe that the series of unit resolutions witnessing according to Lemma 6.4 does not use the omitted clauses and, hence, is present also in and . If , note that contains a negation of a literal from each of the sets , , and does not contain complementary literals. This implies and, hence, . 4. 4.
If , we can assume due to symmetry that
[TABLE]
for some . Note that the collection of the sets is invariant under a cyclic shift of the list . Clearly, , since otherwise in contradiction to (P1). By symmetry, all of the following statements are satisfied
[TABLE]
Assume for a contradiction that any two of the statements
[TABLE]
are satisfied. For each pair of these statements, we get a contradiction with (23). Hence, at most one of these statements is satisfied. It follows that we can assume without loss of generality
[TABLE]
The following claim will be used later.
Claim. If , then the set contains either all of the literals or all of the literals .
Proof.
Since , we have or . In the first case, the set contains to derive and contains to derive . In the second case, the set contains to derive and contains to derive . ∎
By Lemma 3.6 we get that the variable occurs in at least 5 clauses. Thus, the formula obtained from by omitting all clauses containing some of the literals , , , and satisfies . It remains to check the conditions (P1) and (P2) to show that is an encoding of :
- (P1)
As is a subset of , each satisfying assignment of for can be restricted to a satisfying assignment of . 2. (P2)
Let us check for each , . By Lemma 6.3, we can assume . Let us consider separately the cases and . Case .
Fix a series of unit resolutions witnessing according to Lemma 6.4. This series does not use any clause containing the literals , . If this series does not derive a literal on the variable , then and we are done. Assume, the series of resolutions derives a literal . In order to prove , we split this series into the two parts at the occurrence of the literal and replace each of these parts by another series of resolutions in such a way that they can be combined via a literal on the variable and do not derive a literal on the variable . Using this, we obtain a series witnessing .
By Lemma 6.3, we have and . Let us prove that for each , we have
- •
implies
- •
implies
If , the set contains by the claim above. Consider a series of resolutions witnessing . As , this series does not derive . By (24), this series does not derive . Together, we have .
If , the set contains by the claim above. Consider a series of resolutions witnessing . As , this series does not derive . By (23) and Lemma 6.3, this series does not derive . Together, we have .
If , then and . By the above implications, we have and . Using this and Lemma 6.3, we obtain . If , we obtain by a similar argument using a series of resolutions deriving as an intermediate step.
Case .
We have either or . Assume and consider a series of unit resolutions witnessing this. By the claim above, this series does not derive the literal . By (24) and Lemma 6.3, it does not derive . Hence, and we have .
Assume and consider a series of unit resolutions witnessing this. By the claim above, this series does not derive the literal . By (24), it does not derive . Hence, and we have . ∎
It remains to estimate the size of an encoding of that satisfies both the additional conditions of the restricted regular form.
Proposition 6.9**.**
Let and let be a minimum size 2-CNF encoding of with the minimum number of auxiliary variables and, moreover, assume that is in regular form. If satisfies the following two conditions
- •
The sets are pairwise distinct.
- •
For any three different indices we have ,
then .
Proof.
Consider the undirected graph , whose vertices are auxiliary variables and different variables are connected by an edge if and only if for some and . Let denote the set of the connected components of . Note that the elements of are sets of variables, which form a partition of . For , let
[TABLE]
Since is in regular form, . Fix and let be a sequence of literals derived in a series of resolutions witnessing according to Lemma 6.4. Hence, and . Then, the variables form a path in between a vertex in one of the components in and a vertex in one of the components in . Since all the vertices of a path belong to the same connected component, we have .
Let us prove that by contradiction. Assume and distinguish two cases:
There exists , such that for all . Choose different components different from , choose variables , and consider the formula . We show that satisfies the conditions (P1) and (P2), thus it encodes in contradiction to the assumption that has the minimum number of auxiliary variables.
- (P1)
For every , we prove that there is a satisfying assignment of , such that . This implies that is satisfiable as well.
Clearly, or , because and . Due to the symmetry between and and the variables and , we can assume . As is satisfiable, there is a literal such that is satisfiable. Lemma 6.5 and the assumption that is in regular form imply that the set contains only the literal , literals for , and literals on some of the auxiliary variables in the components contained in and in . In particular, we have . By Lemma 6.1, is propagation complete. Hence, none of the literals and is an implicate of . Consequently, there exists a satisfying assignment of the formula such that as required. 2. (P2)
Since is satisfiable for every , Lemma 3.7 for the formula and the substitution implies for all . 2. 2.
Assume that for each there exists such that . It follows that for each . Indeed, if for some and , then for all , since .
By the assumptions, there are , such that . Since and have a non-empty intersection, there are , such that
[TABLE]
By the assumptions, there is , such that . Since has a non-empty intersection with both and , we have
[TABLE]
Since , there is and, moreover, there is , such that for some . Since has a non-empty intersection with each of the sets , , , each of these sets contains . This is a contradiction, since these sets have no common element.
Let denote the set of clauses of that contain only variables from . As has at most three connected components and the number of edges of is , we have .
Consider an undirected graph with vertices , whose edges are the sets . By assumption, contains edges and does not contain a triangle. Since contains vertices, Mantel’s theorem (a special case of Turán’s theorem) implies . Thus, and . Finally, we obtain as required. ∎
The following theorem presents the second main result of this paper. Namely, it shows part 1 for and part 3 of Theorem 2.8.
Theorem 6.10**.**
For , the minimum size of a 2-CNF encoding of satisfies
If , then . 2. 2.
If , then .
Proof.
If , the conclusion follows from Lemma 6.1, Theorem 5.5 and Lemma 3.1. For the rest of the proof, let be a minimum size 2-CNF encoding of that, morever, has the minimum number of auxiliary variables among such encodings. In particular, we have . We first analyze the cases and . The upper bound follows from Lemma 3.1. The lower bound for and can be proven as follows.
- •
Assume . If is not in regular form, we have by Theorem 2.10
[TABLE]
If is in regular form and either assumptions of Proposition 6.7 or assumptions of Proposition 6.8 are satisfied, then we have
[TABLE]
It remains to consider in regular form satisfying the assumptions of Proposition 6.9, for which we have
[TABLE]
Altogether, .
- •
Assume . If is not in regular form, we have by Theorem 2.10
[TABLE]
If is in regular form and either assumptions of Proposition 6.7 or assumptions of Proposition 6.8 are satisfied, then we have
[TABLE]
It remains to consider in regular form satisfying the assumptions of Proposition 6.9. Since is an integer, we have
[TABLE]
Altogether, .
We prove for by induction. Since for and , the lower bound is already proven for these values of . Assume for the rest of the proof and consider three cases concerning the structure of .
If is not in regular form, then Theorem 2.10 and the induction hypothesis imply
[TABLE]
because holds whenever .
If is in regular form and either assumptions of Proposition 6.7 or assumptions of Proposition 6.8 are satisfied, then using the induction hypothesis, we have
[TABLE]
because holds whenever .
It remains to consider in regular form satisfying the assumptions of Proposition 6.9. This lemma implies directly the required lower bound. ∎
7 Further Research
Since 2-CNF formulas are closed under resolution, a function can have a 2-CNF encoding only if it is expressible by a 2-CNF formula. The function can be represented by an anti-monotone 2-CNF formula. It is quite natural to ask if there is a minimum size PC encoding of that is a 2-CNF formula, or at least a CNF formula without positive occurrences of the input variables. More generally, we can pose the following questions. Note that by Lemma 6.5, a positive answer to Question 7.1 implies a negative answer to Question 7.2.
Question 7.1**.**
Assume, is a boolean function expressible by a monotone or anti-monotone 2-CNF formula. Is there a PC encoding of the function of minimum size, which is, moreover, a 2-CNF formula?
Question 7.2**.**
Is there a PC encoding of of minimum size, which contains a positive occurence of an input variable?
We expect a negative answer to Question 7.2. However, for every sufficiently large , there is an irredundant prime PC encoding of of size that contains positive occurences of the input variables. Let us briefly present an example of such a formula. Let , , , be non-empty sets that form a partition of and consider auxiliary variables . Let be the set of the edges of the complete graph on the vertices except of the edges contained in the bipartite graph between and and the bipartite graph between and . The formula
[TABLE]
is a prime PC encoding of containing a positive occurence of each input variable. Moreover, removing any of the clauses with a positive occurence of an input variable leads to a formula that is not a PC encoding of . For example, if we remove the clause , then one can obtain a satisfying assignment inconsistent with the function as follows. Choose , , set , for all , , and .
It is plausible to assume that for every , there is a minimum size PC encoding of , which has the form
[TABLE]
where is a minimum size PC encoding of . This suggests the following conjecture, which is a strengthening of Proposition 3.4.
Conjecture 7.3**.**
Let be a propagation complete encoding of of minimum size and let be a propagation complete encoding of of minimum size for . Then .
The requirement that an encoding is propagation complete can be relaxed to unit refutation completeness introduced in [13]. An encoding is unit refutation complete, if for every partial assignment of that makes unsatisfiable, a contradiction can be derived by unit propagation. This makes no difference for a 2-CNF formula. A minimum size 2-CNF encoding is propagation complete and, hence, unit refutation complete. It follows that for 2-CNF, the minimum size of a unit refutation complete encoding and the minimum size of a propagation complete encoding of the same function are the same. However, for general CNF formulas, a unit refutation complete encoding can be smaller than the smallest propagation complete encoding and, hence, a lower bound on the size of a unit refutation complete encodings is harder to prove.
Question 7.4**.**
Is the minimum size of a unit refutation complete encoding of or at least ?
8 Conclusion
We have shown that any propagation complete encoding of the or constraint for contains at least clauses. This shows that the best known upper bound of clauses achieved by product encoding introduced by Chen [10] is essentially best possible. Let us point out that the product encoding is an encoding of in regular form which is the notion playing central role in our proof.
For the special case of 2-CNF encodings, we have shown for a better lower bound . This case is important, because the encodings that appear in the literature are 2-CNF formulas including the product encoding mentioned above.
We have also shown that for , the number of clauses in a propagation complete encoding of is at least . This number of clauses is achieved by sequential encoding and therefore in this case the lower and upper bound match for both general CNF formulas and 2-CNF formulas.
Acknowledgments
Petr Kučera was supported by the Czech Science Foundation (grant GA15-15511S). Petr Savický was supported by CE-ITI and GAČR under the grant GBP202/12/G061 and by the institutional research plan RVO:67985807.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Roberto Asín, Robert Nieuwenhuis, Albert Oliveras, and Enric Rodríguez-Carbonell. Cardinality networks: a theoretical and empirical study. Constraints , 16(2):195–221, 2011.
- 2[2] Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan. A linear-time algorithm for testing the truth of certain quantified boolean formulas. Information Processing Letters , 8(3):121 – 123, 1979.
- 3[3] Martin Babka, Tomáš Balyo, Ondřej Čepek, Štefan Gurský, Petr Kučera, and Václav Vlček. Complexity issues related to propagation completeness. Artificial Intelligence , 203(0):19 – 34, 2013.
- 4[4] Fahiem Bacchus. GAC via unit propagation. In Christian Bessière, editor, Principles and Practice of Constraint Programming – CP 2007 , volume 4741 of Lecture Notes in Computer Science , pages 133–147. Springer Berlin Heidelberg, 2007.
- 5[5] Olivier Bailleux and Yacine Boufkhad. Efficient CNF encoding of boolean cardinality constraints. In Principles and Practice of Constraint Programming — CP 2003 , pages 108–122. Springer, 2003.
- 6[6] Yael Ben-Haim, Alexander Ivrii, Oded Margalit, and Arie Matsliah. Perfect hashing and CNF encodings of cardinality constraints. In Proceedings of the 15th International Conference on Theory and Applications of Satisfiability Testing , SAT’12, pages 397–409, Berlin, Heidelberg, 2012. Springer-Verlag.
- 7[7] A. Biere, M. Heule, H. van Maaren, and T. Walsh. Handbook of Satisfiability , volume 185 of Frontiers in Artificial Intelligence and Applications . IOS Press, Amsterdam, The Netherlands, The Netherlands, 2009.
- 8[8] Lucas Bordeaux and Joao Marques-Silva. Knowledge compilation with empowerment. In Mária Bieliková, Gerhard Friedrich, Georg Gottlob, Stefan Katzenbeisser, and György Turán, editors, SOFSEM 2012: Theory and Practice of Computer Science , volume 7147 of Lecture Notes in Computer Science , pages 612–624. Springer Berlin / Heidelberg, 2012.
