328 CHAPTER 5 Analysis of Algorithms
INPUT: a set C of clauses
OUTPUT: "satisfiable" or "unsatisfiable"
- N for pal = F, T
- set C1 = C
- if pval = T
- remove from C 1 all clauses containing Pi.
5. remove -'pl from all clauses in C 1 it occurs in
- else
- remove from C1 all clauses containing -Pl
8. remove pl from all clauses in C 1 it occurs in - if C 1 is empty,
output "satisfiable" and stop - else
- for pal = F, T
- set C 2 = C 1
- if p al = T
- remove from C 2 all clauses containing P2
- remove -'p2 from all clauses in C 2 it occurs in
- else
- remove from C 2 all clauses containing -P2
- remove P2 from all clauses in C 2 it occurs in
- if C 2 is empty, output "satisfiable"
- else
21.
- for pvat = F, T
- set • C, val= G-1
- ifPn =T
- remove from Cn all clauses containing Pn
- remove -'Pn from all clauses in CG it occurs in
- else
- remove from CG all clauses containing -p,n
- remove pn from all clauses in CG it occurs in
- if CG is empty, output "satisfiable" and stop
31. output "unsatisfiable"
(a) Trace through the execution of the code on the set C = {P3, -"P3 V P2, -P2 V
Pl} (so, for n = 3). Show what each Ci is after lines 8, 18, and 28. If the algorithm
stops with a "stop" command, say which step caused it to stop.