SlideShare a Scribd company logo
1
The Satisfiability Problem
Cook’s Theorem: An NP-Complete
Problem
Restricted SAT: CSAT, 3SAT
2
Boolean Expressions
Boolean, or propositional-logic
expressions are built from variables and
constants using the operators AND, OR,
and NOT.
 Constants are true and false, represented
by 1 and 0, respectively.
 We’ll use concatenation (juxtaposition) for
AND, + for OR, - for NOT, unlike the text.
3
Example: Boolean expression
(x+y)(-x + -y) is true only when
variables x and y have opposite truth
values.
Note: parentheses can be used at will,
and are needed to modify the
precedence order NOT (highest), AND,
OR.
4
The Satisfiability Problem (SAT )
Study of boolean functions generally is
concerned with the set of truth
assignments (assignments of 0 or 1 to
each of the variables) that make the
function true.
NP-completeness needs only a simpler
question (SAT): does there exist a truth
assignment making the function true?
5
Example: SAT
 (x+y)(-x + -y) is satisfiable.
 There are, in fact, two satisfying truth
assignments:
1. x=0; y=1.
2. x=1; y=0.
 x(-x) is not satisfiable.
6
SAT as a Language/Problem
An instance of SAT is a boolean
function.
Must be coded in a finite alphabet.
Use special symbols (, ), +, - as
themselves.
Represent the i-th variable by symbol x
followed by integer i in binary.
7
Example: Encoding for SAT
(x+y)(-x + -y) would be encoded by
the string (x1+x10)(-x1+-x10)
8
SAT is in NP
There is a multitape NTM that can decide if a
Boolean formula of length n is satisfiable.
The NTM takes O(n2) time along any path.
Use nondeterminism to guess a truth
assignment on a second tape.
Replace all variables by guessed truth values.
Evaluate the formula for this assignment.
Accept if true.
9
Cook’s Theorem
SAT is NP-complete.
 Really a stronger result: formulas may be
in conjunctive normal form (CSAT) – later.
To prove, we must show how to
construct a polytime reduction from
each language L in NP to SAT.
Start by assuming the most resticted
possible form of NTM for L (next slide).
10
Assumptions About NTM for L
1. One tape only.
2. Head never moves left of the initial
position.
3. States and tape symbols are disjoint.
 Key Points: States can be named
arbitrarily, and the constructions
many-tapes-to-one and two-way-
infinite-tape-to-one at most square
the time.
11
More About the NTM M for L
Let p(n) be a polynomial time bound
for M.
Let w be an input of length n to M.
If M accepts w, it does so through a
sequence I0⊦I1⊦…⊦Ip(n) of p(n)+1 ID’s.
 Assume trivial move from a final state.
Each ID is of length at most p(n)+1,
counting the state.
12
From ID Sequences to
Boolean Functions
The Boolean function that the
transducer for L will construct from w
will have (p(n)+1)2 “variables.”
Let variable Xij represent the j-th
position of the i-th ID in the accepting
sequence for w, if there is one.
 i and j each range from 0 to p(n).
13
Picture of Computation as an Array
Initial ID X00 X01 … X0p(n)
X10 X11 … X1p(n)
I1
Ip(n)
Xp(n)0 Xp(n)1 … Xp(n)p(n)
.
.
.
.
.
.
14
Intuition
From M and w we construct a boolean
formula that forces the X’s to represent
one of the possible ID sequences of
NTM M with input w, if it is to be
satisfiable.
It is satisfiable iff some sequence leads
to acceptance.
15
From ID’s to Boolean Variables
The Xij’s are not boolean variables; they
are states and tape symbols of M.
However, we can represent the value of
each Xij by a family of Boolean variables
yijA, for each possible state or tape
symbol A.
yijA is true if and only if Xij = A.
16
Points to Remember
1. The boolean function has components that
depend on n.
 These must be of size polynomial in n.
2. Other pieces depend only on M.
 No matter how many states/symbols m has,
these are of constant size.
3. Any logical formula about a set of
variables whose size is independent of n
can be written somehow.
17
Designing the Function
 We want the Boolean function that
describes the Xij’s to be satisfiable if
and only if the NTM M accepts w.
 Four conditions:
