BIL 439 AUTOMATA THEORY and FORMAL LANGUAGES

Lecture 1 Introduction Eda Y¨cel u
Cukurova University ¸ Computer Engineering Department

September 30, 2011

E. Y¨cel (CU) u

BIL 439

September 30, 2011

1 / 26

¨ Instructor: Eda YUCEL

e-mail: edatyucel@gmail.com Room 122 webpage:

E. Y¨cel (CU) u

BIL 439

September 30, 2011

2 / 26

Textbook

Introduction to the Theory of Computation, Michael Sipser, Course Technology, 1996. (You can find an electronic copy of the book from Web.) ¨ ¨ Ozdevinirler (Otomatlar) Kuramı ve Bi¸imsel Diller, Unal c ˇ YARIMAGAN (Prof. Dr.), 2003.

E. Y¨cel (CU) u

BIL 439

September 30, 2011

3 / 26

Course Description

This course will introduce you to three foundational areas of computer science: Automata Theory: What are the basic mathematical models of computation? Computability Theory: What problems can be solved by computers? Complexity Theory: What makes some problems computationally hard and others easy? ”What are the fundamental capabilities and limitations of computers?”

E. Y¨cel (CU) u

BIL 439

September 30, 2011

4 / 26

Complexity Theory

computer programs
easy: e.g., sorting hard: e.g., scheduling

E. Y¨cel (CU) u

BIL 439

September 30, 2011

5 / 26

g. scheduling ”What makes some problems computationally hard and others easy?” E... 2011 5 / 26 . Y¨cel (CU) u BIL 439 September 30.g.Complexity Theory computer programs easy: e. sorting hard: e.

Y¨cel (CU) u BIL 439 September 30. scheduling ”What makes some problems computationally hard and others easy?” Researchers developed an elegant scheme for classifying programs according to computational complexity.Complexity Theory computer programs easy: e. NP-hard. NP-complete E. P. sorting hard: e.g. NP...g. 2011 5 / 26 .

Complexity Theory If you face with a computationally hard problem E. Y¨cel (CU) u BIL 439 September 30. 2011 6 / 26 .

Y¨cel (CU) u BIL 439 September 30.Complexity Theory If you face with a computationally hard problem 1 which aspect of the problem leads to difficulty → you may alter it E. 2011 6 / 26 .

Complexity Theory If you face with a computationally hard problem 1 2 which aspect of the problem leads to difficulty → you may alter it try to settle for less than a perfect solution E. Y¨cel (CU) u BIL 439 September 30. 2011 6 / 26 .

Complexity Theory If you face with a computationally hard problem 1 2 3 which aspect of the problem leads to difficulty → you may alter it try to settle for less than a perfect solution is it hard only in the worst case situation? E. Y¨cel (CU) u BIL 439 September 30. 2011 6 / 26 .

Complexity Theory If you face with a computationally hard problem 1 2 3 4 which aspect of the problem leads to difficulty → you may alter it try to settle for less than a perfect solution is it hard only in the worst case situation? consider alternative types of computation (randomized computation. Y¨cel (CU) u BIL 439 September 30.) E. 2011 6 / 26 . etc.

Y¨cel (CU) u BIL 439 September 30. 2011 7 / 26 .Computability Theory certain basic problems cannot be solved by computers E.

2011 7 / 26 . Y¨cel (CU) u BIL 439 September 30. software verification! E.g.Computability Theory certain basic problems cannot be solved by computers computer programs solvable not solvable : e.

Computability Theory certain basic problems cannot be solved by computers computer programs solvable not solvable : e. Y¨cel (CU) u BIL 439 September 30. E. 2011 7 / 26 .g. software verification! for an algorithmically unsolvable problem: simplify or alter before you find an algorithmic solution.

2011 8 / 26 .Computability Theory Turing Machine can do everything that a real computer does E. Y¨cel (CU) u BIL 439 September 30.

Y¨cel (CU) u BIL 439 September 30. 2011 8 / 26 .Computability Theory Turing Machine can do everything that a real computer does even a TM cannot solve certain problems! E.

E.Automata Theory Finite automata: good models for devices that have a small amount of memory used in text processing. Y¨cel (CU) u BIL 439 September 30. compilers. etc. 2011 9 / 26 . hardware design.

