
Introduction to Theory of Computation COMP2600 — Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 2016 Slides created by Katya Lebedeva COMP 2600 — Introduction to Theory of Computation 1 Brief Historical Overview Already in 1930’s Alan Turing studied an abstract ma- chine, Turing machine! In 1940’s and 1950’s simpler kinds of machines, fi- nite automata, were studied. In the late 1950’s Noam Chomsky began his study of formal grammar. In 1969 Stephen Cook separated problems that are “intractable” (also called “NP-hard”). COMP 2600 — Introduction to Theory of Computation 2 http://www.nytimes.com/1994/11/24/business/company-news-flaw-undermines-accuracy-of-pentium-chips.html COMP 2600 — Introduction to Theory of Computation 3 Initially all Intel chips did all arithmetic using integers. Software pro- grams were instructing the chip how to divide floating-point numbers using integer arithmetic. The 1993 chips had these instructions inte- grated into them. This makes calculations much faster. In 1994 Thomas R. Nicely discovered that the processor could return incorrect decimal results when dividing large prime numbers. http://www.trnicely.net/pentbug/bugmail1.html. The replacement of flawed chips costed Intel US$475 million! Intel CEO Andy Grove: “Intel survived the crisis and was made stronger by it. We dramatically improved our validation methodology to quickly capture and fix errata, and investigated innovative ways to design products that are error-free right from the beginning.” http://www.techradar.com/au/news/computing-components/processors/pentium-fdiv-the-processor-bug-that-shook-the-world-1270773 COMP 2600 — Introduction to Theory of Computation 4 Three Major branches of Theory of Computation 1. Automata Theory deals with definitions and properties of computation models. Examples: • Deterministic Finite Automata (July 18, July 20) • Nondeterministic Finite Automata (July 22) • Context-Free Grammars (July 27) • Turing Machines (August 1, August 3, August 5) 2. Computability Theory - the study of decidability - classifies problems as being solvable or unsolvable (August 5) 3. Complexity Theory - the study of intractability - classifies problems ac- cording to their degree of difficulty COMP 2600 — Introduction to Theory of Computation 5 Basic Definitions of Automata Theory Alphabet is a finite, nonempty set of symbols Examples: S1 = f0;1g S2 = fa;b;:::;zg S3 = fA;B;:::;Zg COMP 2600 — Introduction to Theory of Computation 6 String (word) is a finite sequence of symbols chosen from some alphabet 01011 is a string from S1 gobbledygook is a string from S2 • Empty string is the string with no symbols e can be chosen from any alphabet! • Length of a string the number of positions for symbols in the string (“number of symbols” is often said though) j01011j is 5 and not 2 jgobbledygookj is 12 and not 8 jej is 0 COMP 2600 — Introduction to Theory of Computation 7 Powers of Alphabet Sk denotes the set of all strings of length k over S Sk = S × S × ··· × S | {z } k times S0 = feg for all S 1 For S1 = f0;1g, S1 = f0;1g 2 S1 = f00;01;10;11g COMP 2600 — Introduction to Theory of Computation 8 Closure of an alphabet S: S∗ is the set of all strings over S S∗ = S0 [ S1 [ S2 [ ::: The set of non-empty strings from alphabet S: S+ = S1 [ S2 [ S3 [ ::: Hence S∗ = S+ [ feg Note: All strings in S∗ and S+ are finite. S∗ and S+ are infinite sets. COMP 2600 — Introduction to Theory of Computation 9 Concatenation of Strings If ∗ x = a1a2 :::am 2 S ∗ y = b1b2 :::bn 2 S then x · y = a1a2 :::amb1b2 :::bn e is the identity for concatenation: e · x = x · e = x Length: jx · yj = jxj + jyj COMP 2600 — Introduction to Theory of Computation 10 Language L over S is any subset of S∗ (i.e. L ⊆ S∗) • set of all English words is a language over fA;B;:::;Z;a;d;:::;zg •f e;01;0011;000111;:::g, i.e. all strings with equal number of 0 and 1 and with all 0’s preceeding 1’s, is a language over f0;1g • 0/, the empty language, is a language over any alphabet •f eg, the language consisting of only the empty string, is a language over any alphabet Note that a language may be infinite. Note that L is also a language over any alphabet that is a superset of S. COMP 2600 — Introduction to Theory of Computation 11 Finite State Automata Neurophysiologists Warren S. McCullough and Walter Pitts published in 1943 the paper “A Logical Calculus of the Ideas Immanent in Nervous Activity” that is considered as a seminal contribution to the theory of automata. Nowadays FSA are a useful model for many important kinds of hardware and software, such as: • software for digital circuits • software for validating protocols • lexical analizers COMP 2600 — Introduction to Theory of Computation 12 State is a snapshot of a system’s history The advantage of having finite number of states is that we can implement the system with fixed set of resources. An automaton works as follows: • it is always in one of finitely many states at a time • starts in some state • changes state in response to an external input (i.e. makes a transition) • accepts input by ending in an accepting (also called final) state The accepted strings constitute the language defined by the automaton! COMP 2600 — Introduction to Theory of Computation 13 A finite automaton modelling recognition of COMP2600 C O M start C CO COM P COMP 2 0 0 6 COMP2600 COMP260 COMP26 COMP2 COMP 2600 — Introduction to Theory of Computation 14 start Start state: COMP2600 Accepting state: 0 When the FA is in state COMP260 COMP26 COMP26 and it sees a “0” in Transition: the input, it moves to state COMP260 and advances on the input. COMP 2600 — Introduction to Theory of Computation 15 Vending Machine • accepts $1 and $2 coins • refunds all money if more than $4 is added • is ready to deliver if exactly $4 has been added ? 1, 2 £ 2 2 - $0 - $2 - $4 @1 @1 6 @R 1 @R 1 - $1 2 $3 2 ¢ ¡ Slide created by Ranald Clouston. Adapted by Katya Lebedeva. COMP 2600 — Introduction to Theory of Computation 16 • S = f1;2g • The start state is “$0”. This is indicated by the ! at the left of it. • At the accepting state “$4” (double circled) you have the exact credit for your purchase Which of the following strings does this automaton accept? • the empty string e × • 22 X • 1222 × • 1222221111 X Slide created by Ranald Clouston. Adapted by Katya Lebedeva. COMP 2600 — Introduction to Theory of Computation 17 Finite Automaton and Language • each FA defines a language: the set of all strings that result in a sequence of state transitions from the start state to an accepting state • each string is a sequence of input labels along the path from the start state to an accepting state • languages that can be described by FA are regular languages The study of FA and the study of formal languages are therefore linked: • given a FA, find the language that is accepted by this automaton • given a language, find the FA that accepts this language COMP 2600 — Introduction to Theory of Computation 18.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages18 Page
-
File Size-