SlideShare a Scribd company logo
Lecture 20:
         Satisfiability
         Steven Skiena

Department of Computer Science
 State University of New York
 Stony Brook, NY 11794–4400

http://www.cs.sunysb.edu/∼skiena
Problem of the Day
Suppose we are given a subroutine which can solve the
traveling salesman decision problem in, say, linear time. Give
an efficient algorithm to find the actual TSP tour by making a
polynomial number of calls to this subroutine.
The Main Idea
Suppose I gave you the following algorithm to solve the
bandersnatch problem:
Bandersnatch(G)
     Convert G to an instance of the Bo-billy problem Y .
     Call the subroutine Bo-billy on Y to solve this instance.
     Return the answer of Bo-billy(Y ) as the answer to G.
Such a translation from instances of one type of problem to
instances of another type such that answers are preserved is
called a reduction.
What Does this Imply?
Now suppose my reduction translates G to Y in O(P (n)):
1. If my Bo-billy subroutine ran in O(P (n)) I can solve the
   Bandersnatch problem in O(P (n) + P (n ))
2. If I know that Ω(P (n)) is a lower-bound to compute
   Bandersnatch, then Ω(P (n) − P (n )) must be a lower-
   bound to compute Bo-billy.
The second argument is the idea we use to prove problems
hard!
Satisfiability
Consider the following logic problem:
Instance: A set V of variables and a set of clauses C over V .
Question: Does there exist a satisfying truth assignment for
C?
Example 1: V = v1, v2 and C = {{v1, v2 }, {v1 , v2}}
A clause is satisfied when at least one literal in it is TRUE. C
is satisfied when v1 = v2 =TRUE.
Not Satisfiable
Example 2: V = v1, v2,
               C = {{v1, v2}, {v1, v 2}, {v 1}}
Although you try, and you try, and you try and you try, you
can get no satisfaction.
There is no satisfying assigment since v1 must be FALSE
(third clause), so v2 must be FALSE (second clause), but then
the first clause is unsatisfiable!
Satisfiability is Hard
Satisfiability is known/assumed to be a hard problem.
Every top-notch algorithm expert in the world has tried and
failed to come up with a fast algorithm to test whether a given
set of clauses is satisfiable.
Further, many strange and impossible-to-believe things have
been shown to be true if someone in fact did find a fast
satisfiability algorithm.
3-Satisfiability
Instance: A collection of clause C where each clause contains
exactly 3 literals, boolean variable v.
Question: Is there a truth assignment to v so that each clause
is satisfied?
Note that this is a more restricted problem than SAT. If 3-SAT
is NP-complete, it implies SAT is NP-complete but not visa-
versa, perhaps long clauses are what makes SAT difficult?!
After all, 1-Sat is trivial!
3-SAT is NP-Complete
To prove it is complete, we give a reduction from
Sat ∝ 3 − Sat. We will transform each clause independantly
based on its length.
Suppose the clause Ci contains k literals.
 • If k = 1, meaning Ci = {z1 }, create two new variables
   v1, v2 and four new 3-literal clauses:
   {v1, v2, z1}, {v1, v 2, z1 }, {v 1, v2, z1}, {v 1, v 2, z1 }.
   Note that the only way all four of these can be satisfied is
   if z is TRUE.
• If k = 2, meaning {z1, z2}, create one new variable v1 and
  two new clauses: {v1, z1, z2}, {v1 , z1, z2}
• If k = 3, meaning {z1 , z2, z3}, copy into the 3-SAT
  instance as it is.
• If k > 3, meaning {z1, z2, ..., zn}, create n − 3 new
  variables and n − 2 new clauses in a chain: {vi, zi, vi},
  ...
Why does the Chain Work?
If none of the original variables in a clause are TRUE, there
is no way to satisfy all of them using the additional variable:

                (F, F, T ), (F, F, T ), . . . , (F, F, F )
But if any literal is TRUE, we have n − 3 free variables and
n − 3 remaining 3-clauses, so we can satisfy each of them.
(F, F, T ), (F, F, T ), . . . , (F, T, F), . . . , (T, F, F ), (T, F, F )
Any SAT solution will also satisfy the 3-SAT instance and
any 3-SAT solution sets variables giving a SAT solution, so
the problems are equivallent.
4-Sat and 2-Sat
A slight modification to this construction would prove 4-SAT,
or 5-SAT,... also NP-complete.
However, it breaks down when we try to use it for 2-SAT,
since there is no way to stuff anything into the chain of
clauses.
Now that we have shown 3-SAT is NP-complete, we may use
it for further reductions. Since the set of 3-SAT instances
is smaller and more regular than the SAT instances, it will
be easier to use 3-SAT for future reductions. Remember the
direction to reduction!
                   Sat ∝ 3 − Sat ∝ X
