Académique Documents
Professionnel Documents
Culture Documents
Problem
By
Mutaz Flmban
Out line
CSAT & 3SAT
Normal Forms for Boolean Expression
Converting Expression to CNF
Theorem 10.12
NP-Completeness of CSAT
Theorem 10.13
NP-Completeness of 3SAT
Theorem 10.15
OUR GOAL
Reduce satisfiability for any
expression to satisfiability for
expressions in the normal form for
the 3SAT problem.
Convert each expression E in SAT
to another expression F in the
normal form for 3SAT.
Note: F is satisfiability if and only
if E is satisfiability.
Important notation
OR () is treated as a Sum, using the (+)
operator.
AND () is treated as a product.
normally use juxtaposition (no operator).
Not = ()
Example
The expression (x y) (x z):
will be written in CNF as (x + y)(x + z)
It is in conjunctive normal form, since it is the
AND (product) of the clauses:
(x + y) and (x + z).
Question?
are the expressions
(x + yz)(x + y + z)(y + z), xyz in CNF?
The first expression not in CNF.
It is the AND of three subexpressions, the last two are
clauses, but the first is not, it is the sum of a literal and a
product of two literals.
Some problems
CSAT is the problem: Given a Boolean
expression in CNF, is it satisfiable?
kSAT is the problem: Given a Boolean
expression in k-CNF, is it satisfiable?
DeMorgans Laws
I. (E F) (E) (F)
to push below , the is
changed to an .
II. (E F) (E) (F)
to push below , the is
changed to an .
III. (E) E : the double negation.
Example
E = (((x + y))(x + y))
(((x + y))(x + y))
Start
((x + y))+(x + y)
(1)
x + y + (x + y)
(3)
x + y + ((x)) y
(2)
x + y + x y
(3)
Theorem 10.12
Every Boolean expression E is
equivalent to an expression F in which
the only negations occur in literals.
the length of F is linear in the number of
symbols of E, and F can be constructed
from E in polynomial time.
The PROOF
The proof is an induction on the number of
operators (, and ) in E.
There is an equivalent expression F with s
only in literals.
If E has n 1 operators, then F has no more
than 2n 1 operators.
continue
F need not have more than one pair of parentheses
per operator.
The number of variable in an expression cannot
exceed the number of operators by more than one.
the length of F is linearly proportional to the length
of E.
the time it takes to construct F is proportional to its
length and the length of E.
BASIS
If E has one operator, it must be of the form:
x
xy
xy
In each case, E is already in the required form, so F =
E.
Note, E and F each have one operator:
The relationship F has at most twice the number of
operators of E minus 1.
induction
Suppose the statement is true for all expressions
with fewer operations than E.
if the highest operator of E is not .
Then E must be of the form:
E1 E2
E1 E2
Induction (continued)
consider the case where E is of the form E 1
There are three cases depending on what the
top operator of E1 is:
E1 = E2
E1 = E2 E3
E1 = E2 E3
The case E1 = E2
By the law of double negation, E = (E2)
E2 has fewer operators than E.
By the inductive hypothesis: there is an
equivalent F for E2 in which the only s are in
literals.
The number of operators of F is at most twice the
number in E2 minus 1, and it is surely true for E.
The Case E1 = E2 E3
By DeMorgans Law: E= (E2 E3) = E2 E3
Both (E2) and (E3) have fewer operators than E.
By the inductive hypothesis: they have an equivalents F2
and F3 that have s only in literals.
F = F2 F3 = E
Let (E2) has (a) operators, and (E3) has (b) operators.
(E) has (a+b+2) operators.
Since (E2) and (E3) have (a+1) and (b+1) operators,
and (F2) has at most 2(a+1)-1 operators, (F3) has at most
2(b+1)-1 operators.
(F) has at most 2a+2b+3 operators. And this number
The Case E1 = E2 E3
This argument, using the second of
DeMorgans laws, is essentially the
same as the case (2).
Theorem 10.13
CSAT is NP-Complete
PROOF:
We show how to reduce SAT to CSAT in polynomial
time:
Using method 10.12 to convert a SAT to an expression E
whose s are only in literals.
Convert E to a CNF expression F in polynomial time.
F is satisfiable if and only if E is.
BASIS
If E consists of one or two symbols,
then it is a literal.
A literal is a clause, so E is already
in CNF.
Induction
Assume that every expression shorter than E
can be converted to a product of clauses.
And conversion takes at most cn2 time on an
expressions of length n.
There are two cases depending on the top-level
operator of E:
E = E1 E2
E = E1 E2
Case 1: E = E1 E2
By the inductive hypothesis:
There are expressions F1 and F2 derived from E1 and E2 respectively in
CNF
All and only the satisfying assignments for E1 can be extended to a
satisfying assignment for F1.
All and only the satisfying assignments for E2 can be extended to a
satisfying assignment for F2.
Let F = F1 F2 where:
F1 F2 is a CNF expression if F1 and F2 are CNF expressions
Case 2: E = E1 E2
By the inductive hypothesis: there
expressions F1 and F2 with the properties:
are
CNF
Continued
Suppose F1= g1 g2 .. gp. And F2= h1 h2 .. hq
Where gs and hs are clauses, also introduce a new
variable y, and let:
F=(y+g1)*(y+g2)**(y+gp) * (y+h1) *
(y+h2) * *(y+hq)
We want to proof that a truth assignment T for E satisfies
E if and only if T can be extended to a truth assignment S
that satisfies F.
Case 2: If Part
Construct an extension S for T, S will satisfy the
expression F as follows:
1) for all variables x in F1, S(x) = S1(x).
2) S(y) = 0 , this makes all the clauses of F that are derived
from F2 true.
3) For all variables x that are in F2 but not in F1, S(x) can be
either 0 or 1.
NP-Completeness of 3SAT
The problem 3SAT is:
Given a boolean expression E that is the
product of clauses, each of which is the sum of
three distinct literals, is E satisfiable?
Theorem 10.15
3SAT is NP-Complete
Proof:
3SAT is in NP, since SAT is NP
To prove NP-Completeness we shell Reduce CSAT
to 3SAT.
PROOF
Given a CNF expression E = e1 ek, replace each
clause ei to create a new expression F
If ei is a single literal (x), we introduce new variables u
and v. Replace (x) by the four clauses:
(x+u+v)(x+u+ v)(x+u+v)(x+u+v)
continue
Thus, each instance of E of CSAT can be
reduced to an instance of F of 3SAT such
that F is satisfiable if and only if E is
satisfiable.
Construction time is linear in length of E.
Since CSAT is NP-Complete, 3SAT is
NP-complete.
Reference
John E. Hopcroft, Rajeev Motwani and
Jeffrey D. Ullman, Introduction to Automata
Theory, Languages, and Computation
Questions
1. How we can reduce the SAT to the CSAT?
We push all s down the expression tree.
Write the Boolean expressions in CNF form.
2. Show how to convert (((x + y))(x + y)) to CNF form
(((x + y))(x + y))
((x + y))+(x + y)
x + y + (x + y)
x + y + ((x)) y
x + y + x y