<<

Universal Turing and Undecidability

Nabil Mustafa

Computational

1 / 174 Q: possible states TM can be in.

I qstart : the TM starts in this state I qhalt : the TM halts when this state is reached

Storage for TM :

A special register stores the current state.

1 input tape, 1 output tape and 1 work tape

Turing recap

A TM is a M = (Γ, Q, δ) where

Γ: set of symbols that TM ’s tapes can contain.

2 / 174 Storage for TM :

A special register stores the current state.

1 input tape, 1 output tape and 1 work tape

Turing machine recap

A Turing machine TM is a tuple M = (Γ, Q, δ) where

Γ: set of symbols that TM ’s tapes can contain. Q: possible states TM can be in.

I qstart : the TM starts in this state I qhalt : the TM halts when this state is reached

3 / 174 1 input tape, 1 output tape and 1 work tape

Turing machine recap

A Turing machine TM is a tuple M = (Γ, Q, δ) where

Γ: set of symbols that TM ’s tapes can contain. Q: possible states TM can be in.

I qstart : the TM starts in this state I qhalt : the TM halts when this state is reached

Storage for TM :

A special register stores the current state.

4 / 174 Turing machine recap

A Turing machine TM is a tuple M = (Γ, Q, δ) where

Γ: set of symbols that TM ’s tapes can contain. Q: possible states TM can be in.

I qstart : the TM starts in this state I qhalt : the TM halts when this state is reached

Storage for TM :

A special register stores the current state.

1 input tape, 1 output tape and 1 work tape

5 / 174 Does restricting the alphabet Γ to 0, 1, , matter? {  B} No! If f is computable by a TM using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM using the alphabet 0, 1, , . | | · {  B} Does using more work tapes make everything much faster? No! If function f is computable by a TM using k tapes, then it is computable in time 5kT (n)2 by a TM using a single work tape.

Church-Turing Hypothesis Every physically realizable device can be simulated by a TM .

Robustness of TM Many details of our TM quite arbitrary

6 / 174 No! If function f is computable by a TM using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM using the alphabet 0, 1, , . | | · {  B} Does using more work tapes make everything much faster? No! If function f is computable by a TM using k tapes, then it is computable in time 5kT (n)2 by a TM using a single work tape.

Church-Turing Hypothesis Every physically realizable computation device can be simulated by a TM .

Robustness of TM Many details of our TM quite arbitrary Does restricting the alphabet Γ to 0, 1, , matter? {  B}

7 / 174 Does using more work tapes make everything much faster? No! If function f is computable by a TM using k tapes, then it is computable in time 5kT (n)2 by a TM using a single work tape.

Church-Turing Hypothesis Every physically realizable computation device can be simulated by a TM .

Robustness of TM Many details of our TM quite arbitrary Does restricting the alphabet Γ to 0, 1, , matter? {  B} No! If function f is computable by a TM using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM using the alphabet 0, 1, , . | | · {  B}

8 / 174 No! If function f is computable by a TM using k tapes, then it is computable in time 5kT (n)2 by a TM using a single work tape.

Church-Turing Hypothesis Every physically realizable computation device can be simulated by a TM .

Robustness of TM Many details of our TM quite arbitrary Does restricting the alphabet Γ to 0, 1, , matter? {  B} No! If function f is computable by a TM using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM using the alphabet 0, 1, , . | | · {  B} Does using more work tapes make everything much faster?

9 / 174 Church-Turing Hypothesis Every physically realizable computation device can be simulated by a TM .

Robustness of TM Many details of our TM quite arbitrary Does restricting the alphabet Γ to 0, 1, , matter? {  B} No! If function f is computable by a TM using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM using the alphabet 0, 1, , . | | · {  B} Does using more work tapes make everything much faster? No! If function f is computable by a TM using k tapes, then it is computable in time 5kT (n)2 by a TM using a single work tape.

10 / 174 Robustness of TM Many details of our TM quite arbitrary Does restricting the alphabet Γ to 0, 1, , matter? {  B} No! If function f is computable by a TM using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM using the alphabet 0, 1, , . | | · {  B} Does using more work tapes make everything much faster? No! If function f is computable by a TM using k tapes, then it is computable in time 5kT (n)2 by a TM using a single work tape.

