Download presentation
Presentation is loading. Please wait.
Published byBlanche Randall Modified over 6 years ago
1
Decidable Languages A language L is decidable if there is a Turing machine ML such that given any word w 0*, then: Input of ML: a b … w Output of ML: 1 … If w L If w L
2
Complement of Decidable Languades
Suppose that L is decidable, is LC = {w : w L} decidable? YES Proof: Let ML be the Turing machine that decides L: …
3
Semidecidable Languages
Definition. A language L is called semidecidable if there exists a Turing machine, ML, such that: If w L then ML(w) halts If w L then ML(w) Why do you think they are called “semidecidable”? Because if we run ML on a word w and it hasn’t stop, there are two possibilities: Maybe it just needs to run more time before it finally ends, or Maybe it will never stop (w L)
4
Decidable vs Semidecidable
If L Decidable then L is semidecidable: Use the Turing machine ML that decides L a follows: … The other way around is not true. If L is not even semidecidable then L cannot be decidable
5
There are Non-Decidable and Even Non-Semidecidable Languages
That is, there are languages for which no algorithm exists that decides if a given word is in the language or not Example: Consider the following set: Halting = {M(w) : M is a Turing machine that halts on w} Halting is not decidable HaltingC is not even semidecidable
6
Halting is Not Decidable but it is Semidecidable
Proof that Halting is semidecidable: Trivial. What this means is that you cannot write a program (in any language, for example in C) that receives as input another program P (for example in C) and an input w for P and correctly decides if P(w) halts or not
7
Multi-tape Turing Machines: Informal Description
Control … a1 a2 Tape1 head1 … a1 a2 Tape2 head2 We add a finite number of tapes …
8
Multi-tape Turing Machines: Informal Description (II)
Each tape is bounded to the left by a cell containing the symbol Each tape has a unique header Transitions have the form (for a 2-tape Turing machine): ( (p,(x1, x2), (q, (y1, y2) ) Such that each xi is in and each yi is in or is or
9
Multi-tape Turing Machines: Formal Definition
Definition. A 2-tape Turing machine is a 5-tuple (S, , , s,H), where: S is a set of states is an alphabet. It must contain and . It cannot contain or s S is the initial state H S is the set of halting states
10
Multi-tape Turing Machines: Formal Definition (II)
is a collection of transitions defined by the function: : (S-H) S ( (, }) ( (, }) such that: 1. For any q S – H, p S with (q,(x1, x2)) = (p, (y1, y2)) ), if xi is then 2. There cannot be any p, q with (q,(x1, x2)) = (p, (y1, y2)) ), with xi ≠ such that yi = yi must be either or
11
Multi-tape Turing Machines: Example
Lets construct a 3-tape Turing machine that receives as input 2 binary numbers of the same lenght in the first two tapes and outputs the OR of the two numbers on the third tape Example: Tape 1: 010111 Tape 2: 100011 Tape 3: 110111
12
Multi-tape Turing Machines
Construct a 2-tape Turing machine that recognizes the language: L = {anbn : n = 0, 1, 2, …} Tape1: w Input: Tape2: Tape1: 1… if w L or Tape1: 0… if w L Output: Hints: use the second tape as an stack Use the machines M1 and M0
13
Multi-tape Turing Machines vs Turing Machines
a1 a2 … ai … b1 b2 … … bj We can simulate a 2-tape Turing machine M2 in a Turing machine M: we can represent the contents of the 2 tapes in the single tape by using special symbols We can simulate one transition from the M2 by constructing multiple transitions on M We introduce several (finite) new states into M
14
Using States to “Remember” Information
Configuration in a 2-tape Turing Machine M2: Tape1 a b a b State: s Tape2 b b a State in the Turing machine M: “s+b+1+a+2” Which represents: M2 is in state s Cell pointed by first header in M2 contains b Cell pointed by second header in M2 contains an a
15
Using States to “Remember” Information (2)
State in the Turing machine M: “s+b+1+a+2” (# states in M2) * | or or | * | or or | How many states are there in M? Yes, we need large number of states for M but it is finite!
16
Configuration in a 2-tape Turing Machine M2:
a b a b State in M2: s Tape2 b b a Equivalent configuration in a Turing Machine M: a b 1 2 4 3 e State in M: s+b+1+a+2
17
Simulating M2 with M The alphabet of the Turing machine M extends the alphabet 2 from the M2 by adding the separator symbols: 1, 2, 3 , 4 and e, and adding the mark symbols: and We introduce more states for M, one for each 5-tuple p++1+ +2 where p in an state in M2 and +1+ +2 indicates that the head of the first tape points to and the second one to We also need states of the form p++1++2 for control purposes
18
Simulating transitions in M2 with M
State in M: s+b+1+a+2 a b 1 2 4 3 e At the beginning of each iteration of M2, the head starts at e and both M and M2 are in an state s We traverse the whole tape do determine the state p++1+ +2, Thus, the transition in M2 that is applicable must have the form: ( (p,(, )), (q,(,)) ) in M2 p+ +1+ +2 q+ +1++2 in M
19
Simulating transitions in M2 with M (2)
To apply the transformation (q,(,)), we go forwards from the first cell. If the (or ) is (or ) we move the marker to the right (left): 1 … i 1 … i If the (or ) is a character, we first determine the correct position and then overwrite
20
state: s 1 a b a b 2 3 b b a 4 e a b 2 4 3 e 1 a b 1 2 4 3 e b a 1 2 4 3 e a b 1 2 4 3 e a b 2 4 3 e Output: 1 state: s+b+1
21
Multi-tape Turing Machines vs Turing Machines (6)
We conclude that 2-tape Turing machines can be simulated by Turing machines. Thus, they don’t add computational power! Using a similar construction we can show that 3-tape Turing machines can be simulated by 2-tape Turing machines (and thus, by Turing machines). Thus, k-tape Turing machines can be simulated by Turing machines
22
Implications If we show that a function can be computed by a k-tape Turing machine, then the function is Turing-computable In particular, if a language can be decided by a k-tape Turing machine, then the language is decidable Example: Since we constructed a 2-tape TM that decides L = {anbn : n = 0, 1, 2, …}, then L is Turing-computable.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.