A Perpetual Point of Confusion
Note carefully the direction of the reduction.
We must transform every instance of a known NP-complete
problem to an instance of the problem we are interested in. If
we do the reduction the other way, all we get is a slow way
to solve x, by using a subroutine which probably will take
exponential time.
This always is confusing at first - it seems bass-ackwards.
Make sure you understand the direction of reduction now -
and think back to this when you get confused.
Vertex Cover
Instance: A graph G = (V, E), and integer k ≤ V
Question: Is there a subset of at most k vertices such that
every e ∈ E has at least one vertex in the subset?




Here, four of the eight vertices suffice to cover.
It is trivial to find a vertex cover of a graph – just take all
the vertices. The tricky part is to cover with as small a set as
possible.
Vertex cover is NP-complete
To prove completeness, we show reduce 3-SAT to VC. From
a 3-SAT instance with n variables and C clauses, we construct
a graph with 2N + 3C vertices.
For each variable, we create two vertices connected by an
edge:
                                                 ......
                   v1   v1   v2   v2   v3   v3            vn   vn




To cover each of these edges, at least n vertices must be in
the cover, one for each pair.
Clause Gadgets
For each clause, we create three new vertices, one for each
literal in each clause. Connect these in a triangle.
At least two vertices per triangle must be in the cover to take
care of edges in the triangle, for a total of at least 2C vertices.
Finally, we will connect each literal in the flat structure to the
corresponding vertices in the triangles which share the same
literal.
                   v1        v1   v2        v2   v3        v3   v4        v4



                             v3                                 v2




                        v1             v4             v1             v4
Claim: G has a vertex cover of size N + 2C iff S
is Satisfiable
Any cover of G must have at least N + 2C vertices. To show
that our reduction is correct, we must show that:
1. Every satisfying truth assignment gives a cover.
   Select the N vertices cooresponding to the TRUE literals
   to be in the cover. Since it is a satisfying truth assignment,
   at least one of the three cross edges associated with each
   clause must already be covered - pick the other two
   vertices to complete the cover.
2. Every vertex cover gives a satisfying truth assignment.
   Every vertex cover must contain n first stage vertices and
   2C second stage vertices. Let the first stage vertices define
   the truth assignment.
   To give the cover, at least one cross-edge must be covered,
   so the truth assignment satisfies.
Example Reduction
Every SAT defines a cover and Every Cover Truth values for
the SAT!
Example: V1 = V2 = T rue, V3 = V4 = F alse.
            v1        v1    v2    v2   v3        v3   v4        v4



                       v3                             v2




                 v1              v4         v1             v4
Starting from the Right Problem
As you can see, the reductions can be very clever and very
complicated. While theoretically any N P -complete problem
can be reduced to any other one, choosing the correct one
makes finding a reduction much easier.
                     3 − Sat ∝ V C
As you can see, the reductions can be very clever and
complicated. While theoretically any NP-complete problem
will do, choosing the correct one can make it much easier.
Maximum Clique
Instance: A graph G = (V, E) and integer j ≤ v.
Question: Does the graph contain a clique of j vertices, ie. is
there a subset of v of size j such that every pair of vertices in
the subset defines an edge of G?
Example: this graph contains a clique of size 5.
Clique is NP-complete
When talking about graph problems, it is most natural to work
from a graph problem - the only NP-complete one we have is
vertex cover!
If you take a graph and find its vertex cover, the remaining
vertices form an independent set, meaning there are no edges
between any two vertices in the independent set, for if there
were such an edge the rest of the vertices could not be a vertex
cover.
vertex in cover

                            vertex in independant
                            set


Clearly the smallest vertex cover gives the biggest indepen-
dent set, and so the problems are equivallent – Delete the
subset of vertices in one from the total set of vertices to get
the order!
Thus finding the maximum independent set must be NP-
complete!
From Independent Set
In an independent set, there are no edges between two
vertices. In a clique, there are always between two vertices.
Thus if we complement a graph (have an edge iff there was no
edge in the original graph), a clique becomes an independent
set and an independent set becomes a Clique!



                 Max Clique = 5    Max Clique = 2
                 Max IS = 2        Max IS = 5
