Skip to content
The Lumenary

Each worksheet prints cleanly on A4 or Letter. Answer keys are on a separate page.

The Lumenary · Advanced undergraduate

Computability

Name: ______________________

Date: ______________________

You will learn to

  • Design simple Turing machines, trace their computations and explain why the model is believed to capture every algorithm (the Church–Turing thesis)
  • Define decidable and recursively enumerable sets, and prove that a set is decidable if and only if both it and its complement are recursively enumerable
  • Prove that the halting problem is undecidable by a diagonal argument, and that most functions N→N\N \to \N are not computable
  • Use many-one reductions to prove undecidability, and prove Rice's theorem
  • Recognise undecidability in other parts of mathematics, from Diophantine equations to groups and tilings
  1. 1.

    The one-state binary incrementer of the lesson starts on the least significant bit of 1011110111 (twenty-three). How many steps does it take before it halts?

  2. 2.

    A Turing machine has 33 states and the two symbols 0,10, 1. Each of its 3×2=63 \times 2 = 6 table entries chooses a symbol to write, a direction (L or R) and a next state, which is one of the 33 states or halt. How many different tables are there?

  3. 3.

    Which of these sets are recursively enumerable? (Select all that apply.)

    • A.K={e∣φe(e) ⁣↓}K = \{e \mid \varphi_e(e)\!\downarrow\}
    • B.K‾={e∣φe(e) ⁣↑}\overline{K} = \{e \mid \varphi_e(e)\!\uparrow\}
    • C.{e∣φe(0)=7}\{e \mid \varphi_e(0) = 7\}
    • D.{e∣Me has at most 10 states}\{e \mid M_e \text{ has at most } 10 \text{ states}\}
    • E.Tot={e∣φe is total}\mathrm{Tot} = \{e \mid \varphi_e \text{ is total}\}
  4. 4.

    In the proof that KK is undecidable we assumed a machine computing the total function hh. Suppose instead we only had a semi-decider ss for KK: it halts with output 11 when φe(e) ⁣↓\varphi_e(e)\!\downarrow and runs forever otherwise. Build DD as before (on input xx: run s(x)s(x); if it outputs 11, loop forever; otherwise halt). What happens?

    • A.No contradiction: DD loops on every input, so φd(d) ⁣↑\varphi_d(d)\!\uparrow, which is consistent.
    • B.The same contradiction arises, so KK is not even r.e.
    • C.DD is not a Turing machine, because it uses ss as a subroutine.
    • D.DD halts on its own index, so d∈Kd \in K.
  5. 5.

    You want to prove that a new set BB is undecidable, using the undecidability of KK. Which do you need to show?

    • A.K≤mBK \le_m B: a computable ff with e∈K  ⟺  f(e)∈Be \in K \iff f(e) \in B.
    • B.B≤mKB \le_m K: a computable ff with x∈B  ⟺  f(x)∈Kx \in B \iff f(x) \in K.
    • C.K⊆BK \subseteq B.
    • D.BB is infinite and not equal to N\N.
  6. 6.

    For which of these properties of an index ee does Rice's theorem show that the set of ee with the property is undecidable? (Select all that apply.)

    • A.φe\varphi_e is total.
    • B.φe(3)=3\varphi_e(3) = 3.
    • C.MeM_e has an even number of states.
    • D.MeM_e halts on input 00 within 100100 steps.
    • E.φe\varphi_e is a partial computable function.
  7. 7.

    In Mathlib, c.eval n is the (partial) result of running program c : Nat.Partrec.Code on input n, and (c.eval n).Dom says that it halts. Which Lean statement says that halting on input n is undecidable?

    • A.¬ ComputablePred fun c : Code => (c.eval n).Dom
    • B.¬ ∃ c : Code, (c.eval n).Dom
    • C.¬ REPred fun c : Code => (c.eval n).Dom
    • D.∀ c : Code, ¬ Decidable ((c.eval n).Dom)
  8. 8.

    Write run(machine, max_steps) that simulates a two-symbol Turing machine started in state 0 on a blank tape. machine is a dict mapping (state, symbol) to (write, move, next_state), with move in (-1, 1) and next_state equal to None for halt. Return ("halt", steps, ones) if it halts within max_steps steps (counting the halting step) and ("running", max_steps, ones) otherwise, where ones is the number of 1s on the tape at that moment.

    Computational — Practice

  9. 9.

    We want to prove for all n≥0n \ge 0 that the incrementer, started on the binary expansion of nn with the head on the last bit, halts with n+1n + 1 on the tape after t(n)+1t(n) + 1 steps, where t(n)t(n) is the number of trailing 11s. Which induction works?

    • A.Strong induction on nn: if nn is even, one step suffices; if n=2m+1n = 2m + 1, the first step writes 00 and moves left, leaving the machine in exactly the starting situation for mm.
    • B.Ordinary induction from nn to n+1n + 1, using that the machine on n+1n + 1 starts where the machine on nn stopped.
    • C.No induction is needed: checking all n<256n < 256 is enough because larger numbers behave the same way.
    • D.Induction on the number of states.
Code: Apache-2.0 · Content: CC BY-SA 4.0