We have now studied of two classes of machine
Ñ FSA and PDA, and their corresponding classes of language Ñ regular
and context-free.
We have also discovered that some languages, the non-context-free, are not recognisable
even by non-determinstic PDAs.
The next class of machine is more powerful still.
In fact, it is the most powerful of all computational machines -- if a Turing
Machine cannot compute it, it is not computable!
This model of computation was developed by Alan Mathison Turing, who
also developed the first electronic computer, Colossus, for breaking
the German militery codes during the Second World War.
A Turing Machine (TM) is a collection of six things:
The following TM accepts the language L
= anbn.
You may find it easier to understannd this graphical notation if you compare
it to the following representation in tabular form of the same TM:
From State | To State | Read | Write | Move Head |
1 | 2 | a | A | Right |
2 | 2 | a | a | Right |
2 | 2 | B | B | Right |
2 | 3 | b | B | Left |
3 | 3 | B | B | Left |
3 | 5 | A | A | Right |
3 | 4 | a | a | Left |
4 | 4 | a | a | Left |
4 | 1 | A | A | Right |
5 | 5 | B | B | Right |
5 | HALT | /\ | /\ | Right |
We can trace the behaviour of this machine
on the tape aabb, as follows:
State | Tape Contents |
1 | aabb |
2 | Aabb |
2 | Aabb |
3 | AaBb |
4 | AaBb |
1 | AaBb |
2 | AABb |
2 | AABb |
3 | AABB |
3 | AABB |
5 | AABB |
5 | AABB |
5 | AABB/\ |
HALT | AABB/\ /\ |
Trace the behaviour of this machine on
the tape aaabb.
Back
to Topic 6
When designing a Turing Machine torecognise
some language, it is usually necessary to write markers to the tape so
that the machine can scan up or down the tape for some pattern of symbols and
then return to the position it started from.
That was the purpose of the As and Bs in the TM for anbn
above.
Such markers can often be thought of as 'brick walls' that fence off some section
of the tape being processed so that the TM 'bounces' off them as it moves up
and down the tape.
Often, we need to INSERT a marker symbol on the tape at exactly the point
where the tape head is currently located without overwriting the symbol already
there. This involves shifting all the symbols after the current tape
head position one position to the right to make room for the marker, leaving
contents of the tape before that position unchanged.
The part of the TM program that achieves this effect is independent of the rest
of the program.
It is an independent subprogram which, once written, can be incorporated
into any other TM program (with an appropriate tape alphabet) by indicating
where we want it to be invoked and what symbol we want it to insert.
Symbolically, the call to INSERT, say, the symbol a would
appear in the calling TM as
If this call to INSERT was made when the tape and its head was in the
condition, say:
aabbaa
then the condition after its call would be
aababaa
The TM for the subprogram INSERT
a, with the alphabet {a, b}, looks like this:
The following TM is supposed to accept
all words with a double a in them somewhere.
This TM exhibits the following, rather problematic, behaviour:
Unlike an FSA or a PDA, a TM cannot just
run out of input in some intermediate state.
There are always infinitely many blanks on a tape after the meaningful input
has been exhausted.
Every TM T over the alphabet S divides the set of strings S* into three classes:
ACCEPT(T): the set of all strings leading to a HALT state. This is the language recognised by T.
REJECT(T): the set of all strings that cause T to crash during execution by being in a state that has no exit arc for the symbol currently under the tape head.
LOOP(T): the set of all other strings, that is, strings that loop forever while running on T.
Remember the Chomsky classification:
Languages that are accepted by FSAs are called regular languages.
Languages that are accepted by PDAs are called context-free languages.
What can we say about the class of languages accepted by TMs?
A language L over the alphabet S is called recursively enumerable (r.e.) if there is a TM T that accepts every word in L and either rejects or loops for every word in L'.
We have seen that, for every TM,T, which runs on strings from the alphabet S,
S* = ACCEPT(T) + LOOP(T) + REJECT(T)
If we denote by L' the complement of a language, L, over its alphabet S (that is, the set difference S* - L), we can rewrite the condition in the defintion of r.e. as
ACCEPT(T) = L and
REJECT(T) + LOOP(T) = L'
A language L over the alphabet S is called recursive if there is a TM T that accepts every word in L and rejects every word in L', that is:
ACCEPT(T) = L and
REJECT(T) = L' and
LOOP(T) = ØNote: Turing used the word recursive because he believed that any set defined by a recursive definition could be defined by a TM.
There is a subtle difference between languages
that are recursive and those that are recursively enumerable (r.e.).
A TM might never reach a HALT state on an r.e. language, whereas it is guaranteed
to do so for a recursive one.
Back
to Topic 6
In our earlier discussions of FSAs and PDAs, and of their respective language classes, we addressed two separate, but related, issues:
The answers to both these theoretical questions are important in practice.
The first provides the foundations for the important technology of language processing.
Although corresponding transformation systems
exist for TMs and the recursive languages, no language processing technology
uses them, becuase TM algorithms are not very effective when implemented as
computer programs.
No software technology is founded on the theory of Turing Machines!
So why do we study them?
The answer lies in the second of the issues addressed above.
The Turing Machine is a model of computation in which the issue of computability
itself can be studied.
If we can prove that some language cannot be recognised by a TM, then that language
represents a function that cannot be computed at all.
We can therefore use the TM to study the limits of computability, which
we will address in Topic
10.
Meanwhile, we will turn our attention to
the question of computational complexity, which asks how hard
it is to compute certain functions.
Back
to Topic 6
Next
Topic
If you have comments or
suggestions, email to author at b.cohen@city.ac.uk
or me Vid-Com-Ram
/ members.tripod.com/bummerang
หมายเหตุ : เอกสารเวปหน้านี้นำมาจากมหาวิทยาลัยแห่งหนึ่งในประเทศอังกฤษ
เป็นหลักสูตรคล้ายคลึงกับ CT313 นำมาเพื่อเป็นเอกสารเปรียบเทียบและอ้างอิง มิได้หวังผลประโยชน์ใดๆ
และขอบอกว่าเค้ามีลิขสิทธิ์นะ