{"version":1,"lectureId":"01M14TXPGH643NHQ5B5ZQFEB15","attempt":0,"publication":{"slug":"three-sat-vertex-cover-reduction","title":"NP-Completeness and Reduction: From Definitions to the 3-SAT to Vertex Cover Proof","subject":"computer-science","summary":"A verifier-first introduction to P and NP, followed by the 3-SAT to Vertex Cover reduction carried out completely. Vertex Cover is posed as a decision problem and checked against a certificate; P and NP are defined by what a polynomial-time verifier can confirm; polynomial-time reductions are defined and their direction fixed. The centrepiece is one full construction: variable gadgets, clause gadgets and the wires between them, drawn on a three-variable, two-clause formula, with the budget argument and both directions of the correspondence argued on that concrete graph, using two different covers. The closing section states exactly what the reduction proves, in which direction it runs, and why NP-hardness is a theorem about a problem rather than a verdict on whoever failed to solve it.","metaDescription":"P and NP defined by verifiers, then the 3-SAT to Vertex Cover reduction built and argued in both directions on one formula.","transcript":"Two definitions and one proof. The definitions are P and NP, and I am going to give them in terms of a machine that checks answers, rather than in terms of how hard a problem happens to feel. The proof is a single reduction, from three satisfiability to vertex cover. Gadgets drawn, wires connected, and both directions argued on one formula small enough to hold in your head. Start with a graph. Six places, and seven roads joining them. I want to post a guard at some of the places, so that every road has a guard at one end of it or the other. A set of vertices that touches every edge like that is called a vertex cover. Taking all six would certainly work, so the interesting question is never whether a cover exists. It is how small one can be. So we ask it as a question with a yes or a no attached. Given the graph and given a number k, is there a vertex cover with at most k vertices? For this graph, take k equal to three. Here is a claimed answer: the set containing b, and d, and f. In complexity that object has a name. It is a certificate, a piece of evidence offered alongside the instance to make the yes easy to confirm. Now check it. The size first. Three vertices, and three was the budget. Then the edges, one at a time, all the way round the outside and then across the middle. Every one of the seven has a lit endpoint. So the answer for this instance is yes, and the certificate is what proved it. Notice how little work that was. Seven checks, one per edge, and nothing had to be searched for. Finding the set is a different business entirely. There are twenty ways to choose three vertices out of six, and here you could try them all. Push the graph up to a hundred vertices with a budget of fifty, and that same brute force never finishes. That gap, between checking an answer and finding one, is the whole of what NP is about. So let us make it precise. A verifier for a problem is an algorithm V that takes two inputs. The instance w, which here is the graph together with the number, and the certificate c, which here is the proposed set of vertices. Three conditions on it. First, V runs in time polynomial in the length of w. Notice that this bounds the certificate too, since V cannot even read a string longer than the time it is allowed. Second, if w is a yes instance, then some certificate makes V accept. Third, if w is a no instance, then no certificate whatsoever makes V accept. Not a clever one, not a lucky one. None. NP is the class of problems that have a verifier like that. Now read the second line again and notice what it does not mention. It promises that a certificate exists. It says absolutely nothing about how you would find one. P is the same definition with the certificate deleted. A problem is in P when a polynomial-time algorithm decides it outright, working out the answer with no help offered. NP is the class we have just built. A polynomial-time verifier, and a short certificate for every yes instance. Every problem in P sits inside NP, because an algorithm that already knows the answer can simply ignore whatever certificate you hand it. Whether the containment runs the other way as well is the open question, and nobody knows. One last thing about the shape of that definition. It is lopsided, and on purpose. NP promises a short proof for the yes answers, and promises absolutely nothing for the no answers. Vertex cover shows you why. To demonstrate that a cover of size three exists, you point at one, like this. To demonstrate that none exists, you would have to rule out every subset, and there is no short way to write that down. So that is the class. Now the question that organises everything else. What does it mean to say that one problem inside it is harder than another? Suppose I have two problems, A and B, and suppose somebody has already handed me a solver for B. Can I get A for free? Sometimes I can, and this is the shape of the arrangement. Take any instance w of A. Run it through a translator, a function f, and out comes a string. Hand that string to the solver for B, and take whatever the solver says as your answer about w. For that to be honest, f has to be faithful. w is a yes instance of A exactly when f of w is a yes instance of B. Not usually, not most of the time. Exactly when, and in both directions. And f itself has to be cheap: computable in polynomial time. If translating cost more than solving, the whole arrangement would be pointless. A translator with those two properties is a polynomial-time reduction, and we write it with this symbol. Read the symbol as no harder than. A is no harder than B, up to a polynomial. Now read that picture as a claim about difficulty, because this is where people get turned around. Suppose B has a polynomial-time algorithm. Then A has one too. Translate, then solve, and both steps are polynomial. Turn that implication around and you get the useful form. If A has no polynomial-time algorithm, then B cannot have one either, because a fast B would have handed us a fast A. So hardness travels forwards along the arrow, out of A and into B, while easiness travels backwards. Point at the arrow and you are pointing at the direction of the claim. That single sentence is most of what an examiner is checking. Which fixes the direction you must write your proof in. If you want to show that your new problem B is hard, you take a problem already known to be hard, and you reduce it into B. The other way round does prove something, but not that. A reduction from B into three satisfiability says B is no harder than three satisfiability. That is an upper bound, not a lower one. It is the single most common way to write the proof backwards, so when you are stuck, ask which problem is the source of the arrow. The source is always the one you already trust to be hard. Now the two names. A problem B is NP-hard when every problem in NP reduces to it in polynomial time. Every one. Including all the ones nobody has thought of yet. And B is NP-complete when it is NP-hard and it is itself a member of NP. The NP-complete problems are the hardest problems in the class, and they all stand or fall together. That definition looks impossible to verify, because NP contains infinitely many problems. Cook and Levin did the impossible part once, in nineteen seventy one, by encoding an arbitrary polynomial-time verification directly as a Boolean formula. Three satisfiability, the restriction where every clause has exactly three literals, is NP-complete too. So nobody after them has to go back to Turing machines. You reduce three satisfiability into your problem, and transitivity carries all of NP along behind. Which is exactly what we are going to do now, once, in full. Three satisfiability. You are handed a Boolean formula in one fixed shape. It is a conjunction of clauses, and each clause is a disjunction of exactly three literals, where a literal means a variable or the negation of one. The question is whether some assignment of true and false to the variables makes the whole formula come out true. And here is the formula we are going to carry for the rest of the lecture. Three variables and two clauses. The first clause is x one or x two or not x three. The second is not x one or not x two or x three. Small enough to settle by inspection, which is exactly why it is safe to use. We are not going to be clever about this formula. We are going to translate it, mechanically, into a graph and a number. The translator is built from two pieces, one for each kind of object a formula contains. First piece: one gadget for every variable. It is a single edge, and its two endpoints are the two literals of that variable. x on one side, not x on the other. A cover has to touch every edge of the graph, and this is an edge. So any cover at all contains at least one of these two vertices. That is a cost we are going to charge for in a moment. And here is the reading that makes the entire proof work. Which endpoint the cover takes is a truth value. Take the x side and we call x true. Take the not x side and we call x false. The gadget is a switch. Second piece: one gadget for every clause. It is a triangle, and its three vertices are the clause's three literals, one copy of each. A triangle has three edges, and no single vertex touches all three. Take just the top one: it meets two of the edges and misses the bottom edge entirely. So one vertex is never enough. Take any two of them and every edge is covered, whichever two you choose. So each triangle costs at least two vertices. Equivalently, exactly one of the three can be left outside the cover, and that fact is what the whole proof will lean on. Third piece, and this one is not a gadget but a wire. For every literal in every clause, join that clause vertex to the variable gadget vertex carrying the same literal. Here the triangle's x vertex is wired back to the x endpoint upstairs. The other two literals of this clause would run off to their own gadgets, which I have not drawn. That is the whole construction. Two vertices and one edge per variable, three vertices and three edges per clause, and one wire per literal. Nothing depends on anything being clever. And now the number. With n variables and m clauses, set k to n plus two m. One vertex per variable gadget, two per clause gadget, and not a single vertex to spare. That tightness is the engine of the whole proof. The gadgets force n, the triangles force two m, those vertex sets do not overlap, so every cover has at least that many. Asking for exactly that many leaves no freedom anywhere. Here is our formula again, and here is the graph it becomes. Three variables, so three variable gadgets. One edge each, six vertices in all, one pair per variable. Two clauses, so two triangles. The first clause is x one or x two or not x three, and its triangle carries exactly those three literals, one vertex each. The second clause is not x one or not x two or x three, and its triangle carries those. Notice that every literal now appears twice over. Once up in a gadget, and once down in a triangle. Now the wires. Every clause vertex joins the gadget vertex with the same label. The x one copy runs up to x one, the x two copy runs to x two, and the not x three copy runs all the way across the picture. The second triangle wires the same way. Not x one, not x two, and x three, each to its own endpoint upstairs. Six literals, six wires. Twelve vertices and fifteen edges. Look at how that was built. One pass over the formula, writing down a fixed number of vertices and edges per variable and per clause. That is the polynomial-time half of the reduction, and it is the easy half. Now the number. Each of the three variable edges demands at least one vertex, because a cover has to touch it. Three edges, one apiece, so three. Each of the two triangles demands at least two, as we showed. Two triangles, two apiece, so four. And those five demands sit on completely separate vertices, so they simply add. Rule a line under them and add. Seven. Every vertex cover of this graph has at least seven vertices, whatever it looks like, and seven is exactly the budget the construction sets. So asking for a cover of size seven is asking for one with no slack at all. Exactly one endpoint from each variable edge. Exactly two vertices from each triangle. Nothing left over to patch anything up with. Take the formula's side first. Set x one true, x two false, and x three true. Check it against both clauses. Clause one is x one or x two or not x three. Its first literal is true, so the clause holds. Clause two is not x one or not x two or x three, and not x two is true, since x two is false. Both clauses hold, so the formula is satisfied. Now build the cover from that assignment. From each variable gadget, take the endpoint whose literal came out true. x one true, so take x one. x two false, so take not x two. x three true, so take x three. Three vertices so far. Now each triangle. Look at which of its literals the assignment made true, pick one of those, and leave that vertex out. Take the other two. In the first triangle, x one is true. So leave the x one copy outside, and take the x two copy and the not x three copy. In the second triangle, not x two is true. So leave the not x two copy outside, and take the other two. Two from each triangle, four in all, and three plus four is seven. Exactly the budget. Now the part that could actually fail. Is every edge of this graph covered? There are three families to check, and I will take them in order. The three variable edges. We took one endpoint of each of them by construction, so all three are covered, and there is nothing to argue. The six triangle edges. We took two of the three vertices of each triangle, and two vertices of a triangle meet all three of its edges. So all six are covered as well. The six wires are the interesting family. If a wire's clause end is in the cover, that wire is covered and there is nothing to prove. So the only wires at risk are the two hanging off the vertices we deliberately left out. And look where those two wires go. The excluded vertex in the first triangle is the copy of x one, and its wire runs up to the gadget vertex x one, which is in the cover, because the assignment made x one true. Same story in the second triangle. The excluded vertex is the copy of not x two, its wire runs up to not x two, and we took not x two into the cover precisely because x two is false. Both risky wires are covered. That is the forward direction complete. And notice exactly where satisfaction was used. The vertex we leave out of a triangle has to be a true literal, and true literals are precisely the ones the gadgets put into the cover. An unsatisfied clause would have nothing safe to leave out. Now run it backwards, which is the direction that actually carries the theorem. Somebody hands you a cover of size seven for this graph. They will not say where they got it, and it need not be the one we just built. The counting does the first job for us. Seven vertices, and we proved the minimum is seven, so there is no slack anywhere. Exactly one endpoint of each variable edge, and exactly two vertices of each triangle. So read the assignment straight off the top row. This cover took not x one, so x one is false. It took x two, so x two is true. It took not x three, so x three is false. Well defined, precisely because exactly one of each pair was taken. Does that assignment satisfy the formula? Here is the argument, and it takes three steps. In each triangle exactly one vertex is left out. In the first triangle, the excluded vertex is the copy of x two. That vertex has a wire running up to the gadget vertex x two. The wire is an edge, and every edge is covered. Its clause end is not in the cover, so its other end must be. The gadget vertex x two is in the cover. And a gadget vertex in the cover is a literal we are calling true. So x two is true, and x two is one of the three literals of this first triangle, which is clause one. Clause one is satisfied, and we never had to look at its other two literals. The second triangle goes the same way. The excluded vertex is the copy of not x one, its wire forces not x one into the cover, and not x one in the cover means x one is false. That literal belongs to clause two, so clause two is satisfied too. Both clauses satisfied, so the formula is satisfiable, and the assignment we read off the cover is the witness. Note what carried that argument. Not the cover's cleverness, but the fact that seven left it no room to be anything else. So let us say precisely what we now have. A function that takes a three satisfiability formula and returns a graph together with a number, computable in time linear in the size of the formula. And a proof, in both directions, that the formula is satisfiable exactly when that graph has a vertex cover of size at most k. That is the definition of a polynomial-time reduction, met in full. Three satisfiability reduces to vertex cover. Now read that as a statement about vertex cover, which is what it is. Cook and Levin put satisfiability at the top, with every problem in NP reducing into it. Satisfiability reduces to three satisfiability, and our arrow carries the hardness one step further along. So vertex cover is NP-hard: every problem in NP reduces to it, by composing the arrows. And vertex cover is in NP, which we settled in the first few minutes. Hand me a set of vertices and I will check it against every edge in linear time. NP-hard and in NP: vertex cover is NP-complete. Now read the arrows once more, because the direction is the whole examinable content. The arrow runs from the problem already known to be hard into the new one, never the other way. What it says is a conditional. If you could solve vertex cover quickly, you could solve three satisfiability quickly, and therefore everything in NP quickly. It does not say the reverse, and it hands you no algorithm at all. Which brings us to the last point, and it is the one worth carrying out of the room. NP-hardness is not a proof that no fast algorithm exists. Nobody has proved that about any problem in NP, and nobody is close. What it is, is a ranking. Vertex cover sits at least as high as every problem in the class. So if you ever find a polynomial-time algorithm for it, you have not found an exception. You have proved P equals NP, and thousands of problems fall in the same instant. And that is exactly why the phrase describes the problem. The reduction is a construction on a page, checkable by anyone. It was true before you attempted the problem, it is true while you are stuck on it, and it will still be true long after P versus NP is settled. It says nothing whatsoever about you. It says where the problem stands.","watch":{"version":1,"scenes":[{"title":"Checking Is Not Finding","start":0,"end":259.36350000000004,"objects":{"card":"a Title that says \"Computational Complexity — NP-Completeness and Reduction: From Definitions to the 3-SAT to Vertex Cover Proof\"","cond1":"a Math [text] that says \"$upright(\"time\") <= p(|w|)$\"","cond2":"a Math [text] that says \"$w in L arrow.r.double exists c: V(w, c) = 1$\"","cond3":"a Math [text] that says \"$w in.not L arrow.r.double forall c: V(w, c) = 0$\"","cover_note":"a Panel that says \"A vertex cover of $G$ is a set $S$ of vertices such that every edge of $G$ has at least one endpoint in $S$.\"","decision":"a Text [text] that says \"Decision problem $upright(\"VC\")$: given a graph $G$ and a number $k$, does $G$ have a vertex cover with at most $k$ vertices?\"","e_ab":"a Line [gray] drawn in g (start=(1.1, 3.2), end=(3.3, 4.5))","e_bc":"a Line [gray] drawn in g (start=(3.3, 4.5), end=(5.5, 3.2))","e_be":"a Line [gray] drawn in g (start=(3.3, 4.5), end=(3.3, -0.3))","e_cd":"a Line [gray] drawn in g (start=(5.5, 3.2), end=(5.5, 1.0))","e_de":"a Line [gray] drawn in g (start=(5.5, 1.0), end=(3.3, -0.3))","e_ef":"a Line [gray] drawn in g (start=(3.3, -0.3), end=(1.1, 1.0))","e_fa":"a Line [gray] drawn in g (start=(1.1, 1.0), end=(1.1, 3.2))","edge_check":"a Tex [text] that says \"Every edge has an endpoint in $S$.\"","g":"a Figure (x_range=(0.0, 6.6), y_range=(-0.7, 5.1), aspect=(6.6, 5.8))","head_check":"a Heading that says \"Checking a Proposed Answer\"","head_classes":"a Heading that says \"The Two Classes\"","head_cover":"a Heading that says \"A Set That Touches Every Edge\"","head_np":"a Heading that says \"The Verifier\"","inclusion":"a Math [text] that says \"$upright(\"P\") subset.eq upright(\"NP\")$\"","instance":"a Math [text] that says \"$chevron.l G, 3 chevron.r$\"","np_panel":"a Panel that says \"$L in upright(\"NP\")$ when some polynomial-time verifier satisfies all three conditions above.\"","p_panel":"a Panel that says \"$L in upright(\"P\")$ when some algorithm decides $L$ in polynomial time, with no certificate offered.\"","point":"a Point [yellow] drawn in g (location=(3.3, 4.5))","point_2":"a Point [yellow] drawn in g (location=(5.5, 1.0))","point_3":"a Point [yellow] drawn in g (location=(1.1, 1.0))","point_4":"a Point [yellow] drawn in g (location=(3.3, 4.5))","size_check":"a Math [text] that says \"$|S| = 3 <= k$\"","va":"a Point [blue] labelled \"a\" drawn in g (location=(1.1, 3.2), marker_radius=0.12)","vb":"a Point [blue] labelled \"b\" drawn in g (location=(3.3, 4.5), marker_radius=0.12)","vc":"a Point [blue] labelled \"c\" drawn in g (location=(5.5, 3.2), marker_radius=0.12)","vd":"a Point [blue] labelled \"d\" drawn in g (location=(5.5, 1.0), marker_radius=0.12)","ve":"a Point [blue] labelled \"e\" drawn in g (location=(3.3, -0.3), marker_radius=0.12)","verdict":"a Math [text] that says \"$V(chevron.l G, 3 chevron.r, S) = upright(\"accept\")$\"","verifier_intro":"a Text [text] that says \"A verifier $V(w, c)$ reads the instance $w$ and a second string $c$, the certificate.\"","vf":"a Point [blue] labelled \"f\" drawn in g (location=(1.1, 1.0), marker_radius=0.12)"},"beats":[{"start":0,"say":"Two definitions and one proof. The definitions are P and NP, and I am going to give them in terms of a machine that checks answers, rather than in terms of how hard a problem happens to feel.","live":[],"does":[[0,"card is shown on the screen, written out."],[1.5,"card: enter:write-left-to-right."]]},{"start":12.6975,"say":"The proof is a single reduction, from three satisfiability to vertex cover. Gadgets drawn, wires connected, and both directions argued on one formula small enough to hold in your head.","live":null,"does":[[24.505499999999998,"card is hidden from the screen — left the board."]]},{"start":25.7055,"say":"Start with a graph. Six places, and seven roads joining them. I want to post a guard at some of the places, so that every road has a guard at one end of it or the other.","live":null,"does":[[25.7055,"head_cover is shown on the screen, written out."],[25.7055,"g is shown on the screen, written out."],[28.039,"va is shown on the screen, written out."],[28.129,"vb is shown on the screen, written out."],[28.219,"vc is shown on the screen, written out."],[28.309,"vd is shown on the screen, written out."],[28.399,"ve is shown on the screen, written out."],[28.489,"vf is shown on the screen, written out."],[29.362000000000002,"e_ab is shown on the screen, drawn."],[29.452,"e_bc is shown on the screen, drawn."],[29.542,"e_cd is shown on the screen, drawn."],[29.632,"e_de is shown on the screen, drawn."],[29.722,"e_ef is shown on the screen, drawn."],[29.812,"e_fa is shown on the screen, drawn."],[29.902,"e_be is shown on the screen, drawn."]]},{"start":36.8475,"say":"A set of vertices that touches every edge like that is called a vertex cover. Taking all six would certainly work, so the interesting question is never whether a cover exists. It is how small one can be.","live":["g","head_cover","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be"],"does":[[40.772,"g moves to a new place on the board."],[40.772,"cover_note is shown on the screen, written out."]]},{"start":49.602999999999994,"say":"So we ask it as a question with a yes or a no attached. Given the graph and given a number k, is there a vertex cover with at most k vertices? For this graph, take k equal to three.","live":["cover_note","g","head_cover","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be"],"does":[[53.806,"decision is shown on the screen, written out."],[61.815999999999995,"instance is shown on the screen, written out."]]},{"start":63.263999999999996,"say":"Here is a claimed answer: the set containing b, and d, and f. In complexity that object has a name. It is a certificate, a piece of evidence offered alongside the instance to make the yes easy to confirm.","live":["cover_note","decision","instance","g","head_cover","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be"],"does":[[66.01499999999999,"vb is emphasized."],[66.36499999999998,"vd is emphasized."],[66.71499999999997,"vf is emphasized."],[77.61399999999999,"cover_note is hidden from the screen — left the board."],[77.61399999999999,"decision is hidden from the screen — left the board."],[77.61399999999999,"head_cover is hidden from the screen — left the board."],[77.61399999999999,"instance is hidden from the screen — left the board."]]},{"start":78.214,"say":"Now check it. The size first. Three vertices, and three was the budget. Then the edges, one at a time, all the way round the outside and then across the middle.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be"],"does":[[78.214,"head_check is shown on the screen, written out."],[83.56600000000002,"size_check is shown on the screen, written out."],[87.444,"e_ab is indicated — a transient flash."],[87.944,"e_bc is indicated — a transient flash."],[88.444,"e_cd is indicated — a transient flash."],[88.944,"e_de is indicated — a transient flash."],[89.444,"e_ef is indicated — a transient flash."],[89.944,"e_fa is indicated — a transient flash."],[90.444,"e_be is indicated — a transient flash."]]},{"start":90.6095,"say":"Every one of the seven has a lit endpoint. So the answer for this instance is yes, and the certificate is what proved it. Notice how little work that was. Seven checks, one per edge, and nothing had to be searched for.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","size_check","head_check"],"does":[[92.548,"edge_check is shown on the screen, written out."],[95.30000000000001,"verdict is shown on the screen, written out."]]},{"start":105.51299999999999,"say":"Finding the set is a different business entirely. There are twenty ways to choose three vertices out of six, and here you could try them all. Push the graph up to a hundred vertices with a budget of fifty, and that same brute force never finishes.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","size_check","edge_check","verdict","head_check"],"does":[[109.17,"point is shown on the screen, grown."],[111.17,"point is hidden from the screen."],[111.57000000000001,"point_2 is shown on the screen, grown."],[113.57000000000001,"point_2 is hidden from the screen."],[113.97000000000001,"point_3 is shown on the screen, grown."],[115.97000000000001,"point_3 is hidden from the screen."]]},{"start":119.8825,"say":"That gap, between checking an answer and finding one, is the whole of what NP is about. So let us make it precise.","live":null,"does":[[127.2315,"edge_check is hidden from the screen — left the board."],[127.2315,"head_check is hidden from the screen — left the board."],[127.2315,"size_check is hidden from the screen — left the board."],[127.2315,"verdict is hidden from the screen — left the board."]]},{"start":128.4315,"say":"A verifier for a problem is an algorithm V that takes two inputs. The instance w, which here is the graph together with the number, and the certificate c, which here is the proposed set of vertices.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be"],"does":[[128.4315,"head_np is shown on the screen, written out."],[130.405,"verifier_intro is shown on the screen, written out."]]},{"start":141.895,"say":"Three conditions on it. First, V runs in time polynomial in the length of w. Notice that this bounds the certificate too, since V cannot even read a string longer than the time it is allowed.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","verifier_intro","head_np"],"does":[[145.703,"cond1 is shown on the screen, written out."]]},{"start":155.603,"say":"Second, if w is a yes instance, then some certificate makes V accept. Third, if w is a no instance, then no certificate whatsoever makes V accept. Not a clever one, not a lucky one. None.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","verifier_intro","cond1","head_np"],"does":[[156.079,"cond2 is shown on the screen, written out."],[161.756,"cond3 is shown on the screen, written out."]]},{"start":172.358,"say":"NP is the class of problems that have a verifier like that. Now read the second line again and notice what it does not mention. It promises that a certificate exists. It says absolutely nothing about how you would find one.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","verifier_intro","cond1","cond2","cond3","head_np"],"does":[[181.66299999999998,"cond2 (the \"exists c\" part) is indicated — a transient flash."],[185.98250000000002,"cond1 is hidden from the screen — left the board."],[185.98250000000002,"cond2 is hidden from the screen — left the board."],[185.98250000000002,"cond3 is hidden from the screen — left the board."],[185.98250000000002,"head_np is hidden from the screen — left the board."],[185.98250000000002,"verifier_intro is hidden from the screen — left the board."]]},{"start":187.1825,"say":"P is the same definition with the certificate deleted. A problem is in P when a polynomial-time algorithm decides it outright, working out the answer with no help offered.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be"],"does":[[187.1825,"head_classes is shown on the screen, written out."],[189.80700000000002,"p_panel is shown on the screen, written out."]]},{"start":198.5335,"say":"NP is the class we have just built. A polynomial-time verifier, and a short certificate for every yes instance.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","p_panel","head_classes"],"does":[[200.925,"np_panel is shown on the screen, written out."]]},{"start":207.644,"say":"Every problem in P sits inside NP, because an algorithm that already knows the answer can simply ignore whatever certificate you hand it. Whether the containment runs the other way as well is the open question, and nobody knows.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","p_panel","np_panel","head_classes"],"does":[[209.502,"inclusion is shown on the screen, written out."]]},{"start":222.118,"say":"One last thing about the shape of that definition. It is lopsided, and on purpose. NP promises a short proof for the yes answers, and promises absolutely nothing for the no answers.","live":["g","va","vb","vc","vd","ve","vf","e_ab","e_bc","e_cd","e_de","e_ef","e_fa","e_be","p_panel","np_panel","inclusion","head_classes"],"does":[[229.688,"point_4 is shown on the screen, grown."],[231.688,"point_4 is hidden from the screen."]]},{"start":234.9785,"say":"Vertex cover shows you why. To demonstrate that a cover of size three exists, you point at one, like this. To demonstrate that none exists, you would have to rule out every subset, and there is no short way to write that down.","live":null,"does":[[240.551,"vb is indicated — a transient flash."],[240.851,"vd is indicated — a transient flash."],[241.151,"vf is indicated — a transient flash."]]},{"start":249.2895,"say":"So that is the class. Now the question that organises everything else. What does it mean to say that one problem inside it is harder than another?","live":null,"does":[[258.32183333333336,"g is hidden from the screen — left the board."],[258.32183333333336,"va is hidden from the screen — g left the board."],[258.32183333333336,"vb is hidden from the screen — g left the board."],[258.32183333333336,"vc is hidden from the screen — g left the board."],[258.32183333333336,"vd is hidden from the screen — g left the board."],[258.32183333333336,"ve is hidden from the screen — g left the board."],[258.32183333333336,"vf is hidden from the screen — g left the board."],[258.32183333333336,"e_ab is hidden from the screen — g left the board."],[258.32183333333336,"e_bc is hidden from the screen — g left the board."],[258.32183333333336,"e_cd is hidden from the screen — g left the board."],[258.32183333333336,"e_de is hidden from the screen — g left the board."],[258.32183333333336,"e_ef is hidden from the screen — g left the board."],[258.32183333333336,"e_fa is hidden from the screen — g left the board."],[258.32183333333336,"e_be is hidden from the screen — g left the board."],[258.32183333333336,"head_classes is hidden from the screen — left the board."],[258.32183333333336,"inclusion is hidden from the screen — left the board."],[258.32183333333336,"np_panel is hidden from the screen — left the board."],[258.32183333333336,"p_panel is hidden from the screen — left the board."]]}]},{"title":"What a Reduction Proves","start":259.36350000000004,"end":477.16945833333335,"objects":{"arrow_f":"an Arrow [yellow] labelled \"f\" drawn in pipe (start=(2.7, 2.2), end=(4.1, 2.2))","arrow_in":"an Arrow [gray] drawn in pipe (start=(6.9, 2.2), end=(7.9, 2.2))","arrow_out":"an Arrow [gray] drawn in pipe (start=(11.1, 2.2), end=(11.9, 2.2))","box_fw":"a Polygon [green] drawn in pipe (vertices=((4.3, 1.4), (6.7, 1.4), (6.7, 3.0), (4.3, 3.0)), fill_opacity=0.18)","box_s":"a Polygon [yellow] drawn in pipe (vertices=((8.1, 1.4), (10.9, 1.4), (10.9, 3.0), (8.1, 3.0)), fill_opacity=0.18)","box_w":"a Polygon [blue] drawn in pipe (vertices=((0.3, 1.4), (2.5, 1.4), (2.5, 3.0), (0.3, 3.0)), fill_opacity=0.18)","chain":"a Math [text] that says \"$L <=_p upright(\"3SAT\") <=_p B$\"","complete_panel":"a Panel that says \"$B$ is NP-complete when $B$ is NP-hard and $B in upright(\"NP\")$.\"","cook":"a Panel that says \"$upright(\"SAT\")$ is NP-complete, and so is $upright(\"3SAT\")$.\"","dir_no":"a Math [text] that says \"$A in.not upright(\"P\") quad arrow.r.double quad B in.not upright(\"P\")$\"","dir_yes":"a Math [text] that says \"$B in upright(\"P\") quad arrow.r.double quad A in upright(\"P\")$\"","hard_math":"a Math [text] that says \"$forall L in upright(\"NP\"): thin L <=_p B$\"","hard_panel":"a Panel that says \"$B$ is NP-hard when every problem in NP reduces to $B$ in polynomial time.\"","head_complete":"a Heading that says \"NP-Hard and NP-Complete\"","head_direction":"a Heading that says \"Which Way Hardness Travels\"","head_reduce":"a Heading that says \"Borrowing One Solver for Another Problem\"","head_wrong":"a Heading that says \"The Direction Is the Proof\"","lbl_ans":"a Math [text] that says \"$upright(\"yes / no\")$\" drawn in pipe","lbl_fw":"a Math [green] that says \"$f(w)$\" drawn in pipe","lbl_s":"a Math [yellow] that says \"$upright(\"solver for \") B$\" drawn in pipe","lbl_w":"a Math [blue] that says \"$w$\" drawn in pipe","notation":"a Math [text] that says \"$A <=_p B$\"","pipe":"a Figure (x_range=(0.0, 13.5), y_range=(0.0, 4.2), aspect=(13.5, 4.2))","poly_line":"a Tex [text] that says \"$f$ is computable in polynomial time.\"","red_def":"a Math [text] that says \"$w in A quad arrow.l.r.double quad f(w) in B$\"","right_text":"a Text [text] that says \"Every 3SAT instance becomes a $B$ instance. A fast algorithm for $B$ would settle 3SAT, and with it all of NP. That is a lower bound on $B$.\"","right_way":"a Math [text] that says \"$upright(\"3SAT\") <=_p B$\"","tag_a":"a Math [blue] that says \"$upright(\"instance of \") A$\" drawn in pipe","tag_b":"a Math [green] that says \"$upright(\"instance of \") B$\" drawn in pipe","tex":"a Tex [text] that says \"Proves $B$ is hard\"","tex_2":"a Tex [text] that says \"Proves nothing about $B$\"","travel":"a Tex [text] that says \"Hardness travels forwards along the arrow.\"","wrong_text":"a Text [text] that says \"Every $B$ instance becomes a 3SAT instance. That bounds $B$ from above by a problem nobody can solve quickly, which says nothing about $B$ at all.\"","wrong_way":"a Math [text] that says \"$B <=_p upright(\"3SAT\")$\""},"beats":[{"start":259.36350000000004,"say":"Suppose I have two problems, A and B, and suppose somebody has already handed me a solver for B. Can I get A for free? Sometimes I can, and this is the shape of the arrangement.","live":[],"does":[[259.36350000000004,"head_reduce is shown on the screen, written out."],[259.36350000000004,"pipe is shown on the screen, written out."],[260.11850000000004,"box_w is shown on the screen, written out."],[260.31850000000003,"lbl_w is shown on the screen, written out."],[260.5185,"tag_a is shown on the screen, written out."]]},{"start":271.7825,"say":"Take any instance w of A. Run it through a translator, a function f, and out comes a string. Hand that string to the solver for B, and take whatever the solver says as your answer about w.","live":["pipe","head_reduce","box_w","lbl_w","tag_a"],"does":[[274.77850000000007,"arrow_f is shown on the screen, drawn."],[277.12350000000004,"box_fw is shown on the screen, written out."],[277.3235,"lbl_fw is shown on the screen, written out."],[277.5235,"tag_b is shown on the screen, written out."],[278.69050000000004,"arrow_in is shown on the screen, drawn."],[278.89050000000003,"box_s is shown on the screen, written out."],[279.19050000000004,"lbl_s is shown on the screen, written out."],[283.13750000000005,"arrow_out is shown on the screen, drawn."],[283.33750000000003,"lbl_ans is shown on the screen, written out."]]},{"start":285.20050000000003,"say":"For that to be honest, f has to be faithful. w is a yes instance of A exactly when f of w is a yes instance of B. Not usually, not most of the time. Exactly when, and in both directions.","live":["pipe","head_reduce","box_w","lbl_w","tag_a","arrow_f","box_fw","lbl_fw","tag_b","arrow_in","box_s","lbl_s","arrow_out","lbl_ans"],"does":[[287.75450000000006,"red_def is shown on the screen, written out."],[298.48150000000004,"red_def (the \"arrow.l.r.double\" part) is indicated — a transient flash."]]},{"start":300.38250000000005,"say":"And f itself has to be cheap: computable in polynomial time. If translating cost more than solving, the whole arrangement would be pointless.","live":["pipe","red_def","head_reduce","box_w","lbl_w","tag_a","arrow_f","box_fw","lbl_fw","tag_b","arrow_in","box_s","lbl_s","arrow_out","lbl_ans"],"does":[[302.17050000000006,"poly_line is shown on the screen, written out."]]},{"start":310.45550000000003,"say":"A translator with those two properties is a polynomial-time reduction, and we write it with this symbol. Read the symbol as no harder than. A is no harder than B, up to a polynomial.","live":["pipe","red_def","poly_line","head_reduce","box_w","lbl_w","tag_a","arrow_f","box_fw","lbl_fw","tag_b","arrow_in","box_s","lbl_s","arrow_out","lbl_ans"],"does":[[315.87750000000005,"notation is shown on the screen, written out."],[322.855,"pipe moves to a new place on the board."],[322.855,"head_reduce is hidden from the screen — left the board."],[322.855,"notation is hidden from the screen — left the board."],[322.855,"poly_line is hidden from the screen — left the board."],[322.855,"red_def is hidden from the screen — left the board."]]},{"start":324.05500000000006,"say":"Now read that picture as a claim about difficulty, because this is where people get turned around. Suppose B has a polynomial-time algorithm. Then A has one too. Translate, then solve, and both steps are polynomial.","live":["pipe","box_w","lbl_w","tag_a","arrow_f","box_fw","lbl_fw","tag_b","arrow_in","box_s","lbl_s","arrow_out","lbl_ans"],"does":[[324.05500000000006,"head_direction is shown on the screen, written out."],[330.0335,"dir_yes is shown on the screen, written out."],[335.61850000000004,"arrow_f is indicated — a transient flash."],[336.59350000000006,"box_s is indicated — a transient flash."]]},{"start":340.2355,"say":"Turn that implication around and you get the useful form. If A has no polynomial-time algorithm, then B cannot have one either, because a fast B would have handed us a fast A.","live":["pipe","box_w","lbl_w","tag_a","arrow_f","box_fw","lbl_fw","tag_b","arrow_in","box_s","lbl_s","arrow_out","lbl_ans","dir_yes","head_direction"],"does":[[340.5835000000001,"dir_no is shown on the screen, written out."]]},{"start":352.759,"say":"So hardness travels forwards along the arrow, out of A and into B, while easiness travels backwards. Point at the arrow and you are pointing at the direction of the claim. That single sentence is most of what an examiner is checking.","live":["pipe","box_w","lbl_w","tag_a","arrow_f","box_fw","lbl_fw","tag_b","arrow_in","box_s","lbl_s","arrow_out","lbl_ans","dir_yes","dir_no","head_direction"],"does":[[354.3845,"travel is shown on the screen, written out."],[360.46850000000006,"arrow_f is indicated — a transient flash."],[368.189,"dir_no is hidden from the screen — left the board."],[368.189,"dir_yes is hidden from the screen — left the board."],[368.189,"head_direction is hidden from the screen — left the board."],[368.189,"pipe is hidden from the screen — left the board."],[368.189,"box_w is hidden from the screen — pipe left the board."],[368.189,"lbl_w is hidden from the screen — pipe left the board."],[368.189,"tag_a is hidden from the screen — pipe left the board."],[368.189,"arrow_f is hidden from the screen — pipe left the board."],[368.189,"box_fw is hidden from the screen — pipe left the board."],[368.189,"lbl_fw is hidden from the screen — pipe left the board."],[368.189,"tag_b is hidden from the screen — pipe left the board."],[368.189,"arrow_in is hidden from the screen — pipe left the board."],[368.189,"box_s is hidden from the screen — pipe left the board."],[368.189,"lbl_s is hidden from the screen — pipe left the board."],[368.189,"arrow_out is hidden from the screen — pipe left the board."],[368.189,"lbl_ans is hidden from the screen — pipe left the board."],[368.189,"travel is hidden from the screen — left the board."]]},{"start":369.389,"say":"Which fixes the direction you must write your proof in. If you want to show that your new problem B is hard, you take a problem already known to be hard, and you reduce it into B.","live":[],"does":[[369.389,"head_wrong is shown on the screen, written out."],[378.6075000000001,"right_way is shown on the screen, written out."],[379.10650000000004,"right_text is shown on the screen, written out."]]},{"start":380.70500000000004,"say":"The other way round does prove something, but not that. A reduction from B into three satisfiability says B is no harder than three satisfiability. That is an upper bound, not a lower one.","live":["right_way","right_text","head_wrong"],"does":[[384.81550000000004,"wrong_way is shown on the screen, written out."],[392.16350000000006,"wrong_text is shown on the screen, written out."]]},{"start":394.981,"say":"It is the single most common way to write the proof backwards, so when you are stuck, ask which problem is the source of the arrow. The source is always the one you already trust to be hard.","live":["right_way","right_text","wrong_way","wrong_text","head_wrong"],"does":[[401.47150000000005,"right_way is indicated — a transient flash."],[406.75350000000003,"head_wrong is hidden from the screen — left the board."],[406.75350000000003,"right_text is hidden from the screen — left the board."],[406.75350000000003,"right_way is hidden from the screen — left the board."],[406.75350000000003,"wrong_text is hidden from the screen — left the board."],[406.75350000000003,"wrong_way is hidden from the screen — left the board."]]},{"start":407.9535,"say":"Now the two names. A problem B is NP-hard when every problem in NP reduces to it in polynomial time. Every one. Including all the ones nobody has thought of yet.","live":[],"does":[[407.9535,"head_complete is shown on the screen, written out."],[412.71350000000007,"hard_math is shown on the screen, written out."],[417.82250000000005,"hard_panel is shown on the screen, written out."]]},{"start":421.1155,"say":"And B is NP-complete when it is NP-hard and it is itself a member of NP. The NP-complete problems are the hardest problems in the class, and they all stand or fall together.","live":["hard_math","hard_panel","head_complete"],"does":[[426.22450000000003,"complete_panel is shown on the screen, written out."]]},{"start":435.2995,"say":"That definition looks impossible to verify, because NP contains infinitely many problems. Cook and Levin did the impossible part once, in nineteen seventy one, by encoding an arbitrary polynomial-time verification directly as a Boolean formula.","live":["hard_math","hard_panel","complete_panel","head_complete"],"does":[[441.9175,"cook is shown on the screen, written out."]]},{"start":452.79150000000004,"say":"Three satisfiability, the restriction where every clause has exactly three literals, is NP-complete too. So nobody after them has to go back to Turing machines. You reduce three satisfiability into your problem, and transitivity carries all of NP along behind.","live":["hard_math","hard_panel","complete_panel","cook","head_complete"],"does":[[464.68050000000005,"chain is shown on the screen, written out."],[467.9655,"chain (the \"upright(\"3SAT\")\" part) is indicated — a transient flash."]]},{"start":471.619,"say":"Which is exactly what we are going to do now, once, in full.","live":["hard_math","hard_panel","complete_panel","cook","chain","head_complete"],"does":[[476.12779166666667,"chain is hidden from the screen — left the board."],[476.12779166666667,"complete_panel is hidden from the screen — left the board."],[476.12779166666667,"cook is hidden from the screen — left the board."],[476.12779166666667,"hard_math is hidden from the screen — left the board."],[476.12779166666667,"hard_panel is hidden from the screen — left the board."],[476.12779166666667,"head_complete is hidden from the screen — left the board."]]}]},{"title":"Two Gadgets","start":477.16945833333335,"end":681.0023541666667,"objects":{"budget":"a Math [text] that says \"$k = n + 2m$\"","cls_claim":"a Tex [text] that says \"Every cover takes at least two vertices of this triangle.\"","cls_read":"a Tex [text] that says \"So at most one vertex of the triangle is left outside.\"","cls_tag":"a Math [green] that says \"$upright(\"clause gadget\")$\" drawn in gad","gad":"a Figure (x_range=(0.0, 9.2), y_range=(0.0, 6.4), aspect=(9.2, 6.4))","head_3sat":"a Heading that says \"Three Satisfiability\"","head_clause":"a Heading that says \"One Triangle Per Clause\"","head_var":"a Heading that says \"One Edge Per Variable\"","head_wire":"a Heading that says \"The Wires and the Budget\"","phi":"a Math [text] that says \"$phi = (x_1 or x_2 or overline(x)_3) and (overline(x)_1 or overline(x)_2 or x_3)$\"","sat_panel":"a Panel that says \"A 3SAT instance is a conjunction of clauses, each a disjunction of exactly three literals, where a literal is a variable or its negation. Is there an assignment making every clause true?\"","t_ab":"a Line [green] drawn in gad (start=(6.4, 3.8), end=(5.0, 1.2))","t_bc":"a Line [green] drawn in gad (start=(5.0, 1.2), end=(7.8, 1.2))","t_ca":"a Line [green] drawn in gad (start=(7.8, 1.2), end=(6.4, 3.8))","tb":"a Point [green] labelled \"overline(y)\" drawn in gad (location=(5.0, 1.2), marker_radius=0.13)","tc":"a Point [green] labelled \"z\" drawn in gad (location=(7.8, 1.2), marker_radius=0.13)","tight_panel":"a Panel that says \"The variable gadgets force $n$ vertices and the clause gadgets force $2m$ more, and those vertices are all distinct. So $k = n + 2m$ is the smallest budget that could possibly work.\"","tt":"a Point [green] labelled \"x\" drawn in gad (location=(6.4, 3.8), marker_radius=0.13)","var_claim":"a Tex [text] that says \"Every cover takes at least one endpoint of this edge.\"","var_edge":"a Line [blue] drawn in gad (start=(1.4, 5.0), end=(3.8, 5.0))","var_read":"a Panel that says \"If the cover takes the $x$ vertex, read $x$ as true. If it takes the $overline(x)$ vertex, read $x$ as false.\"","var_tag":"a Math [blue] that says \"$upright(\"variable gadget\")$\" drawn in gad","vn":"a Point [blue] labelled \"overline(x)\" drawn in gad (location=(3.8, 5.0), marker_radius=0.13)","vx":"a Point [blue] labelled \"x\" drawn in gad (location=(1.4, 5.0), marker_radius=0.13)","wire":"a Line [gray] drawn in gad (start=(1.4, 5.0), end=(6.4, 3.8))","wire_text":"a Text [text] that says \"For each literal in each clause, join that clause vertex to the gadget vertex carrying the same literal.\""},"beats":[{"start":477.16945833333335,"say":"Three satisfiability. You are handed a Boolean formula in one fixed shape. It is a conjunction of clauses, and each clause is a disjunction of exactly three literals, where a literal means a variable or the negation of one.","live":[],"does":[[477.16945833333335,"head_3sat is shown on the screen, written out."],[482.1034583333334,"sat_panel is shown on the screen, written out."]]},{"start":492.95545833333335,"say":"The question is whether some assignment of true and false to the variables makes the whole formula come out true. And here is the formula we are going to carry for the rest of the lecture.","live":["sat_panel","head_3sat"],"does":[[500.23445833333335,"phi is shown on the screen, written out."]]},{"start":504.22445833333336,"say":"Three variables and two clauses. The first clause is x one or x two or not x three. The second is not x one or not x two or x three. Small enough to settle by inspection, which is exactly why it is safe to use.","live":["phi","sat_panel","head_3sat"],"does":[[507.20845833333334,"phi (the \"(x_1 or x_2 or overline(x)_3)\" part) is emphasized."],[511.27245833333336,"phi (the \"(overline(x)_1 or overline(x)_2 or x_3)\" part) is emphasized."],[511.27245833333336,"phi (the \"(x_1 or x_2 or overline(x)_3)\" part) is no longer emphasized."],[515.5674583333333,"phi (the \"(overline(x)_1 or overline(x)_2 or x_3)\" part) is no longer emphasized."]]},{"start":520.9279583333333,"say":"We are not going to be clever about this formula. We are going to translate it, mechanically, into a graph and a number. The translator is built from two pieces, one for each kind of object a formula contains.","live":null,"does":[[534.3024583333333,"head_3sat is hidden from the screen — left the board."],[534.3024583333333,"phi is hidden from the screen — left the board."],[534.3024583333333,"sat_panel is hidden from the screen — left the board."]]},{"start":535.5024583333334,"say":"First piece: one gadget for every variable. It is a single edge, and its two endpoints are the two literals of that variable. x on one side, not x on the other.","live":[],"does":[[535.5024583333334,"head_var is shown on the screen, written out."],[535.5024583333334,"gad is shown on the screen, written out."],[541.4124583333333,"vx is shown on the screen, written out."],[541.6624583333333,"vn is shown on the screen, written out."],[541.9624583333333,"var_edge is shown on the screen, drawn."],[542.3624583333334,"var_tag is shown on the screen, written out."]]},{"start":547.3069583333333,"say":"A cover has to touch every edge of the graph, and this is an edge. So any cover at all contains at least one of these two vertices. That is a cost we are going to charge for in a moment.","live":["gad","head_var","vx","vn","var_edge","var_tag"],"does":[[552.7164583333333,"gad moves to a new place on the board."],[552.7164583333333,"var_claim is shown on the screen, written out."],[556.1074583333334,"var_edge is indicated — a transient flash."]]},{"start":559.0989583333334,"say":"And here is the reading that makes the entire proof work. Which endpoint the cover takes is a truth value. Take the x side and we call x true. Take the not x side and we call x false. The gadget is a switch.","live":["var_claim","gad","head_var","vx","vn","var_edge","var_tag"],"does":[[560.0274583333334,"var_read is shown on the screen, written out."],[567.9574583333333,"vx is indicated — a transient flash."],[571.3824583333334,"vn is indicated — a transient flash."],[574.2499583333333,"head_var is hidden from the screen — left the board."],[574.2499583333333,"var_claim is hidden from the screen — left the board."],[574.2499583333333,"var_read is hidden from the screen — left the board."]]},{"start":574.8499583333333,"say":"Second piece: one gadget for every clause. It is a triangle, and its three vertices are the clause's three literals, one copy of each.","live":["gad","vx","vn","var_edge","var_tag"],"does":[[574.8499583333333,"head_clause is shown on the screen, written out."],[581.1304583333333,"tt is shown on the screen, written out."],[581.3804583333333,"tb is shown on the screen, written out."],[581.6304583333333,"tc is shown on the screen, written out."],[582.7564583333334,"t_ab is shown on the screen, drawn."],[583.0064583333334,"t_bc is shown on the screen, drawn."],[583.2564583333334,"t_ca is shown on the screen, drawn."],[583.6564583333334,"cls_tag is shown on the screen, written out."]]},{"start":585.5969583333333,"say":"A triangle has three edges, and no single vertex touches all three. Take just the top one: it meets two of the edges and misses the bottom edge entirely. So one vertex is never enough.","live":["gad","vx","vn","var_edge","var_tag","head_clause","tt","tb","tc","t_ab","t_bc","t_ca","cls_tag"],"does":[[591.5644583333334,"tt is emphasized."],[594.0484583333333,"The segment (5.0, 1.2) to (7.8, 1.2) in gad is lit up."]]},{"start":599.0724583333333,"say":"Take any two of them and every edge is covered, whichever two you choose. So each triangle costs at least two vertices. Equivalently, exactly one of the three can be left outside the cover, and that fact is what the whole proof will lean on.","live":null,"does":[[599.0724583333333,"tt is no longer emphasized."],[599.0724583333333,"gad: retire a lit segment (unemphasize_line)."],[602.7404583333333,"tb is emphasized."],[603.0404583333334,"tc is emphasized."],[605.2944583333333,"cls_claim is shown on the screen, written out."],[607.6524583333334,"cls_read is shown on the screen, written out."],[614.7574583333334,"cls_claim is hidden from the screen — left the board."],[614.7574583333334,"cls_read is hidden from the screen — left the board."],[614.7574583333334,"head_clause is hidden from the screen — left the board."]]},{"start":615.3574583333334,"say":"Third piece, and this one is not a gadget but a wire. For every literal in every clause, join that clause vertex to the variable gadget vertex carrying the same literal.","live":["gad","vx","vn","var_edge","var_tag","tt","tb","tc","t_ab","t_bc","t_ca","cls_tag"],"does":[[615.3574583333334,"head_wire is shown on the screen, written out."],[615.3574583333334,"tb is no longer emphasized."],[615.3574583333334,"tc is no longer emphasized."],[621.7314583333334,"wire_text is shown on the screen, written out."]]},{"start":626.8189583333334,"say":"Here the triangle's x vertex is wired back to the x endpoint upstairs. The other two literals of this clause would run off to their own gadgets, which I have not drawn.","live":["gad","vx","vn","var_edge","var_tag","tt","tb","tc","t_ab","t_bc","t_ca","cls_tag","wire_text","head_wire"],"does":[[629.0654583333334,"wire is shown on the screen, drawn."],[629.2654583333333,"tt is indicated — a transient flash."],[630.3654583333333,"vx is indicated — a transient flash."]]},{"start":638.1239583333333,"say":"That is the whole construction. Two vertices and one edge per variable, three vertices and three edges per clause, and one wire per literal. Nothing depends on anything being clever.","live":["gad","vx","vn","var_edge","var_tag","tt","tb","tc","t_ab","t_bc","t_ca","cls_tag","wire_text","head_wire","wire"],"does":[]},{"start":651.1639583333333,"say":"And now the number. With n variables and m clauses, set k to n plus two m. One vertex per variable gadget, two per clause gadget, and not a single vertex to spare.","live":null,"does":[[655.2734583333333,"budget is shown on the screen, written out."]]},{"start":664.6854583333334,"say":"That tightness is the engine of the whole proof. The gadgets force n, the triangles force two m, those vertex sets do not overlap, so every cover has at least that many. Asking for exactly that many leaves no freedom anywhere.","live":["gad","vx","vn","var_edge","var_tag","tt","tb","tc","t_ab","t_bc","t_ca","cls_tag","wire_text","budget","head_wire","wire"],"does":[[666.1594583333334,"tight_panel is shown on the screen, written out."],[679.9606875000001,"budget is hidden from the screen — left the board."],[679.9606875000001,"gad is hidden from the screen — left the board."],[679.9606875000001,"vx is hidden from the screen — gad left the board."],[679.9606875000001,"vn is hidden from the screen — gad left the board."],[679.9606875000001,"var_edge is hidden from the screen — gad left the board."],[679.9606875000001,"var_tag is hidden from the screen — gad left the board."],[679.9606875000001,"tt is hidden from the screen — gad left the board."],[679.9606875000001,"tb is hidden from the screen — gad left the board."],[679.9606875000001,"tc is hidden from the screen — gad left the board."],[679.9606875000001,"t_ab is hidden from the screen — gad left the board."],[679.9606875000001,"t_bc is hidden from the screen — gad left the board."],[679.9606875000001,"t_ca is hidden from the screen — gad left the board."],[679.9606875000001,"cls_tag is hidden from the screen — gad left the board."],[679.9606875000001,"wire is hidden from the screen — gad left the board."],[679.9606875000001,"head_wire is hidden from the screen — left the board."],[679.9606875000001,"tight_panel is hidden from the screen — left the board."],[679.9606875000001,"wire_text is hidden from the screen — left the board."]]}]},{"title":"One Formula, One Graph","start":681.0023541666667,"end":1107.9585208333333,"objects":{"G":"a Figure (x_range=(0.2, 9.9), y_range=(0.2, 7.1), aspect=(9.7, 6.9))","assign":"a Table [text] that says \"Variable Value $x_1$ true $x_2$ false $x_3$ true\" (rows=(('Variable', 'Value'), ('$x_1$', 'true'), ('$x_2$', 'false'), …, header=True)","back_table":"a Table [text] that says \"Variable Value $x_1$ false $x_2$ true $x_3$ false\" (rows=(('Variable', 'Value'), ('$x_1$', 'false'), ('$x_2$', 'true'), …, header=True)","c1a":"a Point [green] labelled \"x_1\" drawn in G (location=(1.2, 1.0), marker_radius=0.1)","c1b":"a Point [green] labelled \"x_2\" drawn in G (location=(2.4, 3.2), marker_radius=0.1)","c1c":"a Point [green] labelled \"overline(x)_3\" drawn in G (location=(3.6, 1.0), marker_radius=0.1)","c2a":"a Point [green] labelled \"overline(x)_1\" drawn in G (location=(6.5, 1.0), marker_radius=0.1)","c2b":"a Point [green] labelled \"overline(x)_2\" drawn in G (location=(7.7, 3.2), marker_radius=0.1)","c2c":"a Point [green] labelled \"x_3\" drawn in G (location=(8.9, 1.0), marker_radius=0.1)","cover_size":"a Math [text] that says \"$|S| = 3 + 4 = 7$\"","edge_list":"a Block [text] that says \"variable edges: one endpoint taken triangle edges: two of three taken wires: the risky case\"","forced":"a Block [text] that says \"Exactly one endpoint of each variable edge is in $S$. Exactly two vertices of each triangle are in $S$. The excluded triangle vertex forces its literal true.\"","g_n1":"a Point [blue] labelled \"overline(x)_1\" drawn in G (location=(2.6, 6.3), marker_radius=0.1)","g_n2":"a Point [blue] labelled \"overline(x)_2\" drawn in G (location=(5.9, 6.3), marker_radius=0.1)","g_n3":"a Point [blue] labelled \"overline(x)_3\" drawn in G (location=(9.2, 6.3), marker_radius=0.1)","g_x1":"a Point [blue] labelled \"x_1\" drawn in G (location=(0.9, 6.3), marker_radius=0.1)","g_x2":"a Point [blue] labelled \"x_2\" drawn in G (location=(4.2, 6.3), marker_radius=0.1)","g_x3":"a Point [blue] labelled \"x_3\" drawn in G (location=(7.5, 6.3), marker_radius=0.1)","head_back":"a Heading that says \"From a Cover to an Assignment\"","head_budget":"a Heading that says \"Why Seven Is the Only Budget\"","head_build":"a Heading that says \"The Graph This Formula Becomes\"","head_edges":"a Heading that says \"Every Edge Accounted For\"","head_forward":"a Heading that says \"From an Assignment to a Cover\"","lower":"an Arithmetic [text] that says \"$3 times 1 = 3 2 times 2 = 4 k = 7$\" (operator='+', operands=('3 times 1 = 3', '2 times 2 = 4'), result='k = 7')","phi":"a Derivation [text] that says \"$phi &= (x_1 or x_2 or overline(x)_3) \\ &and (overline(x)_1 or overline(x)_2 or x_3)$\"","point":"a Point [yellow] drawn in G (location=(1.2, 1.0))","point_2":"a Point [yellow] drawn in G (location=(7.7, 3.2))","point_3":"a Point [yellow] drawn in G (location=(1.2, 1.0))","point_4":"a Point [yellow] drawn in G (location=(7.7, 3.2))","point_5":"a Point [yellow] drawn in G (location=(2.4, 3.2))","point_6":"a Point [yellow] drawn in G (location=(6.5, 1.0))","size_line":"a Tex [text] that says \"12 vertices, 15 edges, one pass over $phi$.\"","t1_ab":"a Line [green] drawn in G (start=(1.2, 1.0), end=(2.4, 3.2))","t1_bc":"a Line [green] drawn in G (start=(2.4, 3.2), end=(3.6, 1.0))","t1_ca":"a Line [green] drawn in G (start=(3.6, 1.0), end=(1.2, 1.0))","t2_ab":"a Line [green] drawn in G (start=(6.5, 1.0), end=(7.7, 3.2))","t2_bc":"a Line [green] drawn in G (start=(7.7, 3.2), end=(8.9, 1.0))","t2_ca":"a Line [green] drawn in G (start=(8.9, 1.0), end=(6.5, 1.0))","tight":"a Panel that says \"A cover of size 7 has no slack: exactly one endpoint of each variable edge, and exactly two vertices of each triangle.\"","ve1":"a Line [blue] drawn in G (start=(0.9, 6.3), end=(2.6, 6.3))","ve2":"a Line [blue] drawn in G (start=(4.2, 6.3), end=(5.9, 6.3))","ve3":"a Line [blue] drawn in G (start=(7.5, 6.3), end=(9.2, 6.3))","w1":"a Line [gray] drawn in G (start=(1.2, 1.0), end=(0.9, 6.3))","w2":"a Line [gray] drawn in G (start=(2.4, 3.2), end=(4.2, 6.3))","w3":"a Line [gray] drawn in G (start=(3.6, 1.0), end=(9.2, 6.3))","w4":"a Line [gray] drawn in G (start=(6.5, 1.0), end=(2.6, 6.3))","w5":"a Line [gray] drawn in G (start=(7.7, 3.2), end=(5.9, 6.3))","w6":"a Line [gray] drawn in G (start=(8.9, 1.0), end=(7.5, 6.3))"},"beats":[{"start":681.0023541666667,"say":"Here is our formula again, and here is the graph it becomes. Three variables, so three variable gadgets. One edge each, six vertices in all, one pair per variable.","live":[],"does":[[681.0023541666667,"head_build is shown on the screen, written out."],[681.0023541666667,"G is shown on the screen, written out."],[681.0023541666667,"phi is shown on the screen, written out."],[681.4023541666667,"phi is shown on the screen, written out."],[687.7593541666666,"g_x1 is shown on the screen, written out."],[687.8893541666666,"g_n1 is shown on the screen, written out."],[688.0193541666667,"g_x2 is shown on the screen, written out."],[688.1493541666667,"g_n2 is shown on the screen, written out."],[688.2793541666667,"g_x3 is shown on the screen, written out."],[688.4093541666667,"g_n3 is shown on the screen, written out."],[689.0943541666667,"ve1 is shown on the screen, drawn."],[689.2943541666667,"ve2 is shown on the screen, drawn."],[689.4943541666667,"ve3 is shown on the screen, drawn."]]},{"start":693.5028541666667,"say":"Two clauses, so two triangles. The first clause is x one or x two or not x three, and its triangle carries exactly those three literals, one vertex each.","live":["G","head_build","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3"],"does":[[696.6833541666667,"phi (the \"(x_1 or x_2 or overline(x)_3)\" part) is emphasized."],[703.2203541666667,"c1a is shown on the screen, written out."],[703.4203541666667,"c1b is shown on the screen, written out."],[703.6203541666667,"c1c is shown on the screen, written out."],[704.2073541666667,"t1_ab is shown on the screen, drawn."],[704.3873541666667,"t1_bc is shown on the screen, drawn."],[704.5673541666667,"t1_ca is shown on the screen, drawn."]]},{"start":705.9678541666667,"say":"The second clause is not x one or not x two or x three, and its triangle carries those. Notice that every literal now appears twice over. Once up in a gadget, and once down in a triangle.","live":["G","head_build","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca"],"does":[[705.9678541666667,"phi (the \"(x_1 or x_2 or overline(x)_3)\" part) is no longer emphasized."],[706.4903541666667,"phi (the \"(overline(x)_1 or overline(x)_2 or x_3)\" part) is emphasized."],[711.1113541666667,"c2a is shown on the screen, written out."],[711.3113541666667,"c2b is shown on the screen, written out."],[711.5113541666667,"c2c is shown on the screen, written out."],[714.4433541666667,"t2_ab is shown on the screen, drawn."],[714.6233541666667,"t2_bc is shown on the screen, drawn."],[714.8033541666667,"t2_ca is shown on the screen, drawn."]]},{"start":719.9543541666667,"say":"Now the wires. Every clause vertex joins the gadget vertex with the same label. The x one copy runs up to x one, the x two copy runs to x two, and the not x three copy runs all the way across the picture.","live":["G","head_build","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca"],"does":[[719.9543541666667,"phi (the \"(overline(x)_1 or overline(x)_2 or x_3)\" part) is no longer emphasized."],[727.4433541666667,"w1 is shown on the screen, drawn."],[730.5893541666667,"w2 is shown on the screen, drawn."],[733.6303541666667,"w3 is shown on the screen, drawn."]]},{"start":735.4848541666667,"say":"The second triangle wires the same way. Not x one, not x two, and x three, each to its own endpoint upstairs. Six literals, six wires.","live":["G","head_build","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3"],"does":[[738.7123541666667,"w4 is shown on the screen, drawn."],[739.5593541666667,"w5 is shown on the screen, drawn."],[740.4653541666667,"w6 is shown on the screen, drawn."]]},{"start":746.6383541666667,"say":"Twelve vertices and fifteen edges. Look at how that was built. One pass over the formula, writing down a fixed number of vertices and edges per variable and per clause. That is the polynomial-time half of the reduction, and it is the easy half.","live":["G","head_build","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6"],"does":[[751.9323541666666,"size_line is shown on the screen, written out."],[762.8693541666667,"head_build is hidden from the screen — left the board."],[762.8693541666667,"phi is hidden from the screen — left the board."],[762.8693541666667,"size_line is hidden from the screen — left the board."]]},{"start":764.0693541666667,"say":"Now the number. Each of the three variable edges demands at least one vertex, because a cover has to touch it. Three edges, one apiece, so three.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6"],"does":[[764.0693541666667,"head_budget is shown on the screen, written out."],[767.2853541666667,"ve1 is emphasized."],[767.5353541666667,"ve2 is emphasized."],[767.7853541666667,"ve3 is emphasized."],[772.1853541666667,"lower is shown on the screen, written out."]]},{"start":774.3058541666667,"say":"Each of the two triangles demands at least two, as we showed. Two triangles, two apiece, so four. And those five demands sit on completely separate vertices, so they simply add.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","head_budget"],"does":[[774.3058541666667,"ve1 is no longer emphasized."],[774.3058541666667,"ve2 is no longer emphasized."],[774.3058541666667,"ve3 is no longer emphasized."],[775.2693541666666,"t1_ab is emphasized."],[775.2693541666666,"t1_bc is emphasized."],[775.2693541666666,"t1_ca is emphasized."],[775.2693541666666,"t2_ab is emphasized."],[775.2693541666666,"t2_bc is emphasized."],[775.2693541666666,"t2_ca is emphasized."],[779.3333541666667,"lower is shown on the screen, written out."]]},{"start":786.3993541666666,"say":"Rule a line under them and add. Seven. Every vertex cover of this graph has at least seven vertices, whatever it looks like, and seven is exactly the budget the construction sets.","live":null,"does":[[786.3993541666666,"t1_ab is no longer emphasized."],[786.3993541666666,"t1_bc is no longer emphasized."],[786.3993541666666,"t1_ca is no longer emphasized."],[786.3993541666666,"t2_ab is no longer emphasized."],[786.3993541666666,"t2_bc is no longer emphasized."],[786.3993541666666,"t2_ca is no longer emphasized."],[786.7013541666666,"lower is shown on the screen, drawn."],[787.5013541666667,"lower is shown on the screen, drawn."],[788.9073541666667,"lower is shown on the screen, written out."]]},{"start":798.7833541666666,"say":"So asking for a cover of size seven is asking for one with no slack at all. Exactly one endpoint from each variable edge. Exactly two vertices from each triangle. Nothing left over to patch anything up with.","live":null,"does":[[802.4873541666667,"tight is shown on the screen, written out."],[811.1713541666667,"head_budget is hidden from the screen — left the board."],[811.1713541666667,"lower is hidden from the screen — left the board."],[811.1713541666667,"tight is hidden from the screen — left the board."]]},{"start":812.3713541666667,"say":"Take the formula's side first. Set x one true, x two false, and x three true. Check it against both clauses.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6"],"does":[[812.3713541666667,"head_forward is shown on the screen, written out."],[814.4143541666667,"assign is shown on the screen, written out."],[814.7143541666667,"assign is shown on the screen, written out."],[815.0143541666666,"assign is shown on the screen, written out."],[815.3143541666667,"assign is shown on the screen, written out."]]},{"start":820.8778541666667,"say":"Clause one is x one or x two or not x three. Its first literal is true, so the clause holds. Clause two is not x one or not x two or x three, and not x two is true, since x two is false. Both clauses hold, so the formula is satisfied.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","head_forward"],"does":[[825.7773541666667,"assign (the \"row=2\" part) is indicated — a transient flash."],[834.2753541666666,"assign (the \"row=3\" part) is indicated — a transient flash."]]},{"start":840.4883541666667,"say":"Now build the cover from that assignment. From each variable gadget, take the endpoint whose literal came out true. x one true, so take x one. x two false, so take not x two. x three true, so take x three.","live":null,"does":[[849.3643541666667,"g_x1 is emphasized."],[852.6153541666666,"g_n2 is emphasized."],[856.0983541666667,"g_x3 is emphasized."]]},{"start":857.9348541666667,"say":"Three vertices so far. Now each triangle. Look at which of its literals the assignment made true, pick one of those, and leave that vertex out. Take the other two.","live":null,"does":[]},{"start":869.1298541666667,"say":"In the first triangle, x one is true. So leave the x one copy outside, and take the x two copy and the not x three copy.","live":null,"does":[[872.6363541666667,"point is shown on the screen, grown."],[874.8303541666667,"c1b is emphasized."],[875.1363541666667,"point is hidden from the screen."],[875.1803541666667,"c1c is emphasized."]]},{"start":878.6343541666668,"say":"In the second triangle, not x two is true. So leave the not x two copy outside, and take the other two. Two from each triangle, four in all, and three plus four is seven. Exactly the budget.","live":null,"does":[[882.2683541666667,"point_2 is shown on the screen, grown."],[884.7643541666666,"c2a is emphasized."],[884.7683541666667,"point_2 is hidden from the screen."],[885.1143541666667,"c2c is emphasized."],[889.9663541666666,"cover_size is shown on the screen, written out."],[892.6943541666667,"assign is hidden from the screen — left the board."],[892.6943541666667,"cover_size is hidden from the screen — left the board."],[892.6943541666667,"head_forward is hidden from the screen — left the board."]]},{"start":893.2943541666667,"say":"Now the part that could actually fail. Is every edge of this graph covered? There are three families to check, and I will take them in order.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6"],"does":[[893.2943541666667,"head_edges is shown on the screen, written out."],[899.2503541666667,"edge_list is shown on the screen, written out."]]},{"start":902.6943541666667,"say":"The three variable edges. We took one endpoint of each of them by construction, so all three are covered, and there is nothing to argue.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","edge_list","head_edges"],"does":[[907.0713541666667,"edge_list (the \"variable edges\" part) is emphasized."],[908.6733541666667,"ve1 is indicated — a transient flash."],[908.9233541666667,"ve2 is indicated — a transient flash."],[909.1733541666667,"ve3 is indicated — a transient flash."]]},{"start":911.7928541666668,"say":"The six triangle edges. We took two of the three vertices of each triangle, and two vertices of a triangle meet all three of its edges. So all six are covered as well.","live":null,"does":[[914.7883541666666,"edge_list (the \"triangle edges\" part) is emphasized."],[914.7883541666666,"edge_list (the \"variable edges\" part) is no longer emphasized."],[918.7243541666667,"t1_ab is indicated — a transient flash."],[918.7243541666667,"t1_bc is indicated — a transient flash."],[918.7243541666667,"t1_ca is indicated — a transient flash."],[918.7243541666667,"t2_ab is indicated — a transient flash."],[918.7243541666667,"t2_bc is indicated — a transient flash."],[918.7243541666667,"t2_ca is indicated — a transient flash."]]},{"start":923.3528541666667,"say":"The six wires are the interesting family. If a wire's clause end is in the cover, that wire is covered and there is nothing to prove. So the only wires at risk are the two hanging off the vertices we deliberately left out.","live":null,"does":[[924.9083541666666,"edge_list (the \"triangle edges\" part) is no longer emphasized."],[924.9083541666666,"edge_list (the \"wires\" part) is emphasized."],[932.8613541666667,"point_3 is shown on the screen, grown."],[935.8613541666667,"point_3 is hidden from the screen."],[936.1613541666667,"point_4 is shown on the screen, grown."]]},{"start":936.8863541666667,"say":"And look where those two wires go. The excluded vertex in the first triangle is the copy of x one, and its wire runs up to the gadget vertex x one, which is in the cover, because the assignment made x one true.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","edge_list","head_edges","point_4"],"does":[[936.8863541666667,"edge_list (the \"wires\" part) is no longer emphasized."],[939.1613541666667,"point_4 is hidden from the screen."],[943.9563541666666,"w1 is emphasized."],[946.9293541666667,"g_x1 is indicated — a transient flash."]]},{"start":950.6053541666668,"say":"Same story in the second triangle. The excluded vertex is the copy of not x two, its wire runs up to not x two, and we took not x two into the cover precisely because x two is false. Both risky wires are covered.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","edge_list","head_edges"],"does":[[956.9093541666666,"w5 is emphasized."],[959.3013541666667,"g_n2 is indicated — a transient flash."]]},{"start":966.0658541666667,"say":"That is the forward direction complete. And notice exactly where satisfaction was used. The vertex we leave out of a triangle has to be a true literal, and true literals are precisely the ones the gadgets put into the cover. An unsatisfied clause would have nothing safe to leave out.","live":null,"does":[[980.0093541666666,"w1 is no longer emphasized."],[980.0093541666666,"w5 is no longer emphasized."],[982.9468541666668,"edge_list is hidden from the screen — left the board."],[982.9468541666668,"head_edges is hidden from the screen — left the board."]]},{"start":984.1468541666668,"say":"Now run it backwards, which is the direction that actually carries the theorem. Somebody hands you a cover of size seven for this graph. They will not say where they got it, and it need not be the one we just built.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6"],"does":[[984.1468541666668,"head_back is shown on the screen, written out."],[984.1468541666668,"g_x1 is no longer emphasized."],[984.1468541666668,"g_n2 is no longer emphasized."],[984.1468541666668,"g_x3 is no longer emphasized."],[984.1468541666668,"c1b is no longer emphasized."],[984.1468541666668,"c2a is no longer emphasized."],[989.3013541666667,"g_n1 is emphasized."],[989.5513541666667,"g_x2 is emphasized."],[989.8013541666667,"g_n3 is emphasized."],[990.0513541666667,"c1a is emphasized."],[990.3013541666667,"c2b is emphasized."]]},{"start":996.8668541666667,"say":"The counting does the first job for us. Seven vertices, and we proved the minimum is seven, so there is no slack anywhere. Exactly one endpoint of each variable edge, and exactly two vertices of each triangle.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","head_back"],"does":[[997.3893541666666,"forced is shown on the screen, written out."],[1005.6433541666667,"forced (the \"one endpoint of each variable edge\" part) is emphasized."],[1009.1613541666667,"forced (the \"one endpoint of each variable edge\" part) is no longer emphasized."],[1009.1613541666667,"forced (the \"two vertices of each triangle\" part) is emphasized."]]},{"start":1010.6088541666668,"say":"So read the assignment straight off the top row. This cover took not x one, so x one is false. It took x two, so x two is true. It took not x three, so x three is false. Well defined, precisely because exactly one of each pair was taken.","live":["G","g_x1","g_n1","g_x2","g_n2","g_x3","g_n3","ve1","ve2","ve3","c1a","c1b","c1c","t1_ab","t1_bc","t1_ca","c2a","c2b","c2c","t2_ab","t2_bc","t2_ca","w1","w2","w3","w4","w5","w6","forced","head_back"],"does":[[1011.0153541666666,"back_table is shown on the screen, written out."],[1016.0773541666666,"back_table is shown on the screen, written out."],[1016.0773541666666,"g_n1 is indicated — a transient flash."],[1019.0033541666667,"back_table is shown on the screen, written out."],[1019.0033541666667,"g_x2 is indicated — a transient flash."],[1021.8483541666667,"back_table is shown on the screen, written out."],[1021.8483541666667,"g_n3 is indicated — a transient flash."]]},{"start":1027.9858541666667,"say":"Does that assignment satisfy the formula? Here is the argument, and it takes three steps. In each triangle exactly one vertex is left out. In the first triangle, the excluded vertex is the copy of x two.","live":null,"does":[[1032.8153541666666,"forced (the \"excluded triangle vertex\" part) is emphasized."],[1032.8153541666666,"forced (the \"two vertices of each triangle\" part) is no longer emphasized."],[1038.9453541666667,"point_5 is shown on the screen, grown."],[1041.9453541666667,"point_5 is hidden from the screen."]]},{"start":1042.2623541666667,"say":"That vertex has a wire running up to the gadget vertex x two. The wire is an edge, and every edge is covered. Its clause end is not in the cover, so its other end must be. The gadget vertex x two is in the cover.","live":null,"does":[[1043.5283541666668,"w2 is emphasized."],[1053.2803541666667,"g_x2 is indicated — a transient flash."]]},{"start":1058.5828541666667,"say":"And a gadget vertex in the cover is a literal we are calling true. So x two is true, and x two is one of the three literals of this first triangle, which is clause one. Clause one is satisfied, and we never had to look at its other two literals.","live":null,"does":[[1068.6713541666668,"t1_ab is indicated — a transient flash."],[1068.6713541666668,"t1_bc is indicated — a transient flash."],[1068.6713541666668,"t1_ca is indicated — a transient flash."]]},{"start":1075.3783541666667,"say":"The second triangle goes the same way. The excluded vertex is the copy of not x one, its wire forces not x one into the cover, and not x one in the cover means x one is false. That literal belongs to clause two, so clause two is satisfied too.","live":null,"does":[[1075.3783541666667,"w2 is no longer emphasized."],[1078.6643541666667,"point_6 is shown on the screen, grown."],[1081.6643541666667,"point_6 is hidden from the screen."],[1081.7293541666668,"w4 is emphasized."],[1085.6303541666666,"g_n1 is indicated — a transient flash."],[1088.8813541666668,"t2_ab is indicated — a transient flash."],[1088.8813541666668,"t2_bc is indicated — a transient flash."],[1088.8813541666668,"t2_ca is indicated — a transient flash."]]},{"start":1092.7433541666667,"say":"Both clauses satisfied, so the formula is satisfiable, and the assignment we read off the cover is the witness. Note what carried that argument. Not the cover's cleverness, but the fact that seven left it no room to be anything else.","live":null,"does":[[1092.7433541666667,"w4 is no longer emphasized."],[1092.7433541666667,"forced (the \"excluded triangle vertex\" part) is no longer emphasized."],[1098.8383541666667,"back_table (the \"column=2\" part) is indicated — a transient flash."],[1106.9168541666668,"G is hidden from the screen — left the board."],[1106.9168541666668,"g_x1 is hidden from the screen — G left the board."],[1106.9168541666668,"g_n1 is hidden from the screen — G left the board."],[1106.9168541666668,"g_x2 is hidden from the screen — G left the board."],[1106.9168541666668,"g_n2 is hidden from the screen — G left the board."],[1106.9168541666668,"g_x3 is hidden from the screen — G left the board."],[1106.9168541666668,"g_n3 is hidden from the screen — G left the board."],[1106.9168541666668,"ve1 is hidden from the screen — G left the board."],[1106.9168541666668,"ve2 is hidden from the screen — G left the board."],[1106.9168541666668,"ve3 is hidden from the screen — G left the board."],[1106.9168541666668,"c1a is hidden from the screen — G left the board."],[1106.9168541666668,"c1b is hidden from the screen — G left the board."],[1106.9168541666668,"c1c is hidden from the screen — G left the board."],[1106.9168541666668,"t1_ab is hidden from the screen — G left the board."],[1106.9168541666668,"t1_bc is hidden from the screen — G left the board."],[1106.9168541666668,"t1_ca is hidden from the screen — G left the board."],[1106.9168541666668,"c2a is hidden from the screen — G left the board."],[1106.9168541666668,"c2b is hidden from the screen — G left the board."],[1106.9168541666668,"c2c is hidden from the screen — G left the board."],[1106.9168541666668,"t2_ab is hidden from the screen — G left the board."],[1106.9168541666668,"t2_bc is hidden from the screen — G left the board."],[1106.9168541666668,"t2_ca is hidden from the screen — G left the board."],[1106.9168541666668,"w1 is hidden from the screen — G left the board."],[1106.9168541666668,"w2 is hidden from the screen — G left the board."],[1106.9168541666668,"w3 is hidden from the screen — G left the board."],[1106.9168541666668,"w4 is hidden from the screen — G left the board."],[1106.9168541666668,"w5 is hidden from the screen — G left the board."],[1106.9168541666668,"w6 is hidden from the screen — G left the board."],[1106.9168541666668,"back_table is hidden from the screen — left the board."],[1106.9168541666668,"forced is hidden from the screen — left the board."],[1106.9168541666668,"head_back is hidden from the screen — left the board."]]}]},{"title":"What Was Proved","start":1107.9585208333333,"end":1261.9007916666667,"objects":{"a1":"a Vector [gray] drawn in web (start=(2.4, 4.5), end=(5.2, 3.1), trim_tip=True)","a2":"a Vector [gray] drawn in web (start=(2.4, 3.1), end=(5.2, 3.1), trim_tip=True)","a3":"a Vector [gray] drawn in web (start=(2.4, 1.7), end=(5.2, 3.1), trim_tip=True)","a4":"a Vector [yellow] drawn in web (start=(5.2, 3.1), end=(7.4, 3.1), trim_tip=True)","a5":"a Vector [red] labelled \"upright(\"this lecture\")\" drawn in web (start=(7.4, 3.1), end=(9.6, 3.1), trim_tip=True)","complete_math":"a Math [text] that says \"$upright(\"VC\") upright(\" is NP-complete\")$\"","head_moral":"a Heading that says \"What the Claim Is About\"","head_web":"a Heading that says \"Where Vertex Cover Now Sits\"","l1":"a Point [gray] labelled \"L_1\" drawn in web (location=(2.4, 4.5), marker_radius=0.11)","l2":"a Point [gray] labelled \"L_2\" drawn in web (location=(2.4, 3.1), marker_radius=0.11)","l3":"a Point [gray] labelled \"L_3\" drawn in web (location=(2.4, 1.7), marker_radius=0.11)","meaning":"a Math [text] that says \"$upright(\"VC\") in upright(\"P\") quad arrow.r.double quad upright(\"P\") = upright(\"NP\")$\"","moral":"a Panel that says \"NP-hardness is proved about a problem by exhibiting a reduction. It is a theorem on a page. It holds whoever is looking at the problem, and whatever they have already tried.\"","np_tag":"a Math [gray] that says \"$upright(\"NP\")$\" drawn in web","reduce_math":"a Math [text] that says \"$upright(\"3SAT\") <=_p upright(\"VC\")$\"","region":"a Polygon [gray] drawn in web (vertices=((0.4, 0.7), (10.6, 0.7), (10.6, 5.6), (0.4, 5.6)), fill_opacity=0.1)","sat":"a Point [blue] labelled \"upright(\"SAT\")\" drawn in web (location=(5.2, 3.1), marker_radius=0.14)","tsat":"a Point [blue] labelled \"upright(\"3SAT\")\" drawn in web (location=(7.4, 3.1), marker_radius=0.14)","vcp":"a Point [red] labelled \"upright(\"VC\")\" drawn in web (location=(9.6, 3.1), marker_radius=0.16)","web":"a Figure (x_range=(0.0, 11.0), y_range=(0.0, 6.6), aspect=(11.0, 6.6))"},"beats":[{"start":1107.9585208333333,"say":"So let us say precisely what we now have. A function that takes a three satisfiability formula and returns a graph together with a number, computable in time linear in the size of the formula.","live":[],"does":[[1107.9585208333333,"head_web is shown on the screen, written out."],[1107.9585208333333,"web is shown on the screen, written out."],[1111.3955208333332,"region is shown on the screen, written out."],[1111.5955208333332,"np_tag is shown on the screen, written out."]]},{"start":1121.0045208333333,"say":"And a proof, in both directions, that the formula is satisfiable exactly when that graph has a vertex cover of size at most k. That is the definition of a polynomial-time reduction, met in full.","live":["web","head_web","region","np_tag"],"does":[[1123.7675208333333,"tsat is shown on the screen, written out."],[1125.9855208333333,"vcp is shown on the screen, written out."],[1130.0255208333333,"reduce_math is shown on the screen, written out."],[1131.8255208333333,"a5 is shown on the screen, drawn."]]},{"start":1134.3520208333332,"say":"Three satisfiability reduces to vertex cover. Now read that as a statement about vertex cover, which is what it is. Cook and Levin put satisfiability at the top, with every problem in NP reducing into it.","live":["web","reduce_math","head_web","region","np_tag","tsat","vcp","a5"],"does":[[1143.0835208333333,"sat is shown on the screen, written out."],[1146.3335208333333,"l1 is shown on the screen, written out."],[1146.5335208333333,"l2 is shown on the screen, written out."],[1146.7335208333334,"l3 is shown on the screen, written out."],[1147.6805208333333,"a1 is shown on the screen, drawn."],[1147.9305208333333,"a2 is shown on the screen, drawn."],[1148.1805208333333,"a3 is shown on the screen, drawn."]]},{"start":1149.6740208333333,"say":"Satisfiability reduces to three satisfiability, and our arrow carries the hardness one step further along. So vertex cover is NP-hard: every problem in NP reduces to it, by composing the arrows.","live":["web","reduce_math","head_web","region","np_tag","tsat","vcp","a5","sat","l1","l2","l3","a1","a2","a3"],"does":[[1151.0325208333334,"a4 is shown on the screen, drawn."],[1155.9085208333333,"a5 is indicated — a transient flash."]]},{"start":1164.9955208333333,"say":"And vertex cover is in NP, which we settled in the first few minutes. Hand me a set of vertices and I will check it against every edge in linear time. NP-hard and in NP: vertex cover is NP-complete.","live":["web","reduce_math","head_web","region","np_tag","tsat","vcp","a5","sat","l1","l2","l3","a1","a2","a3","a4"],"does":[[1178.6485208333334,"complete_math is shown on the screen, written out."],[1178.8485208333334,"vcp is indicated — a transient flash."]]},{"start":1180.4730208333333,"say":"Now read the arrows once more, because the direction is the whole examinable content. The arrow runs from the problem already known to be hard into the new one, never the other way.","live":["web","reduce_math","complete_math","head_web","region","np_tag","tsat","vcp","a5","sat","l1","l2","l3","a1","a2","a3","a4"],"does":[[1186.1795208333333,"a4 is indicated — a transient flash."],[1186.4795208333333,"a5 is indicated — a transient flash."]]},{"start":1191.3080208333333,"say":"What it says is a conditional. If you could solve vertex cover quickly, you could solve three satisfiability quickly, and therefore everything in NP quickly. It does not say the reverse, and it hands you no algorithm at all.","live":null,"does":[[1205.6810208333334,"complete_math is hidden from the screen — left the board."],[1205.6810208333334,"head_web is hidden from the screen — left the board."],[1205.6810208333334,"reduce_math is hidden from the screen — left the board."],[1205.6810208333334,"web is hidden from the screen — left the board."],[1205.6810208333334,"region is hidden from the screen — web left the board."],[1205.6810208333334,"np_tag is hidden from the screen — web left the board."],[1205.6810208333334,"tsat is hidden from the screen — web left the board."],[1205.6810208333334,"vcp is hidden from the screen — web left the board."],[1205.6810208333334,"a5 is hidden from the screen — web left the board."],[1205.6810208333334,"sat is hidden from the screen — web left the board."],[1205.6810208333334,"l1 is hidden from the screen — web left the board."],[1205.6810208333334,"l2 is hidden from the screen — web left the board."],[1205.6810208333334,"l3 is hidden from the screen — web left the board."],[1205.6810208333334,"a1 is hidden from the screen — web left the board."],[1205.6810208333334,"a2 is hidden from the screen — web left the board."],[1205.6810208333334,"a3 is hidden from the screen — web left the board."],[1205.6810208333334,"a4 is hidden from the screen — web left the board."]]},{"start":1206.8810208333332,"say":"Which brings us to the last point, and it is the one worth carrying out of the room. NP-hardness is not a proof that no fast algorithm exists. Nobody has proved that about any problem in NP, and nobody is close.","live":[],"does":[[1206.8810208333332,"head_moral is shown on the screen, written out."]]},{"start":1221.8660208333333,"say":"What it is, is a ranking. Vertex cover sits at least as high as every problem in the class. So if you ever find a polynomial-time algorithm for it, you have not found an exception. You have proved P equals NP, and thousands of problems fall in the same instant.","live":["head_moral"],"does":[[1233.6735208333332,"meaning is shown on the screen, written out."],[1237.7475208333333,"A box is drawn around meaning."]]},{"start":1239.2885208333332,"say":"And that is exactly why the phrase describes the problem. The reduction is a construction on a page, checkable by anyone. It was true before you attempted the problem, it is true while you are stuck on it, and it will still be true long after P versus NP is settled.","live":["meaning","head_moral"],"does":[[1244.2115208333332,"moral is shown on the screen, written out."]]},{"start":1255.9450208333333,"say":"It says nothing whatsoever about you. It says where the problem stands.","live":["meaning","moral","head_moral"],"does":[[1259.8115208333334,"moral (the \"a theorem on a page\" part) is indicated — a transient flash."],[1260.859125,"head_moral is hidden from the screen — left the board."],[1260.859125,"meaning is hidden from the screen — left the board."],[1260.859125,"moral is hidden from the screen — left the board."]]}]}]},"durationSeconds":1262,"chapters":[{"title":"Checking Is Not Finding","startSeconds":0,"narration":"Two definitions and one proof. The definitions are P and NP, and I am going to give them in terms of a machine that checks answers, rather than in terms of how hard a problem happens to feel. The proof is a single reduction, from three satisfiability to vertex cover. Gadgets drawn, wires connected, and both directions argued on one formula small enough to hold in your head. Start with a graph. Six places, and seven roads joining them. I want to post a guard at some of the places, so that every road has a guard at one end of it or the other. A set of vertices that touches every edge like that is called a vertex cover. Taking all six would certainly work, so the interesting question is never whether a cover exists. It is how small one can be. So we ask it as a question with a yes or a no attached. Given the graph and given a number k, is there a vertex cover with at most k vertices? For this graph, take k equal to three. Here is a claimed answer: the set containing b, and d, and f. In complexity that object has a name. It is a certificate, a piece of evidence offered alongside the instance to make the yes easy to confirm. Now check it. The size first. Three vertices, and three was the budget. Then the edges, one at a time, all the way round the outside and then across the middle. Every one of the seven has a lit endpoint. So the answer for this instance is yes, and the certificate is what proved it. Notice how little work that was. Seven checks, one per edge, and nothing had to be searched for. Finding the set is a different business entirely. There are twenty ways to choose three vertices out of six, and here you could try them all. Push the graph up to a hundred vertices with a budget of fifty, and that same brute force never finishes. That gap, between checking an answer and finding one, is the whole of what NP is about. So let us make it precise. A verifier for a problem is an algorithm V that takes two inputs. The instance w, which here is the graph together with the number, and the certificate c, which here is the proposed set of vertices. Three conditions on it. First, V runs in time polynomial in the length of w. Notice that this bounds the certificate too, since V cannot even read a string longer than the time it is allowed. Second, if w is a yes instance, then some certificate makes V accept. Third, if w is a no instance, then no certificate whatsoever makes V accept. Not a clever one, not a lucky one. None. NP is the class of problems that have a verifier like that. Now read the second line again and notice what it does not mention. It promises that a certificate exists. It says absolutely nothing about how you would find one. P is the same definition with the certificate deleted. A problem is in P when a polynomial-time algorithm decides it outright, working out the answer with no help offered. NP is the class we have just built. A polynomial-time verifier, and a short certificate for every yes instance. Every problem in P sits inside NP, because an algorithm that already knows the answer can simply ignore whatever certificate you hand it. Whether the containment runs the other way as well is the open question, and nobody knows. One last thing about the shape of that definition. It is lopsided, and on purpose. NP promises a short proof for the yes answers, and promises absolutely nothing for the no answers. Vertex cover shows you why. To demonstrate that a cover of size three exists, you point at one, like this. To demonstrate that none exists, you would have to rule out every subset, and there is no short way to write that down. So that is the class. Now the question that organises everything else. What does it mean to say that one problem inside it is harder than another?"},{"title":"What a Reduction Proves","startSeconds":259.36350000000004,"narration":"Suppose I have two problems, A and B, and suppose somebody has already handed me a solver for B. Can I get A for free? Sometimes I can, and this is the shape of the arrangement. Take any instance w of A. Run it through a translator, a function f, and out comes a string. Hand that string to the solver for B, and take whatever the solver says as your answer about w. For that to be honest, f has to be faithful. w is a yes instance of A exactly when f of w is a yes instance of B. Not usually, not most of the time. Exactly when, and in both directions. And f itself has to be cheap: computable in polynomial time. If translating cost more than solving, the whole arrangement would be pointless. A translator with those two properties is a polynomial-time reduction, and we write it with this symbol. Read the symbol as no harder than. A is no harder than B, up to a polynomial. Now read that picture as a claim about difficulty, because this is where people get turned around. Suppose B has a polynomial-time algorithm. Then A has one too. Translate, then solve, and both steps are polynomial. Turn that implication around and you get the useful form. If A has no polynomial-time algorithm, then B cannot have one either, because a fast B would have handed us a fast A. So hardness travels forwards along the arrow, out of A and into B, while easiness travels backwards. Point at the arrow and you are pointing at the direction of the claim. That single sentence is most of what an examiner is checking. Which fixes the direction you must write your proof in. If you want to show that your new problem B is hard, you take a problem already known to be hard, and you reduce it into B. The other way round does prove something, but not that. A reduction from B into three satisfiability says B is no harder than three satisfiability. That is an upper bound, not a lower one. It is the single most common way to write the proof backwards, so when you are stuck, ask which problem is the source of the arrow. The source is always the one you already trust to be hard. Now the two names. A problem B is NP-hard when every problem in NP reduces to it in polynomial time. Every one. Including all the ones nobody has thought of yet. And B is NP-complete when it is NP-hard and it is itself a member of NP. The NP-complete problems are the hardest problems in the class, and they all stand or fall together. That definition looks impossible to verify, because NP contains infinitely many problems. Cook and Levin did the impossible part once, in nineteen seventy one, by encoding an arbitrary polynomial-time verification directly as a Boolean formula. Three satisfiability, the restriction where every clause has exactly three literals, is NP-complete too. So nobody after them has to go back to Turing machines. You reduce three satisfiability into your problem, and transitivity carries all of NP along behind. Which is exactly what we are going to do now, once, in full."},{"title":"Two Gadgets","startSeconds":477.16945833333335,"narration":"Three satisfiability. You are handed a Boolean formula in one fixed shape. It is a conjunction of clauses, and each clause is a disjunction of exactly three literals, where a literal means a variable or the negation of one. The question is whether some assignment of true and false to the variables makes the whole formula come out true. And here is the formula we are going to carry for the rest of the lecture. Three variables and two clauses. The first clause is x one or x two or not x three. The second is not x one or not x two or x three. Small enough to settle by inspection, which is exactly why it is safe to use. We are not going to be clever about this formula. We are going to translate it, mechanically, into a graph and a number. The translator is built from two pieces, one for each kind of object a formula contains. First piece: one gadget for every variable. It is a single edge, and its two endpoints are the two literals of that variable. x on one side, not x on the other. A cover has to touch every edge of the graph, and this is an edge. So any cover at all contains at least one of these two vertices. That is a cost we are going to charge for in a moment. And here is the reading that makes the entire proof work. Which endpoint the cover takes is a truth value. Take the x side and we call x true. Take the not x side and we call x false. The gadget is a switch. Second piece: one gadget for every clause. It is a triangle, and its three vertices are the clause's three literals, one copy of each. A triangle has three edges, and no single vertex touches all three. Take just the top one: it meets two of the edges and misses the bottom edge entirely. So one vertex is never enough. Take any two of them and every edge is covered, whichever two you choose. So each triangle costs at least two vertices. Equivalently, exactly one of the three can be left outside the cover, and that fact is what the whole proof will lean on. Third piece, and this one is not a gadget but a wire. For every literal in every clause, join that clause vertex to the variable gadget vertex carrying the same literal. Here the triangle's x vertex is wired back to the x endpoint upstairs. The other two literals of this clause would run off to their own gadgets, which I have not drawn. That is the whole construction. Two vertices and one edge per variable, three vertices and three edges per clause, and one wire per literal. Nothing depends on anything being clever. And now the number. With n variables and m clauses, set k to n plus two m. One vertex per variable gadget, two per clause gadget, and not a single vertex to spare. That tightness is the engine of the whole proof. The gadgets force n, the triangles force two m, those vertex sets do not overlap, so every cover has at least that many. Asking for exactly that many leaves no freedom anywhere."},{"title":"One Formula, One Graph","startSeconds":681.0023541666667,"narration":"Here is our formula again, and here is the graph it becomes. Three variables, so three variable gadgets. One edge each, six vertices in all, one pair per variable. Two clauses, so two triangles. The first clause is x one or x two or not x three, and its triangle carries exactly those three literals, one vertex each. The second clause is not x one or not x two or x three, and its triangle carries those. Notice that every literal now appears twice over. Once up in a gadget, and once down in a triangle. Now the wires. Every clause vertex joins the gadget vertex with the same label. The x one copy runs up to x one, the x two copy runs to x two, and the not x three copy runs all the way across the picture. The second triangle wires the same way. Not x one, not x two, and x three, each to its own endpoint upstairs. Six literals, six wires. Twelve vertices and fifteen edges. Look at how that was built. One pass over the formula, writing down a fixed number of vertices and edges per variable and per clause. That is the polynomial-time half of the reduction, and it is the easy half. Now the number. Each of the three variable edges demands at least one vertex, because a cover has to touch it. Three edges, one apiece, so three. Each of the two triangles demands at least two, as we showed. Two triangles, two apiece, so four. And those five demands sit on completely separate vertices, so they simply add. Rule a line under them and add. Seven. Every vertex cover of this graph has at least seven vertices, whatever it looks like, and seven is exactly the budget the construction sets. So asking for a cover of size seven is asking for one with no slack at all. Exactly one endpoint from each variable edge. Exactly two vertices from each triangle. Nothing left over to patch anything up with. Take the formula's side first. Set x one true, x two false, and x three true. Check it against both clauses. Clause one is x one or x two or not x three. Its first literal is true, so the clause holds. Clause two is not x one or not x two or x three, and not x two is true, since x two is false. Both clauses hold, so the formula is satisfied. Now build the cover from that assignment. From each variable gadget, take the endpoint whose literal came out true. x one true, so take x one. x two false, so take not x two. x three true, so take x three. Three vertices so far. Now each triangle. Look at which of its literals the assignment made true, pick one of those, and leave that vertex out. Take the other two. In the first triangle, x one is true. So leave the x one copy outside, and take the x two copy and the not x three copy. In the second triangle, not x two is true. So leave the not x two copy outside, and take the other two. Two from each triangle, four in all, and three plus four is seven. Exactly the budget. Now the part that could actually fail. Is every edge of this graph covered? There are three families to check, and I will take them in order. The three variable edges. We took one endpoint of each of them by construction, so all three are covered, and there is nothing to argue. The six triangle edges. We took two of the three vertices of each triangle, and two vertices of a triangle meet all three of its edges. So all six are covered as well. The six wires are the interesting family. If a wire's clause end is in the cover, that wire is covered and there is nothing to prove. So the only wires at risk are the two hanging off the vertices we deliberately left out. And look where those two wires go. The excluded vertex in the first triangle is the copy of x one, and its wire runs up to the gadget vertex x one, which is in the cover, because the assignment made x one true. Same story in the second triangle. The excluded vertex is the copy of not x two, its wire runs up to not x two, and we took not x two into the cover precisely because x two is false. Both risky wires are covered. That is the forward direction complete. And notice exactly where satisfaction was used. The vertex we leave out of a triangle has to be a true literal, and true literals are precisely the ones the gadgets put into the cover. An unsatisfied clause would have nothing safe to leave out. Now run it backwards, which is the direction that actually carries the theorem. Somebody hands you a cover of size seven for this graph. They will not say where they got it, and it need not be the one we just built. The counting does the first job for us. Seven vertices, and we proved the minimum is seven, so there is no slack anywhere. Exactly one endpoint of each variable edge, and exactly two vertices of each triangle. So read the assignment straight off the top row. This cover took not x one, so x one is false. It took x two, so x two is true. It took not x three, so x three is false. Well defined, precisely because exactly one of each pair was taken. Does that assignment satisfy the formula? Here is the argument, and it takes three steps. In each triangle exactly one vertex is left out. In the first triangle, the excluded vertex is the copy of x two. That vertex has a wire running up to the gadget vertex x two. The wire is an edge, and every edge is covered. Its clause end is not in the cover, so its other end must be. The gadget vertex x two is in the cover. And a gadget vertex in the cover is a literal we are calling true. So x two is true, and x two is one of the three literals of this first triangle, which is clause one. Clause one is satisfied, and we never had to look at its other two literals. The second triangle goes the same way. The excluded vertex is the copy of not x one, its wire forces not x one into the cover, and not x one in the cover means x one is false. That literal belongs to clause two, so clause two is satisfied too. Both clauses satisfied, so the formula is satisfiable, and the assignment we read off the cover is the witness. Note what carried that argument. Not the cover's cleverness, but the fact that seven left it no room to be anything else."},{"title":"What Was Proved","startSeconds":1107.9585208333333,"narration":"So let us say precisely what we now have. A function that takes a three satisfiability formula and returns a graph together with a number, computable in time linear in the size of the formula. And a proof, in both directions, that the formula is satisfiable exactly when that graph has a vertex cover of size at most k. That is the definition of a polynomial-time reduction, met in full. Three satisfiability reduces to vertex cover. Now read that as a statement about vertex cover, which is what it is. Cook and Levin put satisfiability at the top, with every problem in NP reducing into it. Satisfiability reduces to three satisfiability, and our arrow carries the hardness one step further along. So vertex cover is NP-hard: every problem in NP reduces to it, by composing the arrows. And vertex cover is in NP, which we settled in the first few minutes. Hand me a set of vertices and I will check it against every edge in linear time. NP-hard and in NP: vertex cover is NP-complete. Now read the arrows once more, because the direction is the whole examinable content. The arrow runs from the problem already known to be hard into the new one, never the other way. What it says is a conditional. If you could solve vertex cover quickly, you could solve three satisfiability quickly, and therefore everything in NP quickly. It does not say the reverse, and it hands you no algorithm at all. Which brings us to the last point, and it is the one worth carrying out of the room. NP-hardness is not a proof that no fast algorithm exists. Nobody has proved that about any problem in NP, and nobody is close. What it is, is a ranking. Vertex cover sits at least as high as every problem in the class. So if you ever find a polynomial-time algorithm for it, you have not found an exception. You have proved P equals NP, and thousands of problems fall in the same instant. And that is exactly why the phrase describes the problem. The reduction is a construction on a page, checkable by anyone. It was true before you attempted the problem, it is true while you are stuck on it, and it will still be true long after P versus NP is settled. It says nothing whatsoever about you. It says where the problem stands."}]}}
