Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computable Problems.

Similar presentations


Presentation on theme: "Computable Problems."— Presentation transcript:

1 Computable Problems

2 Computability What does it mean to be computable?

3 Computability What does it mean to be computable?
Can decide an answer using Finite number of steps Finite list of instructions

4 Background: Proof By Contradiction

5 Proof By Contradiction
Assume something is true Show it leads to a contradiction Conclude the opposite

6 Proof By Contradiction
Assume something is true Show it leads to a contradiction Conclude the opposite

7 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle

8 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle Assume the opposite: Triangle ABC has right angles A and B

9 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle Assume the opposite: Triangle ABC has right angles A and B Find a contradiction: The measures of A + B + C = 180 (given)

10 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle Assume the opposite: Triangle ABC has right angles A and B Find a contradiction: The measures of A + B + C = 180 (given) C = 180 (step 1 and our assumption)

11 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle Assume the opposite: Triangle ABC has right angles A and B Find a contradiction: The measures of A + B + C = 180 (given) C = 180 (step 1 and our assumption) Measure of C = 0 (step 2 and additive property of equality)

12 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle Assume the opposite: Triangle ABC has right angles A and B Find a contradiction: The measures of A + B + C = 180 (given) C = 180 (step 1 and our assumption) Measure of C = 0 (step 2 and additive property of equality) Measure of C > 0 (given)

13 Proof By Contradiction
Given: The 3 angles in a triangle are each > 0 degrees The 3 angles in a triangle add to 180 Prove: No triangle can have more than one 90 degree angle Assume the opposite: Triangle ABC has right angles A and B Find a contradiction: The measures of A + B + C = 180 (given) C = 180 (step 1 and our assumption) Measure of C = 0 (step 2 and additive property of equality) Measure of C > 0 (given) Assumption must be false – we can not have a triangle with right angles A and B

14 Background: Programs are Data

15 Programs Running Programs
Programs run on data Programs are stored as data Programs can run on other programs

16 Background: Yes/No Questions

17 Decidability Decidability problem: Any problem that requires a yes/no answer Does this data contain " "? Will this program ever stop? Will this program crash? Is there a virus in this program?

18 Sample Program 1: Always Yes Program Anything Rule: Always say Yes Yes

19 Sample Program 1: Always Yes Program Input Result hello.txt (2kB) YES
addressList.doc (86kB) notepad.exe

20 Sample Program 2: Always No Program Anything Rule: Always say No No

21 Sample Program 2: Always No Program Input Result hello.txt (2kB) NO
addressList.doc (86kB) notepad.exe

22 Sample Program 3: Size Checker Program File Rule: Is size > 10 Kb?
Yes/No

23 Sample Program 3: Size Checker Program Input Result hello.txt (2kB) NO
File Input Result hello.txt (2kB) NO addressList.doc (86kB) YES notepad.exe Rule: Is size > 10 Kb? Yes/No

24 Does this program always say yes?
Always Yes? Can I write a program that determines if other programs say Yes all the time? Program Rule: Does this program always say yes? Yes/No

25 Does this program always say yes?
Always Yes? Can I write a program that determines if other programs say Yes all the time? Assume I can write AlwaysYes(Program) … Program Rule: Does this program always say yes? Yes/No

26 Does this program always say yes?
Always Yes? Program Input Result Yes No Size Checker Always Yes Rule: Does this program always say yes? Yes/No

27 Does this program always say yes?
Always Yes? Yes Program Program Input Result Yes No Size Checker Always Yes Rule: Does this program always say yes? Yes/No Yes Program: Input Result hello.txt (2kB) YES addressList.doc (86kB) notepad.exe

28 Does this program always say yes?
Always Yes? No Program Program Input Result Yes No Size Checker Always Yes Rule: Does this program always say yes? Yes/No No Program: Input Result hello.txt (2kB) NO addressList.doc (86kB) notepad.exe

29 Does this program always say yes?
Always Yes? Size Program Program Input Result Yes No Size Checker Always Yes Rule: Does this program always say yes? Yes/No Size Check Program: Input Result hello.txt (2kB) NO addressList.doc (86kB) YES notepad.exe

30 Does this program always say yes?
Always Yes? Always Yes ( Always Yes )  ??? Always Yes Program File Input Result Yes No Size Checker Always Yes ?? Rule: Does this program always say yes? Yes/No

31 Does this program always say yes?
Always Yes? Always Yes ( Always Yes )  No Always Yes Program File Input Result Yes No Size Checker Always Yes NO Rule: Does this program always say yes? Yes/No Everything seems fine…

32 Does this program say Yes if run on itself?
Yes On Self If I can write "Does this program always say yes"… I can write "Does this program say yes when it runs on itself" Program Rule: Does this program say Yes if run on itself? Yes/No

33 Yes On Self Input Result Yes No Size Checker (19kb) Always Yes

34 Yes On Self Input Result Yes YES No NO Size Checker (19kb) Always Yes

35 Yes On Self Input Result Yes YES No NO Size Checker (19kb) Always Yes
???

