Theory of Computation & Computer Graphics β Turing Machine, NEC licence examination syllabus (Nepal Engineering Council).
Notations of Turing Machine
Three ways to write down a machine, and the notation for a computation in progress.
π Where this lives: The instantaneous description β a snapshot of the entire machine state as a single string β is the same idea as a core dump or a debugger's stack frame. When a program crashes and the system writes out registers, program counter and memory contents, it is producing exactly this: a complete configuration from which execution could in principle be resumed. The theoretical notation and the practical debugging artefact are the same concept. Search "instantaneous description Turing machine configuration".
Describing the machine
THREE EQUIVALENT NOTATIONS, chosen by convenience.
ββ 1. THE FORMAL 7-TUPLE βββββββββββββββββββββββββββββββββββ
M = (Q, Ξ£, Ξ, Ξ΄, qβ, B, F)
Used when the machine must be reasoned about rather than
executed. It is the notation for proofs.
ββ 2. THE TRANSITION TABLE βββββββββββββββββββββββββββββββββ
Rows are states, columns are tape symbols, and each entry
gives the triple (next state, symbol written, direction).
FOR THE aβΏbβΏ MACHINE OF THE LAST TOPIC:
STATE β a β b β X β Y β B
βββββββΌββββββββββββΌββββββββββββΌββββββββββββΌββββββββββββΌββββββ
qβ β (qβ,X,R) β β β β β (qβ,Y,R) β ACC
qβ β (qβ,a,R) β (qβ,Y,L) β β β (qβ,Y,R) β β
qβ β (qβ,a,L) β β β (qβ,X,R) β (qβ,Y,L) β β
qβ β β β β β β β (qβ,Y,R) β ACC
A DASH MEANS NO TRANSITION IS DEFINED, and the machine
HALTS AND REJECTS. This is how a table encodes rejection
without a separate reject state.
NOTE THAT THE TABLE IS EXACTLY THE FUNCTION Ξ΄ WRITTEN OUT,
and reading it row by row is how one executes the machine
by hand.
ββ 3. THE TRANSITION DIAGRAM βββββββββββββββββββββββββββββββ
States as circles, transitions as arrows labelled
X / Y , D
meaning "reading X, write Y, move D". A self-loop labelled
a/a,R means "skip over a's, moving right" β the commonest
idiom in Turing machine diagrams.
DIAGRAMS ARE READABLE FOR SMALL MACHINES AND USELESS FOR
LARGE ONES, which is why serious constructions are given as
tables or as high-level descriptions.
ββ 4. HIGH-LEVEL DESCRIPTION βββββββββββββββββββββββββββββββ
In practice, and in most examinations beyond the elementary
level, machines are described in structured English:
"On input w:
1. Scan right to find the first unmarked a; if none,
go to step 4.
2. Mark it X and scan right for the first unmarked b.
If none is found, REJECT.
3. Mark it Y, return to the leftmost X, and repeat
from step 1.
4. Scan right; if only Y's and then a blank remain,
ACCEPT, otherwise REJECT."
THIS IS LEGITIMATE AND STANDARD. By the Church-Turing
thesis, any such description can be turned into a formal
machine, and writing out the states adds no insight. THE
SKILL BEING EXAMINED IS USUALLY THE ALGORITHM, NOT THE
BOOKKEEPING β though a question that explicitly asks for a
transition table expects one.
ββ THE THREE LEVELS OF DESCRIPTION, named ββββββββββββββββββ
FORMAL β the 7-tuple or full transition table
IMPLEMENTATION β prose describing head movements and tape
contents, without listing states
HIGH-LEVEL β prose describing the algorithm, ignoring
the tape entirely
ALL THREE ARE ACCEPTED IN PROOFS. Choosing the highest level
that still makes the argument clear is a mark of a good
answer.
Describing a computation
ββ THE INSTANTANEOUS DESCRIPTION (ID) ββββββββββββββββββββββ
A single string capturing the ENTIRE state of the machine:
Ξ± q Ξ²
Β· Ξ± is the tape content strictly LEFT of the head
Β· q is the current state
Β· Ξ² is the tape content FROM the head rightward
Β· THE HEAD IS ON THE FIRST SYMBOL OF Ξ²
Β· Infinite blanks beyond the written portion are omitted
EXAMPLES on the aβΏbβΏ machine:
qβ aabb start: head on the first a
X qβ abb one a marked, head on the second
X qβ aYb returning leftward
XXYY qβ all marked, head at the trailing blank
WHY THE HEAD POSITION IS ENCODED BY THE POSITION OF q IN THE
STRING: this makes an ID a plain string over Ξ βͺ Q, which is
essential later β the universal Turing machine must READ IDs
as data, and a string is the only thing a tape can hold.
ββ THE MOVE RELATION βββββββββββββββββββββββββββββββββββββββ
Write IDβ β’ IDβ for "one step", and β’* for "zero or more".
FOR A RIGHT MOVE, Ξ΄(q, X) = (p, Y, R):
Ξ± q X Ξ² β’ Ξ± Y p Ξ²
the head symbol X becomes Y, and q moves rightward past it.
FOR A LEFT MOVE, Ξ΄(q, X) = (p, Y, L), with Z the symbol
immediately left of the head:
Ξ± Z q X Ξ² β’ Ξ± p Z Y Ξ²
q moves leftward past Z, and X has become Y.
THE LEFT-MOVE CASE IS THE ONE STUDENTS GET WRONG β note that
the symbol WRITTEN (Y) stays where it was, while the STATE
marker jumps to the left of Z.
ββ A COMPUTATION AS A SEQUENCE OF IDs ββββββββββββββββββββββ
The full run on aabb, written as IDs:
qβaabb β’ Xqβabb β’ Xaqβbb β’ XqβaYb β’ qβXaYb
β’ XqβaYb β’ XXqβYb β’ XXYqβb β’ XXqβYY
β’ XqβXYY β’ XXqβYY β’ XXYqβY β’ XXYYqβ
THIRTEEN IDs β one more than the twelve moves, since the
first ID is the starting configuration.
THE FINAL ID HAS qβ AT THE END WITH THE HEAD ON A BLANK,
which is the accepting condition for this machine.
NOTE WHAT AN ID SEQUENCE IS: A COMPLETE, VERIFIABLE RECORD OF
A COMPUTATION. Each step can be checked against Ξ΄
independently of every other step, which is precisely the
property that makes the later reduction proofs work β a
computation history can be treated as a string and reasoned
about with grammars.
ββ ACCEPTANCE STATED IN ID NOTATION ββββββββββββββββββββββββ
L(M) = { w β Ξ£* : qβw β’* Ξ± p Ξ² for some p β F }
and three possible outcomes on any input:
ACCEPT β an accepting state is reached
REJECT β the machine halts with no applicable transition
and is not in an accepting state
LOOP β the machine never halts
THE THIRD OUTCOME IS WHAT DISTINGUISHES THIS MODEL FROM
EVERYTHING EARLIER, and the notation must be able to express
it: an infinite sequence of IDs with no final one.
ββ CONVENTIONS THAT VARY BETWEEN TEXTBOOKS βββββββββββββββββ
Worth knowing, since an exam may use any of them:
Β· TAPE INFINITE IN ONE DIRECTION (the usual convention) or
BOTH. Equivalent β a two-way tape is simulated by folding
it onto two tracks of a one-way tape.
Β· HALTING STATES: some treatments use explicit q_accept and
q_reject states and require the machine to halt only in
those; others let an undefined transition mean rejection,
as above.
Β· A STAY-PUT direction S in addition to L and R. Adds no
power: replace each S move with a move right followed by a
move left.
Β· THE INPUT'S POSITION: normally the head starts on the
leftmost input symbol, with blanks everywhere else.
STATE YOUR CONVENTION AT THE START OF AN ANSWER. Examiners
accept any consistent one; they do not accept a machine whose
behaviour depends on which convention the reader assumes.
Encoding the head's position by where q sits inside the string is not a stylistic choice. It makes an instantaneous description a plain string over Ξ βͺ Q β and that is what later allows a universal Turing machine to read a computation as data, since a tape can hold nothing but strings.
π Go further: An ID sequence is a complete and independently verifiable record of a computation: each step can be checked against Ξ΄ without reference to any other step. This property is what makes the later undecidability proofs work β a computation history becomes a string that a grammar or another machine can reason about, which is how questions about machine behaviour get reduced to questions about languages. The same idea appears in modern cryptography as verifiable computation, where a server proves it ran a program correctly by producing a certificate derived from its execution trace. Search "computation history proof technique verifiable computation".
π‘ Exam angle: be able to present a machine as a transition table, a diagram and a high-level description, and know that a dash in the table means halt-and-reject. Master the instantaneous description Ξ±qΞ² and the move relation for both directions β the left-move form Ξ±ZqXΞ² β’ Ξ±pZYΞ² is the examinable detail. Be ready to write a full computation as a sequence of IDs. State the three possible outcomes including loop, and note the conventions that vary between textbooks, declaring which you are using.
Syllabus points
Transition function, moves
Instantaneous description (ID)
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.