ATM, Halting Problem, P vs. NP

63
ATM, Halting Problem, P vs. NP Chapter 4, 5 & 7

description

ATM, Halting Problem, P vs. NP. Chapter 4, 5 & 7. Russel’s Paradox. http://www.jimloy.com/logic/russell.htm An Index is a book that lists other books in the library Index of all biology text books in the library. Consider the index of all indices, i.e., book that lists other indices. - PowerPoint PPT Presentation

Transcript of ATM, Halting Problem, P vs. NP

Page 1: ATM, Halting Problem, P vs. NP

ATM, Halting Problem, P vs. NP

Chapter 4, 5 & 7

Page 2: ATM, Halting Problem, P vs. NP

Russel’s Paradox• http://www.jimloy.com/logic/russell.htm

• An Index is a book that lists other books in the library– Index of all biology text books in the library.

• Consider the index of all indices, i.e., book that lists other indices.– It would contain itself.– Called a self-referential index (form of recursion).

• Consider the index of all non self-referential indices.– The book that lists all indices that are non self-referential.– Call it the non-recursive index

1. If the non-recursive index lists itself then its recursive and shouldn’t be in the list.

2. But if it doesn’t list itself, then it is non-recursive and it should be listed as one of the non self-referential books.

Page 3: ATM, Halting Problem, P vs. NP
Page 4: ATM, Halting Problem, P vs. NP
Page 5: ATM, Halting Problem, P vs. NP
Page 6: ATM, Halting Problem, P vs. NP
Page 7: ATM, Halting Problem, P vs. NP
Page 8: ATM, Halting Problem, P vs. NP
Page 9: ATM, Halting Problem, P vs. NP
Page 10: ATM, Halting Problem, P vs. NP
Page 11: ATM, Halting Problem, P vs. NP
Page 12: ATM, Halting Problem, P vs. NP
Page 13: ATM, Halting Problem, P vs. NP
Page 14: ATM, Halting Problem, P vs. NP
Page 15: ATM, Halting Problem, P vs. NP
Page 16: ATM, Halting Problem, P vs. NP
Page 17: ATM, Halting Problem, P vs. NP
Page 18: ATM, Halting Problem, P vs. NP
Page 19: ATM, Halting Problem, P vs. NP
Page 20: ATM, Halting Problem, P vs. NP
Page 21: ATM, Halting Problem, P vs. NP
Page 22: ATM, Halting Problem, P vs. NP
Page 23: ATM, Halting Problem, P vs. NP
Page 24: ATM, Halting Problem, P vs. NP
Page 25: ATM, Halting Problem, P vs. NP
Page 26: ATM, Halting Problem, P vs. NP

ATM reduces to HALTTM

• Proof by Contradiction– Assume we have a Turing Machine R that decides

HALTTM.• In other words, we can design an algorithm that

determines of another algorithm (M) will halt on a given input (w).

Page 27: ATM, Halting Problem, P vs. NP

ATM reduces to HALTTM

• Proof by Contradiction– Assume we have a Turing Machine R that decides

HALTTM.– Then, use R to construct a new machine S that can

decide ATM.– We have already proven that is NOT decidable.– So, if we can construct a machine S that can

decide ATM based on HALTTM then we must conclude that cannot be decidable.

Page 28: ATM, Halting Problem, P vs. NP

ATM reduces to HALTTM

• Proof by Contradiction– Assume we have a Turing Machine R that decides

HALTTM.– Then, use R to construct a new machine S that can

decide ATM.– We have already proven that ATM is NOT decidable.– So, if we can construct a machine S that can

decide ATM based on HALTTM then we must conclude that cannot be decidable.

Page 29: ATM, Halting Problem, P vs. NP

Deeply Understanding ATM

• ATM is just a set of strings where part of the string is the encoding of a Turing Machine (M) and the other part is an input string (w).– The string in ATM are the ones were the input w is accepted by the

