Download presentation

Presentation is loading. Please wait.

Published byBrendon Coxe Modified over 2 years ago

1
CS 461 – Oct. 21 Begin chapter 3 We need a better (more encompassing) model of computation. Ex. { 1 n 2 n 3 n } couldn’t be accepted by PDA. –How could any machine accept this language? –Somehow need to check 1s, 2s and 3s at same time. –We should also be able to handle 1 n 2 n 3 n 4 n, etc.

2
Turing Machine 3 rd model of computation –Alan Turing, 1936 –Use “tape” instead of stack –Can go left or right over the input! Every TM has: –Set of states, including 1 start and 1 accept state –Input alphabet –Tape alphabet, including special “blank” symbol –Transition function δ (state, input) = (state, output, direction)

3
The tape and δ Tape is infinite in both directions –Blanks straddle the input on the tape. Begin reading at leftmost input symbol. As soon as you enter accept state, halt. –You don’t have to read all the input. δ (state, input) = (state, output, direction) –You may change state. –You may change the symbol that’s on the tape. –The “direction” is either L or R.

4
States A TM has at least 3 states –One accept state –One reject state –Ordinary states that we describe in our transition table, beginning with a start state. We don’t need transitions for the accept or reject states. Sometimes a transition “doesn’t matter” because we can’t be in that situation. –Ex. If the leftmost symbol isn’t blank, then the rightmost symbol can’t be blank. You can just go to reject state.

5
Example A TM to accept the language 0(0+1)*1. –Make sure first symbol is 0. Else reject. –Keep moving right until you see blank. –After blank, go left. If 1, accept. Else reject. StateInput 0Input 1Input _ s1s2, 0, Rreject s2s2, 0, Rs2, 1, Rs3, _, L s3reject Doesn’t matter

6
Let’s trace 011 StateInput 0Input 1Input _ s1s2, 0, Rreject s2s2, 0, Rs2, 1, Rs3, _, L s3reject Doesn’t matter TapeTransitionEffect [s1]011s2,0,R0[s2]11 0[s2]11s2,1,R01[s2]1 01[s2]1s2,1,R011[s2] 011[s2]_s3,_,L01[s3]1_ 01[s3]1

7
Input output TMs can easily modify the input on the tape. Thus we can have useful output! Example: let’s flip the bits of our binary input, and automatically accept. –Note: the reject state is unreachable. StateInput 0Input 1Input _ s1s1, 1, Rs1, 0, R

8
Infinite loop It’s possible for a TM to have an infinite loop. We say that the TM “loops.” In this case, it doesn’t accept or reject its input. Simple example: From start state, go left on any input! StateInput 0Input 1Input _ s1s1, 0, Ls1, 1, Ls1, _, L

9
Mystery #1 What does this TM do? Assume s1 is the start state, and unspecified transitions are crash. StateInput 0Input 1Input _ s1s2, 1, R s2s1, 0, R Hint: notice we never move left. This means it doesn’t matter what we write on tape.

10
Mystery #2 Can you figure out what this machine does? –See something wrong? StateInput 0Input 1Input _ s1s1, 0, Rs2, 1, Rs1, _, R s2 s2, 1, Rs2, _, R

Similar presentations

Presentation is loading. Please wait....

OK

Universal Turing Machine

Universal Turing Machine

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on biotechnology in india Ppt on area of plane figures worksheets Ppt on ashoka the great emperor Ppt on tamper resistant packaging Ppt on national education day speech Ppt on call center management Ppt on world health organization Ppt on mammals and egg laying animals for kids Ppt on total internal reflection microscopy Ppt on network switching methods