# Theory of Automata

<<< Previous Row language, Nonterminals Next >>> Theory of Automata
(CS402)
Theory of Automata
Lecture N0. 42
Introduction to Computer Theory
Chapter 15
Summary
Row language, nonterminals defined from summary table, productions defined by rows, rules for defining
productions, all possible productions of CFG for row language of the example under consideration, CFG
corresponding to the given PDA
Note
As has already been discussed that the Row language is the language whose alphabet
Â = {Row1, Row2, ..., Row7}, for the example under consideration, so to determine the CFG of Row language,
the nonterminals of this CFG are introduced in the form Net(X, Y, Z)
where X and Y are joints and Z is any STACK character. Following is an example of Net(X, Y, Z)
a
b
Z
POP
POP
POP
PUSH a
PUSH b
If the above is the path segment between two joints then, the net STACK effect is same as POP Z.
For a given PDA, some sets of all possible sentences Net(X, Y, Z) are true, while other are false. For this
purpose every row of the summary table is examined whether the net effect of popping is exactly one letter.
Consider the Row4 of the summary table developed for the PDA of the language {a2nbn}
FROM
TO
POP
PUSH
ROW
Where
Where
What
What
What
Number
HERE
b
a
--
4
The nonterminal corresponding to the above row may be written as Net (READ1, HERE, a) i.e.Row4 is a single
Net row.
Consider the following row from an arbitrary summary table
FROM
TO
POP
PUSH
ROW
Where
Where
What
What
What
Number
b
b
abb
11
which shows that Row11 is not Net style sentence because the trip from READ9 to READ3 does not pop one
letter form the STACK, while it adds two letters to the STACK. However Row11 can be concatenated with some
Which gives the nonterminal
Which will be a production in the CFG of the corresponding row language.
In general to create productions from rows of summary table, consider the following row in certain summary
table
FROM
TO
POP
PUSH
ROW
Where
Where
What
What
What
Number
u
w
i
m1m2...mn
then for any sequence of joint states S1, S2, ...Sn, the production in the row language can be included as
129 Theory of Automata
(CS402)
It may be noted that in CFG, in general, replacing a nonterminal with string of some other nonterminals does not
always lead to a word in the corresponding CFL e.g. S Æ X|Y, X Æ ab, Y Æ aYY
Here Y Æ aYY does not lead to any word of the language.
Following are the three rules of defining all possible productions of CFG of the row language
The trip starting from START state and ending in ACCEPT state with the NET style
Net(START, ACCEPT, \$) gives the production of the form S Æ Net(START, ACCEPT, \$)
From the summary table the row of the following form
FROM
TO
POP
PUSH
ROW
Where
Where
What
What
What
Number
X
Y
anything
z
i
--
Defines the productions of the form Net(X,Y,z) Æ Rowi
For each row that pushes string of characters on to the STACK of the form
FROM
TO
POP
PUSH
ROW
Where
Where
What
What
What
Number
u
w
i
m1m2...mn
then for any sequence of joint states S1, S2, ...Sn, the production in the row language can be included as
It may be noted that this rule introduces new productions. It does not mean that each production of the form
Nonterminal Æ string of nonterminals, helps in defining some word of the language.
Note
Considering the example of PDA accepting the language {a2nbn:n=1, 2, 3, ...}, using rule1, rule2 and rule3 the
possible productions for the CFG of the row language are
S Æ Net(START, ACCEPT, \$)
Net(START, HERE, \$) Æ Row1Net(READ1, HERE, \$)
Net(START, ACCEPT, \$) Æ Row1Net(READ1, ACCEPT, \$)
130 Theory of Automata
(CS402)
Following is a left most derivation of a word of row language
fi Net(START, ACCEPT, \$)
S
...
using 1
...
using 9
fi Row1Row2Net(RD1,RD2, a)Net(RD2,AT, \$)
...
using 20
fi Row1Row2Row3Net(RD1, HERE,a)Net (RD2,HERE,a)Net(RD2,AT,\$)...
using 27
fi Row1Row2Row3Row4Net(HERE, RD2, a)Net(RD2, ACCEPT, \$)
...
using 2
fi Row1Row2Row3Row4Row5Net(HERE, ACCEPT, \$)
...
using 3
fi Row1Row2Row3Row4Row5Row7
...
using 5
Which is the shortest word in the whole row language.
It can be observed that each left most derivation generates the sequence of rows of the summary table, which are
both joint- and STACK- consistent.
Note: So far the rules have been defined to create all possible productions for the CFG of the row language.
Since in each row in the summary table, the READ column contains L and D in addition to the letters of the
alphabet of the language accepted by the PDA, so each word of the row language generates the word of the
language accepted by the given PDA.
Thus the following rule 4 helps in completing the CFG corresponding to the given PDA
Each row of the summary table defines a production of the form Rowi Æ a where in Rowi the READ column
consists of letter a.
Application of rule 4 to the summary table for the PDA accepting {a2nbn : n=1,2,3,...} under consideration adds
the following productions
Row1 Æ L
Row2 Æ a
Row3 Æ a
Row4 Æ b
Row5 Æ L
Row6 Æ b
Row7 Æ D
Which shows that the word Row1Row2Row3Row4Row5Row7 of the row language is converted to LaabLD = abb
131