Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views16 pages

Ch3 TuringMachinesModel 2

The document discusses Turing machines and the concepts of recursively enumerable and recursive languages. It explains the definitions and properties of these languages, including examples of languages that are recursively enumerable but not recursive, and vice versa. The document also touches on enumeration procedures and decidability in relation to Turing machines.

Uploaded by

thienyendtnt2017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views16 pages

Ch3 TuringMachinesModel 2

The document discusses Turing machines and the concepts of recursively enumerable and recursive languages. It explains the definitions and properties of these languages, including examples of languages that are recursively enumerable but not recursive, and vice versa. The document also touches on enumeration procedures and decidability in relation to Turing machines.

Uploaded by

thienyendtnt2017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

MÔ HÌNH MÁY TURING

(Turing Machines Model) Definition:


2
A language is recursively enumerable
Recursively Enumerable
if some Turing machine accepts it
and
Recursive Languages
« If the human brain was so simple
that we could understand it,
then we would be so simple that we could not »
(L. Watson)
2/96

Let L be a recursively enumerable language


Definition:
and M the Turing Machine that accepts it
A language is recursive
For string w: if some Turing machine accepts it
if w∈ L then M halts in a final state and halts on any input string

In other words:
if w∉ L then M halts in a non-final state
A language is recursive if there is
or loops forever a membership algorithm for it
3/96 4/96

Let L be a recursive language We will prove:

and M the Turing Machine that accepts it 1. There is a specific language


which is not recursively enumerable
For string w: (not accepted by any Turing Machine)

if w∈ L then M halts in a final state 2. There is a specific language


which is recursively enumerable
if w ∉ L then M halts in a non-final state but not recursive
5/96 6/96

1
Non Recursively Enumerable

A Language which
Recursively Enumerable
is not
Recursively Enumerable
Recursive

7/96

We want to find a language that Consider alphabet {a}


is not Recursively Enumerable
Strings: a, aa, aaa, aaaa, K
This language is not accepted by any
Turing Machine a1 a 2 a3 a4 L

9/96 10/96

Example language accepted by M i

Consider Turing Machines


L( M i ) = {aa, aaaa, aaaaaa}
that accept languages over alphabet {a}
L( M i ) = {a 2 , a 4 , a 6 }

Alternative representation
They are countable:

M1, M 2 , M 3 , M 4 , K a1 a2 a3 a4 a5 a6 a7 L

L( M i ) 0 1 0 1 0 1 0 L
11/96 12/96

2
Consider the language
a1 a2 a3 a4 L

L ( M1 ) 0 1 0 1 L L = {a i : a i ∈ L( M i )}
L( M 2 ) 1 0 0 1 L

L( M 3 ) 0 1 1 1 L
L consists from the 1’s in the diagonal
L( M 4 ) 0 0 0 1 L
13/96 14/96

a1 a2 a3 a4 L Consider the language L


L(M 1) 0 1 0 1 L
L = {a i : a i ∈ L( M i )}
L(M 2 ) 1 0 0 1 L

L
L(M 3 ) 0 1 1 1
L = {a i : a i ∉ L( M i )}
L(M 4 ) 0 0 0 1 L
L consists of the 0’s in the diagonal
L = {a 3 , a 4 ,K} 15/96 16/96

a1 a2 a3 a4 L
Theorem:
L(M 1) 0 1 0 1 L
Language Lis not recursively enumerable
L(M 2 ) 1 0 0 1 L

L(M 3 ) 0 1 1 1 L

L(M 4 ) 0 0 0 1 L

L = {a1, a 2 ,K} 17/96 18/96

3
Proof: a1 a2 a3 a4 L

L(M 1) L
Assume for contradiction that 0 1 0 1

L is recursively enumerable L(M 2 ) 1 0 0 1 L

L(M 3 ) 0 1 1 1 L
There must exist some machine Mk
L(M 4 ) 0 0 0 1 L
that accepts L

L( M k ) = L 19/96
Question: M k = M1 ? 20/96

a1 a2 a3 a4 L
a1 a2 a3 a4 L
L(M 1) 0 1 0 1 L
L(M 1) 0 1 0 1 L
L(M 2 ) 1 0 0 1 L
L(M 2 ) 1 0 0 1 L
L(M 3 ) 0 1 1 1 L
L(M 3 ) 0 1 1 1 L

L(M 4 ) 0 0 0 1 L
L(M 4 ) 0 0 0 1 L
a1 ∈ L( M k )
Answer: M k ≠ M1 Question: M k = M 2 ?
a1 ∉ L( M1 ) 21/96 22/96

a1 a2 a3 a4 L a1 a2 a3 a4 L
L(M 1) 0 1 0 1 L L(M 1) 0 1 0 1 L
L(M 2 ) 1 0 0 1 L 1 0 0 1 L
L(M 2 )
L(M 3 ) 0 1 1 1 L L(M 3 ) 0 1 1 1 L