1. Unique: only one symbol per position.
2. Starts right: initial ID is q0w.
3. Moves right: each ID follows from the
next by a move of M.
4. Finishes right: M accepts.
18
Unique
Take the AND over all i, j, Y, and Z of
(-yijY+ -yijZ).
That is, it is not possible for Xij to be
both symbols Y and Z.
19
Starts Right
 The Boolean Function needs to assert
that the first ID is the correct one with
w = a1…an as input.
1. X00 = q0.
2. X0i = ai for i = 1,…, n.
3. X0i = B (blank) for i = n+1,…, p(n).
 Formula is the AND of y0iZ for all i,
where Z is the symbol in position i.
20
Finishes Right
Somewhere, there must be an
accepting state.
Form the OR of Boolean variables yijq,
where i and j are arbitrary and q is an
accepting state.
Note: differs from text.
21
Running Time So Far
Unique requires O(p2(n)) symbols be
written.
 Parentheses, signs, propositional variables.
Algorithm is easy, so it takes no more
time than O(p2(n)).
Starts Right takes O(p(n)) time.
Finishes Right takes O(p2(n)) time.
Variation
over i and j
Variation over symbols Y
and Z is independent of n,
so covered by constant.
22
Running Time – (2)
Caveat: Technically, the propositions
that are output of the transducer must
be coded in a fixed alphabet, e.g.,
x10011 rather than yijA.
Thus, the time and output length have
an additional factor O(log n) because
there are O(p2(n)) variables.
But log factors do not affect polynomials
23
Moves Right
Xij = Xi-1,j whenever the state is none of
Xi-1,j-1, Xi-1,j, or Xi-1,j+1.
For each i and j, construct a formula
that says (in propositional variables) the
OR of “Xij = Xi-1,j” and all yi-1,k,A where A
is a state symbol (k = i-1, i, or i+1).
 Note: Xij = Xi-1,j is the OR of yijA.yi-1,jA for all
symbols A.
Works because
Unique assures
only one yijX true.
24
Constraining the Next Symbol
… A B C …
B
Easy case;
must be B
… A q C …
? ? ?
Hard case; all
three may depend
on the move of M
25
Moves Right – (2)
 In the case where the state is nearby,
we need to write an expression that:
1. Picks one of the possible moves of the
NTM M.
2. Enforces the condition that when Xi-1,j is
the state, the values of Xi,j-1, Xi,j, and
Xi,j+1. are related to Xi-1,j-1, Xi-1,j, and
Xi-1,j+1 in a way that reflects the move.
26
Example: Moves Right
Suppose δ(q, A) contains (p, B, L).
Then one option for any i, j, and C is:
C q A
p C B
If δ(q, A) contains (p, B, R), then an
option for any i, j, and C is:
C q A
C B p
27
Moves Right – (3)
For each possible move, express the
constraints on the six X’s by a Boolean
formula.
For each i and j, take the OR over all
possible moves.
Take the AND over all i and j.
Small point: for edges (e.g., state at 0),
assume invisible symbols are blank.
28
Running Time
We have to generate O(p2(n)) Boolean
formulas, but each is constructed from
the moves of the NTM M, which is fixed
in size, independent of the input w.
Takes time O(p2(n)) and generates an
output of that length.
 Times log n, because variables must be
