Docsity

Polynomial Time Algorithms for Horn Formulas and Occurrence SAT, Study notes of Computer Science

Toggle sidebar
bg1
A Polynomial Time Algorithm for HORNSAT
Horn formula: A CNF Boolean formula in which every clause has at most one positive literal.
Each clause viewed as an implication.
A polynomial time algorithm to decide the satisfiability for Horn Formulas:
•Step 1: Repeat Steps 1.1 and 1.2 below until either the formula is declared to be not satisfiable in
Step 1.1 or 1.2 or every clause has at least two literals:
Step 1.1: In all clauses containing just one literal, assign truth values to the variables appearing in
these clauses to make the clauses true. If this results in an inconsitent truth assigment then the
formula is not satisfiable. Halt.
Step 1.2: Simplify the formula using this new assignment.
–If any clause in the formula evaluates to false, then the formula is not satisfiable. Halt.
–Eliminate all clauses which become true.
•Step 2: Set all the remaining variables to false.
In Step 2, every clause contains at least one negative literal.
•In Step 2, every clause in the resulting formula has at least two literals; at most one of these two
literals is a positive literal since Steps 1.1 and 1.2 do not increase the number of positive literals.
1
pf3
pf4

Partial preview of the text

Download Polynomial Time Algorithms for Horn Formulas and Occurrence SAT and more Study notes Computer Science in PDF only on Docsity!

A Polynomial Time Algorithm for HORNSAT

Horn formula: A CNF Boolean formula in which every clause has at most one positive literal.

Each clause viewed as an implication.

A polynomial time algorithm to decide the satisfiability for Horn Formulas:

  • Step 1: Repeat Steps 1.1 and 1.2 below until either the formula is declared to be not satisfiable in Step 1.1 or 1.2 or every clause has at least two literals:

Step 1.1: In all clauses containing just one literal, assign truth values to the variables appearing in these clauses to make the clauses true. If this results in an inconsitent truth assigment then the formula is not satisfiable. Halt. Step 1.2: Simplify the formula using this new assignment.

  • If any clause in the formula evaluates to false, then the formula is not satisfiable. Halt.
  • Eliminate all clauses which become true.
  • Step 2: Set all the remaining variables to false.

In Step 2, every clause contains at least one negative literal.

  • In Step 2, every clause in the resulting formula has at least two literals; at most one of these two literals is a positive literal since Steps 1.1 and 1.2 do not increase the number of positive literals.

A Polynomial Time Algorithm for HORNSAT: Example

( A¯ ∨ B¯ ∨ D¯) ∧ ( E¯) ∧ ( C¯ ∨ A) ∧ (C) ∧ (B) ∧ ( G¯ ∨ D) ∧ (G).

3 Occurrence SAT

Reduction from 3CNFSAT: replace each occurence of a variable by the required number of new variables; for each variable x in the original formula, create new clauses to constrain x and all the new variables of x to take the same truth value.

  • Let φ be a 3CNFSAT formula.
  • For each variable xi, let l 1 , l 2 ,... , lmi be its occurrences in φ either as a positive or a negative literal (Here mi denotes the number of occurrences of xi as a literal).
  • Replace each occurrence of xi by new variables {zik| 1 ≤ k ≤ mi} as follows:
    • If lk = x, replace it with zik.
    • If lk = ¬x, replace it with ¬zik.
  • Add the constraint that zik’s attain the same boolean value as xi:
    • Add a new set of clauses (¬zi 1 ∨ zi 2 ) ∧ (¬zi 2 ∨ zi 3 ) ∧... ∧ (¬zimi ∨ zi 1 ). ∗ Note that this sub-formula is true iff the zik’s are either all true or all false.
  • Call the new formula φ′.