Deterministic Turing Machines

 
Deterministic Turing Machines
q
f
 
Constituents
 
Infinite tape
Head
Transition diagram
 
 
q
0
q
1
 
Unique accept state.
Also no arrows are
coming out.
 
Formal definition
 
A Deterministic Turing Machine (DTM) is a sextuple
(Q, 
Σ, Γ, δ, 
q
0
, q
f
) where:
Q is a finite set of states
Σ 
is the input alphabet
Γ 
is the tape alphabet,
 Σ 
Γ
There is a special blank symbol □ in 
Γ
q
0
 is the start state
q
f
 is the final state
δ: 
Q x 
Γ
 → Q x 
Γ 
x {L,R,S}, where L stands for Left,
R stands for Right and S stands for Stay.
 
Formal definition (cont.)
 
δ(
q , 
a
) = (q’ , 
b
, L) means: “if you are in state q
and the head in the tape points to symbol 
a
then move to state q’, replace symbol 
a
 with
symbol 
b
 in the tape and move the head one
position to the left”
Illustration
:
a
 
 
q
q‘
 
a
b
,L
 
 
 
head
b
 
 
q
q‘
 
a
b
,L
 
 
 
head
 
Determinism
 
Determinism means that I have no choices!
The transition function 
δ
 sends pair 
(
q,
 
a
)
 to at
most one triple (q’, 
b
, x) (in other words there
is at most one arrow from state q reading
symbol 
a 
–maybe there are no such arrows).
No 
ε-
moves are allowed (I must read
something in the tape in order to change
state).
 
Machine’s special status
 
Start: Be at initial state , the tape contains only
the input and the head points to the first
(leftmost symbol of the input)
Accept: Reach the accept state. The machine
stops the computation and accepts (notice that
part of the input might be unread).
Reject: Be in a state q (other than the accept
state), read symbol 
a 
and find no outgoing arrows
under symbol 
a.
Loop for ever: Enter a subset of states which
repeat for ever (different than the “reject case”)
 
Machine’s special status
 
Start:
a
b
a
a
 
 
 
head
b
q
0
q
1
 
a
b
,R
 
 
Machine’s special status
 
Accept:
b
b
a
a
 
 
 
head
b
q
f
 
 
Machine’s special status
 
Reject:
b
b
a
a
 
 
 
head
b
q
q’
 
a
b
,R
 
 
 
Machine’s special status
 
Loop:
b
b
a
a
 
 
 
head
b
q
 
b
b
,S
 
 
Recursive Languages
 
A language is recursive (or decidable, or
computable) if there is a Turing Machine
which:
Accepts for every string in the language
Rejects for every string not in the language
 
Example
 
Find a DTM that computes the language
 
L = {a
n
b
n
 : n ≥ 0}.
High level program:
Repeat
Erase an a.
Pass along the rest of as.
Erase a b
Pass along the rest of bs.
Go to the beginning of the input.
Until either the whole input is erased (accept) or
you find unmatched as or bs (reject).
 
Example
 
Find a DTM that computes the language
 
L = {a
n
b
n
 : n ≥ 0}.
Answer:
q
0
q
1
q
2
q
3
 
a → x
 
, R
 
b → x
 
, R
 
x → x
 
, R
 
a → a , R
x → x , R
 
b → b , R
 
a → a , L
b → b , L
x → x , L
 
□ → □ , L
 
□ → □ , R
 
□ → □ , R
 
Testing
 
Test the machine for several possible inputs to see if it
works as it should.
Test inputs:
ε (
it should accept)
aaabbb (it should accept)
aaabb (it should reject)
aabbb (it should reject)
aabba (it should reject)
(See file dtm_example.pptx).
 
Slide Note
Embed
Share

Detailed explanation of Deterministic Turing Machines, their constituents, formal definition, determinism, and special statuses such as Start, Accept, Reject, and Loop. Includes visual representations and key concepts of deterministic Turing machines.

  • Turing Machines
  • Determinism
  • Computation
  • State Transition
  • Machine Status

Uploaded on Jul 29, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Deterministic Turing Machines

  2. Constituents Infinite tape Head Transition diagram q1 q0 qf Unique accept state. Also no arrows are coming out.

  3. Formal definition A Deterministic Turing Machine (DTM) is a sextuple (Q, , , , q0, qf) where: Q is a finite set of states is the input alphabet is the tape alphabet, There is a special blank symbol in q0is the start state qfis the final state : Q x Q x x {L,R,S}, where L stands for Left, R stands for Right and S stands for Stay.

  4. Formal definition (cont.) (q , a) = (q , b, L) means: if you are in state q and the head in the tape points to symbol a then move to state q , replace symbol a with symbol b in the tape and move the head one position to the left Illustration: a b head head q q q q

  5. Determinism Determinism means that I have no choices! The transition function sends pair (q, a) to at most one triple (q , b, x) (in other words there is at most one arrow from state q reading symbol a maybe there are no such arrows). No -moves are allowed (I must read something in the tape in order to change state).

  6. Machines special status Start: Be at initial state , the tape contains only the input and the head points to the first (leftmost symbol of the input) Accept: Reach the accept state. The machine stops the computation and accepts (notice that part of the input might be unread). Reject: Be in a state q (other than the accept state), read symbol a and find no outgoing arrows under symbol a. Loop for ever: Enter a subset of states which repeat for ever (different than the reject case )

  7. Machines special status Start: a b a a b head q1 q0

  8. Machines special status Accept: b b a a b head qf

  9. Machines special status Reject: b b a a b head q q

  10. Machines special status Loop: b b a a b head q

  11. Recursive Languages A language is recursive (or decidable, or computable) if there is a Turing Machine which: Accepts for every string in the language Rejects for every string not in the language

  12. Example Find a DTM that computes the language L = {anbn: n 0}. High level program: Repeat Erase an a. Pass along the rest of as. Erase a b Pass along the rest of bs. Go to the beginning of the input. Until either the whole input is erased (accept) or you find unmatched as or bs (reject).

  13. Example Find a DTM that computes the language L = {anbn: n 0}. Answer: a a , R x x , R x x , R b b , R a x , R b x , R q0 q1 q2 , L qf q3 a a , L b b , L x x , L

  14. Testing Test the machine for several possible inputs to see if it works as it should. Test inputs: (it should accept) aaabbb (it should accept) aaabb (it should reject) aabbb (it should reject) aabba (it should reject) (See file dtm_example.pptx).

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#