36 Yes On Self If Says Yes on Self says Yes Then the program should
Answer "Yes"

37 Yes On Self If Says Yes on Self says No Then the program should
Answer "No"

38 Yes On Self Says Yes on Self could decide No or Yes!?!?! Input Result
Size Checker (19kb) Name Size Checker Always Yes Yes On Self Yes or No Says Yes on Self could decide No or Yes!?!?!

39 Yes On Self If I can write "Does this program say yes when it runs on itself "… I can write "Say No if this program says Yes if run on itself" Program

40 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self File Rule: Say No if a program says Yes when run on itself. Otherwise say Yes. Yes/No Input YesSelf Anti Yes YES NO No Size Checker (19kb) Always Yes

41 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self What should AntiYesSelf day about itself? Rule: Say No if a program says Yes when run on itself. Otherwise say Yes.

42 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self Assume: AntiYesSelf( AntiYesSelf( ) )  YES Rule: Say No if a program says Yes when run on itself. Otherwise say Yes. Yes

43 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self Assume: AntiYesSelf( AntiYesSelf( ) )  YES If it says YES when run on itself, it was supposed to say NO! Rule: Say No if a program says Yes when run on itself. Otherwise say Yes. Yes

44 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self Assume: AntiYesSelf( AntiYesSelf( ) )  NO Rule: Say No if a program says Yes when run on itself. Otherwise say Yes. No

45 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self Assume: AntiYesSelf( AntiYesSelf( ) )  NO If it says NO when run on itself, it was supposed to say YES! Rule: Say No if a program says Yes when run on itself. Otherwise say Yes. Yes

46 Say No if a program says Yes when run on itself. Otherwise say Yes.
Anti Yes On Self Anti Yes On Self Can't Answer YES or NO! Rule: Say No if a program says Yes when run on itself. Otherwise say Yes. Assume result is YES: Assume result is No:

47 Chain: If I can write Always Yes

48 Chain: If I can write Always Yes Then I can write Yes On Self

49 Chain: If I can write Always Yes Then I can write Yes On Self
Then I can write Anti Yes On Self

50 Chain: If I can write Always Yes Then I can write Yes On Self
Then I can write Anti Yes On Self But Anti Yes On Self Can't Exist

51 Chain: If I can write Always Yes Then I can write Yes On Self
Then I can write Anti Yes On Self But Anti Yes On Self Can't Exist I can NOT write Always Yes

52 Crash Detection What about detecting possible bugs?

53 Crash Detection What about detecting possible bugs?

54 Crash Detection What about detecting possible bugs?

55 Crash Detection What about detecting possible bugs?

56 Crash Detection What about detecting possible bugs?

57 Crash Detection AntiCrashOnSelf runs on itself:
Assume: AntiCrashSelf( AntiCrashSelf( ) )  YES

58 Crash Detection AntiCrashOnSelf runs on itself:
Assume: AntiCrashSelf( AntiCrashSelf( ) )  YES Then AntiCrashSelf( AntiCrashSelf( ) ) Must Crash!

59 Crash Detection AntiCrashOnSelf runs on itself:
Assume: AntiCrashSelf( AntiCrashSelf( ) )  YES Then AntiCrashSelf( AntiCrashSelf( ) ) Must Crash!

60 Crash Detection AntiCrashOnSelf runs on itself:
Assume: AntiCrashSelf( AntiCrashSelf( ) )  Crashes

61 Crash Detection AntiCrashOnSelf runs on itself:
Assume: AntiCrashSelf( AntiCrashSelf( ) )  Crashes Then AntiCrashSelf( AntiCrashSelf( ) ) Must Output Yes

62 Crash Detection AntiCrashOnSelf runs on itself:
Assume: AntiCrashSelf( AntiCrashSelf( ) )  Crashes Then AntiCrashSelf( AntiCrashSelf( ) ) Must Output Yes

63 The Dilemma

64 Crash Detection What about detecting possible bugs?
AntiCrashOnSelf runs on itself YES: If it outputs Yes then it must have crashed No: If it outputs No then it must not have crashed

65 Crash Detection What about detecting possible bugs?

66 Crash Detection What about detecting possible bugs?

67 Crash Detection What about detecting possible bugs?
Impossible to do perfectly Must settle for pretty good most of the time

68 Alan Turing Father of Computer Science

69 Alan Turing Demonstrated the "Halting Problem" is uncomputable >

70 The Turing Machine Hypothetical device
Reads and write symbols on a tape Decides what to do based on list of rules

71 Real Turing Machines

72 Unsolvable Problems Turing machines can not solve some problems Ex: Look at a program and decide if it halts

73 Computers Turing machine can compute anything computable by any system consisting of: Finite number of steps Finite list of instructions =

74 Unsolvable Problems Turing machines can not solve some problems
A Turing machine can solve any problem solvable by any computer

75 Unsolvable Problems Turing machines can not solve some problems
A Turing machine can solve any problem solvable by any computer There are some problems unsolvable by computation


Download ppt "Computable Problems."

Similar presentations


Ads by Google