L(M 4 ) 0 0 0 1 L L(M 4 ) 0 0 0 1 L
2
a ∈ L( M k )
Answer: Mk ≠ M2 Question: M k = M 3 ?
a 2 ∉ L( M 2 ) 23/96 24/96

4
a1 a2 a3 a4 L
Similarly: M k ≠ Mi for any i
L(M 1) 0 1 0 1 L

L(M 2 ) 1 0 0 1 L Because either:

L(M 3 ) 0 1 1 1 L
a i ∈ L( M k ) a i ∉ L( M k )
or
L(M 4 ) 0 0 0 1 L
3 a ∉ L( M i )
i
a i ∈ L( M i )
a ∉ L( M k )
Answer: M k ≠ M3
a3 ∈ L( M 3 ) 25/96 26/96

Observation:
Therefore, the machine M k cannot exist
There is no algorithm that describes L
Therefore, the language L
is not recursively enumerable
(otherwise L would be accepted by
some Turing Machine)
End of Proof

27/96 28/96

Non Recursively Enumerable

A Language which is
Recursively Enumerable L Recursively Enumerable
and not Recursive

Recursive

29/96

5
We want to find a language which

Is recursively But not We will prove that the language


enumerable recursive
L = {a i : a i ∈ L( M i )}

There is a Is recursively enumerable


The machine
Turing Machine but not recursive
doesn’t halt
that accepts on some input
the language
31/96 32/96

a1 a2 a3 a4 L Theorem:
L(M 1) 0 1 0 1 L

1 0 0 1 L
The language L = {a i : a i ∈ L( M i )}
L(M 2 )

L(M 3 ) 0 1 1 1 L is recursively enumerable


L(M 4 ) 0 0 0 1 L

L = {a 3 , a 4 ,K} 33/96 34/96

Turing Machine that accepts L


For any input string w
Proof:
• Compute i , for which w = ai
• Find Turing machine Mi
We will give a Turing Machine that
(using an enumeration procedure
accepts L
for Turing Machines)

• Simulate M i on input a i
• If M i accepts, then accept w
35/96 End of Proof 36/96

6
Observation:

Recursively enumerable Theorem:


L = {a i : a i ∈ L( M i )}
The language L = {a i : a i ∈ L( M i )}
is not recursive
Not recursively enumerable
L = {a i : a i ∉ L( M i )}
(Thus, also not recursive)
37/96 38/96

Proof: Therefore:
Assume for contradiction that is
L
recursive
L is recursive
Then L is recursive:
Take the Turing Machine M that accepts L But we know:
M halts on any input: L is not recursively enumerable
If M accepts then reject thus, not recursive
If M rejects then accept CONTRADICTION!!!!
39/96 40/96

Non Recursively Enumerable L


Therefore, L is not recursive
Recursively Enumerable

L
Recursive

End of Proof 41/96 42/96

7
We will prove:
(weak result)
Turing acceptable languages • If a language is recursive then
and
Enumeration Procedures there is an enumeration procedure for it
(strong result)
• A language is recursively enumerable
if and only if
there is an enumeration procedure for it
44/96

Proof:
Theorem: Enumeration Machine

if a language L is recursive then


~ M
there is an enumeration procedure for it M

Enumerates all
Accepts L
45/96 strings of input alphabet 46/96

Enumeration procedure
If the alphabet is {a, b} then
~ Repeat:
M can enumerate strings as follows:
a ~
M generates a string w
b
aa M checks if w∈ L
ab
ba YES: print w to output
bb NO: ignore w
aaa
aab
...... 47/96 End of Proof 48/96

8
Example: L = {b, ab, bb, aaa,....}
Enumeration
~ L(M ) Theorem:
M Output
a if language L is recursively enumerable then
b b b there is an enumeration procedure for it
aa
ab ab ab
ba
bb bb bb
aaa aaa aaa
aab
...... ...... ...... 49/96 50/96

Proof: If the alphabet is {a, b} then


Enumeration Machine ~
M can enumerate strings as follows:
a
~ M b
M aa
ab
ba
bb
Enumerates all aaa
Accepts L aab
strings of input alphabet 51/96 52/96

NAIVE APPROACH BETTER APPROACH


Enumeration procedure ~
M Generates first string w1
Repeat: M~ generates a string w
M executes first step on w1
M checks if w∈ L
YES: printw to output ~
M Generates second string w2
NO: ignore w
M executes first step on w2
Problem: If w ∉ L second step on w1
machine M may loop forever 53/96 54/96

9
~
M Generates third string w3 w1 w2 w3 w4 L

M executes first step on w3 1 1 1 1


second step on w2 Step
in 2 2 2 2
third step on w1
string
3 3 3 3
And so on............

55/96 L 56/96

