Skip to content
PostTheory Of Computation / Assignment

TOC-As-1

2024-10-04
Back to Blog

TOC-As-1

Question 1

a.Z×Z is countable.

Construct a counting procedure as below:

1-a-counting-procedure

Each pair corresponds to a unique natural number. Therefore Z×Zis countalbe

b.If set S is countable and n is a natural number constant, then Sn is countable.

Case I

If Sis a finite set with melement;

Then |Sn|=mnwhich is finite. Therefore Snis countable.

Case 2

If Sis a infinite and countable set; Then there must be a bijection between Sand N.

And for 2 countable sets AB, A×Bis also a countable set.

For any element (a,b)A×B, we can write a=f(i)and b=g(j)for some i,jN.

Therefore, (a,b)corresponds to the pair (f(i),g(j)), which in turn corresponds to the natural number pair (i,j).

To establish a one-to-one correspondence, we can use a pairing function that maps each pair (i,j)to a unique natural number k .

k=(i+j)(i+j+1)2+j

Therefore, A×Bis countable.

Since Sn=S×S××Sn times.

And S×Sis countable.

Therefore Snis countable.

Solution:

Bijection |{a|aR0<a<1}|R:tan(πxπ2)

Solution

d.{a|aR0<a<10}is uncountable.

Suppose a real number ai(0,10)denote as ai=ai,1ai,2. Then we build the table as below:

IndexanDigits
0a0a0,0 a0,1 a0,2
1a1a1,0 a1,1 a1,2
2a2a2,0 a2,1 a2,2

Next we define a real number ax=ax,0ax,1such that ax,i=(ai,i+2)mod 10. We can see a xis not in the list!

  • axand a0are different at digit 0.

  • axand a1are different at digit 1.

  • axand a2are different at digit 2.

  • axand a3are different at digit 3.

Thus, axis not counted and set of reals in (0, 10) is uncountable.

{f|f:N{0,1}}is uncountable

Assume that the set of functions from Nto {0,1}is countable.

Suppose all such functions can be listed as f1,f2,f3,.

Define a function gsuch that g(n)=1fn(n). This ensures that gdiffers from each fiat least at position i.

Since gis not equal to any fiin the list, this contradicts the assumption that we have listed all possible functions.

Therefore, the set of functions from Nto {0,1}is uncountable.

Question 2

Prove the followings.(1 pt for each)

a

For a given alphabet Σ, the number of DFA over Σ is countable

b

Two sets are isomorphic if they are of the same cardinality. Prove that the number of DFA's (without specifying Σ) is countable up to set isomorphism.

Question 3

Let Σ={a,b}.Construct a DFA for each of the following languages. (10 pt for each)

a.{w|w has at least one a}

Current Stateab
q0q1q0
q1q1q1

3-a-DFA

b.{w|w has no more than three as}

Current Stateab
q0q1q1
q1q2q1
q2q3q2
q3q4q3
q4q4q4

3-b-DFA

c.{w|w does not have ab as a substring}

Current Stateab
q0q1q2
q1q1q3
q2q1q2
q3q3q3

3-c-DFA

d. {w|w contains no runs of length less than for}.A run in a string is a substring of length at least one and consisting entirely of the same symbol. For example, abbbaabhas four runs: a,bbb,aa,b.

Current Stateab
q0q1q2
q1q3q9
q2q10q4
q3q5q9
q4q10q6
q5q7q9
q6q10q8
q7q7q2
q8q1q8
q9q9q9
q10q10q10

3-d-DFA

Question 4

Let M=(Q,Σ,δ,q0,F)be an arbitrary DFA. We construct a new DFA Mas M=(Q,Σ,δ,q0,QF). We need to prove that L(M)=L(M).

Note:

  • QFis the set difference.

  • L(M)=ΣL(M)is the set complement.


The goal L(M)=L(M)is understood as set equality.
Thus, we need to prove wΣ, wL(M)wL(M).

()
Assume wL(M).
Then wL(M).
Thus, DFA Mrejects w.
In other words, DFA Mhalts on a non-final state qxby consuming all symbols in w.
By the construction of M, qxis a final state of M.
Thus, Maccepts w, and wL(M).


()
Assume wL(M).
DFA Maccepts w.
In other words, DFA Mhalts on a final state qyby consuming all symbols in w.
By the construction of M, qyis a non-final state of M.
Thus, Mrejects w, so wL(M).
Thus, wL(M). L(M)=L(M).