TOC-As-3
1. Construct NPDA’s that recognize the following languages over . (10 pt for each)
a.
b.
c.
2. Show that the language is not contexr-free.
Let
Assume L is context-free.
Let
And
Suppose
By the pumping lemma,
Because
Thus
Therefore
Which means
Therefore
Therefore L is not context-free.
3. Convert the following grammar to an NPDA. (8pt)
4. Let . Design a (nondeterministic) TM for each following language. (10 pt each)
a.
b.
c.
d.
5. Design a TM for each integer subtraction: for . You need to clearly how the input and the side effect are encoded. (8pt each)
Let
- Use
0
to represent positive numbers in the unary system. - Use
#
as a separator between the two numbers. - Use
-
as a special marker to indicate a negative result when. - Use
x
as a symbol to do the subtraction.
Input Format
- The first part of the tape will consist of a sequence of
0
s representing. - The second part, after the separator
#
, will contain a sequence of10
s representing.
For example:
000#00
represents, should be output as 0
(positive result).00#000
represents, and should be output as -0
(negative result).