0% found this document useful (0 votes)
24 views68 pages

TM Theory

The document discusses formal languages, specifically context-sensitive languages and linear bounded automata (LBAs), highlighting their similarities and differences with Turing machines. It explains that LBAs can accept certain languages but have less power than Turing machines while also demonstrating various Turing machine models and their equivalences. The document concludes with theorems proving that multiple variations of Turing machines, including multitape and off-line machines, possess the same computational power as standard Turing machines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views68 pages

TM Theory

The document discusses formal languages, specifically context-sensitive languages and linear bounded automata (LBAs), highlighting their similarities and differences with Turing machines. It explains that LBAs can accept certain languages but have less power than Turing machines while also demonstrating various Turing machine models and their equivalences. The document concludes with theorems proving that multiple variations of Turing machines, including multitape and off-line machines, possess the same computational power as standard Turing machines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 68

Formal Languages

Context-Sensitive Languages
Hinrich Schütze
IMS, Uni Stuttgart, WS 2006/07
With slides borrowed from:

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


inear Bounded Automata (LBAs)
re the same as Turing Machines
ith one difference:

The input string tape space


is the only tape space the machine
is allowed to use

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


A linear bounded automaton is a
nondeterministic Turing machine M = (Q, Σ, Γ,δ,
q0 , B,F), subject to the restriction that Σ must
contain two special symbols [ and ], such that δ
(qi ,[) can contain only elements of the form (qj ,
[,R), and δ (qi , ]) can contain only elements of
the form (qj , ],L).

for some qf ∈ F, x1 , x2 ∈
Γ*.
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Linear Bounded Automaton (LBA)

Input string
[ a b c d e ]

Working space
Left-end Right-end
on tape
marker marker

ll computation is done between end markers

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Example languages accepted by LBAs:

n n n
L {a b c }

LBA’s have more power than NPDA’s

LBA’s have also less power


than Turing Machines
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
LBA for L={a b
n n
| n>=1}

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Variations
of the
Turing Machine

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


The Standard Model
Infinite Tape
 aababbcac a

Read-Write Head (Left or Right)

Control Unit

Deterministic

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Variations of the Standard Model

Turing machines with: • Stay-Option


• Semi-Infinite Tape
• Off-Line
• Multitape
• Multidimensional
• Nondeterministic

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


The variations form different
Turing Machine Classes

We want to prove:
Each Class has the same
power as the Standard Model

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Same Power of two classes means:
The two classes of Turing machines accept
the same languages

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Same Power of two classes means:

For any machine M1 of first class

there is a machine M 2 of second class

such that: L( M 1 ) L( M 2 )

And vice-versa

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Simulation:
a technique to prove same power

Simulate the machine of one class


with a machine of the other class

Second Class
First Class Simulation Machine
Original Machine M2
M1 M1
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Turing Machines with Stay-Option

The head can stay in the same position

 aababbcac a

Left, Right, Stay

L,R,S: moves
14
Example: Time 1
 aababbcac a
q1
Time 2
 b ab abb c ac a
q2

q1 a  b, S q2
15
Theorem: Stay-Option Machines
have the same power as
Standard Turing machines

16
Proof:

Part 1: Stay-Option Machines


are at least as powerful as
Standard machines

Proof: a Standard machine is also


a Stay-Option machine
(that never uses the S move)

17
Proof:

Part 2: Standard Machines


are at least as powerful as
Stay-Option machines

Proof: a standard machine can simulate


a Stay-Option machine

18
Stay-Option Machine

a  b, L
q1 q2

Simulation in Standard Machine

a  b, L
q1 q2

Similar for Right moves


19
Stay-Option Machine

a  b, S
q1 q2

Simulation in Standard Machine

a  b, L x  x, R
q1 q2 q3

For every symbol x


20
Example
Stay-Option Machine:
1 2
q1 a  b, S q2 aaba  baba 
q1 q2

Simulation in Standard Machine:


1 2 3
aaba  baba  baba 
q1 q2 q3
21
Standard Machine--Multiple Track Tape

  a b a b  track 1
  b a c d  track 2

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Proof of equivalence?

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard Machine--Multiple Track Tape

  a b a b  track 1
  b a c d  track 2

one symbol

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


  a b a b  track 1
  b a c d  track 2

q1

  a c a b  track 1
  b d c d  track 2

q2

(b, a )  (c, d ), L
q1 q2
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Semi-Infinite Tape

# a b a c   .........

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Proof of equivalence?

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard Turing machines simulate
Semi-infinite tape machines:

Trivial

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Semi-infinite tape machines simulate
Standard Turing machines:

Standard machine
......... .........

Semi-infinite tape machine


.........

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard machine
.........  a b c d e   .........

reference point

Semi-infinite tape machine with two tracks


Right part # d e    .........
Left part # c b a  

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard machine

q2
q1

Semi-infinite tape machine


Left part Right part
L R
q2 R q2
L
q1 q1

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard machine
a  g, R
q1 q2

Semi-infinite tape machine

