0% found this document useful (0 votes)
14 views21 pages

The Turing Machine Presentation TOA

The Turing Machine presentation TOA

Uploaded by

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

The Turing Machine Presentation TOA

The Turing Machine presentation TOA

Uploaded by

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

THE

TURING
MACHINE
Sameer Ahmad
The big question behind Turing
Machine
Is there any step-by-step way to determine if a logical statement is
true or false??

Suppose a truth-telling machine.


You give it a sentence, and it tells true or false about a given statement.
Suppose you give it the statement, “This statement is false”.
If the machine says true, then there is a panga.
If it says false, a bigger panga.

This statement is false. Truth Teller Machine ??


Turing Machine by Alan Turing
Alan Turing saw the computers at his time, and devised a step by step method of
how they can solve any problem, no guessing, no intuition, just following the
rules.

These were the computers he


noticed.
Step by Step procedure
Let’s go through the step by step procedure of a Turing machine.
It has these parts.

Tape

_ 0 1 0 0 0 1 0 _ _

Head

State Diagram
Machine as Tuples

M = (Q, Σ, Γ, δ, q₀, q_accept, q_reject)


Q = finite set of states
Σ = finite set of input symbols (input alphabet, excluding the blank symbol)
Γ = finite set of tape symbols (tape alphabet, includes blank symbol)
δ = transition function:
δ : Q × Γ → Q × Γ × {L, R}, such as (q0, 1) → (q0, 0, L)
It maps a current state and symbol to:
q₀ = start state, where the machine begins
q_accept = accept state, where computation halts with acceptance
q_reject = reject state, where computation halts with rejection
Let’s solve a problem
You all know how to find the 2’s complement of a binary number, let’s design a Turing
Machine for that.
We have a Tape, with a binary number on it.` 0/0,L 0/1,L
1/1,L
q0 q1
_ 0 1 0 0 0 1 0 _ _ 1/0,
L
_/_,N
_/_,N

Current State: q0 q_r q_a


Let’s solve a problem
0/0,L 0/1,L
1/1,L
_ 0 1 0 0 0 1 0 _ _ q0 q1
1/0,
L
_/_,N
_/_,N
Current State: q0

q_r q_a
Let’s solve a problem
0/0,L 0/1,L
1/1,L
_ 0 1 0 0 0 1 0 _ _ q0 q1
1/0,
L
_/_,N
_/_,N
Current State: q1

q_r q_a
Let’s solve a problem
0/0,L 0/1,L
1/1,L
_ 0 1 0 0 1 1 0 _ _ q0 q1
1/0,
L
_/_,N
_/_,N
Current State: q1

q_r q_a
Let’s solve a problem
0/0,L 0/1,L
1/1,L
_ 0 1 0 1 1 1 0 _ _ q0 q1
1/0,
L
_/_,N
_/_,N
Current State: q1

q_r q_a
0/0,L 0/1,L

Let’s solve a problem q0


1/1,L
q1
1/0,
_/_,N L
_ 0 1 1 1 1 1 0 _ _

q_a
Current State: q1
Let’s solve a problem
0/0,L 0/1,L
1/1,L
_ 0 0 1 1 1 1 0 _ _ q0 q1
1/0,
L
_/_,N
_/_,N
Current State: q1

q_r q_a
Let’s solve a problem
0/0,L 0/1,L
1/1,L
_ 1 0 1 1 1 1 0 _ _ q0 q1
1/0,
L
_/_,N
_/_,N
Current State: q1

q_r q_a
0/0,L 0/1,L

Let’s solve a problem q0


1/1,L
q1
1/0,
_/_,N L
_ 1 0 1 1 1 1 0 _ _

q_a
Current State: q_accept (HALT)
0/0,L
State Diagram as Table
0/1,L

1/1,L
q0 q1
1/0,L
_/_,N
_/_,N

q_r q_a

State Input:0 Input:1 Input:_


Next Write Move Next Write Move Next Write Move
State State State

q0 q0 0 L q1 1 L q_r _ N
q1 q0 1 L q1 0 L q_a _ N
State Diagram as Input
State Input:0 Input:1 Input:_
Next Write Move Next Write Move Next Write Move
State State State

q0 q0 0 L q1 1 L q_r _ N
q1 q0 1 L q1 0 L q_a _ N

This State Diagram can be written as,


(q0, 0)  (q0, 0, L) (q1, 0)  (q1, 1, L)

(q0, 1)  (q1, 1, L) (q1, 1)  (q1, 0, L)

(q0, _)  (q_reject, _, N) (q1, _)  (q_accept, _, N)


Machine as Input to another Machine
(q0, 0)  (q0, 0, L) (q1, 0)  (q1, 1, L)

(q0, 1)  (q1, 1, L) (q1, 1)  (q1, 0, L)

(q0, _)  (q_reject, _, (q1, _)  (q_accept, _, N)


N)
This can be written on tape as,

0 0 0 0 L, 0 1 1 1 L, 0 _ R _ N, 1 0 1 1 L, 1 1 1 0 L
The Halting Problem
A Universal Turing Machine can take the machine states and its tape contents as its
input.
Suppose, we build a machine, that takes any machine M and its tape x as input.
Then, tells in finite time, if the machine will halt or not.

Machine
M

Halt Checker Yes / No

Tape x
New Machine
Now, we make a machine D that uses the Halt Checker machine. If it

Machine
Yes / No
M
Halts
Halt Checker No
Operation

Tape x Yes
Loops
Foreve
Machine D r
Machine as Input
What if the Machine D itself is given as input to Machine D, and the Machine D as its tape content.

Machine
Yes / No
D
Halts
Halt Checker No

Machine Operation
D Yes
Loops
Foreve
Machine D r
Contradiction
Such as machine is never possible. So, we can never tell in finite time for all machines, if they will halt
or loop forever.

You might also like