hardware design.Automata Theory Finite automata: good models for devices that have a small amount of memory used in text processing. 2011 9 / 26 . Pushdown automata: good models for devices that have an unlimited memory that is usable in LIFO manner of a stack too restricted: very simple tasks apply! E. Y¨cel (CU) u BIL 439 September 30. compilers. etc.

compilers. 2011 9 / 26 . Y¨cel (CU) u BIL 439 September 30. hardware design. etc. Pushdown automata: good models for devices that have an unlimited memory that is usable in LIFO manner of a stack too restricted: very simple tasks apply! Context-free grammar: used in programming languages and AI E.Automata Theory Finite automata: good models for devices that have a small amount of memory used in text processing.

s o og D¨zenli ifadelerin tanınması ve sonlu otomatın bu ama¸la kullanımı u c ¨ˇrenilir. g og E. og Sentaks analizi ve ayrı¸tırma kavram ve y¨ntemleri ¨ˇrenilir. 2011 10 / 26 . Turing Makinası ve algortmik hesaplamanın modellenebilirliˇi ¨ˇrenilir.BIL 439 Ders Sonucunda: 1 2 3 4 5 Sonlu Durumlu Makine modelinin donanım tasarımına uygulanması ¨ˇrenilir. Y¨cel (CU) u BIL 439 September 30. og Derleyici tasarımına hazırlanılır.

BIL 439 In practice in the future: Designing a new programming language for a specialized application? Remember what you learned about grammers E. 2011 11 / 26 . Y¨cel (CU) u BIL 439 September 30.

