Nazarie_Chapter 7.pdf

Theory of Languages
and Automata
Chapter 7- Time Complexity
Sharif University of Technology
Time Complexity
Big-O Notation
Small-o Notation
Time Complexity Class
Complexity Relationships
Measuring Nondeterministic
Time
Measuring Deterministic and
Nondeterministic Time
Complexity Relationships
(Cont.)
The Class P
The PATH Problem
The PATH Problem (Cont.)
Proof
Relatively Prime Problem
Proof
Context-Free Languages
Polynomial Time Verifiers
The NP Class
Nondeterministic Polynomial
Time Turing Machines
Proof
Nondeterministic Time
Complexity
The Class NP (Cont.)
Clique
O A clique in an undirected graph is a subgraph,
wherein every two nodes are connected by an edge.
A k-clique is a clique that contains k nodes.
A graph with a 5-clique
The Clique Problem
The clique problem is to determine whether a graph contains
a clique of a specified size. Let
CLIQUE ={<G, k>|G is an undirected graph with a k-clique}
O Theorem 7.24
CLIQUE is in NP
Proof
O The following is a verifier V for CLIQUE
O An alternative proof (N is a nondeterministic Turing machine)
SUBSET-SUM Problem
O Theorem 7.25
O SUBSET-SUM is in NP.
Proof
O The subset is the certificate.
O Alternative proof
The P versus NP Question
NP and EXPTIME
Boolean Formula
O A Boolean formula is an expression
involving Boolean variables and
operations.
O A Boolean formula is satisfiable if some
assignment of 0s and 1s to the variables
makes the formula evaluate to 1.
Satisfiability (SAT) Problem
O The satisfiability problem is to test whether
a Boolean formula is satisfiable.
O Let
SAT = {<φ>|φ is a satisfiable Boolean formula}
Cook-Levin Theorem
OTheorem 7.27
SAT  P iff P = NP
Polynomial Time Computable
Function
O Definition 7.28. A function f: Σ*→Σ*
is a polynomial time computable
function if some polynomial time
Turing machine M exists that halts
with just f(ω) on the tape, when started
on any input ω.
Polynomial Time Reducibility
O Definition 7.29. Language A is
polynomial time mapping reducible, to
language B, written A ≤p B, if a
polynomial time computable function
f: Σ*→Σ* exists, where for every ω,
ωA iff f(ω)B
Polynomial Time Reducibility
(Cont.)
3SAT
Theorem
Example
NP-Completeness
O Definition 7.34. A language B is NP-
complete if it satisfies two conditions:
1. B is in NP, and
2. every A in NP is polynomial time
reducible to B.
NP-Completeness (Cont.)
OTheorem 7.35. If B is NP-
complete and BP, then
P = NP.
NP-Completeness (Cont.)
OTheorem 7.36. If B is NP-
complete and B ≤p C for C in
NP, then C is NP-complete.
The Cook-Levin Theorem
OTheorem 7.37
SAT is NP-complete.
Proof Idea
Proof
Proof (Ctd.)
Proof (Ctd.)
Proof (Ctd.)
Proof (Ctd.)
Proof (Ctd.)
Proof (Ctd.)
Corollary
Corollary
The Vertex Cover Problem
Proof:
End of chapter 7 
Theory of Languages and Automata
Prof. Movaghar
55