CS701 - Assignments


Newer 12 11 10 9 8 7 6 5 4 3  2  1 Older



CS701 – Theory of Computation


Due Date: 21st Nov, 2012



Assignment 1




Instructions to Solve Assignments

The purpose of assignments is to give you hands on practice. It is expected that students will solve the assignments themselves. Following rules will apply during the evaluation of assignment.

·         Cheating from any source will result in zero marks in the assignment.
·         Any student found cheating in any two of the assignments submitted will be awarded "F" grade in the course.
·         No assignment after due date will be accepted.


Question 1: Total Points (10)
Following is the Turing Machine M1 for the language 




For each of the following input strings, provide the sequence of configurations that M1 enters.
(a) 0000
(b)00000
(c) 000000
(d)0000000
(e) 00000000

A) Sequence of configurations of M1 for 0000
q10000
□q2000
□xq300
□x 0q40
□x0xq3
□x0q5x□
□xq50x□
□q5x0x□
q5□x0x□
□q2x0x□
□xq20x□
□ xxq3x□
□ xxxq3
□ xxq5x□
□ xq5xx□
□ q5xxx□
q5□xxx□
□ q2xxx□
□ xq2xx□
□ xxq2x□
□ xxxq2
□xxx□qaccept

B) Sequence of configurations of M1 for 00000
q100000
□q20000
□xq3000
□x 0q400
□x0xq30
□x0x0q4
□x0x0□qreject


C) Sequence of configurations of M1 for 000000
q1000000
□q200000
□xq30000
□x 0q4000
□x0xq300
□x0x0q40
□x0x0x q3
□x0x0q5x□
□x0x q50x□
□x0 q5x0x□
□x q50x0x□
□q5x0x0x□
q5□x0x0x□
□q2x0x0x□
□xq20x0x □
□xxq3x0x □
□xxxq30x□
□xxx0q4x□
□xxx0xq4
□xxx0x□qreject

D) Sequence of configurations of M1 for 0000000
q10000000
□q2000000
□xq300000
□x 0q40000
□x0xq3000
□x0x0q400
□x0x0xq30
□x0x0x0q4
□x0x0x0□qreject

E) Sequence of configurations of M1 for 00000000
q100000000
□q20000000
□xq3000000
□x 0q400000
□x0xq30000
□x0x0q4000
□x0x0xq300
□x0x0x0q40
□x0x0x0xq3
□x0x0x0q5x□
□x0x0x q50x□
□x0x0q5x0x□
□x0xq50x0x□
□x0q5x0x0x□
□xq50x0x0x□
□q5x0x0x0x□
q5□x0x0x0x□
□q2x0x0x0x□
□xq20x0x0x□
□xxq3x0x0x□
□xxxq30x0x□
□xxx0q4x0x□
□xxx0xq40x□
□xxx0xxq3x□
□xxx0xxxq3
□xxx0xxq5x□
□xxx0xq5xx□
□xxx0q5xxx□
□xxxq50xxx□
□xxq5x0xxx□
□xq5xx0xxx□
□q5xxx0xxx□
q5□xxx0xxx□
□q2xxx0xxx□
□xq2xx0xxx□
□xxq2x0xxx□
□xxxq20xxx□
□xxxxq3xxx□
□xxxxxq3xx□
□xxxxxxq3x□
□xxxxxxxq3
□xxxxxxq5x□
□xxxxxq5xx□
□xxxxq5xxx□
□xxxq5xxxx□
□xxq5xxxxx□
□xq5xxxxxx□
□q5xxxxxxx□
q5□xxxxxxx□
□q2xxxxxxx□
□xq2xxxxxx□
□xxq2xxxxx□
□xxxq2xxxx□
□xxxxq2xxx□
□xxxxxq2xx□
□xxxxxxq2x□
□xxxxxxxq2
□xxxxxxx□qaccept

=================================================================


Question 2: Total Points (10)
Suppose for a programming language, a valid variable name has the following properties:
  • Only Alphabets (a, b, c, ... , z, A, B, C, ... , Z) and Numerals (0, 1, 2, ... , 9) are allowed in variable name.
  • Variable name can only start with Alphabets.
  • Maximum length of variable name is 8.
  • The keywords defined for the language cannot be a variable name.

