chapter 1dcslab.snu.ac.kr/courses/ic2019s/lecture1.pdf · 1-8 turing machine mathematical model of...

36
Chapter 1 Welcome Aboard

Upload: others

Post on 19-Apr-2020

10 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Chapter 1Welcome Aboard

Page 2: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Abstraction

1-2Source: http://static.usnews.rankingsandreviews.com/images/Auto/izmo/365609/2014_hyundai_elantra_gt_dashboard.jpghttp://www.ridelust.com/wp-content/uploads/2012/12/Engine2.jpghttp://www.plugincars.com/sites/default/files/Volkswagen-Golf-Variant-twinDRIVE-under-the-hood.jpghttp://wpmedia.driving.ca/2015/02/img_4777.jpg?quality=70&strip=all&w=960&h=480&crop=1

Interface

Page 3: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Levels of Abstraction (Biological System)

1-3Source: https://media.studyisland.com/pics/40040_bio_organization.gif

Page 4: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Levels of Abstraction (Automotive System)

1-4Source: https://media.studyisland.com/pics/40040_bio_organization.gif

…part

system

sub-system

component

whole automobile

Page 5: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Levels of Abstraction (Computer)

1-5

Problems

Language

Instruction Set Architecture

Microarchitecture

Circuits

Devices

Algorithms

Hardware/Software Interface

Page 6: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

1-6

Page 7: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Universal Computing DeviceAll computers, given enough time and memory,are capable of computing exactly the same things.

1-7

= =EmbeddedProcessor Supercomputer

Source: http://images.anandtech.com/reviews/storage/Samsung/SSD830/_DSC2164.jpghttp://www.miscw.com/wp-content/uploads/2016/09/Samsung-Smartphone.jpghttp://koreatechblog.com/wp-content/uploads/2015/02/lg-ultrapc-gram-14zd950-gx58k-1157540_2.jpghttps://4.imimg.com/data4/CO/YS/MY-29352968/samsung-desktop-computer-500x500.jpghttp://oiger.de/wp-content/uploads/Bull-Supercomputer.jpg

Then what is the simplest possible computing device?

Page 8: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

1-8

Turing Machine

Mathematical model of a device that can performany computation – Alan Turing (1937)

Every computation can be performed by some Turing machine. (Turing’s thesis)

(그럼이세상에계산하지못하는것도있나? Yes…Halting Problem…We’ll discuss it later)

For more info about Turing machines, see

http://www.wikipedia.org/wiki/Turing_machine/

For more about Alan Turing, see

http://www.turing.org.uk/turing/

Page 9: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

1-9

A Turing Machine

............Tape

Read-Write headControl Unit

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 10: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

The Tape

............

Read-Write head

No boundaries -- infinite length

The head moves Left or Right

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 11: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

............

Read-Write head

At each transition (time step):1. Reads the symbol under

the Read-Write head2. Writes a symbol3. Moves Left or Right

(All the transitions are specified in the control unit)Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 12: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

............

Example:Time 0

a a cb

............Time 1

a b k c

1. Reads2. Writes

ak

3. Moves LeftSource: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 13: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Computation Example

The function yxyxf +=),( is computable

Turing Machine:

Input string: yx0 unary

Output string: 0xy unary

yx, are integers

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 14: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

à 0

0q

1 1 à1 1

x y

1! !Start

initial state

The 0 is the delimiter that separates the two numbers

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 15: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

à 0

0q

1 1 à1 1

x y

1! !

à 0

fq

1 à1

yx +

! 11

Start

Finish

accept state

initial state

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 16: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Execution Example:

11=x

11=yà 0

0q

1 1 à1 1

Time 0x y

Final Result

à 0

4q

1 1 à1 1yx +

(=2)

(=2)

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 17: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q

Turing machine for function

1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

yxyxf +=),(

Control Unit

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Initial state

accept state

Page 18: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

à 0

0q

1 1Time 0 à

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

1 1

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Initial state

Page 19: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

à

0q

à

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

01 11 1Time 1

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 20: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à 0

0q

1 1 à1 1Time 2

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 21: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

1q

à1 11 11Time 3

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 22: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

1q

1 1 à1 11Time 4

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 23: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

1q

1 1 à1 11Time 4

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 24: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

1q

à1 11 11Time 5

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 25: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

2q

1 1 à1 11Time 6

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 26: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

3q

à1 11 01Time 7

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 27: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

3q

1 1 à1 01Time 8

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 28: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

3q

1 1 à1 01Time 8

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 29: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

3q

à1 11 01Time 9

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 30: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

3q

1 1 à1 01Time 10

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 31: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

3q

à1 11 01Time 11

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/

Page 32: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

0q 1q 2q 3qL,à®à L,01®

L,11®

R,à®à

R,10®

R,11®

4q

R,11®

à

4q

1 1 à1 01

HALT & accept

Time 12

Source: Prof. Costas Busch’s Lecture Slides http://www.cs.rpi.edu/~moorthy/Courses/modcomp/accept state

Page 33: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

1-33

Universal Turing MachineA machine that can implement all Turing machines-- this is also a Turing machine!

• inputs: data, plus a description of computation (other TMs)

Ua,b,c c(a+b)

Universal Turing Machine

Tadd, Tmul

U is programmable – so is a computer!• Program is part of the input data• a computer can emulate a Universal Turing Machine and vice

versa

A computer is a universal computing device.

Page 34: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

Halting Problem

• Halting ProblemØThe problem of determining, from a description of an

arbitrary computer program (i.e., Turing machine) and an input, whether the program will finish running (i.e., halts) or continue to run forever

• Halting problem is undecidable (not Turing machine solvable)(Proof by an application of Cantor’s diagonal argument)오토마타교과목에서더깊게다루어짐.

1-34

Page 35: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

1-35

오토마타이론

Turing machine (T)

Pushdown machine (P)

Finite state machine (F)

L = {(0+1)* | 1의개수는짝수}(F, P, T로 accept 가능)

L = {1 0 | n ≥ 0}(P 또는 T로만 accept 가능)

n n

L = {1 0 1 | n ≥ 0}(T로만 accept 가능)

n n n

Page 36: Chapter 1dcslab.snu.ac.kr/courses/ic2019s/Lecture1.pdf · 1-8 Turing Machine Mathematical model of a device that can perform any computation –Alan Turing (1937) Every computation

1-36

꼭 기억해야 할 것

• (Levels of) Abstraction

• Turing Equivalence

• Undecidable Problem (not Turing machine computable)