doc

advertisement
Q1:
If a language has a finite alphabet and no string of infinite length then the language
must have a finite number of strings.
Answer: False
It is possible that a language could have an infinite number of strings despite the fact
that the alphabet is finite and no string is of infinite length.
Example:
Given  = {1, 0}
L = 0+
i.e., L = {0, 00, 000, 0000, …}
The alphabet is finite. It has two characters to be exact.
L has an infinite number of string, i.e., |L| = . Clearly, it never ends, we can keep
appending zeros forever.
But, most importantly, all of the strings in L have finite length (see proof below)
Proof by induction:
Define: 0i as the ith string of L
1. 01 is clearly finite, i.e., it has exactly one character. Specifically, |01| = 1
2. Assume 0i is finite (induction hypothesis). Specifically, |0i| = finite value.
3. Now, we will prove that 0i+1 is finite.
Note that 0i+1 = 0i01, so
|0i+1| = |0i| + |01| = finite value + 1
Since any finite value plus one is also finite, we have proven that 0i is finite for all values
of i greater or equal to 1.
In other words, all of L’s strings are finite in length.
Now it is very natural to protest this proof. Consider the case of 0 ∞. Clearly this string
must be in L (because it is composed only of zeros) and clearly it is NOT finite (because it
is composed of infinite zeros) So, what have we done wrong?
Is 0∞ actually finite? No way!
Is our induction proof wrong? No, but induction doesn’t prove anything about infinite
values or strings.
Is 0∞ not actually in L? Hmm?
How do we resolve this inconsistency?
It turns out that we really cannot say whether or not 0∞ is in L. Or more generally, we
cannot say that any infinite string is in a set or language. Why? It cannot be
computationally verified and induction proofs do not hold for infinite values.
Consider these three illuminating cases:
1. Given a finite value (say x), I can keep adding one to x (i.e., x = x + 1) and the result
will never be infinite. If I keep adding one forever (i.e., infinite time), I can conceptualize
that the result would be infinite, but this infinite value will never be reached. In the
same way, our induction proof will never really reach 0∞; It will prove every case up to
0∞ but not including 0∞
2. Consider this absurd algorithm
s = “0”;
while (!s.equals(“0∞”)
print(s);
s = s.append(“0”);
}
The while loop will never terminate, i.e., it’ll print an infinite number of strings.
However, the print statement itself will never output 0∞. More specifically, 0∞ will
never be outputted in a finite amount of time. In other words, the algorithm outputs
the L we described above, an infinite number of finite strings.
3. Consider the Turing Machine below that will accept strings in L. If you inputted 0∞
then the Turing Machine will never accept or reject, so how can we really be sure 0∞ is
in L? In fact, consider if you inputted
another infinite string 0∞10∞? Is it even
Q1
possible for the given Turing Machine to
differentiate the string 0∞10∞ from the
0R
_R
string 0∞? Infinite values or strings pose a
real problem for discrete math, finite
Q2
accept
automata, and Turing Machines. In
1R
general, the problem of deciding whether
1R
an infinite string is in a language is not
0R
decidable or even recognizable in finite
reject
time.
_R
Q2: All finite languages are Regular.
Answer: True
Regular languages are defined to be those that can be generated by Regular
Expression. The union operator (which is a valid regular expression operation)
would allow all the strings in a finite language to be describe by a single finite
regular expression.
Q3:
We know that a DFA for recognizing an infinite Regular Language must have a loop.
Why is this fact so important in helping to prove that some infinite languages are
NOT Regular. Your explanation should include more than one sentence, but no more
than four.
Answer: If we assume that a language is regular, then there exists some DFA that
will accept strings in the language. The loop of a DFA allows a portion of the string
(the y component) to be repeated (pumped up) which is necessary to accept an
Regular Language that is not finite. If the pumping-up results in a string that is no
longer in the given language, then the only logical conclusion is that the DFA cannot
exist and thus, the language is not really Regular, which is a classic proof by
contradiction.
Q4: Construct a NFA with as few states as possible for accepting this regular
expression. Show the NFA. Then, use the procedure described on pages 55-58 to
convert your NFA to a DFA. Assume the alphabet is {a, b}
(a*(a U b))*
It turns out that (a*(a U b))* is equivalent to (a U b)*
Q1
An NFA for recognizing this language would be as follows:
a,b
This NFA already happens to be a DFA.
However, assume you constructed your NFA algorithmically without first reducing
the regular expression. Your NFA might look like this:
a
Q1

Q2
a,b
Q3

a,b
Ø
which expands to 8 states
a,b
1,3
a
a,b,
b
a,b
1
2
3
a,b
1,2
a,b
2,3
a,b
1,2,3
a,b
Then, reduces to one. From the start state {1,2} only state {2,3} is reachable and
they both have the same transitions. Both states go to {2,3} on a and b, and both
states are accept states.
2,3
a,b
a
b
Q1
Q5:
Q3
a
Q2
Convert M1 for question 1.1 into a regular expression.
a,b
b
a

b
Q1
Q3
a

Q2
a,b
b*a
b
bb*a
Q3
a
Q2

b*a
aUb
bb*a U a
Q3
Q2
b*a
aUb
Q2
b*a

(a U b)(bb*a U a)
b*a((a U b)(bb*a U a))*

Download