# Languages and Finite Automata_2_ by malj

VIEWS: 2 PAGES: 47

• pg 1
Linear Bounded Automata
LBAs

Courtesy Costas Busch - RPI   1
Linear Bounded Automata (LBAs)
are the same as Turing Machines
with one difference:

The input string tape space
is the only tape space allowed to use

Courtesy Costas Busch - RPI   2
Linear Bounded Automaton (LBA)

Input string
[ a b c d e ]

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

All computation is done between end markers

Courtesy Costas Busch - RPI          3
We define LBA’s as NonDeterministic

Open Problem:
NonDeterministic LBA’s
have same power with
Deterministic LBA’s ?

Courtesy Costas Busch - RPI   4
Example languages accepted by LBAs:

L  {a b c }
n n n

L  {a }
n!

LBA’s have more power than NPDA’s

LBA’s have also less power
than Turing Machines
Courtesy Costas Busch - RPI   5
The Chomsky Hierarchy

Courtesy Costas Busch - RPI   6
Unrestricted Grammars:

Productions
u v

String of variables                        String of variables
and terminals                              and terminals

Courtesy Costas Busch - RPI               7
Example unrestricted grammar:

S  aBc
aB  cA
Ac  d

Courtesy Costas Busch - RPI   8
Theorem:

A language L is recursively enumerable
if and only if L is generated by an
unrestricted grammar

Courtesy Costas Busch - RPI   9
Context-Sensitive Grammars:

Productions
u v

String of variables                         String of variables
and terminals                               and terminals

and:   |u|  |v|
Courtesy Costas Busch - RPI               10
The language       n n n
{a b c }
is context-sensitive:

S  abc | aAbc
Ab  bA
Ac  Bbcc
bB  Bb
aB  aa | aaA
Courtesy Costas Busch - RPI   11
Theorem:
A language   L is context sensistive
if and only if
L   is accepted by a Linear-Bounded automaton

Observation:
There is a language which is recursive
but not context-sensitive
Courtesy Costas Busch - RPI   12
The Chomsky Hierarchy

Non-recursively enumerable

Recursively-enumerable
Recursive

Context-sensitive

Context-free

Regular
Courtesy Costas Busch - RPI   13
Decidability

Courtesy Costas Busch - RPI   14
Consider problems with answer YES or NO

Examples:
• Does Machine         M have three states ?

• Is string   w a binary number?

• Does DFA     M accept any input?

Courtesy Costas Busch - RPI     15
A problem is decidable if some Turing machine
decides (solves) the problem

Decidable problems:
• Does Machine         M have three states ?

• Is string   w a binary number?

• Does DFA     M accept any input?

Courtesy Costas Busch - RPI     16
The Turing machine that decides (solves)
a problem answers YES or NO
for each instance of the problem

Input                                         YES
problem      Turing Machine
instance                                      NO

Courtesy Costas Busch - RPI         17
The machine that decides (solves) a problem:

• If the answer is YES
then halts in a yes state

• If the answer is NO
then halts in a no state

These states may not be final states
Courtesy Costas Busch - RPI   18
Turing Machine that decides a problem

YES states

NO states

YES and NO states are halting states
Courtesy Costas Busch - RPI                19
Difference between
Recursive Languages and Decidable problems

For decidable problems:
The YES states may not be final states

Courtesy Costas Busch - RPI   20
Some problems are undecidable:

which means:
there is no Turing Machine that
solves all instances of the problem

A simple undecidable problem:

The membership problem

Courtesy Costas Busch - RPI   21
The Membership Problem

Input:   •Turing Machine                 M
•String           w

Question:    Does M                    accept w ?

w L(M ) ?

Courtesy Costas Busch - RPI           22
Theorem:
The membership problem is undecidable

(there are M and w for which we cannot
decide whether w  L (M ) )

the membership problem is decidable

Courtesy Costas Busch - RPI   23
Thus, there exists a Turing Machine                 H
that solves the membership problem

M                         YES                M accepts w
H
w                          NO                M rejects w

Courtesy Costas Busch - RPI                 24
Let   L be a recursively enumerable language

Let   M be the Turing Machine that accepts L

We will prove that        L is also recursive:
we will describe a Turing machine that
accepts L and halts on any input
Courtesy Costas Busch - RPI    25
Turing Machine that accepts                      L
and halts on any input

H
M                               YES         accept w
M accepts w ?
w                                   NO          reject   w

Courtesy Costas Busch - RPI                26
Therefore,   L is recursive

Since L is chosen arbitrarily, every
recursively enumerable language is also
recursive

But there are recursively enumerable
languages which are not recursive

Courtesy Costas Busch - RPI   27
Therefore, the membership problem
is undecidable

END OF PROOF
Courtesy Costas Busch - RPI   28
Another famous undecidable problem:

The halting problem

Courtesy Costas Busch - RPI   29
The Halting Problem

Input:   •Turing Machine                 M
•String           w

Question:    Does M                    halt on input w ?

Courtesy Costas Busch - RPI              30
Theorem:
The halting problem is undecidable

(there are M and w for which we cannot
decide whether M halts on input w )

the halting problem is decidable

Courtesy Costas Busch - RPI   31
Thus, there exists Turing Machine                    H
that solves the halting problem

M                         YES                M halts on w
H
w                          NO                    doesn’t
M             w
halt on

Courtesy Costas Busch - RPI                     32
Construction of                     H

H
Input:
q y YES
initial tape contents
wM w                    q0
qn NO
Encoding     String
of M           w
Courtesy Costas Busch - RPI                 33
Construct machine      H :
If   H returns YES then loop forever

If   H returns NO then halt

Courtesy Costas Busch - RPI   34
H

H                           Loop forever

q y YES            qa     qb
wM w   q0
qn NO

Courtesy Costas Busch - RPI              35
Construct machine       ˆ
H:

Input:    wM           (machine              M )

If   M halts on input wM
Then loop forever

Else halt

Courtesy Costas Busch - RPI         36
ˆ
H

copy          wM wM
wM                                      H
wM

Courtesy Costas Busch - RPI        37
Run machine   ˆ
H with input itself:

Input:   wH
ˆ           (machine              ˆ
H )

If   ˆ
H halts on input wH
ˆ

Then loop forever

Else halt

Courtesy Costas Busch - RPI         38
ˆ
H on input wH :
ˆ

If   ˆ
H halts then loops forever

If   ˆ
H doesn’t halt then it halts

NONSENSE !!!!!

Courtesy Costas Busch - RPI   39

The halting problem is undecidable

END OF PROOF

Courtesy Costas Busch - RPI   40
Another proof of the same theorem:

If the halting problem was decidable then
every recursively enumerable language
would be recursive

Courtesy Costas Busch - RPI   41
Theorem:
The halting problem is undecidable

the halting problem is decidable

Courtesy Costas Busch - RPI   42
There exists Turing Machine H
that solves the halting problem

M                         YES                M halts on w
H
w                          NO                    doesn’t
M             w
halt on

Courtesy Costas Busch - RPI                     43
Let   L be a recursively enumerable language

Let   M be the Turing Machine that accepts L

We will prove that        L is also recursive:
we will describe a Turing machine that
accepts L and halts on any input
Courtesy Costas Busch - RPI    44
Turing Machine that accepts                     L
and halts on any input

M         H
NO              reject   w
M halts on w ?
w                               YES
accept    w
Halts on final state
Run M
with input w                     reject    w
Halts on non-final
state
Courtesy Costas Busch - RPI                         45
Therefore    L is recursive

Since L is chosen arbitrarily, every
recursively enumerable language
is also recursive

But there are recursively enumerable
languages which are not recursive