Church-Turing Hypothesis Every physically realizable computation device can be simulated by a TM .

11 / 174 Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

12 / 174 I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B}

13 / 174 I Use binary encoding. Each symbol encoded by log Γ bits. | |

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B}

How to simulate each step of M.

14 / 174 log Γ | |

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by bits.

How to simulate each step of M.

15 / 174 I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

16 / 174 Problem: remember the bits read.

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

I Read the encoded symbol via log Γ bits. | |

17 / 174 I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

18 / 174 I Lookup the (remembered) read bits in the (modified) table

Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

19 / 174 Alphabet size doesn’t matter Claim If function f is computable by a TM M using alphabet Γ, then it is computable in time 4 log Γ T (n) by a TM M0 using the alphabet 0, 1, , . | | · {  B}

Have to decide:

How to represent each symbol of Γ using 0, 1, , . {  B} I Use binary encoding. Each symbol encoded by log Γ bits. | | How to simulate each step of M.

I Read the encoded symbol via log Γ bits. Problem: remember the bits read. | |

I Modify the transition table appropriately

I Lookup the (remembered) read bits in the (modified) table

20 / 174 Remembering bits read

Problem: How to remember the bits read?

L,,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

21 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y j b j 3

22 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

y 0 1 0 0 1 b

23 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

q 01001 q0 01010 R y 0 1 0 0 1 b

24 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

q q 0 0 0 R

y 0 1 0 0 1 b

25 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

q q 0 0 0 R q q 0 1 01 1 R y 0 1 0 0 1 b

26 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

q q 0 0 0 R q q 0 1 01 1 R y 0 1 0 0 1 b q q 01 0 010 0 R

27 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

q q 0 0 0 R q q 0 1 01 1 R y 0 1 0 0 1 b q q 01 0 010 0 R q q 010 0 0100 0 R

28 / 174 Remembering bits read

Problem: How to remember the bits read?

L,R,S Q Γ Q Γ { }

q i q0 j R n x y i b j 3

q q 0 0 0 R q q 0 1 01 1 R y 0 1 0 0 1 b q q 01 0 010 0 R q q 010 0 0100 0 R q 0100 1 q0 1 R

29 / 174 q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R

30 / 174 q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R

31 / 174 q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R

32 / 174 q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R

33 / 174 qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L

34 / 174 qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − −

35 / 174 qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − −

36 / 174 qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − −

37 / 174 qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − −

38 / 174 qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R −

39 / 174 qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R −

40 / 174 qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R −

41 / 174 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | |

Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R −

42 / 174 Lets say that i 01001 and j 01010. Then, → → Q Γ Q Γ L, S, R { } q 0 q0 0 R q0 1 q01 1 R q01 0 q010 0 R q010 0 q0100 0 R q0100 1 qb1.01001 1 L qb1.01001 qb2.01001 L − − qb2.01001 qb3.01001 L − − qb3.01001 qb4.01001 L − − qb4.01001 qw1.01001 S − − qw1.01001 qw2.01001 0 R − qw2.01001 qw3.01001 1 R − qw3.01001 qw4.01001 0 R − qw4.01001 qw5.01001 1 R − 0 qw5.01001 q 0 R − Note: need to move back 2 log Γ steps as well! | | 43 / 174 Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0?

44 / 174 I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | |

45 / 174 I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | |

46 / 174 I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | |

47 / 174 I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | |

48 / 174 What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | |

49 / 174 I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

50 / 174 Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

51 / 174 Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | |

52 / 174 Total time taken: 5 log Γ T (n) steps. | |

Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | |

53 / 174 Total time required

What is the number of states in M0? Each line in the transition table of M creates 4 log Γ states. | | I log Γ steps to read the symbol encoding. | | I log Γ steps to go back to the start of the symbol encoding. | | I log Γ steps to write the new symbol encoding. | | I 2 log Γ in case the tape-head moves to the left. | | What is the size of the old transition table?

I Q Γ | | · | |

Total number of new states required: Q Γ 4 log Γ . | || | | | Each step of M requires 5 log Γ steps of M0. | | Total time taken: 5 log Γ T (n) steps. | |

