1 / 24

Language Recognition (12.4) Longin Jan Latecki Temple University

Language Recognition (12.4) Longin Jan Latecki Temple University. Based on slides by Costas Busch from the course http://www.cs.rpi.edu/courses/spring05/modcomp/ and …. Three Equivalent Representations. Regular expressions. Each can describe the others. Regular languages.

neron
Download Presentation

Language Recognition (12.4) Longin Jan Latecki Temple University

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. Language Recognition (12.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the course http://www.cs.rpi.edu/courses/spring05/modcomp/and …

  2. Three Equivalent Representations Regular expressions Each can describe the others Regular languages Finite automata • Kleene’s Theorem: • For every regular expression, there is a deterministic finite-state automaton that defines the same language, and vice versa.

  3. EXAMPLE 1 • Consider the language { ambn| m, n  N}, which is represented by the regular expression a*b*. • A regular grammar for this language can be written as follows: • S | aS | B • B  b | bB.

  4. NFAs  Regular grammarsThus, the language recognized by FSA is a regular language • Every NFA can be converted into a corresponding regular grammar and vice versa. • Each symbol A of the grammar is associated with a non-terminal node of the NFA sA, in particular, start symbol • S is associated with the start state sS. • Every transition is associated with a grammar production: • T(sA,a) = sB A  aB. • Every production B  is associated with final state sB.

  5. Equivalent FSA and regular grammar, Ex. 4, p. 772. G=(V,T,S,P) V={S, A, B, 0, 1} with S=s0, A=s1, and B=s2, T={0,1}, and productions are S  0A | 1B | 1 | λ A  0A | 1B | 1 B  0A | 1B | 1 | λ

  6. Kleene’sTheorem Languages Generated by Regular Expressions LanguagesRecognizedby FSA

  7. We will show: Languages Generated by Regular Expressions LanguagesRecognizedby FSA Languages Generated by Regular Expressions LanguagesRecognizedby FSA

  8. For any regular expression the language is recognized by FSA (= is a regular language) Proof by induction on the size of Proof - Part 1 Languages Generated by Regular Expressions LanguagesRecognizedby FSA

  9. NFAs regular languages Induction Basis • Primitive Regular Expressions:

  10. Inductive Hypothesis • Assume • for regular expressions and • that • and are regular languages

  11. Inductive Step • We will prove: Are regular Languages

  12. By definition of regular expressions:

  13. We need to show: Regular languages are closed under: Union Concatenation Star By inductive hypothesis we know: and are regular languages This fact is illustrated in Fig. 2 on p. 821.

  14. Therefore: Are regular languages And trivially: is a regular language

  15. For any regular language there is a regular expression with Proof - Part 2 Languages Generated by Regular Expressions LanguagesRecognizedby FSA Proof by construction of regular expression

  16. Since is regular take the NFA that accepts it Single final state

  17. From construct the equivalent Generalized Transition Graph in which transition labels are regular expressions Example:

  18. Another Example:

  19. Reducing the states:

  20. Resulting Regular Expression:

  21. In General • Removing states:

  22. The final transition graph: The resulting regular expression:

  23. Three Equivalent Representations Regular expressions Each can describe the others Regular languages Finite automata

More Related