Punch Line
Thus finding the largest clique is NP-complete:
If V C is a vertex cover in G, then V − V C is a clique in G .
If C is a clique in G, V − C is a vertex cover in G .

More Related Content

What's hot

Physics Assignment Help
Physics Assignment Help Physics Assignment Help
Physics Assignment Help
Edu Assignment Help
 
Bidimensionality
BidimensionalityBidimensionality
BidimensionalityASPAK2014
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Iterative Compression
Iterative CompressionIterative Compression
Iterative CompressionASPAK2014
 
19 Minimum Spanning Trees
19 Minimum Spanning Trees19 Minimum Spanning Trees
19 Minimum Spanning Trees
Andres Mendez-Vazquez
 
Treewidth and Applications
Treewidth and ApplicationsTreewidth and Applications
Treewidth and ApplicationsASPAK2014
 
Per4 induction
Per4 inductionPer4 induction
Per4 induction
Evert Sandye Taasiringan
 
Mathematical induction
Mathematical inductionMathematical induction
Mathematical inductionSman Abbasi
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
Ki2518101816
Ki2518101816Ki2518101816
Ki2518101816
IJERA Editor
 
Solve Equations
Solve EquationsSolve Equations
Solve Equations
nikos mantzakouras
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms IiSri Prasanna
 
11X1 T14 09 mathematical induction 2 (2010)
11X1 T14 09 mathematical induction 2 (2010)11X1 T14 09 mathematical induction 2 (2010)
11X1 T14 09 mathematical induction 2 (2010)Nigel Simmons
 
Mathematical Induction
Mathematical InductionMathematical Induction
Mathematical InductionEdelyn Cagas
 
Mathematical induction and divisibility rules
Mathematical induction and divisibility rulesMathematical induction and divisibility rules
Mathematical induction and divisibility rules
Dawood Faheem Abbasi
 
Paths and Polynomials
Paths and PolynomialsPaths and Polynomials
Paths and PolynomialsASPAK2014
 
Principle of mathematical induction
Principle of mathematical inductionPrinciple of mathematical induction
Principle of mathematical induction
Kriti Varshney
 

What's hot (18)

Physics Assignment Help
Physics Assignment Help Physics Assignment Help
Physics Assignment Help
 
Bidimensionality
BidimensionalityBidimensionality
Bidimensionality
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Iterative Compression
Iterative CompressionIterative Compression
Iterative Compression
 
19 Minimum Spanning Trees
19 Minimum Spanning Trees19 Minimum Spanning Trees
19 Minimum Spanning Trees
 
Treewidth and Applications
Treewidth and ApplicationsTreewidth and Applications
Treewidth and Applications
 
Per4 induction
Per4 inductionPer4 induction
Per4 induction
 
Mathematical induction
Mathematical inductionMathematical induction
Mathematical induction
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Ki2518101816
Ki2518101816Ki2518101816
Ki2518101816
 
Solve Equations
Solve EquationsSolve Equations
Solve Equations
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
 
11X1 T14 09 mathematical induction 2 (2010)
11X1 T14 09 mathematical induction 2 (2010)11X1 T14 09 mathematical induction 2 (2010)
11X1 T14 09 mathematical induction 2 (2010)
 
Mathematical Induction
Mathematical InductionMathematical Induction
Mathematical Induction
 
Sol80
Sol80Sol80
Sol80
 
Mathematical induction and divisibility rules
Mathematical induction and divisibility rulesMathematical induction and divisibility rules
Mathematical induction and divisibility rules
 
Paths and Polynomials
Paths and PolynomialsPaths and Polynomials
Paths and Polynomials
 
Principle of mathematical induction
Principle of mathematical inductionPrinciple of mathematical induction
Principle of mathematical induction
 

Similar to Skiena algorithm 2007 lecture20 satisfiability

Skiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionSkiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionzukun
 
Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2
Techglyphs
 
Algorithm_NP-Completeness Proof
Algorithm_NP-Completeness ProofAlgorithm_NP-Completeness Proof
Algorithm_NP-Completeness Proof
Im Rafid
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam Help
Statistics Exam Help
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
Statistics 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
S.Shayan Daneshvar
 
