theory of computation 計算理論

36
1 Theory of Computation 計計計計

Upload: yen-kelley

Post on 30-Dec-2015

131 views

Category:

Documents


2 download

DESCRIPTION

Theory of Computation 計算理論. Instructor: 顏嗣鈞 E-mail: [email protected] Web: http://www.ee.ntu.edu.tw/~yen Time: 9:10-12:10 PM, Monday Place: BL 103 Office hours: by appointment Class web page: http://www.ee.ntu.edu.tw/~yen/courses/TOC-2008.htm. Textbook. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Theory of Computation 計算理論

1

Theory of Computation

計算理論

Page 2: Theory of Computation 計算理論

2

Instructor: 顏嗣鈞

E-mail: [email protected]

Web: http://www.ee.ntu.edu.tw/~yen

Time: 9:10-12:10 PM, Monday

Place: BL 103

Office hours: by appointment

Class web page: http://www.ee.ntu.edu.tw/~yen/courses/TOC-2008.htm

 

Page 3: Theory of Computation 計算理論

3

Automata, Computability and Complexity: Theory and Applications

by Elaine A. Rich

Publisher: Pearson Pub. Date: October 2007 ISBN-13: 9780132288064

Textbook

Page 4: Theory of Computation 計算理論

4

• :

Introduction to Automata Theory, Languages, and Computation

John E. Hopcroft, Rajeev Motwani,

Jeffrey D. Ullman,

(2nd Ed. Addison-Wesley, 2001)

Reference

Page 5: Theory of Computation 計算理論

5

1st Edition

Introduction to Automata Theory, Languages, and Computation John E. Hopcroft,

Jeffrey D. Ullman,

(Addison-Wesley, 1979)

Page 6: Theory of Computation 計算理論

6

3rd Edition• :

Introduction to Automata Theory, Languages, and Computation

John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman,

(Addison-Wesley, 2006)

Page 7: Theory of Computation 計算理論

7

Grading

HW/Project : 20%

Midterm exam.: 40%

Final exam.: 40%

Page 8: Theory of Computation 計算理論

8

Why Study Automata Theory?

Finite automata are a useful model for important kinds of hardware and software:

• Software for designing and checking digital circuits.

• Lexical analyzer of compilers. • Finding words and patterns in large bodies of

text, e.g. in web pages.• Verification of systems with finite number of

states, e.g. communication protocols.

Page 9: Theory of Computation 計算理論

9

Why Study Automata Theory? (2)

The study of Finite Automata and Formal Languages are intimately connected. Methods for specifying formal languages are very important in many areas of CS, e.g.:

• Context Free Grammars are very useful when designing software that processes data with recursive structure, like the parser in a compiler.

• Regular Expressions are very useful for specifying lexical aspects of programming languages and search patterns.

Page 10: Theory of Computation 計算理論

10

Why Study Automata Theory? (3)

Automata are essential for the study of the limits of computation. Two issues:

• What can a computer do at all? (Decidability)

• What can a computer do efficiently? (Intractability)

Page 11: Theory of Computation 計算理論

11

Applications

Theoretical Computer ScienceAutomata Theory, Formal Languages,

Computability, Complexity …

Com

pile

r

Pro

g.

lan

gu

ag

es

Com

m.

pro

toco

ls

circuits

Patte

rn

reco

gn

ition

Sup

erv

isory

co

ntro

l

Qu

an

tum

co

mpu

ting

Com

pu

ter-

Aid

ed

V

erifi

catio

n ...

Page 12: Theory of Computation 計算理論

12

Aims of the Course• To familiarize you with key Computer Science

concepts in central areas like- Automata Theory- Formal Languages- Models of Computation- Complexity Theory

• To equip you with tools with wide applicability in the fields of CS and EE, e.g. for- Complier Construction- Text Processing- XML

Page 13: Theory of Computation 計算理論

13

Fundamental Theme

• What are the capabilities and limitations of computers and computer programs?– What can we do with

computers/programs?

– Are there things we cannot do with computers/programs?

Page 14: Theory of Computation 計算理論

14

Studying the Theme

• How do we prove something CAN be done by SOME program?

• How do we prove something CANNOT be done by ANY program?

Page 15: Theory of Computation 計算理論

15

Example: The Halting Problem (1)

Consider the following program. Does it terminate for all values of n 1?

while (n > 1) {if even(n) {

n = n / 2;} else {

n = n * 3 + 1;}

}

Page 16: Theory of Computation 計算理論

16

Example: The Halting Problem (2)

