1 00:00:00,704 --> 00:00:02,370 PROFESSOR: Another basic proof technique 2 00:00:02,370 --> 00:00:06,440 is called Proof By Cases, which we prove something 3 00:00:06,440 --> 00:00:11,590 by breaking it up into pieces that are easy to prove 4 00:00:11,590 --> 00:00:14,080 but that together cover all possibilities. 5 00:00:14,080 --> 00:00:16,480 Let's look at an explicit, simple example 6 00:00:16,480 --> 00:00:18,330 from computer science. 7 00:00:18,330 --> 00:00:22,130 Here's a Java logical expression. 8 00:00:22,130 --> 00:00:26,090 The way to decipher this is that the double vertical bar 9 00:00:26,090 --> 00:00:28,300 means "or" in Java. 10 00:00:28,300 --> 00:00:31,980 And the double ampersand means "and" in Java. 11 00:00:31,980 --> 00:00:37,400 So this is a conditional test, an IF test, 12 00:00:37,400 --> 00:00:40,070 that is the guard on a bunch code 13 00:00:40,070 --> 00:00:43,687 to be executed if this test comes out to be true. 14 00:00:43,687 --> 00:00:44,520 Let's read the test. 15 00:00:44,520 --> 00:00:48,450 If x is greater than 0, or x is less than or equal to 0, 16 00:00:48,450 --> 00:00:51,390 and y is greater than 100, go ahead 17 00:00:51,390 --> 00:00:56,800 and do the code that's in there indicated by the vertical dots. 18 00:00:56,800 --> 00:00:59,690 We're going to assume here that x and y are variables that 19 00:00:59,690 --> 00:01:02,870 are declared to be of type floating point, 20 00:01:02,870 --> 00:01:05,232 [? or a ?] real number, or integers for that matter. 21 00:01:05,232 --> 00:01:06,220 OK. 22 00:01:06,220 --> 00:01:10,420 Now what I claim is this code can be improved if it's 23 00:01:10,420 --> 00:01:12,190 rewritten in the following way. 24 00:01:12,190 --> 00:01:20,160 Namely, if x is greater than 0 or y is greater than 100. 25 00:01:20,160 --> 00:01:23,060 So the claim is that these two hunks of codie, if I just 26 00:01:23,060 --> 00:01:27,320 replace this test, which has three components that require 27 00:01:27,320 --> 00:01:31,250 an extra step to evaluate some cases, 28 00:01:31,250 --> 00:01:35,350 by this code the programs are going 29 00:01:35,350 --> 00:01:37,050 to behave exactly the same way. 30 00:01:37,050 --> 00:01:39,500 And therefore it's just more efficient and easier 31 00:01:39,500 --> 00:01:40,100 to understand. 32 00:01:40,100 --> 00:01:43,640 One is one step faster if I replace this longer expression 33 00:01:43,640 --> 00:01:45,390 by this shorter expression. 34 00:01:45,390 --> 00:01:48,980 Now how do I argue that these two pieces of code 35 00:01:48,980 --> 00:01:51,380 are going to behave in exactly the same way, 36 00:01:51,380 --> 00:01:53,274 or come up with the same final output? 37 00:01:53,274 --> 00:01:54,690 They won't behave exactly the same 38 00:01:54,690 --> 00:01:56,439 because one will be faster than the other. 39 00:01:56,439 --> 00:01:58,500 But they're going to yield the same results. 40 00:01:58,500 --> 00:02:03,060 OK, let's consider how these two behave in two cases. 41 00:02:03,060 --> 00:02:07,070 The first case will be that the number x really is positive, 42 00:02:07,070 --> 00:02:08,509 that it's greater than 0. 43 00:02:08,509 --> 00:02:09,949 What happens then? 44 00:02:09,949 --> 00:02:15,190 Well, the first test above in the "or" comes out to be true. 45 00:02:15,190 --> 00:02:17,780 And that means that the whole "or" expression is true. 46 00:02:17,780 --> 00:02:20,160 Because when you have a true "or" anything at all, it 47 00:02:20,160 --> 00:02:21,450 comes out to be true. 48 00:02:21,450 --> 00:02:25,010 And you go ahead and execute code that follows. 49 00:02:25,010 --> 00:02:27,200 Likewise, the second expression starts 50 00:02:27,200 --> 00:02:29,980 with x greater than 0 "or." 51 00:02:29,980 --> 00:02:31,870 So it comes out to be true. 52 00:02:31,870 --> 00:02:34,820 So, in this case, if x is greater than 0, 53 00:02:34,820 --> 00:02:36,670 both conditional expressions will 54 00:02:36,670 --> 00:02:39,750 allow the code that follows them to be executed. 55 00:02:39,750 --> 00:02:42,980 Because they both evaluate to true. 56 00:02:42,980 --> 00:02:44,260 OK. 57 00:02:44,260 --> 00:02:47,290 The next case is that x is less or equal to 0. 58 00:02:47,290 --> 00:02:49,422 Let's see what happens then. 59 00:02:49,422 --> 00:02:51,510 Well, in the top expression, since x 60 00:02:51,510 --> 00:02:55,370 is less than or equal to 0, that first expression, 61 00:02:55,370 --> 00:03:00,020 x greater than 0, if evaluated, returns false. 62 00:03:00,020 --> 00:03:02,460 And same thing in the second expression. 63 00:03:02,460 --> 00:03:05,850 The initial test x greater than 0 returns false. 64 00:03:05,850 --> 00:03:08,200 Now one of the things that the ways "or" works 65 00:03:08,200 --> 00:03:11,180 is that if you have an "or" of a bunch of things, 66 00:03:11,180 --> 00:03:13,900 if the first thing is false, you ignore it 67 00:03:13,900 --> 00:03:17,110 and just proceed to the other things 68 00:03:17,110 --> 00:03:19,610 to see how they come out. 69 00:03:19,610 --> 00:03:21,450 So what that means is that in both 70 00:03:21,450 --> 00:03:24,780 of these expressions, since the first test in the sequence 71 00:03:24,780 --> 00:03:27,860 of things that are being "ored" together came out to be false, 72 00:03:27,860 --> 00:03:29,570 I can just ignore them. 73 00:03:29,570 --> 00:03:33,490 The code is going to behave as though, after the false was 74 00:03:33,490 --> 00:03:36,020 detected, it's just going to behave in the same way 75 00:03:36,020 --> 00:03:40,050 that the rest of the test says to behave. 76 00:03:40,050 --> 00:03:43,920 Well, in the top case, the expression to be check 77 00:03:43,920 --> 00:03:47,840 now is that x is less than or equal to 0, 78 00:03:47,840 --> 00:03:50,730 and y is greater than 100. 79 00:03:50,730 --> 00:03:51,870 But what do we know? 80 00:03:51,870 --> 00:03:55,130 Well, x less than or equal to 0 in this case. 81 00:03:55,130 --> 00:03:57,610 So this test comes out to be true. 82 00:03:57,610 --> 00:04:00,490 And we have something of the form true "and" 83 00:04:00,490 --> 00:04:02,060 something or other. 84 00:04:02,060 --> 00:04:05,580 That means that the net outcome of this expression, it 85 00:04:05,580 --> 00:04:07,593 depends entirely on the something or other. 86 00:04:07,593 --> 00:04:10,740 That is, it depends entirely on whether y is greater than 0. 87 00:04:10,740 --> 00:04:13,440 Because the x is less than or equal to 0. 88 00:04:13,440 --> 00:04:15,235 And so this expression can be simplified. 89 00:04:15,235 --> 00:04:18,959 It's going to behave exactly according to whether 90 00:04:18,959 --> 00:04:20,750 or not y is greater than 100. 91 00:04:20,750 --> 00:04:22,350 So look what I've just done. 92 00:04:22,350 --> 00:04:24,560 I've argued that in this case, both 93 00:04:24,560 --> 00:04:30,150 of these tests cards act like y is the test y greater than 100. 94 00:04:30,150 --> 00:04:34,420 Which is, they behave the same in this case as well. 95 00:04:34,420 --> 00:04:40,130 So what I just figured out was that, in both cases, 96 00:04:40,130 --> 00:04:43,970 these two expressions yield the same result. 97 00:04:43,970 --> 00:04:50,320 And the only possible cases are that x is greater than 0, 98 00:04:50,320 --> 00:04:52,720 or x is less than or equal to 0. 99 00:04:52,720 --> 00:04:55,400 So in all cases, they're the same, and we're done. 100 00:04:55,400 --> 00:04:58,460 That's why it's safe to replace the upper complicated 101 00:04:58,460 --> 00:05:03,020 expression by the lower, less complicated expression. 102 00:05:03,020 --> 00:05:05,420 So, in general as I said, reasoning by cases 103 00:05:05,420 --> 00:05:08,030 breaks complicated problems into easier sub problems. 104 00:05:08,030 --> 00:05:09,950 Which is what we just saw there. 105 00:05:09,950 --> 00:05:12,200 [? It ?] wouldn't be clear how to prove that these two 106 00:05:12,200 --> 00:05:15,100 things were equivalent, but I chose those cases 107 00:05:15,100 --> 00:05:18,510 and it made each case easy to figure out that the two 108 00:05:18,510 --> 00:05:20,240 things with the same. 109 00:05:20,240 --> 00:05:22,980 Now, the truth is that there are some philosophers who 110 00:05:22,980 --> 00:05:28,440 worry about reasoning by cases for kind of subtle reasons. 111 00:05:28,440 --> 00:05:29,830 They're called intuitionists. 112 00:05:29,830 --> 00:05:32,280 And here's what bothers them. 113 00:05:32,280 --> 00:05:33,660 Let me illustrate it. 114 00:05:33,660 --> 00:05:37,810 There's a million dollar Clay Institute question. 115 00:05:37,810 --> 00:05:42,540 One of the dozen or so questions that 116 00:05:42,540 --> 00:05:44,435 are considered to be the major open problems 117 00:05:44,435 --> 00:05:47,356 in various disciplines of mathematics. 118 00:05:47,356 --> 00:05:49,330 And one of the disciplines of mathematics 119 00:05:49,330 --> 00:05:51,840 is complexity theory in computer science, 120 00:05:51,840 --> 00:05:53,740 computational complexity theory. 121 00:05:53,740 --> 00:05:56,930 This question is known as the p equals np question. 122 00:05:56,930 --> 00:06:00,490 And we're actually going to talk about it a fair amount in just 123 00:06:00,490 --> 00:06:01,926 the coming few lectures. 124 00:06:01,926 --> 00:06:03,800 But for now, it doesn't matter what it means. 125 00:06:03,800 --> 00:06:05,216 Well, I'll tell you what it means. 126 00:06:05,216 --> 00:06:08,350 p stands for polynomial time, and np 127 00:06:08,350 --> 00:06:11,870 stands for nondeterministic polynomial time. 128 00:06:11,870 --> 00:06:15,065 I'm not going to define not deterministic polynomial time, 129 00:06:15,065 --> 00:06:19,450 but it would be momentous if those two things were equal. 130 00:06:19,450 --> 00:06:21,610 And everyone expects that they're not equal, 131 00:06:21,610 --> 00:06:24,150 but no one knows how to prove that. 132 00:06:24,150 --> 00:06:29,260 So the million dollar question is, is p equal to np, 133 00:06:29,260 --> 00:06:31,180 yes or no? 134 00:06:31,180 --> 00:06:37,030 And you get a million dollars for settling this question. 135 00:06:37,030 --> 00:06:41,210 Now, I claim that in fact the answer to this question 136 00:06:41,210 --> 00:06:43,300 is on my lecture table. 137 00:06:43,300 --> 00:06:49,060 And I will show it to you in class tomorrow.