coded in a fixed alphabet.
29
Cook’s Theorem – Finale
In time O(p2(n) log n) the transducer
produces a boolean formula, the AND of
the four components: Unique, Starts,
Finishes, and Moves Right.
If M accepts w, the ID sequence gives
us a satisfying truth assignment.
If satisfiable, the truth values tell us an
accepting computation of M.
30
Picture So Far
We have one NP-complete problem: SAT.
In the future, we shall do polytime
reductions of SAT to other problems,
thereby showing them NP-complete.
Why? If we polytime reduce SAT to X,
and X is in P, then so is SAT, and
therefore so is all of NP.
31
Conjunctive Normal Form
A Boolean formula is in Conjunctive
Normal Form (CNF) if it is the AND of
clauses.
Each clause is the OR of literals.
A literal is either a variable or the
negation of a variable.
Problem CSAT : is a Boolean formula in
CNF satisfiable?
32
Example: CNF
(x + -y + z)(-x)(-w + -x + y + z) (…
33
NP-Completeness of CSAT
The proof of Cook’s theorem can be
modified to produce a formula in CNF.
Unique is already the AND of clauses.
Starts Right is the AND of clauses, each
with one variable.
Finishes Right is the OR of variables,
i.e., a single clause.
34
NP-Completeness of CSAT – (2)
Only Moves Right is a problem, and not
much of a problem.
It is the product of formulas for each i
and j.
Those formulas are fixed, independent
of n.
35
NP-Completeness of CSAT – (3)
You can convert any formula to CNF.
It may exponentiate the size of the
formula and therefore take time to write
down that is exponential in the size of
the original formula, but these numbers
are all fixed for a given NTM M and
independent of n.
36
k-SAT
If a boolean formula is in CNF and
every clause consists of exactly k
literals, we say the boolean formula is
an instance of k-SAT.
 Say the formula is in k-CNF.
Example: 3-SAT formula
(x + y + z)(x + -y + z)(x + y + -z)(x + -y + -z)
37
k-SAT Facts
Every boolean formula has an
equivalent CNF formula.
 But the size of the CNF formula may be
exponential in the size of the original.
Not every boolean formula has a k-SAT
equivalent.
2SAT is in P; 3SAT is NP-complete.
38
Proof: 2SAT is in P (Sketch)
Pick an assignment for some variable,
say x = true.
Any clause with –x forces the other
literal to be true.
 Example: (-x + -y) forces y to be false.
Keep seeing what other truth values
are forced by variables with known
truth values.
39
Proof – (2)
 One of three things can happen:
1. You reach a contradiction (e.g., z is
forced to be both true and false).
2. You reach a point where no more
variables have their truth value forced,
but some clauses are not yet made true.
3. You reach a satisfying truth assignment.
40
Proof – (3)
Case 1: (Contradiction) There can only
be a satisfying assignment if you use
the other truth value for x.
 Simplify the formula by replacing x by this
truth value and repeat the process.
Case 3: You found a satisfying
assignment, so answer “yes.”
41
Proof – (4)
Case 2: (You force values for some
variables, but other variables and
clauses are not affected).
 Adopt these truth values, eliminate the
clauses that they satisfy, and repeat.
In Cases 1 and 2 you have spent O(n2)
time and have reduced the length of
the formula by > 1, so O(n3) total.
42
3SAT
This problem is NP-complete.
Clearly it is in NP, since SAT is.
It is not true that every Boolean
formula can be converted to an
equivalent 3-CNF formula, even if we
exponentiate the size of the formula.
43
3SAT – (2)
But we don’t need equivalence.
We need to reduce every CNF formula
F to some 3-CNF formula that is
satisfiable if and only if F is.
Reduction involves introducing new
variables into long clauses, so we can
split them apart.
44
Reduction of CSAT to 3SAT
Let (x1+…+xn) be a clause in some
CSAT instance, with n > 4.
 Note: the x’s are literals, not variables; any
of them could be negated variables.
Introduce new variables y1,…,yn-3 that
appear in no other clause.
45
CSAT to 3SAT – (2)
Replace (x1+…+xn) by
(x1+x2+y1)(x3+y2+ -y1) … (xi+yi-1+ -yi-2)
… (xn-2+yn-3+ -yn-4)(xn-1+xn+ -yn-3)
If there is a satisfying assignment of
the x’s for the CSAT instance, then one
of the literals xi must be made true.
Assign yj = true if j < i-1 and yj = false
for larger j.
46
CSAT to 3SAT – (3)
We are not done.
We also need to show that if the
resulting 3SAT instance is satisfiable,
then the original CSAT instance was
satisfiable.
47
CSAT to 3SAT – (4)
Suppose (x1+x2+y1)(x3+y2+ -y1) …
(xn-2+yn-3+ -yn-4)(xn-1+xn+ -yn-3)
is satisfiable, but none of the x’s is true.
The first clause forces y1 = true.
Then the second clause forces y2 = true.
And so on … all the y’s must be true.
But then the last clause is false.
48
CSAT to 3SAT – (5)
There is a little more to the reduction,
for handling clauses of 1 or 2 literals.
Replace (x) by (x+y1+y2) (x+y1+ -y2)
(x+ -y1+y2) (x+ -y1+ -y2).
Replace (w+x) by (w+x+y)(w+x+ -y).
Remember: the y’s are different
variables for each CNF clause.
49
CSAT to 3SAT Running Time
This reduction is surely polynomial.
In fact it is linear in the length of the
CSAT instance.
Thus, we have polytime-reduced CSAT
to 3SAT.
Since CSAT is NP-complete, so is 3SAT.

More Related Content

Similar to pnp2.ppt

Skiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionSkiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reduction
zukun
 
Stochastic Processes Assignment Help
Stochastic Processes Assignment HelpStochastic Processes Assignment Help
Stochastic Processes Assignment Help
Statistics Assignment Help
 
1Boolean Alegebra 3booleanalgebraold-160325120651.pdf
1Boolean Alegebra 3booleanalgebraold-160325120651.pdf1Boolean Alegebra 3booleanalgebraold-160325120651.pdf
1Boolean Alegebra 3booleanalgebraold-160325120651.pdf
siliconvalley6203
 
Programming Exam Help
Programming Exam Help Programming Exam Help
Programming Exam Help
Programming Exam Help
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
Manish Kumar
 
matrix theory and linear algebra.pptx
matrix theory and linear algebra.pptxmatrix theory and linear algebra.pptx
matrix theory and linear algebra.pptx
Maths Assignment Help
 
Signals and Systems Assignment Help
Signals and Systems Assignment HelpSignals and Systems Assignment Help
Signals and Systems Assignment Help
Matlab Assignment Experts
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
S.Shayan Daneshvar
 
Theoryofcomp science
Theoryofcomp scienceTheoryofcomp science
Theoryofcomp science
Raghu nath
 
Online Signals and Systems Assignment Help
Online Signals and Systems Assignment HelpOnline Signals and Systems Assignment Help
Online Signals and Systems Assignment Help
Matlab Assignment Experts
 
Matlab II
Matlab IIMatlab II
Matlab II
Kelin Jose
 
Sawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD ThesisSawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur
 
probability assignment help (2)
probability assignment help (2)probability assignment help (2)
probability assignment help (2)
Statistics Homework Helper
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved ex
Maths Tutoring
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
Excel Homework Help
 
The mobius function and the mobius inversion formula
The mobius function and the mobius inversion formulaThe mobius function and the mobius inversion formula
The mobius function and the mobius inversion formula
BenjJamiesonDuag
 
Class 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxClass 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptx
MdSiddique20
 
Chapter0
Chapter0Chapter0
Chapter0
guest497e7c
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
parmeet834
 
3_MLE_printable.pdf
3_MLE_printable.pdf3_MLE_printable.pdf
3_MLE_printable.pdf
Elio Laureano
 

Similar to pnp2.ppt (20)

Skiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionSkiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reduction
 
Stochastic Processes Assignment Help
Stochastic Processes Assignment HelpStochastic Processes Assignment Help
Stochastic Processes Assignment Help
 
1Boolean Alegebra 3booleanalgebraold-160325120651.pdf
1Boolean Alegebra 3booleanalgebraold-160325120651.pdf1Boolean Alegebra 3booleanalgebraold-160325120651.pdf
1Boolean Alegebra 3booleanalgebraold-160325120651.pdf
 
Programming Exam Help
Programming Exam Help Programming Exam Help
Programming Exam Help
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
matrix theory and linear algebra.pptx
matrix theory and linear algebra.pptxmatrix theory and linear algebra.pptx
matrix theory and linear algebra.pptx
 
Signals and Systems Assignment Help
Signals and Systems Assignment HelpSignals and Systems Assignment Help
Signals and Systems Assignment Help
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 
Theoryofcomp science
Theoryofcomp scienceTheoryofcomp science
Theoryofcomp science
 
Online Signals and Systems Assignment Help
Online Signals and Systems Assignment HelpOnline Signals and Systems Assignment Help
Online Signals and Systems Assignment Help
 
Matlab II
Matlab IIMatlab II
Matlab II
 
Sawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD ThesisSawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD Thesis
 
probability assignment help (2)
probability assignment help (2)probability assignment help (2)
probability assignment help (2)
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved ex
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
 
The mobius function and the mobius inversion formula
The mobius function and the mobius inversion formulaThe mobius function and the mobius inversion formula
The mobius function and the mobius inversion formula
 
Class 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxClass 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptx
 
Chapter0
Chapter0Chapter0
Chapter0
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 
3_MLE_printable.pdf
3_MLE_printable.pdf3_MLE_printable.pdf
3_MLE_printable.pdf
 

Recently uploaded

Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
GDSC PJATK
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 

Recently uploaded (20)

Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 

pnp2.ppt

  • 1. 1 The Satisfiability Problem Cook’s Theorem: An NP-Complete Problem Restricted SAT: CSAT, 3SAT
  • 2. 2 Boolean Expressions Boolean, or propositional-logic expressions are built from variables and constants using the operators AND, OR, and NOT.  Constants are true and false, represented by 1 and 0, respectively.  We’ll use concatenation (juxtaposition) for AND, + for OR, - for NOT, unlike the text.
  • 3. 3 Example: Boolean expression (x+y)(-x + -y) is true only when variables x and y have opposite truth values. Note: parentheses can be used at will, and are needed to modify the precedence order NOT (highest), AND, OR.
  • 4. 4 The Satisfiability Problem (SAT ) Study of boolean functions generally is concerned with the set of truth assignments (assignments of 0 or 1 to each of the variables) that make the function true. NP-completeness needs only a simpler question (SAT): does there exist a truth assignment making the function true?
  • 5. 5 Example: SAT  (x+y)(-x + -y) is satisfiable.  There are, in fact, two satisfying truth assignments: 1. x=0; y=1. 2. x=1; y=0.  x(-x) is not satisfiable.
  • 6. 6 SAT as a Language/Problem An instance of SAT is a boolean function. Must be coded in a finite alphabet. Use special symbols (, ), +, - as themselves. Represent the i-th variable by symbol x followed by integer i in binary.
  • 7. 7 Example: Encoding for SAT (x+y)(-x + -y) would be encoded by the string (x1+x10)(-x1+-x10)
  • 8. 8 SAT is in NP There is a multitape NTM that can decide if a Boolean formula of length n is satisfiable. The NTM takes O(n2) time along any path. Use nondeterminism to guess a truth assignment on a second tape. Replace all variables by guessed truth values. Evaluate the formula for this assignment. Accept if true.
  • 9. 9 Cook’s Theorem SAT is NP-complete.  Really a stronger result: formulas may be in conjunctive normal form (CSAT) – later. To prove, we must show how to construct a polytime reduction from each language L in NP to SAT. Start by assuming the most resticted possible form of NTM for L (next slide).
  • 10. 10 Assumptions About NTM for L 1. One tape only. 2. Head never moves left of the initial position. 3. States and tape symbols are disjoint.  Key Points: States can be named arbitrarily, and the constructions many-tapes-to-one and two-way- infinite-tape-to-one at most square the time.
  • 11. 11 More About the NTM M for L Let p(n) be a polynomial time bound for M. Let w be an input of length n to M. If M accepts w, it does so through a sequence I0⊦I1⊦…⊦Ip(n) of p(n)+1 ID’s.  Assume trivial move from a final state. Each ID is of length at most p(n)+1, counting the state.
  • 12. 12 From ID Sequences to Boolean Functions The Boolean function that the transducer for L will construct from w will have (p(n)+1)2 “variables.” Let variable Xij represent the j-th position of the i-th ID in the accepting sequence for w, if there is one.  i and j each range from 0 to p(n).
  • 13. 13 Picture of Computation as an Array Initial ID X00 X01 … X0p(n) X10 X11 … X1p(n) I1 Ip(n) Xp(n)0 Xp(n)1 … Xp(n)p(n) . . . . . .
  • 14. 14 Intuition From M and w we construct a boolean formula that forces the X’s to represent one of the possible ID sequences of NTM M with input w, if it is to be satisfiable. It is satisfiable iff some sequence leads to acceptance.
  • 15. 15 From ID’s to Boolean Variables The Xij’s are not boolean variables; they are states and tape symbols of M. However, we can represent the value of each Xij by a family of Boolean variables yijA, for each possible state or tape symbol A. yijA is true if and only if Xij = A.
  • 16. 16 Points to Remember 1. The boolean function has components that depend on n.  These must be of size polynomial in n. 2. Other pieces depend only on M.  No matter how many states/symbols m has, these are of constant size. 3. Any logical formula about a set of variables whose size is independent of n can be written somehow.
  • 17. 17 Designing the Function  We want the Boolean function that describes the Xij’s to be satisfiable if and only if the NTM M accepts w.  Four conditions: 1. Unique: only one symbol per position. 2. Starts right: initial ID is q0w. 3. Moves right: each ID follows from the next by a move of M. 4. Finishes right: M accepts.
  • 18. 18 Unique Take the AND over all i, j, Y, and Z of (-yijY+ -yijZ). That is, it is not possible for Xij to be both symbols Y and Z.
  • 19. 19 Starts Right  The Boolean Function needs to assert that the first ID is the correct one with w = a1…an as input. 1. X00 = q0. 2. X0i = ai for i = 1,…, n. 3. X0i = B (blank) for i = n+1,…, p(n).  Formula is the AND of y0iZ for all i, where Z is the symbol in position i.
  • 20. 20 Finishes Right Somewhere, there must be an accepting state. Form the OR of Boolean variables yijq, where i and j are arbitrary and q is an accepting state. Note: differs from text.
  • 21. 21 Running Time So Far Unique requires O(p2(n)) symbols be written.  Parentheses, signs, propositional variables. Algorithm is easy, so it takes no more time than O(p2(n)). Starts Right takes O(p(n)) time. Finishes Right takes O(p2(n)) time. Variation over i and j Variation over symbols Y and Z is independent of n, so covered by constant.
  • 22. 22 Running Time – (2) Caveat: Technically, the propositions that are output of the transducer must be coded in a fixed alphabet, e.g., x10011 rather than yijA. Thus, the time and output length have an additional factor O(log n) because there are O(p2(n)) variables. But log factors do not affect polynomials
  • 23. 23 Moves Right Xij = Xi-1,j whenever the state is none of Xi-1,j-1, Xi-1,j, or Xi-1,j+1. For each i and j, construct a formula that says (in propositional variables) the OR of “Xij = Xi-1,j” and all yi-1,k,A where A is a state symbol (k = i-1, i, or i+1).  Note: Xij = Xi-1,j is the OR of yijA.yi-1,jA for all symbols A. Works because Unique assures only one yijX true.
  • 24. 24 Constraining the Next Symbol … A B C … B Easy case; must be B … A q C … ? ? ? Hard case; all three may depend on the move of M
  • 25. 25 Moves Right – (2)  In the case where the state is nearby, we need to write an expression that: 1. Picks one of the possible moves of the NTM M. 2. Enforces the condition that when Xi-1,j is the state, the values of Xi,j-1, Xi,j, and Xi,j+1. are related to Xi-1,j-1, Xi-1,j, and Xi-1,j+1 in a way that reflects the move.
  • 26. 26 Example: Moves Right Suppose δ(q, A) contains (p, B, L). Then one option for any i, j, and C is: C q A p C B If δ(q, A) contains (p, B, R), then an option for any i, j, and C is: C q A C B p
  • 27. 27 Moves Right – (3) For each possible move, express the constraints on the six X’s by a Boolean formula. For each i and j, take the OR over all possible moves. Take the AND over all i and j. Small point: for edges (e.g., state at 0), assume invisible symbols are blank.
  • 28. 28 Running Time We have to generate O(p2(n)) Boolean formulas, but each is constructed from the moves of the NTM M, which is fixed in size, independent of the input w. Takes time O(p2(n)) and generates an output of that length.  Times log n, because variables must be coded in a fixed alphabet.
  • 29. 29 Cook’s Theorem – Finale In time O(p2(n) log n) the transducer produces a boolean formula, the AND of the four components: Unique, Starts, Finishes, and Moves Right. If M accepts w, the ID sequence gives us a satisfying truth assignment. If satisfiable, the truth values tell us an accepting computation of M.
  • 30. 30 Picture So Far We have one NP-complete problem: SAT. In the future, we shall do polytime reductions of SAT to other problems, thereby showing them NP-complete. Why? If we polytime reduce SAT to X, and X is in P, then so is SAT, and therefore so is all of NP.
  • 31. 31 Conjunctive Normal Form A Boolean formula is in Conjunctive Normal Form (CNF) if it is the AND of clauses. Each clause is the OR of literals. A literal is either a variable or the negation of a variable. Problem CSAT : is a Boolean formula in CNF satisfiable?
  • 32. 32 Example: CNF (x + -y + z)(-x)(-w + -x + y + z) (…
  • 33. 33 NP-Completeness of CSAT The proof of Cook’s theorem can be modified to produce a formula in CNF. Unique is already the AND of clauses. Starts Right is the AND of clauses, each with one variable. Finishes Right is the OR of variables, i.e., a single clause.
  • 34. 34 NP-Completeness of CSAT – (2) Only Moves Right is a problem, and not much of a problem. It is the product of formulas for each i and j. Those formulas are fixed, independent of n.
  • 35. 35 NP-Completeness of CSAT – (3) You can convert any formula to CNF. It may exponentiate the size of the formula and therefore take time to write down that is exponential in the size of the original formula, but these numbers are all fixed for a given NTM M and independent of n.
  • 36. 36 k-SAT If a boolean formula is in CNF and every clause consists of exactly k literals, we say the boolean formula is an instance of k-SAT.  Say the formula is in k-CNF. Example: 3-SAT formula (x + y + z)(x + -y + z)(x + y + -z)(x + -y + -z)
  • 37. 37 k-SAT Facts Every boolean formula has an equivalent CNF formula.  But the size of the CNF formula may be exponential in the size of the original. Not every boolean formula has a k-SAT equivalent. 2SAT is in P; 3SAT is NP-complete.
  • 38. 38 Proof: 2SAT is in P (Sketch) Pick an assignment for some variable, say x = true. Any clause with –x forces the other literal to be true.  Example: (-x + -y) forces y to be false. Keep seeing what other truth values are forced by variables with known truth values.
  • 39. 39 Proof – (2)  One of three things can happen: 1. You reach a contradiction (e.g., z is forced to be both true and false). 2. You reach a point where no more variables have their truth value forced, but some clauses are not yet made true. 3. You reach a satisfying truth assignment.
  • 40. 40 Proof – (3) Case 1: (Contradiction) There can only be a satisfying assignment if you use the other truth value for x.  Simplify the formula by replacing x by this truth value and repeat the process. Case 3: You found a satisfying assignment, so answer “yes.”
  • 41. 41 Proof – (4) Case 2: (You force values for some variables, but other variables and clauses are not affected).  Adopt these truth values, eliminate the clauses that they satisfy, and repeat. In Cases 1 and 2 you have spent O(n2) time and have reduced the length of the formula by > 1, so O(n3) total.
  • 42. 42 3SAT This problem is NP-complete. Clearly it is in NP, since SAT is. It is not true that every Boolean formula can be converted to an equivalent 3-CNF formula, even if we exponentiate the size of the formula.
  • 43. 43 3SAT – (2) But we don’t need equivalence. We need to reduce every CNF formula F to some 3-CNF formula that is satisfiable if and only if F is. Reduction involves introducing new variables into long clauses, so we can split them apart.
  • 44. 44 Reduction of CSAT to 3SAT Let (x1+…+xn) be a clause in some CSAT instance, with n > 4.  Note: the x’s are literals, not variables; any of them could be negated variables. Introduce new variables y1,…,yn-3 that appear in no other clause.
  • 45. 45 CSAT to 3SAT – (2) Replace (x1+…+xn) by (x1+x2+y1)(x3+y2+ -y1) … (xi+yi-1+ -yi-2) … (xn-2+yn-3+ -yn-4)(xn-1+xn+ -yn-3) If there is a satisfying assignment of the x’s for the CSAT instance, then one of the literals xi must be made true. Assign yj = true if j < i-1 and yj = false for larger j.
  • 46. 46 CSAT to 3SAT – (3) We are not done. We also need to show that if the resulting 3SAT instance is satisfiable, then the original CSAT instance was satisfiable.
  • 47. 47 CSAT to 3SAT – (4) Suppose (x1+x2+y1)(x3+y2+ -y1) … (xn-2+yn-3+ -yn-4)(xn-1+xn+ -yn-3) is satisfiable, but none of the x’s is true. The first clause forces y1 = true. Then the second clause forces y2 = true. And so on … all the y’s must be true. But then the last clause is false.
  • 48. 48 CSAT to 3SAT – (5) There is a little more to the reduction, for handling clauses of 1 or 2 literals. Replace (x) by (x+y1+y2) (x+y1+ -y2) (x+ -y1+y2) (x+ -y1+ -y2). Replace (w+x) by (w+x+y)(w+x+ -y). Remember: the y’s are different variables for each CNF clause.
  • 49. 49 CSAT to 3SAT Running Time This reduction is surely polynomial. In fact it is linear in the length of the CSAT instance. Thus, we have polytime-reduced CSAT to 3SAT. Since CSAT is NP-complete, so is 3SAT.