Let L be the set of all such valid variable names.
(a)  Prove that L is finite.
(b) How many strings does L contain (excluding the keywords condition stated above)?
§  Answer for Question No. 2
  • B)
  • The maximum length of variable is 8 it means the language has all variables of length 1, 2, and so on up to length 8.
  • Because only alphabets are allowed at first position, so there are 52 choices for the first position. For other seven positions there are 62 choices.
  •  
  • Therefore total numbers of strings of L are:
  • 52 + 52(62)1 + 52(62)2 + 52(62)3 + 52(62)4 + 52(62)5 + 52(62)6 + 52(62)7
  • = 186125991646140 strings
  •  
    •  
    • A) The language L is finite if and only if it has finite many strings. We have calculated the number of strings (excluding the keyword condition) to be 186125991646140
    • Including the keyword condition the total number of strings will be less than the above counting number which is a surely a finite number.
    • So our language L is Finite.
    •  
    • =================================================================


    Question 3: Total Points (40)
    For each of the following languages, provide implementation-level and Formal description of Turing Machines.
    (a)             A = { 0n1n2n | n ≥ 0 }
    (b)            B = { 0i10j | 0 ≤ i < j }

                  
    [Note: Formal description also includes transition diagram.]

    Answer for Question No. 3

    A)        A = { 0n1n2n | n ≥ 0 }
    Implementation-Level Description:
    1.    On input string x
    2.    If the string is empty then accept else continue.
    3.    Check that the format of the string is of the form 0*1*2*. If no then reject and if yes then continue
    4.     Cross the first ‘0’ and first ‘1’ and first ‘2’ in the string.
    5.    Come back to the start of the string and then again move forward and cross next ‘0’ and cross next ‘1’ and next ‘2’.
    6.    Repeat the step 5 unless either all 0’s or all 1’s or all 2’s are crossed.
    7.    If we find all 0’s, 1’s, and 2’s crossed, then accept; else reject.
      
    Formal Description:
    ·         Q= {q0, q1, q2, q3, q4,qaccept}
    ·         = {0, 1, 2}
    ·         Г = {0, 1, 2,, x}
    ·         q0 is the start state, qaccept is the accept state and qreject is the reject state.
    ·         ∂ (gamma) is the transition function given by the following transition diagram.
    Note that in the below diagram, every transition that is not mentioned goes to the reject state





B)        B = { 0i10j | 0≤ i < j }
Implementation-Level Description:
1.    On input string x
2.    Check that the format of the string is of the form 0*10*. If no then reject and if yes then continue
3.    Cross the first ‘0’ in the string, move forward to find ‘1’ in the string, when ‘1’ found then cross the next ‘0’ that comes after ‘1’
4.    Come back to the start of the string. Go forward and cross the next ‘0’ in the string and then also cross the next ‘0’ after ‘1’
5.    Repeat step 4 unless all the 0’s to the right side of ‘1’ or to the left side of ‘1’ are crossed.
6.    If there are one or more 0’s remaining to the right side of ‘1’ accept. If no ‘0’ on either side of ‘1’, reject. If one or more 0’s remaining to the left side of ‘1’, reject
 
Formal Description:
·         Q= {q0, q1, q2, q3, q4, q5,qaccept}
·         = {0, 1}
·         Г = {0, 1,, x}
·         q0 is the start state, qaccept is the accept state and qreject is the reject state.
·         ∂ (gamma) is the transition function given by the following transition diagram.
Note that in the below diagram, every transition that is not mentioned goes to the reject state


=================================================================


Question 4: Total Points (10)
For this question, consider ∑ = { 0, 1 } and ɼ = { 0, 1, ˽ }
(symbol ˽  means blank)
Describe the language accepted by each of the following Turing Machines.

(a)  M1 with transition function as:
δ(q0, 0) = (q1, 1, R)
δ(q1, 1) = (q0, 0, R)
δ(q1, ˽) = (qa, ˽, R)

(b) M2 with transition function as:
δ(q0, 0) = (q0, ˽, R)
δ(q0, 1) = (q1, ˽, R)
δ(q1, 1) = (q1, ˽, R)
δ(q1, ˽) = (qa, ˽, R)

(c)  M3 with transition function as:
δ(q0, 0) = (q1, 1, R)
δ(q1, 1) = (q2, 0, L)
δ(q2, 1) = (q0, 1, R)
δ(q1, ˽) = (qa, ˽, R)

[Note: Describe languages as provided in the statement of question 3.]
Answer for Question No. 4

A)   L(M1) = { (01)n0   |  n0 }
B)   L(M2) = { 0n1m    |   n0, m1 }
C)   L(M3) = { 0(110)n | n0 }

=================================================================

Question 5: Total Points (20)
Read the paper titled “Turing Machines with Two Letters and Two States”, and explain how it is possible to decide halting problem for this two letters and two states Turing machine.


Question 6: Total Points (10)
Read the paper titled “Penguins And Pandas: A Note On Teaching Cantor’s Diagonal Argument”, and justify how non-numerical variations of Cantor's diagonal argument is easy to understand as compared to the original argument.
Answer for Question No. 6
Yes it is true that the non-numerical variation of Cantor’s diagonal argument is easier to understand as compared to the original argument.
On one hand, by reading this paper, we easily understand the power of Cantor’s diagonal argument, while one the other hand, we also easily understand the uncountable infinite sequences of infinite elements, even if we don’t have much knowledge of number theories in mathematics.
Creating Cantor’s special sequence by using the images of penguin and pandas is easier than creating it using real numbers; because thinking about two images i.e. penguin and panda is easier than thinking of real numbers(with decimal point and 0 to 9 digits).
Contradicting element and its contradiction can also be understood more easily when there are two images penguin and panda instead real numbers.
Writer has observed that the students become quite creative in constructing contexts for proving that certain sets are uncountable when they are not limited to sets of numbers. The animal sequences and songs offer a familiar vehicle for leading fine arts and humanity students to an appreciation of uncountable sets and levels of infinity.





Download: Click here