Machine M.– The string in the complement of are the ones the input w is rejected

by the Machine M.

• A decider for ATM cannot exist because there are absurd Turing Machines infinite loop or output nothing.

• Detecting such absurdity is impossible because you are limited by the power of the same machine that allows for such absurdity. – Simulating an absurd Turing Machine with another Turing Machine

cannot “undo” it absurdity and allow it to always produce an answer (accept or reject).

Page 30: ATM, Halting Problem, P vs. NP
Page 31: ATM, Halting Problem, P vs. NP

Chapter 7

Time Complexity

Page 32: ATM, Halting Problem, P vs. NP

Big-O

Page 33: ATM, Halting Problem, P vs. NP

Little-o

Page 34: ATM, Halting Problem, P vs. NP

O(n2)

Page 35: ATM, Halting Problem, P vs. NP

O(n log2n)

Page 36: ATM, Halting Problem, P vs. NP

O(n)

Page 37: ATM, Halting Problem, P vs. NP
Page 38: ATM, Halting Problem, P vs. NP

Non-determinism

Page 39: ATM, Halting Problem, P vs. NP

The Cost of Non-determinism

Page 40: ATM, Halting Problem, P vs. NP

The Class P

Page 41: ATM, Halting Problem, P vs. NP

Example of a problem in P

Page 42: ATM, Halting Problem, P vs. NP

PATH is polynomial

Page 43: ATM, Halting Problem, P vs. NP

The Class NP

Page 44: ATM, Halting Problem, P vs. NP

Polynomial Verification

• Some problems (Hamiltonian Path) cannot be solved in Polynomial Time (P), but…

• If we could somehow obtain a solution (ask an oracle), the solution could be verified in P-time.

Page 45: ATM, Halting Problem, P vs. NP

Hamiltonian Path: Decider vs. Verifier

• There is very subtle difference:

• Hamiltonian Decider – Input: Graph– Output: Hamiltonian Path

• Hamiltonian Verifier– Input: Graph, Hamiltonian Path– Output: Accept/Reject

Page 46: ATM, Halting Problem, P vs. NP

Hamiltonian Path Algorithm – Non-deterministic

Page 47: ATM, Halting Problem, P vs. NP
Page 48: ATM, Halting Problem, P vs. NP

Understand NP in English

• Problems where the solutions can be verified in P-Time, but cannot be “discovered” in P-time

• Problems where the solutions can be “discovered” P-Time using a Non-deterministic Turing Machine

• Note: Every non-deterministic Turing machine can be made deterministic by adding O(kn)

Page 49: ATM, Halting Problem, P vs. NP
Page 50: ATM, Halting Problem, P vs. NP
Page 51: ATM, Halting Problem, P vs. NP
Page 52: ATM, Halting Problem, P vs. NP
Page 53: ATM, Halting Problem, P vs. NP
Page 54: ATM, Halting Problem, P vs. NP

Non-determinism O(kn)

• k is usually 2– Given a graph with n vertices, there are 2n possible

subsets.• 2 options for each vertex• Either you are in the subset (1) on not (0)• Binary state condition

– Given a list with n value, there are 2n possible subsets

Page 55: ATM, Halting Problem, P vs. NP

Non-determinism O(kn)

“Non deterministically select a subset implies 2n operations.”• This is a loop through a Turing machine state

that has a branching non-deterministic transition

• For each n vertex regardless of the tape symbol– Add (1) the vertex to the subset and continue– Don’t add (2) the vertex and continue

Page 56: ATM, Halting Problem, P vs. NP
Page 57: ATM, Halting Problem, P vs. NP
Page 58: ATM, Halting Problem, P vs. NP
Page 59: ATM, Halting Problem, P vs. NP
Page 60: ATM, Halting Problem, P vs. NP
Page 61: ATM, Halting Problem, P vs. NP
Page 62: ATM, Halting Problem, P vs. NP
Page 63: ATM, Halting Problem, P vs. NP