closure properties of regular languages
play

Closure Properties of Regular Languages We show how to combine - PowerPoint PPT Presentation

Closure Properties of Regular Languages We show how to combine regular languages. Closure Properties A set is closed under an operation if applying that operation to any members of the set always yields a member of the set. For example, the


  1. Closure Properties of Regular Languages We show how to combine regular languages.

  2. Closure Properties A set is closed under an operation if applying that operation to any members of the set always yields a member of the set. For example, the positive integers are closed un- der addition and multiplication, but not divi- sion. Goddard 4a: 2

  3. Closure under Kleene The set of regular languages is closed Fact. under each Kleene operation. That is, if L 1 and L 2 are regular languages, then each of L 1 ∪ L 2 , L 1 L 2 and L 1 ∗ is regular. Goddard 4a: 3

  4. Proving Closure under Kleene The easiest approach is to show that the REs for L 1 and L 2 can be combined or adjusted to form the RE for the combination language. Example: The RE for L 1 L 2 is obtained by writing down the RE for L 1 followed by the RE for L 2 . Goddard 4a: 4

  5. Closure under Complementation The set of regular languages is closed Fact. under complementation. The complement of language L , written L , is all strings not in L but with the same alphabet. The statement says that if L is a regular lan- guage, then so is L . To see this fact, take deterministic FA for L and interchange the accept and reject states. Goddard 4a: 5

  6. Closure under Intersection The set of regular languages is closed Fact. under intersection. One approach: Use de Morgan’s law: L 1 ∩ L 2 = ( L 1 ∪ L 2 ) and that regular languages are closed under union and complementation. Goddard 4a: 6

  7. Product Construction for Intersection Each state in the product is pair of states from the original machines. Formally, if L 1 is accepted by DFA M 1 with 5- tuple ( Q 1 , Σ , q 1 , T 1 , δ 1 ) and L 2 is accepted by DFA M 2 with 5-tuple ( Q 2 , Σ , q 2 , T 2 , δ 2 ) . Then L 1 ∩ L 2 is accepted by the DFA ( Q 1 × Q 2 , Σ , ( q 1 , q 2 ) , T 1 × T 2 , δ ) where δ (( r, s ) , x ) = ( δ 1 ( r, x ) , δ 2 ( s, x )) . Goddard 4a: 7

  8. Example: Even 0 ’s and 1 ’s Suppose L 1 is the binary strings with an even number of 0 ’s, and L 2 the binary strings with an even number of 1 ’s. Then the FAs for these languages both have two states: A 1 0 0 1 0 X Y 0 B 1 1 And so the FA for L 1 ∩ L 2 has four states: Goddard 4a: 8

  9. Product Construction for Even 0 ’s and 1 ’s 1 A ,X A ,Y 1 0 0 0 0 1 B,X B,Y 1 Goddard 4a: 9

  10. Overview A regular language is one which has an FA or an RE. Regular languages are closed under union, concatenation, star, and complementation. Goddard 4a: 10

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend