Download We are given a set of n lectures (in no particular order) that are

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Vincent's theorem wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Large numbers wikipedia , lookup

Infinitesimal wikipedia , lookup

Infinity wikipedia , lookup

A New Kind of Science wikipedia , lookup

Non-standard analysis wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Hyperreal number wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Real number wikipedia , lookup

Elementary mathematics wikipedia , lookup

Addition wikipedia , lookup

Non-standard calculus wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
CNG280 FORMAL LANGUAGES AND ABSTRACT MACHINES
MIDTERM ANSWERS
1. Suppose that the set of all real numbers in the interval [0,1] is countably infinite. That is,
there is a way of enumerating all members of this set in the following form:
R={r1,r2,r3,…}
where each ri in this set is in the form ri = 0.ri1ri2ri3… (rij  {0,1} for j  N).
Now construct a real number r0 = 0.r01r02r03… (r0j  {0,1} for j  N) as follows:
0 if rjj  1
r0 j  
1 if rjj  0
That is, jth bit of r0 is obtained by flipping the corresponding bit of rj. We can see that r0 is
also a real number in the interval [0,1] and thus must exist in the set R. But, r 0 cannot be
equal to r1 since r01≠r11 according to the construction above (i.e. first bits of r0 and r1 are
different); r0 cannot be equal to r2 since r02≠r22; r0 cannot be equal to r3 since r03≠r33; and
so on. So, r0  R. This is a contradiction. Therefore, the set of all real numbers in the
interval [0,1] is not countable.
2.
0:
0
1:
1
0 1 :
e
0
e
1
( 0 1)* :
0
e
e
e
e
e
1
0( 0 1)* :
0
0
e
e
e
e
e
e
1
0( 0 1)*11:
0
0
e
e
e
e
e
e
e
1
e
e
1
e
1
3. First we convert M into the following form where there are no transitions into the initial
state nor out of the final state:
a
a
e
b
e
q3
q1
q2
q4
b
Calculate R(i,j,k) for 1≤i,j≤4 and k=0,1,2,...:
k=0
1
2
3
4
1
a
b
e
2
b
a
3
4
e
The automaton corresponding to the transitions for k=0 is the initial automaton, as shown
above.
k=1 1
2
*
1
a
a*b
*
2
ba aUba*b
3
a*
a*b
4
3
4
e
We can eliminate q1 since it has already been considered in the above transitions. Thus,
the automaton corresponding to the transitions for k=1 is the following:
q3
*
ab
k=2
2
2
(aUba*b)*
*
3
a b(aUba*b)*
4
q2
aUba*b
e
3
q4
4
(aUba*b)*
*
a b(aUba*b)*
We can eliminate q2 since it has already been considered in the above transitions. Thus,
the automaton corresponding to the transitions for k=2 is the following:
a*b(aUba*b)*
q3
q4
When the initial automaton is reduced to a two-state automaton, the transition on the arc
gives us the desired regular expression. Thus,
L(M) = a*b(aUba*b)*
4. Suppose that L={an : n is prime} is regular. Then, according to pumping lemma, there
must be an integer n≥1 such that any string w  L with |w|≥n can be rewritten as w=xyz
such that y≠e, |xy|≤n, and xyiz  L for each i≥0. Take x=ap, y=aq and z=ar (p+q+r=n),
where p,r≥0 and q>0. By the pumping lemma, xyiz  L for each i≥0; that is, p+qi+r is
prime for each i≥0. For instance, consider the case i=p+2q+r+2. Then
p+qi+r=(q+1)*(p+2q+r). But, this is a product of two natural numbers, each greater than
1; that is, it is not a prime number. This is a contradiction. Therefore, L is not regular.
5. First of all, we can eliminate the rightmost two states, since they are unreachable (i.e. we
can never reach them beginning from the initial state):
a
b
a
a,b
b
a,b
The equivalence classes for this automaton are:
[e]=L, i.e. (ba)*={e,ba,baba,bababa,…}
[b]=Lb, i.e. (ba)*b={b,bab,babab,…}
[a]=L(aUbb)  *, i.e. (ba)*(aUbb)(aUb)*={a,bb,baa,babb,baaa,babba,…}
So, the standard automaton is:
K={[e], [b], [a]}
s=[e]
F={[e]}

a
b
[e]
[a]
[b]
[b]
[e]
[a]
[a]
[a]
[a]
a
[e]
[a]
a,b
b
a
[b]
b