Y¨cel (CU) u BIL 439 September 30. or DNA alphabet) and pattern matching? Remember finite automata and regular expressions E. binary. 2011 11 / 26 .BIL 439 In practice in the future: Designing a new programming language for a specialized application? Remember what you learned about grammers Dealing with string searching (human.

Y¨cel (CU) u BIL 439 September 30. or DNA alphabet) and pattern matching? Remember finite automata and regular expressions Confronted with a problem that seems to require more computation time than you can afford? Remember what you learned about NP-completeness E.BIL 439 In practice in the future: Designing a new programming language for a specialized application? Remember what you learned about grammers Dealing with string searching (human. binary. 2011 11 / 26 .

g. modern cryptography protocols) rely on theoretical principles that you learn here.BIL 439 In practice in the future: Designing a new programming language for a specialized application? Remember what you learned about grammers Dealing with string searching (human. binary. E. or DNA alphabet) and pattern matching? Remember finite automata and regular expressions Confronted with a problem that seems to require more computation time than you can afford? Remember what you learned about NP-completeness Various application areas (e. Y¨cel (CU) u BIL 439 September 30. 2011 11 / 26 .

2011 12 / 26 .Syllabus 1 2 3 ¨ Finite automata (Sonlu Otomatlar-Ozdevinirler) Regular expressions and languages (D¨zenli ifadeler ve diller) u Context-free grammars and languages (Baˇlamdan baˇımsız g g gramerler ve diller) Pushdown automata (Yıˇılı¨zdevinirler) g o Turing machines (Turing makineleri) Decidability (Karar verilebilirlik) Complexity theory and NP-completeness Parsing (Ayrı¸tırma i¸lemleri) s s 4 5 6 7 8 E. Y¨cel (CU) u BIL 439 September 30.

Grading Criteria Attendance: 10% Homework: 20% (3 homeworks) Midterm: 30% Final: 40% E. 2011 13 / 26 . Y¨cel (CU) u BIL 439 September 30.

Y¨cel (CU) u BIL 439 September 30. Σ2 = {0. i. h. c. l}. d.g. 1} E.Strings and Languages Alphabet (character set): a finite set that consists of symbols. e. k. f. b. 2011 14 / 26 . denoted by Σ e. g. j. Σ1 = {a.

Y¨cel (CU) u BIL 439 September 30. 2011 15 / 26 . g.Strings and Languages String over an alphabet: a finite sequence of symbols from that alphabet. d. i. k. usually written next to one another and not separated by commas. c. for Σ1 = {a. ’ali’ is a string over Σ1 for Σ2 = {0. h. e. j. ’001110101’ is a string over Σ2 |w| denotes length of string w empty string: ε E. f. 1}. l}. b.

h. Y¨cel (CU) u BIL 439 September 30. for Σ1 = {a. we can write w = w1 w2 .Strings and Languages String over an alphabet: a finite sequence of symbols from that alphabet. 1}. d. k. . j. i. f. ’001110101’ is a string over Σ2 |w| denotes length of string w empty string: ε If w has length n. usually written next to one another and not separated by commas. e. . g. l}. b. wn where each wi ∈ Σ. wR : reverse of w E. ’ali’ is a string over Σ1 for Σ2 = {0. 2011 15 / 26 . c.

h. 1}. f. i. wR : reverse of w prefix. . 2011 15 / 26 . l}. e. ’ali’ is a string over Σ1 for Σ2 = {0. we can write w = w1 w2 . usually written next to one another and not separated by commas. Y¨cel (CU) u BIL 439 September 30. b. d. j. ’001110101’ is a string over Σ2 |w| denotes length of string w empty string: ε If w has length n. suffix. g. . k.Strings and Languages String over an alphabet: a finite sequence of symbols from that alphabet. wn where each wi ∈ Σ. c. for Σ1 = {a. and substring of a string w E.

i. k. ’001110101’ is a string over Σ2 |w| denotes length of string w empty string: ε If w has length n.Strings and Languages String over an alphabet: a finite sequence of symbols from that alphabet. g. usually written next to one another and not separated by commas. Y¨cel (CU) u BIL 439 September 30. wn where each wi ∈ Σ. wR : reverse of w prefix. d. . j. and substring of a string w concatenation of x and y. 2011 15 / 26 . we can write w = w1 w2 . c. e. 1}. ’ali’ is a string over Σ1 for Σ2 = {0. . h. f. b. suffix. for Σ1 = {a. l}. written as xy E.

f. suffix. k. wR : reverse of w prefix. h. 2011 15 / 26 . ’001110101’ is a string over Σ2 |w| denotes length of string w empty string: ε If w has length n.Strings and Languages String over an alphabet: a finite sequence of symbols from that alphabet. Y¨cel (CU) u BIL 439 September 30. . g. j. 1}. i. . wn where each wi ∈ Σ. c. x: concatenation of string x with itself k times k E. usually written next to one another and not separated by commas. for Σ1 = {a. . d. and substring of a string w concatenation of x and y. . e. we can write w = w1 w2 . written as xy xk = x . b. l}. ’ali’ is a string over Σ1 for Σ2 = {0.

} Language: a set of strings. 11. for Σ2 = {0. 01. . 1}: {ε.Strings and Languages The lexicographic ordering of strings: the same as familiar dictionary ordering.. 1.. . . . 2011 16 / 26 . 000. except that shorter strings precede longer strings. E. 0. 00. 10. Y¨cel (CU) u BIL 439 September 30.

A proof is a convincing logical argument that a statement is true. Theorems. And Proofs Definitions describe the objects and notions that we use.Definitions. Y¨cel (CU) u BIL 439 September 30. 2011 17 / 26 . A theorem is a mathematical statement proved true. E.

2011 18 / 26 .Types Of Proof Proof by construction..... or proof by example Proof by induction.in Turkish: istikra ile ispat Proof by contradiction . Y¨cel (CU) u BIL 439 September 30. E.

E.Proof by Construction To prove that a particular thing exists. Y¨cel (CU) u BIL 439 September 30. you may construct it (explicit example) or show how to construct it (algorithm). 2011 19 / 26 .

E. 2011 20 / 26 .Example (Proof by Construction) We can prove that there is at least one square number that is also a cube number by showing that 64 is the square of 8 and the cube of 4. Y¨cel (CU) u BIL 439 September 30.

.Proof by Induction An advanced method used to show that all elements of an infinite set (e. Y¨cel (CU) u BIL 439 September 30. 2011 21 / 26 . then it is also true when n = k + 1. 2. Show that the statement is true when n = 0. . Conclude that the statement is true for all n ≥ 0. for some k ≥ 0.g. Natural numbers {0. }) have a specified property. E. . 1. Show that if the statement is true when n = k.

E. 2011 22 / 26 . 2 for all n ≥ 1.Example (Proof by Induction) Use induction to prove that 1 + 2 + · · · + n = n(n+1) . Y¨cel (CU) u BIL 439 September 30.

2 E. 2011 23 / 26 ... Y¨cel (CU) u BIL 439 September 30.Example (Proof by Induction) BASIS STEP: n = 1 1 = 1(1+1) . TRUE.

assume that 1 + 2 + · · · + n = n(n+1) . 2 HYPOTHESIS: for n ≤ k.Example (Proof by Induction) BASIS STEP: n = 1 1 = 1(1+1) . 2 E. TRUE.. Y¨cel (CU) u BIL 439 September 30. 2011 23 / 26 ..

?: 1 + 2 + · · · + k + k + 1 = (k+1)(k+2) 2 ⇒ k(k+1) + k + 1 = (k+1)(k+2) . assume that 1 + 2 + · · · + n = For n = k + 1. 2 HYPOTHESIS: for n ≤ k. 2011 23 / 26 .. TRUE! 2 2 n(n+1) .Example (Proof by Induction) BASIS STEP: n = 1 1 = 1(1+1) . Y¨cel (CU) u BIL 439 September 30. 2 E. TRUE..

Show that this leads to a contradiction. 2011 24 / 26 . Then. conclude that if A is true. E. then B must be true. Y¨cel (CU) u BIL 439 September 30. suppose that A is true and B is false.Proof by Contradiction To prove that A implies B.

Y¨cel (CU) u BIL 439 September 30. 2011 25 / 26 . There are no positive integer solutions to the diophantine equation x2 − y 2 = 1.Example (Proof by Contradiction) Theorem. E.

Example (Proof by Contradiction) Theorem. 2011 26 / 26 . There are no positive integer solutions to the diophantine equation x2 − y 2 = 1. Y¨cel (CU) u BIL 439 September 30. Proof. E. Assume to the contrary that there is a solution (x. y) where x and y are positive integers.

we can factor the left side: x2 − y 2 = (x − y)(x + y) = 1. Assume to the contrary that there is a solution (x. y) where x and y are positive integers. If this is the case. E. 2011 26 / 26 . Proof. There are no positive integer solutions to the diophantine equation x2 − y 2 = 1. Y¨cel (CU) u BIL 439 September 30.Example (Proof by Contradiction) Theorem.

Example (Proof by Contradiction) Theorem. 2011 26 / 26 . Assume to the contrary that there is a solution (x. Y¨cel (CU) u BIL 439 September 30. If this is the case. it follows that either x − y = 1 and x + y = 1 or x − y = −1 and x + y = −1. y) where x and y are positive integers. Since x and y are integers. There are no positive integer solutions to the diophantine equation x2 − y 2 = 1. E. Proof. we can factor the left side: x2 − y 2 = (x − y)(x + y) = 1.

Y¨cel (CU) u BIL 439 September 30. we can factor the left side: x2 − y 2 = (x − y)(x + y) = 1. 2011 26 / 26 . Assume to the contrary that there is a solution (x. If x − y = 1 and x + y = 1: x = 1 and y = 0.Example (Proof by Contradiction) Theorem. it follows that either x − y = 1 and x + y = 1 or x − y = −1 and x + y = −1. If this is the case. Since x and y are integers. Proof. contradiction! E. y) where x and y are positive integers. There are no positive integer solutions to the diophantine equation x2 − y 2 = 1.

it follows that either x − y = 1 and x + y = 1 or x − y = −1 and x + y = −1. contradiction! If x − y = −1 and x + y = −1: x = −1 and y = 0. Assume to the contrary that there is a solution (x.Example (Proof by Contradiction) Theorem. There are no positive integer solutions to the diophantine equation x2 − y 2 = 1. y) where x and y are positive integers. If this is the case. Since x and y are integers. If x − y = 1 and x + y = 1: x = 1 and y = 0. 2011 26 / 26 . we can factor the left side: x2 − y 2 = (x − y)(x + y) = 1. contradiction! E. Y¨cel (CU) u BIL 439 September 30. Proof.

Sign up to vote on this title
UsefulNot useful