Itroductio to Automata Theory Readig: Chapter 1 1
What is Automata Theory? Study of abstract computig devices, or machies Automato = a abstract computig device Note: A device eed ot eve be a physical hardware! A fudametal questio i computer sciece: Fid out what differet models of machies ca do ad caot do The theory of computatio Computability vs. Complexity 2
(A pioeer of automata theory) Ala Turig (1912-1954) Father of Moder Computer Sciece Eglish mathematicia Studied abstract machies called Turig machies eve before computers existed Heard of the Turig test? 3
Theory of Computatio: A Historical Perspective 1930s Ala Turig studies Turig machies Decidability Haltig problem 1940-1950s Fiite automata machies studied Noam Chomsky proposes the Chomsky Hierarchy for formal laguages 1969 Cook itroduces itractable problems or NP-Hard problems 1970- Moder computer sciece: compilers, computatioal & complexity theory evolve 4
Laguages & Grammars Or words Laguages: A laguage is a collectio of seteces of fiite legth all costructed from a fiite alphabet of symbols Grammars: A grammar ca be regarded as a device that eumerates the seteces of a laguage - othig more, othig less N. Chomsky, Iformatio ad Cotrol, Vol 2, 1959 Image source: Nowak et al. Nature, vol 417, 2002 5
The Chomsky Hierachy A cotaimet hierarchy of classes of formal laguages Regular (DFA) Cotextfree (PDA) Cotextsesitive (LBA) Recursivelyeumerable (TM) 6
The Cetral Cocepts of Automata Theory 7
Alphabet A alphabet is a fiite, o-empty set of symbols We use the symbol (sigma) to deote a alphabet Examples: Biary: = {0,1} All lower case letters: = {a,b,c,..z} Alphaumeric: = {a-z, A-Z, 0-9} DNA molecule letters: = {a,c,g,t} 8
Strigs A strig or word is a fiite sequece of symbols chose from Empty strig is e (or epsilo ) Legth of a strig w, deoted by w, is equal to the umber of (o- e) characters i the strig E.g., x = 010100 x = 6 x = 01 e 0 e 1 e 00 e x =? xy = cocatetatio of two strigs x ad y 9
Powers of a alphabet Let be a alphabet. k = the set of all strigs of legth k * = 0 U 1 U 2 U + = 1 U 2 U 3 U 10
Laguages L is a said to be a laguage over alphabet, oly if L Í * è this is because * is the set of all strigs (of all possible legth icludig 0) over the give alphabet Examples: 1. Let L be the laguage of all strigs cosistig of 0 s followed by 1 s: L = {e, 01, 0011, 000111, } 2. Let L be the laguage of all strigs of with equal umber of 0 s ad 1 s: L = {e, 01, 10, 0011, 1100, 0101, 1010, 1001, } Caoical orderig of strigs i the laguage Defiitio: Let L = {e}; Is L=Ø? NO Ø deotes the Empty laguage 11
The Membership Problem Give a strig w Î *ad a laguage L over, decide whether or ot w ÎL. Example: Let w = 100011 Q) Is w Î the laguage of strigs with equal umber of 0s ad 1s? 12
Fiite Automata Some Applicatios Software for desigig ad checkig the behavior of digital circuits Lexical aalyzer of a typical compiler Software for scaig large bodies of text (e.g., web pages) for patter fidig Software for verifyig systems of all types that have a fiite umber of states (e.g., stock market trasactio, commuicatio/etwork protocol) 13
Fiite Automata : Examples O/Off switch actio state Modelig recogitio of the word the Start state Trasitio Itermediate state Fial state 14
Structural expressios Grammars Regular expressios E.g., uix style to capture city ames such as Palo Alto CA : [A-Z][a-z]*([ ][A-Z][a-z]*)*[ ][A-Z][A-Z] Start with a letter A strig of other letters (possibly empty) Should ed w/ 2-letter state code Other space delimited words (part of city ame) 15
Formal Proofs 16
Deductive Proofs From the give statemet(s) to a coclusio statemet (what we wat to prove) Logical progressio by direct implicatios Example for parsig a statemet: If y 4, the 2 y y 2. give coclusio (there are other ways of writig this). 17
Example: Deductive proof Let Claim 1: If y 4, the 2 y y 2. Let x be ay umber which is obtaied by addig the squares of 4 positive itegers. Claim 2: Give x ad assumig that Claim 1 is true, prove that 2 x x 2 Proof: 1) Give: x = a 2 + b 2 + c 2 + d 2 implies or follows 2) Give: a 1, b 1, c 1, d 1 3) è a 2 1, b 2 1, c 2 1, d 2 1 (by 2) 4) è x 4 (by 1 & 3) 5) è 2 x x 2 (by 4 ad Claim 1) 18
O Theorems, Lemmas ad Corollaries We typically refer to: A major result as a theorem A itermediate result that we show to prove a larger result as a lemma A result that follows from a already prove result as a corollary A example: Theorem: The height of a -ode biary tree is at least floor(lg ) Lemma: Level i of a perfect biary tree has 2 i odes. Corollary: A perfect biary tree of height h has 2 h+1-1 odes. 19
Quatifiers For all or For every Uiversal proofs Notatio= There exists Used i existetial proofs Notatio= Implicatio is deoted by => E.g., IF A THEN B ca also be writte as A=>B 20
Provig techiques By cotradictio Start with the statemet cotradictory to the give statemet E.g., To prove (A => B), we start with: (A ad ~B) ad the show that could ever happe What if you wat to prove that (A ad B => C or D)? By iductio (3 steps) Basis, iductive hypothesis, iductive step By cotrapositive statemet If A the B If ~B the ~A 21
Provig techiques By couter-example Show a example that disproves the claim Note: There is o such thig called a proof by example! So whe asked to prove a claim, a example that satisfied that claim is ot a proof 22
Differet ways of sayig the same thig If H the C : i. H implies C ii. iii. iv. H => C C if H H oly if C v. Wheever H holds, C follows 23
If-ad-Oly-If statemets A if ad oly if B (A <==> B) (if part) if B the A ( <= ) (oly if part) A oly if B ( => ) (same as if A the B ) If ad oly if is abbreviated as iff i.e., A iff B Example: Theorem: Let x be a real umber. The floor of x = ceilig of x if ad oly if x is a iteger. Proofs for iff have two parts Oe for the if part & aother for the oly if part 24
Summary Automata theory & a historical perspective Chomsky hierarchy Fiite automata Alphabets, strigs/words/seteces, laguages Membership problem Proofs: Deductive, iductio, cotrapositive, cotradictio, couterexample If ad oly if Read chapter 1 for more examples ad exercises 25