RU beehive logo promo banner for Computing & Info Sciences
ITEC 420
2023fall
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: (i) ∀ γ  ∈  Γ, δ(s,γ) = (q1,γ,→), and (ii) ∀ k  ∈  K ∖ {s}, δ(k,) = (yes,,←)
    Recall that is set-subtraction, and γ is a lower-case gamma.

    1. In informal English, what does (i) say? (Your answer will be scored on both correctness and clarity/simplicity.)
    2. In informal English, what does (ii) 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, L(M) could not be the set of palindromes, nor the set of strings ending in a, nor {anbncn}, but it could be (for all we know) {a*}. Explain.
      hint: How does a TM know if it's seen all the characters of its input?

  5. based on textbook Exercises 20.7.5-6
    1. Explain why, if L1 and L2 are both decidable, then L1L2 must also be decidable.
    2. Give languages L1, L2 such that L1 is undecidable, L2 is decidable, and L1L2 is decidable.
    3. Give languages L1, L2 such that L1 is undecidable, L2 is decidable, and L1L2 is undecidable.
    hint: Consider simple, “extreme” sets-of-strings, just like you consider extreme inputs when writing unit tests (e.g. for a function that takes in doubles, one might test 0.0 and Double.POSITIVE_INFINITY).
  6. Rich, exercise 21.8.4 Show that HALL = {<M> : Turing machine M halts on all w  ∈  Σ*} is not in D by reduction from HALT.

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.