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 positive integers are closed un- der addition and multiplication, but not divi- sion. Goddard 4a: 2
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
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
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
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
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
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
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
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
Recommend
More recommend