RU beehive logo ITEC dept promo banner
ITEC 420
2021fall
ibarland

Turing Machines
hw05

Turing Machine instructions


  1. Write a TM to compute function f where f(w) = wy$, w ∈ {a,b}*, y ∈ {_}*, and |y| = 2|w|.
    Note: This is similar to our example of duplicating a string (u to uu) except that the duplicated-bits are all spaces (and then followed by '$').
    Note: We use the fact that this machine exists in passing, in the Ch17b slides, writing a non-deterministic decider for composite numbers.
  2. Write a Turing Machine to decide L={x-y=z : x,y,z1*}.
    To clarify: The input alphabet for this language is Σ={-,=,1}, and (for example) 111-11111=1∈ L. (That is, are checking just the syntax of unary-subtraction.)
    note: This definition allows any/all of x,y,z can have zero 1s.
    yaml gotcha: You must include single-quotes around -. (However they are not needed for =.)
  3. Write a Turing Machine to decide L = {x-y=z : x,y,z1*, and |x| - |y| = |z|}.
    (That is, we verify semantics of unary-subtraction.)
    Note: Start with a copy of your answer to the previous problem. (Be sure to save that one first!)
    tip:

    If you are decrementing both x and y: Remove a 1 from y before finding a corresponding 1 in x. (That way, in case y has reached zero (ε), you don't need to go back to un-change a decrement to x.)

    Furthermore: My solution removed 1s from the right edge of y and z (but the left edge of x). I think this might help keep a solution slightly simpler?

    Note: My solution used 4 phases, and each phase had 4 states on average. (However, there is a solution with as few as 9 states.)
  4. Suppose we have a deterministic TM M = (K,Σ,δ,s,Γ,{n,y}), and q1s is one of the states in K
    (where as usual: n and y are reject and accept states respectively, indicates the blank/space character, and machine's read-head initially starts on the space preceding its input).

    Consider the logic formulas: (a) ∀ γ ∈ Γ, δ(s,γ) = (q1,γ,→), and (b) ∀ k ∈ K ∖ {s}, δ(k,) = (yes,,←)
    Recall that is set-subtraction, and γ is a lower-case gamma.

    1. In informal English, what does (a) say?
    2. In informal English, what does (b) say?
    3. Assuming (a) and (b) both hold, how does M procede, given the empty-string as input?
    4. Assuming (a) and (b) both hold, what else might we say about M?


logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.