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 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.
The one-state binary incrementer of the lesson starts on the least significant bit of (twenty-three). How many steps does it take before it halts?
- 2.
A Turing machine has states and the two symbols . Each of its table entries chooses a symbol to write, a direction (L or R) and a next state, which is one of the states or halt. How many different tables are there?
- 3.
Which of these sets are recursively enumerable? (Select all that apply.)
- A.
- B.
- C.
- D.
- E.
- 4.
In the proof that is undecidable we assumed a machine computing the total function . Suppose instead we only had a semi-decider for : it halts with output when and runs forever otherwise. Build as before (on input : run ; if it outputs , loop forever; otherwise halt). What happens?
- A.No contradiction: loops on every input, so , which is consistent.
- B.The same contradiction arises, so is not even r.e.
- C. is not a Turing machine, because it uses as a subroutine.
- D. halts on its own index, so .
- 5.
You want to prove that a new set is undecidable, using the undecidability of . Which do you need to show?
- A.: a computable with .
- B.: a computable with .
- C..
- D. is infinite and not equal to .
- 6.
For which of these properties of an index does Rice's theorem show that the set of with the property is undecidable? (Select all that apply.)
- A. is total.
- B..
- C. has an even number of states.
- D. halts on input within steps.
- E. is a partial computable function.
- 7.
In Mathlib,
c.eval nis the (partial) result of running programc : Nat.Partrec.Codeon inputn, and(c.eval n).Domsays that it halts. Which Lean statement says that halting on inputnis 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)
- A.
- 8.
Write
run(machine, max_steps)that simulates a two-symbol Turing machine started in state0on a blank tape.machineis a dict mapping(state, symbol)to(write, move, next_state), withmovein(-1, 1)andnext_stateequal toNonefor halt. Return("halt", steps, ones)if it halts withinmax_stepssteps (counting the halting step) and("running", max_steps, ones)otherwise, whereonesis the number of 1s on the tape at that moment.Computational — Practice
- 9.
We want to prove for all that the incrementer, started on the binary expansion of with the head on the last bit, halts with on the tape after steps, where is the number of trailing s. Which induction works?
- A.Strong induction on : if is even, one step suffices; if , the first step writes and moves left, leaving the machine in exactly the starting situation for .
- B.Ordinary induction from to , using that the machine on starts where the machine on stopped.
- C.No induction is needed: checking all is enough because larger numbers behave the same way.
- D.Induction on the number of states.