Toc L13
Toc L13
COMPUTABILITY THEORY
COMPUTABILITY & TURING MACHINE
ì Following FA, PDA, Regular & Context-free language towards Computability
& Turing Machine (TM).
ì Computability Theory, History.
ì Turing Machine
ì Informal Description
ì Input/output convention
ì Abstraction
ì Implementation level description
ì Low level description
ìFormal Definition
ìState Diagram
PushFinite
Down Automaton
Automaton (FA)
(PDA)
Computational
ComputationalModel
Model
withwith
REGULAR
additional
limited stack
memorymemory
can be
can
used
be
LANGUAGES usedtoto
compute
compute these
these
languages.
languages.
Can be decided by a DFA.
CONTEXT FREE Regular language is member of
LANGUAGES CFL.Can be decided by an NFA.
CanCan
be generated
be expressed
by CFG.
by a
regular expression.
Pushdown
Finite automata
automata
is used in text
is processing,
used in
programming
pattern matching,
languages, parity
AI tools,
checking,
Natural
Can be recognized by PDA.
Language
compilers, and
processing,
hardware design,
parsingetc.(math Regular language is closed
expressions), etc. CFGunder
can beregular
decided
operations.
by PDA.
CSC3113: Theory of Computation
NEXT: WE WILL LEARN
ì Can be decided by a Turing Machine
(TM).
ì A model of computation that is –
REGULAR
ì General purpose: Captures all
LANGUAGES algorithms that can be implemented in
any programming language.
ì Mathematically simple: We can hope to
CONTEXT FREE prove that things are not computable in
this model.
LANGUAGES
COMPUTABLE ì Turing Machine is deterministic
ì Must reach Accept/Reject state
ì Halts once it reaches Accept/Reject state
ì Might loop forever
ì At every step, the head of the Turing Machine named M reads a letter
xi from the one-way infinite tape.
ì Depending on its current state and the letter xi being pointed by the
head of the TM –
ì reads/writes a letter from/on the tape,
ì moves its read/write head left or right, and
ì jumps to a new state.
ì Initially, the tape contains the input wÎS*, padded with blanks “_”,
and the TM is in start state q0.
ì During the computation –
ì the head moves left and right (but not beyond the leftmost point),
ì the internal state of the machine changes, and
ì the content of the tape is rewritten.
FINITE STATE
q0 qq13 q2
CONTROL
Head
AI N N
P U T …
Infinite Tape
MOVE
READREADright
0, WRITE
READ to
1,1WRITE
1, WRITE
READ
⌴, st alphabet
READ
#, MOVE
0,
MOVE WRITE
READ
0,MOVE
1, WRITE
READ
right1,1,MOVE
rightWRITE
READ
1,READ
WRITE
right
#, WRITE
right
0,
⌴,MOVE
MOVE ⌴, 1,WRITE
rightright
1, MOVE
MOVE ⌴,right
MOVEright
left to ⌴
⌴
0 01 1 1# #0 01 1 ⌴
1 ⌴
We will always consider that the given input already has a blank symbol ⌴ at both
left and right of input. So, we will ignore these steps for our computation.
CSC3113: Theory of Computation
TESTING MEMBERSHIP IN B = { W#W | W Î {0,1}* }
ì Example: 011#011 ì The input always starts and ends with a blank symbol ⌴
ì The head initially points at the first input alphabet
ì Computing steps
1. READ (store) 1st alphabet, WRITE X,
2. (find #) MOVE right until READ #, If ⌴ found REJECT
3. (skip X) MOVE right while READ X
4. if current alphabet = stored alphabet, WRITE X, MOVE left to ⌴, else REJECT
5. (skip X) MOVE right while READ X
6. READ (store) current alphabet, if alphabet is not #, then continue step 2
7. If alphabet is #, (skip X) MOVE right while READ X,
8. If current alphabet ⌴ then ACCEPT otherwise REJECT
READ 0, WRITE ´,
MOVE
READright
1READ
(store), WRITE
READ
MOVE
READ
1(store), 0´right
WRITE
READ #, 1´READ
(match), WRITE WRITE
(match),WRITE
1(match), ´ ´,
MOVE
MOVE while
MOVEright
right ´ ´ MOVE
until
while READ MOVEright while
while ´ ´ ACCEPTEDREAD ⌴
MOVE
while READ ´ right
MOVE
MOVE toUntil
#´right
while #READ
, MOVE MOVE
while ´left
´MOVE
left
toto
⌴⌴left to ⌴
#
0 ´
⌴ ´ 1 ´
1 # ´
0 ´
1 ´
1 ⌴
CSC3113: Theory of Computation
FORMAL DEFINITION: TURING MACHINE (TM)
ìA Turing machine M is defined by a 7-tuple
(Q, S, G, d, q0, qaccept, qreject)
ì Q finite set of states
ì S finite input alphabet (without blank symbol “⌴”)
ì G finite tape alphabet with {⌴} È S Í G
ì d the transition function
d: Q\{qaccept, qreject} ´ G ® Q ´ G ´ {L,R}
ì q0 start state Î Q
ì qaccept accept state Î Q
ì qreject reject state Î Q
ì qaccept ≠ qreject
CSC3113: Theory of Computation
ì Sipser-Introduction to the Theory of Computation 3E, Computability.
ì Lewis, Papadimitriou-Elements of Theory of Computation, 2ed,
Turing Machine.
ì Hopcroft, Motwani, Ullman-Introduction to Automata Theory,
Languages, and Computations, Turing Machine.