Building a efer mousetrap Let s uild an FA that only accepts the string aa from Σ = { a } Models of Computa-on Lecture #5 (a?er quiz) Chapter 6 Building a efer mousetrap Let s uild an FA that only accepts the string aa from Σ = { a } L = { aa } Include all the other edges that go to a reject L = { aa } Include all the other edges that go to a reject L = { aa } PreFy messy in reality, most of the edges here are for cases that reject. Let s uild a preser machine. a a a a a, a, a, a, 1
Defini-on of a TG. 1. A set of states, at least one is designated start, and any numer of which may e final 2. A finite alphaet Σ of input lefers 3. A finite set of transi-ons etween states, ased on reading strings of input lefers, maye even Defini-on of a TG. 1. A set of states, at least one is designated start, and any numer of which may e final 2. A finite alphaet Σ of input lefers 3. A finite set of transi-ons etween states, ased on reading strings of input lefers, maye even Look familiar? (first slide) Transi-on graphs can crash Defini-on: if an input contains lefers for which there is no edge transi-on, the machine will crash ; a new way to reject the input. As long as it is more fragile we might do well to also give it extra features! : The language of all words that contain a doule lefer. aa But, with powerful tools come new worries Allow input of a string rather than a character. 2
Non- determinism How to scan aaaa? First loop three -mes? it appears to reject. Non- determinism How to scan aaaa? First loop two -mes it appears to accept. Non- determinism For a TG accept means that at least one path to a final state exists for the string. Non- determinism s impact There could e more than one successful path a a a a Non- determinism s impact Allowing edges gives a new meaning to alternate paths! ex: Find all paths for aa through this TG: Non- determinism s impact Allowing edges can provide infinite paths to accept, for a finite machine with finite states! Ex: Find all paths for aa through this TG??? a a a a a a a a a a 3
Generalized Instead of laeling edges with strings, what aout laeling with languages? L 1 L 2 L 3 GTG Defini-on of a GTG. 1. A set of states, at least one is designated start, and any numer of which may e final 2. A finite alphaet Σ of input lefers 3. A finite set of transi-ons etween states, each laeled with a regular expression The language of all words that contain a doule lefer. The language of all words that contain a doule lefer. aa a a How can we eliminate the loops? How can we eliminate the loops? aa (a) * (aa)(a) * a a 4
6.3 Show that any language that can e accepted y a TG can e accepted y a TG with an even numer of states. 6.3 Show that any language that can e accepted y a TG can e accepted y a TG with an even numer of states. Machine with odd numer of states 6.3 Show that any language that can e accepted y a TG can e accepted y a TG with an even numer of states. 6.5 Prove that for every TG there is another TG that accepts the same language ut has only one state Machine with odd numer of states 6.5 Prove that for every TG there is another TG that accepts the same language ut has only one state Machine with multiple states 6.5 Prove that for every TG there is another TG that accepts the same language ut has only one state Machine with multiple states 5
6.8i Suppose that L is a finite language who words are w 1, w 2, w 3,, w 83. Prove that there is a TG that accepts exactly the language L. 6.8i Suppose that L is a finite language who words are w 1, w 2, w 3,, w 83. Prove that there is a TG that accepts exactly the language L. w 1 w 2 w 3... w 83... 6.8ii Of all TGs that accept exactly the language L, what is the one with the fewest numer of states? 6.8ii Of all TGs that accept exactly the language L, what is the one with the fewest numer of states? L 6