Theorem:
If for any string wi
machine M halts in a final state
If for language L
then it prints wi on the output
there is an enumeration procedure
then L is recursively enumerable

End of Proof 57/96 58/96

Proof: Turing machine that accepts L


Input Tape
For input string w
w
Machine that Repeat:
accepts L • Using the enumerator,
generate the next string of L
Enumerator • Compare generated string with w
Compare
for L
If same, accept and exit loop

59/96 End of Proof 60/96

10
The Chomsky Hierarchy

Non-recursively enumerable
We have proven:
Recursively-enumerable
A language is recursively enumerable Recursive
if and only if
there is an enumeration procedure for it Context-sensitive

Context-free

Regular
61/96 62/96

Consider problems with answer YES or NO

Examples:
Decidability
• Does Machine M have three states ?

• Is string w a binary number?

• Does DFA M accept any input?


64/96

A problem is decidable if some TM


decides (solves) the problem The Turing machine that decides (solves)
Decidable problems: a problem answers YES or NO
for each instance of the problem
• Does Machine M have three states ?

• Is string w a binary number? Input YES


problem Turing Machine
• Does DFA M accept any input?
instance NO
65/96 66/96

11
Turing Machine that decides a problem

The machine that decides (solves) a problem:


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

• If the answer is NO NO states


then halts in a no state

These states may not be final states YES and NO states are halting states
67/96 68/96

Difference between Some problems are undecidable:


Recursive Languages and Decidable problems
which means:
there is no Turing Machine that
solves all instances of the problem
For decidable problems:
A simple undecidable problem:
The YES states may not be final states
The membership problem
69/96 70/96

The Membership Problem Theorem:


The membership problem is undecidable
Input: •Turing Machine M
(there are M and w for which we cannot
•String w decide whether w ∈ L ( M ) )

Question: Does M accept w ?


Proof: Assume for contradiction that
w ∈ L( M ) ? the membership problem is decidable
71/96 72/96

12
Thus, there exists a Turing Machine H Let L be a recursively enumerable language
that solves the membership problem
Let M be the Turing Machine that accepts L
M YES M accepts w
H
w We will prove that L is also recursive:
NO M rejects w
we will describe a Turing machine that
accepts L and halts on any input
73/96 74/96

Turing Machine that accepts Therefore, L is recursive


L
and halts on any input
Since L is chosen arbitrarily, every
recursively enumerable language is also
H recursive
M YES accept w
M accepts w ? But there are recursively enumerable
w NO reject languages which are not recursive
w

75/96 Contradiction!!!! 76/96

Another famous undecidable problem:


Therefore, the membership problem
is undecidable
The halting problem

END OF PROOF 77/96 78/96

13
The Halting Problem Theorem:
The halting problem is undecidable
Input: •Turing Machine M
(there are M and w for which we cannot
•String w
decide whether M halts on input w )

Question: Does M halt on input w ?


Proof: Assume for contradiction that
the halting problem is decidable
79/96 80/96

Thus, there exists Turing Machine H Construction of H


that solves the halting problem
H
Input:
M YES M halts on w q y YES
initial tape contents
H
wM w q0
w NO doesn’t
M w qn NO
halt on
Encoding String
of M w
81/96 82/96

Construct machine H′ :
H′
If H returns YES then loop forever
H Loop forever

If H returns NO then halt q y YES qa qb


wM w q0
qn NO

83/96 84/96

14
Construct machine Ĥ :

Input: wM (machine M ) Ĥ

copy wM wM
If M halts on input wM
wM
wM H′

Then loop forever

Else halt
85/96 86/96

Run machine Ĥ with input itself: Ĥ on input wHˆ :

Input: wHˆ (machine Ĥ ) If Ĥ halts then loops forever

If Ĥ doesn’t halt then it halts


If Ĥ halts on input wHˆ
Then loop forever NONSENSE !!!!!

Else halt
87/96 88/96

Therefore, we have contradiction Another proof of the same theorem:

The halting problem is undecidable


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

89/96 90/96

15
Theorem:

The halting problem is undecidable There exists Turing Machine H


that solves the halting problem

Proof:
M YES M halts on w
Assume for contradiction that
the halting problem is decidable H
w NO doesn’t
M w
halt on

91/96 92/96

Turing Machine that accepts L


Let L be a recursively enumerable language
and halts on any input
Let M be the Turing Machine that accepts L M H
NO reject w
We will prove that L is also recursive: M halts on w ?
w YES
we will describe a Turing machine that
accept w
accepts L and halts on any input Halts on final state
Run M
with input w reject w
Halts on non-final
93/96 state 94/96

Therefore L is recursive
Since L is chosen arbitrarily, every
Therefore, the halting problem is undecidable
recursively enumerable language
is also recursive

But there are recursively enumerable


languages which are not recursive

Contradiction!!!!
95/96 END OF PROOF 96/96

16

You might also like