R (a, x)  ( g , x), R R
Right part q1 q2

L ( x, a )  ( x, g ), L L
Left part q1 q2
For all symbols x
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Time 1
Standard machine
.........  a b c d e   .........

q1

Semi-infinite tape machine


Right part # d e    .........
Left part # c b a  
L
q1
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Time 2
Standard machine
.........  g b c d e   .........

q2

Semi-infinite tape machine


Right part # d e    .........
Left part # c b g  
L
q2
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
At the border:

Semi-infinite tape machine

R (# , # )  (# , # ), R L
Right part q1 q1

L (# , # )  (# , # ), R R
Left part q1 q1

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Semi-infinite tape machine

Time 1
Right part # d e    .........
Left part # c b g  
L
q1

Time 2
Right part # d e    .........
Left part # c b g  
R
q1
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Theorem: Semi-infinite tape machines
have the same power as
Standard Turing machines

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


The Off-Line Machine
Input File
a b c
read-only

Control Unit

Tape read-write
  g d e  
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Proof of equivalence?

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Off-line machines simulate
Standard Turing Machines:

Off-line machine:

1. Copy input file to tape

2. Continue computation as in
Standard Turing machine

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard machine
 a b c  

Off-line machine

Input File Tape


a b c   a b c 

1. Copy input file to tape


C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Standard machine
 a b c  
q1

Off-line machine

Input File Tape


a b c   a b c 
q1
2. Do computations as in Turing machine
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Standard Turing machines simulate
Off-line machines:

Use a Standard machine with four track tape


to keep track of
the Off-line input file and tape contents

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Off-line Machine
Input File Tape
a b c d   e f g 

Four track tape -- Standard Machine

# a b c d Input File
# 0 0 1 0 head position
e f g Tape
0 1 0 head position
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Reference point

# a b c d Input File
# 0 0 1 0 head position
e f g Tape
0 1 0 head position

Repeat for each state transition:


• Return to reference point
• Find current input file symbol
• Find current tape symbol
• Make transition
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Theorem:Off-line machines
have the same power as
Standard machines

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Multitape Turing Machines

Control unit

Tape 1 Tape 2
 a b c   e f g 
Input

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Tape 1 Time 1 Tape 2
 a b c   e f g 
q1 q1

Time 2
 a g c   e d g 
q2 q2

(b, f )  ( g , d ), L, R
q1 q2
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Proof of equivalence?

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Multitape machines simulate
Standard Machines:

Use just one tape

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Standard machines simulate
Multitape machines:

Standard machine:

• Use a multi-track tape

• A tape of the Multiple tape machine


corresponds to a pair of tracks

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Multitape Machine
Tape 1 Tape 2
 a b c   e f g h 

Standard machine with four track tape


a b c Tape 1
0 1 0 head position
e f g h Tape 2
0 0 1 0 head position
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Reference point

a b c Tape 1
#
# 0 1 0 head position
# e f g h Tape 2
# 0 0 1 0 head position

Repeat for each state transition:


•Return to reference point
•Find current symbol in Tape 1
•Find current symbol in Tape 2
•Make transition
C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
Theorem: Multi-tape machines
have the same power as
Standard Turing Machines

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


Multidimensional Turing
Machines

C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk


C. Busch, E. Rich, R. Sproat, G. Taylor and M. Volk
A limitation of Turing Machines:

Turing Machines are “hardwired”

they execute
only one program

Real Computers are re-programmable

57
Solution: Universal Turing Machine

Attributes:

• Reprogrammable machine

• Simulates any other Turing Machine

58
Universal Turing Machine
simulates any other Turing MachineM

Input of Universal Turing Machine:

Description of transitions of M
Initial tape contents of M

59
Tape 1
Three tapes

Description of M

Universal
Tape 2
Turing
Machine
Tape Contents of M

Tape 3

State of M 60
Tape 1

Description of M

We describe Turing machine M


as a string of symbols:

We encode as a string of symbols


M

61
Alphabet Encoding

Symbols: a b c d 

Encoding: 1 11 111 1111

62
State Encoding

States: q1 q2 q3 q4 

Encoding: 1 11 111 1111

Head Move Encoding

Move: L R

Encoding: 1 11
63
Transition Encoding

Transition:  (q1, a ) (q2 , b, L)

Encoding: 1 0 1 0 11 0 11 0 1

separator

64
Machine Encoding

Transitions:
 (q1, a ) (q2 , b, L)  (q2 , b) (q3 , c, R )

Encoding:
1 0 1 0 11 0 11 0 1 00 11 0 1 10 111 0 111 0 11
separator
65
Tape 1 contents of Universal Turing Machine:

encoding of the simulated machineM


as a binary string of 0’s and 1’s

66
A Turing Machine is described
with a binary string of 0’s and 1’s

Therefore:

The set of Turing machines forms a language:

each string of the language is


the binary encoding of a Turing Machine

67
Language of Turing Machines

L = { 010100101, (Turing Machine 1)

00100100101111, (Turing Machine 2)

111010011110010101,
……
…… }

68

You might also like