Part 2
To speak theoretically about whether tasks are computable or complex to solve by a machine, we need to define what machine we are talking about!
Turing machine
Turing machine is the universally accepted model for computation
Now that we have the model, we can better define computability and complexity
Computability
A task/language is computable/decidable in time
Machines as strings
- We know from Binary encoding that everything can be encoded in binary
- So TMs can also be encoded as binary strings
UTM: Universal Turing Machine
- Now that TMs can be encoded as binary strings, they can be given as input to other TMs!
- So let's build a simulator that gets the binary encoding of a TM
and a string , simulates the running over and returns the result. - Like a python interpreter
- This simulator exists and it's called a UTM.
- Simulating the TM is obviously slower than running it directly.
- If TM runs in
time, the best UTM simulating TM runs in
Uncomputability
Uncomputable functions exist!
How to prove?
How to prove that a task is computable or uncomputable?
Proving Computability
- Construct a TM that solves it!
- Write an algorithm in pseudocode! Keep in mind that all steps must be elementary (or known to be computable)
Proving Uncomputability
- Reduction from an undecidable problem
- Rice Theorem
General guideline
- Check if it's possible to write a python code to solve it -> decidable
- Use Rice Theorem if it's a semantic language:
- if It's trivial -> decidable
- if non trivial -> undecidable
- Check if you can reduce the halting problem to it