JFLAP Manual PDF
JFLAP Manual PDF
JFLAP Manual PDF
Running JFLAP
Download JFLAP and the fles referenced in this book from www . j flap. org to get started.
JFLAP is written in Java to allow it to run on a range of platforms. JFLAP requires that
your computer have Java SE 1. 4 or later installed. JFLAP works with Java 1.5. For the latest
version, visit http://java.sun.com/ . Mac OS X's latest Java release, if not already preinstalled,
is available from http://www.apple. com/j ava/, or from Software Update.
With Java SE 1. 4 or later installed on your computer, you may attempt to run JFLAP. JFLAP
is distributed as an executable .jar (Java ARchive) fle. JFLAP may be run as either an application
or applet. The following table lists how to run the JV. jar executable .jar as an application on
your platform of choice.
Windows Double click on Ji. jar; the fle will appear as Ji if sufx hiding is
on.
Unix & Linux From a shell with the JV. jar fle H the current directory, enter the
command java -jar JV.jar.
Mac OS X The Windows and Unix directions will work on a Mac.
JFLAP Interface Primer
We cover universal elements of the JFLAP interface here. To begin, start JFLAP. When JFLAP
has fnished loading, a window will appear similar to that shown in Figure 1. This window ofers a
choice of major structures if you wish to create a new structure; alternatively, the File menu allows
you to open an existing saved structure or quit JFLAP.
Throughout this book we shall review the creation of these structures. However, right now we
are going to open a JFLAP saved fle of an existing fnite automaton (FA) . From the File menu,
choose Open. JFLAP allows users to save and open fles that contain a single structure. Select
and open the fle exO. 1 a. A new window will appear with an FA.
We refer to all the things you can do to a structure as operators. (It is not necessary to under
stand what the operators are doing at this point; our purpose is to describe JFLAP's interface. )
xvi
xvii
Figure 1: The window that appears when you start JFLAP.
Operators are typically activated through the menu items. Choose th ' t
.
r ht N d
e menu 1 em Test : HIgh-
Ig on
.
eter
.
minism. (This activates an operator that shades nondeterministic states in an
automaton, H thIS case Q and ) N t h
g ql
ex , c oose the menu item Test ' Highlight A T 't
'
(Th' t' t
' - anSI IOns
IS ac Iva es an operator that highlights A-tr ' t '
.
.
.
1 b 1 d
anSI IOns H an automaton, H this case the arc
a e e A. ) We chose these two operators because they require no intervention from the user.
Nondetrmhdsti 5E5 E highlghted.
Figure 2: An illustration of the window for a structure, with three tabs active.
The window for a structure consists of a menu bar that contains operators you may apply t th
structure and a tabb d . t f b
O e
, e zn erJace elow the menu bar. Note that JFLAP k
.
eeps everythzng related
JFLAP STARTUP
XVlll
to a structure in a single window, and uses tabs to manage multiple operators active at the same
time. The results of the two operators we invoked are displayed in tabs, so there are currently three
tabs: Editor, Nondeterminism, and A-Tansitions. In Figure 2, the Nondeterminism tab
is selected, indicating that the interface for the "highlight nondeterminism" operator is currently
active and displayed. To switch to another operator, click on its tab. (Note that you cannot switch
to the Editor tab at this time. This is because the other two currently active operators depend
on the automaton not changing. )
We will now remove the Nondeterminism and A-Tansitions tabs. To get rid of a tab, select
the menu item File : Dismiss Tab. This will remove the currently active tab. When it is gone,
remove the other tab as well. (JFLAP prevents removal of the Editor tab. )
As a last step, peruse the contents of the File menu. Use New when you want to create a new
h N
.
I cted JFLAP will display
.
the window shown in Figure 1 that allows
structure; w en ew is se e ,
you to choose a type of structure to create. The Open, Save, and Save As menu items allow
you to read and write structures to fles like any other application that deals with documents. he
Close item will close the window of the structure. The Print item will print the currently active
tab. Quit will stop JFLAP entirely.
Chapter 1
1Hle ^DlOHulu
A fnite automaton is the frst type of representation for a regular language that we will examine.
In this chapter we will construct a deterministic fnite automaton (DFA) in JFLAP, illustrate
several methods of simulating input on that automaton, discuss nondeterministic fnite automata
(NFAs) in JFLAP, and present simple analyses that JFLAP may apply to automata. We present a
standard defnition of a DFA in Sections 1. 1-1. 4, and show in the optional Section 1. 5 how JFLAP
handles a more general defnition of a DFA with multiple character transitions.
J.J A Simple Finite Automaton
d
Figure 1. 1: A fnite automaton (FA), which recognizes the language of any number of a's followed
by any odd number of b's.
In this section you will learn how to build automata in JFLAP by way of constructing, with
help, the DFA that recognizes the language of strings of any number of a's followed by any odd
number of b's (e. g. , ab, bbb, aabbbbb) . This section will teach the essentials of automaton editing
in JFLAP: creating and deleting states and transitions, moving existing states, editing existing
transitions, and setting states to be initial and fnal. When you are done, you will have a machine
like that pictured in Figure 1. 1!
The frst step is, of course, to start JFLAP. Once JFLAP is running, you begin building an FA
by clicking on the button labeled Finite Automaton. A window will appear with (from top to
bottom) a menu, a tab that says Editor, a tool bar, and a large blank area at the bottom.
1
CHAPTER 1. FINITE AUTOMATA
2
1.1.1 Create States
All automata require a set of states. Before you can create states you must frst activate the State
Creator tool: click on the button below the window's menu bar. This button will now appear
shaded to indicate that tool is active.
The large blank area below the tools, called the canvas, is where the automaton is created and
edited. Now that the State Creator tool is active, click on the canvas to create a state. A state will
appear under the location where you clicked. As you will see, states in JFLAP are yellow circles
with some identifying text inside. Click three more times in three other locations to create three
more states. There will now be four states on the canvas, with the text qo, ql, q2, and q3 to identify
,each of them.
1.1.2 Defne the Initial State and the Final State
All automata require an initial state and a set of fnal states. In this automaton we will make qo
the initial state, and ql the single fnal state. Select the Attribute Editor tool, by clicking the
button. Two of this tool's many functions are to defne an initial state and to defne the set of fnal
states. (This tool's other functions are described in Section 1. 1. 5. )
Now that the Attribute Editor tool is selected, right-click on qo (or, control-click if you are a
Macintosh user with a single mouse button) . A pop-up menu above the state will appear with
several items, including two items Final and Initial. Select the item Initial. The state qo will
now have a white arrowhead appear to its left to indicate it is the initial state. Similarly, right-click
on the state ql, and select the item Final. The state ql will now have a double outline instead of
a single outline, indicating that this state is a member of the set of fnal states.
You may fnd it necessary to set a fnal state as nonfnal. To illustrate how, right-click on ql
once you have marked it as fnal. Notice that the item Final now has a check mark next to it .
Select the item Final again. This will toggle ql out of the set of fnal states. Before you proceed,
you must of course put ql in the set of fnal states again!
1.1.3 Creating Transitions
We will now create transitions. In this machine, three transitions are necessary: three on b from qo
to ql, ql to q2, and back again from q2 to ql, and a loop transition on 0 for state qo
We will create
others for illustrating some special features, and for later illustration of the Deleter tool.
To create these transitions, select the Transition Creator tool, denoted by the . icon. The
frst transition we are going to create is the b transition from qo to ql
Once the Transition Creator
tool is selected, press the mouse cursor down on the qo state, drag the mouse cursor to the ql state,
and release the mouse button. A text feld will appear between the two states. Type "b" and
1.1. A SIMPLE FINITE AUTOMATON 3
press return. A new b transition from qo to ql will appear. By the same method, create the two b
transitions from ql and q2 and from q2 and ql
Tip As an alternative to pressing return, you can stop editing a transition merely by doing
something else like clicking in empty space but not on a state! ) , or creating another
transition by dragging between two other states. If you wish to cancel an edit of a
transition, press Escape.
The next transition is qo's loop transition on 0. Creating loop transitions on a state is just like
other transitions: you press the mouse on the start state and release the mouse on the end state.
However, because the start and end states are the same for a loop transition, this is the same as
clicking on the state. So, click on state qo, and enter "a" and press return, just as you did for the
b transitions.
Lastly, create three transitions from qo to q3, the frst on the terminal 0 another on b, and a
third on C. Notice that JFLAP stacks the transition labels atop each other.
Tip If you are in the process of editing a transition from a state g to a state g and you
wish to create another transition from state g to state g_ without having to use the
mouse, press Shift-Return. This creates a new transition from g to g in addition to
ending your editing of the current transition.
1.1.4 Deleting States and Tansitions
.
You probably noticed that the automaton built requires three states, not four. This fourth state q3
and the transitions going to it are unneccessary and can be removed. Deleting objects has a tool
all its own: click the: button to activate the Deleter tool.
First, we want to remove the transition on b from qo to q3. To delete this transition, click on
the b. The b transition will be gone, leaving the 0 and C transitions. You can also click on the
transition arrow itself to delete a transition: click on the arrow from qo to q3, and notice that the 0
transition disappears. The C transition remains. When you click on the arrow, the transition with
the label closest to the arrow is deleted.
Deleting states is similar. Click on the state q3. The state q3 will disappear, and notice that the
C transition is gone as well. Deleting a state will also delete all transitions coming from or going
to that state. You should now be left only with the other three states and the transitions between
them.
1.1.5 Attribute Editor Tool
ec ion . . , ut it as many other functions We already used the Attribute Editor tool l'n S t' 1 1 2 b
.
h
related to modifcation of attributes of existing states and transitions. Select the Attribute Editor
tool once again as we walk through examples of its use.
4 CHAPTER 1. FINITE AUTOMATA
Setting states as initial or fnal
This tool may set states as initial or fnal states as described in Section 1. 1. 2.
Moving states and transitions
When you initially placed the states for the FA built earlier you may not have arranged them in
a logical order. To move a state, press on the state and drag it to a new location. Dragging a
transition will likewise move its two associated states. Attempt this now by dragging states and
transitions.
Editing existing transitions
To edit an existing transition, simply click on it! Try clicking the transition from qo to ql The
same interface in which you initially defned this transition will appear on the transition and allow
you to edit the input characters read by that transition.
Labels
When you set the state qo as the initial state and the state ql as a fnal state, perhaps you noticed
the menu item Change Label. Right-click on q2 and select Change Label. A dialog box will
appear, asking for a label. When processing input, while the machine is in state q2 , we shall have
processed an even number of b's, so enter "even # of b' s". A box will appear under the state with
this label. By a similar token, label ql "odd # of b' s". To delete an existing label from a state
choose the menu item Clear Label from the same menu. Alternatively, the menu item Clear All
Labels will delete all labels from all states.
If you right-click in empty space, a diferent menu will appear, with the item Display State
Labels. This will initially have a check mark next to it to indicate that it is active. Select it.
The labels will become invisible. Hover the mouse cursor over q2; after a short time, a tool-tip will
appear to display the label even # of b's. Right-click in empty space once more, and reactivate
Display State Labels; the labels will appear again.
Automatic layout
Right-click in empty space again. Notice the menu item Layout Graph. When selected, JFLAP
will apply a graph layout algorithm to the automaton. While usually not useful for automata you
produce yourself, many of JFLAP' s algorithms automatically produce automata, often with large
numbers of states. If you fnd JFLAP' s frst attempt at automatic layout inappropriate, this may
alleviate the tedium of moving those states yourself.
1.2. SIMULATION OF INPUT
J.2
Tip
Figure 1. 2: In the midst of the simulation of aabbb on our FA.
In addition to activating a tool by clicking on its button in the tool bar, there are also
shortcut keys available for quickly switching tools. For example, hover the mouse over
the State Creator tool after a little while a tool-tip will appear with the text (5)tatc
Ctcatot. The parentheses enclosing the 5 indicate that this is the shortcut key for the
State Creator tool. Note that in spite of appearances, shortcut keys are really lower
case, so do not press Shift when typing the shortcut key for a tool!
Simulation of Input
5
I this section we cover three of JFLAP' s methods to simulate input on an automaton: stepping
WIth closure, fast simulation, and multiple simulation. The fourth, stepping by state, is discussed
briefy in Section 1.3.
1.2.1 Stepping Simulation
The stepping simulation option allows you to view every confguration generated by an automaton
in its attempt to process an input string. Figure 1. 2 shows a snapshot of a stepping simulation of
the iput string aabbb on the automaton you built in Section 1. 1, also stored in fle exl. la. The top
portIOn of the window displays the automaton, with the state in the active confguration shaded
darker. The portion below the automaton displays the current confguration. In Figure 1. 2, notice
the confguration is in state qo, and that the frst two characters aa are grayed-out, indicating that
they have been read, while the three characters bbb are not grayed-out, indicating that they remain
to be read.
6 CHAPTER 1. FINITE AUTOMATA
Try stepping
We shall walk through the process of stepping through input in an automaton. First, select the
menu item Input : Step with Closure. A dialog box will ask for input for the machine: enter
"aabbb" and press Return or click OK.
Your window will now appear similar to Figure 1. 2. The single confguration displayed will be
on the initial state Qg, and have the unprocessed input aabbb.
The tool bar at the bottom is your interface to the simulator. Click Step. The old confguration
on Qg has been replaced with a new confguration, again on the state Qg but with the character
a read. Notice that the frst character a in the input has been lightened a bit to indicate that it
.has been read. Click Step twice more, and it will go from Qg to qg again, and then to Q_ with the
input bb remaining.
Some of the operations in the tool bar below the confguration display act only on selected
confgurations. Click on the confguration; this will select it (or deselect it if it is already selected) .
A selected confguration is drawn shaded. Click Remove. Unfortunately, this deletes the only
confguration! The simulator is useless. Oops! Click the Reset button; this will restart the
simulation, so you can try again.
With the simulation back to its original state, click Step repeatedly (fve times) until all the
input is read. The confguration at this point should be drawn with green background, indicating
that it is an accepting confguration, and that the machine accepts the input. FA confgurations
are accepting confgurations if all the input is read and it is in a fnal state. The confguration's
input is entirely gray, indicating that all the input has been read.
One can Trace a confguration to see its ancestry from the initial confguration. (Do not select
a confguration; press Trace instead. An error message indicates that Trace requires a selected
confguration! ) Now select the single confguration, and click the Trace button. A window will
show the ancestry of this confguration, starting with the initial confguration on top and the
selected confguration on the bottom. When you've had a chance to look over the trace of the
confguration, close this window.
To return to the editor, choose File : Dismiss Tab to dismiss the simulator.
Failure
On the fip side of an accepting confguration is a rejected confguration. A rejected confguration
is one which (1) does not lead to any more confgurations and (2) is not accepting. Run a stepping
simulation again, except this time with the input aabb. Since this has an even number of b's the
machine will not accept it. Click Step repeatedly, and note that eventually the confguration will
turn red. This indicates that it is a rejected confguration.
1.2. SIMULATION OF INPUT
7
Figure 1.3: The result of performing a fast simulation of aabbb on the automaton.
1.2.2 Fast Simulation
Steping thro
.
uh simulation of input is fne, but Fast Run will reveal if the automaton accepts
a strmg and, If It does, the series of confgurations leading to that string's acceptance without the
bother of having to repeatedly step through the machine watching for accepting confgurations.
Choose Input : Fast Run. When prompted for input, enter the same "aabbb" string. The
result after JFLAP determines that the machine accepts this input is shown in Figure 1. 3. The trace
of confgurations from top to b tt (
.
f
. . . 1 .
. .
'
O om 1.e. , rom Imtla to acceptmg confguration) , is displayed.
AlternatlVely, If the machine did not accept this input, JFLAP would report that the string was
not accepted.
Notice te to buttons near the bottom of the dialog box. I'm Done will close the display.
Keep Lookmg IS useful for nondeterministic machines and is covered later in Section 1. 3. 2.
1.2.3 Multiple Simulation
The third method for simulating input on an automaton is Multiple Run. This method allows
oe to peform multiple runs on a machine quickly. Select Input : Multiple Run now. (Your
dIsplay WIll not resemble Figure 1. 4 exactly, but do not worry! ) The automaton is displayed to the
left, and on the right is an empty table where you may enter inputs for multiple runs. One enters
inputs in the Input column. Select the upper-left cell of this table, enter the input "aabbb", then
2
8
CHAPTER 1. FINITE AUTOMATA
Figure 1.4: An example of simulating multiple entries. The second-to-last
input is the empty string, entered with Enter Lambda.
press return. Notice that instead of one row there are now two: the table will grow to accommodate
more entries as you enter them.
Continue entering various inputs you wish to test on the machine; whichever you choose is up
to you. If you wish to make a lambda entry-that is, test to see if the automaton accepts the
empty string-then while entering an input, click the Enter Lambda button near the bottom of
the window, and that input feld will hold the empty string. When you have entered all inputs and
wish JFLAP to simulate all these strings, click Run Inputs. Notice that the Result column is
now full of Accept and Reject entries, indicating whether an input was accepted or not. View
Tace will show the trace of the last confguration generated for each selected run in the table.
Clear will clear the table of all inputs.
Tip For convenience, the multiple run simulator will remember all inputs entered by the
user between machines. For example, suppose you have one automaton, and perform
multiple runs on that machine. If you later perform multiple run simulation on a different
automaton those same inputs will appear.
J. Nondeterminism
In this section we will talk about NFAs in JFLAP, using the automaton pictured in Figure 1. 5 as
our example.
Either of two conditions imply that an FA is nondeterminstic. The frst condition is, if the FA
has two transitions from the same state that read the same symbol, the FA is considered an NFA.
1.3. NONDETERMINISM
Figure 1.5: An NFA that accepts the language of a series of a's followed by a
series of b's, where the number of a's is nonzero and divisible by 2 or 3, and
the number of b's is divisible by 2 or 3.
9
For example, ql of the FA in Figure 1. 5 has two outgoing transitions on a. The second condition
is: if the FA has any transitions that read the empty string for input , the FA is nondeterministic.
1.3.1 Creating Nondeterministic Finite Automata
Creating an NFA is much the same as creating a DFA. Select File : New, and then select Finite
Automaton to get a new window. In this window we will create the automaton shown in Figure 1.5,
that accepts the language anbm, where U ` 0 and is divisible by 2 or 3 and H 2 0 and is divisible
by 2 or 3. The frst step is to create the thirteen states of the automaton, and to make qo the initial
state and make Q and ql1 the fnal states.
Note that JFLAP numbers states in the order that you create them: the frst state is qo , the
second ql , and so on. It is important to respect this order: the following discussion assumes that
you create the states in such an order that they are numbered as they are in Figure 1. 5.
Notice the four transitions in Figure 1. 5 with a A ,the Greek letter lambda, . These A-transitions
are transitions on the empty string. To enter a A-transition, create a transition, but leave the
feld empty. When you fnish editing, a transition with the label A will appear. Create the four
A-transitions from q3 and qg to Q and qn.
Once you have created the A-transitions, create the other transitions on the symbols a or b.
10 CHAPTER 1. FINITE AUTOMATA
Figure 1.6: Step with closure simulation of aaaabb on our NFA after two steps.
1.3.2 Simulation
D
.
I t
.
ut on a deterministic machine will produce a single path of confgurations, unng Slmu a lOn, lnp
. ,
while input on a nondeterministic machine may produce multiple paths of confguratlOns. JFLAP s
simulators have features to deal with this possibility.
Stepping simulation: Step with Closure
.
I t Step with Closure and input the string "aaaabb", that is, four Select the menu ltem npu .
,
a's followed by two b's. This is a string that will eventually be accepted since the numbr
.
of a s
.
d d
.
bl b 2 and the number of b' s is divisible by 2. After you enter thlS mput, lS nonzero an lV1Sl e y
.
h ld see the familiar step simulator, with a starting confguration on qg with all the mput you s ou
. .
r k
. .
b d cr ck Step once to move this confguratlOn to ql. However, lf you c lC remammg to e processe . 1
Step a second time you will see a rather unfamiliar sight, as shown in Figure 1. 6.
. .
Notice that there are four confgurations in your simulator. This is because your machme lS
d
. .
t
.
Th last confguration was on ql with the unread input aaabb, and ql has a non etermmlS lC. e
.
However, what two confgurations on q6 and qn? These confguratlOns transitions to q2 and qg.
are ue to e A ransl ! . d th \ t
k t t " " " b" " b" "b " "ba a" and "bba" Select
and any addltlOna ones you ! e O ry: a , aa , aaaa , aa , a , .
Run Inputs and examine the results. Do the strings have the same result in both DFAs? There
is at least one string in which the result is Accept for one DFA, and Reject in the other DFA.
Thus the two states qo and ql are distinguishable and cannot be combined.
N ow we will examine the two states q2 and q5 to see if they are distinguishable. Dismiss the tab
in both windows to go back to the DFA window. In one window change the start state to q2 , and
in the other window change the start state to q5 . Select Input : Multiple Run again. Notice
that the strings from the last run still appear in the window. Select Run Inputs to try these
same strings. Type in additional strings and try them as well. Are these states distinguishable
or indistinguishable? They are distinguishable if there is one string that accepts in one and does
not accept in the other. All strings must be tested to determine if the states are indistinguishable.
Clearly it is impossible to test all strings, so a reasonable test set should be created.
2.2. DFA TO MINIMAL DFA 25
Figure 2. 8: Initial split of fnal and nonfnal states.
2.2.2 Conversion Example
We go through an example of converting a DFA to a minimum state DFA. Remove the previous
windows (without saving them) and load the fle ex2. 2a again, which should have the start state
qo. Select Convert : Minimize DFA. The window splits into two showing the DFA on the left
and a tree of states on the right.
We assume that all states are indistinguishable to start with. The root of the tree contains all
states. Each time we determine a distinction between states, we split a node in the tree to show
this distinction. We continue to split nodes until there are no more splits possible. Each leaf in the
fnal tree represents a group of states that are indistinguishable.
The frst step in distinguishing states is to note that a fnal and a nonfnal state are diferent.
The former accepts A and the other does not. Thus the tree has already split the set of states into
two groups of nonfnal and fnal states as shown in Figure 2. 8.
For additional splits, a terminal will be selected that distinguishes the states in the node. If
some of the states in a leaf node on that terminal go to states in one leaf node and other states on
that same terminal go to states that are in another leaf node, then the node should be split into
two groups of states (i. e. , two new leaf nodes) .
Let's frst examine the leaf node of the nonfnal states (0, 1, 2, 4, 5, 7) . What happens for each
of these states if they process a b? State qo on a b goes to state q2 , state ql on a b goes to state
qo, and so on. Each of these states on a b goes to a state already in this node. Thus, b does not
distinguish these states. In JFLAP, click on the tree node containing the nonfnal states. (Click on
the circle, not the label or the word Nonfnal . ) The states in this node are highlighted in the DFA.
Try to split this node on the terminal b. Select Set Terminal and enter b. A message appears
informing you that b does not distinguish these states.
Again select Set Terminal and enter the terminal 0. Since a does distinguish these states, the
node is split, resulting in two new leaf nodes. The set of states from the split node must be entered
into the new leaf nodes, into groups that are indistinguishable. A state number can be entered by
26
CHAPTER 2. NFA TO DFA TO MINIMAL DFA
Figure 2. 9: Split node on O.
Figure 2. 10: Node (0, 1, 2, 4, 5, 7) split on O.
frst selecting the leaf node it will be assigned to, and then clicking on the corresponding state in
the DFA. Click on the left leaf node and then click on state qo in the DFA. The state number 0
should appear in the leaf node, as shown in Figure 2. 9.
State qo on an O goes to state q5 , which i s i n the node we are splitting. Note that states ql , q4 ,
and q7 on an O also go to a state in the node we are splitting. Add all of them to the same new leaf
node as 0 by clicking on these states in the DFA. The remaining states, q2 and q5 on an O, go to a
fnal state, thus distinguishing them. Click on the right new leaf node, and then click on states q2
and q5 to enter them into this node, resulting in the tree shown in Figure 2. 10. To see if we have
done this correctly, click on Check Node. Figure 2. 10 shows the resulting tree after splitting this
node on O.
2.2. DFA TO MINIMAL DFA
Figure 2. 1 1 : The completed tree of distinguished states.
The states can be collapsed in any order. However, to understand the following discussion, you
will need to collapse states in the given order. Select the State Collapser tool . Once selected,
click frst on state q2
A window like the one shown in Figure 4. 17 appears that informs you of the
new labels for transitions before the collapse occurs. Let 7ij be the expression of the transition from
qi to qj . The rule is, if we are removing qk , for all states qi and qj so that i i k and j i k, 7ij is
replaced with 7ij + 7ik7kk7kj . In other words, we compensate for the removal of qk by encapsulating
in the walk from qi to qj the efect of going from qi to qk (hence 7ik) , then looping on qk as much
as we please (hence 7kk) ' and then proceeding from qk to qj (hence 7kj) . Lastly, note that 0 obeys
the following relations: if 7 is any regular expression, 7 + 0 = 7, 70 = 0, and 0* = A.
Select the row that describes the new transition from ql to ql (the loop transition on ql ) ,
d+e+ca*c. The transitions from which this new transition is composed are highlighted in the GTG.
There are two paths that must be combined into one expression transition, the walk from ql to ql ,
d+e, and the alternative walk from ql to ql that goes through q2 , ca*c. More formally, 71, 1 = d+e,
71 , 2 = 72, 1 = c, and 72,2 = a, so the new transition is 71 1 + 71 272* 272 1 = d + e + ca* c as JFLAP ,
' "
M
58
CHAPTER 4. REGULAR EXPRESSIONS
indicates.
The rules for operations on the empty set are more unfamiliar. Select the row that describes
the new transition from ,,to ql . There are two paths that must be combined into one expression
transition, the walk from ,,to qo, b, and the alternative walk from ,,to ,,that goes through
q, , 0a*c. More formally, , = b,
,,
*
,,
,
. Defnition of an RE in JFLAP
Let " be some alphabet. The set of all possible regular expressions is given by R.
R = {0, A} U " U {abl a, b E R} ' {a+bl a, b E R} ' {a*l a E R} ' {(a) la E R}
. Summary
In Section 4. 1 we learned how to edit regular expressions (REs) . JFLAP respects the following
operators in order of decreasing precedence: the Kleene star (the * character) , concatenation
(implicit by making two expressions adjacent) , and lastly, union (the character) . Parentheses