Topic: Logic
Related Reading: Ch. 7
Due:
Please make sure you adhere to the policies on academic integrity.
A propositional 2-CNF expression is a conjunction of clauses, each containing exactly 2 literals, e.g.,
(A ∨ B) ∧ (¬A ∨ C) ∧ (¬B ∨ D) ∧ (¬C ∨ G) ∧ (¬D ∨ G)
(A ∨ B) ∧ (¬A ∨ C) resolves to (B ∨ C)
(¬B ∨ D) ∧ (B ∨ C) resolves to (D ∨ C)
(D ∨ C) ∧ (¬C ∨ G) resolves to (D ∨ G)
(D ∨ G) ∧ (¬D ∨ G) resolves to G
Given the n symbols and their negations, there
are 2n possible literals. A 2-CNF formala can be
formed by choosing any 2 distinct literals of
those 2n, or by choosing the same one twice, if
we consider a formula such as
Starting with a given sentence, resolution proceeds by taking two existing clasues that can be resolved, and adding the resultant as a new clause in the knowledge base (assuming it is not already there). Based on (b), at most O(n2) new clasues can be added to the knowledge base. Each clause added requires a process that involves considering all possible pairs of existing clauses. Even without any special data structures, this suggest at most O(n2) steps, each of which requires at most O(n4) time. This leads to an upper bound of O(n6) on the time (although clearly much better is possible with more care).
Notice that when we resolve two clauses from 2-CNF, the resultant has at most two literals (one each from the two resolved clauses, with the key literal removed from the result). The problem with 3-CNF is that resolving two different 3-CNF clauses will in general produce a resultant that has four literals. The continued resolution of those larger clauses may result in even larger clasues.
So although it is true that there are only polynomially many semantically distinct 3-CNF clauses, the process of resolution generates clauses with more literals.
A sentence is in disjunctive normal form (DNF) if it is the disjunction of conjunctions of literals. For example, the sentence
(A ∧ B ∧ ¬C) ∨ (¬A ∧ C) ∨ (B ∧ ¬C)is in DNF.
Given a finite number of propositional symbols, consider the truth table and specifically those rows of the truth table for which the overall sentence evaluates to true. The precondition for each such row can be stated as a conjunction of literals, using a positive literal for those variables that are true and a negated literal for those variables that are false.
If we take such a conjunction for every row of the truth table for which the sentence is true, we can create a DNF formula by taking the disjunction of those conjunctions. We claim that the original sentence must be logically equivalent to the DNF formula we have described. If the DNF formula is true, there must be at least one clause that is true, and that corresponds to a setting of variables that is consistent with a row of the truth table for which the original sentence is true. Conversely, if the original sentence is true for some setting of variables, the conjunction corresponding to that row of the table must be true, and thus the disjunction of our DNF formula.
One possible algorithm is based directly on the truth table
construction described in the previous part. However, it
is also possible to use an approach similar to that for
converting to CNF. We start similar to the one from the
book, removing all biconditions and implications, and then
pushing all negations inward to the literals using
DeMorgan's law as necessary. The final step is different,
as we distribute the ∧ operators over the ∨
operators. For example, we might convert the sentence
Since satisfiability depends only on finding a single satisfiable clause, we can check each clause independently. A particular clause is satisfiable so long as it does not contain both the positive and negative literals for any of the variables.
Assuming we find a satisfiable clause, we can create a complete satisfying assignment by assigning those variables that are within the clause to the natural setting based on that clause, and assign all other variables not in the clause arbitrarily.
A ⇒ B B ⇒ C C ⇒ ¬A
For variety, we will demonstrate the truth table version
of the algorithm.
Given the three True combinations, we can rewrite the
combination of sentences as a single DNF clause:
A B C World
T T T False
T T F False
T F T False
T F F False
F T T True
F T F False
F F T True
F F F True
Note well that in this case we can simplify the result, by
combining the final two clauses, leading to the DNF form
As for the algorithm in (c) for satisfiability, either of those clauses can be used to give a satisfying assignment, for example we could set A=false, B=false, and C arbitrarily.
But this question is a bit misleading, because the conversion to CNF described in the book suffers from the same risk of an exponential increase in the size of the formula. The reason that CNF is used in practice is because there are algorithms to take a general formula and to create a CNF form that has polynomial size compared to the original, and which is satisfiable if and only if the original formula is (albeit, with the need to introduce additional artificial variables).