You are on page 1of 3

HW1 Q4

Name of member 1:
Roll no. of member 1:
Name of member 2:
Roll no. of member 2:

(Rename file to CSE322-HQ4-Roll1-Roll2)

Figure out how to use Math equations and symbols in Google Doc, either from Menu -> Insert ->
Equation or via plugins. Enabling Offline Editing may be useful. You can also type using ASCII
as is shown in the solved example that uses LATEX symbols in text.

Adhere to page limits. Anything above the limit may be ignored.

You cannot assume any property of the extended transition function other than what has been
discussed in lecture. If you need any such property, you must prove it no matter how obvious it
seems.
HQ4. [Page limit 2 pages] You are given an NFA N=<Q,A,d,q0,F>. Construct another NFA
M=<Q,A,d,q0,E> where E is defined as the set of those states that have some path (using
0 or more transitions) to some final state.
(a) Give a recursive definition of E and use that to design an algorithm to construct E
just like we did for e-closure.
(b) Give a simple interpretation of the strings in L(M), i.e., construct a language K that
“intuitively” represents the strings accepted by M. Hint: Feel free to use standard
string operations/operators.
(c) Give a formal proof that M indeed accepts K using δ^ . You may first want to
present a set theoretic characterisation of E (e.g., E = { q in Q : … }). Hint: Avoid the
temptation to use graph-theoretical notations like edge, path, etc.

(a) E can be defined as a set of states such that:


*FE
* if there exists some q  Q and some symbol a  A U {e} such that d(q,a) ∩ F is not
empty, then q  E
* No other state is in E (it is okay to not write this, even though you should ideally make
this explicit)

Algorithm to construct E:
def ConstructE():
E=F
while (flag is false):
flag = true
for all q in Q – E and all a in A U {e}: // important to search only in Q – E to end the loop
for all r in d(q,a):
if r is in E: add q to E, flag = false, continue
return E

(b) K = { prefix of z : z is a string in L(N) } = = { w : there exists some string


x s.t. wx  L(N) }

(c) First, we write E = { q : there is some string z such that d’(q,z) has some state from F }
Now, M accepts w
iff w is in L(M)
iff d’(q0,w) has some state from E ................. [using definition of acceptance by NFA]
iff there exists some state q s.t. q  d’(q0,w) and q  E
.................................. [expanding d’(q0,w) has some state from E]
iff there exists some state q s.t. q  d’(q0,w) and there exists some string z s.t. d’(q,z)
has some state from F
.................................... [using definition of E]
iff there exists some state q and some string z s.t. q  d’(q0,w) and d’(q,z) has some
state in F ........ [moving “there exists z” forward since “q is in d’(q0,w)” does not depend on z]
iff there exists some string z s.t. d’(q0,wz) has some state in F ........[by Claim 2 below]
iff there exists some string z s.t. wz  L(N) ......[using definition of acceptance by NFA]
iff w  K. (QED) ................................................[using definition of K]

Claim 1: We will first prove using induction on y.

Base case: y is the empty string.


LHS becomes .

RHS becomes .
So, the claim holds for the base case.

IH: Assume that the claim holds for any string of length n.
IS: Consider a string w of length n+1, i.e., w=xa where a is a symbol and x is a string.

LHS becomes

RHS becomes
So the claim holds for w as well.
Hence, the claim holds for all strings.

Claim 2: Using Claim 1,


Since q  d’(q0,w), using Claim 1, d’(q,z) is a subset of d’(q0,wz).
Further, since d’(q,z) has some state in F, using the previous statement, d’(q0,wz) also has
some state in F. This proves Claim 2 used in the proof above.

You might also like