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,690 To make a donation or to view additional materials 6 00:00:12,690 --> 00:00:16,541 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:16,541 --> 00:00:17,166 at ocw.mit.edu. 8 00:00:25,865 --> 00:00:26,740 PROFESSOR: All right. 9 00:00:26,740 --> 00:00:31,244 Today we go back to fun with hardness proofs in games. 10 00:00:31,244 --> 00:00:33,660 It's been a while since we've done many games and puzzles. 11 00:00:33,660 --> 00:00:35,710 So today we're going to talk mostly 12 00:00:35,710 --> 00:00:38,480 about this one paper, which has a ton of results in it, 13 00:00:38,480 --> 00:00:41,590 by Giovanni Viglietta. 14 00:00:41,590 --> 00:00:45,000 "Gaming's a hard job, but someone has to do it!" 15 00:00:45,000 --> 00:00:47,180 What's particularly cool about this paper 16 00:00:47,180 --> 00:00:49,240 is it shows a bunch of metatheorems, 17 00:00:49,240 --> 00:00:51,860 which you can think of as general techniques for proving 18 00:00:51,860 --> 00:00:52,600 hardness. 19 00:00:52,600 --> 00:00:56,460 And I'm going to talk about essentially 20 00:00:56,460 --> 00:00:58,460 two main metatheorems, although there'll 21 00:00:58,460 --> 00:01:01,110 be a few different versions-- one for NP-hardness 22 00:01:01,110 --> 00:01:02,640 and one for PSPACE-hardness. 23 00:01:02,640 --> 00:01:04,930 And this'll be our first real PSPACE-hardness 24 00:01:04,930 --> 00:01:07,900 proof other than lecture one. 25 00:01:07,900 --> 00:01:10,360 And the proofs here aren't very hard, 26 00:01:10,360 --> 00:01:12,970 and the fun part is applying them to various games. 27 00:01:12,970 --> 00:01:15,115 And they apply to a lot of different games. 28 00:01:18,120 --> 00:01:23,015 So metatheorem we're using here in a somewhat vague sense. 29 00:01:23,015 --> 00:01:25,230 This won't be a formal theorem, because it's 30 00:01:25,230 --> 00:01:26,740 hard to state all of the assumptions 31 00:01:26,740 --> 00:01:28,190 you need about your game. 32 00:01:28,190 --> 00:01:31,660 But it's sort of-- think of it as a roughly true theorem. 33 00:01:31,660 --> 00:01:33,910 We're not going to state all the assumptions you need. 34 00:01:33,910 --> 00:01:39,130 But the general setup for metatheorem one 35 00:01:39,130 --> 00:01:43,510 is that you have a player-- or the paper calls it an avatar, 36 00:01:43,510 --> 00:01:46,690 you know, a little guy walking around. 37 00:01:46,690 --> 00:01:48,205 You're traversing a 2D environment. 38 00:01:53,290 --> 00:01:56,780 So you're not allowed to have crossovers. 39 00:01:56,780 --> 00:01:58,115 From a given start location. 40 00:02:03,600 --> 00:02:10,729 And given that setup, if you have two features in your game, 41 00:02:10,729 --> 00:02:15,610 one is called location traversal, 42 00:02:15,610 --> 00:02:17,950 and the other is called single-use paths. 43 00:02:23,920 --> 00:02:26,970 Then your game is NP-hard. 44 00:02:26,970 --> 00:02:28,970 That's the metatheorem. 45 00:02:28,970 --> 00:02:31,440 So location traversal means that there 46 00:02:31,440 --> 00:02:35,300 are some locations on the board that you have to visit in order 47 00:02:35,300 --> 00:02:36,320 to win the level. 48 00:02:36,320 --> 00:02:37,940 So there's no target location. 49 00:02:37,940 --> 00:02:39,777 Your goal is to visit all of the locations. 50 00:02:39,777 --> 00:02:41,360 Once you do that, potentially you win. 51 00:02:41,360 --> 00:02:43,026 Or maybe there is also a target location 52 00:02:43,026 --> 00:02:44,465 you have to get to at the end. 53 00:02:44,465 --> 00:02:44,965 Question? 54 00:02:44,965 --> 00:02:46,839 AUDIENCE: Does planar mean you're on a plane, 55 00:02:46,839 --> 00:02:49,134 or like a planar graph kind of environment? 56 00:02:49,134 --> 00:02:50,050 PROFESSOR: Either way. 57 00:02:50,050 --> 00:02:51,690 You could be sort of in a grid. 58 00:02:51,690 --> 00:02:53,850 You could be in a planar graph. 59 00:02:53,850 --> 00:02:55,930 It's vague. 60 00:02:55,930 --> 00:02:58,060 But the goal is two-dimensional, so the point 61 00:02:58,060 --> 00:03:01,260 is we don't need crossovers for this reduction. 62 00:03:03,940 --> 00:03:06,400 So location traversal, you have to visit certain locations. 63 00:03:06,400 --> 00:03:09,382 Single-use paths, you can only use them once. 64 00:03:09,382 --> 00:03:11,590 They're traversable, but once you traverse them once, 65 00:03:11,590 --> 00:03:14,020 they're no longer traversable. 66 00:03:14,020 --> 00:03:15,770 So from this, you can get NP-hardness. 67 00:03:15,770 --> 00:03:18,690 Any guesses how? 68 00:03:18,690 --> 00:03:19,880 What should I reduce from? 69 00:03:19,880 --> 00:03:21,060 AUDIENCE: Hamiltonian. 70 00:03:21,060 --> 00:03:22,460 PROFESSOR: Hamiltonicity, yup. 71 00:03:25,280 --> 00:03:28,357 AUDIENCE: All paths are single-use? 72 00:03:28,357 --> 00:03:28,940 PROFESSOR: No. 73 00:03:28,940 --> 00:03:32,915 Not all paths are single-use, although it will work here. 74 00:03:32,915 --> 00:03:35,040 The idea is that you mark some paths as single-use, 75 00:03:35,040 --> 00:03:37,510 others not. 76 00:03:37,510 --> 00:03:44,620 So reduction from planar, let's say, max degree three. 77 00:03:49,727 --> 00:03:50,310 Hamiltonicity. 78 00:03:55,990 --> 00:03:59,450 And so the idea is whenever I have a vertex in my Hamiltonian 79 00:03:59,450 --> 00:04:04,680 graph, I'm going to turn that into a location that 80 00:04:04,680 --> 00:04:10,030 must be traversed, because we want to visit all the vertices. 81 00:04:10,030 --> 00:04:10,770 So there you go. 82 00:04:10,770 --> 00:04:12,340 That's where to put them. 83 00:04:12,340 --> 00:04:18,329 And whenever I have an edge, I'm going to convert that 84 00:04:18,329 --> 00:04:19,630 into a single-use path. 85 00:04:23,980 --> 00:04:28,020 And because I'm maximum degree three and each of these edges 86 00:04:28,020 --> 00:04:31,010 is single-use, once I use one of the edges 87 00:04:31,010 --> 00:04:34,980 and it disappears, and then I use another edge, 88 00:04:34,980 --> 00:04:39,060 and I get the treat that was in that node, 89 00:04:39,060 --> 00:04:42,054 and then I use another edge and that disappears, 90 00:04:42,054 --> 00:04:44,220 it's a really bad idea for me to use the third edge, 91 00:04:44,220 --> 00:04:45,844 because then I'm trapped there forever. 92 00:04:45,844 --> 00:04:49,000 So I would have had to have already solved the puzzle. 93 00:04:49,000 --> 00:04:51,910 I would have had to already get all of the vertices 94 00:04:51,910 --> 00:04:53,050 before going here. 95 00:04:53,050 --> 00:04:55,550 So there was no reason to traverse that edge. 96 00:04:55,550 --> 00:04:57,890 Therefore, you're effectively doing a Hamiltonian path 97 00:04:57,890 --> 00:04:59,990 from the given start position, which 98 00:04:59,990 --> 00:05:03,190 we know how to reduce from Hamiltonian cycle. 99 00:05:03,190 --> 00:05:06,810 And because we can do planar graphs, this is planar setup, 100 00:05:06,810 --> 00:05:09,180 max degree three is critical for not 101 00:05:09,180 --> 00:05:11,700 being able to revisit a vertex. 102 00:05:11,700 --> 00:05:12,200 OK? 103 00:05:12,200 --> 00:05:14,140 We've seen a very similar proof to this back 104 00:05:14,140 --> 00:05:16,900 in the Hamiltonicity lecture, but there, the assumption 105 00:05:16,900 --> 00:05:19,930 was that there was a time limit, plus collectibles, 106 00:05:19,930 --> 00:05:23,950 plus location traversal. 107 00:05:23,950 --> 00:05:26,680 This is another way to do the same kind of proof. 108 00:05:26,680 --> 00:05:29,340 And it makes it a little easier to be convinced 109 00:05:29,340 --> 00:05:32,457 that your proofs work perfectly, because with time limits, 110 00:05:32,457 --> 00:05:33,790 you're very sensitive to timing. 111 00:05:33,790 --> 00:05:36,350 Every edge has to be exactly the same length. 112 00:05:36,350 --> 00:05:38,810 Here we're adding single-use paths 113 00:05:38,810 --> 00:05:43,360 instead of that to force you to finish the level. 114 00:05:43,360 --> 00:05:46,190 The claim is also it makes the puzzles more fun. 115 00:05:46,190 --> 00:05:48,450 So that's, of course, up to interpretation. 116 00:05:48,450 --> 00:05:50,870 But at the very least, using this proof, 117 00:05:50,870 --> 00:05:53,790 we can get a whole bunch more games that we haven't seen. 118 00:05:53,790 --> 00:05:55,840 So one of them is Boulder Dash. 119 00:05:55,840 --> 00:05:59,150 How many people have played Boulder Dash, let's say? 120 00:05:59,150 --> 00:05:59,650 Yeah. 121 00:05:59,650 --> 00:06:01,590 Only-- not very many. 122 00:06:01,590 --> 00:06:05,150 I used to play this in C64 days, Commodore 64. 123 00:06:05,150 --> 00:06:08,090 But you are walking around these boulders. 124 00:06:08,090 --> 00:06:11,310 You can hold them up, but as soon as you let go, they fall. 125 00:06:11,310 --> 00:06:12,900 And if they fall on you, you die. 126 00:06:12,900 --> 00:06:14,490 So you don't want that to happen. 127 00:06:14,490 --> 00:06:17,520 And the goal is to collect all the diamonds, roughly, 128 00:06:17,520 --> 00:06:19,570 and then to get it to a target location. 129 00:06:19,570 --> 00:06:22,540 There's some weird physics about how boulders fall. 130 00:06:22,540 --> 00:06:27,009 But basically, here are the two gadgets. 131 00:06:27,009 --> 00:06:29,050 Location traversal, you just put a diamond there, 132 00:06:29,050 --> 00:06:30,860 and then you have to get it. 133 00:06:30,860 --> 00:06:33,320 And then this is a single-use path. 134 00:06:33,320 --> 00:06:36,280 The idea is you can come from either side, 135 00:06:36,280 --> 00:06:37,510 push this out of the way. 136 00:06:37,510 --> 00:06:39,110 The boulder is then in the way. 137 00:06:39,110 --> 00:06:41,440 So if you then tried to traverse it, 138 00:06:41,440 --> 00:06:44,700 you can't turn around the corner, so you get stuck. 139 00:06:44,700 --> 00:06:45,200 OK. 140 00:06:45,200 --> 00:06:47,000 So once you have those two gadgets, 141 00:06:47,000 --> 00:06:48,470 you get an NP-hardness proof. 142 00:06:48,470 --> 00:06:51,760 So Boulder Dash is NP-hard. 143 00:06:51,760 --> 00:06:52,534 Lode Runner. 144 00:06:52,534 --> 00:06:54,200 How many people have played Lode Runner? 145 00:06:54,200 --> 00:06:55,210 A few more. 146 00:06:55,210 --> 00:06:58,660 I used to play these in, I think, 147 00:06:58,660 --> 00:07:01,760 Apple IIe days or something. 148 00:07:01,760 --> 00:07:04,490 Well, originally C64 again. 149 00:07:04,490 --> 00:07:07,030 So you have this guy who walks around, has to collect all 150 00:07:07,030 --> 00:07:09,734 the parts again, these things. 151 00:07:09,734 --> 00:07:12,150 And the fun thing about Lode Runner is you can dig a hole, 152 00:07:12,150 --> 00:07:13,410 and then the monsters fall in. 153 00:07:13,410 --> 00:07:15,800 They'll drop their diamond if they have one. 154 00:07:15,800 --> 00:07:17,540 And they might be able to climb back out. 155 00:07:17,540 --> 00:07:20,670 Eventually, that square will refill. 156 00:07:20,670 --> 00:07:22,170 So it's a timed thing. 157 00:07:22,170 --> 00:07:24,460 And so based on that kind of physics, 158 00:07:24,460 --> 00:07:26,800 we can build the two gadgets again. 159 00:07:26,800 --> 00:07:30,280 You put gold wherever you want to make the thing. 160 00:07:30,280 --> 00:07:32,786 And this is a single-traversal gadget. 161 00:07:32,786 --> 00:07:34,410 This is after it's been traversed once. 162 00:07:34,410 --> 00:07:36,069 You get stuck in the hole. 163 00:07:36,069 --> 00:07:38,610 But if there's a monster there, you can actually stand on it, 164 00:07:38,610 --> 00:07:40,180 dig the hole, let the guy fall. 165 00:07:40,180 --> 00:07:42,300 This will regenerate. 166 00:07:42,300 --> 00:07:45,530 This guy's stuck, but now you cannot traverse this thing. 167 00:07:45,530 --> 00:07:48,690 There's no jumping in this game. 168 00:07:48,690 --> 00:07:50,420 You can't jump over there. 169 00:07:50,420 --> 00:07:53,460 You have to get to the other side by falling. 170 00:07:53,460 --> 00:07:56,070 And that's only possible in the initial configuration. 171 00:07:56,070 --> 00:07:58,921 So Lode Runner's NP-hard. 172 00:07:58,921 --> 00:07:59,420 Questions? 173 00:08:02,280 --> 00:08:02,910 Cool. 174 00:08:02,910 --> 00:08:09,050 Also, Legend of Zelda II, Adventures of Link is NP-hard. 175 00:08:09,050 --> 00:08:12,061 On the one hand, we have single-use paths 176 00:08:12,061 --> 00:08:13,060 illustrated on the left. 177 00:08:13,060 --> 00:08:16,070 And location traversal we're going to do by keys. 178 00:08:16,070 --> 00:08:18,250 If you get enough keys, you can open enough doors. 179 00:08:18,250 --> 00:08:19,625 At the end of the puzzle, there's 180 00:08:19,625 --> 00:08:21,782 going to be a whole bunch of doors. 181 00:08:21,782 --> 00:08:25,500 Let me get this one going again. 182 00:08:25,500 --> 00:08:27,235 For single-traversal paths, there 183 00:08:27,235 --> 00:08:29,080 are actually these bridges that disappear 184 00:08:29,080 --> 00:08:30,970 after you traverse them. 185 00:08:30,970 --> 00:08:32,720 So you can do some amount of jumping, 186 00:08:32,720 --> 00:08:34,964 but if you make it really long, you 187 00:08:34,964 --> 00:08:38,520 will be prevented from re-traversing that path. 188 00:08:38,520 --> 00:08:41,230 So we're going to put a key at each vertex. 189 00:08:41,230 --> 00:08:43,549 And then at some finishing location, 190 00:08:43,549 --> 00:08:46,880 we'll have end doors, one for each vertex. 191 00:08:46,880 --> 00:08:50,910 And that should do Zelda II. 192 00:08:50,910 --> 00:08:51,410 OK. 193 00:08:51,410 --> 00:08:55,560 So that is metatheorem one. 194 00:08:55,560 --> 00:08:58,190 I want to tell you about a slight variation 195 00:08:58,190 --> 00:09:02,110 on this metatheorem, and then another result based on it. 196 00:09:13,990 --> 00:09:17,550 So metatheorem two is same kind of setup. 197 00:09:45,770 --> 00:09:50,421 So slightly different. 198 00:09:50,421 --> 00:09:50,920 Yeah. 199 00:09:53,902 --> 00:09:55,420 I'll keep a little bit of suspense 200 00:09:55,420 --> 00:09:57,280 about why we care about this. 201 00:09:57,280 --> 00:09:59,700 Instead of single-use paths, suppose 202 00:09:59,700 --> 00:10:04,486 that you could build tokens, which 203 00:10:04,486 --> 00:10:05,610 are things you can pick up. 204 00:10:05,610 --> 00:10:07,390 And for this reduction, let's say 205 00:10:07,390 --> 00:10:10,710 you can only pick up one at a time, though it won't matter. 206 00:10:10,710 --> 00:10:13,690 And toll roads, where you have to pay with a token in order 207 00:10:13,690 --> 00:10:16,410 to traverse the edge, this essentially 208 00:10:16,410 --> 00:10:18,590 can be used to simulate a single-use path, 209 00:10:18,590 --> 00:10:22,710 but it's a slightly different perspective in that you can 210 00:10:22,710 --> 00:10:25,625 visit an edge if you-- well, what 211 00:10:25,625 --> 00:10:28,250 we're going to imagine doing is putting tokens at the vertices, 212 00:10:28,250 --> 00:10:30,022 but just one at each vertex. 213 00:10:30,022 --> 00:10:31,730 When you pick up that token, you can then 214 00:10:31,730 --> 00:10:34,710 traverse one of the incident edges. 215 00:10:34,710 --> 00:10:39,190 So again, every edge will become a toll road. 216 00:10:41,870 --> 00:10:44,500 And every vertex will become a location traversal 217 00:10:44,500 --> 00:10:46,170 point that has to be traversed. 218 00:10:46,170 --> 00:10:49,930 And it will have one token. 219 00:10:49,930 --> 00:10:51,870 And so you can use this same kind of proof. 220 00:10:51,870 --> 00:10:53,390 It's just a different perspective 221 00:10:53,390 --> 00:10:55,900 on the same kind of thing. 222 00:10:55,900 --> 00:11:00,830 And we can use this to prove that Pac-Man is NP-hard. 223 00:11:00,830 --> 00:11:01,840 This is the motivation. 224 00:11:01,840 --> 00:11:05,060 So again, you have to get all the dots in Pac-Man. 225 00:11:05,060 --> 00:11:07,590 So you, in particular, have to get that one. 226 00:11:07,590 --> 00:11:11,680 When you get that one, this edge becomes traversable. 227 00:11:11,680 --> 00:11:14,370 So this is a somewhat generalized version of Tetris. 228 00:11:14,370 --> 00:11:17,980 You have lots of houses for the ghosts, lots of ghosts, 229 00:11:17,980 --> 00:11:19,210 obviously. 230 00:11:19,210 --> 00:11:22,210 The algorithms that the ghosts follow doesn't matter too much. 231 00:11:22,210 --> 00:11:25,020 The only constraint is that ghosts change direction 232 00:11:25,020 --> 00:11:27,670 if and only if the state changes, 233 00:11:27,670 --> 00:11:30,280 like you turn them into-- I forget the names of all 234 00:11:30,280 --> 00:11:33,030 the modes-- but you turn them into the blue mode 235 00:11:33,030 --> 00:11:35,820 or they turn back, then they will switch direction 236 00:11:35,820 --> 00:11:37,699 in their tunnel. 237 00:11:37,699 --> 00:11:39,240 And that is the only setting in which 238 00:11:39,240 --> 00:11:43,350 ghosts will reverse direction, double-back on themselves. 239 00:11:43,350 --> 00:11:45,860 They never double-back otherwise. 240 00:11:45,860 --> 00:11:48,690 And given that setup, if we make these edges really long, 241 00:11:48,690 --> 00:11:51,750 we can make sure that the ghosts always stay within their edge, 242 00:11:51,750 --> 00:11:54,800 because you're basically alternating between switching 243 00:11:54,800 --> 00:11:57,420 the state, turning the directions of the ghosts, 244 00:11:57,420 --> 00:12:00,010 traversing an edge, and then doing it again and again, 245 00:12:00,010 --> 00:12:02,382 so that the ghosts always sort of go back and forth. 246 00:12:02,382 --> 00:12:04,340 If you happen to capture one, it doesn't really 247 00:12:04,340 --> 00:12:06,048 change its location much, because it just 248 00:12:06,048 --> 00:12:07,710 goes back to the house. 249 00:12:07,710 --> 00:12:10,730 But you obviously need one of these in your possession. 250 00:12:10,730 --> 00:12:13,190 You end up using the token right away 251 00:12:13,190 --> 00:12:15,200 to traverse one of the incident edges, 252 00:12:15,200 --> 00:12:17,180 so you can actually get across. 253 00:12:17,180 --> 00:12:20,210 But it's long enough, so that by the time you cross over, 254 00:12:20,210 --> 00:12:22,520 the ghosts have reset. 255 00:12:22,520 --> 00:12:26,090 So that is metatheorem two applied to Pac-Man, 256 00:12:26,090 --> 00:12:28,330 in case you were wondering. 257 00:12:28,330 --> 00:12:31,380 This is, I think, quite clever, to get 258 00:12:31,380 --> 00:12:32,610 these things to work out. 259 00:12:32,610 --> 00:12:34,970 OK. 260 00:12:34,970 --> 00:12:37,410 NP-hardness, we're used to that. 261 00:12:37,410 --> 00:12:40,250 The next metatheorems are about PSPACE-hardness. 262 00:12:40,250 --> 00:12:43,070 And before I get there, I need to tell you 263 00:12:43,070 --> 00:12:47,220 a little bit about some basic PSPACE-hard problems. 264 00:12:47,220 --> 00:12:53,580 Like, we have SAT and Hamiltonicity for NP-hardness. 265 00:12:53,580 --> 00:12:58,820 For PSPACE-hardness, there are a couple of natural problems. 266 00:12:58,820 --> 00:13:00,330 First, let me remind you, because it 267 00:13:00,330 --> 00:13:03,110 was lecture one that I defined PSPACE, 268 00:13:03,110 --> 00:13:05,665 these are all problems solvable in polynomial space. 269 00:13:16,570 --> 00:13:19,050 And so we're measuring space instead of time. 270 00:13:19,050 --> 00:13:22,690 This is contained in exponential time, 271 00:13:22,690 --> 00:13:25,650 because there are, at most, exponentially many states 272 00:13:25,650 --> 00:13:28,600 of a polynomial space machine. 273 00:13:28,600 --> 00:13:31,100 And it contains NP. 274 00:13:31,100 --> 00:13:33,140 In particular, every NP problem can 275 00:13:33,140 --> 00:13:36,780 be simulated on a PSPACE computer 276 00:13:36,780 --> 00:13:39,080 just by trying all possible options for the guests, 277 00:13:39,080 --> 00:13:40,640 but backtracking and throwing away 278 00:13:40,640 --> 00:13:43,217 the information from the other guests' paths, 279 00:13:43,217 --> 00:13:45,300 and just keeping one bit of state, which is, did I 280 00:13:45,300 --> 00:13:48,070 find a yes solution yet? 281 00:13:48,070 --> 00:13:52,610 So you can turn any NP machine into a PSPACE machine. 282 00:13:52,610 --> 00:13:54,190 So it's somewhere in between. 283 00:13:54,190 --> 00:13:56,720 The other fun fact is that it equals 284 00:13:56,720 --> 00:13:58,485 non-deterministic polynomial space. 285 00:14:02,670 --> 00:14:04,680 So non-deterministic in the sense of NP. 286 00:14:04,680 --> 00:14:08,185 If you add guessing to a PSPACE machine, that doesn't help you. 287 00:14:08,185 --> 00:14:11,310 You can always simulate it with a deterministic machine, 288 00:14:11,310 --> 00:14:14,610 at most, blowing up the space by a square. 289 00:14:14,610 --> 00:14:17,870 So if you had SSPACE before, you have S squared space after. 290 00:14:20,720 --> 00:14:24,080 Our polynomials are closed under squaring. 291 00:14:24,080 --> 00:14:26,770 So this is especially useful for showing that a lot of games 292 00:14:26,770 --> 00:14:27,868 are in PSPACE. 293 00:14:27,868 --> 00:14:29,326 It's a lot easier, usually, to give 294 00:14:29,326 --> 00:14:32,140 a non-deterministic polynomial space algorithm. 295 00:14:32,140 --> 00:14:34,660 You have the freedom to guess whenever you like, just 296 00:14:34,660 --> 00:14:37,910 like with proving containment in NP. 297 00:14:37,910 --> 00:14:39,950 And if you prove containment in NP space, 298 00:14:39,950 --> 00:14:42,860 you are also proving containment in PSPACE. 299 00:14:42,860 --> 00:14:44,526 This is called Savage's theorem. 300 00:14:44,526 --> 00:14:45,320 OK. 301 00:14:45,320 --> 00:14:51,150 So that was just some recall from lecture one. 302 00:14:51,150 --> 00:14:55,100 And now let's talk about some sort of base 303 00:14:55,100 --> 00:14:57,790 problems, PSPACE-complete problems 304 00:14:57,790 --> 00:14:59,220 that we can reduce from. 305 00:15:08,880 --> 00:15:13,140 I would say the most obvious one is to simulate 306 00:15:13,140 --> 00:15:14,595 a polynomial space algorithm. 307 00:15:19,390 --> 00:15:21,180 You can relax it slightly to say, 308 00:15:21,180 --> 00:15:29,360 simulate a linear space algorithm or a Turing machine, 309 00:15:29,360 --> 00:15:31,270 if you prefer that. 310 00:15:31,270 --> 00:15:33,280 Of course, you are PSPACE-complete if you 311 00:15:33,280 --> 00:15:35,710 can simulate all algorithms that run in polynomial space. 312 00:15:35,710 --> 00:15:37,630 And there are some proofs that work that way. 313 00:15:37,630 --> 00:15:39,910 It takes some simple model of a computer, 314 00:15:39,910 --> 00:15:42,200 like a Turing machine, typically. 315 00:15:42,200 --> 00:15:44,601 Like your reading and writing cells on a tape. 316 00:15:44,601 --> 00:15:46,100 And you're doing whatever you can do 317 00:15:46,100 --> 00:15:48,450 in that linear amount of space. 318 00:15:48,450 --> 00:15:51,590 And just simulate those transitions one at a time. 319 00:15:51,590 --> 00:15:53,470 But it's usually pretty tedious to do that. 320 00:15:53,470 --> 00:15:55,800 I don't think we will see any proofs directly 321 00:15:55,800 --> 00:15:59,550 of simulating a Turing machine. 322 00:15:59,550 --> 00:16:06,770 Usually simpler way to go is a problem called Q SAT. 323 00:16:06,770 --> 00:16:10,100 It's actually usually called QBF, 324 00:16:10,100 --> 00:16:14,500 and sometimes called TQBF, and occasionally called Q SAT. 325 00:16:14,500 --> 00:16:16,780 But I'm growing on the name Q SAT, 326 00:16:16,780 --> 00:16:18,967 because we can specify things. 327 00:16:18,967 --> 00:16:20,800 It's consistent with our naming terminology. 328 00:16:20,800 --> 00:16:23,550 We can say Q 3SAT, and we can say Q 1-in-3SAT, 329 00:16:23,550 --> 00:16:25,680 and we can say planar Q SAT. 330 00:16:25,680 --> 00:16:29,870 Whereas QBF, usually people mean Q 3SAT, I guess. 331 00:16:29,870 --> 00:16:32,550 But this is a little more explicit what kind of SAT 332 00:16:32,550 --> 00:16:33,870 we want. 333 00:16:33,870 --> 00:16:37,700 So we're adding the letter Q, which is Quantified. 334 00:16:37,700 --> 00:16:43,900 So the general problem is, given a fully quantified Boolean 335 00:16:43,900 --> 00:16:58,710 formula, you want to decide, is it true? 336 00:17:04,109 --> 00:17:09,349 That's the T in TQBF, if you prefer that term. 337 00:17:09,349 --> 00:17:12,940 So for example, here is a quantified formula. 338 00:17:24,086 --> 00:17:25,710 It took me a little thinking to come up 339 00:17:25,710 --> 00:17:30,980 with one that is actually true and in not a quite trivial way. 340 00:17:30,980 --> 00:17:32,536 This is a 2SAT formula. 341 00:17:32,536 --> 00:17:34,160 And so in particular, you can read this 342 00:17:34,160 --> 00:17:39,350 as x implies y, and y implies x. 343 00:17:39,350 --> 00:17:40,970 And we're saying for every x, there 344 00:17:40,970 --> 00:17:42,914 is a y, such that this is satisfied. 345 00:17:42,914 --> 00:17:43,580 And that's true. 346 00:17:43,580 --> 00:17:47,589 Namely, y equals x would be the correct choice. 347 00:17:47,589 --> 00:17:49,630 But it's not totally obvious, given that formula, 348 00:17:49,630 --> 00:17:50,254 that it's true. 349 00:17:50,254 --> 00:17:52,310 And in general, given such a formula-- probably 350 00:17:52,310 --> 00:17:55,950 not with 2SAT in here, but with 3SAT formula-- 351 00:17:55,950 --> 00:17:58,760 it's going to be PSPACE-complete. 352 00:17:58,760 --> 00:18:01,520 To contrast with SAT, essentially, there 353 00:18:01,520 --> 00:18:04,610 are a bunch of There Exists at the beginning. 354 00:18:04,610 --> 00:18:07,530 With Q SAT, you can have For Alls in addition to Exists. 355 00:18:07,530 --> 00:18:11,510 That's what we're changing. 356 00:18:11,510 --> 00:18:15,090 And we can simplify things a little bit. 357 00:18:19,320 --> 00:18:24,600 We can assume a prenex form, which 358 00:18:24,600 --> 00:18:26,760 just means that all the quantifiers are 359 00:18:26,760 --> 00:18:29,510 in the beginning, and then we have a 3SAT formula, 360 00:18:29,510 --> 00:18:31,440 or whatever. 361 00:18:31,440 --> 00:18:37,310 And we can assume that the quantifiers alternate 362 00:18:37,310 --> 00:18:44,503 between For All and There Exists just by adding in extra dummies 363 00:18:44,503 --> 00:18:46,502 if we happen to use a bunch of For Alls in a row 364 00:18:46,502 --> 00:18:48,001 or a bunch of There Exists in a row. 365 00:18:48,001 --> 00:18:50,850 But really, the hard case is when you have lots of both, 366 00:18:50,850 --> 00:18:52,750 and they are interwoven. 367 00:18:52,750 --> 00:18:55,160 So it's not enough to look at formulas 368 00:18:55,160 --> 00:18:57,847 that have a bunch of For Alls and then a bunch of Exists. 369 00:18:57,847 --> 00:18:59,430 You have to think about the case where 370 00:18:59,430 --> 00:19:01,388 there are lots of alternations between the two. 371 00:19:03,560 --> 00:19:06,522 We'll talk more about that when we get to two-player games, 372 00:19:06,522 --> 00:19:08,450 because that relates to two-player games. 373 00:19:08,450 --> 00:19:11,110 But for now, we're going to stick to one-player games. 374 00:19:11,110 --> 00:19:13,690 And this is just something we need to simulate 375 00:19:13,690 --> 00:19:14,770 by our single player. 376 00:19:18,120 --> 00:19:22,470 So now the question is, what forms can this formula take? 377 00:19:22,470 --> 00:19:25,430 Because we have lots of forms of SAT that we know are hard. 378 00:19:25,430 --> 00:19:28,080 And pretty much all of them remain hard in this setting 379 00:19:28,080 --> 00:19:31,350 as well, when you add in the quantifiers. 380 00:19:31,350 --> 00:19:34,790 And in fact, there is a Schaefer-style dichotomy 381 00:19:34,790 --> 00:19:50,150 theorem, like we had with SAT and NP. 382 00:19:50,150 --> 00:19:54,150 And basically, this quantified SAT 383 00:19:54,150 --> 00:19:57,810 is polynomial if and only if the types of clauses you allow 384 00:19:57,810 --> 00:20:02,340 are all Horn clauses, or all dual-Horn clauses, 385 00:20:02,340 --> 00:20:11,660 or all 2SAT clauses, or a system of linear equalities mod 2 X 386 00:20:11,660 --> 00:20:16,060 or and x nor quality constraints. 387 00:20:16,060 --> 00:20:17,630 Those could all be solved before. 388 00:20:17,630 --> 00:20:20,390 They can still be solved in this setting in polynomial time, 389 00:20:20,390 --> 00:20:23,300 even with alternating quantifiers. 390 00:20:23,300 --> 00:20:24,910 So that's cool. 391 00:20:24,910 --> 00:20:27,810 However, it is no longer polynomial time 392 00:20:27,810 --> 00:20:30,420 if your clauses are satisfied when you set the variables all 393 00:20:30,420 --> 00:20:33,040 true or all false. 394 00:20:33,040 --> 00:20:36,380 Because we have these For All quantifiers now, being all true 395 00:20:36,380 --> 00:20:41,510 is not the panacea that it was before. 396 00:20:41,510 --> 00:20:42,500 So that's one case. 397 00:20:42,500 --> 00:20:45,150 And otherwise, you are PSPACE-complete. 398 00:20:45,150 --> 00:20:49,140 All other versions of SAT are PSPACE-complete-- sorry, 399 00:20:49,140 --> 00:20:51,430 of Q SAT. 400 00:20:51,430 --> 00:20:53,430 So it's almost the same as the Schaefer theorem, 401 00:20:53,430 --> 00:20:57,830 but there's one case that differs. 402 00:20:57,830 --> 00:21:01,230 It's hard where it wasn't before. 403 00:21:01,230 --> 00:21:07,490 So that's cool for general, from a formula perspective. 404 00:21:07,490 --> 00:21:09,030 But we, of course, typically care 405 00:21:09,030 --> 00:21:13,720 about planar bipartite graphs expressing those clauses 406 00:21:13,720 --> 00:21:15,150 and their variables. 407 00:21:15,150 --> 00:21:19,030 And good news is everything works as before. 408 00:21:19,030 --> 00:21:28,850 So planar Q SAT and planar 1-in-3 Q SAT are hard. 409 00:21:28,850 --> 00:21:31,110 Planar not all equal. 410 00:21:31,110 --> 00:21:35,890 Q SAT is also going to be easy like it was before. 411 00:21:35,890 --> 00:21:41,010 But planar Q SAT, we can use the usual crossover gadget. 412 00:21:41,010 --> 00:21:43,820 What that crossover gadget does, it 413 00:21:43,820 --> 00:21:45,370 forces some variables to be the same, 414 00:21:45,370 --> 00:21:47,100 but it also creates new variables. 415 00:21:47,100 --> 00:21:49,240 And those variables need to be quantified. 416 00:21:49,240 --> 00:21:51,590 All you need to do to simulate our old proof 417 00:21:51,590 --> 00:21:54,120 is put a whole bunch of existential quantifiers 418 00:21:54,120 --> 00:21:55,759 at the end of the quantifier list. 419 00:21:55,759 --> 00:21:57,300 So for every new variable you create, 420 00:21:57,300 --> 00:22:00,510 you put There Exists at the end for those variables. 421 00:22:00,510 --> 00:22:02,310 And we know those variables are forced 422 00:22:02,310 --> 00:22:08,010 to be equal to other copies of variables that are given to us. 423 00:22:08,010 --> 00:22:12,390 And so it stimulates the old planar SAT proof, 424 00:22:12,390 --> 00:22:13,750 but in a quantified setting. 425 00:22:13,750 --> 00:22:15,700 And that was actually done by Lichtenstein 426 00:22:15,700 --> 00:22:18,780 in the original planar SAT paper. 427 00:22:18,780 --> 00:22:22,060 It also talked about planar Q SAT. 428 00:22:22,060 --> 00:22:23,980 And then once you have this problem is hard, 429 00:22:23,980 --> 00:22:28,560 the same reaction we had for 1-in-3 Q SAT also just works. 430 00:22:28,560 --> 00:22:33,580 So with the same idea. 431 00:22:33,580 --> 00:22:35,400 So there are some base problems. 432 00:22:35,400 --> 00:22:38,730 Now we can do so reductions. 433 00:22:38,730 --> 00:22:41,470 First we'll prove a theorem. 434 00:22:41,470 --> 00:22:43,190 And then we'll apply that metatheorem 435 00:22:43,190 --> 00:22:45,730 to a bunch of different games. 436 00:22:49,600 --> 00:22:50,455 One-player games. 437 00:23:02,830 --> 00:23:08,710 So for next metatheorem, we're going to have a similar setup. 438 00:23:12,140 --> 00:23:13,910 We're traversing a planar environment. 439 00:23:16,490 --> 00:23:21,330 But this time we are given a start location 440 00:23:21,330 --> 00:23:22,110 and a destination. 441 00:23:30,420 --> 00:23:33,540 Because we're no longer going to have the location traversal 442 00:23:33,540 --> 00:23:35,970 goal, we need to add some kind of goal. 443 00:23:35,970 --> 00:23:37,970 Otherwise, you've solved the game by starting. 444 00:23:37,970 --> 00:23:39,034 [LAUGHTER] 445 00:23:39,840 --> 00:23:41,530 So it's a path traversal. 446 00:23:41,530 --> 00:23:48,680 Get from A to B. And what we're going to need 447 00:23:48,680 --> 00:23:54,400 is a door plus a pressure plate. 448 00:24:02,830 --> 00:24:06,990 So the idea is that there is an obstacle, a door, 449 00:24:06,990 --> 00:24:09,600 which is either open or closed. 450 00:24:09,600 --> 00:24:12,140 And there's a pressure plate, where 451 00:24:12,140 --> 00:24:16,740 if you step on a pressure plate marked open-- 452 00:24:16,740 --> 00:24:18,230 so you're walking along here, you 453 00:24:18,230 --> 00:24:20,945 step on this square, that will open this door 454 00:24:20,945 --> 00:24:23,050 and make it traversable. 455 00:24:23,050 --> 00:24:26,880 As you go across it, you're forced to open the door. 456 00:24:26,880 --> 00:24:30,670 And there's going to be another pressure plate marked closed, 457 00:24:30,670 --> 00:24:33,600 which, as you traverse it, you step on that plate, 458 00:24:33,600 --> 00:24:35,550 it forces the door to close. 459 00:24:35,550 --> 00:24:37,360 So in order to get to the other side here, 460 00:24:37,360 --> 00:24:40,382 usually this is in some kind of tunnel. 461 00:24:40,382 --> 00:24:42,340 So in order to get from this side to this side, 462 00:24:42,340 --> 00:24:44,130 you must close this door. 463 00:24:44,130 --> 00:24:45,480 And we have more than one. 464 00:24:45,480 --> 00:24:46,715 So there are many such doors. 465 00:24:49,770 --> 00:24:53,420 I'll say A, B, C. And this is going 466 00:24:53,420 --> 00:24:57,230 to say Open A. This is going to say Close B. 467 00:24:57,230 --> 00:24:59,490 And we can furthermore assume that there's exactly 468 00:24:59,490 --> 00:25:04,536 one open and exactly one close for each door. 469 00:25:04,536 --> 00:25:05,960 OK? 470 00:25:05,960 --> 00:25:08,400 So maybe I should have written A here. 471 00:25:08,400 --> 00:25:10,749 So this is the complete story for A. 472 00:25:10,749 --> 00:25:13,290 And there's a similar open and close for B, an open and close 473 00:25:13,290 --> 00:25:16,380 for C. And otherwise, you can just walk around. 474 00:25:16,380 --> 00:25:18,240 And your goal is to get to destinations. 475 00:25:18,240 --> 00:25:19,570 Sounds pretty simple. 476 00:25:19,570 --> 00:25:21,590 And this is a very powerful metatheorem. 477 00:25:21,590 --> 00:25:25,260 This is PSPACE-complete. 478 00:25:25,260 --> 00:25:27,130 This applies to a lot of games. 479 00:25:33,310 --> 00:25:35,670 But before I get to what games it applies to, 480 00:25:35,670 --> 00:25:40,720 let's prove that this is indeed PSPACE-complete by a reduction 481 00:25:40,720 --> 00:25:44,270 from Q 3SAT. 482 00:25:49,760 --> 00:25:54,230 We won't even need planar here. 483 00:25:54,230 --> 00:25:55,730 We won't need planar, because we can 484 00:25:55,730 --> 00:25:56,920 open doors kind of remotely. 485 00:25:56,920 --> 00:25:59,690 When I step on this button, which could be far, far away, 486 00:25:59,690 --> 00:26:00,920 I open this door. 487 00:26:00,920 --> 00:26:04,200 So effectively, the connections between variables and clauses 488 00:26:04,200 --> 00:26:06,780 can be crossing. 489 00:26:06,780 --> 00:26:08,280 There's no restriction on that here. 490 00:26:19,810 --> 00:26:23,390 So you're going to see a few different proofs like this. 491 00:26:23,390 --> 00:26:25,600 We'll see others in future lectures. 492 00:26:25,600 --> 00:26:30,170 But this is a typical prototype for how to reduce from Q3SAT. 493 00:26:30,170 --> 00:26:32,670 You have your start location, you have your finish location. 494 00:26:32,670 --> 00:26:34,580 Your goal is to traverse this thing. 495 00:26:34,580 --> 00:26:37,300 It's sort of like a circuit. 496 00:26:37,300 --> 00:26:40,180 And then you have these blocks which represent quantifiers. 497 00:26:40,180 --> 00:26:41,740 We'll talk about those in a moment. 498 00:26:41,740 --> 00:26:43,600 In the end, you exit here. 499 00:26:43,600 --> 00:26:46,330 And you have to satisfy this formula in order 500 00:26:46,330 --> 00:26:48,390 to get through. 501 00:26:48,390 --> 00:26:54,710 If you get through, then you are able to enter this quantifier 502 00:26:54,710 --> 00:26:55,980 gadget. 503 00:26:55,980 --> 00:26:57,930 And these are kind of in a nested structure. 504 00:26:57,930 --> 00:26:59,555 You can think of this quantifier gadget 505 00:26:59,555 --> 00:27:02,780 as calling this one by traversing this path. 506 00:27:02,780 --> 00:27:05,700 You're recursively calling the rest of the formula. 507 00:27:05,700 --> 00:27:07,450 And then this is sort of the return value. 508 00:27:07,450 --> 00:27:08,190 Yes, I did it. 509 00:27:08,190 --> 00:27:09,580 I succeeded, I got a yes. 510 00:27:12,240 --> 00:27:13,700 So for the existential quantifier, 511 00:27:13,700 --> 00:27:16,205 what this is essentially doing is, say, OK, I 512 00:27:16,205 --> 00:27:17,580 don't know what x is going to be, 513 00:27:17,580 --> 00:27:19,150 I'm going to let the player decide 514 00:27:19,150 --> 00:27:21,010 between two different paths. 515 00:27:21,010 --> 00:27:22,860 Set x to true or set x to false. 516 00:27:22,860 --> 00:27:25,400 So there'll be two ways to go here. 517 00:27:25,400 --> 00:27:27,960 And then you'll exit along the same path. 518 00:27:27,960 --> 00:27:30,430 But x will be set one way or the other. 519 00:27:30,430 --> 00:27:32,630 Recursively, you want that formula to be true. 520 00:27:32,630 --> 00:27:34,130 And if that happens, then the player 521 00:27:34,130 --> 00:27:36,040 will be able to come back here. 522 00:27:36,040 --> 00:27:41,920 And if you successfully set the rest of the formula to be true, 523 00:27:41,920 --> 00:27:43,670 then it means the overall formula is true, 524 00:27:43,670 --> 00:27:45,600 because you just wanted to check that there was at least one 525 00:27:45,600 --> 00:27:47,410 setting for x that made it true. 526 00:27:47,410 --> 00:27:50,360 And so this is just a direct connection. 527 00:27:50,360 --> 00:27:53,530 On the other hand, for the universal quantifier, 528 00:27:53,530 --> 00:27:54,990 this a little bit trickier. 529 00:27:54,990 --> 00:27:57,810 And it's drawn at a very high level here. 530 00:27:57,810 --> 00:28:00,740 You need to check both settings of y. 531 00:28:00,740 --> 00:28:02,500 So what you're going to end up doing 532 00:28:02,500 --> 00:28:05,530 is if you enter this gadget, you're 533 00:28:05,530 --> 00:28:10,330 first going to set y to true and exit out here. 534 00:28:10,330 --> 00:28:13,060 And then recursively, the rest better be true. 535 00:28:13,060 --> 00:28:15,380 If it is, you come back here. 536 00:28:15,380 --> 00:28:17,300 When you come back here, you mark the fact 537 00:28:17,300 --> 00:28:19,310 that you got one setting correct. 538 00:28:19,310 --> 00:28:22,450 Then you set y to false, or the other setting. 539 00:28:22,450 --> 00:28:25,220 And then you go out here again. 540 00:28:25,220 --> 00:28:27,050 And if the formula is again true, 541 00:28:27,050 --> 00:28:28,230 you'd be able to come back. 542 00:28:28,230 --> 00:28:31,850 And if you've accumulated two correct answers internal 543 00:28:31,850 --> 00:28:34,360 to this gadget, you know that the overall formula is true, 544 00:28:34,360 --> 00:28:36,670 with a universal quantifier here. 545 00:28:36,670 --> 00:28:40,280 And then you'll be able to return out to the caller. 546 00:28:40,280 --> 00:28:42,500 So that's sort of the recursive algorithm 547 00:28:42,500 --> 00:28:44,840 view of what's going on here. 548 00:28:44,840 --> 00:28:47,990 Let's do that with pressure plates. 549 00:28:47,990 --> 00:28:52,037 So it looks a little bit messy, but the idea is very simple. 550 00:28:52,037 --> 00:28:53,620 It's to implement exactly what I said. 551 00:28:53,620 --> 00:28:57,500 First, these clause gadgets, these are 3SAT clauses. 552 00:28:57,500 --> 00:29:00,290 And what we're going to do is just have three doors, 553 00:29:00,290 --> 00:29:02,889 and you have to-- this is drawn in the reverse order of what 554 00:29:02,889 --> 00:29:03,430 it should be. 555 00:29:03,430 --> 00:29:04,970 It's going right to left usually, 556 00:29:04,970 --> 00:29:07,090 but it also works in the other direction. 557 00:29:07,090 --> 00:29:10,214 If any of these doors is open, you can get to the other side. 558 00:29:10,214 --> 00:29:11,880 And in order to get through all of them, 559 00:29:11,880 --> 00:29:13,760 all the clauses must be satisfied. 560 00:29:13,760 --> 00:29:15,590 So that's the 3SAT part. 561 00:29:15,590 --> 00:29:17,630 Really easy in this setting. 562 00:29:17,630 --> 00:29:20,210 Where door open means that the variable was set true. 563 00:29:20,210 --> 00:29:25,640 In fact, we will have both an xi and an xi bar door. 564 00:29:25,640 --> 00:29:30,030 And so you use the corresponding literals there. 565 00:29:33,331 --> 00:29:33,830 Cool. 566 00:29:33,830 --> 00:29:38,660 So now this is an existential quantifier, an easier case 567 00:29:38,660 --> 00:29:40,360 to think about. 568 00:29:40,360 --> 00:29:43,730 So let's say we come in from the left, as in here. 569 00:29:43,730 --> 00:29:46,140 And that's coming into this part of the gadget. 570 00:29:46,140 --> 00:29:48,352 And we have to give the player a choice. 571 00:29:48,352 --> 00:29:50,560 They can either take the top path or the bottom path. 572 00:29:50,560 --> 00:29:53,460 Now, there's a worry that maybe you go a little bit this way 573 00:29:53,460 --> 00:29:54,340 and then double-back. 574 00:29:54,340 --> 00:29:55,839 But that's not going to be possible. 575 00:29:55,839 --> 00:29:57,900 We need to argue that. 576 00:29:57,900 --> 00:30:02,220 And negative means close, and positive means open. 577 00:30:02,220 --> 00:30:07,220 So if I come in here, the first thing I do is close the A door. 578 00:30:07,220 --> 00:30:09,640 That's going to prevent me from later coming back 579 00:30:09,640 --> 00:30:10,580 through this way. 580 00:30:10,580 --> 00:30:14,500 I can only have one door for each button. 581 00:30:14,500 --> 00:30:19,080 But I want a literal to be able to appear in many classes. 582 00:30:19,080 --> 00:30:21,580 So in fact, I'm going to have several copies of x here. 583 00:30:21,580 --> 00:30:25,020 So this is the first occurrence of x1 bar, 584 00:30:25,020 --> 00:30:27,370 and the first occurrence of x2 bar, and so on. 585 00:30:27,370 --> 00:30:29,660 I want to open all of those doors, 586 00:30:29,660 --> 00:30:34,180 so I can use individual copies of the variable up there. 587 00:30:34,180 --> 00:30:38,290 And then I'm going to close all of the positive versions of x. 588 00:30:38,290 --> 00:30:40,550 This corresponds to setting x to false. 589 00:30:40,550 --> 00:30:43,100 And then at the very end, I open the B door, 590 00:30:43,100 --> 00:30:44,350 which lets me go through here. 591 00:30:49,044 --> 00:30:50,710 The reason you can't mess up this gadget 592 00:30:50,710 --> 00:30:53,549 is if I went part way and then doubled back, 593 00:30:53,549 --> 00:30:55,090 I would immediately close the B door, 594 00:30:55,090 --> 00:30:57,040 which means I can't really exit this way, which 595 00:30:57,040 --> 00:30:59,290 means I'm going to have to go all the way through here 596 00:30:59,290 --> 00:31:01,210 and reset all of the variables. 597 00:31:01,210 --> 00:31:04,250 And this is exactly the complement of this. 598 00:31:04,250 --> 00:31:07,830 And so exactly one of these will be fully traversed. 599 00:31:07,830 --> 00:31:10,130 The other one will be nullified. 600 00:31:10,130 --> 00:31:13,370 And then that corresponds to existential quantifier. 601 00:31:13,370 --> 00:31:14,020 Question? 602 00:31:14,020 --> 00:31:16,322 AUDIENCE: The doors start in a closed state? 603 00:31:16,322 --> 00:31:18,780 PROFESSOR: Let's say all the doors start in a closed state. 604 00:31:18,780 --> 00:31:19,960 Although, I don't think-- 605 00:31:19,960 --> 00:31:22,254 AUDIENCE: Can you close things more than once? 606 00:31:22,254 --> 00:31:22,920 PROFESSOR: Yeah. 607 00:31:22,920 --> 00:31:23,760 Sorry. 608 00:31:23,760 --> 00:31:26,410 One important thing is if you click on Open when it's 609 00:31:26,410 --> 00:31:27,970 already open, nothing happens. 610 00:31:27,970 --> 00:31:29,450 If you click on Close when it's already closed, 611 00:31:29,450 --> 00:31:30,158 nothing happened. 612 00:31:30,158 --> 00:31:32,369 So you can close multiple times. 613 00:31:32,369 --> 00:31:33,660 It doesn't make it more closed. 614 00:31:33,660 --> 00:31:34,700 It's just closed. 615 00:31:34,700 --> 00:31:36,366 AUDIENCE: Stepping on the Close and then 616 00:31:36,366 --> 00:31:40,290 going back and opening B seems to work? 617 00:31:40,290 --> 00:31:42,929 PROFESSOR: So you could do some of this and then double-back. 618 00:31:42,929 --> 00:31:43,470 You're right. 619 00:31:43,470 --> 00:31:45,160 B will open up again. 620 00:31:45,160 --> 00:31:47,820 But by traversing all of these, you undo all of the things 621 00:31:47,820 --> 00:31:50,520 you did up there, because these are complementary. 622 00:31:50,520 --> 00:31:53,340 So you've fully traversed one as the last thing you did. 623 00:31:53,340 --> 00:31:55,470 That's going to be the one that sticks. 624 00:31:55,470 --> 00:31:56,000 Yeah. 625 00:31:56,000 --> 00:31:59,760 So that's pretty nice. 626 00:31:59,760 --> 00:32:03,870 And on the other hand, here is a universal quantifier. 627 00:32:03,870 --> 00:32:05,275 Not that much harder. 628 00:32:05,275 --> 00:32:06,650 But this is essentially-- there's 629 00:32:06,650 --> 00:32:09,650 one door inside here which is keeping track of, 630 00:32:09,650 --> 00:32:12,520 am I going through this for the second time? 631 00:32:12,520 --> 00:32:14,580 So in this case, there's no choice. 632 00:32:14,580 --> 00:32:16,630 We just have to try both settings. 633 00:32:16,630 --> 00:32:20,080 The first thing we do is set x to be true. 634 00:32:20,080 --> 00:32:21,450 That's this setting. 635 00:32:21,450 --> 00:32:24,710 And we also open door-- or sorry, 636 00:32:24,710 --> 00:32:26,510 we close door D. Oh, right. 637 00:32:26,510 --> 00:32:27,010 Sorry. 638 00:32:27,010 --> 00:32:29,770 Your other question is, do the doors start open or closed? 639 00:32:29,770 --> 00:32:31,270 I don't think it matters, because we 640 00:32:31,270 --> 00:32:33,860 have these close things in the beginning, essentially, 641 00:32:33,860 --> 00:32:35,597 everything gets closed at the beginning. 642 00:32:35,597 --> 00:32:37,930 So here we're going to close D, which is our final exit. 643 00:32:37,930 --> 00:32:39,096 That's where we want to get. 644 00:32:39,096 --> 00:32:41,080 So that's going to be hard. 645 00:32:41,080 --> 00:32:43,810 We have to get to the open D spot. 646 00:32:43,810 --> 00:32:45,760 Then we set x to our setting. 647 00:32:45,760 --> 00:32:49,549 Then we open A. And now we're allowed to go here. 648 00:32:49,549 --> 00:32:51,340 You could try to go this way, but it's just 649 00:32:51,340 --> 00:32:52,590 going to close a couple doors. 650 00:32:52,590 --> 00:32:54,990 So it doesn't really help you. 651 00:32:54,990 --> 00:32:57,300 So we recursively call the thing with x true. 652 00:32:57,300 --> 00:33:01,490 If it comes back with the thing being satisfied, 653 00:33:01,490 --> 00:33:03,980 we can't go through here, because D is closed. 654 00:33:03,980 --> 00:33:05,730 So we're going to have to go through here. 655 00:33:05,730 --> 00:33:07,540 We open B. We immediately go through B. 656 00:33:07,540 --> 00:33:12,750 We immediately close B. So it's like that's a one-way gadget. 657 00:33:12,750 --> 00:33:17,320 Now we set x to false, the opposite of this thing. 658 00:33:17,320 --> 00:33:19,930 And we can't go backwards, because B is closed. 659 00:33:19,930 --> 00:33:23,430 Now we open D. So if we can get through again, 660 00:33:23,430 --> 00:33:24,730 we'll be able to exit. 661 00:33:24,730 --> 00:33:27,540 We can't immediately turn back, because again, B is closed. 662 00:33:27,540 --> 00:33:31,560 We open C, visit C, close C. So another one-way gadget. 663 00:33:31,560 --> 00:33:34,210 And we also close A to prevent other weird things 664 00:33:34,210 --> 00:33:35,810 from happening. 665 00:33:35,810 --> 00:33:37,570 So now we go through again. 666 00:33:37,570 --> 00:33:41,600 If we get back with D open, then we can return and we're happy. 667 00:33:41,600 --> 00:33:45,187 And this gadget in the actual construction, keep in mind, 668 00:33:45,187 --> 00:33:46,770 what's happening here is we are making 669 00:33:46,770 --> 00:33:48,980 an exponential-length puzzle. 670 00:33:48,980 --> 00:33:51,550 The length of the solution is going to be exponential, 671 00:33:51,550 --> 00:33:53,670 because you have to try both settings of all 672 00:33:53,670 --> 00:33:55,480 the universal quantifiers. 673 00:33:55,480 --> 00:33:58,590 So any gadget is going to be visited many, many, many times. 674 00:33:58,590 --> 00:34:02,550 But each time, we're completely resetting x, resetting x again, 675 00:34:02,550 --> 00:34:03,800 and then returning. 676 00:34:03,800 --> 00:34:07,180 So we'll revisit, will reset x to true, and then 677 00:34:07,180 --> 00:34:08,940 later to false, and so on. 678 00:34:08,940 --> 00:34:11,860 But we are checking all the possible assignments for here. 679 00:34:11,860 --> 00:34:15,040 And we're letting the player non-deterministically guess 680 00:34:15,040 --> 00:34:20,159 assignment for the existential quantifiers. 681 00:34:20,159 --> 00:34:23,699 So that is pressure plates in the abstract 682 00:34:23,699 --> 00:34:25,652 PSPACE-completeness. 683 00:34:25,652 --> 00:34:27,376 AUDIENCE: Sorry for another question. 684 00:34:27,376 --> 00:34:29,909 In our usual sense of reduction, you usually 685 00:34:29,909 --> 00:34:33,564 think of a polynomial size thing that we make. 686 00:34:33,564 --> 00:34:34,230 PROFESSOR: Good. 687 00:34:34,230 --> 00:34:34,900 Yeah. 688 00:34:34,900 --> 00:34:37,870 I didn't mention it, but there are 689 00:34:37,870 --> 00:34:40,672 different notions of reductions for PSPACE-completeness. 690 00:34:40,672 --> 00:34:42,130 But for the most part, we will just 691 00:34:42,130 --> 00:34:44,110 use the same notion of reduction we did before, 692 00:34:44,110 --> 00:34:47,850 which is the running time of the reduction 693 00:34:47,850 --> 00:34:50,040 should be polynomial time. 694 00:34:50,040 --> 00:34:52,800 So here we're given a formula which is expressed 695 00:34:52,800 --> 00:34:54,940 in this kind of succinct form. 696 00:34:54,940 --> 00:34:57,980 And we're producing a level whose 697 00:34:57,980 --> 00:35:00,250 size is polynomial in that. 698 00:35:00,250 --> 00:35:05,580 Now, the actual execution of the game, 699 00:35:05,580 --> 00:35:09,070 the trace of what happens, or the certificate that 700 00:35:09,070 --> 00:35:11,150 is solvable, that has exponential length. 701 00:35:11,150 --> 00:35:12,650 But we're not talking about MP here, 702 00:35:12,650 --> 00:35:14,358 so we don't need polynomial certificates. 703 00:35:14,358 --> 00:35:17,220 But the reduction itself is polynomial. 704 00:35:17,220 --> 00:35:21,560 And again, of course, you need to preserve the yes/no answer. 705 00:35:21,560 --> 00:35:23,030 So that's our notion of reduction. 706 00:35:23,030 --> 00:35:23,530 Question? 707 00:35:23,530 --> 00:35:25,330 AUDIENCE: Is there a way to make this reduction work 708 00:35:25,330 --> 00:35:26,810 where you just have toggle plates 709 00:35:26,810 --> 00:35:30,200 rather than-- so that they're not marked with Open or Closed, 710 00:35:30,200 --> 00:35:32,630 but just change the state of the door? 711 00:35:37,297 --> 00:35:39,130 PROFESSOR: Let's come back to your question. 712 00:35:39,130 --> 00:35:41,470 I have a proof that does essentially that. 713 00:35:41,470 --> 00:35:45,140 I was wondering the same thing, but I'm not totally sure. 714 00:35:45,140 --> 00:35:49,980 So let's come back to that and try to figure out the answer. 715 00:35:49,980 --> 00:35:55,420 So this applies to many, many, many games. 716 00:35:55,420 --> 00:35:58,900 Here is an example of an RPG, one of the earliest-- 717 00:35:58,900 --> 00:35:59,830 Eye of the Beholder. 718 00:35:59,830 --> 00:36:02,150 I think it's officially DND-licensed. 719 00:36:02,150 --> 00:36:04,180 It has a small number of pressure plates. 720 00:36:04,180 --> 00:36:05,930 Here you are. 721 00:36:05,930 --> 00:36:08,784 You touch the pressure plate, and this door opens. 722 00:36:08,784 --> 00:36:09,284 Ta-da! 723 00:36:12,000 --> 00:36:14,860 We don't know to what extent these things exist, 724 00:36:14,860 --> 00:36:16,684 but reasonable to assume you have 725 00:36:16,684 --> 00:36:17,850 this kind of infrastructure. 726 00:36:17,850 --> 00:36:20,630 And then PSPACE-complete. 727 00:36:20,630 --> 00:36:24,040 Even back in the early '90s. 728 00:36:24,040 --> 00:36:27,590 A lot of first-person shooters have pressure plates. 729 00:36:27,590 --> 00:36:30,050 Doom doesn't have literal pressure plates, 730 00:36:30,050 --> 00:36:30,905 but it has triggers. 731 00:36:30,905 --> 00:36:34,060 There's like walls that if you walk through them, 732 00:36:34,060 --> 00:36:34,850 something happens. 733 00:36:34,850 --> 00:36:36,745 A block can appear, or a monster can appear. 734 00:36:36,745 --> 00:36:39,370 If you make a block appear, that will essentially close a door. 735 00:36:39,370 --> 00:36:40,869 If you make a block disappear, which 736 00:36:40,869 --> 00:36:43,040 is also possible on the general script editor, 737 00:36:43,040 --> 00:36:46,170 then you can do all this in Doom. 738 00:36:46,170 --> 00:36:48,380 Quake is the first one I know that has 739 00:36:48,380 --> 00:36:51,309 actual physical representations of a pressure plate. 740 00:36:51,309 --> 00:36:53,100 You touch this-- it's a little hard to see, 741 00:36:53,100 --> 00:36:56,320 but this drawbridge is opening. 742 00:36:56,320 --> 00:36:59,230 And a little more far. 743 00:36:59,230 --> 00:37:01,560 Adventure games. 744 00:37:01,560 --> 00:37:04,220 It's hard to define the generalization of an adventure 745 00:37:04,220 --> 00:37:07,920 game, but one definition is that there's 746 00:37:07,920 --> 00:37:10,610 an older engine for adventure games called SCUMM 747 00:37:10,610 --> 00:37:12,810 for all the old Sierra games. 748 00:37:12,810 --> 00:37:15,977 This, I think, stands for Maniac Mansion. 749 00:37:15,977 --> 00:37:17,810 That was the original game they read it for. 750 00:37:17,810 --> 00:37:21,130 But if you ever played Monkey Island or Space Quest XII, 751 00:37:21,130 --> 00:37:22,480 which that doesn't exist. 752 00:37:22,480 --> 00:37:24,070 But there was Space Quest IV where 753 00:37:24,070 --> 00:37:28,594 they time-traveled to the future and played Space Quest XII. 754 00:37:28,594 --> 00:37:30,010 It's a very good game, by the way. 755 00:37:33,010 --> 00:37:36,270 A lot of these are actually freely available now. 756 00:37:36,270 --> 00:37:38,630 And anyway, it's an engine. 757 00:37:38,630 --> 00:37:41,680 It has a very restricted set of scripting languages. 758 00:37:41,680 --> 00:37:44,160 And in particular, it lets you do, effectively, 759 00:37:44,160 --> 00:37:46,010 the style of pressure plate things, where 760 00:37:46,010 --> 00:37:47,810 if you talk to someone, then they 761 00:37:47,810 --> 00:37:50,050 make you go to a new place, and they open up 762 00:37:50,050 --> 00:37:52,680 some other traversal options, or vice versa. 763 00:37:52,680 --> 00:37:56,490 So you have to take this a little bit liberally, 764 00:37:56,490 --> 00:37:58,800 but you can essentially implement 765 00:37:58,800 --> 00:38:01,330 these kinds of things, because you have rooms. 766 00:38:01,330 --> 00:38:03,350 Here you don't even need planarity, 767 00:38:03,350 --> 00:38:05,430 and you can implement pressure plates. 768 00:38:05,430 --> 00:38:08,070 So that's cool. 769 00:38:08,070 --> 00:38:10,760 A little more literally pressure plates. 770 00:38:10,760 --> 00:38:15,950 Prince of Persia, one of the first platform PC video games, 771 00:38:15,950 --> 00:38:16,960 I guess. 772 00:38:16,960 --> 00:38:18,900 I don't know exactly the right qualifiers. 773 00:38:18,900 --> 00:38:21,119 This, I think, they even did motion capture. 774 00:38:21,119 --> 00:38:23,160 It's one of the first instances of motion capture 775 00:38:23,160 --> 00:38:26,727 for video games in the very early days of graphics. 776 00:38:26,727 --> 00:38:29,310 And you see in particular, this was a pressure plate literally 777 00:38:29,310 --> 00:38:32,360 that opens up that door. 778 00:38:32,360 --> 00:38:34,250 So that's pretty cool. 779 00:38:34,250 --> 00:38:36,860 One catch is that pressure plates-- in this game, 780 00:38:36,860 --> 00:38:40,400 you can jump, so maybe you skip a pressure plate. 781 00:38:40,400 --> 00:38:42,710 But if you put a pressure plate on the top of a ledge 782 00:38:42,710 --> 00:38:45,210 that you have to climb up, that will force you to touch it. 783 00:38:45,210 --> 00:38:48,740 So that's Prince of Persia, PSPACE-complete. 784 00:38:52,020 --> 00:38:55,200 All of these games pretty much are in PSPACE, 785 00:38:55,200 --> 00:38:58,740 because the state of the game is some polynomial space 786 00:38:58,740 --> 00:39:02,130 thing-- which things have been pressed, or opened, or closed. 787 00:39:02,130 --> 00:39:05,060 The total space of the game is usually polynomial. 788 00:39:05,060 --> 00:39:07,850 Each thing has some, at most, linear number 789 00:39:07,850 --> 00:39:08,600 of bits of states. 790 00:39:08,600 --> 00:39:11,030 So the overall thing is polynomial. 791 00:39:11,030 --> 00:39:13,827 Or I should say constant number of bits. 792 00:39:13,827 --> 00:39:14,660 That doesn't matter. 793 00:39:14,660 --> 00:39:16,480 I get to take a log. 794 00:39:16,480 --> 00:39:19,385 And so you're just traversing this giant state machine. 795 00:39:22,440 --> 00:39:24,220 To store the current state of the game 796 00:39:24,220 --> 00:39:26,270 only requires polynomial space. 797 00:39:26,270 --> 00:39:28,660 And at best, you're making a non-deterministic choice 798 00:39:28,660 --> 00:39:31,160 at each step, of whether I push this button, or that button, 799 00:39:31,160 --> 00:39:32,700 or wait. 800 00:39:32,700 --> 00:39:34,380 As long as you discretize time, you 801 00:39:34,380 --> 00:39:36,990 get an easy NPSPACE algorithm for pretty much all 802 00:39:36,990 --> 00:39:38,550 single-player video games. 803 00:39:38,550 --> 00:39:43,030 Not quite all, but all the ones I've talked about here. 804 00:39:43,030 --> 00:39:45,160 Cool. 805 00:39:45,160 --> 00:39:49,990 So that is metatheorem three. 806 00:39:49,990 --> 00:39:57,280 But this issue of having to force someone to pressure plate 807 00:39:57,280 --> 00:39:58,460 is a little bit restrictive. 808 00:39:58,460 --> 00:40:01,330 And that you can definitely get rid of. 809 00:40:01,330 --> 00:40:06,350 And this is what Giovanni calls buttons in metatheorem four. 810 00:40:32,185 --> 00:40:33,810 If instead of doors and pressure plates 811 00:40:33,810 --> 00:40:36,610 you have doors and buttons, you get PSPACE-completeness. 812 00:40:36,610 --> 00:40:38,740 Now, this is a little bit more restrictive 813 00:40:38,740 --> 00:40:49,640 in that we're going to allow a button to, let's say, 814 00:40:49,640 --> 00:40:55,890 open or close three doors. 815 00:40:55,890 --> 00:40:58,630 So pressing one button has a bulk effect. 816 00:40:58,630 --> 00:41:00,300 It affects three things at once. 817 00:41:00,300 --> 00:41:03,152 This has since been improved down to two. 818 00:41:03,152 --> 00:41:04,610 But that hasn't been published yet. 819 00:41:04,610 --> 00:41:08,720 So I am going to cover the published version, which 820 00:41:08,720 --> 00:41:10,890 is this one, where you manipulate 821 00:41:10,890 --> 00:41:13,441 three doors for every button that you press. 822 00:41:13,441 --> 00:41:15,190 And here we're drawing it with the buttons 823 00:41:15,190 --> 00:41:16,477 on the sides of the walls. 824 00:41:16,477 --> 00:41:18,560 There are many, of course, physical manifestations 825 00:41:18,560 --> 00:41:19,580 of this. 826 00:41:19,580 --> 00:41:23,000 And the proof is a reduction from pressure plates. 827 00:41:23,000 --> 00:41:24,230 Question? 828 00:41:24,230 --> 00:41:26,760 AUDIENCE: The buttons are allowed to close one door 829 00:41:26,760 --> 00:41:27,500 and open another? 830 00:41:27,500 --> 00:41:28,290 PROFESSOR: Yes. 831 00:41:28,290 --> 00:41:29,670 So you can see that here. 832 00:41:29,670 --> 00:41:31,745 One button will close some doors, open others. 833 00:41:34,415 --> 00:41:36,740 This is one gadget. 834 00:41:36,740 --> 00:41:38,220 Here's the gadget on the top-left, 835 00:41:38,220 --> 00:41:40,850 and this is a sample execution going left to right. 836 00:41:40,850 --> 00:41:44,155 This simulates a pressure plate. 837 00:41:44,155 --> 00:41:46,030 And in this case, you can enter from the left 838 00:41:46,030 --> 00:41:47,664 and go to the right, or vice versa. 839 00:41:47,664 --> 00:41:50,080 Although, in the proof, we actually only need one of those 840 00:41:50,080 --> 00:41:50,580 traversals. 841 00:41:50,580 --> 00:41:55,140 So you could just stick with the top half of the gadget. 842 00:41:55,140 --> 00:41:58,600 And the white means open, the black means closed here. 843 00:41:58,600 --> 00:42:01,460 So the initial state is supposed to be A is open, B is closed, 844 00:42:01,460 --> 00:42:02,710 C is closed. 845 00:42:02,710 --> 00:42:04,280 So you come in here. 846 00:42:04,280 --> 00:42:06,414 If you want to traverse, you have 847 00:42:06,414 --> 00:42:07,580 to hit one of these buttons. 848 00:42:07,580 --> 00:42:09,570 Let's say you hit the top one. 849 00:42:09,570 --> 00:42:11,820 And we're going to do this plus or minus 850 00:42:11,820 --> 00:42:15,580 x, which is the actual thing you wanted this pressure plate 851 00:42:15,580 --> 00:42:18,120 to do-- open or close door x. 852 00:42:18,120 --> 00:42:22,000 If this wasn't open for x, there would be a plus x here. 853 00:42:22,000 --> 00:42:23,550 But then also, we will close the door 854 00:42:23,550 --> 00:42:25,390 we just came through and open the door 855 00:42:25,390 --> 00:42:26,750 to go to the next spot. 856 00:42:26,750 --> 00:42:28,170 Then you go to the next spot. 857 00:42:28,170 --> 00:42:29,920 Let's say you press the bottom button. 858 00:42:32,760 --> 00:42:35,754 Because that opens C. And you want to go forward. 859 00:42:35,754 --> 00:42:37,170 So it's the only one that opens C. 860 00:42:37,170 --> 00:42:40,110 This one would have closed C. And we also 861 00:42:40,110 --> 00:42:43,582 closed D and opened B, which gets us to the next stage. 862 00:42:43,582 --> 00:42:45,040 And let's say we press this button, 863 00:42:45,040 --> 00:42:47,870 because this is the only one that opens D. Then we 864 00:42:47,870 --> 00:42:50,570 close C and open A. The point of that 865 00:42:50,570 --> 00:42:53,670 is to reset the gadget to its original state of open, 866 00:42:53,670 --> 00:42:55,990 closed, closed, open. 867 00:42:55,990 --> 00:43:01,070 And then along the way, we also activated x in the way 868 00:43:01,070 --> 00:43:03,480 that we wanted it to be activated. 869 00:43:03,480 --> 00:43:06,210 So that was pretty easy. 870 00:43:06,210 --> 00:43:09,980 Now we have buttons which you can press or not. 871 00:43:09,980 --> 00:43:14,240 But when you press them, it activates three things at once. 872 00:43:14,240 --> 00:43:16,470 And this also exists in many video games. 873 00:43:16,470 --> 00:43:19,110 Here were a few that I found. 874 00:43:19,110 --> 00:43:21,862 We have the original Tomb Raider, 875 00:43:21,862 --> 00:43:23,570 and I think all the Tomb Raiders probably 876 00:43:23,570 --> 00:43:26,220 have some notion of switch, which opens, in this case, 877 00:43:26,220 --> 00:43:26,820 one door. 878 00:43:26,820 --> 00:43:29,690 But you could imagine generalizing to more doors. 879 00:43:29,690 --> 00:43:31,220 We have Sonic the Hedgehog here. 880 00:43:31,220 --> 00:43:33,480 When you press that button, it opens that door. 881 00:43:33,480 --> 00:43:35,860 You can use that to simulate the same effect. 882 00:43:35,860 --> 00:43:37,722 And this game, Lost Vikings, which 883 00:43:37,722 --> 00:43:39,180 I barely remember playing, but I do 884 00:43:39,180 --> 00:43:42,330 remember in particular that the main character here 885 00:43:42,330 --> 00:43:43,445 is called Erik the Swift. 886 00:43:43,445 --> 00:43:45,780 [LAUGHTER] 887 00:43:45,780 --> 00:43:48,170 And you see him pressing a button which, in this case, 888 00:43:48,170 --> 00:43:51,060 actually opens two doors. 889 00:43:51,060 --> 00:43:53,770 So that's pretty compelling. 890 00:43:53,770 --> 00:43:55,550 And in general, tons of video-- I mean, 891 00:43:55,550 --> 00:43:58,440 almost every video game with some puzzle element 892 00:43:58,440 --> 00:43:59,500 has buttons in it. 893 00:43:59,500 --> 00:44:03,235 So now you know a ton of video games that are PSPACE-complete. 894 00:44:05,990 --> 00:44:06,490 Questions? 895 00:44:09,650 --> 00:44:10,730 All right. 896 00:44:10,730 --> 00:44:16,020 So the next metatheorem is going to be 897 00:44:16,020 --> 00:44:19,340 a specific kind of implementation 898 00:44:19,340 --> 00:44:21,800 of that same construction. 899 00:44:21,800 --> 00:44:24,610 It's more of a physical realization of a door. 900 00:44:24,610 --> 00:44:26,950 It's a door that can be opened or closed. 901 00:44:26,950 --> 00:44:30,730 And it has various ways to interact with that door. 902 00:44:30,730 --> 00:44:32,824 If it's open, you can traverse through it. 903 00:44:32,824 --> 00:44:34,490 If you go through the clause connection, 904 00:44:34,490 --> 00:44:37,274 you are forced to close the door, in which case 905 00:44:37,274 --> 00:44:38,190 you can't traverse it. 906 00:44:38,190 --> 00:44:39,410 If you go through the open connection, 907 00:44:39,410 --> 00:44:40,993 you can either just go through, or you 908 00:44:40,993 --> 00:44:43,320 can open the door if you want. 909 00:44:43,320 --> 00:44:45,815 That doesn't really-- you don't need this connection, 910 00:44:45,815 --> 00:44:48,150 but a lot of gadgets will end up doing that. 911 00:44:48,150 --> 00:44:49,650 So this is just one bit of state. 912 00:44:49,650 --> 00:44:51,820 Door is open or closed. 913 00:44:51,820 --> 00:44:54,710 And we can simulate this kind of thing, 914 00:44:54,710 --> 00:45:01,040 or simulate the previous type of pressure plates if you have 915 00:45:01,040 --> 00:45:03,390 a door, and an open pressure plate, 916 00:45:03,390 --> 00:45:04,740 and a closed pressure plate. 917 00:45:04,740 --> 00:45:09,970 We're just sort of remapping that into this gadget. 918 00:45:09,970 --> 00:45:13,410 When you go through the open traversal, 919 00:45:13,410 --> 00:45:15,750 that's just visiting here. 920 00:45:15,750 --> 00:45:18,200 And when you go through the traverse connection, 921 00:45:18,200 --> 00:45:19,640 that's going through the door. 922 00:45:19,640 --> 00:45:22,770 And when you go through the close connection, 923 00:45:22,770 --> 00:45:24,450 that's visiting that pressure plate. 924 00:45:24,450 --> 00:45:25,470 And vice versa. 925 00:45:25,470 --> 00:45:27,620 So you can take the previous reduction, 926 00:45:27,620 --> 00:45:28,929 translate it into this view. 927 00:45:28,929 --> 00:45:30,970 Of course, you're going to end up with crossings, 928 00:45:30,970 --> 00:45:32,280 and it will be kind of ugly. 929 00:45:32,280 --> 00:45:34,080 But you can do this. 930 00:45:34,080 --> 00:45:36,830 So as long as you have a crossover gadget, 931 00:45:36,830 --> 00:45:40,350 doors-- this is called a door gadget-- by themselves 932 00:45:40,350 --> 00:45:42,294 are PSPACE-complete. 933 00:45:42,294 --> 00:45:44,710 So we'll call this metatheorem five. 934 00:45:47,840 --> 00:45:51,260 I mean, this is very similar to metatheorem three, 935 00:45:51,260 --> 00:45:53,220 just like two and one were very similar. 936 00:45:53,220 --> 00:45:55,090 But just give it another name. 937 00:45:57,730 --> 00:46:04,830 Doors plus crossover are PSPACE-complete. 938 00:46:07,450 --> 00:46:09,800 So this is sort of a reinterpretation, if you will, 939 00:46:09,800 --> 00:46:12,060 of the original Viglietta paper. 940 00:46:12,060 --> 00:46:14,990 Viglietta's a co-author, but this is the Nintendo Games 941 00:46:14,990 --> 00:46:16,800 paper. 942 00:46:16,800 --> 00:46:19,230 So this is-- you can think of as a simplification 943 00:46:19,230 --> 00:46:24,100 of that previous metatheorem with pressure plates. 944 00:46:24,100 --> 00:46:27,560 And then that has been implemented in even more games 945 00:46:27,560 --> 00:46:29,940 than you've seen so far. 946 00:46:29,940 --> 00:46:31,935 So one of the first ones we did was Legend 947 00:46:31,935 --> 00:46:36,120 of Zelda-- A Link to the Past. 948 00:46:36,120 --> 00:46:39,810 So a few things going on here. 949 00:46:39,810 --> 00:46:41,650 But this is basically the door gadget. 950 00:46:41,650 --> 00:46:42,919 And then you're done. 951 00:46:42,919 --> 00:46:45,210 There are lots of ways to do crossovers in Zelda that's 952 00:46:45,210 --> 00:46:45,800 not too hard. 953 00:46:45,800 --> 00:46:49,730 We showed a hook-shot version some time ago. 954 00:46:49,730 --> 00:46:51,500 But anyway. 955 00:46:51,500 --> 00:46:54,120 So there are these notion of doors in Zelda. 956 00:46:54,120 --> 00:46:56,120 These are currently in the closed state. 957 00:46:56,120 --> 00:46:58,240 And when you walk through this in the open state, 958 00:46:58,240 --> 00:47:01,820 you'd come out on the other side. 959 00:47:01,820 --> 00:47:04,080 And so in particular, the to traversal 960 00:47:04,080 --> 00:47:06,640 is going to be whether this door is currently open. 961 00:47:06,640 --> 00:47:09,220 Now, getting back to the question, 962 00:47:09,220 --> 00:47:13,620 in Zelda-- A Link to the Past, you only have toggles. 963 00:47:13,620 --> 00:47:19,460 If I press this button, all the doors labeled one switch state. 964 00:47:19,460 --> 00:47:22,370 But you can't jump and then land on the thing again. 965 00:47:22,370 --> 00:47:24,380 In this case, you are falling down. 966 00:47:24,380 --> 00:47:25,530 The drawing isn't clear. 967 00:47:25,530 --> 00:47:29,230 This is the 2D drawing of falling down a tunnel. 968 00:47:29,230 --> 00:47:32,290 And then the only thing you can do is walk down. 969 00:47:32,290 --> 00:47:34,960 And then you hit a teleport, and you immediately go here. 970 00:47:34,960 --> 00:47:36,900 So this is one way to get traversals to work 971 00:47:36,900 --> 00:47:40,250 by preventing backtracking. 972 00:47:40,250 --> 00:47:44,340 Sorry-- getting toggles to work by preventing backtracking. 973 00:47:44,340 --> 00:47:46,785 So the intent of this gadget is there 974 00:47:46,785 --> 00:47:48,370 are doors labeled one and two. 975 00:47:48,370 --> 00:47:51,250 And it should always be exactly one of those is closed. 976 00:47:51,250 --> 00:47:56,430 Either the one is closed or the two is closed, but not both. 977 00:47:56,430 --> 00:48:01,230 And in Zelda, all the games are initially closed. 978 00:48:01,230 --> 00:48:02,890 So this is annoying. 979 00:48:02,890 --> 00:48:05,700 So we have to build this initialize gadget 980 00:48:05,700 --> 00:48:09,890 through all of these doors, where you come in here. 981 00:48:09,890 --> 00:48:12,061 This is the end. 982 00:48:12,061 --> 00:48:13,310 These are one-way teleporters. 983 00:48:13,310 --> 00:48:14,690 You can't go up here. 984 00:48:14,690 --> 00:48:17,130 So you have to go here, toggle two. 985 00:48:17,130 --> 00:48:18,640 Then go to this teleporter, go here. 986 00:48:18,640 --> 00:48:21,992 This is a block, so you have to go over this way. 987 00:48:21,992 --> 00:48:23,950 We're going to chain all these gadgets together 988 00:48:23,950 --> 00:48:26,780 through these initialize paths, so that all of the doors 989 00:48:26,780 --> 00:48:28,670 are initially in the closed state, 990 00:48:28,670 --> 00:48:32,180 with one closed and two open. 991 00:48:32,180 --> 00:48:36,140 And then there's a crystal-something 992 00:48:36,140 --> 00:48:37,570 that you break. 993 00:48:37,570 --> 00:48:39,100 And it flips. 994 00:48:39,100 --> 00:48:42,050 All of these blue blocks become these, and all of these 995 00:48:42,050 --> 00:48:42,990 become blue blocks. 996 00:48:42,990 --> 00:48:44,770 And that only happens once. 997 00:48:44,770 --> 00:48:47,340 So now, basically, the initialize paths are destroyed. 998 00:48:47,340 --> 00:48:49,185 So now think of this as being untraversable, 999 00:48:49,185 --> 00:48:51,560 and this is traversable. 1000 00:48:51,560 --> 00:48:52,140 OK? 1001 00:48:52,140 --> 00:48:55,720 So now, if the doors open, door number one is open, 1002 00:48:55,720 --> 00:48:57,110 then we can traverse it. 1003 00:48:57,110 --> 00:48:58,930 That's cool. 1004 00:48:58,930 --> 00:49:01,330 Let's look at the closed paths. 1005 00:49:01,330 --> 00:49:04,800 The closed path-- exactly one of these is going to be open. 1006 00:49:04,800 --> 00:49:07,340 So if the door was already closed, 1007 00:49:07,340 --> 00:49:09,060 that means two will be open. 1008 00:49:09,060 --> 00:49:10,110 We go down here. 1009 00:49:10,110 --> 00:49:11,740 We teleport to here. 1010 00:49:11,740 --> 00:49:16,220 And then again, because two is the only thing open, 1011 00:49:16,220 --> 00:49:19,620 we go out through the close exit. 1012 00:49:19,620 --> 00:49:23,270 On the other hand, if the door was open 1013 00:49:23,270 --> 00:49:26,140 and we're trying to close it, we have to be forced to close it. 1014 00:49:26,140 --> 00:49:27,890 And indeed, we'll go through door one. 1015 00:49:27,890 --> 00:49:29,079 Can't go through door two. 1016 00:49:29,079 --> 00:49:29,870 We'll go down here. 1017 00:49:29,870 --> 00:49:30,920 We'll toggle door one. 1018 00:49:30,920 --> 00:49:33,080 Now door one is closed. 1019 00:49:33,080 --> 00:49:33,890 And so is two. 1020 00:49:33,890 --> 00:49:37,190 We'll teleport to here. 1021 00:49:37,190 --> 00:49:38,670 Remember this is blocked now? 1022 00:49:38,670 --> 00:49:41,090 Now we're forced to switch two as well. 1023 00:49:41,090 --> 00:49:42,860 So we're effectively simulating the effect 1024 00:49:42,860 --> 00:49:47,690 of doing two doors with one choice of a thing. 1025 00:49:47,690 --> 00:49:49,570 First we flip one, then we flip two. 1026 00:49:49,570 --> 00:49:52,670 Then we teleport here. 1027 00:49:52,670 --> 00:49:54,120 One was open. 1028 00:49:54,120 --> 00:49:55,040 We flipped everything. 1029 00:49:55,040 --> 00:49:57,123 Now two is open, and we go out through the closed. 1030 00:49:57,123 --> 00:49:58,800 So in both cases, we exit through close. 1031 00:49:58,800 --> 00:49:59,300 Yeah? 1032 00:49:59,300 --> 00:50:01,350 AUDIENCE: How do you ensure that the blocks only 1033 00:50:01,350 --> 00:50:02,700 get flipped once? 1034 00:50:02,700 --> 00:50:05,878 Because the crystals can be hit as many times as you want, 1035 00:50:05,878 --> 00:50:06,790 right? 1036 00:50:06,790 --> 00:50:08,530 PROFESSOR: OK. 1037 00:50:08,530 --> 00:50:10,890 I had forgotten that detail. 1038 00:50:10,890 --> 00:50:13,680 Essentially, we want to just put a one-way gadget. 1039 00:50:13,680 --> 00:50:15,559 So when you hit the crystal-- I mean, 1040 00:50:15,559 --> 00:50:17,600 either you hit it or you don't but if you hit it, 1041 00:50:17,600 --> 00:50:19,890 then we have a cliff that you fall off of and visit 1042 00:50:19,890 --> 00:50:21,210 the rest of the game. 1043 00:50:21,210 --> 00:50:23,290 So you can't go back and flip the crystal. 1044 00:50:23,290 --> 00:50:25,470 If you don't flip the crystal, then the gadget 1045 00:50:25,470 --> 00:50:26,580 will break in other ways. 1046 00:50:26,580 --> 00:50:28,560 If you didn't flip everything, you 1047 00:50:28,560 --> 00:50:31,240 won't be able to traverse again. 1048 00:50:31,240 --> 00:50:31,810 Yeah. 1049 00:50:31,810 --> 00:50:35,760 I should have that drawn, but I don't. 1050 00:50:35,760 --> 00:50:36,319 OK. 1051 00:50:36,319 --> 00:50:37,860 So there's just one crystal, and it's 1052 00:50:37,860 --> 00:50:39,710 hidden in between the initializer 1053 00:50:39,710 --> 00:50:42,500 and the rest of the traversal. 1054 00:50:42,500 --> 00:50:44,490 OK. 1055 00:50:44,490 --> 00:50:45,810 So what haven't we done? 1056 00:50:45,810 --> 00:50:47,310 The open case. 1057 00:50:47,310 --> 00:50:49,800 So maybe we come in the open door. 1058 00:50:52,215 --> 00:50:53,840 Well, we're not going to have a choice. 1059 00:50:53,840 --> 00:50:55,050 Either it's already open. 1060 00:50:55,050 --> 00:50:57,540 Then we'll go through here, teleport to here. 1061 00:50:57,540 --> 00:51:00,360 And we can go through the one, and we're out. 1062 00:51:00,360 --> 00:51:03,920 Or it's closed, in which case two is open. 1063 00:51:03,920 --> 00:51:05,980 Then we can't go here, so we go down here. 1064 00:51:05,980 --> 00:51:08,260 We toggle one, we toggle two. 1065 00:51:08,260 --> 00:51:10,720 And then we go out here. 1066 00:51:10,720 --> 00:51:11,970 And now one is open. 1067 00:51:11,970 --> 00:51:12,980 So it's kind of cool. 1068 00:51:12,980 --> 00:51:14,371 When we're going through open, we 1069 00:51:14,371 --> 00:51:15,620 know that we'll end up opened. 1070 00:51:15,620 --> 00:51:17,424 And so we'll go out the open. 1071 00:51:17,424 --> 00:51:19,090 When we go through the closed traversal, 1072 00:51:19,090 --> 00:51:20,880 we know we will end up closed. 1073 00:51:20,880 --> 00:51:23,990 And so we will always go out the closed exit. 1074 00:51:23,990 --> 00:51:26,790 And traverse is just completely separate. 1075 00:51:26,790 --> 00:51:27,290 Cool? 1076 00:51:27,290 --> 00:51:30,620 So this is a door in Link to the Past. 1077 00:51:38,180 --> 00:51:43,200 And so that's a good example of toggles. 1078 00:51:43,200 --> 00:51:47,290 If you, again, have sufficient crossovers and so on forced, 1079 00:51:47,290 --> 00:51:50,490 I think you could argue this is more generally letting you deal 1080 00:51:50,490 --> 00:51:54,110 with toggles as long as you can, right next to a toggle, 1081 00:51:54,110 --> 00:51:56,230 put a-- after traversing it, you essentially 1082 00:51:56,230 --> 00:51:59,680 have-- say you have a one-way gadget before and after it, 1083 00:51:59,680 --> 00:52:00,710 in a certain sense. 1084 00:52:00,710 --> 00:52:02,707 Here in Zelda, there's only two levels. 1085 00:52:02,707 --> 00:52:04,540 So we can't make you fall off another cliff. 1086 00:52:04,540 --> 00:52:07,570 But it's the same thing with the teleporter. 1087 00:52:07,570 --> 00:52:10,070 We have a one-way right before it, a one-way right after it. 1088 00:52:10,070 --> 00:52:12,194 You could only hit it once, then you're essentially 1089 00:52:12,194 --> 00:52:13,710 doing toggles. 1090 00:52:13,710 --> 00:52:14,210 Cool. 1091 00:52:18,720 --> 00:52:20,930 Next one is Donkey Kong Country. 1092 00:52:20,930 --> 00:52:24,920 This is a recall of the physics of Donkey Kong. 1093 00:52:24,920 --> 00:52:27,700 You can jump around and kill enemies and stuff. 1094 00:52:27,700 --> 00:52:31,980 But the main goal is to get to a destination other than points. 1095 00:52:31,980 --> 00:52:34,360 There are these bees which kill you if you touch them. 1096 00:52:34,360 --> 00:52:36,240 There are ropes and things you can climb. 1097 00:52:36,240 --> 00:52:39,100 And there are also barrels that you can throw at things. 1098 00:52:41,700 --> 00:52:45,840 And there are three main Donkey Kong Countries, 1, 2, and 3. 1099 00:52:45,840 --> 00:52:48,630 And they each add an additional feature. 1100 00:52:48,630 --> 00:52:51,330 But none of them share that feature. 1101 00:52:51,330 --> 00:52:54,140 So there are three different PSPACE-hardness proofs, each 1102 00:52:54,140 --> 00:52:55,495 with an additional feature. 1103 00:52:58,580 --> 00:52:59,980 This is Donkey Kong Country 1. 1104 00:52:59,980 --> 00:53:01,190 Let me tell you the notation. 1105 00:53:01,190 --> 00:53:03,800 We have these bees, which are stationary. 1106 00:53:03,800 --> 00:53:06,150 So those serve as obstacles you can't touch. 1107 00:53:06,150 --> 00:53:08,410 Then there are these bees highlighted in red. 1108 00:53:08,410 --> 00:53:09,700 They're not red bees. 1109 00:53:09,700 --> 00:53:11,110 That's different. 1110 00:53:11,110 --> 00:53:15,230 But they are moving, according to this arrow. 1111 00:53:15,230 --> 00:53:18,590 So you imagine this whole thing shifting over to here, 1112 00:53:18,590 --> 00:53:20,730 and then shifting all the way over to here, 1113 00:53:20,730 --> 00:53:21,870 and back and forth. 1114 00:53:21,870 --> 00:53:24,700 And this is naturally occurring in Donkey Kong Country. 1115 00:53:24,700 --> 00:53:27,265 You have bees which have some horizontal path 1116 00:53:27,265 --> 00:53:29,110 that they traverse. 1117 00:53:29,110 --> 00:53:30,870 But we're going to generalize a little bit 1118 00:53:30,870 --> 00:53:32,744 and allow the bees to move different amounts. 1119 00:53:32,744 --> 00:53:35,140 This one only moves a little bit back and forth-- 1120 00:53:35,140 --> 00:53:37,810 I guess between here and here. 1121 00:53:37,810 --> 00:53:39,510 All right. 1122 00:53:39,510 --> 00:53:44,850 Then there's this additional feature, which is this tire. 1123 00:53:44,850 --> 00:53:48,110 And the tire, if you land on it, you basically 1124 00:53:48,110 --> 00:53:49,880 bounce back up very high. 1125 00:53:49,880 --> 00:53:51,790 And that's going to be annoying. 1126 00:53:51,790 --> 00:53:53,290 From the traversal standpoint, we're 1127 00:53:53,290 --> 00:53:54,414 going to be in this barrel. 1128 00:53:54,414 --> 00:53:56,980 It's going to shoot us-- we're forced to shoot straight down. 1129 00:53:56,980 --> 00:53:58,800 And if we hit this thing, we are basically 1130 00:53:58,800 --> 00:54:01,310 stuck in this connected component. 1131 00:54:01,310 --> 00:54:02,310 There's bees everywhere. 1132 00:54:02,310 --> 00:54:03,570 We can't get out. 1133 00:54:03,570 --> 00:54:04,070 OK? 1134 00:54:04,070 --> 00:54:07,630 On the other hand, if the tire were up here, 1135 00:54:07,630 --> 00:54:12,720 then if we shoot down, we can time it right, 1136 00:54:12,720 --> 00:54:15,360 wait for the bees to be going to the right here. 1137 00:54:15,360 --> 00:54:17,550 And then we can run down here and fall down, 1138 00:54:17,550 --> 00:54:20,010 and go through the traverse out. 1139 00:54:20,010 --> 00:54:24,010 Because of these bees, which are going to go most over to here, 1140 00:54:24,010 --> 00:54:28,300 we can't go out through the open setting from traverse. 1141 00:54:28,300 --> 00:54:30,020 But if we come from the open setting, 1142 00:54:30,020 --> 00:54:32,690 because these bees are going to go way over here, 1143 00:54:32,690 --> 00:54:36,520 we can run over and push the tire up to this position. 1144 00:54:36,520 --> 00:54:38,080 So if you land on it, you bounce. 1145 00:54:38,080 --> 00:54:42,280 But if you come from the side, you can push the tire however 1146 00:54:42,280 --> 00:54:44,050 much you want. 1147 00:54:44,050 --> 00:54:46,764 So that will be pushing it into the open state. 1148 00:54:46,764 --> 00:54:48,430 And these bees will go right up to here. 1149 00:54:48,430 --> 00:54:50,806 And that's as far as we can push it, right on that ledge. 1150 00:54:50,806 --> 00:54:52,846 Because you don't want it to fall down the ledge, 1151 00:54:52,846 --> 00:54:54,880 which also happens in Donkey Kong physics. 1152 00:54:54,880 --> 00:54:55,380 OK. 1153 00:54:55,380 --> 00:54:56,680 So that's open. 1154 00:54:56,680 --> 00:54:59,020 You don't have to open, but you can. 1155 00:54:59,020 --> 00:55:00,320 Now, close. 1156 00:55:00,320 --> 00:55:02,510 You have to close the door. 1157 00:55:02,510 --> 00:55:05,060 And this corresponds to coming through here. 1158 00:55:05,060 --> 00:55:07,710 If there was a tire here, if we were in the open state, 1159 00:55:07,710 --> 00:55:11,400 we have to push the tire off of the edge here. 1160 00:55:11,400 --> 00:55:14,680 And then it will roll down to that position. 1161 00:55:14,680 --> 00:55:18,130 And if we time it right, the bees will be right over here. 1162 00:55:18,130 --> 00:55:19,520 And then we can jump around. 1163 00:55:19,520 --> 00:55:21,124 You can climb the rope. 1164 00:55:21,124 --> 00:55:23,290 And if you're really fast, you're climbing the rope. 1165 00:55:23,290 --> 00:55:25,684 And these bees are really slow, rather. 1166 00:55:25,684 --> 00:55:26,600 Then you go over here. 1167 00:55:26,600 --> 00:55:27,724 This might not be to scale. 1168 00:55:27,724 --> 00:55:29,475 Maybe you want to widen the section here, 1169 00:55:29,475 --> 00:55:31,350 so that you have more time to climb the rope. 1170 00:55:31,350 --> 00:55:34,020 But that's just constant factors. 1171 00:55:34,020 --> 00:55:36,370 Either you allow me to slow down bees, 1172 00:55:36,370 --> 00:55:39,670 or you stretch this diagram a little bit. 1173 00:55:39,670 --> 00:55:40,170 OK? 1174 00:55:40,170 --> 00:55:40,980 So that's close. 1175 00:55:40,980 --> 00:55:42,396 In order to get from here to here, 1176 00:55:42,396 --> 00:55:44,215 you must push the tire off the edge. 1177 00:55:44,215 --> 00:55:45,840 And then it will roll to exactly there, 1178 00:55:45,840 --> 00:55:47,760 preventing you from traversal. 1179 00:55:47,760 --> 00:55:49,350 So that's a door. 1180 00:55:49,350 --> 00:55:52,370 Donkey Kong Country 1 is PSPACE-complete. 1181 00:55:52,370 --> 00:55:53,830 What about Donkey Kong Country 2? 1182 00:55:53,830 --> 00:55:55,420 It has no tires. 1183 00:55:55,420 --> 00:55:58,580 But it has the balloon. 1184 00:55:58,580 --> 00:56:04,340 The balloon-- normally, balloons go down, 1185 00:56:04,340 --> 00:56:06,600 as you might know, from gravity. 1186 00:56:06,600 --> 00:56:08,990 But if you have these air currents, 1187 00:56:08,990 --> 00:56:11,940 the balloon will rise. 1188 00:56:11,940 --> 00:56:13,890 And when you're on the balloon, you 1189 00:56:13,890 --> 00:56:15,760 can use it as sort of a ledge. 1190 00:56:15,760 --> 00:56:17,620 It may still go down, but you can 1191 00:56:17,620 --> 00:56:20,142 control whether it falls to the left or to the right, 1192 00:56:20,142 --> 00:56:21,600 according to whether you press left 1193 00:56:21,600 --> 00:56:24,440 or right on the controller. 1194 00:56:24,440 --> 00:56:28,200 So this is actually the closed state. 1195 00:56:28,200 --> 00:56:30,390 Again, there are these bees. 1196 00:56:30,390 --> 00:56:31,560 They're moving a little bit. 1197 00:56:31,560 --> 00:56:33,646 But if you time it right, you can get down here. 1198 00:56:33,646 --> 00:56:35,270 But if you land on the balloon, there's 1199 00:56:35,270 --> 00:56:36,690 no way to get beyond this barrel. 1200 00:56:36,690 --> 00:56:39,470 And so you're stuck. 1201 00:56:39,470 --> 00:56:40,900 If the balloon is out of the way, 1202 00:56:40,900 --> 00:56:43,550 it will end up being here at position A. 1203 00:56:43,550 --> 00:56:46,330 Then when you shoot from this barrel, 1204 00:56:46,330 --> 00:56:48,910 you end up in this barrel, and you get to traverse out. 1205 00:56:48,910 --> 00:56:50,030 So that's good. 1206 00:56:50,030 --> 00:56:52,265 Again, these barrels is a forced shot. 1207 00:56:52,265 --> 00:56:56,280 So you can't make any decision at those types of barrels. 1208 00:56:56,280 --> 00:56:57,030 OK. 1209 00:56:57,030 --> 00:56:58,340 Good. 1210 00:56:58,340 --> 00:57:03,080 So the idea with the open clause is that there's 1211 00:57:03,080 --> 00:57:04,400 a little bit of rope here. 1212 00:57:04,400 --> 00:57:06,409 So you would climb this rope, jump. 1213 00:57:06,409 --> 00:57:08,450 When the bees are over to the right a little bit, 1214 00:57:08,450 --> 00:57:10,530 they get over to here. 1215 00:57:10,530 --> 00:57:14,290 Then go on this balloon, push it over to the left 1216 00:57:14,290 --> 00:57:20,020 here, and then jump back out, and grab the rope, and leave. 1217 00:57:20,020 --> 00:57:22,270 And if you get the balloon to here, 1218 00:57:22,270 --> 00:57:26,140 it will settle to this position, so that you've successfully 1219 00:57:26,140 --> 00:57:28,520 opened the gadget even though you couldn't get here 1220 00:57:28,520 --> 00:57:30,370 from there. 1221 00:57:30,370 --> 00:57:32,960 On the other hand, the close is going 1222 00:57:32,960 --> 00:57:34,370 to force you to reset that. 1223 00:57:34,370 --> 00:57:37,890 So we get shot over this way, shot down here. 1224 00:57:37,890 --> 00:57:39,890 Now, it could be we just get shot, shot, shot, 1225 00:57:39,890 --> 00:57:40,890 and we're out. 1226 00:57:40,890 --> 00:57:45,770 But if there was a balloon here, we will land on it. 1227 00:57:45,770 --> 00:57:48,790 In order to get to this barrel or the next one, 1228 00:57:48,790 --> 00:57:50,770 we have to push the balloon over. 1229 00:57:50,770 --> 00:57:54,530 Then we can go here or go here. 1230 00:57:54,530 --> 00:57:57,444 And we'll end up getting shot to this position and out. 1231 00:57:57,444 --> 00:57:58,860 But because of these air currents, 1232 00:57:58,860 --> 00:58:04,530 the balloon will go up to here in Donkey Kong physics. 1233 00:58:04,530 --> 00:58:06,070 And so when you do close, you are 1234 00:58:06,070 --> 00:58:08,150 forced to put the balloon back here, which 1235 00:58:08,150 --> 00:58:10,010 is annoying for traversal. 1236 00:58:10,010 --> 00:58:12,120 So that's a door. 1237 00:58:12,120 --> 00:58:12,620 Question? 1238 00:58:12,620 --> 00:58:14,893 AUDIENCE: Is there any reason you need the [INAUDIBLE] 1239 00:58:14,893 --> 00:58:15,392 at the top? 1240 00:58:17,829 --> 00:58:19,370 PROFESSOR: Why do we need this exact? 1241 00:58:19,370 --> 00:58:21,340 I don't remember. 1242 00:58:21,340 --> 00:58:24,570 I was wondering that as well. 1243 00:58:24,570 --> 00:58:25,880 Yeah. 1244 00:58:25,880 --> 00:58:28,651 What it does do is force a particular sort of timing 1245 00:58:28,651 --> 00:58:30,900 maybe, about whether it's to the left or to the right. 1246 00:58:30,900 --> 00:58:33,887 But not sure. 1247 00:58:33,887 --> 00:58:34,970 I'll bet there's a reason. 1248 00:58:37,827 --> 00:58:39,410 But this figure was drawn by Giovanni. 1249 00:58:42,080 --> 00:58:42,580 Cool. 1250 00:58:42,580 --> 00:58:44,080 What about Donkey Kong Country 3? 1251 00:58:44,080 --> 00:58:48,440 Well, Donkey Kong Country 3 has neither balloons nor tires, 1252 00:58:48,440 --> 00:58:52,800 but it has tracking barrels, with a T on it. 1253 00:58:52,800 --> 00:58:57,320 So tracking barrels, if you land in one, 1254 00:58:57,320 --> 00:59:00,460 you can then slide it left or right. 1255 00:59:00,460 --> 00:59:05,230 And when you leave it, you always get shot up. 1256 00:59:05,230 --> 00:59:09,190 And even if you jump out and then, say, go over here 1257 00:59:09,190 --> 00:59:11,720 and fall, the tracking barrel tracks you. 1258 00:59:11,720 --> 00:59:14,307 So if you're coming from traversal 1259 00:59:14,307 --> 00:59:16,640 and you get shot down here, if the tracking barrel's out 1260 00:59:16,640 --> 00:59:18,940 of the way, then I traverse. 1261 00:59:18,940 --> 00:59:23,039 Then I'm forced to go down here and leave via the close exit, 1262 00:59:23,039 --> 00:59:24,080 which is not what I want. 1263 00:59:24,080 --> 00:59:26,602 I want to leave according to the traversal exit. 1264 00:59:26,602 --> 00:59:28,060 Now, this has some leakage, but you 1265 00:59:28,060 --> 00:59:30,270 can show this leakage is OK. 1266 00:59:30,270 --> 00:59:33,090 You can go from traverse in to close out. 1267 00:59:33,090 --> 00:59:35,289 But that won't end up helping you, 1268 00:59:35,289 --> 00:59:37,830 because you were already close, so you knew you could already 1269 00:59:37,830 --> 00:59:39,630 get to close out. 1270 00:59:39,630 --> 00:59:43,270 So this is the closed state when the tracker barrel's over here. 1271 00:59:43,270 --> 00:59:44,800 This is the open state. 1272 00:59:44,800 --> 00:59:47,091 When we're in the open state, we come through traverse. 1273 00:59:47,091 --> 00:59:48,425 We can jump out and leave here. 1274 00:59:48,425 --> 00:59:50,810 So that's good. 1275 00:59:50,810 --> 00:59:56,760 On the other hand, if we come via the open position, 1276 00:59:56,760 --> 00:59:59,990 we can go get shot down here. 1277 00:59:59,990 --> 01:00:01,800 And if the barrel was there, we're 1278 01:00:01,800 --> 01:00:03,349 going to have to move it over here. 1279 01:00:03,349 --> 01:00:04,390 I guess we don't have to. 1280 01:00:04,390 --> 01:00:05,390 We could leave it there. 1281 01:00:05,390 --> 01:00:07,190 But we are able to bring the barrel over 1282 01:00:07,190 --> 01:00:08,800 here and leave through open. 1283 01:00:08,800 --> 01:00:10,650 And now we're in the open state. 1284 01:00:10,650 --> 01:00:12,260 That's good. 1285 01:00:12,260 --> 01:00:15,360 On the other hand, if we come from close, 1286 01:00:15,360 --> 01:00:19,290 if it's currently open, we will be shot into the barrel. 1287 01:00:19,290 --> 01:00:21,230 And then to get over here, we have 1288 01:00:21,230 --> 01:00:23,370 to bring the barrel over here, putting it 1289 01:00:23,370 --> 01:00:25,680 into the close state. 1290 01:00:25,680 --> 01:00:29,910 Now, this is the relevant part, where the tracking hurts you. 1291 01:00:29,910 --> 01:00:30,550 You go in here. 1292 01:00:30,550 --> 01:00:33,530 You'd like to just jump out and get out here, 1293 01:00:33,530 --> 01:00:36,380 but because it's a tracking barrel, if you jump out here, 1294 01:00:36,380 --> 01:00:39,580 the barrel will come over anyway even though you don't go back 1295 01:00:39,580 --> 01:00:40,540 into it. 1296 01:00:40,540 --> 01:00:43,020 So if you leave through the close exit, 1297 01:00:43,020 --> 01:00:45,170 you have to bring the barrel over to the right. 1298 01:00:45,170 --> 01:00:49,272 So that forces the clothes, preventing traversal. 1299 01:00:49,272 --> 01:00:50,480 That's Donkey Kong Country 3. 1300 01:00:55,530 --> 01:01:01,560 But there's one Nintendo game that rules them all, 1301 01:01:01,560 --> 01:01:03,940 and that is Super Mario Bros. 1302 01:01:03,940 --> 01:01:07,805 And for the first time, we are announcing 1303 01:01:07,805 --> 01:01:12,120 a PSPACE-completeness result for Super Mario Bros. 1304 01:01:12,120 --> 01:01:15,710 So the Nintendo paper and another paper 1305 01:01:15,710 --> 01:01:19,370 by Giovanni, which I will talk about next, 1306 01:01:19,370 --> 01:01:22,900 was prevented at Fun with Algorithms earlier this summer. 1307 01:01:22,900 --> 01:01:25,860 Two people were there. 1308 01:01:25,860 --> 01:01:28,325 And then we started talking, oh, we 1309 01:01:28,325 --> 01:01:31,000 should really prove Mario Bros. is also a PSPACE-complete. 1310 01:01:31,000 --> 01:01:34,510 So this is our current reduction. 1311 01:01:34,510 --> 01:01:37,060 You may recall another crossover gadget 1312 01:01:37,060 --> 01:01:40,460 that involved invincibility stars, or mushrooms, 1313 01:01:40,460 --> 01:01:41,224 or something. 1314 01:01:41,224 --> 01:01:42,140 Those are consumables. 1315 01:01:42,140 --> 01:01:44,830 We can't afford consumables in a PSPACE reduction, 1316 01:01:44,830 --> 01:01:47,030 because we have to visit the same thing many times. 1317 01:01:47,030 --> 01:01:50,950 But using Mario physics, we designed this crossover. 1318 01:01:50,950 --> 01:01:54,210 You're going to be small Mario throughout this reduction. 1319 01:01:54,210 --> 01:01:58,440 If you come up here and you run, you will fall here. 1320 01:01:58,440 --> 01:02:00,690 And if you come over there, you run, you'll fall here. 1321 01:02:00,690 --> 01:02:02,740 But you can't jump around and land here. 1322 01:02:02,740 --> 01:02:03,740 You'll end up down here. 1323 01:02:03,740 --> 01:02:06,671 And that's larger than your jump distance. 1324 01:02:06,671 --> 01:02:07,170 OK? 1325 01:02:07,170 --> 01:02:09,790 So as long as you can't glitch through walls, 1326 01:02:09,790 --> 01:02:12,780 this is a valid crossover and it's reusable. 1327 01:02:12,780 --> 01:02:13,907 It's a one-way crossover. 1328 01:02:13,907 --> 01:02:15,240 You can only go from up to down. 1329 01:02:18,520 --> 01:02:19,990 OK. 1330 01:02:19,990 --> 01:02:20,975 Now the door. 1331 01:02:20,975 --> 01:02:23,430 The door's a little bit weird. 1332 01:02:23,430 --> 01:02:27,520 But it has actually been built by modifying the Super Mario 1333 01:02:27,520 --> 01:02:28,020 Bros. 1334 01:02:28,020 --> 01:02:35,680 ROM, so it does exist in the physics of the real Mario. 1335 01:02:35,680 --> 01:02:39,240 This doesn't have to be length, but this is a fire bar, 1336 01:02:39,240 --> 01:02:40,484 which is normally rotating. 1337 01:02:40,484 --> 01:02:42,400 But if it has size one, then it doesn't really 1338 01:02:42,400 --> 01:02:43,850 do much rotating. 1339 01:02:43,850 --> 01:02:45,850 So these are things you're not allowed to touch. 1340 01:02:49,750 --> 01:02:52,660 The version we implemented has fire bars. 1341 01:02:52,660 --> 01:02:53,840 Those do exist in the ROM. 1342 01:02:53,840 --> 01:02:56,570 But even if you have fire bars that are much bigger, 1343 01:02:56,570 --> 01:02:59,153 you can still do all the things you need to do in this gadget. 1344 01:02:59,153 --> 01:03:01,490 It's just a lot harder to do correctly. 1345 01:03:01,490 --> 01:03:02,740 I was trying it earlier today. 1346 01:03:02,740 --> 01:03:05,050 [LAUGHTER] 1347 01:03:05,050 --> 01:03:07,069 And then we have this guy. 1348 01:03:07,069 --> 01:03:09,110 I forget what they're called, but they're dropped 1349 01:03:09,110 --> 01:03:10,891 by the cloud thing in the sky. 1350 01:03:10,891 --> 01:03:13,140 You can also create them at the beginning of the level 1351 01:03:13,140 --> 01:03:16,420 even though that doesn't appear in the true levels. 1352 01:03:16,420 --> 01:03:19,976 You can make a new level that has these guys initially. 1353 01:03:19,976 --> 01:03:22,350 It'll just be the case that there's also a cloud floating 1354 01:03:22,350 --> 01:03:23,710 around at the top. 1355 01:03:23,710 --> 01:03:26,390 But if you shield from that, you're OK. 1356 01:03:26,390 --> 01:03:28,850 So there's one of these guys, and he can basically 1357 01:03:28,850 --> 01:03:33,860 be walking back and forth here or over here. 1358 01:03:33,860 --> 01:03:36,150 And you can flip that by if you hit 1359 01:03:36,150 --> 01:03:39,330 this block with the right timing, 1360 01:03:39,330 --> 01:03:42,540 this guy will end up bouncing and walking over here. 1361 01:03:42,540 --> 01:03:43,109 And practice. 1362 01:03:43,109 --> 01:03:44,400 You have to hit it a few times. 1363 01:03:44,400 --> 01:03:46,224 Sometimes he'll walk back over. 1364 01:03:46,224 --> 01:03:48,390 But if you get the direction that he's facing right, 1365 01:03:48,390 --> 01:03:50,050 he'll jump up and then keep going. 1366 01:03:50,050 --> 01:03:52,530 And then he'll be over in the other side. 1367 01:03:52,530 --> 01:03:53,292 OK. 1368 01:03:53,292 --> 01:03:55,000 But you can't just reach everything here. 1369 01:03:55,000 --> 01:03:58,012 If you are on the open side, you can hit him if you want 1370 01:03:58,012 --> 01:03:58,970 and put him over there. 1371 01:03:58,970 --> 01:04:01,600 That's going to be the open setting. 1372 01:04:01,600 --> 01:04:04,497 The traversal requires you to go through this way 1373 01:04:04,497 --> 01:04:06,080 without the ability to hit this thing. 1374 01:04:06,080 --> 01:04:09,810 And so if the spiny guy is over on the left, 1375 01:04:09,810 --> 01:04:11,720 you will die, guaranteed. 1376 01:04:11,720 --> 01:04:13,770 We checked. 1377 01:04:13,770 --> 01:04:16,279 And otherwise, you jump-- if he's not there, 1378 01:04:16,279 --> 01:04:18,320 if it's on the right side, then you can traverse. 1379 01:04:18,320 --> 01:04:20,770 So this is the open state that's drawn. 1380 01:04:20,770 --> 01:04:22,140 So this is the tricky part. 1381 01:04:22,140 --> 01:04:24,510 We need something that's untraversable by the player 1382 01:04:24,510 --> 01:04:26,170 but traversable by the monster. 1383 01:04:26,170 --> 01:04:28,580 And this could be a fire bar that's rotating. 1384 01:04:28,580 --> 01:04:32,250 If you time it right, you could still rush by it. 1385 01:04:32,250 --> 01:04:34,040 And of course, close. 1386 01:04:34,040 --> 01:04:36,660 Close, we need to force this guy to be on the other side. 1387 01:04:36,660 --> 01:04:38,785 And so we do the same thing that we did on the left 1388 01:04:38,785 --> 01:04:39,930 to go through to close. 1389 01:04:39,930 --> 01:04:42,430 Just like on the left, this guy has to be on the other side. 1390 01:04:42,430 --> 01:04:44,840 So first, you can knock him over to the other side. 1391 01:04:44,840 --> 01:04:48,040 And then you can go back and jump through there. 1392 01:04:48,040 --> 01:04:50,385 So Super Mario Bros. is PSPACE-complete. 1393 01:04:50,385 --> 01:04:50,885 Yeah? 1394 01:04:50,885 --> 01:04:53,360 AUDIENCE: What was the advantage of the rotating fire bar? 1395 01:04:53,360 --> 01:04:56,217 PROFESSOR: Oh, it's more naturally occurring. 1396 01:04:56,217 --> 01:04:58,050 In real Mario, there are rotating fire bars. 1397 01:04:58,050 --> 01:05:01,660 There's never this single fire just floating in midair. 1398 01:05:01,660 --> 01:05:03,030 Fire bars can float in midair. 1399 01:05:06,680 --> 01:05:09,260 In all the levels that exist in Super Mario Bros., 1400 01:05:09,260 --> 01:05:12,030 fire bars are a fixed length. 1401 01:05:12,030 --> 01:05:14,640 We have six fire things or whatever. 1402 01:05:14,640 --> 01:05:17,330 But in the ROM, it has support for making 1403 01:05:17,330 --> 01:05:20,019 fire bars of arbitrary length or up to some size. 1404 01:05:20,019 --> 01:05:22,560 So you can make this in the ROM, or you can have it rotating. 1405 01:05:22,560 --> 01:05:24,620 And then it's a more intense experience. 1406 01:05:24,620 --> 01:05:27,410 AUDIENCE: Why are there fire bars [INAUDIBLE] 1407 01:05:27,410 --> 01:05:28,760 that they're hitting? 1408 01:05:28,760 --> 01:05:30,590 PROFESSOR: Yeah. 1409 01:05:30,590 --> 01:05:31,950 That's dealing with glitches. 1410 01:05:31,950 --> 01:05:32,450 Yeah? 1411 01:05:32,450 --> 01:05:34,908 AUDIENCE: What is the shell guy dropped by the cloud thing? 1412 01:05:34,908 --> 01:05:36,300 Or I don't know the game. 1413 01:05:36,300 --> 01:05:38,810 PROFESSOR: Oh, in the game, the cloud is up there. 1414 01:05:38,810 --> 01:05:41,110 And every few seconds, he throws one, 1415 01:05:41,110 --> 01:05:44,290 and it falls in some kind of random spot. 1416 01:05:44,290 --> 01:05:48,290 And then he traverses left and right like a regular turtle. 1417 01:05:48,290 --> 01:05:51,870 But in this, we're assuming that you can have him initially 1418 01:05:51,870 --> 01:05:53,520 appear there. 1419 01:05:53,520 --> 01:05:54,890 So he's not thrown by the cloud. 1420 01:05:54,890 --> 01:05:57,170 There would also be a cloud throwing spiny guys. 1421 01:05:59,789 --> 01:06:01,330 We're assuming that this guy can just 1422 01:06:01,330 --> 01:06:02,662 be there from the beginning. 1423 01:06:02,662 --> 01:06:05,137 AUDIENCE: So it drops more than one? 1424 01:06:05,137 --> 01:06:05,970 PROFESSOR: Oh, yeah. 1425 01:06:05,970 --> 01:06:08,303 It drops one, and then drops another, and drops another. 1426 01:06:08,303 --> 01:06:09,290 I think it's unlimited. 1427 01:06:09,290 --> 01:06:11,750 I mean, there might be a practical limit 1428 01:06:11,750 --> 01:06:15,490 given by the memory of an NES, which is pretty small. 1429 01:06:15,490 --> 01:06:18,715 But I think it limits to like eight creatures on screen 1430 01:06:18,715 --> 01:06:19,590 at once or something. 1431 01:06:19,590 --> 01:06:23,460 But we're generalizing that as well. 1432 01:06:23,460 --> 01:06:24,760 Are there questions? 1433 01:06:24,760 --> 01:06:25,670 OK. 1434 01:06:25,670 --> 01:06:28,400 I have one more proof I want to cover. 1435 01:06:28,400 --> 01:06:31,510 And this is the other Giovanni paper, and Fun with Algorithms 1436 01:06:31,510 --> 01:06:32,800 is here. 1437 01:06:32,800 --> 01:06:34,660 And it's about Lemmings. 1438 01:06:34,660 --> 01:06:36,460 If you haven't played Lemmings, it's 1439 01:06:36,460 --> 01:06:38,820 sort of the first real-time strategy game. 1440 01:06:38,820 --> 01:06:42,062 So you have these characters which appear periodically. 1441 01:06:42,062 --> 01:06:43,770 Then you can click on characters and make 1442 01:06:43,770 --> 01:06:44,590 them do different things. 1443 01:06:44,590 --> 01:06:45,780 You can make them build bridges. 1444 01:06:45,780 --> 01:06:47,238 You can make them dig horizontally. 1445 01:06:47,238 --> 01:06:49,877 You can make them dig vertically. 1446 01:06:49,877 --> 01:06:51,210 And so going through that again. 1447 01:06:51,210 --> 01:06:55,450 Here we're making this guy climb, and then digging down. 1448 01:06:55,450 --> 01:06:57,990 And then digging left. 1449 01:06:57,990 --> 01:06:59,160 And then digging down. 1450 01:06:59,160 --> 01:07:01,210 And then they can dig left to switch directions. 1451 01:07:01,210 --> 01:07:02,740 And then make them dig down again. 1452 01:07:02,740 --> 01:07:04,582 And then build bridge and dig through. 1453 01:07:04,582 --> 01:07:06,290 This is, I think, level two or something. 1454 01:07:06,290 --> 01:07:08,310 It's quite challenging. 1455 01:07:08,310 --> 01:07:10,510 And your goal is to get as many lemmings as possible 1456 01:07:10,510 --> 01:07:12,010 to the exit. 1457 01:07:12,010 --> 01:07:14,060 And the way you do it is you select the ability 1458 01:07:14,060 --> 01:07:15,851 you want, and then you click on the lemming 1459 01:07:15,851 --> 01:07:17,070 that you want to do it on. 1460 01:07:17,070 --> 01:07:19,720 And otherwise, they are walking around. 1461 01:07:19,720 --> 01:07:21,575 So how many people have played Lemmings? 1462 01:07:21,575 --> 01:07:22,950 Yeah, this is more popular one. 1463 01:07:22,950 --> 01:07:24,366 If you haven't played, you should. 1464 01:07:24,366 --> 01:07:27,320 It's really hard, though. 1465 01:07:27,320 --> 01:07:28,660 I was reading Wikipedia. 1466 01:07:28,660 --> 01:07:30,160 Sarah, one of your favorite authors, 1467 01:07:30,160 --> 01:07:32,680 Terry Pratchett was playing Lemmings. 1468 01:07:32,680 --> 01:07:35,220 He wrote a book that is clearly inspired by Lemmings. 1469 01:07:35,220 --> 01:07:37,350 And then he said he had to delete Lemmings 1470 01:07:37,350 --> 01:07:41,457 from his computer and override it in order to stop playing. 1471 01:07:41,457 --> 01:07:42,290 It was so addictive. 1472 01:07:42,290 --> 01:07:43,456 There are a bunch of levels. 1473 01:07:43,456 --> 01:07:45,331 It's fun. 1474 01:07:45,331 --> 01:07:46,830 There are many free versions as well 1475 01:07:46,830 --> 01:07:49,380 that have duplicated the Lemmings physics and so 1476 01:07:49,380 --> 01:07:52,410 on, with new levels, and there are level editors, and all 1477 01:07:52,410 --> 01:07:53,740 that good stuff. 1478 01:07:53,740 --> 01:07:56,860 So you might expect this game is pretty hard. 1479 01:07:56,860 --> 01:08:00,750 Here we're going to prove PSPACE-hardness. 1480 01:08:00,750 --> 01:08:05,030 There was the first paper by a Graham Cormode, 1481 01:08:05,030 --> 01:08:08,919 which showed NP-hardness and conjectured PSPACE-hardness. 1482 01:08:08,919 --> 01:08:10,210 So this was the results before. 1483 01:08:12,345 --> 01:08:13,720 So there are all these abilities. 1484 01:08:13,720 --> 01:08:15,050 I haven't defined all of them. 1485 01:08:15,050 --> 01:08:17,219 I'll show you just a few of them. 1486 01:08:17,219 --> 01:08:18,760 If they're unlimited, normally you're 1487 01:08:18,760 --> 01:08:20,970 given a limit to how many you have. 1488 01:08:20,970 --> 01:08:23,600 But even when they're unlimited and you have arbitrary time, 1489 01:08:23,600 --> 01:08:26,920 the game is still in PSPACE, because again, the state 1490 01:08:26,920 --> 01:08:30,800 is polynomial number of bits. 1491 01:08:30,800 --> 01:08:31,720 OK. 1492 01:08:31,720 --> 01:08:34,779 There's another thing I didn't mention, which is hazards. 1493 01:08:34,779 --> 01:08:36,620 These are traps. 1494 01:08:36,620 --> 01:08:39,330 If your lemming goes there, you die. 1495 01:08:39,330 --> 01:08:43,220 So those are also important for some of the proofs. 1496 01:08:43,220 --> 01:08:47,461 And so Graham showed that if you have diggers and a time-bound, 1497 01:08:47,461 --> 01:08:48,960 then you get NP equal to time-bound, 1498 01:08:48,960 --> 01:08:51,800 you actually get NP-completeness. 1499 01:08:51,800 --> 01:08:54,029 And you can convert that into other abilities. 1500 01:08:54,029 --> 01:08:57,430 But the [INAUDIBLE] new results are this one. 1501 01:08:57,430 --> 01:09:01,470 We're going to focus on this column, which is given builders 1502 01:09:01,470 --> 01:09:05,399 and bashers, either unlimited or given an exponential number 1503 01:09:05,399 --> 01:09:08,939 of them-- because we need to run for exponential time-- 1504 01:09:08,939 --> 01:09:11,640 and hazards, and just one lemming, 1505 01:09:11,640 --> 01:09:14,090 the game is PSPACE-complete. 1506 01:09:14,090 --> 01:09:16,877 Another result in the same paper that might interest you-- 1507 01:09:16,877 --> 01:09:18,960 but we're no longer in the Approximation section-- 1508 01:09:18,960 --> 01:09:24,930 is APX-hardness for any ability you want. 1509 01:09:24,930 --> 01:09:29,290 And a polynomial number of lemmings, and time, 1510 01:09:29,290 --> 01:09:30,390 and hazards. 1511 01:09:30,390 --> 01:09:33,229 And it's based on this weird thing about hazards 1512 01:09:33,229 --> 01:09:36,040 that if you have many lemmings go through a trap at once, 1513 01:09:36,040 --> 01:09:37,490 then only one of them dies. 1514 01:09:37,490 --> 01:09:38,891 [LAUGHTER] 1515 01:09:38,891 --> 01:09:40,265 Because the trap has to activate, 1516 01:09:40,265 --> 01:09:41,790 and it takes a certain amount of time. 1517 01:09:41,790 --> 01:09:43,870 So if they're really bunched up, then most of them 1518 01:09:43,870 --> 01:09:44,536 can get through. 1519 01:09:44,536 --> 01:09:47,944 So you can use that to reduce the number of lemmings. 1520 01:09:47,944 --> 01:09:50,569 And you're trying to approximate how many lemmings get through. 1521 01:09:50,569 --> 01:09:51,069 OK. 1522 01:09:51,069 --> 01:09:52,279 So that's fun. 1523 01:09:52,279 --> 01:09:54,582 But I don't have those pictures here, 1524 01:09:54,582 --> 01:09:56,540 because the PSPACE-hardness is kind of the more 1525 01:09:56,540 --> 01:09:58,130 impressive technical thing. 1526 01:09:58,130 --> 01:10:00,250 And it's already quite complicated. 1527 01:10:00,250 --> 01:10:04,780 So in order to really get this proof right, 1528 01:10:04,780 --> 01:10:06,840 Giovanni went through an incredible effort 1529 01:10:06,840 --> 01:10:11,740 of documenting Lemming physics at a pixel-by-pixel level, 1530 01:10:11,740 --> 01:10:13,810 because it is pretty weird, especially 1531 01:10:13,810 --> 01:10:15,980 when you start using the bridge building. 1532 01:10:15,980 --> 01:10:17,790 If you've ever played this game, it 1533 01:10:17,790 --> 01:10:20,026 will stop at kind of weird moments. 1534 01:10:20,026 --> 01:10:21,650 So here is the physics of what happens. 1535 01:10:21,650 --> 01:10:24,600 In general, the lemming is represented by a pin right 1536 01:10:24,600 --> 01:10:26,220 under its left foot. 1537 01:10:26,220 --> 01:10:26,930 I don't know. 1538 01:10:26,930 --> 01:10:29,240 Maybe that's the right foot. 1539 01:10:29,240 --> 01:10:33,645 And that pin should always be on the ground. 1540 01:10:33,645 --> 01:10:35,686 If it's not on the ground, the lemming will fall. 1541 01:10:35,686 --> 01:10:36,894 If it falls too far, it dies. 1542 01:10:36,894 --> 01:10:38,470 But that's not relevant here. 1543 01:10:38,470 --> 01:10:43,040 So the general walking-- all lemmings start as walkers. 1544 01:10:43,040 --> 01:10:46,016 And what they do is basically move left to right. 1545 01:10:46,016 --> 01:10:46,890 There's an animation. 1546 01:10:46,890 --> 01:10:48,670 But mostly, this pin is moving one pixel 1547 01:10:48,670 --> 01:10:49,894 to the right at a time. 1548 01:10:49,894 --> 01:10:51,310 And so it's visiting these things. 1549 01:10:51,310 --> 01:10:54,120 Once it sees, oh, there's no longer an obstacle beneath me, 1550 01:10:54,120 --> 01:10:56,040 I'm going to fall this amount, and then 1551 01:10:56,040 --> 01:10:58,690 I will fall one pixel at a time until I hit the ground. 1552 01:10:58,690 --> 01:10:59,730 So there's a gap here. 1553 01:10:59,730 --> 01:11:02,950 That won't be important here, but this is the real physics. 1554 01:11:02,950 --> 01:11:07,910 If I hit a step-- and this is, at most, eight pixels up-- then 1555 01:11:07,910 --> 01:11:11,422 I will rise up and go over. 1556 01:11:11,422 --> 01:11:13,630 But if I have two big a step, more than eight pixels, 1557 01:11:13,630 --> 01:11:17,180 then when I hit the wall, I will switch directions. 1558 01:11:17,180 --> 01:11:20,940 So in this case, he will hit here and then climb back up. 1559 01:11:20,940 --> 01:11:23,195 That is the regular walker physics. 1560 01:11:26,210 --> 01:11:28,510 Now, we're going to use two abilities. 1561 01:11:28,510 --> 01:11:31,150 One is called basher. 1562 01:11:31,150 --> 01:11:36,100 And there's some animations here of what happens with bashers. 1563 01:11:36,100 --> 01:11:38,280 In general, it's horizontal digging. 1564 01:11:38,280 --> 01:11:40,510 But it's kind of weird horizontal digging. 1565 01:11:40,510 --> 01:11:42,700 There's this particular pattern that you dig, 1566 01:11:42,700 --> 01:11:48,150 which ends up tunneling a big horizontal rectangle more 1567 01:11:48,150 --> 01:11:49,060 or less. 1568 01:11:49,060 --> 01:11:50,970 But the way it tells whether it's finished 1569 01:11:50,970 --> 01:11:52,710 is it looks at these four positions 1570 01:11:52,710 --> 01:11:55,730 right in front of the dig mask. 1571 01:11:55,730 --> 01:11:59,140 And if at least one of them is solid, you will keep digging. 1572 01:11:59,140 --> 01:12:01,256 If they're all empty, you will stop digging. 1573 01:12:01,256 --> 01:12:02,630 That's important, because we need 1574 01:12:02,630 --> 01:12:05,320 to see exactly when these things stop happening. 1575 01:12:05,320 --> 01:12:07,140 Then you return to being a walker. 1576 01:12:07,140 --> 01:12:10,150 So if everything is normal, you just dig through. 1577 01:12:10,150 --> 01:12:13,387 Here, that position was when all four were empty. 1578 01:12:13,387 --> 01:12:15,220 One was empty, but then all four were empty. 1579 01:12:15,220 --> 01:12:18,080 And so then you stop digging and keep walking. 1580 01:12:18,080 --> 01:12:18,580 OK. 1581 01:12:18,580 --> 01:12:20,740 But there's also this notion of steel. 1582 01:12:20,740 --> 01:12:22,530 Any pixel can be marked as steel. 1583 01:12:22,530 --> 01:12:24,212 It's a separate, independent bit. 1584 01:12:24,212 --> 01:12:26,420 Usually there's some graphics to indicate your steel. 1585 01:12:26,420 --> 01:12:28,800 But here we're going to use blue. 1586 01:12:28,800 --> 01:12:31,750 And there's this one steel check. 1587 01:12:31,750 --> 01:12:34,685 And if that position is steel, you 1588 01:12:34,685 --> 01:12:35,980 will immediately stop digging. 1589 01:12:35,980 --> 01:12:37,646 Or you will stop digging when that start 1590 01:12:37,646 --> 01:12:40,190 position hits a steel pixel. 1591 01:12:40,190 --> 01:12:42,175 So we're going to use that in the proof. 1592 01:12:42,175 --> 01:12:45,730 But that's how bashers work. 1593 01:12:45,730 --> 01:12:47,510 Next we have builders. 1594 01:12:47,510 --> 01:12:49,900 These are building the staircases. 1595 01:12:49,900 --> 01:12:52,450 And there's this subtlety that the solidity check 1596 01:12:52,450 --> 01:12:55,330 are these three points. 1597 01:12:55,330 --> 01:12:59,500 If any of them is solid, it will stop digging. 1598 01:12:59,500 --> 01:13:03,290 And if this one's solid, you'll also switch directions. 1599 01:13:03,290 --> 01:13:05,050 There's also a limited number of stairs, 1600 01:13:05,050 --> 01:13:07,216 because you can only fit so many in this little bag. 1601 01:13:07,216 --> 01:13:09,197 [LAUGHTER] 1602 01:13:09,197 --> 01:13:10,530 That won't matter for the proof. 1603 01:13:10,530 --> 01:13:12,300 We're always going to stop before we 1604 01:13:12,300 --> 01:13:17,610 hit the 15 stairs or so, 10 stairs, something like that. 1605 01:13:17,610 --> 01:13:19,410 So you can see it in action here. 1606 01:13:19,410 --> 01:13:22,980 You place the step. 1607 01:13:22,980 --> 01:13:26,960 The initial step overlaps your feet by two pixels. 1608 01:13:26,960 --> 01:13:30,850 And then you do this offset of two to the right, one up 1609 01:13:30,850 --> 01:13:32,340 until you hit something like that. 1610 01:13:32,340 --> 01:13:35,330 And then in that case, you turn around, 1611 01:13:35,330 --> 01:13:37,260 because you hit the wall, so to speak. 1612 01:13:37,260 --> 01:13:40,870 But notice there's this big gap here. 1613 01:13:40,870 --> 01:13:43,120 OK. 1614 01:13:43,120 --> 01:13:47,900 So now we want to use metatheorem five. 1615 01:13:47,900 --> 01:13:52,244 We want to build a door and crossover, I guess. 1616 01:13:52,244 --> 01:13:54,660 I don't know if I have the-- I do have the crossover here. 1617 01:13:54,660 --> 01:13:56,150 It's not so hard. 1618 01:13:56,150 --> 01:13:58,740 First we just need to be able to move lemmings around. 1619 01:13:58,740 --> 01:14:00,210 And they move in a very simple way. 1620 01:14:00,210 --> 01:14:00,760 So yeah. 1621 01:14:00,760 --> 01:14:03,658 AUDIENCE: How did he check all these pixel things? 1622 01:14:03,658 --> 01:14:09,022 PROFESSOR: [LAUGHS] That's a good question. 1623 01:14:09,022 --> 01:14:10,480 Definitely one thing he did is look 1624 01:14:10,480 --> 01:14:14,250 at one of the clones of lemmings and read the source code. 1625 01:14:14,250 --> 01:14:17,440 How that clone was done to mimic exactly the original lemmings 1626 01:14:17,440 --> 01:14:19,290 I'm not sure. 1627 01:14:19,290 --> 01:14:21,030 So I don't know whether this has been 1628 01:14:21,030 --> 01:14:26,630 compared against disassembled, original Lemmings code or what. 1629 01:14:26,630 --> 01:14:27,630 I'll follow up with him. 1630 01:14:27,630 --> 01:14:30,340 I was talking to him earlier today. 1631 01:14:30,340 --> 01:14:30,840 OK. 1632 01:14:30,840 --> 01:14:34,820 So we are only going to give the player the ability 1633 01:14:34,820 --> 01:14:37,560 to do builders or bashers. 1634 01:14:37,560 --> 01:14:40,160 And we want to prevent the player from doing builders 1635 01:14:40,160 --> 01:14:41,380 in random places. 1636 01:14:41,380 --> 01:14:43,320 So these red things are traps. 1637 01:14:43,320 --> 01:14:47,710 If you ever at any point decide to become a builder, 1638 01:14:47,710 --> 01:14:49,100 your dot will not be here. 1639 01:14:49,100 --> 01:14:50,490 Your dot will be above. 1640 01:14:50,490 --> 01:14:52,980 And then it will be touching the trap, and then you die. 1641 01:14:52,980 --> 01:14:54,840 So these red things are to prevent you 1642 01:14:54,840 --> 01:14:56,560 from building anywhere. 1643 01:14:56,560 --> 01:15:00,070 You also can't bash anywhere, because let's say 1644 01:15:00,070 --> 01:15:02,540 this is all steel. 1645 01:15:02,540 --> 01:15:03,214 OK. 1646 01:15:03,214 --> 01:15:05,130 Or actually, I think the whole background here 1647 01:15:05,130 --> 01:15:09,170 is steel except in specific places in the gadget. 1648 01:15:09,170 --> 01:15:10,610 So this is a small thing. 1649 01:15:10,610 --> 01:15:12,760 This basically let's us ascend slightly. 1650 01:15:12,760 --> 01:15:14,718 Because lemmings only like to go left and right 1651 01:15:14,718 --> 01:15:19,850 and there's no jump ability, we want 1652 01:15:19,850 --> 01:15:21,480 to be able to build a graph. 1653 01:15:21,480 --> 01:15:23,160 So this will let us go up a little bit. 1654 01:15:23,160 --> 01:15:24,970 This will let us go down a little bit. 1655 01:15:24,970 --> 01:15:27,710 This will let us change directions into going up, 1656 01:15:27,710 --> 01:15:29,350 change directions in going down. 1657 01:15:29,350 --> 01:15:31,330 This is a crossover, because lemmings will just 1658 01:15:31,330 --> 01:15:32,130 proceed to the right. 1659 01:15:32,130 --> 01:15:33,963 There's no way to make them change direction 1660 01:15:33,963 --> 01:15:35,810 unless they hit something. 1661 01:15:35,810 --> 01:15:38,790 So that's basic lemming driving. 1662 01:15:43,215 --> 01:15:45,340 These are not explicitly stated in the metatheorem. 1663 01:15:45,340 --> 01:15:47,964 You see here the vagueness of the metatheorem. 1664 01:15:47,964 --> 01:15:49,380 We need the ability for the player 1665 01:15:49,380 --> 01:15:52,030 to choose whether lemmings go one way or another way. 1666 01:15:52,030 --> 01:15:54,734 We need that, for example, in the existential quantifier. 1667 01:15:54,734 --> 01:15:56,400 But in general, we were kind of assuming 1668 01:15:56,400 --> 01:15:59,560 that the player has this kind of agency to choose directions 1669 01:15:59,560 --> 01:16:00,410 of lemmings. 1670 01:16:00,410 --> 01:16:03,710 So for that, we need a kind of fork gadget. 1671 01:16:03,710 --> 01:16:09,450 And you can either do a build immediately followed by a bash, 1672 01:16:09,450 --> 01:16:12,610 or you can do a bash in order to get down. 1673 01:16:12,610 --> 01:16:14,090 So if I do a build and then a bash, 1674 01:16:14,090 --> 01:16:16,530 I will stop building and then just make one step. 1675 01:16:16,530 --> 01:16:19,680 Because if I made a second step, I would die from the traps. 1676 01:16:19,680 --> 01:16:22,550 That will let me choose to go to the top path. 1677 01:16:22,550 --> 01:16:24,960 Or even if this is already there, I could bash it away. 1678 01:16:24,960 --> 01:16:26,560 Or if it isn't there, just wait. 1679 01:16:26,560 --> 01:16:28,431 And then I will go down here. 1680 01:16:28,431 --> 01:16:28,930 OK? 1681 01:16:28,930 --> 01:16:30,960 So no matter what the state of this gadget is, 1682 01:16:30,960 --> 01:16:34,520 I can either take the top path or go down to the bottom path. 1683 01:16:34,520 --> 01:16:37,840 Because here I have unlimited bashes and builds. 1684 01:16:37,840 --> 01:16:39,990 So those are the two states. 1685 01:16:39,990 --> 01:16:44,860 This is the non-steel part. 1686 01:16:44,860 --> 01:16:50,800 We need that for the bash to succeed. 1687 01:16:50,800 --> 01:16:56,300 So it ends up bashing, but because it's all empty here, 1688 01:16:56,300 --> 01:16:59,291 you immediately stop bashing. 1689 01:16:59,291 --> 01:16:59,790 OK. 1690 01:16:59,790 --> 01:17:00,940 That's the fork. 1691 01:17:00,940 --> 01:17:03,096 And finally, the door. 1692 01:17:03,096 --> 01:17:06,610 So if the door was open, you go through it. 1693 01:17:06,610 --> 01:17:09,120 If it's closed, you die, even if you try to build a bridge. 1694 01:17:09,120 --> 01:17:11,680 If I go this way, I can either fall down, 1695 01:17:11,680 --> 01:17:13,960 or I could bash it away and then open the door. 1696 01:17:13,960 --> 01:17:15,810 But I still fall to the bottom. 1697 01:17:15,810 --> 01:17:19,410 If I come from here with a closed door, fine, I can exit. 1698 01:17:19,410 --> 01:17:22,860 If it's an open door, I better build this thing. 1699 01:17:22,860 --> 01:17:25,040 If I build too far, I'm in trouble. 1700 01:17:25,040 --> 01:17:27,682 But if I build just once and then immediately bash, 1701 01:17:27,682 --> 01:17:28,890 then I will get to the right. 1702 01:17:28,890 --> 01:17:30,590 What did I just do in rapid fire? 1703 01:17:30,590 --> 01:17:34,090 That was the closed path, where I must put this 1704 01:17:34,090 --> 01:17:36,350 back in in order to survive. 1705 01:17:36,350 --> 01:17:38,050 The open, I had a choice. 1706 01:17:38,050 --> 01:17:39,130 I could bash it. 1707 01:17:39,130 --> 01:17:41,480 In either case, I end up to the open exit. 1708 01:17:41,480 --> 01:17:45,060 And for traversal, you will only survive if this is not there. 1709 01:17:45,060 --> 01:17:46,950 And you get out. 1710 01:17:46,950 --> 01:17:48,510 So lots of crossing paths. 1711 01:17:48,510 --> 01:17:51,680 But you can see why you need this pixel-by-pixel analysis 1712 01:17:51,680 --> 01:17:55,030 to really be sure that this gadget does exactly what you 1713 01:17:55,030 --> 01:17:56,020 want. 1714 01:17:56,020 --> 01:17:57,540 And that is a door for Lemmings. 1715 01:17:57,540 --> 01:18:01,052 And therefore, Lemmings is PSPACE-complete. 1716 01:18:01,052 --> 01:18:02,380 Pretty epic. 1717 01:18:02,380 --> 01:18:04,740 And that's all for today. 1718 01:18:04,740 --> 01:18:06,850 Yay, video games.