Turing Machines. Motivation. Our main goal in this course is to analyze problems and categorize them according to their complexity . Motivation. We ask question such as “how much time it takes to compute something?”. Motivation.
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
Motivation Our main goal in this course is to analyze problems and categorize them according to their complexity.
Motivation We ask question such as “how much time it takes to compute something?”
Motivation But in order to answer them we must first have a computational model to relate to.
Introduction • Objectives: • To introduce the computational model called “Turing Machine”. • Overview: • DeterministicTuring machines • Multi-tape Turing machines • Non-deterministic Turing machines • The Church-Turing thesis • Complexity classes as bounds on resources required by TMs.
Formal Definition of a TM Summary 1. Q - the set of states. 2. - the input alphabet. 3. - the tape alphabet 4. :QQ{L,R} - the transition function. 5. q0- the start state. 6. qacceptQ - the accept state. 7. qrejectQ - the reject state.
The Language a TM Accepts • A Turing Machine accepts its input, if it reaches an accepting configuration. • The set of inputs it accepts is called its language.
the state the content of the tape the position of the head Configurations • How many distinct configurations may a Turing machine which uses N cells have? ||N N |Q|
Examples: Member of L: aaabbbccc Non-Member of L: aaabbcccc Building a TM for a Simple Language L = { anbncn | n0 }
The Turing Machine 1. Q = {q0,q1,q2,q3,q4,qaccept,qreject} 2. = {a,b,c} 3. = {a,b,c,_,X,Y,Z} 4. will be specified shortly. 5. q0 - the start state. 6. qacceptQ - the accept state. 7. qrejectQ - the reject state.
aa, R bb, R YY, R ZZ, R q1 bY,R q2 aX,R q0 cZ,L XX, R q3 bb, L aa, LYY, L YY, R qac q4 ZZ, L __, R YY, R ZZ, R The Transitions Function aa, R bb, R YY, R ZZ, R q1 bY,R transitions not specified here yield qreject q2 aX,R q0 cZ,L XX, R __, R q3 bb, L aa, LYY, L YY, R qac q4 ZZ, L __, R YY, R ZZ, R
aa, R YY, R Demonstration bb, R ZZ, R q1 q1 q1 bY,R aX,R q2 q2 q2 q0 q0 q0 q0 q0 cZ,L XX, R __, R q3 q3 q3 ZZ, L bb, L YY, L aa, L YY, R qac qac __, R q4 q4 q4 YY, R ZZ, R . . . X a Y b Z c _ _
Equivalent Models • Deterministic Turing machines are extremely powerful. • We can simulate many other models by them and vice-versa with only a polynomial loss of efficiency. • Next we’ll see an example for such model.
SIP 136-138 Multi-Tape Turing Machines The input is written on the first tape . . . . . . . . .
Multi-Tape Turing Machines 1. Q - the set of states. 2. - the input alphabet. 3. - the tape alphabet 4. :QkQ({L,R})k- the transition function, where k (the number of tapes) is some constant. 5. q0- the start state. 6. qacceptQ - the accept state. 7. qrejectQ - the reject state.
Robustness • Multi-tape machines are polynomially equivalent to single-tape machines. • We can state a much stronger claim concerning the robustness of the Turing machine model:
What’s Next? • We proceed with a less realistic computational model, • Which can be simulated by DTMs • However, with an exponential loss of efficiency.
Non-deterministic Turing Machines 1. Q - the set of states. 2. - the input alphabet. 3. - the tape alphabet 4. :QP(Q{L,R}) - the transition function. 5. q0- the start state. 6. qacceptQ - the accept state. 7. qrejectQ - the reject state. power set P(A)={B | BA}
. . . Computations deterministic computation non-deterministic computation tree accepts if some branch reaches an accepting configuration time Note: the size of the tree is exponential in its height
Alternative Description A non-deterministic machine always guesses correctly the ultimate choice.
Example • A non-deterministic TM which checks if two vertices are connected in a graph may simply guess a path between them. • Now it only needs to verify this is a valid path.
SIP 138-140 Simulating a Non-deterministic machine by a Deterministic One • We’ll describe a deterministic 3-tapes Turing machine which simulates a given non-deterministic machine.
Simulation • Write 111…1 on the address tape. • Copy the input to the simulation tape. • Simulate the NTM: use the choices dictated by the address tape (if valid). • If it accepted – accept. • Replace the address string with the lexicographically next string. If there is no such – reject. • Go to step 2.
Complexity Classes • Now that we have a formal computational model • We may begin to categorize problems • According to the resources TMs which compute them require.
Time Complexity Definition: Let t:nn be a function. TIME(t(n))={L | L is a language decidable by a O(t(n)) deterministic TM} NTIME(t(n))={L | L is a language decidable by a O(t(n)) non-deterministic TM}
Example: { anbncn | n0 } P Polynomial Time Definition:
The Towers of Hanoi The Halting Problem Minimum Spanning Tree Which are in P and Which aren’t?
Space Complexity Definition: Let f:nn be a function. SPACE(f(n))={L | L is a language decidable by an O(f(n)) space deterministic TM} NSPACE(f(n))={L | L is a language decidable by an O(f(n)) space non-deterministic TM}
3Tape Machines input work output . . . read-only Only the size of the work tape is counted for complexity purposes read/write . . . write-only . . .