• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • esc pour rejeter
⌘ '
raccourcis clavier

1

Let

L1={anbmckn,m,k0}L_{1} = \{ a^n b^m c^k | n,m,k \geq 0 \}

and

L2={anbncnn1}L_{2} = \{ a^n b^n c^n | n \geq 1 \}

Complete the following PDA such that L(M)=L1L2L(M) = L_{1} - L_{2} where Σ={a,b,c}\Sigma = \{ a, b, c \}

2

Turing machines with carry-bit

Note that all TODOs are replaced with answers\boxed{\text{answers}}

10x#c\square
qsq_s(q1,1,x,R)(q_{1,1}, \text{x}, \text{R})(q1,3,x,R)(q_{1,3}, \text{x}, \text{R})(qs,x,R)(q_s, \text{x}, \text{R})---
q1,1q_{1,1}(q1,1,1,R)(q_{1,1},1,\text{R})(q1,1,0,R)(q_{1,1},0,\text{R})-(q1,2,#,R)(q_{1,2}, \#, \text{R})--
q1,2q_{1,2}(q1,5,x,R)(q_{1,5},\text{x},\text{R})(q1,6,x,R)\boxed{(q_{1,6}, x, \text{R})}(q1,2,x,R)(q_{1,2}, \text{x}, \text{R})---
q1,3q_{1,3}(q1,3,1,R)(q_{1,3},1,\text{R})(q1,3,0,R)(q_{1,3},0,\text{R})-(q1,4,#,R)(q_{1,4}, \#, \text{R})--
q1,4q_{1,4}(q1,6,x,R)\boxed{(q_{1,6}, x, \text{R})}(q1,7,x,R)(q_{1,7},\text{x},\text{R})(q1,4,x,R)(q_{1,4}, \text{x}, \text{R})---
q1,5q_{1,5}(q1,5,1,R)(q_{1,5},1,\text{R})(q1,5,0,R)(q_{1,5},0,\text{R})-(q1,8,#,R)(q_{1,8},\#,\text{R})--
q1,6q_{1,6}(q1,6,1,R)(q_{1,6},1,\text{R})(q1,6,0,R)(q_{1,6},0,\text{R})-(q1,9,#,R)(q_{1,9},\#,\text{R})--
q1,7q_{1,7}(q1,7,1,R)(q_{1,7},1,\text{R})(q1,7,0,R)(q_{1,7},0,\text{R})-(q1,10,#,R)(q_{1,10},\#,\text{R})--
q1,8q_{1,8}(q1,8,1,R)\boxed{(q_{1,8}, 1, \text{R})}(q1,8,0,R)\boxed{(q_{1,8}, 0, \text{R})}--(q1,8,c,R)\boxed{(q_{1,8}, c, R)}(q1,end1,c,L)\boxed{(q_{1,\text{end}_1},\text{c},\text{L})}
q1,9q_{1,9}(q1,9,1,R)\boxed{(q_{1,9}, 1, \text{R})}(q1,9,0,R)\boxed{(q_{1,9}, 0, \text{R})}--(q1,9,c,R)\boxed{(q_{1,9}, c, R)}(q1,end1,1,L)\boxed{(q_{1,\text{end}_1}, 1,\text{L})}
q1,10q_{1,10}(q1,10,1,R)\boxed{(q_{1,10}, 1, \text{R})}(q1,10,0,R)\boxed{(q_{1,10}, 0, \text{R})}--(q1,10,c,R)\boxed{(q_{1,10}, c, R)}(q1,end1,0,L)\boxed{(q_{1,\text{end}_1}, 0,\text{L})}
q1,end1q_{1,\text{end}_1}(q1,end1,1,L)(q_{1,\text{end}_1},1,\text{L})(q1,end1,0,L)(q_{1,\text{end}_1},0,\text{L})-(q1,end2,#,L)(q_{1,\text{end}_2},\#,\text{L})(q1,end1,c,L)(q_{1,\text{end}_1},\text{c},\text{L})-
q1,end2q_{1,\text{end}_2}(q1,end3,1,L)(q_{1,\text{end}_3},1,\text{L})(q1,end3,0,L)(q_{1,\text{end}_3},0,\text{L})(q1,end2,x,L)(q_{1,\text{end}_2},\text{x},\text{L})(q1,end2,#,L)(q_{1,\text{end}_2},\#,\text{L})-(q2,s,,R)(q_{2,s},\square,\text{R})
q1,end3q_{1,\text{end}_3}(q1,end3,1,L)(q_{1,\text{end}_3},1,\text{L})(q1,end3,0,L)(q_{1,\text{end}_3},0,\text{L})(q1,end3,x,L)(q_{1,\text{end}_3},\text{x},\text{L})(q1,end3,#,L)(q_{1,\text{end}_3},\#,\text{L})-(qs,,R)(q_s,\square,\text{R})

Table 1

10x#c\square
q2,sq_{2,s}--(q2,s,,R)\boxed{(q_{2,s}, \square, R)}(q2,1,,R)\boxed{(q_{2,1}, \square, R)}--
q2,1q_{2,1}--(q2,1,,R)\boxed{(q_{2,1}, \square, R)}(q2,2,,R)\boxed{(q_{2,2}, \square, R)}--
q2,2q_{2,2}(q2,2,1,R)\boxed{(q_{2,2}, 1, R)}(q2,2,0,R)\boxed{(q_{2,2}, 0, R)}--(q2,2,c,R)\boxed{(q_{2,2}, c, R)}(q3,s,,L)(q_{3,s}, \square, \text{L})

Table 2

10c\squareNotes
q3,sq_{3,s}(q3,s,1,L)\boxed{(q_{3,s}, 1, L)}(q3,s,0,L)\boxed{(q_{3,s}, 0, L)}(q3,1,0,L)\boxed{(q_{3,1}, 0, L)}End\boxed{End}no carry over
q3,1q_{3,1}(q3,1,0,L)\boxed{(q_{3,1}, 0, L)}(q3,s,1,L)\boxed{(q_{3,s}, 1, L)}(q3,1,1,L)\boxed{(q_{3,1}, 1, L)}(q3,s,1,L)(q_{3,s}, 1, \text{L})carry over

Table 3

3

Let N3=N×N×N\mathbb{N}^3 = N \times N \times N. For example, (1, 5, 6), (0, 999, 124115), and (10, 10, 10) are all elements of N3\mathbb{N}^3. Prove N3\mathbb{N}^3 is countably infinite. Hint: find a way to enumerate it. [10]

To prove that N3\mathbb{N}^3 is countably infinite, we will prove there exists a bijection f:NN3f: \mathbb{N} \to \mathbb{N}^3

We can enumerate N3\mathbb{N}^3 lexicographically by ordering the set {T0,T1,T2,}\{T_{0}, T_{1}, T_{2}, \ldots \} sequentially.

  • T0={(0,0,0)}T_{0} = \{(0, 0, 0)\}
  • T1={(1,0,0),(0,1,0),(0,0,1)}T_{1} = \{(1, 0, 0), (0, 1, 0), (0, 0, 1)\}
  • T2={(2,0,0),(1,1,0),(1,0,1),(0,2,0),(0,1,1),(0,0,2)}T_{2} = \{(2, 0, 0), (1, 1, 0), (1, 0, 1), (0, 2, 0), (0, 1, 1), (0, 0, 2)\}

Via Cantor Pairing function, we have the following bijection f:N2Nf: \mathbb{N}^2 \to \mathbb{N} where

f(x,y)=(x+y)(x+y+1)2+yf(x, y) = \frac{(x+y)(x+y+1)}{2} + y

If we enumerate N3\mathbb{N}^3, we can applying the pairing extension twice. Meaning

g(x,y,z)=f(x,f(y,z))g(x, y, z) = f(x, f(y, z))

This bijection is:

  • injective: given that ff is a bijection between N2N\mathbb{N}^2 \to \mathbb{N}, each (y,z)(y, z) pair maps to unique value f(y,z)f(y, z). Therefore each (x,f(y,z))(x, f(y, z)) pair maps to a unique natural numbers. Therefore different triples (x,y,z)(x, y, z) maps to a different natural numbers
  • surjective: for any nNn \in \mathbb{N} we can find unique values a,bNa,b \in \mathbb{N} such that f(a,b)=nf(a, b) = n (via inverse of ff) Therefore for bb, we can find a unique value c,dNc, d \in \mathbb{N} such that f(c,d)=bf(c,d) = b. This means n=g(a,c,d)n = g(a,c, d) ,therefore every natural number is in the range of gg

q.e.d\boxed{\text{q.e.d}}