# Turing Theory Turing Machine A Turing Machine denoted

- Slides: 8

Turing Theory

Turing Machine • A Turing Machine denoted by TM, is a collection of six things. – An alphabet of input letters – A TAPE divided into a sequence of numbered cells each containing one character or a blank. The input word is presented to the machine one letter per cell beginning in the leftmost cell called cell i. The rest of the TAPE is initially filled with blanks

Turing Machine • A TAPE HEAD that can in one step – read the contents of a cell on the TAPE – replace it with some other character, and – reposition itself to the next cell to the right or to the left of the current. • Moving left at cell i makes the machine crash • An alphabet Г of characters that can be printed on the TAPE by the TAPE HEAD. This can include – Printing a blank means erasing and blank is not included as a letter in the alphabet Г

Turing Machine • A finite set of states including exactly one START state from which the execution begins – Start state can be re-entered during execution at a later stage. • A program, which is a set of rules that tells on the basis of a current state and the letter the TAPE HEAD has just read – how to change states – what to print on the TAPE and – where to move the TAPE HEAD – The program is depicted as a collection of directed edges connecting the states. Each edge is labeled with a triplet of information (letter, direction) • The first letter is the character read from the cell. The second is the one that is to be printed and direction is L or R i. e. the direction in which the TAPE HEAD will move

Turing Machine (a, a, R) (b, b, R) 2 START 1 3 HALT 4 (∆, ∆, R) (b, b, R)

TM for even

Turing Machine n n a b (a, a, R) (B, B, L) (B, B, R) (a, , A, R) START 1 2 3 (b, B, L) 4 (A, A, R) (∆, ∆, R) HALT 4 2 (A, A, R) (a, a, L)

TM: an bn an