Design and analysis of algorithms unit 6 non deterministic polynomial
Design and analysis of algorithms unit 6 non deterministic polynomialDesign and analysis of algorithms unit 6 non deterministic polynomial
Design and analysis of algorithms unit 6 non deterministic polynomial
nowicam882
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
Excel Homework Help
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
Statistics Homework Helper
 
Kernelization Basics
Kernelization BasicsKernelization Basics
Kernelization BasicsASPAK2014
 
Backtracking
BacktrackingBacktracking
Backtracking
Sally Salem
 
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
 
Algebraic techniques in combinatorics
Algebraic techniques in combinatoricsAlgebraic techniques in combinatorics
Algebraic techniques in combinatorics
Vui Lên Bạn Nhé
 
The Max Cut Problem
The Max Cut ProblemThe Max Cut Problem
The Max Cut Problem
dnatapov
 
Algorithm Design and Complexity - Course 6
Algorithm Design and Complexity - Course 6Algorithm Design and Complexity - Course 6
Algorithm Design and Complexity - Course 6Traian Rebedea
 
Complex Variables Assignment Help
Complex Variables Assignment HelpComplex Variables Assignment Help
Complex Variables Assignment Help
Maths Assignment Help
 
Complex Variables Assignment Help
Complex Variables Assignment HelpComplex Variables Assignment Help
Complex Variables Assignment Help
Math Homework Solver
 

Similar to Skiena algorithm 2007 lecture20 satisfiability (20)

Approx
ApproxApprox
Approx
 
Skiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionSkiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reduction
 
Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2
 
Algorithm_NP-Completeness Proof
Algorithm_NP-Completeness ProofAlgorithm_NP-Completeness Proof
Algorithm_NP-Completeness Proof
 
Lecture26
Lecture26Lecture26
Lecture26
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam Help
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process 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
 
Design and analysis of algorithms unit 6 non deterministic polynomial
Design and analysis of algorithms unit 6 non deterministic polynomialDesign and analysis of algorithms unit 6 non deterministic polynomial
Design and analysis of algorithms unit 6 non deterministic polynomial
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
 
Kernelization Basics
Kernelization BasicsKernelization Basics
Kernelization Basics
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Lecture3
Lecture3Lecture3
Lecture3
 
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...
 
Algebraic techniques in combinatorics
Algebraic techniques in combinatoricsAlgebraic techniques in combinatorics
Algebraic techniques in combinatorics
 
The Max Cut Problem
The Max Cut ProblemThe Max Cut Problem
The Max Cut Problem
 
Algorithm Design and Complexity - Course 6
Algorithm Design and Complexity - Course 6Algorithm Design and Complexity - Course 6
Algorithm Design and Complexity - Course 6
 
Complex Variables Assignment Help
Complex Variables Assignment HelpComplex Variables Assignment Help
Complex Variables Assignment Help
 
Complex Variables Assignment Help
Complex Variables Assignment HelpComplex Variables Assignment Help
Complex Variables Assignment Help
 

More from zukun

My lyn tutorial 2009
My lyn tutorial 2009My lyn tutorial 2009
My lyn tutorial 2009zukun
 
ETHZ CV2012: Tutorial openCV
ETHZ CV2012: Tutorial openCVETHZ CV2012: Tutorial openCV
ETHZ CV2012: Tutorial openCVzukun
 
ETHZ CV2012: Information
ETHZ CV2012: InformationETHZ CV2012: Information
ETHZ CV2012: Informationzukun
 
Siwei lyu: natural image statistics
Siwei lyu: natural image statisticsSiwei lyu: natural image statistics
Siwei lyu: natural image statisticszukun
 
Lecture9 camera calibration
Lecture9 camera calibrationLecture9 camera calibration
Lecture9 camera calibrationzukun
 
Brunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer visionBrunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer visionzukun
 
Modern features-part-4-evaluation
Modern features-part-4-evaluationModern features-part-4-evaluation
Modern features-part-4-evaluationzukun
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-softwarezukun
 
Modern features-part-2-descriptors
Modern features-part-2-descriptorsModern features-part-2-descriptors
Modern features-part-2-descriptorszukun
 
Modern features-part-1-detectors
Modern features-part-1-detectorsModern features-part-1-detectors
Modern features-part-1-detectorszukun
 
Modern features-part-0-intro
Modern features-part-0-introModern features-part-0-intro
Modern features-part-0-introzukun
 
Lecture 02 internet video search
Lecture 02 internet video searchLecture 02 internet video search
Lecture 02 internet video searchzukun
 