Not as easy to answer as it might first seem.

Say we start with n = 7, for example:

7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5,

16, 8, 4, 2, 1

In fact, for all numbers that have been tried

(a lot!), it does terminate . . .

. . . but in general?

Page 17: Theory of Computation 計算理論

17

Example: The Halting Problem (3)Then the following important undecidability

result should perhaps not come as a total surprise:

It is impossible to write a program that decides if another, arbitrary, program terminates (halts) or not.

What might be surprising is that it is possible to prove such a result. This was first done by the British mathematician Alan Turing.

Page 18: Theory of Computation 計算理論

18

Our focus

AutomataComputability

Complexity

Page 19: Theory of Computation 計算理論

19

Topics1.  Finite automata, Regular languages, Regular

grammars: deterministic vs. nondeterministic, one-way vs. two-way finite automata, minimization, pumping lemma for regular sets, closure properties.

2.  Pushdown automata, Context-free languages, Context-free grammars: deterministic vs. nondeterministic, one-way vs. two-way PDAs, reversal bounded PDAs, linear grammars, counter machines, pumping lemma for CFLs, Chomsky normal form, Greibach normal form, closure properties.

3.

Page 20: Theory of Computation 計算理論

20

Topics (cont’d)3. Linear bounded automata, Context-

sensitive languages, Context-sensitive grammars.

4. Turing machines, Recursively enumerable sets, Type 0 grammars: variants of Turing machines, halting problem, undecidability, Post correspondence problem, valid and invalid computations of TMs.

 

Page 21: Theory of Computation 計算理論

21

Topics (cont’d)5. Basic recursive function theory 6. Basic complexity theory: Various

resource bounded complexity classes, including NLOGSPACE, P, NP, PSPACE, EXPTIME, and many more. reducibility, completeness.

7. Advanced topics: Tree Automata, quantum automata, probabilistic automata, interactive proof systems, oracle computations, cryptography.

Page 22: Theory of Computation 計算理論

22

Who should take this course?

YOU

Page 23: Theory of Computation 計算理論

23

Languages

The terms language and word are used in a strict technical sense in this course:

A language is a set of words.

A word is a sequence (or string) of symbols.

(or ) denotes the empty word, the sequence of zero symbols.

Page 24: Theory of Computation 計算理論

24

Symbols and Alphabets

• What is a symbol, then?

• Anything, but it has to come from an alphabet which is a finite set.

• A common (and important) instance is = {0, 1}.

, the empty word, is never an symbol of an alphabet.

Page 25: Theory of Computation 計算理論

25

Computation

CPU memory

Page 26: Theory of Computation 計算理論

26

CPU

input memory

output memory

Program memory

temporary memory

Page 27: Theory of Computation 計算理論

27

CPU

input memory

output memoryProgram memory

temporary memory

3)( xxf

compute xx

compute xx 2

Example:

Page 28: Theory of Computation 計算理論

28

CPU

input memory

output memoryProgram memory

temporary memory

3)( xxf

compute xx

compute xx 2

2x

Page 29: Theory of Computation 計算理論

29

CPU

input memory

output memoryProgram memory

temporary memory3)( xxf

compute xx

compute xx 2

2x

42*2 z82*)( zxf

Page 30: Theory of Computation 計算理論

30

CPU

input memory

output memoryProgram memory

temporary memory3)( xxf

compute xx

compute xx 2

2x

42*2 z82*)( zxf

8)( xf

Page 31: Theory of Computation 計算理論

31

Automaton

CPU

input memory

output memory

Program memory

temporary memory

Automaton

Page 32: Theory of Computation 計算理論

32

Different Kinds of Automata

Automata are distinguished by the temporary memory

• Finite Automata: no temporary memory

• Pushdown Automata: stack

• Turing Machines: random access memory

Page 33: Theory of Computation 計算理論

33

input memory

output memory

temporary memory

Finite

Automaton

Finite Automaton

Example: Vending Machines

(small computing power)

Page 34: Theory of Computation 計算理論

34

input memory

output memory

Stack

Pushdown

Automaton

Pushdown Automaton

Example: Compilers for Programming Languages

(medium computing power)

Push, Pop

Page 35: Theory of Computation 計算理論

35

input memory

output memory

Random Access Memory

Turing

Machine

Turing Machine

Examples: Any Algorithm

(highest computing power)

Page 36: Theory of Computation 計算理論

36

Finite

Automata

Pushdown

Automata

Turing

Machine

Power of Automata

Less power More power

Solve more

computational problems