54 / 174 Proof Lets consider that a TM M computes the function f and has k tapes (plus additional input and output tapes) Next we consider a single work tape Turing machine Mˆ Mˆ encodes the k tapes of M on a single tape by using locations 1, k + 1, 2k + 1,... to encode the first tape, locations 2, k + 2, 2k + 2,... to encode the second tape etc. For every symbol a in M’s alphabet, Mˆ will contain both the symbol a and the symbol ˆa. In the encoding of each tape, exactly one symbol will be of the ‘ˆ type’, indicating that the corresponding head of M is positioned in that location.

More work tapes do not make much difference Claim If a function f is computable by a TM M using k tapes, then its computable in time 5kT (n)2 by a TM using a single work tape.

55 / 174 More work tapes do not make much difference Claim If a function f is computable by a TM M using k tapes, then its computable in time 5kT (n)2 by a TM using a single work tape.

Proof Lets consider that a TM M computes the function f and has k tapes (plus additional input and output tapes) Next we consider a single work tape Turing machine Mˆ Mˆ encodes the k tapes of M on a single tape by using locations 1, k + 1, 2k + 1,... to encode the first tape, locations 2, k + 2, 2k + 2,... to encode the second tape etc. For every symbol a in M’s alphabet, Mˆ will contain both the symbol a and the symbol ˆa. In the encoding of each tape, exactly one symbol will be of the ‘ˆ type’, indicating that the corresponding head of M is positioned in that location.

56 / 174 More work tapes do not make much difference

Proof Cont’d To simulate one step of M, the machine makes two passes of its work tape: first it traverses the tape in the left-to-right direction and records (via additional states) the k symbols of the form ˆa Then Mˆ uses M’s transition function to determine the new state, symbols, and head movements and sweeps the tape back in the right-to-left direction to update the encoding accordingly. Mˆ will never reach more than location kT (n) of its work tape, meaning that for each of the at most T (n) steps of M, Mˆ performs at most 5kT (n) work (sweeping back and forth requires about 2T (n) steps, and some additional steps needed for updating head movement and book keeping).

57 / 174 I a primitive that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

58 / 174 Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

59 / 174 Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do.

60 / 174 I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

61 / 174 I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

62 / 174 So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

63 / 174 I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

64 / 174 I How can there be a fixed machine UTM that will run any other TM ?

Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

65 / 174 Universal Turing Machines

So far, constructed Turing machines for a specific task.

I a primitive computer that only performs one task.

Not very useful, since there are many things we want to do. Question: does there exist a TM that does many things?

I Given a ‘program’ P and an input x for P, run P on x.

I Note that a program is just an algorithm for doing something, i.e., its a Turing machine.

So ... given any TM M and x, does there exist a TM UTM that will run M on x

I How to give M to UTM? Since M is a machine.

I How can there be a fixed machine UTM that will run any other TM ?

66 / 174 I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

67 / 174 I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

68 / 174 The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B}

69 / 174 But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

70 / 174 Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

71 / 174 M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α

72 / 174 So UTM takes α and x, and simulates Mα on x.

What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { }

73 / 174 What is a Turing machine really

Observe that the TM s are not all that different

I Can assume all have 1 input tape, 1 output tape, 1 work tape.

I Can assume Γ = 0, 1, , {  B} The only thing different between different Turing machines is the transition table

But the transition table can be written up as a string of bits!

Mα: TM represented by string of bits α M 0, 1 ∗: string of bits representing M b c ∈ { } So UTM takes α and x, and simulates Mα on x.

74 / 174 Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

75 / 174 For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

76 / 174 We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand.

77 / 174 I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

78 / 174 I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

79 / 174 I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

80 / 174 I Store the new state of M

So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

81 / 174 So we just have to design a TM that can run the above algorithm.

The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

82 / 174 The Algorithm for TM

How can a fixed Turing machine UTM run any other TM ?

Basic idea: Running a TM is also just an algorithm!

For example, we ran the TM for PAL(x) by hand. We just have to follow some rules, i.e., there is a simple algorithm for running a TM M:

I Read the symbol of the input x at the tape-head.

I Scan the transition table to find a rule which applies.

I Apply this rule to write new symbol and move the tape head.

I Store the new state of M

So we just have to design a TM that can run the above algorithm.

