1 / 19

Building Finite Automata for Finite Languages

Learn to build finite automata corresponding to finite languages with step-by-step examples and explanations by Instructor Naveed Ullah Safi. Understand the concept of final states and dead states in finite automata construction.

streadwell
Download Presentation

Building Finite Automata for Finite Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FA corresponding to Finite languages Lecture 07 Instructor NaveedUllah Safi

  2. FA corresponding to Finite languages • We can also build finite automaton for a given finite language. • To build an FA for a finite language, first we must identify all the strings in the given language. • Second we must construct that much final states in the FA as the number of strings in the language i:e the number of final states must be equal to the number of strings in the language. Instructor NaveedUllah Safi

  3. a,b a,b FA corresponding to finite languages y • Example Consider the language L = {Λ, b, ab, bb}, The language L may be accepted by the following FA a a,b a b 1 3 4+ b b 2+ 5+ a,b a x Instructor NaveedUllah Safi 3

  4. a,b a,b Note y a L = {Λ, b, ab, bb} a,b a b As there are four strings in the language so there will be four final states represented by 1, 2, 4 and 5. Also there are two dead states in this FA where someone if enter, then there is no way to leave that state 1 3 4+ b b 2+ 5+ a,b a x Instructor NaveedUllah Safi

  5. Example Continued … • It is to be noted that the states x and y are called Dead States, Waste Baskets or Davey John Lockers, as the moment one enters these states there is no way to leave it. Instructor NaveedUllah Safi

  6. Note • It is to be noted that to build an FA accepting the language having less number of strings, the tree structure may also help in this regard, which can be observed in the following transition diagram for the Language L, discussed in the previous example Instructor NaveedUllah Safi

  7. 4 a 3 a,b b a,b a 5+ a,b 1± 8 a,b 6 b a 2+ a,b b 7+ Instructor NaveedUllah Safi

  8. Example Consider the language L = {aa, bab, aabb, bbba}, defined over Σ ={a, b}, expressed by aa + bab + aabb + bbba The above language may be accepted by the following FA Instructor NaveedUllah Safi

  9. a,b x 5+ 3+ 9+ 1– y a,b Example Continued … a,b b a a a a b b 2 4 b b b a 6 7 8 a a b a,b 10 a b a,b 11+ Instructor NaveedUllah Safi

  10. Example Consider the language L = {w belongs to {a,b}*: length(w) >= 2 and w neither ends in aa nor bb}. The language L may be expressed by the regular expression (a+b)*(ab+ba) This language may be accepted by the following FA Instructor NaveedUllah Safi

  11. 4+ 2 1– 5+ 3 Example Continued … a b a b a a b b b a Instructor NaveedUllah Safi

  12. Note • It is to be noted that building an FA corresponding to the language L, discussed in the previous example, seems to be quite difficult, but the same can be done using tree structure Instructor NaveedUllah Safi

  13. a aa a b a b a a ab Λ b a ba b a b a b b b bb Example continued … Instructor NaveedUllah Safi

  14. Example • Consider the language L = {w belongs to {a,b}*: w does not end in aa}. The language L may be expressed by the regular expression Λ + a + b + (a+b)*(ab+ba+bb) This language may be accepted by the following FA Instructor NaveedUllah Safi

  15. Example Continued … a aa a b a b a a ab Λ b a ba b a b a b b b Instructor NaveedUllah Safi bb

  16. Task solution … Using the technique discussed by Martin, build an FA accepting the following language L = {w belongs to {a,b}*: length(w) >= 2 and second letter of w, from right is a}. Solution:The language L may be expressed by the regular expression (a+b)*(aa+ab) This language may be accepted by the following FA Instructor NaveedUllah Safi

  17. Task continued … a aa a b a b a a ab Λ b a ba b a b a b b b Instructor NaveedUllah Safi bb

  18. Task solution … • Using the technique discussed by Martin, build an FA accepting the following language L = {w belong to {a,b}*: w neither ends in ab norin ba}. • Solution: The language L may be expressed by the regular expression Λ + a + b + (a+b)*(aa+bb) This language may be accepted by the following FA Instructor NaveedUllah Safi

  19. Task continued … a aa a b a b a a ab b a Λ ba b a b a b b b Instructor NaveedUllah Safi bb

More Related