Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution NonCommercial ShareAlike 30 Unported License ID: 652615
Download Presentation The PPT/PDF document "CSE 105 Theory of Computation" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
CSE 105Theory of Computation
Alexander TsiatasSpring 2012
Theory of Computation Lecture Slides by Alexander
Tsiatas
is licensed under a Creative Commons Attribution-
NonCommercial
-
ShareAlike
3.0
Unported
License.
Based on a work at http://peerinstruction4cs.org.
Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org.Slide2
Mapping ReductionsSome more formalities….
2Slide3
Mapping reductions:a second definition
A ≤m BSecond definition:There is a function f: Σ* -> Σ*If f(x) = y, then:y is in B if and only if x is in A.
f is computable by a TM that always haltsWe say that f maps strings in A to strings in BNote that A ≤m B also implies A ≤
m
B
3Slide4
Thm.: EQTM is not recognizable
ATM = { <M,w> | M accepts w }EQ
TM = { <M1,M2> | L(M
1
) = L(M
2
) }
f(<
M,w
>) = <M
1,M2> where:M
1
= “On any input, reject”
M2 = “On any input, run M on w. If it accepts, accept.”Which mapping reduction does this f give?ATM ≤m EQTMEQTM ≤m ATMATM ≤m EQTMEQTM ≤m ATM
4Slide5
We showed: ATM ≤m EQTM
We know: ATM is NOT co-recognizable.We showed this in a previous lecture
We showed: ATM is mapping reducible to EQTM.
We can “co-recognize” A
TM
by applying f and “co-recognizing” EQ
TM
This means: if EQ
TM
is co-recognizable, then A
TM is co-recognizable.We know A
TM
is not co-recognizable, though.
Contradiction! EQTM is NOT co-recognizable.The same as: EQTM is NOT recognizable.5Slide6
Thm.: EQTM is not co-recognizable
ATM = { <M,w> | M accepts w }EQ
TM = { <M1,M2> | L(M
1
) = L(M
2
) }
f(<
M,w
>) = <M
1,M2> where:M
1
= “Accept”
M2 = “On any input, run M on w. If it accepts, accept.”Which mapping reduction does this f give?ATM ≤m EQTMEQTM ≤m ATMATM ≤m EQTMEQTM ≤m ATM
6Slide7
We showed: ATM ≤m EQTM
We know: ATM is NOT co-recognizable.We showed this in a previous class
We showed: ATM is mapping reducible to EQTM.
We can “co-recognize” A
TM
by applying f and “co-recognizing” EQ
TM
This means: if EQ
TM
is co-recognizable, then A
TM is co-recognizable.We know A
TM
is not co-recognizable, though.
Contradiction! EQTM is NOT co-recognizable.7Slide8
So, we did TWO mapping reductions
ATM ≤m EQTMATM ≤
m EQTM
We have shown: There is a language (
EQ
TM
) that is not recognizable and also not co-recognizable!
In general: to show that a language L is NOT recognizable
Give a mapping reduction from A
TM
to L.
Pro tip
: Use A
TM as the stock “language that’s recognizable but not co-recognizable”8
x 2Slide9
Measuring Complexity of Decidable ProblemsBig-O
Review9Slide10
Review: How Big-O Simplifies Analysis
The number of transitions Turing Machine M takes when run on input w can be written as a function of n=|w| like this: f(n) = 10n3 + 200n2 + 5Which best represents a tight bound on the big-O running time of M(w)? (where n = |w|)O(n
3 + n2)O(n5
)
O(n
3
)
O(200n
2
)
10Slide11
Review: How Big-O Simplifies Analysis
The number of transitions Turing Machine M takes when run on input w can be written as a function of n=|w| like this: f(n) = 10n3 + 200n2 + 5Which are NOT a big-O running time of M(w)? (where n = |w|)O(n3
+ n2)O(n5
)
O(n
3
)
O(200n
2
)
More than one of the above
11Slide12
Measuring Complexity of Decidable ProblemsP AND NP
Complexity Classes12Slide13
Polynomial TimeA language L can be decided in
polynomial time if there exists a TM recognizing L that, on input n characters long, will accept or reject in O(nk) steps in the worst case, for some constant k
13Slide14
P and NP
P is the class of languages that can be decided in polynomial time on a deterministic, single-tape TMNP is the class of languages that can be decided in polynomial time on a
non-deterministic TMAlternate definition of NP: problems where, if somebody gives you a solution, you can check it for correctness in polynomial time on a deterministic, single-tape TM NP stands for
n
on-deterministic
p
olynomial
14Slide15
Complexity Classes:Where are P and NP?
Regular
Context-free
Decidable
Recognizable
Co-recognizableSlide16
P = NP ????????Perhaps the greatest theoretical computation question of our time
Most people suspect no, but it has never been proven…If you can prove it one way or the other, you win $1,000,000 from the Clay Institute16
Two Possible Venn DiagramsSlide17
A Clue in the P ≠/= NP Puzzle?The Class NP-Complete
Complexity Classes17Slide18
Polynomial-time Mapping ReducibilityIf A B (we can use a decider M
B for B to build a decider MA for A), and MB uses a polynomial number of steps in the worst case, then as long as the process of reducing A to B takes a polynomial number of steps…A B and B is in P means…A is in P!
18Slide19
Mapping Reducibility and NP-Completeness
There are a class of problems that are known to be in NP (can be solved in polynomial time using nondeterminism), but no deterministic polynomial time algorithm has ever been discovered to solve any of themBoolean equation satisfiabilityTraveling salesmanVarious graph problems (Clique, Independent Set, …)
Various scheduling optimization problemsFreeCell (Windows game), SudokuMap coloringAmazingly, all these problems can be to each other
This means that
a polynomial-time solution to ONE is a polynomial time solution to ALL
!!
19Slide20
“Foo is NP-complete”
What does this mean?Foo is in NPEvery problem in NP can to FooIt’s impossible to solve Foo in polynomial time
None or more than one of the above
20Slide21
The first NP-complete problem: SAT
SAT = {<φ> | φ is a Boolean formula with a satisfying assignment}Boolean formula: n variables x1…xn
, m clauses.Literal: any xi
or ~
x
i
Clause: OR of a bunch of literals
Boolean formula: AND of a bunch of clauses
Is there a way to assign
x
i = T or F such that φ is TRUE?
21Slide22
SAT is in NPWith a non-deterministic TM:
Non-deterministically “guess” a solution, and plug it in.With a verifier:Just plug in the assignment and see if the formula evaluates to TRUE.22Slide23
Every problem in NP to SATHow can we possibly make a statement about ALL problems in NP? Any ideas?
23Slide24
Every problem in NP to SATT/F Properties of TM’s:
Tape head is at position k after t stepsTape position k contains symbol a after t
stepsState is q after t steps
You can create clauses based on these T/F properties and your TM description!
“If at step
t
, TM is in state
q
and reading an
a from position
k, then at step t + 1, TM is in state r and at position k + 1,
and
position
k contains a b”“TM is in state qaccept after poly(n) steps”“TM is in state q0 at step 0”Etc.24Slide25
Every problem in NP to SAT
If a problem A is in NP, there is a non-deterministic TM that can decide it in polynomial timeWe have made a construction for an arbitrary problem A:We transformed properties of the nondeterministic TM for A
into a Boolean formula for A.“Non-deterministic TM can decide if w is in
A
” -> “There’s a satisfying assignment for the Boolean formula”
In other words: a reduction for
arbitrary
A
in NP to SAT.
We can solve A by turning it into a Boolean formula and solving SAT.
25Slide26
Every problem in NP to SATThe complete details of the transformation are quite complex – especially showing that it can be done in polynomial time
Much more detail in text for the curious – details not on the finalThis is just to give a flavor of the reductionThe reduction proves the Cook-Levin Theorem: SAT is NP-complete.
26Slide27
Luckily, we don’t have to reduce from ALL problems in NP anymore…
Suppose we want to show that B is NP-complete. How can we do this?Show that B is in NPShow that B SAT
Show that SAT BNone or more than one of the above
27Slide28
If P = NP
Regular
Context-free
Decidable
Recognizable
Co-recognizableSlide29
If P ≠ NP
Regular
Context-free
Decidable
Recognizable
Co-recognizableSlide30
Consequences of P ≠/= NPWhat’s at Stake?
Wonderful!!! Doom!!!30Slide31
If P = NP, what would the consequences be?
Many cryptographic systems are no longer secure, so all your Facebook, Gmail and online credit card transactions become insecure in a way they weren’t beforeMany important optimizations may now be computationally practical, improving our lives and efficiency in many thingsIt takes as long to verify the correctness of an answer to problems in NP as it does to find the correct answer in the first placeOther/None/More than one
31