2.5 Quality and Error Measures
3.1.1 CNFs and Factor Graphs
Without loss of generality, we assume that a Boolean formula is represented in CNF. Every Boolean formula can be converted to CNF with help of De Morgan’s law and the distributivity law. However, in practice this can lead to an exponential blow up of the formula. A CNF is a conjunction of disjunctions of Boolean literals. A literal is either a negated or unnegated
f1 X1 f X2 2 f3 X3 X1 f1 f2 X2 vc = (1, 1) f c = (1, 1) vc = (0, 2) f c = (0, 1) vc = (0, 1) f c = (0, 1)
Figure 3.1: (left) (X1∨ ¬X2)∧ (¬X1∨ X2)∧ (X1∨ X2∨ X3) represented as a factor graph. Circles denote variable nodes and squares denote clauses. A dashed line indicates that the variable appears negated in a clause; otherwise we use a full line. (right) The resulting lifted CNF after running the Color Passing algorithm as illustrated in Figure 2.4.
propositional variable. Specifically, a CNF consists of n variables X = {X1, . . . , Xn} with xi∈ {False, True} and m clauses C = {C1, . . . , Cm} constraining the variables. A clause Ca is defined over a subset of the variables Xa =Xa,1, . . . , Xa,|Ca| and — this will turn out to
be convenient for formulating the message passing update formulas — a corresponding list of their signs which is denoted as sa=sa,1, . . . , sa,|Ca| with
sa,i= (
−1, if Xa,iunnegated 1, if Xa,inegated
(3.1)
A solution to a CNF is an assignment to all variables in X such that all clauses in C are satisfied, i.e., evaluate to True. As an example, consider the following CNF, consisting of three variables, three clauses, and seven literals:
(X1∨ ¬X2)∧ (¬X1∨ X2)∧ (X1∨ X2∨ X3) . A possible solution to that formula is X1= True, X2 = False, X3= True.
Every CNF can be represented as a factor graph (see [128]). The factor graph representing the example CNF from above is shown in Figure 3.1(left). For CNFs, there is a one-to-one mapping between the variables in the CNF and the variable nodes in the factor graph, as well as the clauses and factor nodes. Therefore, we will not distinguish between logical and probabilistic variables explicitly. We have a factor fa for each clause Ca∈ C. We use a dashed line between a variable Xi and a factor fa whenever the variable appears negated in a clause, i.e., si,a= 1, otherwise a full line. The factor functions fa(xa) are defined in a such a way that they return a value of 1 if the corresponding clause evaluates to True for xa and 0 otherwise. With this definition, the normalization constant Z amounts to the number of solutions of the CNF and each satisfying assignment of X has the same probability, i.e., 1/Z.
Before deriving lifted message updates for WP and SP in the next sections, let us first illustrate lifting in the case of CNFs. As we will see, CP and its outcome, the lifted factor graph, are simpler for the CNF case compared to the LBP case. As we have seen above, we can use the CP algorithm to lift a ground factor graph. Of course, this is also possible for a factor graph representing a CNF. Again, for the lifted satisfiability approach, CP on a factor graph representing a CNF is the first step. For such a factor graph, the domain of each variable has size d = 2 and the initial coloring of the factors just distinguishes clauses with different number
of negated and unnegated variables. I.e., two clauses fall into the same group if both have the same number of positive and negative literals because the logic operator ∨ is commutative. But more importantly, as we will show next, the lifting can actually be simplified in the case of CNFs.
First, we can employ a more efficient color signature coding scheme. The initial grouping of the factors solely depends on the zero state of their corresponding clause. Additionally, the factor nodes do not have to sort the incoming colors according to the positions of the variables, instead only the sign of a variable matters, i.e., only two positions exist. One position for the variables appearing unnegated in the clause and a second position for the negated variables. We have seen in the case of the BP lifting that we have to distinguish arbitrarily many positions (see Example 2.3 for details).
Second, we can employ simplified counts. Because there are only two positions, we store two values: counts for the negated position and for the unnegated position. We do not have to manage a complex structure with counts for different positions as in the case of LBP anymore. Reconsider Figure 3.1(right). Here, the count associated with the edge between X1 and f1 is (1, 1) because X1 represents ground variables that appeared positive and negative in ground factors represented by f1. Second, there is the variable count vc. It corresponds to the number of ground variables that send messages to a factor at each position. In the ground network, the factor f3 is connected to three positive variables, but two of them are represented by a single clusternode in the lifted network. Hence, we have vc = (0, 2) for the edge between X1 and f2 because f2 is now the representative of f3. So, for lifted CNFs, all counts in the factor graph are of dimension two only.
Having the lifted CNF at hand, we can now run LBP on this lifted graph. However, there are other ground message passing algorithms available that are more appropriate for solving CNFs. We will show that these algorithms can be lifted too. First, we will describe the approach based on LBP, before we will then derive the lifted versions of WP and SP which are designed to operate on factor graphs for CNFs directly.