+---
+
+# Back to halting
+
+* Universal Turing machine can do any possible computation
+* Has the same halting behaviour of the emulated machine
+
+Can we build another machine that detects if a machine halts when given some input?
+
+Assume we can...
+
+```python
+def does_it_stop(program, input):
+ if very_clever_decision:
+ return True
+ else:
+ return False
+```
+
+But I can use the program listing as an input:
+
+```python
+def stops_on_self(program):
+ return does_it_stop(program, program)
+```
+
+---
+
+# Halting: the clever bit
+
+<table width="100%">
+<tr>
+<td>
+```python
+def does_it_stop(program, input):
+ if very_clever_decision:
+ return True
+ else:
+ return False
+```
+</td>
+<td>
+```python
+def stops_on_self(program):
+ return does_it_stop(program, program)
+```
+</td>
+</tr>
+</table>
+
+Let's put an infinite loop in a program that detects infinite loops!
+
+```python
+def bobs_yer_uncle(program):
+ if stops_on_self(program):
+ while True:
+ pass
+ else:
+ return True
+```
+
+If a `program` halts on on itself, `bobs_yer_uncle` doesn't halt. If `program` doesn't halt, `bobs_yer_uncle` returns `True`.
+
+--
+
+What does this do?
+```python
+bobs_yer_uncle(bobs_yer_uncle)
+```
+
+---
+
+<table width="100%">
+<tr>
+<td>
+```python
+def does_it_stop(program, input):
+ if very_clever_decision:
+ return True
+ else:
+ return False
+```
+</td>
+<td>
+```python
+def stops_on_self(program):
+ return does_it_stop(program, program)
+```
+</td>
+<td>
+```python
+def bobs_yer_uncle(program):
+ if stops_on_self(program):
+ while True:
+ pass
+ else:
+ return True
+```
+</td>
+</tr>
+</table>
+
+What does this do?
+```python
+bobs_yer_uncle(bobs_yer_uncle)
+```