320 likes | 618 Views
Introduction to the Theory of Computation (complexity, computability, and automata). นำเสนอโดย ดร.สุธี สุดประเสริฐ. Source: Chapter 0 - Introduction to the Theory of Computation by Michael Sipser . อะไรคือความสามารถพื้นฐานของคอมพิวเตอร์และขีดจำกัดของคอมพิวเตอร์คืออะไร ?.
E N D
Introduction to the Theory of Computation(complexity, computability, and automata) นำเสนอโดย ดร.สุธี สุดประเสริฐ Source: Chapter 0 - Introduction to the Theory of Computation by Michael Sipser
อะไรคือความสามารถพื้นฐานของคอมพิวเตอร์และขีดจำกัดของคอมพิวเตอร์คืออะไร?อะไรคือความสามารถพื้นฐานของคอมพิวเตอร์และขีดจำกัดของคอมพิวเตอร์คืออะไร? • ปัญหานี้เริ่มขึ้นในช่วงปี 1930 เมื่อนักคณิตศาสตร์เริ่มสนใจที่จะหาความหมายของ “การคำนวณ” (computation) • มี 3 สาขาวิชาที่เกี่ยวเนื่องกับปัญหานี้โดยแต่ละสาขามีมุ่งมองในการตอบปัญหานี้แตกต่างกันไป • Complexity theory • Computability theory • Automata theory
Complexity theory (1) • ปัญหาทางคอมพิวเตอร์มีความหลากหลาย; • บางปัญหาง่าย เช่น ปัญหาการจัดเรียงลำดับ • บางปัญหายาก เช่น ปัญหาการจัดตารางเวลา • อะไรคือองค์ประกอบที่ทำให้ปัญหาหนึ่ง ยากกว่าอีกปัญหาหนึ่ง • ซึ่งปัญหานี้คือหัวใจหลักของ complexity theory
Complexity theory (2) • นักวิจัยได้ค้นพบวิธีการในการจำแนกได้ว่าปัญหาหนึ่งมีความยากง่ายขนาดไหน • ในกรณีนี้ เราสามารถแสดงวิธีการในการให้หลักฐานว่าปัญหาหนึ่งคือปัญหาที่มีความยากทางการคำนวณ (เหมือนการบอกชนิดของธาตุ จากการเปรียบจากตารางธาตุ) • แต่เราไม่สามารถพิสูจน์ตรงๆ ได้ว่าปัญหาหนึ่งเป็นปัญหาที่ยาก
Complexity theory (3) • สาขาวิชาหนึ่งที่มีการใช้ complexity theory โดยตรงคือสาขาวิทยาการเข้ารหัสลับ (cryptography) • ในสาขาวิชาอื่นๆ ส่วนมากจะชอบปัญหาที่ง่ายมากกว่าปัญหาที่ยาก • แต่สาขาวิทยาการเข้ารหัสลับ จะแตกต่างออกไปคือต้องการที่จะหาปัญหาที่แก้ได้ยากแทน
Computabilitytheory • ในช่วงปี 1900-1950, นักคณิตศาสตร์ (Kurt Godel, Alan Turing, และ Alonzo Church) ได้ค้นพบว่ามีปัญหารูปแบบหนึ่งที่คอมพิวเตอร์ไม่สามารถแก้ปัญหาได้ • ปัญหานั้นคือการบอกว่านิพจน์ทางคณิตศาสตร์หนึ่งเป็นจริงหรือเท็จ • ไม่มีลำดับวิธีการทางคอมพิวเตอร์ไหนที่สามารถแก้ไขนี้ได้ • ใน computability theory การจำแนกปัญหาจะจำแนกว่าปัญหาแบบไหนแก้ไขได้และปัญหาแบบไหนแก้ไขไม่ได้
Automata theory (1) • Automata theory จะสนใจในการนิยามและคุณสมบัติของจำลองทางคณิตศาสตร์ของการคำนวณ • แบบจำลองหนึ่งคือfinite automaton ซึ่งนิยมใช้ใน • text processing, compilers, และ hardware design • อีกแบบจำลองหนึ่งคือcontext-free grammar ซึ่งนิยมใช้ใน • programming languages และ artificial intelligence (natural language processing)
Automata theory (2) • Automata theory เป็นจุดเริ่มต้นที่เหมาะสมในการเริ่มต้นศึกษาทฤษฎีการคำนวณเพราะว่า • computability theory และ complexity theory ต้องการนิยามที่ชัดเจนของคอมพิวเตอร์ก่อน • การศึกษา automata theory จะทำให้เราเข้าใจนิยามทั่วไปของคอมพิวเตอร์ได้ชัดเจนมากขึ้น
สัญลักษณ์ทางคณิตศาสตร์และคำศัพท์ที่ควรรู้ก่อนเรียนวิชานี้สัญลักษณ์ทางคณิตศาสตร์และคำศัพท์ที่ควรรู้ก่อนเรียนวิชานี้ • Sets • Sequences and Tuples • Functions and Relations • Graphs • Strings and Languages • Boolean Logic
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
Sets • UnionA B { 1, 2, 3 } { 2, 3, 4, 5 } = { 1, 2, 3, 4, 5 } • IntersectA B { 1, 2, 3 } { 2, 3, 4, 5 } = { 2, 3 } • ComplementA’ { 0, 2, 4, … }’ = { 1, 3, 5, … } • Power set is the set of all subsets. A = { 0, 1 } A* = { , {0}, {1}, {0, 1} }
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
Functions and Relations • Functions : A function also is called a mappings. f(a) = b f: D → R abs (-1) = abs(-1) = 1 ads: Integer → Integer add (3, 5) = 8 add: Integer Integer → Integer divide (5, 2) = 2.5 divide: Integer Integer → Real Input Output Domain Range
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
Graphs nodes (vertices) edges (arcs) degree 3 degree = 2 5 nodes, 6 edges 4 nodes, 6 edges An undirected graph or a graph
Graphs G = (V, E) where V is the set of nodes andE is the set of edges G = ({1,2,3,4,5}, {(1,2), (2,3), (3,4), (4,5), (5,1)})
Graphs a path in a graph a cycle in a graph a tree
Graphs indegree = 1 outdegree = 2 indegree = 2 outdegree = 2 A directed graph
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
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.
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.
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
Boolean Logic exclusive or or XOR equality implication Two expressions in each row are equivalent.
Boolean Logic • Distributive Law P (Q R) equals (P Q) (P R) P (Q R) equals (P Q) (P R)
Definitions, Theorems, and Proofs • Definitions • Mathematical statements • Proof • Theorem • Lemmas • Corollaries
Definitions • Definitions describe the objects and notions that we use.
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.”
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.
Types of Proof • Proof by construction • Proof by contradiction • Proof by induction