1 / 16

Closure Properties for Regular Languages

Closure Properties for Regular Languages. Preliminaries. So far, we have stated languages in plain English. For example: “all words starting and ending with the character b ” The description in plain English can be cumbersome and ambiguous

duscha
Download Presentation

Closure Properties for Regular 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. Closure Properties for Regular Languages

  2. Preliminaries • So far, we have stated languages in plain English. For example: “all words starting and ending with the character b” • The description in plain English can be cumbersome and ambiguous • “Regular Expressions” is a formal way to describe languages accepted by finite automata

  3. Regular Expressions Regular Expressions are built upon a subset of the following operations on sets: • Union • Complementation • Intersection • Difference • Concatenation • Kleene star

  4. Union Let L and M two languages, then their union is defined by: L  M = { w : w  L or w  M} Let AL and AM two finite automata accepting L and M respectively: AL: AM: s > s’ > … … Is there a finite automata accepting L  M ?

  5. Union (2) Is there a finite automata accepting L  M ? Yes! AL s e … q > e s’ AM …

  6. Complement Let L be a language over an alphabet , then the complement of L is defined as: LC = { w : w  * and w  L} Let AL be a finite automaton accepting L. Is there a finite automaton accepting LC? b b a a f s q b b P a a

  7. a r r s q q > b b b Complement (2) a r r s q q > b b b

  8. Complement (3) Given a language accepted by a finite automaton AL, to find a finite automaton accepting LC we have to do the following steps: 1. Transform AL into an equivalent DFA AL’ 2. Construct a new automaton ALC by taking AL’and: 2.1 Removing the favorable marks of all favorable states 2.2 Marking as favorable those states that initially had no favorable mark The resulting ALC is a DFA accepting LC

  9. Intersection Let L and be M two languages, then their intersection is defined by: L  M = { w : w  L and w  M} Using DeMorgan’s Laws: (L  M) = (LC MC)C Thus, there must be a finite automaton accepting (L  M)

  10. Difference Let L and M be two languages, then their difference is defined by: L  M = { w : w  L and w  M} Using DeMorgan’s Laws: (L  M) = L  MC Thus, there must be a finite automaton for (L  M)

  11. Concatenation Let L and M be two languages, then their concatenation is defined by: LM = { wv : w  L and v  M} b b A: B: a a s f a s f b a b b P a How to extend these automata such that the resulting one accepts the concatenation language?

  12. Concatenation (2) AL e s > s’ e AM … e … Steps to obtain a finite automation accepting LM: 1. Make an e-transition from all favorable states in AL to the initial state in AM 2. Unmark all favorable states in AL 3. Remove the mark of the initial state in AM

  13. Kleene Star Let L be a language over an alphabet an alphabet , then we define: L0 = {e} L1 = L L2 = LL L3 = L2L = LLL … Ln = Ln-1L Kleene star of L is defined as: L* = L0 L1 L2 …

  14. Kleene Star (2) An equivalent definition: L* = {w1 w2 … wk : w1, w2, …, wk  L} b A: a s > f a b b P a Obtain a finite automaton accepting L(A)*

  15. Kleene Star (3) e e AL s > s’ e e … e This finite automaton accepts L*

  16. Closure under Set Operations Theorem Theorem. Let L and M two regular languages, then the following languages are also regular: • L  M • LC • L  M • L – M • LM • L* One says that the regular languages are “closed” under these 6 operations

More Related