introduction to the theory of computation (complexity, computability, and automata)

Post on 13-Feb-2016

141 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

Introduction to the Theory of Computation (complexity, computability, and automata). นำเสนอโดย ดร.สุธี สุดประเสริฐ. Source: Chapter 0 - Introduction to the Theory of Computation by Michael Sipser . อะไรคือความสามารถพื้นฐานของคอมพิวเตอร์และขีดจำกัดของคอมพิวเตอร์คืออะไร ?. - PowerPoint PPT Presentation

TRANSCRIPT

1

Introduction to the Theory of Computation(complexity, computability, and

automata)

นำ�เสนอโดยดร.สธุ ีสดุประเสรฐิ

Source: Chapter 0 - Introduction to the Theory of Computation by Michael Sipser

2

อะไรคือความสามารถพื้นฐานของคอมพวิเตอร์และขดีจำากัดของคอมพวิเตอรคื์ออะไร?

ปัญห�นี้เริม่ขึ้นในชว่งปี 1930 เมื่อนักคณิตศ�สตร์เริม่สนใจท่ีจะห�คว�มหม�ยของ ก�รคำ�นวณ “ ”(computation)

ม ี3 ส�ข�วชิ�ท่ีเก่ียวเน่ืองกับปัญห�นี้ โดยแต่ละส�ข�มมุีง่มองในก�รตอบปัญห�น้ีแตกต่�งกันไป Complexity theory Computability theory Automata theory

3

Complexity theory (1) ปัญห�ท�งคอมพวิเตอรม์คีว�มหล�กหล�ย;

บ�งปัญห�ง่�ย เชน่ ปัญห�ก�รจดัเรยีงลำ�ดับ บ�งปัญห�ย�ก เชน่ ปัญห�ก�รจดัต�ร�งเวล�

อะไรคือองค์ประกอบท่ีทำ�ใหปั้ญห�หน่ึง ย�กกว�่อีกปัญห�หน่ึง ซึ่งปัญห�น้ีคือหวัใจหลักของ complexity theory

4

Complexity theory (2) นักวจิยัได้ค้นพบวธิกี�รในก�รจำ�แนกได้ว�่ปัญห�หนึ่ง

มคีว�มย�กง่�ยขน�ดไหน ในกรณีน้ี เร�ส�ม�รถแสดงวธิกี�รในก�รใหห้ลักฐ�นว�่

ปัญห�หน่ึงคือปัญห�ท่ีมคีว�มย�กท�งก�รคำ�นวณ (เหมอืนก�รบอกชนิดของธ�ต ุจ�กก�รเปรยีบจ�กต�ร�งธ�ต)ุ

แต่เร�ไมส่�ม�รถพสิจูน์ตรงๆ ได้ว่�ปัญห�หนึ่งเป็นปัญห�ท่ีย�ก

5

Complexity theory (3) ส�ข�วชิ�หน่ึงท่ีมกี�รใช ้complexity theory โดยตรง

คือส�ข�วทิย�ก�รเข�้รหสัลับ (cryptography) ในส�ข�วชิ�อ่ืนๆ สว่นม�กจะชอบปัญห�ท่ีง่�ยม�กกว�่

ปัญห�ท่ีย�ก แต่ส�ข�วทิย�ก�รเข�้รหสัลับ จะแตกต่�งออกไปคือ

ต้องก�รท่ีจะห�ปัญห�ท่ีแก้ได้ย�กแทน

6

Computability theory ในชว่งปี 1900-1950, นักคณิตศ�สตร ์(Kurt Godel, Alan

Turing, และ Alonzo Church) ได้ค้นพบว�่มปัีญห�รูปแบบหนึ่งท่ีคอมพวิเตอรไ์มส่�ม�รถแก้ปัญห�ได้ ปัญห�นัน้คือก�รบอกว�่นิพจน์ท�งคณิตศ�สตรห์นึ่งเป็นจรงิหรอืเท็จ ไมม่ลีำ�ดับวธิกี�รท�งคอมพวิเตอรไ์หนท่ีส�ม�รถแก้ไขนี้ได้

ใน computability theory ก�รจำ�แนกปัญห�จะจำ�แนกว�่ปัญห�แบบไหนแก้ไขได้และปัญห�แบบไหนแก้ไขไมไ่ด้

7

Automata theory (1) Automata theory จะสนใจในก�รนิย�มและคณุสมบติัของ

จำ�ลองท�งคณิตศ�สตรข์องก�รคำ�นวณ แบบจำ�ลองหน่ึงคือ finite automaton ซึ่งนิยมใชใ้น

text processing, compilers, และ hardware design อีกแบบจำ�ลองหนึ่งคือ context-free grammar ซึ่งนิยมใช้

ใน programming languages และ artificial intelligence (natural

language processing)

8

