1 00:00:00,080 --> 00:00:02,430 The following content is provided under a Creative 2 00:00:02,430 --> 00:00:03,820 Commons license. 3 00:00:03,820 --> 00:00:06,060 Your support will help MIT OpenCourseWare 4 00:00:06,060 --> 00:00:10,150 continue to offer high quality educational resources for free. 5 00:00:10,150 --> 00:00:12,700 To make a donation, or to view additional materials 6 00:00:12,700 --> 00:00:16,600 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:16,600 --> 00:00:17,310 at ocw.mit.edu. 8 00:00:25,741 --> 00:00:26,616 PROFESSOR: All right. 9 00:00:26,616 --> 00:00:28,530 Welcome back to 6890. 10 00:00:28,530 --> 00:00:32,380 Today we start a series of lectures on satisfiability. 11 00:00:32,380 --> 00:00:34,190 We saw a little bit about satisfiability 12 00:00:34,190 --> 00:00:36,220 in the first lecture. 13 00:00:36,220 --> 00:00:39,530 Now we're going to do it right, and do it more intensely, 14 00:00:39,530 --> 00:00:40,710 and see a lot of examples. 15 00:00:40,710 --> 00:00:42,900 Today we'll just see a few examples 16 00:00:42,900 --> 00:00:46,680 of using SAT to prevent NP-completeness or NP-hardness. 17 00:00:46,680 --> 00:00:51,190 But over the next lecture or two we will see many more examples. 18 00:00:51,190 --> 00:00:55,160 And SAT is really the most common problem 19 00:00:55,160 --> 00:00:57,430 that everyone uses to prove NP-hardness. 20 00:00:57,430 --> 00:01:01,090 So this is the moment you've all been waiting for, I suppose. 21 00:01:01,090 --> 00:01:03,730 This is one of the motivations for organizing 22 00:01:03,730 --> 00:01:06,300 this whole class, so we can tell you all about SAT, 23 00:01:06,300 --> 00:01:08,740 it's many variations, so you get to learn them all, 24 00:01:08,740 --> 00:01:10,430 and then see lots of different ways 25 00:01:10,430 --> 00:01:13,110 you can SAT to represent your problems. 26 00:01:13,110 --> 00:01:15,280 So without further ado, let's get started. 27 00:01:21,480 --> 00:01:27,680 Today I'm going to give you a whole bunch of problems 28 00:01:27,680 --> 00:01:32,034 and definitions, and then we will do reductions afterwards. 29 00:01:32,034 --> 00:01:33,950 So there's going to be a lot of problems here. 30 00:01:33,950 --> 00:01:36,200 You probably will have trouble remembering them all, 31 00:01:36,200 --> 00:01:37,140 there are so many. 32 00:01:37,140 --> 00:01:38,742 But in particular, the notes serve 33 00:01:38,742 --> 00:01:40,200 as a useful reference, like, here's 34 00:01:40,200 --> 00:01:42,200 all the versions you might care about-- here's 35 00:01:42,200 --> 00:01:44,940 which ones are hard, which ones are easy. 36 00:01:44,940 --> 00:01:49,150 So with that in mind, get ready for the ride. 37 00:01:49,150 --> 00:01:53,170 So the original SAT problem is you're 38 00:01:53,170 --> 00:02:06,280 given a Boolean formula, which is like over the operators 39 00:02:06,280 --> 00:02:08,705 AND, OR, and NOT. 40 00:02:08,705 --> 00:02:10,330 And in case you look at the literature, 41 00:02:10,330 --> 00:02:16,860 usually AND is the wedge, OR is the v, and NOT is the neg? 42 00:02:16,860 --> 00:02:19,650 I don't know the name of that symbol. 43 00:02:19,650 --> 00:02:31,530 And it's over n variables x1, x2, xn. 44 00:02:31,530 --> 00:02:33,280 So usually, you're not given true or false 45 00:02:33,280 --> 00:02:37,070 so that you can construct them by saying, x1 and not x1. 46 00:02:37,070 --> 00:02:37,820 That's never true. 47 00:02:37,820 --> 00:02:39,130 So that's false, for example. 48 00:02:39,130 --> 00:02:41,470 And then you could negate that and get true. 49 00:02:41,470 --> 00:02:43,890 And the question is, can you set the variables 50 00:02:43,890 --> 00:02:45,070 to make the formula true? 51 00:02:58,520 --> 00:03:01,230 So that's the general problem. 52 00:03:01,230 --> 00:03:02,930 This is the very first problem proved 53 00:03:02,930 --> 00:03:07,304 to be NP-complete by Cook and then by Levin. 54 00:03:07,304 --> 00:03:09,220 So it's usually called the Cook-Levin theorem, 55 00:03:09,220 --> 00:03:12,150 the satisfiability is NP-complete. 56 00:03:12,150 --> 00:03:14,670 And I was looking at the paper the other day. 57 00:03:14,670 --> 00:03:18,470 It doesn't actually mention the notion of NP in that paper. 58 00:03:18,470 --> 00:03:19,470 I think that came later. 59 00:03:19,470 --> 00:03:23,760 But the notion is there. 60 00:03:23,760 --> 00:03:35,070 So I'll give you another version of the same problem, 61 00:03:35,070 --> 00:03:37,700 essentially, called circuit SAT. 62 00:03:37,700 --> 00:03:40,650 This is a useful perspective which we will see probably 63 00:03:40,650 --> 00:03:41,750 not till next class. 64 00:03:41,750 --> 00:03:44,595 But another way to think about it. 65 00:03:44,595 --> 00:03:45,970 Also makes it the NP-completeness 66 00:03:45,970 --> 00:03:47,136 a little bit more intuitive. 67 00:03:54,991 --> 00:03:55,490 OK. 68 00:03:55,490 --> 00:03:58,390 This is kind of the algebraic way of thinking about things. 69 00:03:58,390 --> 00:04:00,910 You have variables and you write operators, 70 00:04:00,910 --> 00:04:03,630 and you use parentheses and that sort of thing. 71 00:04:03,630 --> 00:04:05,530 But if you're more graphically inclined, 72 00:04:05,530 --> 00:04:10,490 you could imagine you have your excise as wires, 73 00:04:10,490 --> 00:04:15,879 they're connected to gates-- this is an and gate, this is 74 00:04:15,879 --> 00:04:20,140 an or gate, this is a negation. 75 00:04:20,140 --> 00:04:26,000 So you can imagine something like this. 76 00:04:26,000 --> 00:04:31,890 So you can, generally, copy your data and do various things. 77 00:04:31,890 --> 00:04:33,897 And then this is the output. 78 00:04:33,897 --> 00:04:35,855 And so this is what you might call the formula. 79 00:04:38,870 --> 00:04:43,800 It is the AND of the negation of the OR of x3 80 00:04:43,800 --> 00:04:46,630 and the AND of x1 and x2. 81 00:04:46,630 --> 00:04:50,500 And then, pop off, it's also ANDed with this thing again. 82 00:04:50,500 --> 00:04:52,490 So the one advantage of circuit SAT 83 00:04:52,490 --> 00:04:56,640 is you can reuse complex computations, just 84 00:04:56,640 --> 00:04:58,260 by copying the signal. 85 00:04:58,260 --> 00:05:01,460 Normally, in a formula, you'd have to copy and paste 86 00:05:01,460 --> 00:05:02,590 that chunk of the formula. 87 00:05:02,590 --> 00:05:04,910 So you could imagine this lets you write formulas 88 00:05:04,910 --> 00:05:06,650 slightly more efficiently. 89 00:05:06,650 --> 00:05:09,350 I think it doesn't. 90 00:05:09,350 --> 00:05:12,370 If you reuse things, you can always write them 91 00:05:12,370 --> 00:05:14,020 as a variable over here. 92 00:05:14,020 --> 00:05:14,892 Question. 93 00:05:14,892 --> 00:05:16,646 AUDIENCE: What about feedback? 94 00:05:16,646 --> 00:05:18,020 PROFESSOR: Feedback is forbidden. 95 00:05:18,020 --> 00:05:19,990 So this should be a directed acyclic graph. 96 00:05:19,990 --> 00:05:20,510 Yeah. 97 00:05:20,510 --> 00:05:22,960 Good question. 98 00:05:22,960 --> 00:05:28,600 So it's an acyclic circuit. 99 00:05:28,600 --> 00:05:31,460 That would be another problem, which is harder than an NP. 100 00:05:31,460 --> 00:05:35,170 So circuit SAT is NP-complete when it's acyclic 101 00:05:35,170 --> 00:05:37,495 and you can convert between one and the other. 102 00:05:37,495 --> 00:05:38,995 And it's a little bit more intuitive 103 00:05:38,995 --> 00:05:43,190 that you can write arbitrary computations as a circuit. 104 00:05:43,190 --> 00:05:47,460 And then this is a question of whether you can-- 105 00:05:47,460 --> 00:05:49,700 the existence of some setting of the AIs 106 00:05:49,700 --> 00:05:52,710 is the same thing as saying, is there 107 00:05:52,710 --> 00:05:57,440 some set of guesses that will lead me to a yes answer? 108 00:05:57,440 --> 00:05:59,670 So that is intuitively like NP and that's 109 00:05:59,670 --> 00:06:02,680 roughly how you prove these problems are NP-complete. 110 00:06:02,680 --> 00:06:06,210 You write the computation-- the checking computation-- 111 00:06:06,210 --> 00:06:10,330 to see whether your certificate is a valid certificate 112 00:06:10,330 --> 00:06:12,650 as a circuit or as a formula. 113 00:06:12,650 --> 00:06:17,770 And then the existential quantifiers on the xi's let you 114 00:06:17,770 --> 00:06:21,490 do all the guessing to see whether they're-- and this is 115 00:06:21,490 --> 00:06:22,180 biased, right? 116 00:06:22,180 --> 00:06:23,640 It's trying to find a true. 117 00:06:23,640 --> 00:06:25,020 And that's exactly what NP does. 118 00:06:25,020 --> 00:06:29,760 It's trying to find a true path that ends up answering yes. 119 00:06:29,760 --> 00:06:32,110 So yes and true are symmetric here. 120 00:06:32,110 --> 00:06:36,430 So that's the extent of the complexity theory 121 00:06:36,430 --> 00:06:38,210 we'll do today. 122 00:06:38,210 --> 00:06:40,690 I'm going to give you more versions of SAT. 123 00:06:40,690 --> 00:06:43,780 Next one is CNF SAT. 124 00:06:43,780 --> 00:06:46,870 CNF stands for conjunctive normal form. 125 00:06:52,820 --> 00:06:54,770 I hope you all know prepositional logic. 126 00:06:54,770 --> 00:06:56,990 Because we're going to be doing a bunch today. 127 00:06:56,990 --> 00:07:00,210 So ANDs are also called conjunctions, 128 00:07:00,210 --> 00:07:02,000 ORs are called disjunctions. 129 00:07:02,000 --> 00:07:04,240 This is old terminology. 130 00:07:04,240 --> 00:07:12,400 So conjunctive normal form means that your formula 131 00:07:12,400 --> 00:07:13,960 is an AND of clauses. 132 00:07:19,430 --> 00:07:20,470 What's a clause? 133 00:07:20,470 --> 00:07:25,960 Well a clause is going to be an OR of literals. 134 00:07:29,012 --> 00:07:29,720 What's a literal? 135 00:07:33,920 --> 00:07:39,450 A literal is going to be xi or not xi. 136 00:07:42,000 --> 00:07:43,050 So these are variables. 137 00:07:43,050 --> 00:07:44,800 So variables are possible literals 138 00:07:44,800 --> 00:07:47,810 and the negations of variables and literals, and that's it. 139 00:07:47,810 --> 00:07:50,030 And that is CNF SAT. 140 00:07:50,030 --> 00:07:53,350 So it's a special case of SAT where your formula happens 141 00:07:53,350 --> 00:07:56,740 to have this picture. 142 00:07:56,740 --> 00:08:00,390 And in general, you can convert arbitrary formulas 143 00:08:00,390 --> 00:08:02,130 into conjunctive normal form. 144 00:08:02,130 --> 00:08:05,710 It's a normal form, meaning it's essentially unique. 145 00:08:05,710 --> 00:08:08,540 A minimal CNF formula is unique. 146 00:08:08,540 --> 00:08:10,240 So there's a known transformation 147 00:08:10,240 --> 00:08:11,684 to do that, polynomial time. 148 00:08:11,684 --> 00:08:13,100 That's how you prove this is hard. 149 00:08:15,970 --> 00:08:18,100 Another view in this picture. 150 00:08:18,100 --> 00:08:23,190 We'll use CNF SAT a lot, usually in even more specialized form. 151 00:08:23,190 --> 00:08:25,700 But already, one useful view-- which 152 00:08:25,700 --> 00:08:31,690 we saw a little bit in lecture one, we'll see it again today-- 153 00:08:31,690 --> 00:08:36,320 is you can view such an input as a bipartite graph. 154 00:08:36,320 --> 00:08:45,420 You have, let's say, variables on the one side 155 00:08:45,420 --> 00:08:49,540 and clauses on the other side. 156 00:08:49,540 --> 00:08:51,570 And then you have two types of connections, 157 00:08:51,570 --> 00:08:56,300 a clause-- in general, a clause is going to have degree three. 158 00:08:56,300 --> 00:09:00,650 And let's say the dashed edges are negated 159 00:09:00,650 --> 00:09:03,420 and the solid edges are not negated. 160 00:09:03,420 --> 00:09:07,385 So this is a clause that involves x1 or x2 or not x3. 161 00:09:12,580 --> 00:09:14,200 And in general, each of these clauses 162 00:09:14,200 --> 00:09:19,630 is going to involve some number of variables over here. 163 00:09:19,630 --> 00:09:22,230 I said three, but I haven't actually gotten to three yet. 164 00:09:22,230 --> 00:09:24,610 That is 3SAT. 165 00:09:24,610 --> 00:09:27,140 So the most common form of CNF SAT we use 166 00:09:27,140 --> 00:09:36,230 is called 3SAT, where it's CNF SAT in the special case where 167 00:09:36,230 --> 00:09:41,190 the clause is an or three literals. 168 00:09:41,190 --> 00:09:45,101 And you can assume it's exactly three or at most three. 169 00:09:45,101 --> 00:09:47,350 So that's like saying the degree of each of the clause 170 00:09:47,350 --> 00:09:49,060 notes here is exactly three. 171 00:09:51,610 --> 00:09:53,370 And that's the problem with it we 172 00:09:53,370 --> 00:09:56,310 used for proving Super Mario Brothers was 173 00:09:56,310 --> 00:09:58,870 hard in the first lecture. 174 00:09:58,870 --> 00:10:01,280 So in my notes I have things nicely indented. 175 00:10:01,280 --> 00:10:05,190 So we had CNF SAT, which is a special case of SAT, 176 00:10:05,190 --> 00:10:07,600 and then 3SAT, which is a special case of CNF SAT. 177 00:10:07,600 --> 00:10:12,352 A special case of 3SAT that's also hard is called 3SAT-5. 178 00:10:12,352 --> 00:10:14,060 I don't know that this is super standard, 179 00:10:14,060 --> 00:10:17,310 but I found at least one paper that gives it this name. 180 00:10:17,310 --> 00:10:26,610 This says that each variable occurs in less than 181 00:10:26,610 --> 00:10:32,250 or equal to five clauses, either in it's positive or negated 182 00:10:32,250 --> 00:10:33,280 form. 183 00:10:33,280 --> 00:10:38,390 So this is sometimes called max five occurrence 3-SAT. 184 00:10:38,390 --> 00:10:41,500 And I think you can even make them exactly five occurrances 185 00:10:41,500 --> 00:10:42,710 if you want. 186 00:10:42,710 --> 00:10:45,071 But, at most, five occurrances is usually what you want. 187 00:10:45,071 --> 00:10:45,570 Question. 188 00:10:45,570 --> 00:10:48,724 AUDIENCE: Is that tight as 3SAT-4 NP? 189 00:10:48,724 --> 00:10:50,140 PROFESSOR: That's a good question. 190 00:10:50,140 --> 00:10:51,840 3SAT-4? 191 00:10:51,840 --> 00:10:53,150 I don't know. 192 00:10:53,150 --> 00:10:56,874 I would guess it's tight. 193 00:10:56,874 --> 00:10:59,040 Because there are a lot of people that mention five, 194 00:10:59,040 --> 00:11:01,731 but I haven't seen a mention that four is polynomial. 195 00:11:01,731 --> 00:11:02,230 All right? 196 00:11:02,230 --> 00:11:04,620 So we should figure that out. 197 00:11:04,620 --> 00:11:05,330 Other questions? 198 00:11:05,330 --> 00:11:07,571 Or it's probably the same one. 199 00:11:07,571 --> 00:11:08,070 All right. 200 00:11:08,070 --> 00:11:10,450 Here's another special case of 3SAT. 201 00:11:14,540 --> 00:11:15,410 Monotone 3SAT. 202 00:11:18,170 --> 00:11:32,075 This is where each clause is all positive or all negative. 203 00:11:37,840 --> 00:11:40,110 So of course, if every clause is all positive, 204 00:11:40,110 --> 00:11:44,460 then you could set all the variables to true 205 00:11:44,460 --> 00:11:45,720 and you'll satisfy. 206 00:11:45,720 --> 00:11:48,136 If all the classes are negative, you set all the variables 207 00:11:48,136 --> 00:11:49,520 to false and you satisfy. 208 00:11:49,520 --> 00:11:51,974 But if half the clauses are all positive, 209 00:11:51,974 --> 00:11:54,140 half the clauses are all negative, then that's hard. 210 00:11:54,140 --> 00:11:56,700 That's called monotone 3SAT. 211 00:11:56,700 --> 00:11:58,940 I've actually not seen this used, 212 00:11:58,940 --> 00:12:01,565 but I imagine it is helpful in a few situations. 213 00:12:04,170 --> 00:12:05,680 This is definitely the most common. 214 00:12:05,680 --> 00:12:07,659 Almost every proof starts with 3SAT. 215 00:12:07,659 --> 00:12:09,700 But it's really good to know all the extra things 216 00:12:09,700 --> 00:12:12,200 you can assume about your 3SAT problem and it still be hard. 217 00:12:14,950 --> 00:12:17,320 I have more hard versions, but before we get there 218 00:12:17,320 --> 00:12:19,989 I'm going to tell you about some easy versions. 219 00:12:19,989 --> 00:12:20,530 And question. 220 00:12:20,530 --> 00:12:24,080 AUDIENCE: Is monotone 3SAT-5? 221 00:12:24,080 --> 00:12:25,470 PROFESSOR: Another good question. 222 00:12:25,470 --> 00:12:28,480 Monotone 3SAT-5, is that NP complete? 223 00:12:28,480 --> 00:12:30,140 I don't know. 224 00:12:30,140 --> 00:12:32,010 Partly these were done at different times. 225 00:12:34,850 --> 00:12:37,280 Monotone 3SAT is mentioned in Garey and Johnson 226 00:12:37,280 --> 00:12:41,250 as done in 1978, presumably for a particular hardness proof. 227 00:12:41,250 --> 00:12:45,610 3SAT-5 is probably a very old idea. 228 00:12:45,610 --> 00:12:47,880 Probably this idea of reducing occurances 229 00:12:47,880 --> 00:12:49,010 goes to some logic thing. 230 00:12:49,010 --> 00:12:52,070 But the earliest reference I found was 1998, 231 00:12:52,070 --> 00:12:54,690 and most people had forgotten about monotone 3SAT by then. 232 00:12:54,690 --> 00:12:57,156 So it probably just hasn't been considered, 233 00:12:57,156 --> 00:12:58,030 but it might be easy. 234 00:12:58,030 --> 00:12:58,530 Yeah. 235 00:13:01,649 --> 00:13:03,940 AUDIENCE: The construction to limit to five variables-- 236 00:13:03,940 --> 00:13:08,327 should I believe work with the monotone construction as well? 237 00:13:08,327 --> 00:13:08,910 PROFESSOR: OK. 238 00:13:08,910 --> 00:13:09,770 Conjecture. 239 00:13:09,770 --> 00:13:10,650 Yes, it's hard. 240 00:13:13,390 --> 00:13:13,890 OK. 241 00:13:19,270 --> 00:13:23,570 But stay tuned for a certain answer. 242 00:13:23,570 --> 00:13:25,250 So let me tell you some polynomial time 243 00:13:25,250 --> 00:13:28,350 versions of SAT. 244 00:13:28,350 --> 00:13:31,950 The three is tight if you have a clause 245 00:13:31,950 --> 00:13:36,050 being an or of two literals, but otherwise they're 246 00:13:36,050 --> 00:13:38,250 just like 3SAT-- or just like CNF SAT, 247 00:13:38,250 --> 00:13:43,950 I guess-- then this is polynomial time. 248 00:13:43,950 --> 00:13:48,800 And let me give you a rough sketch why. 249 00:13:48,800 --> 00:13:52,670 So if you have an or of two literals, 250 00:13:52,670 --> 00:13:55,540 that's something like x or y. 251 00:13:55,540 --> 00:13:58,410 And the little bit of propositional logic 252 00:13:58,410 --> 00:14:04,480 you should know is the meaning of, let's say, a implies b. 253 00:14:04,480 --> 00:14:07,600 Saying this should hold-- and a and b 254 00:14:07,600 --> 00:14:14,257 are either true or false-- is the same as saying not a or b. 255 00:14:14,257 --> 00:14:16,840 Because if a is false, then the implication tells you nothing. 256 00:14:16,840 --> 00:14:20,600 If a is true, then it better be the case that b is true. 257 00:14:20,600 --> 00:14:22,114 So either a is false, in which case 258 00:14:22,114 --> 00:14:24,030 you don't worry about something, or a is true, 259 00:14:24,030 --> 00:14:25,910 and then b better be true, as well. 260 00:14:25,910 --> 00:14:28,180 So these are the same-- maybe write triple 261 00:14:28,180 --> 00:14:31,510 equals, for these are equivalent logical statements. 262 00:14:31,510 --> 00:14:33,720 So we can apply that here and say 263 00:14:33,720 --> 00:14:38,740 x or y is the same thing as not x implies y, 264 00:14:38,740 --> 00:14:40,086 or not y implies x. 265 00:14:40,086 --> 00:14:40,710 It's symmetric. 266 00:14:40,710 --> 00:14:43,400 But this is now just a simple implication. 267 00:14:43,400 --> 00:14:47,020 If we ever set x to be false, then y must be true. 268 00:14:47,020 --> 00:14:49,170 And every clause can be converted 269 00:14:49,170 --> 00:14:50,260 into such an implication. 270 00:14:50,260 --> 00:14:53,470 You can build a graph of all such implications. 271 00:14:53,470 --> 00:14:56,620 And then, turns out, to solve 2SAT, you can just 272 00:14:56,620 --> 00:14:59,434 pick your favorite variable, xi, set it to true, 273 00:14:59,434 --> 00:15:01,100 follow all implications, see whether you 274 00:15:01,100 --> 00:15:02,310 get a contradiction. 275 00:15:02,310 --> 00:15:04,400 If you don't, then the claim is there 276 00:15:04,400 --> 00:15:06,490 is a satisfying assignment where xi equals true. 277 00:15:06,490 --> 00:15:09,600 So you can try that with xi true, xi false. 278 00:15:09,600 --> 00:15:11,340 If there's any hope, then one of them 279 00:15:11,340 --> 00:15:13,510 should say no contradiction. 280 00:15:13,510 --> 00:15:14,570 Then just run with that. 281 00:15:14,570 --> 00:15:17,380 And you can prove by induction that won't get stuck. 282 00:15:17,380 --> 00:15:21,610 It won't make any impossible assignments, 283 00:15:21,610 --> 00:15:24,440 unless there was no assignment to begin with. 284 00:15:24,440 --> 00:15:28,450 So that's why 2SAT is easy and one of the situations 285 00:15:28,450 --> 00:15:30,510 you should be careful about. 286 00:15:30,510 --> 00:15:37,930 On the other hand, MAX 2SAT is hard. 287 00:15:37,930 --> 00:15:40,070 So MAX 2SAT is you're given a 2SAT 288 00:15:40,070 --> 00:15:42,620 formula-- you're given a 2CNF formula-- 289 00:15:42,620 --> 00:15:46,480 and normally, we ask for an assignment to the variables 290 00:15:46,480 --> 00:15:49,010 that satisfies all the clauses, but if you just 291 00:15:49,010 --> 00:15:59,060 want to satisfy k of them-- so satisfy k of the clauses. 292 00:15:59,060 --> 00:16:00,650 So usually you want to maximize k, 293 00:16:00,650 --> 00:16:03,210 but let's say, for a decision problem, I'll give you k 294 00:16:03,210 --> 00:16:05,630 and I want to know, can you satisfy k of the clauses? 295 00:16:05,630 --> 00:16:07,290 That problem is NP hard. 296 00:16:11,660 --> 00:16:12,950 So that can be useful. 297 00:16:12,950 --> 00:16:14,630 If you can only represent 2SAT clauses, 298 00:16:14,630 --> 00:16:16,820 but you can somehow get a maximization thing in, 299 00:16:16,820 --> 00:16:19,260 then you're golden again. 300 00:16:19,260 --> 00:16:21,440 But 2SAT alone is not enough. 301 00:16:21,440 --> 00:16:27,310 There are some other easy-to-solve versions. 302 00:16:27,310 --> 00:16:29,990 This is essentially a generalization of 2SAT 303 00:16:29,990 --> 00:16:30,890 is Horn SAT. 304 00:16:34,455 --> 00:16:36,080 It's maybe a little bit more surprising 305 00:16:36,080 --> 00:16:39,450 the first time you see it. 306 00:16:39,450 --> 00:16:42,399 Again, it's a special case of CNF SAT, which 307 00:16:42,399 --> 00:16:43,690 you can tell by my indentation. 308 00:16:50,520 --> 00:16:53,180 Each clause has at most one negative literal. 309 00:16:56,840 --> 00:16:59,270 So that means a clause is going to look something 310 00:16:59,270 --> 00:17:02,850 like-- has one negative? 311 00:17:02,850 --> 00:17:04,001 Sorry. 312 00:17:04,001 --> 00:17:04,500 Sorry. 313 00:17:04,500 --> 00:17:06,000 Horn is the other way around. 314 00:17:06,000 --> 00:17:08,130 We will get-- that problem is also solvable. 315 00:17:08,130 --> 00:17:11,040 But the one that's called Horn SAT is-- there's 316 00:17:11,040 --> 00:17:12,800 at most one positive literal. 317 00:17:12,800 --> 00:17:14,430 So that means you're form is going 318 00:17:14,430 --> 00:17:21,599 to look something like not x or not y are not z or w. 319 00:17:21,599 --> 00:17:23,180 So there's one positive. 320 00:17:23,180 --> 00:17:25,910 The rest are all negated. 321 00:17:25,910 --> 00:17:29,540 And we can do some more prepositional logic. 322 00:17:29,540 --> 00:17:31,650 So use De Morgan's theorem. 323 00:17:31,650 --> 00:17:35,615 This is the same thing as the negation of the AND. 324 00:17:39,400 --> 00:17:39,900 OK? 325 00:17:39,900 --> 00:17:43,880 And then we can apply this helpful rule. 326 00:17:43,880 --> 00:17:49,490 And say this is the same thing as if x and y and z are true, 327 00:17:49,490 --> 00:17:53,000 then w better be true. 328 00:17:53,000 --> 00:17:57,680 And so you can use essentially the same algorithm that 329 00:17:57,680 --> 00:18:00,150 you're-- I mean, slightly harder to check. 330 00:18:00,150 --> 00:18:02,360 If all three of these things are true, 331 00:18:02,360 --> 00:18:04,460 then this one better be true. 332 00:18:04,460 --> 00:18:06,190 But it's always a guarantee. 333 00:18:06,190 --> 00:18:09,290 You know this thing must happen. 334 00:18:09,290 --> 00:18:12,850 Just like in 2-SAT, if x happened to be set to false, 335 00:18:12,850 --> 00:18:14,059 then you know y must be true. 336 00:18:14,059 --> 00:18:16,058 So you can just follow these implication chains. 337 00:18:16,058 --> 00:18:18,455 If you get a contradiction, you know you're in trouble. 338 00:18:18,455 --> 00:18:19,830 If you don't get a contradiction, 339 00:18:19,830 --> 00:18:21,440 again, you can prove by induction 340 00:18:21,440 --> 00:18:23,630 that all will be well. 341 00:18:23,630 --> 00:18:25,216 And so you just make sure every time 342 00:18:25,216 --> 00:18:27,340 you assign a variable you don't get a contradiction 343 00:18:27,340 --> 00:18:32,130 and you can satisfy any Horn formula. 344 00:18:32,130 --> 00:18:32,780 So that's cool. 345 00:18:44,834 --> 00:18:46,250 So I didn't write it on the board, 346 00:18:46,250 --> 00:18:50,060 but this is polynomially solvable. 347 00:18:50,060 --> 00:18:55,800 There's a symmetric version, which is called Dual Horn SAT. 348 00:18:59,120 --> 00:19:03,770 So this is the same thing, but at most one negative literal 349 00:19:03,770 --> 00:19:06,190 in each clause. 350 00:19:06,190 --> 00:19:09,200 And this is also solvable in polynomial time 351 00:19:09,200 --> 00:19:13,250 because you can just negate all the variables in your formula. 352 00:19:13,250 --> 00:19:14,750 And then when you get an answer, you 353 00:19:14,750 --> 00:19:16,510 can negate all the variables again 354 00:19:16,510 --> 00:19:19,010 to get the solution to the original problem. 355 00:19:19,010 --> 00:19:21,310 So because you can solve Horn SAT, 356 00:19:21,310 --> 00:19:22,948 you can solve Dual Horn SAT. 357 00:19:28,930 --> 00:19:30,380 Cool. 358 00:19:30,380 --> 00:19:37,590 One more bad case I'll mention now is DNF SAT. 359 00:19:37,590 --> 00:19:41,840 You might say, well, why do we make things ANDs of ORs? 360 00:19:41,840 --> 00:19:43,690 What about ORs of ANDs? 361 00:19:43,690 --> 00:19:46,502 So DNF is disjunctive normal form, 362 00:19:46,502 --> 00:19:48,335 meaning the disjunctions are on the outside. 363 00:19:55,240 --> 00:20:05,012 So the formula is an AND of OR-- sorry. 364 00:20:05,012 --> 00:20:06,220 AUDIENCE: It's an OR of ANDs. 365 00:20:06,220 --> 00:20:07,095 PROFESSOR: Other way. 366 00:20:11,290 --> 00:20:16,660 OR of ANDs of literals. 367 00:20:16,660 --> 00:20:18,540 We use some shorthand, not-defined clauses 368 00:20:18,540 --> 00:20:20,456 here because we don't really use this problem. 369 00:20:20,456 --> 00:20:24,570 Because it's polynomial time. 370 00:20:24,570 --> 00:20:26,964 Why is it polynomial time? 371 00:20:26,964 --> 00:20:29,180 AUDIENCE: You can just evaluate one of the ANDs. 372 00:20:29,180 --> 00:20:30,560 PROFESSOR: Just evaluate one of the ANDs. 373 00:20:30,560 --> 00:20:30,810 If you-- 374 00:20:30,810 --> 00:20:31,710 AUDIENCE: If it's true. 375 00:20:31,710 --> 00:20:32,418 PROFESSOR: Right. 376 00:20:32,418 --> 00:20:35,020 It's true if any one of these is possible. 377 00:20:35,020 --> 00:20:37,950 So you can just check for obvious contradictions, like xi 378 00:20:37,950 --> 00:20:39,510 and not xi. 379 00:20:39,510 --> 00:20:41,820 If that happens, then that cause is impossible. 380 00:20:41,820 --> 00:20:42,770 Throw it away. 381 00:20:42,770 --> 00:20:44,770 If any clause has no internal contradictions, 382 00:20:44,770 --> 00:20:46,424 then just satisfy the clause. 383 00:20:46,424 --> 00:20:48,160 OK? 384 00:20:48,160 --> 00:20:52,120 It's basically-- the answer is yes whenever there is a clause. 385 00:20:52,120 --> 00:20:54,980 It could be of the empty formula, no clauses. 386 00:20:54,980 --> 00:20:58,950 So writing-- you can also write any formula into DNF. 387 00:20:58,950 --> 00:21:02,670 It's like an enumeration of all the true possibilities. 388 00:21:02,670 --> 00:21:05,480 But it takes exponential time to do so. 389 00:21:05,480 --> 00:21:08,400 So it's a funny asymmetry between AND and OR. 390 00:21:08,400 --> 00:21:11,221 That's life. 391 00:21:11,221 --> 00:21:11,720 Yeah. 392 00:21:11,720 --> 00:21:14,369 AUDIENCE: I just want to say, for Horn SAT, 393 00:21:14,369 --> 00:21:16,410 even if you don't have Horn SAT or Dual Horn SAT, 394 00:21:16,410 --> 00:21:18,993 you might have a formula where some renaming-- not necessarily 395 00:21:18,993 --> 00:21:21,410 all of the literals-- but renaming just some 396 00:21:21,410 --> 00:21:23,210 of the literals will put it in Horn SAT. 397 00:21:23,210 --> 00:21:24,190 And that's also in-- 398 00:21:24,190 --> 00:21:24,773 PROFESSOR: Oh. 399 00:21:24,773 --> 00:21:26,270 Just negating some of them. 400 00:21:26,270 --> 00:21:27,370 AUDIENCE: Yeah. 401 00:21:27,370 --> 00:21:29,260 Like, each time a variable occurs, 402 00:21:29,260 --> 00:21:31,690 you have to negate all the instances of that variable. 403 00:21:31,690 --> 00:21:34,190 But these are called renamable Horn formulas. 404 00:21:34,190 --> 00:21:37,537 And it's also-- finding the renaming is linear time. 405 00:21:37,537 --> 00:21:38,120 PROFESSOR: OK. 406 00:21:38,120 --> 00:21:41,195 So some kind of renamable Horn. 407 00:21:45,500 --> 00:21:47,666 And by renaming, you just mean negating, right? 408 00:21:47,666 --> 00:21:48,290 AUDIENCE: Yeah. 409 00:21:48,290 --> 00:21:51,460 The term used in the literature is renamable Horn. 410 00:21:51,460 --> 00:21:57,640 PROFESSOR: There exists a negation of, let's say, 411 00:21:57,640 --> 00:22:08,390 some subset of the variable's x such that Horn. 412 00:22:08,390 --> 00:22:08,890 OK? 413 00:22:08,890 --> 00:22:10,200 That's the very concise version. 414 00:22:10,200 --> 00:22:12,866 So you get to choose some of the variables to negate and make it 415 00:22:12,866 --> 00:22:15,795 a Horn clause that's also polynomial time. 416 00:22:15,795 --> 00:22:16,980 Cool. 417 00:22:16,980 --> 00:22:17,683 Thank you. 418 00:22:21,310 --> 00:22:23,660 You might be wondering at this point, how much-- I mean, 419 00:22:23,660 --> 00:22:25,627 do I have to remember all of these? 420 00:22:25,627 --> 00:22:26,960 And sometimes the answer is yes. 421 00:22:26,960 --> 00:22:30,244 But there is actually a dichotomy theorem 422 00:22:30,244 --> 00:22:31,910 that will tell you which versions of SAT 423 00:22:31,910 --> 00:22:34,860 are polynomial time and which versions are NP hard, 424 00:22:34,860 --> 00:22:37,930 and we'll cover that in one more page. 425 00:22:37,930 --> 00:22:41,860 But I'm-- well, all of these are involved in the statement 426 00:22:41,860 --> 00:22:43,780 of that dichotomy. 427 00:22:43,780 --> 00:22:46,370 Not quite all, but most of them. 428 00:22:46,370 --> 00:22:47,940 So it's not exactly a shortcut. 429 00:23:02,990 --> 00:23:05,330 I would say a lot of the time, the problem 430 00:23:05,330 --> 00:23:07,760 you're working with does not naturally 431 00:23:07,760 --> 00:23:09,160 map onto ANDs and ORs. 432 00:23:09,160 --> 00:23:12,470 It sort of involves bits of some sort-- there's a 0 and a 1 433 00:23:12,470 --> 00:23:16,880 notion-- but they may not really correspond to logical notions 434 00:23:16,880 --> 00:23:18,580 of true or false. 435 00:23:18,580 --> 00:23:20,950 And the operations you can do on them 436 00:23:20,950 --> 00:23:24,730 may not correspond to AND or OR, or anything nice like that. 437 00:23:24,730 --> 00:23:29,820 So the next two versions of SAT are in that spirit. 438 00:23:34,760 --> 00:23:37,817 So this is usually, these days, called 1-in3 SAT, 439 00:23:37,817 --> 00:23:39,650 but originally it was called exactly-1 3SAT. 440 00:23:48,860 --> 00:23:52,010 So this is going to be a little bit weirder to write down, 441 00:23:52,010 --> 00:23:56,950 but like CNF SAT, the formula is the end of a bunch of clauses. 442 00:23:56,950 --> 00:23:58,490 So that part's the same. 443 00:23:58,490 --> 00:24:01,940 But now we're going to make a clause 444 00:24:01,940 --> 00:24:05,790 to be a relation on three variables, which 445 00:24:05,790 --> 00:24:19,950 is that exactly one of, let's say, xi, xj, and xk is true. 446 00:24:19,950 --> 00:24:24,780 So this means it could be true-false-false, xi is true, 447 00:24:24,780 --> 00:24:27,310 but the other two are false, it could be xj is true, 448 00:24:27,310 --> 00:24:31,320 the other two are false, or it could be that xk is true 449 00:24:31,320 --> 00:24:33,000 and the other two are false. 450 00:24:33,000 --> 00:24:35,740 But those are the only happy assignments. 451 00:24:35,740 --> 00:24:36,240 Question. 452 00:24:36,240 --> 00:24:38,797 AUDIENCE: Is it exactly one of three variables or three 453 00:24:38,797 --> 00:24:40,430 literals? 454 00:24:40,430 --> 00:24:43,060 PROFESSOR: Good question. 455 00:24:43,060 --> 00:24:45,809 The original statement is its variables, 456 00:24:45,809 --> 00:24:46,850 so that's how I wrote it. 457 00:24:46,850 --> 00:24:49,500 This is usually called monotone. 458 00:24:49,500 --> 00:24:53,440 These days it's usually called monotone 1-in-3SAT. 459 00:24:53,440 --> 00:24:55,600 I don't know how usually exactly. 460 00:24:55,600 --> 00:24:58,600 Sometimes it's called all positive 1-in-3SAT. 461 00:25:01,530 --> 00:25:10,210 So let's say literals equal variables. 462 00:25:10,210 --> 00:25:12,820 You could, of course, if you want, consider 463 00:25:12,820 --> 00:25:15,170 a more general version where you can have negations. 464 00:25:15,170 --> 00:25:19,274 But you don't need to, so why bother. 465 00:25:19,274 --> 00:25:21,190 That fact is usually forgotten in most proofs. 466 00:25:21,190 --> 00:25:23,390 So you'll see in the literature a reduction 467 00:25:23,390 --> 00:25:25,220 from 1-in-3SAT with negations, and they 468 00:25:25,220 --> 00:25:26,178 have a negation gadget. 469 00:25:26,178 --> 00:25:29,210 It's like, you don't need to have a negation gadget. 470 00:25:29,210 --> 00:25:33,220 So why not skip it? 471 00:25:33,220 --> 00:25:34,010 But there you go. 472 00:25:34,010 --> 00:25:36,610 Now I'll just mention I'm not a fan of the word 473 00:25:36,610 --> 00:25:40,060 monotone here because here we have monotone to mean 474 00:25:40,060 --> 00:25:41,300 all positive or all negative. 475 00:25:41,300 --> 00:25:42,825 Here we mean all positive. 476 00:25:45,450 --> 00:25:47,750 Not ideal reuse of terminology. 477 00:25:47,750 --> 00:25:50,250 I think that's why sometimes this is all positive 1-in-3SAT. 478 00:25:50,250 --> 00:25:51,684 Anyway, it's a bit of a mess. 479 00:25:51,684 --> 00:25:53,350 But that is the state of the literature. 480 00:25:53,350 --> 00:25:57,310 So you get it all. 481 00:25:57,310 --> 00:25:58,730 All right. 482 00:25:58,730 --> 00:25:59,835 Here's another problem. 483 00:26:04,420 --> 00:26:07,000 Monotone not-exactly-1 3SAT. 484 00:26:11,590 --> 00:26:14,140 I should not have any suspense here. 485 00:26:14,140 --> 00:26:16,410 This is NP. 486 00:26:16,410 --> 00:26:17,940 OK? 487 00:26:17,940 --> 00:26:19,210 This is NP-complete. 488 00:26:19,210 --> 00:26:21,290 This is also NP-complete. 489 00:26:21,290 --> 00:26:24,560 But not-exactly-1 3SAT is polynomial. 490 00:26:24,560 --> 00:26:28,360 So I think you know what it means. 491 00:26:28,360 --> 00:26:33,040 A clause specifies that-- again, we take an and of clauses. 492 00:26:33,040 --> 00:26:40,490 And we want zero, two, or three of three variables are true. 493 00:26:40,490 --> 00:26:44,200 In other words, exactly one of them is false. 494 00:26:44,200 --> 00:26:45,310 No. 495 00:26:45,310 --> 00:26:47,050 I don't mean that. 496 00:26:47,050 --> 00:26:50,880 Exactly one of them being false would be 1-in-3SAT again, 497 00:26:50,880 --> 00:26:53,620 just by negating everything, which we're 498 00:26:53,620 --> 00:26:56,210 allowed to do if we want to. 499 00:26:56,210 --> 00:26:58,000 But this is different. 500 00:26:58,000 --> 00:27:01,000 This is saying, it could be everything's false, 501 00:27:01,000 --> 00:27:03,074 or it could be one thing is false, 502 00:27:03,074 --> 00:27:04,615 or it could be zero things are false. 503 00:27:07,560 --> 00:27:09,820 But not two things are false. 504 00:27:09,820 --> 00:27:10,320 OK? 505 00:27:10,320 --> 00:27:13,240 This turns out to be polynomial. 506 00:27:13,240 --> 00:27:17,790 And do I have-- oh. 507 00:27:17,790 --> 00:27:21,510 There's one funny thing here, which 508 00:27:21,510 --> 00:27:24,210 is if all your clauses look like this, 509 00:27:24,210 --> 00:27:26,570 you can set all your variables to false. 510 00:27:26,570 --> 00:27:28,970 So this is sort of a trivial problem. 511 00:27:28,970 --> 00:27:30,700 But to make it more interesting, you 512 00:27:30,700 --> 00:27:35,580 can say x1 equals true, just to get you started. 513 00:27:35,580 --> 00:27:37,860 So there's no trivial solution then 514 00:27:37,860 --> 00:27:40,600 and it still turns out this is easy. 515 00:27:40,600 --> 00:27:42,810 Because if you think about this long enough, 516 00:27:42,810 --> 00:27:46,220 as I did yesterday, this will look something 517 00:27:46,220 --> 00:27:57,630 like-- if you have three variables, 518 00:27:57,630 --> 00:28:01,780 either they're all false-- then fine-- or if one of them 519 00:28:01,780 --> 00:28:03,739 is true, then you better have another one true. 520 00:28:03,739 --> 00:28:06,029 That's a way of saying if there's at least one of them, 521 00:28:06,029 --> 00:28:07,410 there better be at least two. 522 00:28:07,410 --> 00:28:08,280 That's what we want. 523 00:28:08,280 --> 00:28:11,120 This has to be true for all shifts of i, j, k. 524 00:28:11,120 --> 00:28:13,370 So for each of i, j, k, if one of them is true, 525 00:28:13,370 --> 00:28:16,050 you want to imply the OR of the other. 526 00:28:16,050 --> 00:28:22,910 And this is the same as NOT xi or xj or xk. 527 00:28:22,910 --> 00:28:25,410 Don't need the parentheses because it's 528 00:28:25,410 --> 00:28:27,270 associative communicative. 529 00:28:27,270 --> 00:28:32,530 And that is a dual horn clause. 530 00:28:32,530 --> 00:28:34,840 And that's why this is polynomial. 531 00:28:34,840 --> 00:28:35,340 Question. 532 00:28:35,340 --> 00:28:37,506 AUDIENCE: I think I'm confused about the definition. 533 00:28:37,506 --> 00:28:40,240 Why can't they just all be true then? 534 00:28:40,240 --> 00:28:42,130 PROFESSOR: Good question. 535 00:28:42,130 --> 00:28:44,940 Let's say x2 is false. 536 00:28:44,940 --> 00:28:46,400 I should double check. 537 00:28:46,400 --> 00:28:49,710 I don't remember that in the statement of the problem. 538 00:28:49,710 --> 00:28:51,250 We do not allow negations here. 539 00:28:51,250 --> 00:28:53,470 Once you allow negations, this trick won't work. 540 00:28:53,470 --> 00:28:56,097 But if these appear all in positive form, 541 00:28:56,097 --> 00:28:57,930 then we can convert into the single negative 542 00:28:57,930 --> 00:28:58,840 and get dual horn. 543 00:28:58,840 --> 00:28:59,340 Question. 544 00:28:59,340 --> 00:29:01,940 AUDIENCE: Are you allowed to mix the zero, two, and threes? 545 00:29:01,940 --> 00:29:05,180 Or does it have to be all the clauses have to be-- 546 00:29:05,180 --> 00:29:07,300 PROFESSOR: All causes look like-- all clauses 547 00:29:07,300 --> 00:29:10,120 say, zero, two, or three of these three variables 548 00:29:10,120 --> 00:29:11,897 must be true. 549 00:29:11,897 --> 00:29:14,230 You can't have a clause that says zero of these are true 550 00:29:14,230 --> 00:29:14,990 and two of these are true. 551 00:29:14,990 --> 00:29:15,210 AUDIENCE: No. 552 00:29:15,210 --> 00:29:17,293 But if you have two of these clauses that give you 553 00:29:17,293 --> 00:29:19,280 all those choices, can you choose 554 00:29:19,280 --> 00:29:22,290 one to be zero and then have another one be two, 555 00:29:22,290 --> 00:29:22,820 or whatever. 556 00:29:22,820 --> 00:29:24,550 PROFESSOR: For each clause, it's an independent choice 557 00:29:24,550 --> 00:29:27,320 whether you have zero, two, or three of the variables true. 558 00:29:27,320 --> 00:29:28,270 Yeah. 559 00:29:28,270 --> 00:29:32,220 So this OR is local to the clause. 560 00:29:32,220 --> 00:29:34,360 Other questions? 561 00:29:34,360 --> 00:29:36,830 So it's still an AND of things that-- it's just 562 00:29:36,830 --> 00:29:38,050 we have a weirder relation. 563 00:29:38,050 --> 00:29:40,425 Instead of just taking the OR of a bunch of things, which 564 00:29:40,425 --> 00:29:42,410 would be saying at least one of them is true, 565 00:29:42,410 --> 00:29:47,720 now we allow zero or two or three of them to be true. 566 00:29:47,720 --> 00:29:50,050 OK. 567 00:29:50,050 --> 00:29:54,290 One more version, then we'll get to-- well, one 568 00:29:54,290 --> 00:29:58,840 and a half more versions-- then we'll 569 00:29:58,840 --> 00:30:00,176 get to the dichotomy theorem. 570 00:30:06,980 --> 00:30:09,160 So x1 is Not-All-Equal-3SAT. 571 00:30:19,382 --> 00:30:20,840 I feel like that's about all I need 572 00:30:20,840 --> 00:30:24,570 to write down, other than the fact that it is NP-complete. 573 00:30:24,570 --> 00:30:28,280 But just in case, what this means is 574 00:30:28,280 --> 00:30:33,770 a clause is something like Not-All-Equal 575 00:30:33,770 --> 00:30:35,700 of three variables again. 576 00:30:38,260 --> 00:30:43,410 And this is what I'm defining is going to be the monotone 577 00:30:43,410 --> 00:30:49,480 Not-All-Equal-3SAT-- which is also hard-- 578 00:30:49,480 --> 00:30:58,610 where these are variables, not just literals. 579 00:30:58,610 --> 00:31:03,710 So no negations in monotone Not-All-Equal-3SAT. 580 00:31:03,710 --> 00:31:05,420 Again, the original proof already 581 00:31:05,420 --> 00:31:09,370 had monotonicity in there, so there's no work to be done. 582 00:31:09,370 --> 00:31:09,870 Cool. 583 00:31:09,870 --> 00:31:11,970 So not all equal just means that they're not 584 00:31:11,970 --> 00:31:13,340 all the same values. 585 00:31:13,340 --> 00:31:16,720 So that means not all true and not all false. 586 00:31:16,720 --> 00:31:23,580 Not TTT and not FFF. 587 00:31:23,580 --> 00:31:25,130 I really like this version of 3SAT 588 00:31:25,130 --> 00:31:27,120 because it's completely symmetric 589 00:31:27,120 --> 00:31:29,170 between true and false. 590 00:31:29,170 --> 00:31:30,596 I mean, not at the clause level. 591 00:31:30,596 --> 00:31:31,970 Every clause has to be satisfied. 592 00:31:31,970 --> 00:31:33,886 Those are ANDed together in the logical level. 593 00:31:33,886 --> 00:31:35,345 But the xi's are treated completely 594 00:31:35,345 --> 00:31:36,886 symmetrically between true and false. 595 00:31:36,886 --> 00:31:38,510 You could just call them red and blue. 596 00:31:38,510 --> 00:31:40,850 There's no reason to think one is true one is false. 597 00:31:40,850 --> 00:31:45,780 You just can't have them all be the same color within a clause. 598 00:31:45,780 --> 00:31:46,280 OK. 599 00:31:46,280 --> 00:31:48,822 So you could think of it as a problem on hypergraphs. 600 00:31:48,822 --> 00:31:51,030 Three uniform hypergraphs, you have all these triples 601 00:31:51,030 --> 00:31:52,150 of things. 602 00:31:52,150 --> 00:31:55,060 You just want them to not all be colored the same. 603 00:31:55,060 --> 00:31:57,740 So it means two of one, one of the other two trues and one 604 00:31:57,740 --> 00:32:00,950 false, two reds and one blue, two falses, one true. 605 00:32:00,950 --> 00:32:03,294 They're all this-- those are all good cases 606 00:32:03,294 --> 00:32:04,460 and these are the bad cases. 607 00:32:08,000 --> 00:32:10,390 Cool. 608 00:32:10,390 --> 00:32:14,324 AUDIENCE: So this is one or two in 3SAT? 609 00:32:14,324 --> 00:32:14,990 PROFESSOR: Yeah. 610 00:32:14,990 --> 00:32:17,240 You can think of this exactly one or two 611 00:32:17,240 --> 00:32:20,320 in 3SAT, if you want to phrase it in this style. 612 00:32:20,320 --> 00:32:20,820 OK. 613 00:32:20,820 --> 00:32:24,900 So ideally, you should remember all of these. 614 00:32:24,900 --> 00:32:27,510 But I'll tell you the most important ones are regular 615 00:32:27,510 --> 00:32:30,560 3SAT-- that's at least one of each thing is true-- 616 00:32:30,560 --> 00:32:34,340 exactly 1 3SAT, or 1-in-3SAT-- where exactly one of the things 617 00:32:34,340 --> 00:32:37,140 is true, and adding more things breaks it-- 618 00:32:37,140 --> 00:32:38,490 and Not-All-Equal-3SAT. 619 00:32:38,490 --> 00:32:40,750 Those are the three important ones 620 00:32:40,750 --> 00:32:43,190 to know from a lower bounds perspective. 621 00:32:43,190 --> 00:32:44,830 These others are to, like, be careful 622 00:32:44,830 --> 00:32:46,871 that you don't fall into one of these things that 623 00:32:46,871 --> 00:32:50,970 is polynomial. 624 00:32:50,970 --> 00:32:53,507 So occasionally MAX 2SAT is the one other 625 00:32:53,507 --> 00:32:54,590 that would be useful here. 626 00:32:54,590 --> 00:32:56,650 But remember these guys. 627 00:32:56,650 --> 00:32:57,572 They're super handy. 628 00:32:57,572 --> 00:32:59,780 Because what will happen when you're proving hardness 629 00:32:59,780 --> 00:33:02,460 is you fool around and you try to find-- 630 00:33:02,460 --> 00:33:05,430 you build a gadget that has two truths-- two 631 00:33:05,430 --> 00:33:07,920 possible ways to satisfy it. 632 00:33:07,920 --> 00:33:10,860 Call one red and one blue or one true and one false. 633 00:33:10,860 --> 00:33:14,850 And then you try different ways to combine three of them. 634 00:33:14,850 --> 00:33:17,740 And you're trying to get-- you need some other things-- 635 00:33:17,740 --> 00:33:19,890 but you're trying to get clause gadgets. 636 00:33:19,890 --> 00:33:26,690 Trying to get them to-- when you combine three 637 00:33:26,690 --> 00:33:28,910 wires into a little gadget, you want 638 00:33:28,910 --> 00:33:30,740 them to be constrained somehow. 639 00:33:30,740 --> 00:33:33,120 That in order to be globally OK, something 640 00:33:33,120 --> 00:33:35,172 must hold locally at those three things. 641 00:33:35,172 --> 00:33:37,380 And it might end up being a Not-All-Equal constraint, 642 00:33:37,380 --> 00:33:39,296 it might end up being an exactly 1 constraint, 643 00:33:39,296 --> 00:33:41,930 or it might end up being a 3SAT constraint. 644 00:33:41,930 --> 00:33:44,610 With some negations to make it happy, 645 00:33:44,610 --> 00:33:48,570 it should be one of those to be hard. 646 00:33:48,570 --> 00:33:51,190 If you fall into something like this, then that's not good. 647 00:33:53,950 --> 00:33:54,695 Question. 648 00:33:54,695 --> 00:33:58,913 AUDIENCE: So let's say, since this Not-All-Equal thing-- 649 00:33:58,913 --> 00:34:01,220 let's say you call it red and blue. 650 00:34:01,220 --> 00:34:03,964 What if you add green? 651 00:34:03,964 --> 00:34:11,429 Then would there be-- would Not-All-Equal 3SAT be NP-hard, 652 00:34:11,429 --> 00:34:13,330 or would you need 4SAT or something? 653 00:34:13,330 --> 00:34:13,996 PROFESSOR: Yeah. 654 00:34:13,996 --> 00:34:15,180 So what about ternary truth? 655 00:34:19,488 --> 00:34:23,949 I-- there might be a problem on that in the PSET. 656 00:34:23,949 --> 00:34:27,570 But in general, you would have to go through the work 657 00:34:27,570 --> 00:34:28,830 to check which problems. 658 00:34:28,830 --> 00:34:31,510 I think those are pretty uncommon. 659 00:34:31,510 --> 00:34:34,429 So usually what you do is if you have a gadget that 660 00:34:34,429 --> 00:34:36,627 can be solved not two ways, but four ways, 661 00:34:36,627 --> 00:34:38,710 is you call two of them true and two of them false 662 00:34:38,710 --> 00:34:41,570 and hope they behave more or less identically. 663 00:34:41,570 --> 00:34:43,949 So that's the most common answer, practically, 664 00:34:43,949 --> 00:34:45,489 to what we do. 665 00:34:45,489 --> 00:34:47,954 But it certainly is plausible with three different values. 666 00:34:47,954 --> 00:34:49,370 Some of these are going to be hard 667 00:34:49,370 --> 00:34:52,560 but I don't know which ones. 668 00:34:52,560 --> 00:34:55,261 Hopefully all them, but you have to be careful. 669 00:34:55,261 --> 00:34:56,719 And definitely the next theorem I'm 670 00:34:56,719 --> 00:34:58,850 going to talk about-- the dichotomy theorem-- 671 00:34:58,850 --> 00:35:01,500 would get more complicated with three colors. 672 00:35:13,100 --> 00:35:13,760 Nice question. 673 00:35:18,520 --> 00:35:30,620 So let's do Schaefer's Dichotomy Theorem. 674 00:35:30,620 --> 00:35:36,370 This is about which versions of SAT are polynomial 675 00:35:36,370 --> 00:35:37,870 and which versions are NP-complete. 676 00:35:37,870 --> 00:35:42,070 With the right set up, every problem you can think of 677 00:35:42,070 --> 00:35:44,080 is either polynomial or NP-complete. 678 00:35:44,080 --> 00:35:46,360 There's no things in between. 679 00:35:46,360 --> 00:35:48,540 These are called NP-intermediate problems. 680 00:35:48,540 --> 00:35:51,490 So it's always going to be one extreme or the other, 681 00:35:51,490 --> 00:35:54,040 as I'm about to set it up. 682 00:35:54,040 --> 00:35:56,920 And this theorem is by Schaefer. 683 00:35:56,920 --> 00:35:58,930 And in the very same paper he proves 684 00:35:58,930 --> 00:36:01,600 Not-All-Equal 3SAT and 1-in-3SAT are hard. 685 00:36:01,600 --> 00:36:03,020 Those are the original proofs. 686 00:36:03,020 --> 00:36:05,340 So it's a great paper. 687 00:36:05,340 --> 00:36:08,290 I have looked at it many times. 688 00:36:08,290 --> 00:36:10,220 It's from 1978. 689 00:36:10,220 --> 00:36:13,319 So long time ago. 690 00:36:13,319 --> 00:36:14,360 But still quite readable. 691 00:36:19,720 --> 00:36:22,920 So I don't know how much-- all the last problems we've stated 692 00:36:22,920 --> 00:36:25,250 have this property, but I'll make it explicit again. 693 00:36:25,250 --> 00:36:29,090 That's your formula is going to be an AND of clauses. 694 00:36:29,090 --> 00:36:32,770 And now we're going to allow general kinds of clauses. 695 00:36:32,770 --> 00:36:35,600 A clause is just going to be any relation 696 00:36:35,600 --> 00:36:37,185 on some number of variables. 697 00:36:39,917 --> 00:36:42,250 So there won't be any notion of literal here because you 698 00:36:42,250 --> 00:36:45,700 can put that in the relation. 699 00:36:45,700 --> 00:36:52,200 I'll call this a general clause and say relation 700 00:36:52,200 --> 00:36:54,345 on some variables. 701 00:36:57,180 --> 00:36:59,320 So relation is something-- I give you 702 00:36:59,320 --> 00:37:01,500 a set of truth values for those variables 703 00:37:01,500 --> 00:37:02,880 and we'll say yes or no. 704 00:37:02,880 --> 00:37:04,457 That's valid or it's invalid. 705 00:37:04,457 --> 00:37:06,040 You can think of a relation as the set 706 00:37:06,040 --> 00:37:08,290 of all assignments, their variables, and make it true. 707 00:37:08,290 --> 00:37:10,716 But you don't have to specify that, per se. 708 00:37:10,716 --> 00:37:12,090 You just sort of know what it is. 709 00:37:14,890 --> 00:37:15,390 OK. 710 00:37:15,390 --> 00:37:17,880 So I mean, in particular, it could 711 00:37:17,880 --> 00:37:20,200 be the OR of three variables, then we get 3SAT. 712 00:37:20,200 --> 00:37:23,070 Or it could be the Not-All-Equal constraint on three variables, 713 00:37:23,070 --> 00:37:24,750 then it's Not-All-Equal 3SAT, and so on. 714 00:37:27,561 --> 00:37:28,060 OK. 715 00:37:28,060 --> 00:37:31,620 We are going to-- so I guess, sorry. 716 00:37:31,620 --> 00:37:34,800 The relationship should be given to you as a Boolean formula. 717 00:37:34,800 --> 00:37:37,400 So it could be an OR, or you can write 1-in-3SAT 718 00:37:37,400 --> 00:37:38,489 as a Boolean formula. 719 00:37:38,489 --> 00:37:39,530 It's just little tedious. 720 00:37:39,530 --> 00:37:41,330 You could say, well it could be this, or it could be this, 721 00:37:41,330 --> 00:37:42,310 or it could be this. 722 00:37:42,310 --> 00:37:46,960 In general, I'm going to assume that they're 723 00:37:46,960 --> 00:37:49,680 given to you in CNF form. 724 00:37:49,680 --> 00:37:50,680 Sorry, that's redundant. 725 00:37:50,680 --> 00:37:54,110 CNF has form in it. 726 00:37:54,110 --> 00:37:57,420 Because any formula can be made into CNF. 727 00:37:57,420 --> 00:38:02,010 So now CNF is an AND of ORs, so this 728 00:38:02,010 --> 00:38:05,629 is going to be an AND of what we might normally call clauses, 729 00:38:05,629 --> 00:38:07,170 but we're already in a clause, so I'm 730 00:38:07,170 --> 00:38:08,420 going to call this subclauses. 731 00:38:11,010 --> 00:38:14,507 Starting to sound like legalese. 732 00:38:14,507 --> 00:38:15,340 I made up this word. 733 00:38:15,340 --> 00:38:17,240 It's not in the literature. 734 00:38:17,240 --> 00:38:20,010 So in general, your formula is an AND of clauses, 735 00:38:20,010 --> 00:38:21,620 each one is your sum relation, which 736 00:38:21,620 --> 00:38:23,240 we're going to think of as an AND of subclauses. 737 00:38:23,240 --> 00:38:25,448 Of course, it's really just an AND of all the things. 738 00:38:25,448 --> 00:38:28,850 But this is trying to be general. 739 00:38:28,850 --> 00:38:31,620 Because we're going to have constraints in the clauses, 740 00:38:31,620 --> 00:38:33,890 in particular. 741 00:38:33,890 --> 00:38:41,410 So then claim is SAT-- on these types of formulas-- so 742 00:38:41,410 --> 00:38:44,100 here's the difference, I guess. 743 00:38:44,100 --> 00:38:48,430 To define the problem, you specify what kind of relations 744 00:38:48,430 --> 00:38:49,120 that you allow. 745 00:38:49,120 --> 00:38:51,850 So in 3SAT, we say, OK, so OR of three things. 746 00:38:51,850 --> 00:38:54,700 In CNF SAT, it's an OR of k things for any k. 747 00:38:54,700 --> 00:38:58,810 In Not-All-Equal 3SAT, it's not all equal of three things, 748 00:38:58,810 --> 00:38:59,310 and so on. 749 00:38:59,310 --> 00:39:03,570 So we give that up front and then the decision problem 750 00:39:03,570 --> 00:39:07,560 is well, I have n variables and I 751 00:39:07,560 --> 00:39:12,364 can combine them with these clauses however I want. 752 00:39:12,364 --> 00:39:14,030 So we need some kind of infinity, right? 753 00:39:14,030 --> 00:39:15,640 If I gave you a specific problem, 754 00:39:15,640 --> 00:39:17,600 then it's not going to be NP-hard. 755 00:39:17,600 --> 00:39:19,410 Like, with these 10 variables, that's 756 00:39:19,410 --> 00:39:21,360 never going to be interesting. 757 00:39:21,360 --> 00:39:24,690 So I give you the notion of what causes are allowed, 758 00:39:24,690 --> 00:39:28,170 what relations are permitted, and then I 759 00:39:28,170 --> 00:39:32,490 want to consider the class of all possible formulas you 760 00:39:32,490 --> 00:39:35,106 can build with clauses of that type. 761 00:39:35,106 --> 00:39:37,480 So you can think of this as really more of a clause type, 762 00:39:37,480 --> 00:39:40,840 like Not-All-Equal, just to be precise here. 763 00:39:40,840 --> 00:39:43,760 And then we get a version of SAT. 764 00:39:43,760 --> 00:39:56,190 And it's going to be polynomial if one of four cases happen. 765 00:39:56,190 --> 00:39:57,140 At least one. 766 00:39:57,140 --> 00:39:58,990 Any one of these will make it easy. 767 00:39:58,990 --> 00:40:01,100 We have seen almost all of these. 768 00:40:01,100 --> 00:40:08,140 So first one is setting all variables true 769 00:40:08,140 --> 00:40:10,910 satisfies the formula. 770 00:40:10,910 --> 00:40:14,490 Well not just the formula, but all formulas of this type. 771 00:40:14,490 --> 00:40:29,995 Or all variables false satisfies all clauses. 772 00:40:32,850 --> 00:40:33,350 OK. 773 00:40:33,350 --> 00:40:35,970 This is a statement over all formulas with this clause type, 774 00:40:35,970 --> 00:40:36,469 right? 775 00:40:36,469 --> 00:40:38,260 So, a statement about the clause types. 776 00:40:38,260 --> 00:40:40,770 And it's one of the issues we were having with not exactly 777 00:40:40,770 --> 00:40:44,897 1 3SAT, because there the clause type allowed everything 778 00:40:44,897 --> 00:40:46,980 to be false and it also had everything to be true, 779 00:40:46,980 --> 00:40:48,440 so it was doubly bad. 780 00:40:48,440 --> 00:40:51,729 But of course is if you have clauses where this 781 00:40:51,729 --> 00:40:53,270 is true for all the-- you could allow 782 00:40:53,270 --> 00:40:54,394 different types of clauses. 783 00:40:54,394 --> 00:40:57,190 You could have Not-All-Equal plus 1-in-3SAT, that 784 00:40:57,190 --> 00:40:58,967 will also be hard, of course. 785 00:40:58,967 --> 00:41:01,550 But if all of your clauses have this property, then of course, 786 00:41:01,550 --> 00:41:03,716 you just globally set the variables and you're done. 787 00:41:06,200 --> 00:41:07,951 OK. 788 00:41:07,951 --> 00:41:08,950 That was the first case. 789 00:41:19,730 --> 00:41:21,800 All right. 790 00:41:21,800 --> 00:41:29,400 So the next one is that it could be the subclauses 791 00:41:29,400 --> 00:41:35,705 are all Horn, or all dual Horn. 792 00:41:41,190 --> 00:41:44,429 So those are two happy cases we saw before. 793 00:41:44,429 --> 00:41:46,220 I mean, we can think of the overall problem 794 00:41:46,220 --> 00:41:50,470 as an AND of the clauses, which are ANDs of subclauses, 795 00:41:50,470 --> 00:41:53,010 so if everything is a Horn or dual Horn thing, 796 00:41:53,010 --> 00:41:54,940 then we're happy. 797 00:41:54,940 --> 00:42:05,670 And next case is the relations are all 2-CNF. 798 00:42:05,670 --> 00:42:07,410 So this would be the 2SAT case. 799 00:42:07,410 --> 00:42:09,830 If all the relations you're working with are in 2-CNF, 800 00:42:09,830 --> 00:42:12,455 then when we AND them together, you still have a 2-CNF formula, 801 00:42:12,455 --> 00:42:15,770 so you can solve it by 2SAT. 802 00:42:15,770 --> 00:42:17,740 So these are all things we've seen. 803 00:42:17,740 --> 00:42:21,660 There's one more case we haven't seen. 804 00:42:21,660 --> 00:42:22,786 Is there a question? 805 00:42:22,786 --> 00:42:23,758 Yeah. 806 00:42:23,758 --> 00:42:26,674 AUDIENCE: Isn't 2SAT just a subcase of the Horn and dual 807 00:42:26,674 --> 00:42:28,049 Horn thing? 808 00:42:28,049 --> 00:42:29,590 Because you're always going to have-- 809 00:42:29,590 --> 00:42:30,465 PROFESSOR: It's true. 810 00:42:30,465 --> 00:42:33,810 2SAT is a special case of Horn. 811 00:42:33,810 --> 00:42:35,744 [INTERPOSING VOICES] 812 00:42:35,744 --> 00:42:37,702 AUDIENCE: You could have one with two positives 813 00:42:37,702 --> 00:42:39,160 and another one with two negatives. 814 00:42:39,160 --> 00:42:40,594 AUDIENCE: Yeah, that's true. 815 00:42:40,594 --> 00:42:42,102 Yeah. 816 00:42:42,102 --> 00:42:43,560 PROFESSOR: Ah, right, right, right. 817 00:42:43,560 --> 00:42:44,110 So I see. 818 00:42:44,110 --> 00:42:47,320 So 2-CNF, some of the clauses are going to be Horn 819 00:42:47,320 --> 00:42:49,300 and some of them are dual Horn, I think. 820 00:42:49,300 --> 00:42:51,370 So it doesn't fall into this because it's not 821 00:42:51,370 --> 00:42:52,270 all one or the other. 822 00:42:52,270 --> 00:42:54,570 In general, those combinations are bad. 823 00:42:54,570 --> 00:42:57,067 But 2SAT is always OK. 824 00:42:57,067 --> 00:42:57,650 Good question. 825 00:43:02,520 --> 00:43:10,855 OK Last case is some linear algebra. 826 00:43:17,540 --> 00:43:19,000 This is one other easy case of SAT 827 00:43:19,000 --> 00:43:20,400 which doesn't come up very often, 828 00:43:20,400 --> 00:43:22,030 so I didn't write it as a separate one. 829 00:43:50,050 --> 00:43:52,280 So imagine equations like this. 830 00:43:52,280 --> 00:43:57,040 I take some number variables, I x OR them together and I say, 831 00:43:57,040 --> 00:44:01,290 that should be 0, or similar thing, I set it equal to 1. 832 00:44:01,290 --> 00:44:05,200 Those are what I would call linear equation over Zmod2. 833 00:44:05,200 --> 00:44:08,450 Because in Zmod2-- the finite field in two elements-- 834 00:44:08,450 --> 00:44:12,590 addition becomes x OR and there's no multiplication here 835 00:44:12,590 --> 00:44:15,510 because it's a linear system. 836 00:44:15,510 --> 00:44:20,930 So we can solve these things because z2 is a finite field. 837 00:44:20,930 --> 00:44:22,850 We can use Gaussian elimination if-- even 838 00:44:22,850 --> 00:44:25,170 if I have a whole bunch of these equations, 839 00:44:25,170 --> 00:44:28,650 I can solve them all using Gaussian elimination. 840 00:44:28,650 --> 00:44:30,230 Or determine that they're unsolvable. 841 00:44:30,230 --> 00:44:35,790 So that's another easy case for SAT to be careful about. 842 00:44:35,790 --> 00:44:40,450 And the theorem is if you have one of these situations-- 843 00:44:40,450 --> 00:44:41,780 so you can't mix these. 844 00:44:41,780 --> 00:44:43,360 If you have one clause of this type 845 00:44:43,360 --> 00:44:47,680 and another clause of this type, your problem will be NP-hard. 846 00:44:47,680 --> 00:44:54,090 So in general, you say, otherwise SAT is NP-hard. 847 00:44:59,565 --> 00:45:01,190 I guess it will actually be NP-complete 848 00:45:01,190 --> 00:45:03,690 here, the way we've set it up. 849 00:45:03,690 --> 00:45:07,320 Well, assuming the relations are checkable. 850 00:45:07,320 --> 00:45:08,690 So these are the only cases. 851 00:45:08,690 --> 00:45:10,485 This is an easy case, this is an easy case, 852 00:45:10,485 --> 00:45:11,360 this is an easy case. 853 00:45:11,360 --> 00:45:13,640 It could be that multiple of these things are true. 854 00:45:13,640 --> 00:45:16,310 Maybe your 2CNF and your all Horn. 855 00:45:16,310 --> 00:45:18,460 That will also be polynomial, of course. 856 00:45:18,460 --> 00:45:20,580 But if none of these individually hold, 857 00:45:20,580 --> 00:45:22,400 then your problem is NP-hard. 858 00:45:22,400 --> 00:45:23,023 Question. 859 00:45:23,023 --> 00:45:24,564 AUDIENCE: So how does this generalize 860 00:45:24,564 --> 00:45:26,966 from non-Boolean fields? 861 00:45:26,966 --> 00:45:28,860 I'm sure the last one is also still true. 862 00:45:28,860 --> 00:45:29,526 PROFESSOR: Yeah. 863 00:45:29,526 --> 00:45:32,180 So we can go back to your question about three colors, 864 00:45:32,180 --> 00:45:33,790 and the answer is I don't know. 865 00:45:33,790 --> 00:45:35,340 As far as I know, there's no theorem of that type. 866 00:45:35,340 --> 00:45:36,330 But there might be one. 867 00:45:36,330 --> 00:45:39,150 It's been 30 years. 868 00:45:39,150 --> 00:45:41,426 So it wouldn't be surprising. 869 00:45:41,426 --> 00:45:43,550 Certainly, you can-- some of these positive results 870 00:45:43,550 --> 00:45:45,320 will generalize. 871 00:45:45,320 --> 00:45:50,360 But I think even this one would be a little tricky. 872 00:45:50,360 --> 00:45:52,202 AUDIENCE: So MAX 2SAT doesn't fall in this? 873 00:45:52,202 --> 00:45:52,910 PROFESSOR: Right. 874 00:45:52,910 --> 00:45:56,335 So here the goal is always to satisfy all of the clauses. 875 00:45:56,335 --> 00:45:57,960 It's always the AND of all the clauses. 876 00:45:57,960 --> 00:46:01,560 You could imagine a MAX 2SAT-like theorem. 877 00:46:01,560 --> 00:46:03,410 My guess is most problems will be hard. 878 00:46:03,410 --> 00:46:06,680 But as far as I know, there's no such theorem. 879 00:46:06,680 --> 00:46:07,470 Yeah. 880 00:46:07,470 --> 00:46:09,678 AUDIENCE: Is there any way to understand this theorem 881 00:46:09,678 --> 00:46:13,760 as making a geometric statement about the relation being convex 882 00:46:13,760 --> 00:46:15,930 and hypercube or something? 883 00:46:15,930 --> 00:46:17,430 Like, is there any sort of convexity 884 00:46:17,430 --> 00:46:20,470 property encoded in this? 885 00:46:20,470 --> 00:46:21,470 PROFESSOR: I don't know. 886 00:46:21,470 --> 00:46:24,140 I would guess no. 887 00:46:24,140 --> 00:46:25,910 I know there is a more modern take 888 00:46:25,910 --> 00:46:28,309 on this that is more algebraic. 889 00:46:28,309 --> 00:46:30,350 So it's more like, if you start with these things 890 00:46:30,350 --> 00:46:31,724 and you can build up in this way, 891 00:46:31,724 --> 00:46:33,560 anything you can build up in this way 892 00:46:33,560 --> 00:46:36,280 are the polynomial solvable versions of SAT. 893 00:46:36,280 --> 00:46:40,036 Anything you can't build up in this way is NP-hard. 894 00:46:40,036 --> 00:46:42,410 So if you're interested in that, check the Wikipedia page 895 00:46:42,410 --> 00:46:45,742 for Schaefer's Dichotomy Theorem. 896 00:46:45,742 --> 00:46:47,950 But I don't think there's a geometric interpretation. 897 00:46:47,950 --> 00:46:50,116 This one, obviously, has a geometric interpretation. 898 00:46:50,116 --> 00:46:53,680 But I think the others not, would be my guess. 899 00:46:53,680 --> 00:46:54,920 Yeah. 900 00:46:54,920 --> 00:46:56,420 AUDIENCE: So does this say something 901 00:46:56,420 --> 00:47:00,260 about the complexity of recognizing the clauses if you 902 00:47:00,260 --> 00:47:01,750 interpret them as a language? 903 00:47:01,750 --> 00:47:04,060 PROFESSOR: If I give you the formula that 904 00:47:04,060 --> 00:47:06,220 specifies the types of clauses, can you 905 00:47:06,220 --> 00:47:09,760 determine whether any of these is the case. 906 00:47:09,760 --> 00:47:14,690 I would guess yes, but I don't know of such a theorem. 907 00:47:14,690 --> 00:47:16,700 So another good question. 908 00:47:16,700 --> 00:47:19,130 So many questions to think about here. 909 00:47:19,130 --> 00:47:21,460 It's definitely not explicitly mentioned, 910 00:47:21,460 --> 00:47:23,070 that I saw, in the Schaefer paper. 911 00:47:23,070 --> 00:47:25,590 But it's been around for a while so people may 912 00:47:25,590 --> 00:47:28,101 have thought about that more. 913 00:47:28,101 --> 00:47:29,600 It definitely can be a little tricky 914 00:47:29,600 --> 00:47:33,010 to check which things are of this type, practically. 915 00:47:33,010 --> 00:47:37,620 So it would be nice if there was an algorithm. 916 00:47:37,620 --> 00:47:42,520 I would say-- so again, practically speaking, 917 00:47:42,520 --> 00:47:47,380 there was one hardness proof I was trying to generate gadgets 918 00:47:47,380 --> 00:47:48,400 computationally. 919 00:47:48,400 --> 00:47:50,170 So just enumerate all possible gadgets 920 00:47:50,170 --> 00:47:52,070 of a certain size for my problem, 921 00:47:52,070 --> 00:47:55,970 and then see what formula they were representing. 922 00:47:55,970 --> 00:47:58,660 And then we would take that formula, 923 00:47:58,660 --> 00:48:02,560 do a Karnaugh map-- if you've ever done digital logic stuff-- 924 00:48:02,560 --> 00:48:06,110 and then from that, you get a nice, minimal form. 925 00:48:06,110 --> 00:48:08,660 And then we would-- usually we could just look at the map 926 00:48:08,660 --> 00:48:12,360 and say, oh, that's just equals, or that's 927 00:48:12,360 --> 00:48:13,530 not equals or something. 928 00:48:13,530 --> 00:48:15,590 We were hoping for-- we were dreaming for-- one 929 00:48:15,590 --> 00:48:17,210 of these things or 3SAT. 930 00:48:17,210 --> 00:48:19,580 We never got the gadget we wanted. 931 00:48:19,580 --> 00:48:22,750 So I think, with a Karnaugh map, you could do this. 932 00:48:22,750 --> 00:48:23,950 But that's exponential time. 933 00:48:23,950 --> 00:48:26,300 AUDIENCE: Yeah. 934 00:48:26,300 --> 00:48:28,719 PROFESSOR: So I don't know for sure. 935 00:48:28,719 --> 00:48:30,510 I should probably check the algebraic view. 936 00:48:30,510 --> 00:48:32,370 That might-- 937 00:48:32,370 --> 00:48:34,354 AUDIENCE: That's a clever approach though. 938 00:48:34,354 --> 00:48:35,020 PROFESSOR: Yeah. 939 00:48:35,020 --> 00:48:36,420 AUDIENCE: To do things computationally. 940 00:48:36,420 --> 00:48:37,880 PROFESSOR: It's definitely helpful. 941 00:48:37,880 --> 00:48:39,580 Because of course, computationally, you 942 00:48:39,580 --> 00:48:40,960 can only look at small gadgets. 943 00:48:40,960 --> 00:48:44,060 But hopefully there is a small gadget and then a nice proof. 944 00:48:44,060 --> 00:48:47,216 So why do the hard work of generating them yourself when 945 00:48:47,216 --> 00:48:48,590 the computer could do it for you? 946 00:48:48,590 --> 00:48:50,310 It doesn't work for all problems. 947 00:48:50,310 --> 00:48:52,830 Your problems need to be locally isolatable. 948 00:48:52,830 --> 00:48:56,370 To not worry about the big picture. 949 00:48:56,370 --> 00:48:59,290 Other questions? 950 00:48:59,290 --> 00:49:01,850 Cool. 951 00:49:01,850 --> 00:49:05,240 Well that's all the versions of SAT you need to know. 952 00:49:05,240 --> 00:49:07,770 Because here we have the universality theorem. 953 00:49:07,770 --> 00:49:10,150 There will be another one or two that we 954 00:49:10,150 --> 00:49:13,980 bump into but these are the things you should all know. 955 00:49:13,980 --> 00:49:15,700 It's really helpful when doing a proof 956 00:49:15,700 --> 00:49:18,370 to not have to worry about which version 3SAT you even 957 00:49:18,370 --> 00:49:21,116 are going to use, and just know that these are all out here. 958 00:49:21,116 --> 00:49:23,490 So that when you find a gadget that happens to match one, 959 00:49:23,490 --> 00:49:24,906 and then you say, oh, well I meant 960 00:49:24,906 --> 00:49:28,821 to do a reduction from Not-All-Equal 3SAT. 961 00:49:28,821 --> 00:49:30,570 That's why I wanted to tell you all these, 962 00:49:30,570 --> 00:49:34,800 although I know it's a lot to take in all at once. 963 00:49:34,800 --> 00:49:37,075 Let's do some reductions, finally. 964 00:49:43,240 --> 00:49:45,510 NP hardcore time. 965 00:49:45,510 --> 00:49:53,910 So the first one, I had actually never seen before, 966 00:49:53,910 --> 00:49:55,580 but it's in Schaefer's paper. 967 00:49:55,580 --> 00:49:57,805 So I thought it'd be fun to cover. 968 00:50:01,430 --> 00:50:03,340 Here's a problem, which is NP-hard, 969 00:50:03,340 --> 00:50:05,760 and we will actually prove this one NP-hard. 970 00:50:05,760 --> 00:50:07,240 2-colorable perfect matching. 971 00:50:09,880 --> 00:50:16,570 Let's say you're given a planar 3-regular graph, 972 00:50:16,570 --> 00:50:18,030 every vertex has degree 3. 973 00:50:24,380 --> 00:50:27,650 And what you'd like to do is 2-color the vertices, a red 974 00:50:27,650 --> 00:50:48,766 and blue, such that every vertex has exactly one 975 00:50:48,766 --> 00:50:49,890 neighbor of the same color. 976 00:50:59,750 --> 00:51:00,250 OK. 977 00:51:00,250 --> 00:51:05,990 So if you look at a vertex and it has three neighbors, 978 00:51:05,990 --> 00:51:08,580 then-- let's say we color this guy red, 979 00:51:08,580 --> 00:51:10,610 there should be exactly one neighbor that's red. 980 00:51:10,610 --> 00:51:12,766 And so you can think of this edge as being red, 981 00:51:12,766 --> 00:51:14,890 and then the red edges will form a perfect matching 982 00:51:14,890 --> 00:51:15,779 in the graph. 983 00:51:15,779 --> 00:51:17,320 Every vertex will be [? instant to ?] 984 00:51:17,320 --> 00:51:19,029 exactly one edge. 985 00:51:19,029 --> 00:51:20,820 So that's the 2-colorable perfect matching. 986 00:51:20,820 --> 00:51:23,160 It's kind of-- well, sorry. 987 00:51:23,160 --> 00:51:25,900 The red edges form perfect matching on the red nodes, 988 00:51:25,900 --> 00:51:29,470 and the black-- or the white edges, 989 00:51:29,470 --> 00:51:33,520 I guess-- form a perfect matching on the white nodes, 990 00:51:33,520 --> 00:51:35,950 black nodes, whatever. 991 00:51:35,950 --> 00:51:39,370 So it's like two perfect matchings, 992 00:51:39,370 --> 00:51:42,010 one in each color class. 993 00:51:42,010 --> 00:51:43,430 So this is a nice problem. 994 00:51:43,430 --> 00:51:45,270 You can think of it as SAT, in a sense. 995 00:51:45,270 --> 00:51:47,810 It's, again, just a local constraint on the notes. 996 00:51:50,607 --> 00:51:52,940 And so you can think of this as being a clause involving 997 00:51:52,940 --> 00:51:54,880 those four guys. 998 00:51:54,880 --> 00:51:56,860 I think, unless I did something wrong, 999 00:51:56,860 --> 00:52:01,880 you can think of it as 2SAT and 4SAT, 1000 00:52:01,880 --> 00:52:04,940 or a special version of 2SAT and 4SAT. 1001 00:52:04,940 --> 00:52:08,185 Because-- is that right? 1002 00:52:08,185 --> 00:52:09,140 Yeah. 1003 00:52:09,140 --> 00:52:13,810 So let's say red is true. 1004 00:52:13,810 --> 00:52:16,047 So what we're saying is if this guy is true, 1005 00:52:16,047 --> 00:52:18,130 among these four nodes there should be exactly one 1006 00:52:18,130 --> 00:52:20,070 other one that is red. 1007 00:52:20,070 --> 00:52:21,790 On the other hand, if this is black, 1008 00:52:21,790 --> 00:52:24,730 there should be exactly one of them that is black. 1009 00:52:24,730 --> 00:52:26,560 And so the other two should be red. 1010 00:52:26,560 --> 00:52:30,100 So in all cases, it's exactly two and four of them are red. 1011 00:52:30,100 --> 00:52:32,970 And it's symmetric between red and black, so that seems good. 1012 00:52:32,970 --> 00:52:35,190 So this is a special case of 2SAT and 4SAT. 1013 00:52:35,190 --> 00:52:37,870 In case you were wondering whether 2SAT and 4SAT is hard, 1014 00:52:37,870 --> 00:52:38,940 here it is. 1015 00:52:38,940 --> 00:52:45,865 And I have the original reduction by Schaefer here. 1016 00:52:45,865 --> 00:52:47,020 Do I have any notes? 1017 00:52:47,020 --> 00:52:48,690 No, that would be too easy. 1018 00:52:48,690 --> 00:52:55,220 So here's a gadget and here's another gadget, 1019 00:52:55,220 --> 00:52:58,360 and then they're pasted together. 1020 00:52:58,360 --> 00:53:02,160 And I should mention-- so Schaefer 1021 00:53:02,160 --> 00:53:04,455 claims that if you have a planar 3-regular graph, 1022 00:53:04,455 --> 00:53:05,330 this problem is hard. 1023 00:53:05,330 --> 00:53:06,820 But he doesn't prove it. 1024 00:53:06,820 --> 00:53:08,510 He just proves it for general graphs, 1025 00:53:08,510 --> 00:53:11,060 so I'm only going to prove it for general graphs. 1026 00:53:11,060 --> 00:53:13,970 Maybe we can think about planar 3-regular case, 1027 00:53:13,970 --> 00:53:15,940 but not right here. 1028 00:53:15,940 --> 00:53:20,180 So this will just make a graph instance to that problem. 1029 00:53:20,180 --> 00:53:23,780 So this gadget, this is a k4 on-- 1030 00:53:23,780 --> 00:53:27,090 and we're only distinguishing x, y, and z. 1031 00:53:27,090 --> 00:53:28,970 And it has to form-- there's going 1032 00:53:28,970 --> 00:53:32,530 to be one red edge and one black edge. 1033 00:53:32,530 --> 00:53:34,230 So maybe like this, and like this. 1034 00:53:34,230 --> 00:53:35,570 Or like this, or like this. 1035 00:53:35,570 --> 00:53:38,550 It's going to be a rotation of one of those assignments. 1036 00:53:38,550 --> 00:53:41,570 So I believe the claim is x, y, and z, 1037 00:53:41,570 --> 00:53:43,370 just looking at those three vertices, 1038 00:53:43,370 --> 00:53:46,490 should be not-all-equal. 1039 00:53:46,490 --> 00:53:46,990 OK? 1040 00:53:46,990 --> 00:53:49,690 If two of them are red, by symmetry-- there's 1041 00:53:49,690 --> 00:53:52,010 lots of rotational symmetry here-- so maybe two of them 1042 00:53:52,010 --> 00:53:53,400 are red and one is black. 1043 00:53:53,400 --> 00:53:55,400 Then this guy can be set black and you're happy. 1044 00:53:55,400 --> 00:53:58,530 It's actually forced for that guy to be black. 1045 00:53:58,530 --> 00:54:02,100 If two of them are black, then these two must be red. 1046 00:54:02,100 --> 00:54:05,170 And if all three of these are black, you're toast. 1047 00:54:05,170 --> 00:54:07,310 Because you should have two of each. 1048 00:54:07,310 --> 00:54:10,640 And if all three of them are red, you're in trouble. 1049 00:54:10,640 --> 00:54:17,490 So this is a not-all-equal clause gadget for this problem. 1050 00:54:17,490 --> 00:54:21,890 So we're going to reduce from Not-All-Equal 3SAT 1051 00:54:21,890 --> 00:54:23,630 to 2-colorable perfect matching. 1052 00:54:23,630 --> 00:54:26,650 So we're representing a Not-All-Equal clause like this. 1053 00:54:26,650 --> 00:54:33,250 And now what we need is the ability to copy data, right? 1054 00:54:33,250 --> 00:54:35,670 So these are three variables that-- at the moment, yeah, 1055 00:54:35,670 --> 00:54:37,180 they can be red or blue. 1056 00:54:37,180 --> 00:54:39,330 But what we need is that the same xi 1057 00:54:39,330 --> 00:54:40,930 can appear in multiple clauses. 1058 00:54:40,930 --> 00:54:42,379 Because we have a bipartite graph. 1059 00:54:42,379 --> 00:54:44,420 If every variable appeared in only in one clause, 1060 00:54:44,420 --> 00:54:47,340 the problem would be really easy. 1061 00:54:47,340 --> 00:54:49,590 So that's what this gadget does. 1062 00:54:49,590 --> 00:54:52,680 The claim is this gadget copies a value. 1063 00:54:52,680 --> 00:54:55,250 And this, I think, requires-- so it says that these two 1064 00:54:55,250 --> 00:54:57,900 guys must have the same color. 1065 00:54:57,900 --> 00:55:00,760 And so what you do is you just have-- 1066 00:55:00,760 --> 00:55:02,520 for each Not-All-Equal clause-- you 1067 00:55:02,520 --> 00:55:04,540 have one of these Not-All-Equal gadgets. 1068 00:55:04,540 --> 00:55:06,780 And then whenever you have two variables 1069 00:55:06,780 --> 00:55:09,680 that are supposed to be the same thing here, it's x and x. 1070 00:55:09,680 --> 00:55:11,777 In our terminology, xi and xi. 1071 00:55:11,777 --> 00:55:14,110 Then you're just going to connect them with this gadget. 1072 00:55:14,110 --> 00:55:16,230 And that will force them to be equal. 1073 00:55:16,230 --> 00:55:17,780 Or over here we have y and y. 1074 00:55:17,780 --> 00:55:20,160 So r here is Not-All-Equal. 1075 00:55:20,160 --> 00:55:24,090 In our terminology, it'd be NAE, xxy, and yzu. 1076 00:55:24,090 --> 00:55:28,296 This would represent that formula. 1077 00:55:28,296 --> 00:55:30,670 So the thing to check, which I will leave as an exercise, 1078 00:55:30,670 --> 00:55:34,265 because it seems-- at least, I couldn't find a clean way 1079 00:55:34,265 --> 00:55:34,765 to do it. 1080 00:55:34,765 --> 00:55:36,014 It seems a little bit tedious. 1081 00:55:36,014 --> 00:55:40,960 That this forces equality between the two ends, 1082 00:55:40,960 --> 00:55:42,615 not providing any other constraints. 1083 00:55:45,610 --> 00:55:48,616 So that was a simple proof. 1084 00:55:48,616 --> 00:55:50,120 One of few simple proofs. 1085 00:55:50,120 --> 00:55:51,260 Still some cases to check. 1086 00:55:51,260 --> 00:55:52,549 Yeah. 1087 00:55:52,549 --> 00:55:54,465 AUDIENCE: Wait, you said those general graphs, 1088 00:55:54,465 --> 00:55:55,620 they don't [? tap in? ?] 1089 00:55:55,620 --> 00:55:56,328 PROFESSOR: Right. 1090 00:55:56,328 --> 00:55:59,100 This is general graphs. 1091 00:55:59,100 --> 00:56:03,490 So you might say, what about planar 3-regular graphs? 1092 00:56:03,490 --> 00:56:07,830 Planar Not-All-Equal 3SAT-- when this graph is planar-- 1093 00:56:07,830 --> 00:56:10,000 when the bipartite graph is planar-- it's actually 1094 00:56:10,000 --> 00:56:12,030 easy to solve, polynomial. 1095 00:56:12,030 --> 00:56:15,490 So you can't reduce from planar Not-All-Equal 3SAT 1096 00:56:15,490 --> 00:56:17,120 because it's easy. 1097 00:56:17,120 --> 00:56:19,280 But I would guess that in this situation-- 1098 00:56:19,280 --> 00:56:21,570 and we just proved this is a more general problem 1099 00:56:21,570 --> 00:56:23,500 than Not-All-Equal 3SAT-- what we 1100 00:56:23,500 --> 00:56:25,920 would need at this point is a crossover gadget. 1101 00:56:25,920 --> 00:56:27,910 So that when-- and this thing is going 1102 00:56:27,910 --> 00:56:30,580 to end up with crossings-- if there's a gadget that just 1103 00:56:30,580 --> 00:56:33,030 communicates the information across the crossover, 1104 00:56:33,030 --> 00:56:34,620 without any other constraints, then 1105 00:56:34,620 --> 00:56:36,870 we can just plug that in and get rid of all crossings. 1106 00:56:36,870 --> 00:56:40,140 Then we have a planar graph and that would prove this part. 1107 00:56:40,140 --> 00:56:44,130 And then the other part is that we have high degree nodes here. 1108 00:56:44,130 --> 00:56:46,064 And so I'm guessing Schaefer had in mind 1109 00:56:46,064 --> 00:56:47,730 the gadget that takes a high degree node 1110 00:56:47,730 --> 00:56:50,460 and splits it up into lots of little lower degree nodes-- 1111 00:56:50,460 --> 00:56:53,770 degree 3 nodes-- that simulates the same effect. 1112 00:56:53,770 --> 00:56:55,580 But I don't know either gadget. 1113 00:56:55,580 --> 00:56:57,840 But that would be my guess on how to-- that 1114 00:56:57,840 --> 00:56:59,340 would be the obvious approach of how 1115 00:56:59,340 --> 00:57:00,954 to proceed to get that theorem. 1116 00:57:00,954 --> 00:57:01,454 Yeah. 1117 00:57:01,454 --> 00:57:02,870 AUDIENCE: The other gadget is just 1118 00:57:02,870 --> 00:57:07,410 [? 1b ?] split into degree 3 copies connected 1119 00:57:07,410 --> 00:57:10,067 by that gadget. 1120 00:57:10,067 --> 00:57:10,650 PROFESSOR: OK. 1121 00:57:10,650 --> 00:57:11,640 Good. 1122 00:57:11,640 --> 00:57:12,440 One gadget down. 1123 00:57:12,440 --> 00:57:13,648 Now we just need a crossover. 1124 00:57:15,994 --> 00:57:16,660 Other questions? 1125 00:57:21,550 --> 00:57:22,840 All right. 1126 00:57:22,840 --> 00:57:25,840 I want to talk about two families of problems-- 1127 00:57:25,840 --> 00:57:28,160 a proof hardness for two families of problems-- next. 1128 00:57:28,160 --> 00:57:32,530 One is called pushing blocks. 1129 00:57:32,530 --> 00:57:35,810 These come up in lots of different video games. 1130 00:57:35,810 --> 00:57:39,030 One of the first, I think, is called Sokoban. 1131 00:57:39,030 --> 00:57:43,860 This goes back to 1984 and this is, I believe, the original CGA 1132 00:57:43,860 --> 00:57:46,510 graphics for Sokoban. 1133 00:57:46,510 --> 00:57:48,640 And so you may have played Sokoban. 1134 00:57:48,640 --> 00:57:50,080 I think it's in Emacs. 1135 00:57:50,080 --> 00:57:51,180 It's all over the place. 1136 00:57:51,180 --> 00:57:53,590 Tons of implementations on it. 1137 00:57:53,590 --> 00:57:56,510 You are at a warehouseman, that is what sokoban means literally 1138 00:57:56,510 --> 00:57:57,580 in Japanese. 1139 00:57:57,580 --> 00:57:58,680 And you have these boxes. 1140 00:57:58,680 --> 00:57:59,750 They're all one by one boxes. 1141 00:57:59,750 --> 00:58:00,541 You are one by one. 1142 00:58:00,541 --> 00:58:03,150 There are some bricks which cannot be moved. 1143 00:58:03,150 --> 00:58:06,680 You have some target locations and your poor job 1144 00:58:06,680 --> 00:58:09,190 is to move all these boxes into the target locations. 1145 00:58:09,190 --> 00:58:10,940 Or rather, every target location must 1146 00:58:10,940 --> 00:58:13,050 be covered by exactly one box. 1147 00:58:13,050 --> 00:58:15,612 Boxes can overlap each other, you can push a box, 1148 00:58:15,612 --> 00:58:17,070 but you can only push one at a time 1149 00:58:17,070 --> 00:58:18,370 because you're not that strong. 1150 00:58:18,370 --> 00:58:21,030 So you could not, for example, push left here. 1151 00:58:21,030 --> 00:58:24,700 But in general, your inputs are up, down, left, and right. 1152 00:58:24,700 --> 00:58:27,060 Up, up, down, down, left, right, left, right. 1153 00:58:27,060 --> 00:58:29,719 And you can only push one block at a time. 1154 00:58:29,719 --> 00:58:31,260 So if you push a block into a corner, 1155 00:58:31,260 --> 00:58:32,970 it's never going to move again. 1156 00:58:32,970 --> 00:58:34,770 So often you have to hit reset. 1157 00:58:34,770 --> 00:58:36,370 There's a lot of ways to get stuck. 1158 00:58:36,370 --> 00:58:38,500 But this is a solvable instance. 1159 00:58:38,500 --> 00:58:41,970 I think it's level five in the original game. 1160 00:58:41,970 --> 00:58:45,892 So this got started a huge family of problems. 1161 00:58:45,892 --> 00:58:47,350 There are tons of other video games 1162 00:58:47,350 --> 00:58:49,000 that have pushing blocks problems. 1163 00:58:49,000 --> 00:58:52,080 This is one, in Legend of Zelda: Minish Cap, which I think 1164 00:58:52,080 --> 00:58:54,070 is a Gameboy Advance game. 1165 00:58:54,070 --> 00:58:55,820 It's been a while since I played this one. 1166 00:58:55,820 --> 00:58:58,630 But here is a level where you have-- 1167 00:58:58,630 --> 00:59:01,580 it's in perspective a little bit, 1168 00:59:01,580 --> 00:59:03,790 but this is really a 2D problem. 1169 00:59:03,790 --> 00:59:05,030 Everything is one by one. 1170 00:59:05,030 --> 00:59:06,330 Believe me. 1171 00:59:06,330 --> 00:59:08,290 You have one by one blocks. 1172 00:59:08,290 --> 00:59:09,670 You're on ice. 1173 00:59:09,670 --> 00:59:12,220 So if you ever push a block, it will slide off 1174 00:59:12,220 --> 00:59:16,530 to infinity unless it hits something else, like a block. 1175 00:59:16,530 --> 00:59:19,621 And your goal is to get a block here. 1176 00:59:19,621 --> 00:59:20,120 OK? 1177 00:59:20,120 --> 00:59:21,280 Anyone see how to do it? 1178 00:59:23,893 --> 00:59:25,393 AUDIENCE: It's like Ricochet Robots. 1179 00:59:25,393 --> 00:59:25,850 AUDIENCE: Can you walk without sliding? 1180 00:59:25,850 --> 00:59:27,140 PROFESSOR: It's a lot like Ricochet Robots. 1181 00:59:27,140 --> 00:59:27,990 Yeah. 1182 00:59:27,990 --> 00:59:30,100 You can walk wherever you want. 1183 00:59:30,100 --> 00:59:32,040 There is no block. 1184 00:59:32,040 --> 00:59:34,460 So there's lots of free space in this case. 1185 00:59:34,460 --> 00:59:39,250 So you can push this guy down and then push it over and then 1186 00:59:39,250 --> 00:59:39,910 push it up. 1187 00:59:39,910 --> 00:59:41,570 It's actually not that hard. 1188 00:59:41,570 --> 00:59:43,236 At some point I was thinking, well maybe 1189 00:59:43,236 --> 00:59:46,270 I should stack up three here so it ends up-- but no. 1190 00:59:46,270 --> 00:59:50,662 It's just three pushes and you're done. 1191 00:59:50,662 --> 00:59:53,120 And if you watch the YouTube video that's linked from this, 1192 00:59:53,120 --> 00:59:55,470 you'll see him spend like 30 minutes 1193 00:59:55,470 --> 00:59:57,300 until he finds the right solution. 1194 00:59:57,300 --> 00:59:59,841 In the game, it's frustrating because once you push them off, 1195 00:59:59,841 --> 01:00:02,150 they disappear and you have to leave and come back. 1196 01:00:02,150 --> 01:00:04,110 Anyway. 1197 01:00:04,110 --> 01:00:08,330 So out of all these games, we've defined a bunch of models. 1198 01:00:08,330 --> 01:00:11,090 Here's one aspect of the model. 1199 01:00:11,090 --> 01:00:12,850 So we have the fixed blocks, which 1200 01:00:12,850 --> 01:00:16,590 are in red, the movable blocks, which are in cyan here, 1201 01:00:16,590 --> 01:00:17,820 and the robot is blue. 1202 01:00:17,820 --> 01:00:19,750 Everything's one by one. 1203 01:00:19,750 --> 01:00:24,310 And in one model, which we call Push, when you push a block, 1204 01:00:24,310 --> 01:00:25,980 it moves one step. 1205 01:00:25,980 --> 01:00:27,180 That's the normal model. 1206 01:00:27,180 --> 01:00:29,360 And that's like Sokoban. 1207 01:00:29,360 --> 01:00:32,710 And I'll talk about the two in a second. 1208 01:00:32,710 --> 01:00:35,900 In PushPush-- this is like the on-ice version. 1209 01:00:35,900 --> 01:00:36,840 So you're not on ice. 1210 01:00:36,840 --> 01:00:39,060 You can still kind of move and then kind of 1211 01:00:39,060 --> 01:00:42,300 counteract physics and just move one step. 1212 01:00:42,300 --> 01:00:45,530 But the blocks, they'll just fly off until they hit something. 1213 01:00:45,530 --> 01:00:49,090 So here, this block will fly until it goes there. 1214 01:00:49,090 --> 01:00:52,290 In PushPushPush, everything is so slippery 1215 01:00:52,290 --> 01:00:55,120 that if you hit a block and it hits another block that's 1216 01:00:55,120 --> 01:00:58,620 movable, they will all just keep going until they 1217 01:00:58,620 --> 01:01:00,896 hit an immovable block. 1218 01:01:00,896 --> 01:01:02,659 AUDIENCE: But you don't slip. 1219 01:01:02,659 --> 01:01:04,950 PROFESSOR: You still don't slip in any of these models. 1220 01:01:04,950 --> 01:01:06,699 So there's another version where you slip, 1221 01:01:06,699 --> 01:01:08,530 which has not been considered so much. 1222 01:01:08,530 --> 01:01:10,450 Although Ricochet Robots has been considered 1223 01:01:10,450 --> 01:01:11,890 and that's in that genre. 1224 01:01:11,890 --> 01:01:12,390 Yeah? 1225 01:01:12,390 --> 01:01:16,192 AUDIENCE: Is there a model where the block you first pushed 1226 01:01:16,192 --> 01:01:18,150 stops and transfers its momentum to the other-- 1227 01:01:18,150 --> 01:01:18,950 PROFESSOR: Oh, cool. 1228 01:01:18,950 --> 01:01:19,280 Yeah. 1229 01:01:19,280 --> 01:01:20,290 Conservation momentum. 1230 01:01:20,290 --> 01:01:22,800 So this one hits then the next one goes. 1231 01:01:22,800 --> 01:01:23,509 That's probably-- 1232 01:01:23,509 --> 01:01:24,466 AUDIENCE: PushStopPush. 1233 01:01:24,466 --> 01:01:25,560 PROFESSOR: PushStopPush. 1234 01:01:25,560 --> 01:01:27,700 I would guess that's also hard because this ends up 1235 01:01:27,700 --> 01:01:28,995 being the same proof. 1236 01:01:28,995 --> 01:01:31,210 I'm guessing that works, but we would need to check. 1237 01:01:31,210 --> 01:01:32,610 That's a good-- yeah. 1238 01:01:32,610 --> 01:01:36,630 The push-- push ricochet push. 1239 01:01:36,630 --> 01:01:37,130 OK. 1240 01:01:37,130 --> 01:01:39,250 One other thing here is the number two. 1241 01:01:39,250 --> 01:01:41,430 You'll notice only two blocks are moving. 1242 01:01:41,430 --> 01:01:44,680 And normally here, two is the strength of the robot, 1243 01:01:44,680 --> 01:01:46,672 meaning if there are up to two in a row, 1244 01:01:46,672 --> 01:01:49,130 you can push two blocks, but once there are three in a row, 1245 01:01:49,130 --> 01:01:51,070 you can't push at all. 1246 01:01:51,070 --> 01:01:52,950 The idea here is the same thing happens. 1247 01:01:52,950 --> 01:01:54,570 So they're just too heavy. 1248 01:01:54,570 --> 01:01:56,720 After you get up to three of them, 1249 01:01:56,720 --> 01:01:58,750 then they'll stop sliding. 1250 01:01:58,750 --> 01:02:00,900 And same with PushPushPush. 1251 01:02:00,900 --> 01:02:03,220 AUDIENCE: So Sokoban is actually Push-1. 1252 01:02:03,220 --> 01:02:05,080 PROFESSOR: Sokoban is like Push-1. 1253 01:02:05,080 --> 01:02:06,570 It's a little bit more complicated, 1254 01:02:06,570 --> 01:02:08,990 as illustrated in this table. 1255 01:02:08,990 --> 01:02:15,400 So Sokoban is here and you can only push one block at a time. 1256 01:02:15,400 --> 01:02:16,529 There are fixed blocks. 1257 01:02:16,529 --> 01:02:18,570 And in general, the models that have fixed blocks 1258 01:02:18,570 --> 01:02:21,670 are highlighted in pink here. 1259 01:02:21,670 --> 01:02:24,980 The slide thing is trying to capture whether it just 1260 01:02:24,980 --> 01:02:28,600 moves one step or all the way until it can't anymore. 1261 01:02:28,600 --> 01:02:29,277 That's the max. 1262 01:02:29,277 --> 01:02:31,110 And there's only a couple of slide versions. 1263 01:02:31,110 --> 01:02:33,620 I haven't put PushPushPush here because that 1264 01:02:33,620 --> 01:02:36,560 would be the only difference-- is what max means. 1265 01:02:36,560 --> 01:02:39,800 But everything else you just move one step. 1266 01:02:39,800 --> 01:02:42,150 Then the other issue is, what is the goal? 1267 01:02:42,150 --> 01:02:46,340 I mentioned in Sokoban you have to cover every storage 1268 01:02:46,340 --> 01:02:48,700 space with a box. 1269 01:02:48,700 --> 01:02:51,360 That is the only problem with that flavor, in this list 1270 01:02:51,360 --> 01:02:52,040 anyway. 1271 01:02:52,040 --> 01:02:53,810 All the ones that are called Push-- 1272 01:02:53,810 --> 01:02:56,990 the goal is just to get the robot to a destination, 1273 01:02:56,990 --> 01:03:00,450 like in Mario or Zelda or something. 1274 01:03:00,450 --> 01:03:04,630 So that's the difference between Sokoban and Push-1. 1275 01:03:04,630 --> 01:03:09,090 Well Push-1-f, I suppose, is pushing one thing 1276 01:03:09,090 --> 01:03:11,320 at a time with fixed blocks. 1277 01:03:11,320 --> 01:03:14,490 That's identical to Sokoban except for this issue of what 1278 01:03:14,490 --> 01:03:15,120 the goal is. 1279 01:03:15,120 --> 01:03:17,581 Either just to get from s to t-- the robot-- 1280 01:03:17,581 --> 01:03:19,955 or to get all the blocks into a particular configuration. 1281 01:03:23,290 --> 01:03:25,050 OK. 1282 01:03:25,050 --> 01:03:27,340 Well there are some other things here. 1283 01:03:27,340 --> 01:03:29,260 We've talked about Push-k. 1284 01:03:29,260 --> 01:03:30,970 Push-star is when k is infinity. 1285 01:03:30,970 --> 01:03:33,380 So when you push, you can-- your arbitrary strength-- 1286 01:03:33,380 --> 01:03:36,230 you can push as many blocks in a row as you want. 1287 01:03:36,230 --> 01:03:38,940 PushPush-k, PushPush-star, then. 1288 01:03:38,940 --> 01:03:41,410 We've talked about f. f is when you have fixed blocks. 1289 01:03:41,410 --> 01:03:46,400 Push-1-f, Push-k-f, and Push-star-f. 1290 01:03:46,400 --> 01:03:48,550 And then there's one other variation here 1291 01:03:48,550 --> 01:03:50,390 that's been considered, which is the x. 1292 01:03:50,390 --> 01:03:53,120 This is when the path that the robot takes 1293 01:03:53,120 --> 01:03:56,320 must not cross itself-- must not revisit a square. 1294 01:03:56,320 --> 01:03:57,840 This is-- there a lot of video games 1295 01:03:57,840 --> 01:04:00,230 where after you leave a square, that square disappears. 1296 01:04:00,230 --> 01:04:05,070 It falls down into the abyss and so you're scared. 1297 01:04:05,070 --> 01:04:07,450 So to represent those games-- there's 1298 01:04:07,450 --> 01:04:10,770 another reason we did that, but I'll get to that in a moment-- 1299 01:04:10,770 --> 01:04:13,741 there's Push-k-x and Push-star-x. 1300 01:04:13,741 --> 01:04:14,240 OK. 1301 01:04:14,240 --> 01:04:15,573 Now let's talk about complexity. 1302 01:04:15,573 --> 01:04:18,040 That's the right two columns here. 1303 01:04:18,040 --> 01:04:21,120 The reference and the complexity. 1304 01:04:21,120 --> 01:04:25,150 So all of these problems are NP-hard. 1305 01:04:25,150 --> 01:04:25,650 OK? 1306 01:04:25,650 --> 01:04:28,160 But there's this issue-- are they in NP 1307 01:04:28,160 --> 01:04:29,741 or are they PSPACE-Complete? 1308 01:04:29,741 --> 01:04:30,240 Question. 1309 01:04:30,240 --> 01:04:30,906 AUDIENCE: Sorry. 1310 01:04:30,906 --> 01:04:32,610 What did you say a fixed block is? 1311 01:04:32,610 --> 01:04:35,480 PROFESSOR: A fixed block is a block that cannot be pushed. 1312 01:04:35,480 --> 01:04:37,070 So it's just glued to the ground. 1313 01:04:37,070 --> 01:04:38,094 AUDIENCE: So this is just whether or not 1314 01:04:38,094 --> 01:04:39,120 there are some blocks that are fixed. 1315 01:04:39,120 --> 01:04:39,828 PROFESSOR: Right. 1316 01:04:39,828 --> 01:04:42,260 In these problems, this is a more general version 1317 01:04:42,260 --> 01:04:43,560 than this game. 1318 01:04:43,560 --> 01:04:46,420 Here, you allow some blocks to be specified as fixed. 1319 01:04:46,420 --> 01:04:48,490 Here, everything is potentially movable. 1320 01:04:48,490 --> 01:04:50,240 Although if you have more than k in a row, 1321 01:04:50,240 --> 01:04:51,370 it's like a fixed block. 1322 01:04:51,370 --> 01:04:53,660 If you have a k plus 1 by k plus 1 block, 1323 01:04:53,660 --> 01:04:56,190 that's fixed, effectively. 1324 01:04:56,190 --> 01:04:58,740 But you have a resolution issue that you 1325 01:04:58,740 --> 01:05:01,340 can't make tiny fixed blocks in this model. 1326 01:05:01,340 --> 01:05:03,790 And in this model there are no fixed blocks whatsoever. 1327 01:05:03,790 --> 01:05:05,980 But here you can specify some of them are fixed. 1328 01:05:08,810 --> 01:05:09,560 A lot of versions. 1329 01:05:09,560 --> 01:05:10,790 AUDIENCE: So push-star has a boundary? 1330 01:05:10,790 --> 01:05:12,150 Otherwise you could just-- 1331 01:05:12,150 --> 01:05:14,571 PROFESSOR: Push-star does live in a rectangular box. 1332 01:05:14,571 --> 01:05:15,070 Yeah. 1333 01:05:15,070 --> 01:05:15,914 That is the one. 1334 01:05:15,914 --> 01:05:16,830 AUDIENCE: Is it fixed? 1335 01:05:16,830 --> 01:05:21,450 PROFESSOR: You could think of that as fixed blocks or not. 1336 01:05:21,450 --> 01:05:24,050 If nothing is fixed, then you can just walk off to infinity. 1337 01:05:24,050 --> 01:05:26,060 Move all the blocks away and then come back 1338 01:05:26,060 --> 01:05:27,143 and find your destination. 1339 01:05:27,143 --> 01:05:28,312 AUDIENCE: [INAUDIBLE]. 1340 01:05:28,312 --> 01:05:29,020 PROFESSOR: Right. 1341 01:05:29,020 --> 01:05:30,420 So they're all NP-hard. 1342 01:05:30,420 --> 01:05:33,280 There's a few that are known to be PSPACE-Complete. 1343 01:05:33,280 --> 01:05:38,560 Push-Push, with a fixed strength, is PSPACE-Complete. 1344 01:05:38,560 --> 01:05:44,240 Or with fixed blocks, I think, should also be PSPACE-Complete. 1345 01:05:44,240 --> 01:05:45,890 That's not written here. 1346 01:05:45,890 --> 01:05:48,250 But Push-Push-Star, all we know is NP-hardness. 1347 01:05:50,800 --> 01:05:56,050 Push-k-f, where k is at least 2, is known to be PSPACE-Complete. 1348 01:05:56,050 --> 01:06:02,160 But Push-1-f or Push-2, without the f, are both open. 1349 01:06:02,160 --> 01:06:04,720 And the reason we were interested 1350 01:06:04,720 --> 01:06:07,450 in a non-crossing path is that forces the problem to be an NP. 1351 01:06:07,450 --> 01:06:09,074 Because then you know the solution path 1352 01:06:09,074 --> 01:06:10,130 has polynomial length. 1353 01:06:10,130 --> 01:06:12,160 You can visit each [? grant at ?] most once. 1354 01:06:12,160 --> 01:06:14,070 So the hard part here was to prove 1355 01:06:14,070 --> 01:06:16,630 that it's still NP-hard, even with non-crossing paths. 1356 01:06:16,630 --> 01:06:18,479 We won't try to prove that today. 1357 01:06:18,479 --> 01:06:20,770 So those, we actually have tight bounds of NP-complete. 1358 01:06:20,770 --> 01:06:22,970 And Sokoban-- there's a relatively old result-- 1359 01:06:22,970 --> 01:06:25,220 1998-- that it's PSPACE-Complete. 1360 01:06:25,220 --> 01:06:25,720 OK. 1361 01:06:25,720 --> 01:06:26,950 Let's do some reductions. 1362 01:06:26,950 --> 01:06:30,870 So this first reduction is amazingly cool. 1363 01:06:30,870 --> 01:06:33,120 It's by Michael Hoffman, 2000. 1364 01:06:33,120 --> 01:06:36,540 This is Push-star with a rectangular box. 1365 01:06:36,540 --> 01:06:37,040 OK. 1366 01:06:37,040 --> 01:06:38,200 So you're here. 1367 01:06:38,200 --> 01:06:40,010 The outlined regions are the blank space. 1368 01:06:40,010 --> 01:06:42,190 Everything else is filled with a block. 1369 01:06:42,190 --> 01:06:44,370 But every block is movable and you 1370 01:06:44,370 --> 01:06:46,060 can push arbitrarily strongly. 1371 01:06:46,060 --> 01:06:48,350 So this is going to be variables. 1372 01:06:48,350 --> 01:06:50,340 You're going to make some choices here. 1373 01:06:50,340 --> 01:06:53,130 These are the connections between variables and clauses. 1374 01:06:53,130 --> 01:06:55,380 This is a bipartite graph encoded 1375 01:06:55,380 --> 01:06:57,770 in binary in the obvious way. 1376 01:06:57,770 --> 01:07:00,070 There's variables here, clauses here. 1377 01:07:00,070 --> 01:07:04,720 There's a hole exactly when that literal appears in that clause. 1378 01:07:04,720 --> 01:07:05,220 OK? 1379 01:07:05,220 --> 01:07:07,570 There's actually two rows per variable, the true 1380 01:07:07,570 --> 01:07:09,040 and the false. 1381 01:07:09,040 --> 01:07:12,050 And then there's this gadget here to connect the things. 1382 01:07:12,050 --> 01:07:13,550 And then these are the clauses where 1383 01:07:13,550 --> 01:07:15,800 we're going to check that they were all set correctly. 1384 01:07:15,800 --> 01:07:16,890 So let's go through it. 1385 01:07:16,890 --> 01:07:19,140 This is the schematic diagram of what I just said. 1386 01:07:19,140 --> 01:07:20,765 We're going to start here in the variable block 1387 01:07:20,765 --> 01:07:22,390 and walk through each of the variables. 1388 01:07:22,390 --> 01:07:24,740 Here's what the variables look like. 1389 01:07:24,740 --> 01:07:27,930 You have two rows, the xi row and the xi complement row. 1390 01:07:27,930 --> 01:07:31,369 That's another way to write NOT xi. 1391 01:07:31,369 --> 01:07:33,410 And you're going to count, how many times does xi 1392 01:07:33,410 --> 01:07:34,690 appear in any clauses? 1393 01:07:34,690 --> 01:07:36,190 In the positive form, negative form. 1394 01:07:36,190 --> 01:07:38,194 That's called ni and ni bar. 1395 01:07:38,194 --> 01:07:40,110 And you're going to measure out these lengths. 1396 01:07:40,110 --> 01:07:42,470 You can negate variables to make sure that ni is always 1397 01:07:42,470 --> 01:07:44,230 bigger than ni bar. 1398 01:07:44,230 --> 01:07:45,550 So do that. 1399 01:07:45,550 --> 01:07:48,386 So in this case, ni is this big, ni bar is this big. 1400 01:07:48,386 --> 01:07:49,010 Measure it out. 1401 01:07:49,010 --> 01:07:50,051 This is your blank space. 1402 01:07:50,051 --> 01:07:52,340 And what you're allowed-- what we will show you 1403 01:07:52,340 --> 01:07:54,980 you're allowed to do-- is either move up here 1404 01:07:54,980 --> 01:07:57,680 and move all the way over here and then up. 1405 01:07:57,680 --> 01:08:00,900 Or to move here and all the way over and then up. 1406 01:08:00,900 --> 01:08:04,742 And this star is so that the one block that's here could fit. 1407 01:08:04,742 --> 01:08:06,200 And then you can go over to this x. 1408 01:08:06,200 --> 01:08:08,324 In general, in these gadgets, the x is your target. 1409 01:08:08,324 --> 01:08:09,426 x marks the spot. 1410 01:08:09,426 --> 01:08:10,120 All right? 1411 01:08:10,120 --> 01:08:11,440 For the gadget. 1412 01:08:11,440 --> 01:08:13,320 And then there's a global x, which will 1413 01:08:13,320 --> 01:08:16,410 be at the end of the clauses. 1414 01:08:16,410 --> 01:08:17,500 So what does this do? 1415 01:08:17,500 --> 01:08:19,649 Well if you think about this connection block-- 1416 01:08:19,649 --> 01:08:21,729 this is the bipartite graph encoded 1417 01:08:21,729 --> 01:08:25,830 as a matrix-- the number of blank spaces over here 1418 01:08:25,830 --> 01:08:28,081 is exactly ni. 1419 01:08:28,081 --> 01:08:32,097 So this is why, after you push ni steps or ni bar steps, 1420 01:08:32,097 --> 01:08:32,930 you'll have to stop. 1421 01:08:32,930 --> 01:08:35,205 Because there are no blank spaces to the right of you. 1422 01:08:35,205 --> 01:08:36,830 Then the only thing you can do is go up 1423 01:08:36,830 --> 01:08:38,663 because there are no blank spaces below you. 1424 01:08:38,663 --> 01:08:41,850 So in general, these gadgets are super tight because above you 1425 01:08:41,850 --> 01:08:42,979 there's nothing. 1426 01:08:42,979 --> 01:08:43,800 It's all blocks. 1427 01:08:43,800 --> 01:08:45,759 And below you and left of you, it's all blocks. 1428 01:08:45,759 --> 01:08:46,883 There's nothing you can do. 1429 01:08:46,883 --> 01:08:48,569 You put the next variable gadget here, 1430 01:08:48,569 --> 01:08:50,979 so then that remains true. 1431 01:08:50,979 --> 01:08:52,439 In your row, and in your columns, 1432 01:08:52,439 --> 01:08:53,480 you're completely packed. 1433 01:08:53,480 --> 01:08:57,130 So the only choice you have is to do this or to do this. 1434 01:08:57,130 --> 01:09:01,350 And you will fill the row that you choose. 1435 01:09:01,350 --> 01:09:02,233 Exactly. 1436 01:09:02,233 --> 01:09:03,020 OK? 1437 01:09:03,020 --> 01:09:04,384 So that's the variable gadget. 1438 01:09:04,384 --> 01:09:07,010 AUDIENCE: What prevents you from choosing both? 1439 01:09:07,010 --> 01:09:08,649 PROFESSOR: You could choose both. 1440 01:09:08,649 --> 01:09:11,450 Or you could do a little bit of one and then do the other. 1441 01:09:11,450 --> 01:09:11,950 That's true. 1442 01:09:11,950 --> 01:09:14,033 But as we'll see, that only makes your life worse. 1443 01:09:14,033 --> 01:09:14,754 AUDIENCE: OK. 1444 01:09:14,754 --> 01:09:15,420 PROFESSOR: Yeah. 1445 01:09:15,420 --> 01:09:17,180 Good question. 1446 01:09:17,180 --> 01:09:19,319 So next, we enter the bridge gadget, 1447 01:09:19,319 --> 01:09:22,970 which is these two pictures and it looks like this. 1448 01:09:22,970 --> 01:09:25,060 This is basically a locking mechanism. 1449 01:09:25,060 --> 01:09:27,790 So you start here-- I'll just tell you're supposed to do. 1450 01:09:27,790 --> 01:09:30,380 You walk over through this blank space, 1451 01:09:30,380 --> 01:09:35,270 then you push all of these things down to here. 1452 01:09:35,270 --> 01:09:38,970 So this basically prevents you from going back 1453 01:09:38,970 --> 01:09:40,069 to where you were. 1454 01:09:40,069 --> 01:09:41,850 So you push all that down. 1455 01:09:41,850 --> 01:09:47,040 And then you go over here and you tunnel down-- 1456 01:09:47,040 --> 01:09:49,370 so I think you're moving these blocks over to here. 1457 01:09:49,370 --> 01:09:51,069 That's another kind of lock. 1458 01:09:51,069 --> 01:09:54,920 And then you're pushing this stuff down to here. 1459 01:09:54,920 --> 01:09:56,780 And then you get there. 1460 01:09:56,780 --> 01:09:59,690 So when all is said and done, this will be down here, 1461 01:09:59,690 --> 01:10:02,180 this will be down here, this will be over here. 1462 01:10:02,180 --> 01:10:04,650 And so when you're in the clause block-- again, 1463 01:10:04,650 --> 01:10:07,890 you have full rows to your left, full columns above you. 1464 01:10:07,890 --> 01:10:10,360 So there's nothing-- you can't go up and you can't go left. 1465 01:10:10,360 --> 01:10:11,880 That's the purpose of this gadget-- 1466 01:10:11,880 --> 01:10:13,740 is to connect this thing to this thing. 1467 01:10:13,740 --> 01:10:15,610 If there was a teleporter, it would be much easier. 1468 01:10:15,610 --> 01:10:17,151 We could just leave these all filled. 1469 01:10:17,151 --> 01:10:21,290 But we want to get up to here, but make sure this is all 1470 01:10:21,290 --> 01:10:22,600 filled at the end. 1471 01:10:22,600 --> 01:10:25,050 So that's the sole purpose of this gadget. 1472 01:10:25,050 --> 01:10:25,550 OK. 1473 01:10:25,550 --> 01:10:28,336 Now a clause. 1474 01:10:28,336 --> 01:10:30,910 How do we do a clause again? 1475 01:10:30,910 --> 01:10:32,840 So you have-- there's three spaces here 1476 01:10:32,840 --> 01:10:33,760 because this is 3SAT. 1477 01:10:33,760 --> 01:10:36,880 You can move down one here, and then move over two. 1478 01:10:36,880 --> 01:10:38,590 These two blocks go here. 1479 01:10:38,590 --> 01:10:40,140 And then you can get to the x. 1480 01:10:40,140 --> 01:10:43,550 Or you can go down here and over and get to the x. 1481 01:10:43,550 --> 01:10:45,830 Or you can go here and down, over. 1482 01:10:45,830 --> 01:10:48,406 And this is possible if there's a hole below you. 1483 01:10:48,406 --> 01:10:50,280 This is possible if there's a hole below you, 1484 01:10:50,280 --> 01:10:52,321 and this is possible if there's a hole below you. 1485 01:10:52,321 --> 01:10:54,410 These are aligned with these things. 1486 01:10:54,410 --> 01:10:57,000 So with exact-- I didn't quite align them, 1487 01:10:57,000 --> 01:11:00,750 but these three columns are these three columns. 1488 01:11:00,750 --> 01:11:03,990 And if one of these is unfilled, you'll 1489 01:11:03,990 --> 01:11:05,520 be able to get from here to here. 1490 01:11:05,520 --> 01:11:08,030 If they're all filled, you won't. 1491 01:11:08,030 --> 01:11:10,390 Because it will be full columns all the way down. 1492 01:11:13,070 --> 01:11:17,090 So that's a clause gadget because things 1493 01:11:17,090 --> 01:11:23,000 were filled when you chose that thing to be-- maybe 1494 01:11:23,000 --> 01:11:24,655 I-- did I get it backwards? 1495 01:11:24,655 --> 01:11:27,020 AUDIENCE: So you're really choosing the opposite. 1496 01:11:27,020 --> 01:11:27,728 PROFESSOR: Right. 1497 01:11:27,728 --> 01:11:31,726 You're choosing the thing to be not true 1498 01:11:31,726 --> 01:11:33,850 and leaving the other one to be as true as possible 1499 01:11:33,850 --> 01:11:34,960 by not pushing it. 1500 01:11:34,960 --> 01:11:37,220 So it leaves the hole so that later you can traverse-- 1501 01:11:37,220 --> 01:11:38,350 AUDIENCE: So that's why you wouldn't want to choose both. 1502 01:11:38,350 --> 01:11:38,550 PROFESSOR: Right. 1503 01:11:38,550 --> 01:11:40,100 If you chose both, that would be like making them 1504 01:11:40,100 --> 01:11:41,475 both of them not true, and so you 1505 01:11:41,475 --> 01:11:43,890 don't get any of the benefits. 1506 01:11:43,890 --> 01:11:45,220 OK? 1507 01:11:45,220 --> 01:11:47,680 That's Push-star. 1508 01:11:47,680 --> 01:11:48,180 Cool? 1509 01:11:53,840 --> 01:11:55,640 OK. 1510 01:11:55,640 --> 01:11:58,210 Let's do Push-Push-1 in 3D. 1511 01:11:58,210 --> 01:12:00,530 This is really easy. 1512 01:12:00,530 --> 01:12:02,940 This is almost like the Super Mario Brothers proof. 1513 01:12:02,940 --> 01:12:07,180 So it's just old drawing style. 1514 01:12:07,180 --> 01:12:08,930 And we've drawn sort of the dual graphs, 1515 01:12:08,930 --> 01:12:11,890 so these paths are little width-1 tunnels 1516 01:12:11,890 --> 01:12:13,284 that you can walk down. 1517 01:12:13,284 --> 01:12:15,950 So you start up here and you can either push this thing this way 1518 01:12:15,950 --> 01:12:17,410 or this way. 1519 01:12:17,410 --> 01:12:19,910 And so you're choosing which way you'll be able to traverse. 1520 01:12:19,910 --> 01:12:22,880 Either you can go the true way or the false way-- 1521 01:12:22,880 --> 01:12:25,056 the opposite of wherever you push that block. 1522 01:12:25,056 --> 01:12:26,680 And so that cuts off one of the things. 1523 01:12:26,680 --> 01:12:29,700 Then that path is going to be connected to all of the clauses 1524 01:12:29,700 --> 01:12:30,920 that it satisfies. 1525 01:12:30,920 --> 01:12:32,915 That that literal choice satisfies. 1526 01:12:32,915 --> 01:12:34,540 Then there's this gadget to prevent you 1527 01:12:34,540 --> 01:12:36,720 from wrapping around to the other side. 1528 01:12:36,720 --> 01:12:40,599 Whichever one you come down, you will block off the other path. 1529 01:12:40,599 --> 01:12:42,640 And then you do that again for the next variable, 1530 01:12:42,640 --> 01:12:43,848 the next variable, and so on. 1531 01:12:43,848 --> 01:12:45,860 At the end of the last variable, you 1532 01:12:45,860 --> 01:12:47,400 run through all the clauses. 1533 01:12:47,400 --> 01:12:48,600 So how do the clauses work? 1534 01:12:48,600 --> 01:12:50,390 Very simple. 1535 01:12:50,390 --> 01:12:54,730 If any of the literals that satisfy the clause 1536 01:12:54,730 --> 01:12:58,320 were visitable, then you could push this block over. 1537 01:12:58,320 --> 01:13:00,112 And then later, when you visit the clause-- 1538 01:13:00,112 --> 01:13:01,653 at the end, when you visit the clause 1539 01:13:01,653 --> 01:13:03,720 and try to traverse it-- if there's nothing here 1540 01:13:03,720 --> 01:13:05,126 when you push this block down, it 1541 01:13:05,126 --> 01:13:06,500 will go all the way to the bottom 1542 01:13:06,500 --> 01:13:10,580 and you're trapped, never to get to the finish line down here. 1543 01:13:10,580 --> 01:13:14,700 But if at least one of these was in, then it will block this guy 1544 01:13:14,700 --> 01:13:17,530 and you can-- if that's true for all the clauses-- 1545 01:13:17,530 --> 01:13:19,300 then you can get to the destination. 1546 01:13:19,300 --> 01:13:22,340 So these are just clause checking. 1547 01:13:22,340 --> 01:13:26,209 And that's a very straightforward 3SAT proof. 1548 01:13:26,209 --> 01:13:28,250 In fact, the previous proof is based on this one. 1549 01:13:28,250 --> 01:13:30,477 And the next proof is based on this one. 1550 01:13:30,477 --> 01:13:32,560 And the Nintendo proofs are all based on this one. 1551 01:13:32,560 --> 01:13:35,206 This is sort of the prototype. 1552 01:13:35,206 --> 01:13:35,705 Yeah. 1553 01:13:35,705 --> 01:13:37,746 AUDIENCE: Do you have the crossover gadget that-- 1554 01:13:37,746 --> 01:13:39,000 PROFESSOR: So this is 3D. 1555 01:13:39,000 --> 01:13:39,708 AUDIENCE: Oh, oh. 1556 01:13:39,708 --> 01:13:41,610 PROFESSOR: So there's no crossover. 1557 01:13:41,610 --> 01:13:43,610 But in 2D, we want to get a crossover. 1558 01:13:43,610 --> 01:13:45,850 So here's how we do 2D. 1559 01:13:45,850 --> 01:13:48,730 And this will work for both Push and Push-1-- Push 1560 01:13:48,730 --> 01:13:50,100 and Push-Push. 1561 01:13:50,100 --> 01:13:51,600 The only place we're using Push-Push 1562 01:13:51,600 --> 01:13:56,350 was this clause gadget, so let's first get rid of that aspect. 1563 01:13:56,350 --> 01:13:57,861 So here's something called a lock, 1564 01:13:57,861 --> 01:14:00,110 and you're going to have to believe a little bit here. 1565 01:14:02,730 --> 01:14:04,740 Your goal, let's say, is to get from a to b. 1566 01:14:04,740 --> 01:14:11,730 And this is what happens if you try to go from a to b directly. 1567 01:14:11,730 --> 01:14:13,610 There isn't much that you can move-- well, 1568 01:14:13,610 --> 01:14:22,600 you can maybe move i down, j left, and like this, but-- yes. 1569 01:14:22,600 --> 01:14:31,880 You can move i down, j left, e down, f left, b down, but not c 1570 01:14:31,880 --> 01:14:34,194 left, because d is in the way. 1571 01:14:34,194 --> 01:14:34,694 OK? 1572 01:14:37,870 --> 01:14:39,430 So you can't get from a to b. 1573 01:14:39,430 --> 01:14:45,449 But if you visit from u, and you push this block out of the way, 1574 01:14:45,449 --> 01:14:47,490 then you'd come back through a, then you can do-- 1575 01:14:47,490 --> 01:14:48,290 AUDIENCE: Push them over. 1576 01:14:48,290 --> 01:14:49,748 PROFESSOR: You can do these things. 1577 01:14:49,748 --> 01:14:50,590 Push them all over. 1578 01:14:50,590 --> 01:14:52,870 And then you have room to push c over, 1579 01:14:52,870 --> 01:14:55,750 and then a can go all the way down, and you're through. 1580 01:14:55,750 --> 01:14:58,980 So this unlocks the lock. 1581 01:14:58,980 --> 01:15:01,363 Then allowing a to be traversal later. 1582 01:15:01,363 --> 01:15:02,862 AUDIENCE: And going backwards from v 1583 01:15:02,862 --> 01:15:04,740 to u would lock it again? 1584 01:15:04,740 --> 01:15:05,480 PROFESSOR: No. 1585 01:15:05,480 --> 01:15:06,820 This is not a reversible gadget. 1586 01:15:06,820 --> 01:15:07,700 It only works once. 1587 01:15:07,700 --> 01:15:10,684 AUDIENCE: [INAUDIBLE]. 1588 01:15:10,684 --> 01:15:11,850 PROFESSOR: You can't unlock. 1589 01:15:11,850 --> 01:15:13,630 Once l's down, it's permanently there. 1590 01:15:16,470 --> 01:15:19,960 So now we're going to use this in a clause as follows. 1591 01:15:19,960 --> 01:15:21,460 So here's the lock and then there's 1592 01:15:21,460 --> 01:15:23,050 this schematic above it. 1593 01:15:23,050 --> 01:15:24,920 So we have three possible entries. 1594 01:15:24,920 --> 01:15:29,384 This is xi or NOT xj or xk. 1595 01:15:29,384 --> 01:15:30,800 And we're going to use this gadget 1596 01:15:30,800 --> 01:15:33,976 to say, well if you come down the true path from here, 1597 01:15:33,976 --> 01:15:35,850 you're going to have to push this block down, 1598 01:15:35,850 --> 01:15:38,450 which prevents you from using the other half of the gadget. 1599 01:15:38,450 --> 01:15:41,522 So either you move y or you move x. 1600 01:15:41,522 --> 01:15:43,730 From then on, you can only do west to south traversal 1601 01:15:43,730 --> 01:15:46,340 or only north to east traversal. 1602 01:15:46,340 --> 01:15:47,976 So it blocks the other path. 1603 01:15:47,976 --> 01:15:49,350 So this is-- because I don't want 1604 01:15:49,350 --> 01:15:51,590 to come down here, unlock the lock, 1605 01:15:51,590 --> 01:15:53,340 and then go back on a different path. 1606 01:15:53,340 --> 01:15:55,880 Because that's not something that's necessarily true. 1607 01:15:55,880 --> 01:15:57,300 So as you come down one of these, 1608 01:15:57,300 --> 01:15:59,850 you force these gadgets to be in a particular state that 1609 01:15:59,850 --> 01:16:03,720 will only let you come back the way you came-- go back 1610 01:16:03,720 --> 01:16:04,600 the way you came. 1611 01:16:04,600 --> 01:16:06,910 And then you can unlock the lock and then 1612 01:16:06,910 --> 01:16:08,500 this just connects back. 1613 01:16:08,500 --> 01:16:09,000 OK? 1614 01:16:09,000 --> 01:16:10,960 Then later, when we're checking the clauses-- 1615 01:16:10,960 --> 01:16:12,460 when we come through all the clauses 1616 01:16:12,460 --> 01:16:14,043 to make sure that they're true-- we're 1617 01:16:14,043 --> 01:16:15,903 going to route those from a to b, to a to b, 1618 01:16:15,903 --> 01:16:17,235 to a to b for all the locks. 1619 01:16:17,235 --> 01:16:18,860 And if they're all unlocked, then we'll 1620 01:16:18,860 --> 01:16:20,800 be able to traverse them, and otherwise, not. 1621 01:16:20,800 --> 01:16:23,160 That's the idea. 1622 01:16:23,160 --> 01:16:24,200 OK. 1623 01:16:24,200 --> 01:16:25,920 Then we have the issue of a crossover, 1624 01:16:25,920 --> 01:16:28,060 if we want to go into 2D. 1625 01:16:28,060 --> 01:16:34,590 So we have-- here's a basic crossover in the Push-1 model, 1626 01:16:34,590 --> 01:16:36,120 or Push-Push-1. 1627 01:16:36,120 --> 01:16:40,500 If we're going to go from north to south, then we will go-- OK. 1628 01:16:40,500 --> 01:16:42,660 We can push this down. 1629 01:16:42,660 --> 01:16:45,170 But we won't be able to go to the east then. 1630 01:16:45,170 --> 01:16:45,920 OK? 1631 01:16:45,920 --> 01:16:47,420 And we're not able to go to the west 1632 01:16:47,420 --> 01:16:49,840 because if we push this block, it gets stuck. 1633 01:16:49,840 --> 01:16:51,550 So we can go north to south, that's fine. 1634 01:16:51,550 --> 01:16:55,020 And we can also go west to east, by symmetry, essentially. 1635 01:16:55,020 --> 01:16:58,100 But you can't go from west to north or west to south, 1636 01:16:58,100 --> 01:16:59,850 or any of the other combinations. 1637 01:16:59,850 --> 01:17:01,890 This works as long as you do one or the other. 1638 01:17:04,590 --> 01:17:07,840 Once you do west to east, you can't even do north to south. 1639 01:17:07,840 --> 01:17:10,430 So that's why we call it an XOR crossover. 1640 01:17:10,430 --> 01:17:11,930 It's not what we want. 1641 01:17:11,930 --> 01:17:15,070 But if we combine things in this way, 1642 01:17:15,070 --> 01:17:18,280 we get a uni-directional crossover. 1643 01:17:18,280 --> 01:17:22,140 This is one where-- I better check my notes-- you can 1644 01:17:22,140 --> 01:17:25,810 do with one of three things. 1645 01:17:25,810 --> 01:17:29,720 You can do north to south, if you want. 1646 01:17:29,720 --> 01:17:33,450 And then you can do west to east. 1647 01:17:33,450 --> 01:17:35,567 So you could just do west to east. 1648 01:17:35,567 --> 01:17:37,650 Or you could do north to south, then west to east. 1649 01:17:37,650 --> 01:17:39,149 Or you could just do north to south. 1650 01:17:39,149 --> 01:17:40,890 Those are all possible here. 1651 01:17:40,890 --> 01:17:45,100 So when we do north to south, we prevent this particular thing 1652 01:17:45,100 --> 01:17:46,290 from being traversed. 1653 01:17:46,290 --> 01:17:49,110 But we unlock this gate, which later, when we go west to east, 1654 01:17:49,110 --> 01:17:50,900 will allow us to do it. 1655 01:17:50,900 --> 01:17:58,340 So we go here and then these are called no-reverse gadgets. 1656 01:17:58,340 --> 01:18:00,820 So once you push this block back, 1657 01:18:00,820 --> 01:18:04,480 you can never go-- this gadget becomes untraversible. 1658 01:18:04,480 --> 01:18:07,997 So you come here, you push this, push that, push that, 1659 01:18:07,997 --> 01:18:09,830 and now you can never use this gadget again. 1660 01:18:09,830 --> 01:18:11,860 So it's like a single-use thing. 1661 01:18:11,860 --> 01:18:13,010 So you can come here. 1662 01:18:13,010 --> 01:18:14,520 If you tried to do that, you would 1663 01:18:14,520 --> 01:18:16,689 get stuck because this is a lock and it 1664 01:18:16,689 --> 01:18:17,730 hasn't been unlocked yet. 1665 01:18:17,730 --> 01:18:20,780 So instead you've got to go over here, go through this thing, 1666 01:18:20,780 --> 01:18:23,710 permanently destroy it, and then unlock this gadget, 1667 01:18:23,710 --> 01:18:24,730 and then you exit. 1668 01:18:24,730 --> 01:18:26,690 So that was north to south traversal. 1669 01:18:26,690 --> 01:18:29,290 We unlocked this gate and we unlocked this gate. 1670 01:18:29,290 --> 01:18:30,710 So if you're coming west to east, 1671 01:18:30,710 --> 01:18:32,740 it could be this has been done or not. 1672 01:18:32,740 --> 01:18:36,210 So going west to east, maybe you haven't visited this gadget. 1673 01:18:36,210 --> 01:18:37,740 Then you can just go through here, 1674 01:18:37,740 --> 01:18:41,330 block off a later north to south traversal, that's OK. 1675 01:18:41,330 --> 01:18:43,480 Then come over here and leave. 1676 01:18:43,480 --> 01:18:46,620 And if you try to go here, nothing happens. 1677 01:18:46,620 --> 01:18:48,340 OK? 1678 01:18:48,340 --> 01:18:51,440 Or it could be this has already been done-- north to south-- 1679 01:18:51,440 --> 01:18:53,230 and then when you're coming from the west, 1680 01:18:53,230 --> 01:18:56,680 this has been unlocked, and so you can open this gate 1681 01:18:56,680 --> 01:18:58,840 and come through here. 1682 01:18:58,840 --> 01:19:01,760 This has already been used, so you can't go that way. 1683 01:19:01,760 --> 01:19:04,260 So instead you use this one. 1684 01:19:04,260 --> 01:19:06,830 This has already been unlocked, so you can get through. 1685 01:19:06,830 --> 01:19:08,987 And then you get out. 1686 01:19:08,987 --> 01:19:10,570 So with just a little bit of checking, 1687 01:19:10,570 --> 01:19:12,510 those are the only things you can do. 1688 01:19:12,510 --> 01:19:14,730 So when we have this diagram-- I think 1689 01:19:14,730 --> 01:19:16,690 I have one here-- variables and clauses, 1690 01:19:16,690 --> 01:19:18,856 and you connect all the variables to all the clauses 1691 01:19:18,856 --> 01:19:21,350 they're involved in-- this is a slide from lecture one, 1692 01:19:21,350 --> 01:19:24,790 but it's the same outline. 1693 01:19:24,790 --> 01:19:27,190 You know the order in which these crossings happen. 1694 01:19:27,190 --> 01:19:30,900 Because you know I'm going to visit variable i before I visit 1695 01:19:30,900 --> 01:19:33,870 variable j greater than i. 1696 01:19:33,870 --> 01:19:37,750 So I know how to order-- and each of these paths 1697 01:19:37,750 --> 01:19:40,160 is really two paths, one and then the other. 1698 01:19:40,160 --> 01:19:42,860 And so I know whether I'm going to do north 1699 01:19:42,860 --> 01:19:45,220 to south before west to east. 1700 01:19:45,220 --> 01:19:48,880 If not, I'd transpose the gadget and exchange north-south 1701 01:19:48,880 --> 01:19:50,260 with west-east. 1702 01:19:50,260 --> 01:19:52,260 And then I don't need that they're both visited. 1703 01:19:52,260 --> 01:19:53,720 I don't know which ones are going to be visited, 1704 01:19:53,720 --> 01:19:55,130 but I could do one or the other. 1705 01:19:55,130 --> 01:19:57,421 Or if I do both, I know one will come before the other. 1706 01:19:57,421 --> 01:20:00,060 So that kind of crossover gadget is enough 1707 01:20:00,060 --> 01:20:04,430 for Push-1 and Push-Push-1. 1708 01:20:04,430 --> 01:20:07,600 And it's exactly mimicking what we did with Super Mario 1709 01:20:07,600 --> 01:20:09,680 Brothers, we just had a different variable choice 1710 01:20:09,680 --> 01:20:13,690 and a different clause and a different crossover gadget. 1711 01:20:13,690 --> 01:20:15,950 But other than that, it was exactly the same. 1712 01:20:15,950 --> 01:20:18,460 The gadgets were different, but the proof structure 1713 01:20:18,460 --> 01:20:19,510 was the same. 1714 01:20:19,510 --> 01:20:22,640 And that's our beginning of 3SAT reductions. 1715 01:20:22,640 --> 01:20:25,810 We will do many more next class.