Download presentation
Presentation is loading. Please wait.
1
Recall last lecture and Nondeterministic TMs
Ola Svensson
2
Computational Complexity
3
Turing Machines
4
The goals A model that can compute anything computable
A model so simple and clean so that we can prove interesting results
5
A Turing machine π is described by a tuple (Ξ, π, πΏ)
A finite alphabet Ξ containing (β³,β, 0, 1, β¦) start symbol blank symbol
6
A Turing machine π is described by a tuple (Ξ, π, πΏ)
A finite alphabet Ξ containing (β³,β, 0, 1, β¦) A finite set π of states containing π π π‘πππ‘ and π βπππ‘ A function πΏ: Ξ 2 Γπβ Ξ Γ πΏ,π,π
π Γπ describing rules of each step: IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
7
Example Start configuration of π on input π₯ Input: β³ 1 β β¦
β β¦ Work/output: β³ β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
8
Example Input: β³ 1 β β¦ Work/output: β³ β β¦ State: π π π‘πππ‘ IF THEN Input
β β¦ Work/output: β³ β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
9
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN
β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
10
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN
β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
11
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN
β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
12
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN
β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
13
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN
β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
14
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π
β β¦ Work/output: β³ 1 β β¦ State: π ο Hey, donβt miss this! IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
15
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π IF THEN Input
β β¦ Work/output: β³ 1 β β¦ State: π IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
16
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π IF THEN Input
β β¦ Work/output: β³ 1 β β¦ State: π IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
17
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π βπππ‘
β β¦ Work/output: β³ 1 β β¦ State: π βπππ‘ What do we compute? IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right Stay Left π 1 π βπππ‘
18
Efficiency and Running Time
Let π: 0,1 β β 0,1 β and let π:βββ Let π be a Turing machine
19
Efficiency and Running Time
Let π: 0,1 β β 0,1 β and let π:βββ Let π be a Turing machine We say that π computes π if for every π₯β 0,1 β , whenever π is initialized to the start configuration on input π₯, then it halts with f(π₯) written on its output type.
20
Efficiency and Running Time
Let π: 0,1 β β 0,1 β and let π:βββ Let π be a Turing machine We say that π computes π if for every π₯β 0,1 β , whenever π is initialized to the start configuration on input π₯, then it halts with f(π₯) written on its output type. We say that π computes π in T n -time if its computation on every input π₯ requires at most T( π₯ ) steps.
21
Efficiency and Running Time
Let π: 0,1 β β 0,1 β and let π:βββ Let π be a Turing machine We say that π computes π if for every π₯β 0,1 β , whenever π is initialized to the start configuration on input π₯, then it halts with f(π₯) written on its output type. We say that π computes π in T n -time if its computation on every input π₯ requires at most T( π₯ ) steps. DTIME(f(n)) = Set of languages that can be decided by a TM in time πβ
π(π)
22
Robustness of definition of Turing Machine
The size of the alphabet doesnβt really matter The number of tapes do not really matter (up to a square in the running time) It is able to simulate all other realistic models with polynomial slow down (except potentially quantum computers that still need to be built) Church-Turing Thesis: Any computable function can be computed by a Turing machine
24
Universal Turing Machine
Every binary string represents some Turing machine (write down πΏ) A Turing machine has infinitely many representations (pad with ones) There exists a TM π such that for every π₯, πΌβ 0,1 β π π₯, πΌ = M πΌ (π₯) Moreover, if π πΌ halts on input π₯ within π steps then π(π₯,πΌ) halts within πΆβ
πβ
πππ(π) steps where πΆ is a number independent of π₯ . (πΆ depends on the number of states, alphabet, and tapes of π πΌ ).
25
DIAGONALIZATION
26
Cantorβs argument The set of infinite binary strings are uncountable
π 1 =(π, 0, 0, 0, 0, 0, 0, β¦ π 2 =(0, π, 0, 1, 0, 1, 0, β¦ π 3 =(0, 1, π, 0, 1, 1, 0, β¦ π 4 =(1, 1, 1, π, 1, 1, 0, β¦ π 5 =(0, 0, 1, 0, π, 0, 1, β¦ π 6 =(0, 0, 1, 0, 0, π, 1, β¦ π 7 =(0, 0, 1, 0, 0, 1, π, β¦ β¦ π =(1, 0, 0, 1, 0, 0, 1, β¦ s is different from any string in the enumeration so it is not part of the enumeration
27
Halting Problem The output of π πΌ 3 ( πΌ 5 ) (? if doesnβt halt) πΆ π
πΆ π πΆ π πΆ π πΆ π πΆ π π 1 π ? β¦ πΏ= { πΌ 1 , πΌ 2 , πΌ πΌ 5 , πΌ 6 , β¦} The set of strings πΌ for which M πΌ πΌ =0 or ?
28
Halting Problem The output of π πΌ 3 ( πΌ 5 ) (? if doesnβt halt) πΆ π
πΆ π πΆ π πΆ π πΆ π πΆ π π 1 π ? β¦ πΏ= { πΌ 1 , πΌ 2 , πΌ πΌ 5 , πΌ 6 , β¦} The set of strings πΌ for which M πΌ πΌ =0 or ? Suppose a TM M decides L. Let πΌ be its encoding. Then we get a contradiction on input πΌ since πΌβπΏβ π πΌ πΌ =0
29
Deterministic Time Hierarchy
The output of π πΌ 3 ( πΌ 5 ) (? if does not halt in π π.π steps) πΆ π πΆ π πΆ π πΆ π πΆ π πΆ π π 1 π ? β¦ πΏ= { πΌ 1 , πΌ 2 , πΌ πΌ 5 , πΌ 6 , β¦} The set of strings πΌ for which M πΌ πΌ =0 or ?
30
Deterministic Time Hierarchy
The output of π πΌ 3 ( πΌ 5 ) (? if does not halt in π π.π steps) πΆ π πΆ π πΆ π πΆ π πΆ π πΆ π π 1 π ? β¦ πΏ= { πΌ 1 , πΌ 2 , πΌ πΌ 5 , πΌ 6 , β¦} The set of strings πΌ for which M πΌ πΌ =0 or ? Suppose a TM M decides L in time n. Let πΌ be its encoding. Then we get a contradiction on input πΌ since πΌβπΏβ π πΌ πΌ =0
31
Diagonalization The proof technique used two things about TMs
They can be encoded efficiently There is a TM that can emulate any other without increasing running time or space too much Otherwise, they treated TMs as βblack boxesβ We will show today that such a proof cannot alone resolve P vs NP
32
Nondeterministic Turing Machines
33
Nondeterministic Turing machines (NDTMs)
Same definition as TMs except that NDTM has two transition functions πΏ 0 and πΏ 1 and a special state called π ππππππ‘ When NDTM computes a function we envision that at each computational step it makes an arbitrary choice as to which of its two transition functions to apply For every input π₯, we say that M π₯ =1 if there exists some sequences of these choices (called nondeterministic choices) that would make M reach π ππππππ‘ on input π₯ Otherwise if every sequence of choices makes π halt without reaching π ππππππ‘ then we say π π₯ =0 We say that π runs in π π -time if for every input π₯β 0,1 β and every sequence of nondeterministic choices, π reaches either the halting state or π ππππππ‘ within π( π₯ ) steps NTIME(f(n)) = Set of languages that can be decided by a NDTM in time πβ
π(π)
34
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
35
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
36
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
37
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
38
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
39
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
40
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π π π‘πππ‘ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
41
If then move to π πππππ‘ . If not move to π βπππ‘ .
Example What language do we accept? Input: β³ 1 β β¦ Work/output: β³ 1 β β¦ State: π ο Now normal deterministic executionβ¦ IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state β³/0/1 β π π π‘πππ‘ Right 0 for πΏ 0 1 for πΏ 1 Stay Left π Once we reach state π, we run βnormalβ TM to check if number on work tape divides input. If then move to π πππππ‘ . If not move to π βπππ‘ .
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.