Lecture 01 internet video search
Lecture 01 internet video searchLecture 01 internet video search
Lecture 01 internet video searchzukun
 
Lecture 03 internet video search
Lecture 03 internet video searchLecture 03 internet video search
Lecture 03 internet video searchzukun
 
Icml2012 tutorial representation_learning
Icml2012 tutorial representation_learningIcml2012 tutorial representation_learning
Icml2012 tutorial representation_learningzukun
 
Advances in discrete energy minimisation for computer vision
Advances in discrete energy minimisation for computer visionAdvances in discrete energy minimisation for computer vision
Advances in discrete energy minimisation for computer visionzukun
 
Gephi tutorial: quick start
Gephi tutorial: quick startGephi tutorial: quick start
Gephi tutorial: quick startzukun
 
EM algorithm and its application in probabilistic latent semantic analysis
EM algorithm and its application in probabilistic latent semantic analysisEM algorithm and its application in probabilistic latent semantic analysis
EM algorithm and its application in probabilistic latent semantic analysiszukun
 
Object recognition with pictorial structures
Object recognition with pictorial structuresObject recognition with pictorial structures
Object recognition with pictorial structureszukun
 
Iccv2011 learning spatiotemporal graphs of human activities
Iccv2011 learning spatiotemporal graphs of human activities Iccv2011 learning spatiotemporal graphs of human activities
Iccv2011 learning spatiotemporal graphs of human activities zukun
 

More from zukun (20)

My lyn tutorial 2009
My lyn tutorial 2009My lyn tutorial 2009
My lyn tutorial 2009
 
ETHZ CV2012: Tutorial openCV
ETHZ CV2012: Tutorial openCVETHZ CV2012: Tutorial openCV
ETHZ CV2012: Tutorial openCV
 
ETHZ CV2012: Information
ETHZ CV2012: InformationETHZ CV2012: Information
ETHZ CV2012: Information
 
Siwei lyu: natural image statistics
Siwei lyu: natural image statisticsSiwei lyu: natural image statistics
Siwei lyu: natural image statistics
 
Lecture9 camera calibration
Lecture9 camera calibrationLecture9 camera calibration
Lecture9 camera calibration
 
Brunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer visionBrunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer vision
 
Modern features-part-4-evaluation
Modern features-part-4-evaluationModern features-part-4-evaluation
Modern features-part-4-evaluation
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-software
 
Modern features-part-2-descriptors
Modern features-part-2-descriptorsModern features-part-2-descriptors
Modern features-part-2-descriptors
 
Modern features-part-1-detectors
Modern features-part-1-detectorsModern features-part-1-detectors
Modern features-part-1-detectors
 
Modern features-part-0-intro
Modern features-part-0-introModern features-part-0-intro
Modern features-part-0-intro
 
Lecture 02 internet video search
Lecture 02 internet video searchLecture 02 internet video search
Lecture 02 internet video search
 
Lecture 01 internet video search
Lecture 01 internet video searchLecture 01 internet video search
Lecture 01 internet video search
 
Lecture 03 internet video search
Lecture 03 internet video searchLecture 03 internet video search
Lecture 03 internet video search
 
Icml2012 tutorial representation_learning
Icml2012 tutorial representation_learningIcml2012 tutorial representation_learning
Icml2012 tutorial representation_learning
 
Advances in discrete energy minimisation for computer vision
Advances in discrete energy minimisation for computer visionAdvances in discrete energy minimisation for computer vision
Advances in discrete energy minimisation for computer vision
 
Gephi tutorial: quick start
Gephi tutorial: quick startGephi tutorial: quick start
Gephi tutorial: quick start
 
EM algorithm and its application in probabilistic latent semantic analysis
EM algorithm and its application in probabilistic latent semantic analysisEM algorithm and its application in probabilistic latent semantic analysis
EM algorithm and its application in probabilistic latent semantic analysis
 
Object recognition with pictorial structures
Object recognition with pictorial structuresObject recognition with pictorial structures
Object recognition with pictorial structures
 
Iccv2011 learning spatiotemporal graphs of human activities
Iccv2011 learning spatiotemporal graphs of human activities Iccv2011 learning spatiotemporal graphs of human activities
Iccv2011 learning spatiotemporal graphs of human activities
 

Recently uploaded

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 

Recently uploaded (20)

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 

