3
Construction of TMs Turing Machines as Acceptors: If we construct a turing machine that accepts a given language. Turing Machines as Transducers: If we construct a turing machine that computes a function. A Turing Machine can be constructed by drawing a suitable Transition Diagram(TD) or Transition Table(TT)or by writing suitable delta transitions(DT). Examples: 1. Construct a turing machine which accepts the language of aba over . Ans: a b a ... q0 qa=Halt; S=Stop; =blank Fig: Turing Machine for ‘aba’ Note:” q0 upon a, changes it to b, moves Right(R), and goes to q1” can be represented, -in TD as, and -in TT as, (q0,a) =(q1,b,R) Note: While writing transitions, change state only when it is absolutely required. That is, change state only when you want to redefine a transition in a different way.

Examples of Turing Machine Constructions

Embed Size (px)

DESCRIPTION

Examples of Turing Machines

Citation preview

Page 1: Examples of Turing Machine Constructions

Construction of TMsTuring Machines as Acceptors: If we construct a turing machine that accepts a given language.Turing Machines as Transducers: If we construct a turing machine that computes a function.

A Turing Machine can be constructed by drawing a suitable Transition Diagram(TD) or Transition Table(TT)or by writing suitable delta transitions(DT).

Examples:

1. Construct a turing machine which accepts the language of aba over . Ans:

a b a ...

q0

qa=Halt; S=Stop; =blankFig: Turing Machine for ‘aba’

Note:” q0 upon a, changes it to b, moves Right(R), and goes to q1” can be represented,

-in TD as, and

-in TT as, (q0,a) =(q1,b,R)

Note: While writing transitions, change state only when it is absolutely required. That is, change state

only when you want to redefine a transition in a different way.

2. Construct a TM for the addition of two unary numbers.Ans: Let us consider 2+3. It can be represented on type in unary format as,

q0 To add these two unary numbers, we replace + with 1 and then, we remove last 1. Therefore, the corresponding transitions are:

Page 2: Examples of Turing Machine Constructions

where is the final

state.

3. Construct a TM for subtraction of two unary numbers. ie. f(a-b)=c where a >b.Ans: Let a=3 and b=2. Then the tape contains,

where is the final

state.