Automata theory (2) Automata theory เป็นจุดเริม่ต้นท่ีเหม�ะสมในก�ร

เริม่ต้นศึกษ�ทฤษฎีก�รคำ�นวณเพร�ะว�่ computability theory และ complexity theory

ต้องก�รนิย�มท่ีชดัเจนของคอมพวิเตอรก่์อน ก�รศึกษ� automata theory จะทำ�ใหเ้ร�เข�้ใจนิย�ม

ทัว่ไปของคอมพวิเตอรไ์ด้ชดัเจนม�กขึ้น

9

สญัลักษณ์ทางคณิตศาสตรแ์ละคำาศัพท์ท่ีควรรูก่้อนเรยีนวชิาน้ี Sets Sequences and Tuples Functions and Relations Graphs Strings and Languages Boolean Logic

10

Sets {7, 21, 57} 7 {7, 21, 57} {7,21} {7, 21, 57} {7, 7, 7, 21, 57} = {7, 21, 57} Infinite set

N = {1, 2, 3, …} is empty set

11

Sets Union A B

{ 1, 2, 3 } { 2, 3, 4, 5 } = { 1, 2, 3, 4, 5 } Intersect A B

{ 1, 2, 3 } { 2, 3, 4, 5 } = { 2, 3 } Complement A’

{ 0, 2, 4, … }’ = { 1, 3, 5, … } Power set is the set of all subsets.

A = { 0, 1 }A* = { , {0}, {1}, {0, 1} }

12

Sequence and Tuples Sequence

(7, 21, 57) (21, 7, 57) (7, 7, 21, 57) Tuple

A sequence with k elements is a k-tuple.(1, 3) : 2-tuple (also called pair)(2, 4, 6) : 3-tuple

13

Functions and Relations Functions : A function also is called a mappings.

f(a) = b f: D → R

abs (-1) = abs(-1) = 1ads: Integer → Integer

add (3, 5) = 8add: Integer Integer → Integer

divide (5, 2) = 2.5divide: Integer Integer → Real

Domain RangeInput Output

14

Functions and Relations A predicate or property is a function whose

range is {TRUE, FALSE}.even(4) = TRUE, odd(4) = FALSE

A property whose domain is a set of k-tuples is called a relation, a k-ary relation. A 2-ary relation is called a binary relation.aRb means aRb = TRUE or R(a, b) = TRUE

infix prefix

15

Graphsnodes (vertices)

edges (arcs)

5 nodes, 6 edges 4 nodes, 6 edges

An undirected graph or a graph

degree 3degree = 2

16

Graphs

G = (V, E) where V is the set of nodes and E is the set of edges

G = ({1,2,3,4,5}, {(1,2), (2,3), (3,4), (4,5), (5,1)})

17

Graphs

a path in a graph a cycle in a graph a tree

18

Graphs

A directed graph

indegree = 1outdegree = 2

indegree = 2outdegree = 2

19

Strings and Languages = {a, b, c ,d ,e, 0, 1}

An alphabet is any nonempty finite set. Members of the alphabet are the symbols of

the alphabet. A string over an alphabet is a finite sequence

of symbols from that alphabet.ab01, 01aed, 001, aabb

alphabet symbols

20

Strings and Languages If w is a string, the length of w, written |w|, is

the number of symbols.w = abcde, |w| = 5

|w| = 0 is call the empty string and is written . wR is the reverse of w.

w = abcde, wR = edcba w = abracadabra, cad is substring of w.

21

Strings and Languages w1 = abcd and w2 = 0011, the concatenation of

w1 and w2, written w1w2.

w1w2 = abcd0011.

A language is a set of strings.

22

Boolean Logic The value TRUE and FALSE are called the

Boolean values.Often represented by the value 1 and 0.

conjunction or AND disjunction or OR negation or NOT

23

Boolean Logic

exclusive or or XOR equality implication

Two expressions in each row are equivalent.

24

Boolean Logic Distributive Law

P (Q R) equals (P Q) (P R)

P (Q R) equals (P Q) (P R)

25

Definitions, Theorems, and Proofs Definitions Mathematical statements Proof Theorem Lemmas Corollaries

26

Definitions Definitions describe the objects and notions

that we use.

27

Mathematical statements A meaningful composition of words which can

be considered either true or false is called a mathematical statement or simply a statement.

“ABC is an equilateral triangle.”“E is a set of even numbers.”

28

Proofs A proof is a convincing logical argument that

a statement is true. A theorem is a mathematical statement

proved true. Generally we reserve the use of that word for statements of special interest.

A lemma is a proved statement that is interesting only because they assist in the proof of another, more significant statement.

A corollary is a proved statement that may allow us to conclude easily that other, related statements are true.

29

Types of Proof Proof by construction Proof by contradiction Proof by induction

top related