Assignment

Logic


Overview

Topic: Logic
Related Reading: Ch. 7
Due:

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (50 points)

  1. (20 points)

    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)
    	
    1. Prove, using resolution, that the above sentence entails 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

    2. Two clauses are semantically distinct if they are not logically equivalent. How many semantically distinct 2-CNF clauses can be constructed from n proposition symbols?

      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 (A ∨ A) = (A) to be allowed in 2-CNF. This suggests approximately (2n choose 2) + 2n possible clauses, which simplifies to 2n(2n-1)/2 + 2n = n(2n-1) + 2n = 2n2 + n possible clauses. The number of semantically distinct ones are slightly less, as the n clauses of the form (A ∨ ¬A) are all equivalently true, and thus represent a single semantically different clause. So there are precisely 2n2 + 1 semantically distinct clauses.

    3. Using your answer to (b), prove that propositional resolution always terminates in time polynomial in n given a 2-CNF sentence containing no more than n distinct symbols.

      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).

    4. Explain why your argument in (c) does not apply to 3-CNF

      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.

  2. (30 points)

    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.
    1. Any propositional logic sentence is logically equivalent to the assertion that some possible world in which it would be true is in fact the case. From this observation, prove that any sentence can be written 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.

    2. Construct an algorithm that converts any sentence in propositional logic into DNF (Hint: The algorithm is similar to the algorithm for conversion to CNF)

      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 A ∧ (B ∨ C) to (A ∧ B) ∨ (A ∧ C).

    3. Construct a simple example algorithm that takes as input a sentence in DNF and returns a satisfying assignment if one exists, or reports that no satisfying assignment exists.

      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.

    4. Apply the algorithms in (b) and (c) to the following set of sentences:
      A ⇒ B
      B ⇒ C	    
      C ⇒ ¬A
      

      For variety, we will demonstrate the truth table version of the algorithm.
      ABCWorld
      TTTFalse
      TTFFalse
      TFTFalse
      TFFFalse
      FTTTrue
      FTFFalse
      FFTTrue
      FFFTrue
      Given the three True combinations, we can rewrite the combination of sentences as a single DNF clause: (¬A ∧ B ∧ C) ∨(¬A ∧ ¬B ∧ C) ∨(¬A ∧ ¬B ∧ ¬C).

      Note well that in this case we can simplify the result, by combining the final two clauses, leading to the DNF form (¬A ∧ B ∧ C) ∨(¬A ∧ ¬B).

      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.

    5. Since the algorithm in (b) is very similar to the algorithm for conversion to CNF, and since the algorithm in (c) is much simpler than any algorithm for solving a set of sentences in CNF, why is this technique not used in automated reasoning?
    6. The truth table approach clearly takes exponential time and it could produce a DNF formula that has exponential size compared to the original. Although sometimes efficient, the other algorithm also suffers from the fact that it may produce a DNF formula that has exponential size relative to the original sentence.

      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).


    Last modified: Wednesday, 05 May 2010