83 / 174 T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

84 / 174 Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape

85 / 174 I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

86 / 174 I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα

87 / 174 I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape.

88 / 174 Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function.

89 / 174 Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

90 / 174 Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

91 / 174 Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

92 / 174 Copy new symbol to T4 and move heads of T1 and T3.

Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

93 / 174 Universal Turing Machine

Storage:

T1: input tape containing α, x.

T2: output tape Three work tapes:

I T3 contains the current state of Mα I T4 is used the same way as Mα’s work-tape. I T5 contains the transition function. Transition function of UTM:

Scan T5 to find a match of the state with T3

Scan T5 to find a match of symbol with T1 and T4.

Copy new state to T3

Copy new symbol to T4 and move heads of T1 and T3.

94 / 174 Simulating Mα

95 / 174 A Quote

“If we were so clever that we could understand our brain, our brain would be so complex that we couldn’t understand it.”

96 / 174 It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

I We don’t care how much time is taken

I So just spend as much time till the computation of the function finishes.

Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { } HALT(P, x): Given program P and x, does P halt on x?

Halting function HALT is not computable by any TM .

Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀

97 / 174 I We don’t care how much time is taken

I So just spend as much time till the computation of the function finishes.

Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { } HALT(P, x): Given program P and x, does P halt on x?

Halting function HALT is not computable by any TM .

Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀ It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

98 / 174 I So just spend as much time till the computation of the function finishes.

Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { } HALT(P, x): Given program P and x, does P halt on x?

Halting function HALT is not computable by any TM .

Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀ It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

I We don’t care how much time is taken

99 / 174 Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { } HALT(P, x): Given program P and x, does P halt on x?

Halting function HALT is not computable by any TM .

Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀ It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

I We don’t care how much time is taken

I So just spend as much time till the computation of the function finishes.

100 / 174 HALT(P, x): Given program P and x, does P halt on x?

Halting function HALT is not computable by any TM .

Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀ It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

I We don’t care how much time is taken

I So just spend as much time till the computation of the function finishes.

Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { }

101 / 174 Halting function HALT is not computable by any TM .

Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀ It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

I We don’t care how much time is taken

I So just spend as much time till the computation of the function finishes.

Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { } HALT(P, x): Given program P and x, does P halt on x?

102 / 174 Uncomputable functions

f is computable by a TM M if M(x) = f (x) x ∀ It would seem that any function f : 0, 1 ∗ 0, 1 can be computed by a Turing machine. { } → { }

I We don’t care how much time is taken

I So just spend as much time till the computation of the function finishes.

Uncomputable functions exist There exists UC : 0, 1 ∗ 0, 1 not computable by any TM . { } → { } HALT(P, x): Given program P and x, does P halt on x?

Halting function HALT is not computable by any TM .

103 / 174 Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { }

104 / 174 I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

105 / 174 S P

What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | |

106 / 174 What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

107 / 174 Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

What if S and P are infinite sets?

108 / 174 I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { }

109 / 174 I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. →

110 / 174 A Detour

Let S = s1,..., sn and P = p1,..., pm be two finite sets { } { } Question: When does a bijection between S and P exist?

I Answer: a bijection f : S P iff S = P ∃ → | | | | S P

What if S and P are infinite sets? Any bijection between S = 1, 2,... and P = 2, 3,... ? { } { } I f : S P defined as: f (a) = a + 1. → I 1 2, 2 3, 3 4 and so on. ↔ ↔ ↔

111 / 174 I f : S P defined as: f (a) = 2a. → I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔ I Looks weird, but make sure you completely understand this.

Theorem A bijection exists between natural N and rationals Q.

Theorem No bijection exists between natural numbers N and reals R.

Question: What about an infinite set, and its power set?

A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { }

112 / 174 I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔ I Looks weird, but make sure you completely understand this.

Theorem A bijection exists between natural numbers N and rationals Q.

Theorem No bijection exists between natural numbers N and reals R.

Question: What about an infinite set, and its power set?

A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { } I f : S P defined as: f (a) = 2a. →

113 / 174 I Looks weird, but make sure you completely understand this.

Theorem A bijection exists between natural numbers N and rationals Q.

Theorem No bijection exists between natural numbers N and reals R.

Question: What about an infinite set, and its power set?