Skiena algorithm 2007 lecture20 satisfiability

  • 1. Lecture 20: Satisfiability Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794–4400 http://www.cs.sunysb.edu/∼skiena
  • 2. Problem of the Day Suppose we are given a subroutine which can solve the traveling salesman decision problem in, say, linear time. Give an efficient algorithm to find the actual TSP tour by making a polynomial number of calls to this subroutine.
  • 3. The Main Idea Suppose I gave you the following algorithm to solve the bandersnatch problem: Bandersnatch(G) Convert G to an instance of the Bo-billy problem Y . Call the subroutine Bo-billy on Y to solve this instance. Return the answer of Bo-billy(Y ) as the answer to G. Such a translation from instances of one type of problem to instances of another type such that answers are preserved is called a reduction.
  • 4. What Does this Imply? Now suppose my reduction translates G to Y in O(P (n)): 1. If my Bo-billy subroutine ran in O(P (n)) I can solve the Bandersnatch problem in O(P (n) + P (n )) 2. If I know that Ω(P (n)) is a lower-bound to compute Bandersnatch, then Ω(P (n) − P (n )) must be a lower- bound to compute Bo-billy. The second argument is the idea we use to prove problems hard!
  • 5. Satisfiability Consider the following logic problem: Instance: A set V of variables and a set of clauses C over V . Question: Does there exist a satisfying truth assignment for C? Example 1: V = v1, v2 and C = {{v1, v2 }, {v1 , v2}} A clause is satisfied when at least one literal in it is TRUE. C is satisfied when v1 = v2 =TRUE.
  • 6. Not Satisfiable Example 2: V = v1, v2, C = {{v1, v2}, {v1, v 2}, {v 1}} Although you try, and you try, and you try and you try, you can get no satisfaction. There is no satisfying assigment since v1 must be FALSE (third clause), so v2 must be FALSE (second clause), but then the first clause is unsatisfiable!
  • 7. Satisfiability is Hard Satisfiability is known/assumed to be a hard problem. Every top-notch algorithm expert in the world has tried and failed to come up with a fast algorithm to test whether a given set of clauses is satisfiable. Further, many strange and impossible-to-believe things have been shown to be true if someone in fact did find a fast satisfiability algorithm.
  • 8. 3-Satisfiability Instance: A collection of clause C where each clause contains exactly 3 literals, boolean variable v. Question: Is there a truth assignment to v so that each clause is satisfied? Note that this is a more restricted problem than SAT. If 3-SAT is NP-complete, it implies SAT is NP-complete but not visa- versa, perhaps long clauses are what makes SAT difficult?! After all, 1-Sat is trivial!
  • 9. 3-SAT is NP-Complete To prove it is complete, we give a reduction from Sat ∝ 3 − Sat. We will transform each clause independantly based on its length. Suppose the clause Ci contains k literals. • If k = 1, meaning Ci = {z1 }, create two new variables v1, v2 and four new 3-literal clauses: {v1, v2, z1}, {v1, v 2, z1 }, {v 1, v2, z1}, {v 1, v 2, z1 }. Note that the only way all four of these can be satisfied is if z is TRUE.
  • 10. • If k = 2, meaning {z1, z2}, create one new variable v1 and two new clauses: {v1, z1, z2}, {v1 , z1, z2} • If k = 3, meaning {z1 , z2, z3}, copy into the 3-SAT instance as it is. • If k > 3, meaning {z1, z2, ..., zn}, create n − 3 new variables and n − 2 new clauses in a chain: {vi, zi, vi}, ...
  • 11. Why does the Chain Work? If none of the original variables in a clause are TRUE, there is no way to satisfy all of them using the additional variable: (F, F, T ), (F, F, T ), . . . , (F, F, F ) But if any literal is TRUE, we have n − 3 free variables and n − 3 remaining 3-clauses, so we can satisfy each of them. (F, F, T ), (F, F, T ), . . . , (F, T, F), . . . , (T, F, F ), (T, F, F ) Any SAT solution will also satisfy the 3-SAT instance and any 3-SAT solution sets variables giving a SAT solution, so the problems are equivallent.
  • 12. 4-Sat and 2-Sat A slight modification to this construction would prove 4-SAT, or 5-SAT,... also NP-complete. However, it breaks down when we try to use it for 2-SAT, since there is no way to stuff anything into the chain of clauses. Now that we have shown 3-SAT is NP-complete, we may use it for further reductions. Since the set of 3-SAT instances is smaller and more regular than the SAT instances, it will be easier to use 3-SAT for future reductions. Remember the direction to reduction! Sat ∝ 3 − Sat ∝ X
  • 13. A Perpetual Point of Confusion Note carefully the direction of the reduction. We must transform every instance of a known NP-complete problem to an instance of the problem we are interested in. If we do the reduction the other way, all we get is a slow way to solve x, by using a subroutine which probably will take exponential time. This always is confusing at first - it seems bass-ackwards. Make sure you understand the direction of reduction now - and think back to this when you get confused.
  • 14. Vertex Cover Instance: A graph G = (V, E), and integer k ≤ V Question: Is there a subset of at most k vertices such that every e ∈ E has at least one vertex in the subset? Here, four of the eight vertices suffice to cover. It is trivial to find a vertex cover of a graph – just take all the vertices. The tricky part is to cover with as small a set as possible.
  • 15. Vertex cover is NP-complete To prove completeness, we show reduce 3-SAT to VC. From a 3-SAT instance with n variables and C clauses, we construct a graph with 2N + 3C vertices. For each variable, we create two vertices connected by an edge: ...... v1 v1 v2 v2 v3 v3 vn vn To cover each of these edges, at least n vertices must be in the cover, one for each pair.
  • 16. Clause Gadgets For each clause, we create three new vertices, one for each literal in each clause. Connect these in a triangle. At least two vertices per triangle must be in the cover to take care of edges in the triangle, for a total of at least 2C vertices. Finally, we will connect each literal in the flat structure to the corresponding vertices in the triangles which share the same literal. v1 v1 v2 v2 v3 v3 v4 v4 v3 v2 v1 v4 v1 v4
  • 17. Claim: G has a vertex cover of size N + 2C iff S is Satisfiable Any cover of G must have at least N + 2C vertices. To show that our reduction is correct, we must show that: 1. Every satisfying truth assignment gives a cover. Select the N vertices cooresponding to the TRUE literals to be in the cover. Since it is a satisfying truth assignment, at least one of the three cross edges associated with each clause must already be covered - pick the other two vertices to complete the cover.
  • 18. 2. Every vertex cover gives a satisfying truth assignment. Every vertex cover must contain n first stage vertices and 2C second stage vertices. Let the first stage vertices define the truth assignment. To give the cover, at least one cross-edge must be covered, so the truth assignment satisfies.
  • 19. Example Reduction Every SAT defines a cover and Every Cover Truth values for the SAT! Example: V1 = V2 = T rue, V3 = V4 = F alse. v1 v1 v2 v2 v3 v3 v4 v4 v3 v2 v1 v4 v1 v4
  • 20. Starting from the Right Problem As you can see, the reductions can be very clever and very complicated. While theoretically any N P -complete problem can be reduced to any other one, choosing the correct one makes finding a reduction much easier. 3 − Sat ∝ V C As you can see, the reductions can be very clever and complicated. While theoretically any NP-complete problem will do, choosing the correct one can make it much easier.
  • 21. Maximum Clique Instance: A graph G = (V, E) and integer j ≤ v. Question: Does the graph contain a clique of j vertices, ie. is there a subset of v of size j such that every pair of vertices in the subset defines an edge of G? Example: this graph contains a clique of size 5.
  • 22. Clique is NP-complete When talking about graph problems, it is most natural to work from a graph problem - the only NP-complete one we have is vertex cover! If you take a graph and find its vertex cover, the remaining vertices form an independent set, meaning there are no edges between any two vertices in the independent set, for if there were such an edge the rest of the vertices could not be a vertex cover.
  • 23. vertex in cover vertex in independant set Clearly the smallest vertex cover gives the biggest indepen- dent set, and so the problems are equivallent – Delete the subset of vertices in one from the total set of vertices to get the order! Thus finding the maximum independent set must be NP- complete!
  • 24. From Independent Set In an independent set, there are no edges between two vertices. In a clique, there are always between two vertices. Thus if we complement a graph (have an edge iff there was no edge in the original graph), a clique becomes an independent set and an independent set becomes a Clique! Max Clique = 5 Max Clique = 2 Max IS = 2 Max IS = 5
  • 25. Punch Line Thus finding the largest clique is NP-complete: If V C is a vertex cover in G, then V − V C is a clique in G . If C is a clique in G, V − C is a vertex cover in G .