EE 109 Unit 20 Theoretical Computer Science and Turing Machines - - PowerPoint PPT Presentation

ee 109 unit 20 theoretical computer science and turing
SMART_READER_LITE
LIVE PREVIEW

EE 109 Unit 20 Theoretical Computer Science and Turing Machines - - PowerPoint PPT Presentation

1 2 EE 109 Unit 20 Theoretical Computer Science and Turing Machines Credit: Adapted from Gaurav Sukhatme's CSCI 109 Lecture Slides THEORETICAL COMPUTER SCIENCE 3 4 Computability State Machine Review Theoretical Computer Science


slide-1
SLIDE 1

1

EE 109 Unit 20 – Theoretical Computer Science and Turing Machines

2

THEORETICAL COMPUTER SCIENCE

Credit: Adapted from Gaurav Sukhatme's CSCI 109 Lecture Slides

3

Computability

  • Theoretical Computer Science

– The study of ______ can be computed and how __________________________ – Uses __________________ models – Tries to generalize computers so that what is proven is applicable to _________ computer system no matter its speed, # of processors, etc.

4

State Machine Review

  • Recall that a state machine is defined by a 6-tuple:

– A set of possible input values – A set of possible states – A set of possible outputs – An initial state – A transition function: {States x Inputs} -> the Next state – An output function: {States x Inputs} -> Output value(s)

S0

Out=False

S1

Out=False

S2

  • ut=True

Input=1 Input=1 Input=0 Input=1 Input=0 Input=0 On Reset

slide-2
SLIDE 2

5

Formal Definition

  • Mathematically, a state machine consists of:

– A set of possible input values: {0, 1} – A set of possible states: {S0, S1, S2} – A set of possible outputs: {False, True} – An initial state = S0 – A transition function:

  • {States x Inputs} -> the Next state

– An output function:

  • {States x Inputs} -> Output value(s)

A

Out=False

B

Out=False

C

  • ut=True

Input=1 Input=1 Input=0 Input=1 Input=0 Input=0 On Reset

Inputs State 1 S0 S0 S1 S1 S0 S2 S2 S0 S2

State Transition Function Output Function

Inputs State 1 S0 False False S1 False False S2 True True

6

Limits of FSM's

  • Finite state machines have certain _______________

– Why? Because they have a __________________________ of states!

  • Problem: Given an arbitrary length string of A's and B's

determine if there is an __________ number of A's and B's

– Key is "_____________________ length" – Show execution for "AABABBBBA"

Equal 1 Extra A 1 Extra B 2 Extra As 2 Extra B's

A A A A B B B B A A B B initial

7

Turing Machine

  • A Turing Machine was a _____________ machine /

mathematical model of a machine proposed by Alan Turing

  • It consisted of a controller which was an FSM and an

"___________" roll of tape marked into distinct squares with input symbols in each square

– The tape was like _______________ and so we could now process an arbitrarily long input sequence with a finite set of states because we could use the tape to store results – It had a read/write _______________ that could read and write the symbol in the ___________ tape square

8

Formal Definition of a Turing Machine

  • Set of input symbols
  • Set of output symbols
  • Set of states
  • Initial state and initial square location
  • State transition function {State x Input => Next State}
  • Action Function {State x Input => Action}

– At each state the Turing machine could

  • ______________ a symbol from the current square of the tape

– Based on the state and the symbol read it could then

  • ___________ a symbol from the tape
  • ___________ a symbol onto the tape (erasing the old symbol)
  • __________________

– ..and..

  • Move the tape __________ or ________ or not move {R, L, N}

A A B A B B B

Turing Machine

slide-3
SLIDE 3

9

Sample Turing Machine

  • Turing Machine to detect equal/unequal number of A's and B's
  • The machine works by making repeated passes through the

string, each time removing one A and one B. Eventually string is either empty (AEs = BEs) or something is leF (AEs G BEs)

  • The steps the machine takes…

– Start at beginning of string (left side) – Move right looking for either an A or B or end of string

  • If end of string found, number of AEs and BEs equal. Done.
  • If A or B found, replace it with an X.

– Continue to move right, looking for the other character or end of string

  • If other character is found replace it with an X, back to start of string, repeat.
  • If end of string reached (other character was NOT found), number AEs and BEs unequal.

Done.

10

Sample Turing Machine

  • Turing Machine to detect equal/unequal number of A's and B's

– Sample operation on "AAB"

Start

  • A

A B

  • A,RT
  • X

A B

  • A,RT
  • X

A B

  • Start

EQ A,Rt B,Rt UNEQ Lt Find First

'A','X',R 'B','X',R '-’,’-’,N '-’,’-’,N 'B','X',L 'A','X',L '-','-',R 'A','X',R 'B','X',R '-','-’,N {'A','X','B'}, '-',L {‘A’,'X’},-,R {‘B’,'X’},-,R 'X','-',R 11

TM Highlights

  • ________________________ a Turing machine is not fun
  • But ________________ a current computer can do, a Turing machine can do and

vice versa

  • We can use Turing machines to prove what current computers can't do

– What is computable? – It a Turing Machine can't do it, a computer as we know it today _____________ do it

  • Example of what isn't computable?

– ________________ Problem: Write a program that is given another program as input and determines if that program will eventually halt. – Turing proved this is not computable in a famous paper

  • Turing also proved that there is a Turing Machine that could take as input a

description of another Turing Machine and then emulate its operation

– _______________ Turing Machine – Forerunner of the "Stored Program Concept" (instructions & data are treated similarly)

  • If an algorithm is O(polynomial) on TM then it is also O(polynomial) on a

__________________ computer as well

– Modern computers just seek to increase performance

12

CENG

Pre-requisite structure

Your Future CENG Courses

EE 109L (3)

Intro to CENG

<< None >>

EE 277L (2)

Fundamentals of Digital Circuits << EE 109 >>

EE 154 (2)

  • Intro. to Logic Design

<< EE 109 >>

EE 254L (4)

Digital Sys. Design

<< EE 154 >>

EE 457 (3)

Computer Sys. Org. << EE 254L >>

EE 454L (4)

  • Intro. to SoC

<< EE 254L >>

EE 451 (3)

Parallel & Distributed << EE 355 or CSCI 104>>

CS 353 (3) or EE 450(3)

Networks

<< CS 350 >>

CS 350 (4)

Intro to OS

EE 477L (4)

VLSI

<< EE 277L, 254L >>

slide-4
SLIDE 4

13

Congratulations!!

  • You have learned a LOT this semester
  • You should be proud of yourself and what you've

designed, programmed, and built

  • This is just the beginning…you will learn how to

design all kinds of complex and exciting software and hardware systems

– SW and HW are integrally intertwined…the more you know about each the better engineer you will be

  • Stay curious! Don't be afraid to try, fail, then

debug