A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { } I f : S P defined as: f (a) = 2a. → I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔

114 / 174 Theorem A bijection exists between natural numbers N and rationals Q.

Theorem No bijection exists between natural numbers N and reals R.

Question: What about an infinite set, and its power set?

A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { } I f : S P defined as: f (a) = 2a. → I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔ I Looks weird, but make sure you completely understand this.

115 / 174 Theorem No bijection exists between natural numbers N and reals R.

Question: What about an infinite set, and its power set?

A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { } I f : S P defined as: f (a) = 2a. → I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔ I Looks weird, but make sure you completely understand this.

Theorem A bijection exists between natural numbers N and rationals Q.

116 / 174 Question: What about an infinite set, and its power set?

A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { } I f : S P defined as: f (a) = 2a. → I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔ I Looks weird, but make sure you completely understand this.

Theorem A bijection exists between natural numbers N and rationals Q.

Theorem No bijection exists between natural numbers N and reals R.

117 / 174 A Detour

Bijection between S = 1, 2, 3,... and P = 2, 4, 6,... ? { } { } I f : S P defined as: f (a) = 2a. → I 1 2, 2 4, 3 6 and so on. ↔ ↔ ↔ I Looks weird, but make sure you completely understand this.

Theorem A bijection exists between natural numbers N and rationals Q.

Theorem No bijection exists between natural numbers N and reals R.

Question: What about an infinite set, and its power set?

118 / 174 Proof Consider an infinite set S and its corresponding power set P We show a contradiction if bijection f : S P ∃ → Let i be any element of S and A be any element of P If bijection exists, every A P is mapped to by some i S ∈ ∈ Consider the following set A0 P: ∈ A0 = i S : i / f (i) { ∈ ∈ } A0: All i which are not present in the set f (i)

Bijection between a set and its powerset

Claim There does not exist bijection between infinite set and its power set

119 / 174 We show a contradiction if bijection f : S P ∃ → Let i be any element of S and A be any element of P If bijection exists, every A P is mapped to by some i S ∈ ∈ Consider the following set A0 P: ∈ A0 = i S : i / f (i) { ∈ ∈ } A0: All i which are not present in the set f (i)

Bijection between a set and its powerset

Claim There does not exist bijection between infinite set and its power set

Proof Consider an infinite set S and its corresponding power set P

120 / 174 Let i be any element of S and A be any element of P If bijection exists, every A P is mapped to by some i S ∈ ∈ Consider the following set A0 P: ∈ A0 = i S : i / f (i) { ∈ ∈ } A0: All i which are not present in the set f (i)

Bijection between a set and its powerset

Claim There does not exist bijection between infinite set and its power set

Proof Consider an infinite set S and its corresponding power set P We show a contradiction if bijection f : S P ∃ →

121 / 174 If bijection exists, every A P is mapped to by some i S ∈ ∈ Consider the following set A0 P: ∈ A0 = i S : i / f (i) { ∈ ∈ } A0: All i which are not present in the set f (i)

Bijection between a set and its powerset

Claim There does not exist bijection between infinite set and its power set

Proof Consider an infinite set S and its corresponding power set P We show a contradiction if bijection f : S P ∃ → Let i be any element of S and A be any element of P

122 / 174 Consider the following set A0 P: ∈ A0 = i S : i / f (i) { ∈ ∈ } A0: All i which are not present in the set f (i)

Bijection between a set and its powerset

Claim There does not exist bijection between infinite set and its power set

Proof Consider an infinite set S and its corresponding power set P We show a contradiction if bijection f : S P ∃ → Let i be any element of S and A be any element of P If bijection exists, every A P is mapped to by some i S ∈ ∈

123 / 174 Bijection between a set and its powerset

Claim There does not exist bijection between infinite set and its power set

Proof Consider an infinite set S and its corresponding power set P We show a contradiction if bijection f : S P ∃ → Let i be any element of S and A be any element of P If bijection exists, every A P is mapped to by some i S ∈ ∈ Consider the following set A0 P: ∈ A0 = i S : i / f (i) { ∈ ∈ } A0: All i which are not present in the set f (i)

124 / 174 Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely

125 / 174 Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃

126 / 174 If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈

127 / 174 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’:

128 / 174 If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction!

129 / 174 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’:

130 / 174 Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

131 / 174 Proof Cont’d Now lets look at A0 more closely Since f is a bijection, j such that f (j) = A0 ∃ Here is the fatal question: Is j A0? ∈ If the answer is ‘Yes’: 0 0 I If j A , then by definition of A , j maps to a set which does not contain∈ j

I Contradiction! If the answer is ‘No’: 0 0 I If j / A , then j is mapping to a set (A ) which doesn’t contain j. So by definition∈ of A0, j should be in A0.

I Contradiction!

Important Corollary

Given any function f : S P, there always exists a pj P such that no → ∈ si S maps to pj . ∈

132 / 174 A Quote

“It seemed unworthy of a grown man to spend his time on such trivialities, but what was I to do?” –Bertrand Russell.

133 / 174 S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

134 / 174 Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

135 / 174 I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈

136 / 174 I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

137 / 174 Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

138 / 174 I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈

139 / 174 I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

140 / 174 Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

141 / 174 I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

142 / 174 By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i

143 / 174 I Then there is no TM that decides the language Lk !

Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈

144 / 174 Uncountable Sets and Uncomputable functions

Claim: Uncomputable functions exist

S: Infinite set of all binary strings, P: Power-set of S

Each si S is a binary string ∈ I A Turing Machine can be represented by a string

I Interpret each si to represent some TM Msi

Each pj P is a set of binary strings ∈ I A language is just a set of strings

I Interpret each pj to represent a language, say, Lj

Now, each TM Msi decides some language Lj

I This defines f ( ): f (si ) = pj , where Ms decides Lj · i By previous corollary, pk P s.t. no si maps to pk ∃ ∈ I Then there is no TM that decides the language Lk !

145 / 174 Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

146 / 174 I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT

147 / 174 I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x

148 / 174 I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c

149 / 174 Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

150 / 174 If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c

151 / 174 I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

152 / 174 I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M

153 / 174 I When MH would halt with a ‘No’, D also halts.

HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop.

154 / 174 HALT Halting function HALT is not computable by any TM

Proof.

Assume a TM MH computes HALT I MH takes as input a TM M (as a string) and M’s input x I MH ( M ; x) = 1 if M halts on input x, 0 otherwise b c I Note that MH always halts

Consider the case when x = M : MH ( M ; M ) b c b c b c If MH exists, then there also exists a TM D s.t.

I D takes as input a TM M I D works the same way as MH . However, when MH is about to halt with a ‘yes’, D goes into an infinite loop. I When MH would halt with a ‘No’, D also halts.

155 / 174 I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

156 / 174 I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c

157 / 174 Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c

158 / 174 If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c

159 / 174 I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c

160 / 174 I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c

161 / 174 If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

162 / 174 I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c

163 / 174 I Contradiction! This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c

164 / 174 This type of argument is called a diagonalization argument.

HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction!

165 / 174 HALT

Proof Cont’d

So far: if MH exists, then there also exists D:

I D( M ) does not halt if M halts on input M b c b c I D( M ) halts if M does not halt on input M b c b c Fatal question: Does D( D ) halt? b c If D( D ) halts: b c I D( D ) halts = D does not halt on input D b c ⇒ b c I Contradiction!

If D( D ) does not halt: b c I D( D ) does not halt = D halts on input D b c ⇒ b c I Contradiction! This type of argument is called a diagonalization argument.

166 / 174 Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

The spawns more problems

Using reductions, can show many problems to be undecidable

167 / 174 Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable

168 / 174 HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT

169 / 174 Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

170 / 174 Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs}

171 / 174 Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem

172 / 174 M0 halts on all inputs if and only if M halts on x

The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise

173 / 174 The Halting problem spawns more problems

Using reductions, can show many problems to be undecidable Goal: show that the problem A is undecidable Establish that, if there were an algorithm for problem A, then there would be an algorithm for HALT HALT doesn’t have an algorithm, hence so doesn’t A

Claim: This is undecidable: {M: M halts on all inputs} Reduce HALT to this problem Given M; x construct the following machine M0: M0(y) = M(x) if y = x, M0(y) = 0 otherwise M0 halts on all inputs if and only if M halts on x

174 / 174