DESKTOP

Algorithms for Compiler Design: PROPERTIES OF REGULAR SETS

7/24/2010 7:57:22 PM
2.11 PROPERTIES OF REGULAR SETS
Since the union of two regular sets is always a regular set, regular sets are closed under the union operation. Similarly, regular sets are closed under concatenation and closure operations, because the concatenation of a regular sets is also a regular set, and the closure of a regular set is also a regular set.

Regular sets are also closed under the complement operation, because if L(M) is a language accepted by a finite automata M, then the complement of L(M) is Σ* L(M). If we make all final states of M nonfinal, and we make all nonfinal states of M final, then the automata accepts Σ* L(M); hence, we conclude that the complement of L(M) is also a regular set. For example, consider the transition diagram in Figure 1.

Click To expand
Figure 1: Transition diagram.

The transition diagram of the complement to the automata shown in Figure 1 is shown in Figure 2.

Click To expand
Figure 2: Complement to transition diagram in Figure 1.

Since the regular sets are closed under complement as well as union operations, they are closed under intersection operations also, because intersection can be expressed in terms of both union and complement operations, as shown below:

where L1 denotes the complement of L1.

An automata for accepting L1 L2 is required in order to simulate the moves of an automata that accepts L1 as well as the moves of an automata that accepts L2 on the input string x. Hence, every state of the automata that accepts L1 L2 will be an ordered pair [p, q], where p is a state of the automata accepting L1 and q is a state of the automata accepting L2.

Therefore, if M1 = (Q1, Σ, δ1, q1, F1) is an automata accepting L1, and if M2 = (Q2, Σ, δ2, q2, F2) is an automata accepting L2, then the automata accepting L1 L2 will be: M = (Q1Q2, Σ, δ, [q1, q2], F1F2) where δ ([p, q], a) = [δ1 (p, a), δ2 (q, a)]. But all the members of Q1Q2 may not necessarily represent reachable states of M. Hence, to reduce the amount of work, we start with a pair [q1, q2] and find transitions on every member of Σ from [q1, q2]. If some transitions go to a new pair, then we only generate that pair, because it will then represent a reachable state of M.

We next consider the newly generated pairs to find out the transitions from them. We continue this until no new pairs can be generated.

Let M1 = ( Q1, Σ, δ1, q1, F1) be a automata accepting L1, and let M2 = (Q2, Σ, δ2, q2, F2) be a automata accepting L2. M = (Q, Σ, δ, q0, F) will be an automata accepting L1 L2.

begin
Qold = Φ Qnew = { [ q1, q2 ] }
While ( Qold Qnew )
{
Temp = Qnew Qold Qold = Qnew for every pair [p, q] in Temp do
for every a in Σ do
Qnew = Qnew δ ([p, q ], a)
}
Q = Qnew end

Consider the automatas and their transition diagrams shown in Figure 3 and Figure 4.

Click To expand
Figure 3: Transition diagram of automata M1.
Click To expand
Figure 4: Transition diagram of automata M2.

The transition table for the automata accepting L(M1) L(M2) is:

δ

A

b

[1, 1]

[1, 1]

[2, 4]

[2, 4]

[3, 3]

[4, 2]

[3, 3]

[2, 2]

[1, 1]

[4, 2]

[1, 1]

[2, 4]

[2, 2]

[3, 1]

[4, 4]

[3, 1]

[2, 1]

[1, 4]

[4, 4]

[1, 3]

[2, 2]

[2, 1]

[3, 1]

[4, 4]

[1, 4]*

[1, 3]

[2, 2]

[1, 3]

[1, 2]

[2, 1]

[1, 2]*

[1, 1]

[2, 4]

We associate the names with states of the automata obtained, as shown below:

[1, 1]

A

[2, 4]

B

[3, 3]

C

[4, 2]

D

[2, 2]

E

[3, 1]

F

[4, 4]

G

[2, 1]

H

[1, 4]

I

[1, 3]

J

[1, 2]

K

The transition table of the automata using the names associated above is:

δ

a

B

A

A

B

B

C

D

C

E

A

D

A

B

E

F

G

F

H

I

G

J

E

H

F

G

I*

J

E

J

K

H

K*

A

B


Other  
  •   Algorithms for Compiler Design: EQUIVALENCE OF TWO AUTOMATAS
  •  Algorithms for Compiler Design: CONTEXT-FREE GRAMMAR
  •  Algorithms for Compiler Design: REGULAR GRAMMAR
  •  Algorithms for Compiler Design: RIGHT LINEAR AND LEFT LINEAR GRAMMAR
  •  Algorithms for Compiler Design: Top-down parsing
  •  Algorithms for Compiler Design: Implementation
  •  Algorithms for Compiler Design: THE PREDICTIVE TOP-DOWN PARSER
  •  Algorithms for Compiler Design: A HANDLE OF A RIGHT SENTENTIAL FORM
  •  Algorithms for Compiler Design: IMPLEMENTATION in Bottom-up Parsing
  •  Algorithms for Compiler Design: THE LR PARSER
  •  Algorithms for Compiler Design: DATA STRUCTURES FOR REPRESENTING PARSING TABLES
  •  Algorithms for Compiler Design: WHY LR PARSING IS ATTRACTIVE
  •  Algorithms for Compiler Design: EXAMPLES for Bottom-up Parsing
  •  Combinations and Permutations with F#
  •  Production Diagnostics Improvements in CLR 4
  •  Using the Dynamic Keyword in C# 4.0
  •  
    Top 10
    Mobile Application Security : The Apple iPhone - Push Notifications, Copy/Paste, and Other IPC
    Exploring the T-SQL Enhancements in SQL Server 2005 : The WAITFOR Command
    Parallel Programming with Microsoft .Net : Parallel Aggregation - Variations
    Optimizing an Exchange Server 2010 Environment : Analyzing Capacity and Performance
    Programming .NET Security : Hashing Algorithms Explained
    Sharepoint 2007: Specify Your Colleagues
    Algorithms for Compiler Design: THE NFA WITH ∈-MOVES
    Choosing The Right Parts For Your Build (Part 1) - Picking the perfect processor
    Choosing The Right Parts For Your Build (Part 5) - Choosing your case & Picking the right storage
    SQL Server 2008 : Leveraging the Microsoft Sync Framework
    Most View
    Legal Trouble with Social Networks (Part 1)
    The choices of mobile computing for SOHO users (part 2)
    Infrastructure Security: The Application Level
    Sharepoint 2007: Create a New List Item
    SQL Azure Data Access
    Getting Started with MySQL Enterprise & MySQL Enterprise Components
    iPhone Application Development : Using Advanced Interface Objects and Views - User Input and Output
    How to Protect Your Mobile Devices
    Joomla! Blogging and RSS Feeds : Commenting anyone?
    The Second BlackBerry Developers Conference Asia (Part 2)
    Windows Azure : Understanding the Blob Service
    Windows Server 2008 : Understanding the Identity Management for UNIX Components
    Migrating from Legacy SharePoint to SharePoint Server 2010 : Using Visual Upgrade
    Designing and Implementing Mobility in Exchange Server 2010 : Securing Access to ActiveSync Using Internet Security and Acceleration (ISA) Server 2006
    SQL Server 2008 : Explaining Advanced Query Techniques - Creating CTEs
    Configuring Server Roles in Windows 2008 : New Roles in 2008
    Mass Effect Infiltrator
    iPhone 3D Programming : Anti-Aliasing Tricks with Offscreen FBOs (part 1) - A Super Simple Sample App for Supersampling
    Changes in Windows Vista Affecting SDI
    Search for a File or Directory