1 / 30

CD5560 FABER Formal Languages, Automata and Models of Computation Exercise 2

CD5560 FABER Formal Languages, Automata and Models of Computation Exercise 2 Mälardalen University 2007. NEXT WEEK! Midterm Exam 1 Regular Languages. Place: U2-114 Time: Tuesday 2007-04-24, 10:15-12:00 It is OPEN BOOK .

haines
Download Presentation

CD5560 FABER Formal Languages, Automata and Models of Computation Exercise 2

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. CD5560 FABER Formal Languages, Automata and Models of Computation Exercise 2 Mälardalen University 2007

  2. NEXT WEEK!Midterm Exam 1Regular Languages Place: U2-114 Time: Tuesday 2007-04-24, 10:15-12:00 It is OPEN BOOK. (This means you are allowed to bring in one book of your choice.) It will cover lectures 1 through 5 (Regular Languages).

  3. Tenta 29 okt 1999; uppgift 2 (L Salling) Construct (and explain) a) A regular expression over wich strings contain all three symbols!

  4. Solution or

  5. Construct (and explain) b) A minimal DFA for a language L over wich strings contain all three symbols!

  6. Särskiljningsalgoritm

  7. c) En reguljär grammatik för L

  8. Tenta 24 okt 1994; uppgift 2 (L Salling) Reguljära? a) Språket över vars strängar innehåller ett jämnt antal a:n! Ja, språket är reguljärt och beskrivs med ett reguljärt uttryck:

  9. Tenta 24 okt 1994; uppgift 2 (L Salling) b) De välformade aritmetiska uttrycken formade i alfabetet Nej, språket är inte reguljärt: Ta följande sträng: N stycken a adderas Om språket vore reguljärt skulle det kunna pumpas. Men de N avslutande tecknen består enbart av höger- parenteser och kan inte ändras utan att balansen med vänsterparenteserna förstörs.

  10. a) Tenta 15 mars 1995; uppgift 3 (L Salling) Reguljära? Ja, språket är reguljärt och beskrivs med ett reguljärt uttryck:

  11. b) Tenta 15 mars 1995; uppgift 3 (L Salling) Reguljära? Nej. Strängen vars enda palindromprefix längre än 2 är strängen själv, kan inte pumpas någonstans inuti b-block utan att falla ur språket.

  12. c) Tenta 15 mars 1995; uppgift 3 (L Salling) Reguljära? Nej. Om det vore reguljärt skulle även föregående språk vara det (eftersom det är komplementspråk, och regulariteten bevaras under komplementbildning).

  13. Pumping Lemma is necessary but not sufficient for RL • OBS! The pumping lemma does not give a sufficient condition for a language to be regular! You can not use it to show that language is regular. • For example, the language • (strings over the alphabet {0,1} consisting of a nonempty even palindrome followed by another nonempty string) is not regular but can still be "pumped" with m = 4: • Suppose w=uuRv has length at least 4. If u has length 1, then |v| ≥ 2 and we can take y to be the first character in v. Otherwise, take y to be the first character of u and note that yk for k ≥ 2 starts with the nonempty palindrome yy. For a practical test that exactly characterizes regular languages, see the Myhill-Nerode theorem. The typical method for proving that a language is regular is to construct either a Finite State Machine or a Regular Expression for the language.

  14. Minimizing DFA’s By Partitioning (Delmängdskonstruktion)

  15. Minimizing DFA’s • Different methods • All involve finding equivalent states: • States that go to equivalent states under all inputs • We will use the Partitioning Method

  16. Minimizing DFA’s by Partitioning • Consider the following DFA (from Forbes Louis): • Accepting states are yellow • Non-accepting states are blue • Are any states really the same?

  17. S2and S7are really the same: • Both Final states • Both go to S6 under input b • Both go to S3 under an a • S0and S5 really the same. Why? • We say each pair is equivalent • Are there any other equivalent states? • We can merge equivalent states into 1 state

  18. Partitioning Algorithm • First • Divide the set of states into • Final and • Non-final states • Partition I • Partition II

  19. Partitioning Algorithm • Now • See if states in each partition each go to the • same partition • S1 &S6 are different from the rest of the states in Partition I • (but like each other) • We will move them to their own partition

  20. Partitioning Algorithm

  21. Partitioning Algorithm • Now again • See if states in each partition each go to the same partition • In Partition I, S3goes • to a different partition • from S0, S5andS4 • We’ll move S3 to its own partition

  22. Partitioning Algorithm • Note changes in S6, S2 and S7

  23. Partitioning Algorithm • Now S6 goes to a different partition on an a from S1 • S6 gets its own partition. • We now have 5 partitions • Note changes in S2 and S7

  24. Partitioning Algorithm • All states within each of the 5 partitions are identical. • We might as well call the states I, II III, IV and V.

  25. b b b V b a a a a b a b Partitioning Algorithm Here they are:

  26. Chomsky Hierarchy

  27. Automata theory: formal languages and formal grammars

  28. Automata theory: formal languages and formal grammars

  29. Non-regular languages Context-Free Languages Regular Languages

More Related