CS181 Winter 2019 – Problem Set #4 Solutions
CS181作业代写 (20 points) Show that the set of three-dimensional coordinates (x, y, z) x, y, z Z has size equal to N.Solution: (x, y, z) x, y, z Z = ZZZ.
1.(20 points) Show that the set of three-dimensional coordinates (x, y, z) x, y, z Z has size equal toN. CS181作业代写
Solution: (x, y, z) x, y, z Z = Z Z Z. We show Z Z Z = N N N = N via a sequence of three bijections.
First we exhibit a bijection from N N N to Z Z Z. Let f : N Z be the bijection from
N to Z which we defined in class. Let f j((x, y, z)) = (f (x), f (y), f (z)). We show that f j is a bijection. f j is injective: for any two (x, y, z), (xj, yj, zj) such that f j(x, y, z) = f j(xj, yj, zj), we have that xj = x, yj = y and zj = z by the injectivity of f . Similarly, f j is surjective: for any (x, y, z) Z Z Z, there is an xj, yj and zj all in N where f (xj) = x, f (yj) = y and f (zj) = z. So f j(xj, yj, zj) = (x, y, z).CS181作业代写
Now we exhibit a bijection from N N N to N N.
Let g : N N N be the bijection from N N to N which we defined in class. Let gj(x, y, z) = (g(x, y), z). We show that gj is abijection.CS181作业代写
gj is injective: for any two (x, y, z), (xj, yj, zj) such that (g(x, y), z) = gj(x, y, z) =gj(xj, yj, zj) = (g(xj, yj), zj), we have that xj = x, yj = y, and zj = z by the injectivity of f . Similarly, gjis surjective: for any(a, z) N N, there is an xj, yj such that (a, z) = (g(xj, yj)z) = gj(xj, yj, zj) by the surjectivity of g.
We can combine the bijections f j : N × N × N → Z × Z × Z, gj : N × N × N → N × N, and g : N × N → N to get a bijection from Z × Z × Z to N.
2.(30 points). Let us define Fast-Rewind Turing Machines (FRTM).
They are similar to Turing Machines, except that the head of an FRTM is not allowed to move left one cell at a time. Instead, the head of the FRTM must move left only all the way to the left-hand end of the tape (i.e. the first cell). The head of the FRTM can move right one step at a time, justlike the usual Turing The transition function for the FRTM is of the form
δ : Q × Γ → Q × Γ × {R, F IRST }.CS181作业代写
Explain how to convert any Turing Machine into an FRTM. A full proof is not needed, you only need to give an explanation of the intuition behind why your transformation works.
Solution: There are several ways to solve this. Here is one way.
In order to simulate the right side move of a Turing Machine, we don’t need to do any ad- ditional work. The corresponding FRTM can just move one step right whenever the original Turing Machine wants to move right.
The harder direction is getting an FRTM to simulate the left side move of a regular Turing Machine. For an FRTM to simulate an ordinary turing machine’s left moves, we use the following algorithm. Suppose the head wants to move one step left from the cell it is currently on.CS181作业代写
(a)Markthe current That is, if the current cell had symbol α on it, now make it α.
(b)Move all the way left to the first cell of the tape.
(c)Copythe entire tape one cell to the right, except for the mark which is kept on the same tape cell.
(d)Resetagain to move all the way left to the start of the tape.CS181作业代写
(e)Scan right till you find the cell with the mark. This is the cell one step to the left of the original cell. Remove the mark.
At the end of this procedure, the FRTM head ends up one spot to the left of where it originally was without modifying the rest of the tape.
3.(50 points). In class, we showed the existence of two kinds of infinities. Let Σ = {0, 1}and CS181作业代写
L = {L | L ⊆ Σ∗}. We showed that |Σ∗| is not the same as |L|.
We briefly describe the proof below and establish some notation. The proof proceeds by contradiction. Let (s, 0, 1, 00, 01, 10, 11, . . .) be a given enumeration of strings in Σ∗. We assume for the sake of contradiction that there exists someenumeration (L1, L2, L3, . . .) of languages in . Then we proceed by constructing a language LDIAG such that i, LDIAG = Li via Cantor’s Diagonalization to establish a contradiction.
(a)(10 points) CallLDIAG
= LDIAG. Construct another language LDIAG
ƒ= LDIAG
via diagonalization which is also not present in the enumeration (L1, L2, L3, . . .). Thus LDIAG would have also proved to us that |Σ∗| = |L|.CS181作业代写
(b)(15points) Construct an infinite set of languages LDIAG = {LDIAG, LDIAG, . . . , LDIAG, . . .}
1 2 i via diagonalization by providing a description of LDIAG such that
- ∀j,j ƒ= i, LDIAG ƒ= LDIAG.i j
- ∀j,LDIAG ƒ= Lj.
Formally prove your construction by induction.CS181作业代写
(c)(15 points) Construct one more language LSUPERDIAG such that
- ∀j,LSU P ERDIAG ƒ= LDIAG and
- ∀j,LSU P ERDIAG ƒ= Lj
Briefly explain why your language satisfies the above properties.
(d)(10points) Construct yet another language LSUP ERDIAG that is different from LSUP ERDIAGsatisfying the same properties as part (c). Briefly explain your answer.
Solution:
Lets name the procedure that generates LDIAG from the sequence (L1, L2, . . . , ) as Cantor’s diagonalization.
(a) Intuition: CS181作业代写
Consider the sequence (LDIAG, L1, L2, . . .). Set LDIAG be the language obtained by 1 2 using cantor’s diagonalization on this sequence.
Details:
Consider the sequence (LDIAG, L1, L2, . . .). We will show that there exists a language LDIAG that is not part of this sequence using Cantor’s diagonalization.
Consider a matrix M that has the enumeration of all strings in Σ∗ along it’s columns and the enumeration (LDIAG, L1, L2, . . .) along it’s rows. The entries of the matrix aredefined as follows: M [i, j] = 1 if string j belongs to language i and M [i, j] = 0 if string j doesn’t belong to language i. Now, let’s define a language LDIAG by complementing the diagonal of the matrix M . That is, look at the diagonal. For each element in the diagonal, if M [i, i] = 1, then don’t include string i in LDIAG while if M [i, i] = 0, then we include string i in LDIAG.CS181作业代写
Now, we show that such a language LDIAG doesn’t exist in the list (LDIAG, L1, L2, . . .).
Suppose it did exist in the list. Let’s say it was the kth element in the list. Let’s look at the entry M [k, k]. Suppose M [k, k] = 1, then it means that string k lies in the language LDIAG by the definition of the matrix. However, by the definition of LDIAG,if M [k, k] = 1, then string k does not belong to LDIAG. Similarly, Suppose M [k, k] = 0,then it means that string k does not belong to the language LDIAG by the definition of the matrix. However, by the definition of LDIAG, if M [k, k] = 0, then string k does belong to LDIAG. Thus, in both cases we arrive at a contradiction. Therefore, LDIAG doesn’t exist in the list (LDIAG, L1, L2, . . .)CS181作业代写
(b)Considerthe sequence (LDIAG, L1, LDIAG, L2, . . . , LDIAG, Li, Li+1, Li+2 . . .). Let LDIAG1 2 i i+1 be the language obtained by applying cantor’s diagonalization to this sequence.
We can prove by induction that for all i, LDIAG satisfies the conditions of the problem. As the base case, LDIAG = Li for any i via the original diagonization argument. For the induction step, take the sequence (LDIAG, L1, LDIAG, L2, . . . , LDIAG, Li, Li+1, Li+2 . . .)
and assume the following holds:
- ∀j,j ƒ= i, LDIAG ƒ= LDIAG.i j
- ∀j,LDIAG ƒ= Lj.CS181作业代写
We diagonalize on the sequence of languages (LDIAG, L1, LDIAG, L2, . . . , LDIAG, Li, Li+1, Li+2 . . .)
as we did in part (a) to obtain the new language LDIAG. The two properties above still hold, so we are done.
(c)Consider the sequence (LDIAG, L1, LDIAG, L2, . . .). Set LSUPERDIAG be the language obtained by using cantor’s diagonalization on this sequence.
(d)Finally,consider thesequence (LSUP ERDIAG, LDIAG, L1, LDIAG, L2, . . .) and obtain LSUP ERDIAG via cantor’s diagonalization.
其他代写:代写CS C++代写 java代写 r代写 matlab代写 web代写 app代写 作业代写 物理代写 数学代写 考试助攻 金融经济统计代写