**The problem: **Generalized Geography. This is problem GP2 in the appendix.

**The description: **Given a directed graph G=(V,A) and a starting vertex v_{o}. Players alternate choosing edges that leave the current vertex (starting with v_{0}. The next current vertex is the one at the end of the edge leaving from v_{o}. You can’t choose an edge that is already chosen. The first player to be unable to choose an edge loses. Does Player 1 have a forced win?

**Example: **This is the “geography” game kids play in the car, where you have to think of a place that has as its first letter the last letter of the previous choice. As a graph problem, vertices correspond to letters, and edges to locations:

Note that the vertices can have self-loops, and (at least in the actual game) could have multiple edges between pairs of vertices. There is no requirement to have any edges leave a vertex either- I remember instituting the “Phoenix rule” on car trips because nobody could think of a place that started with X.

Anyway, if we start at E, player 1 has a forced win- they have to take “Egypt” to T, and then player 2 has to take “Texas” to S, and if player 1 chooses “Singapore” we’re in vertex E, it’s player 2’s turn, and they have no place left to pick. (The actual game has many more edges, of course)

**Reduction:** Schaefer says he’s building off of the Sequential Truth Assignment problem from last time, but his instance looks more like an instance of QBF. (I think this is a result of his claim that they’re basically the same problem). So we’re given a formula: (∃ x_{1}) (∀ x_{2}) (∃ x_{3}) … (∃ x_{n)} (A_{1} ∧ A_{2} ∧ … A_{m}), where each A_{i} is a disjunction of literals. We’ll further assume n is odd (so the last quantifier is ∃)

We then go on to build a graph. Each positive and negative literal gets a vertex. Each variable x_{1} gets 4 vertices in the graph:

- x
_{i}corresponding to a positive literal - ~x
_{i}corresponding to a negative literal - 2 vertices u and v that control the “entrance” and “exit” for the setting of one of the 2 literal values.

We have a vertex for each clause (y_{i}), and an additional vertex u_{n+1} so the last v_{i} has someplace to go.

Each set of these 4 vertices are set up in a diamond, with edges from u_{i} to both x_{i }and ~x_{i}, and then from both of those to v_{i}. v_{i} then connects to u_{i+1}, making a chain of diamonds. The final u_{n+1} connects to each y vertex, and each y vertex connects to the literals that are in its clause.

Here’s the example picture from the paper:

Player 1 starts on vertex u_{1}. The player chooses whether to make variable x_{1} positive or negative by going to that vertex (simulating a “there exists”), and player 2 has no choice but to move on to the v_{1} vertex, and player 1 has no choice to move to the next u_{2 }(simulating a “for all”). This alternating process continues until we hit vertex u_{n+1}. Since there are an odd number of variables, it is now player 2’s turn.

If the setting of the variables has not satisfied some clause, player 2 can move to the y vertex of that unsatisfied clause. Then player 1 has to go to one of the 3 literals that appear in that clause. Since the clause was not satisfied, all of these variables have not been chosen, so the edge from that literal to the v vertex is available for player 2 to pick. But after that, the vertex from the v vertex to the next u vertex has already been chosen, so player 1 loses.

If the setting of the variables has satisfied every clause, then player 2 has to pick a move to a y vertex that has a literal chosen by a player to satisfy it. When player 1 moves to that vertex, the only edge exiting that vertex has already been chosen, so player 2 loses.

**Difficulty: **7. I think this is very slick and elegant, but I don’t see a student getting there without lots of help.

**The problem: **Sequential Truth Assignment. This is problem GP4 in the appendix.

**The description: **Given a set of variables and a collection of clauses (like a Satisfiability instance), players take turns giving truth assignments to sequential variables. Player 1 wins if and only if all clauses are satisfied. Does player 1 have a forced win?

**Example: **(x_{1} ∨ x_{2} ∨ x_{3}) ∧ (~x_{1} ∨ ~x_{2} ∨ ~x_{3}) ∧ (x_{1} ∨ ~x_{2} ∨ x_{3}).

Player 1 can win by choosing x_{1} = true, which satisfies both the first and third clauses. Then layer 2 has to set x_{2}, so should set it to true (otherwise clause 2 is automatically satisfied)_{.} but player 1 then set x_{3} to false satisfying the second clause.

**Reduction: **The paper by Shaefer that has many of the reductions we’ll be doing in this section refers to the paper by Stockmeyer and Meyer that showed how QBF was NP-Complete (or worse- you might want to check out the comments of the QBF problem for a discussion) defined a formula B_{k} to be a formula on k sets of variables, with sets alternating between “For All” and “There Exists”. Schaefer points out that if you allow players to assign values to these sets of variables (instead of one at a time, like our problem describes), then player 1 is the “There Exists” player and player 2 is the “For All” player, and you have basically the same problem.

To get to our “one variable at a time” version of the problem, we need to build a problem instance with one variable per set. We can start with an instance of 3SAT and since the variables are set sequentially, we set up the quantifiers to be ∃ x_{1} ∀ x_{2} ∃ x_{3}, and so on.

**Difficulty: **5. I think it depends on how hard you see the intermediate step of going from QBF to the alternating of setting groups of variables. Knowing you have to break the reduction into 2 steps is a bit hard as well.

**The problem: **Generalized Hex. This is problem GP1 in the appendix.

**The description: **Given a graph G=(V,E) and two vertices s,t in V. Players alternate coloring vertices (except for s and t) “blue” (by player 1) and “red” (by player 2). Player 1 wins if a path of blue vertices from s to t ever exists, and player 2 wins if that becomes impossible. Does Player 1 have a forced win?

G&J mark this problem as “not known to be in NP” (like many of these problems), and the paper by Even and Tarjan mentions that it’s likely that this problem is even harder than NP-Complete problems, since we may not even be able to solve it in polynomial time with a non-deterministic algorithm.

**Example: **Here’s a picture of the “standard” Hex game that I took from the Internet:

(from https://www.maths.ed.ac.uk/~csangwin/hex/index.html)

The hexagonal spaces are the vertices of the graph. In the “standard” game, the vertices are only adjacent to their neighbors, but the generalized game allows for different kinds of connections. In the “standard” game of hex, you can connect from any hex on one blue edge of the board to any hex on the other blue edge- we can add that in the generalized game by making an edge from every cell on one blue edge to s, and another set of edges from every cell on the other side to t.

The other big difference is that in the standard game, either blue has a path connecting the 2 blue sides or red has a path connecting the 2 red sides (so blue not being able to create a path means red has a path). In the generalized game, there are no “red sides”, so all we care about is whether blue can create a path or not.

In the above image, blue does not have a win (because red has already won). But if we look at a slightly different board:

If the hex marked green is blue instead of red, then blue has a forced win, no matter whose turn it is. Either of the two cells next to the left blue edge will win the game for blue.

**Reduction: **As I alluded to last week, many of these problems reduce from QBF. So the question is: How do we take an arbitrary formula and turn it into a game board that has a forced win for player 1 if and only if the formula is solvable?

To help us, Even and Tarjan create some subgraphs that have properties that will help us. First is a tree where the root connects to s, and some leaves connect to t:

It turns out that if it’s blue’s turn, blue has a forced win if and only if *all* of the leaves connect directly to t: Your first move is the root (above s), and then each move after that you choose the child node that is the root of a subtree that red has not played in.

If there are leaves that are not connected to t, red can win by always picking a node in the subtree that *is* connected to t. In the graph above, if blue picks the root, red would pick the left child, forcing blue to move right. Then red picks the right child of blue’s node, and then the left child of blue’s next move.

(If blue doesn’t pick the root on their first move, or if blue doesn’t pick a child of their last move, red can disconnect the whole tree.)

The way to think of this graph is that it is similar to “and”.

Here’s another tree structure:

This graph has one child of the root connecting directly to t, and otherwise sets pairs of grandchildren that may or may not connect directly to t- all of the a’s connect to t, and the b’s may or may not connect to t. If it’s blue’s turn, they have a forced win if and only if there is at least one b vertex that connects to t. (Blue picks the root, red has to pick the child that connects directly to t, then blue picks the child that has both a and b connect to t, and red can’t stop it).

The way to think of this graph is “or”. (The caption in the figure in the paper says this represents a “conjunction” which I’m pretty sure is a typo).

The third graph is based on variables:

There are 2 copies of each variable and their negation. If it’s blue’s move, they can pick either x_{1}(1) or x_{1}(2) or their negations. Then red has to pick the negated vertex of the opposite number (if blue picks x_{1}(1) then red has to pick ~x_{1}(2)). This will be used to force a variable to only have one truth value. If it’s red’s move, they can decide whether to use the positive or negated version of x_{1} and blue’s moves are forced. So, if it’s blue’s move when this ladder is reached, it works like a “there exists”- blue can choose any combination of literals they want. If it’s red’s move, this works like a “for all”- red can force blue into whatever variable configuration that they want.

So we’re given a QBF formula. We’ll assume the expression part of the formula is in CNF. We create a graph that has s,t, 4 vertices for each variable (x_{i}(1), x_{i}(2), ~x_{i}(1) and ~x_{i}(2) for each variable x_{i}). For each change in quantifier (between ∀ and ∃) we add a “quantifier” vertex q_{i} . We can assume the first quantifier in the formula is a ∀, so the first quantifier vertex is placed in such a way that blue needs to play on it (effectively wasting its turn and giving red the initiative to select the first part of the next set of vertices). If the next quantifier is a ∃, we add the quantifier vertex such that blue will reclaim the initiative

For each clause, we add an “and” tree, where the “b” leaves of the tree connect to the corresponding literals of the clause.

Here is the paper’s example for a small formula:

Some things I noticed to help me understand what is happening:

- The formula starts with ∃, so blue can pick either x(1) or ~x(1).
- The formula then moves into a ∀, so blue will have to pick q
_{1}, meaning red gets to decide whether blue will pick y(1) or ~y(1) - The formula then moves into a ∃, which means after blue’s choice, red has to pick q
_{2}, giving blue the choice about z(1) or ~z(1) - The l vertices denote the subtrees. They are built out of the trees discussed earlier, and the paths through the “b” vertices (the one next to the “a” vertices) connect to the literals that are in each clause.

There are a lot more details about how it all gets exactly connected, but I think this shows the main idea of how the game is set up.

**Difficulty: **8. This is a very cool transformation, but you need a lot of help to see the structures and forcing moves. On top of that, there are a lot of fiddly details that I’ve glossed over that are important in an actual reduction.

**The problem: **Quantified Boolean Formulas (QBF). This is problem LO11 in the appendix.

**The description: **Given a set U {u_{1}..u_{n}} of variables, a formula F that consists of a quantifier Q_{i} for each u_{i} that is either ∀ or ∃, and a boolean expression E bound to the quantifiers, is F true?

**Example: **∀ u_{1} ∀ u_{2} ∃ u_{3} (u_{1} ∨ u_{2} ∨ u_{3}). This is true because for each value of u_{1} and u_{2}, we can find a value for u_{3} (namely “true”) that makes the expression true.

**Reduction:** G&J send you to the paper by Stockmeyer and Meyer that we did last week, and calls it a “generic transformation”, which means it builds a Turing Machine, similar to how Cook’s Theorem does.

But I think you can do a regular reduction from 3SAT: Given a SAT instance, we add a ∃ quantifier for each variable and then use the SAT formula as our E expression in this problem. Then we’re just asking whether there exist values for each variable that make the formula true.

**Difficulty: **3, assuming I’m not missing something. I always worry when I find a “short cut” like this.

**The problem: **Integer Expression Membership. This is problem AN18 in the appendix.

**The description: **Given an integer expression e over the expressions ∪ and +, which work on sets of integers. The ∪ operation unions two sets of integers together, and the + operation takes two sets of integers and creates the set of sums of elements from each of the sets. Given an integer K, is K in the set of integers represented by e?

**Example: **Suppose A = {1,2,3}, B = {4,5,6}, C = {1,3,5}.

Then the expression (A∪C) would be {1,2,3,5} and the set (A∪C) + B would be {2,4,6,3,5,7,6,8,10}. So if we were given that expression and a K of 8, a solver for the problem would say “yes”, but if given a K of 9, the solver for the problem would say “no”.

**Reduction:** Stockmeyer and Meyer show this in their Theorem 5.1. They reduce from Subset Sum (they call it Knapsack, but their version of Knapsack doesn’t have weights, so it’s out Subset Sum problem). So from a Subset sum instance (a set A = {a_{1}, …, a_{n}} and a target B), we build an expression. The expression is (a_{1} ∪ 0) + (a_{2} ∪ 0) + … + (a_{n} ∪ 0). Then we set K=B.

Notice that the set of integers generated by this expresion is the set of all sums of all subsets of A. Asking is B is a member is just asking if there is a way to make the above expression (for each element a_{i}, either taking it or taking 0) that adds up to exactly B. This is exactly the Subset Sum problem.

**Difficulty:** 4. The reduction itself is easy. It might be hard to explain the problem itself though.

**The problem:** Unification for Finitely Presented Algebras. This is problem AN17 in the appendix.

**The description: **Given a description of an algebra as a set G of generator symbols, a set O of operator symbols (of possibly varying dimensions), and a Γ of “defining relations” over G and O. We’re also given two expressions x and y over G and O, and a set of variables V. Can we find “interpretations” for x and y, called I(x) and I(y) such that I(x) and I(y) are formed by replacements of variables such that I(x) and I(y) represent the same element of the algebra?

**Example: **The paper by Kozen that has the reduction gives a pretty good example of an algebra: Suppose G was {0,1}, O was {∧, ∨, ¬}, and Γ was {0∧0 ≡ 0, 0 ∧ 1 ≡ 0, 1 ∧ 0 ≡ 0, 1 ∧ 1 ≡ 1, 0 ∨ 0 ≡ 0, 0 ∨ 1 ≡, 1 ∨ 0 ≡ 1, 1 v 1 ≡ 1, ¬0 ≡ 1, ¬1 ≡}. This is the normal Boolean Algebra we see everywhere.

Now we can ask questions like: If x = a ∨ b ∨ c and y = 0 ∨ 1 ∨ d, can we find a unification of the variables that makes the equations the same? The answer is yes, with the replacements {a/0, b/1, d/c}.

I think the “represent the same element” part of the problem statement means that we can also take advantage of unification rules, so we can ask questions like does ~x ∨ y ∨ ~z unify to 1?

**Reduction: **Kozen’s paper makes the point that if we use the Boolean Algebra that we used in the example, then the Satisfiability problem can be represented in Boolean Algebra using the rules above, and the question “Is this formula satisfiable” can be recast as “Does this formula unify to true?”

He doesn’t provide the proof, though, so I hope I’m representing him correctly.

**Difficulty**: 4. Once you see how the Boolean Algebra relates, it’s pretty easy.

**The problem: **Unification With Commutative Operators. This is problem AN16 in the appendix.

**The description: **Given a set V of variables, a set C of constants, a set of n ordered pairs (e_{i}, f_{i}) (1 ≤ i ≤ n) representing “expressions”. Each expression is defined recursively as either a variable from V, a constant from C, or (e+f) where e and f are expressions. Can we create a way to assign each variable v in V a variable-free expression I(v) such that, if I(e) denotes the expression obtained by making all such replacements of variables in an expression e, that I(e_{i}) ≡ I(f_{i}) for all i? We define e ≡ f as either:

- e = f (the only possible way if e or f is a constant)
- If e = (a+b) and f = (c + d) then either (a ≡ c and b ≡ d) or (a ≡ d and b ≡ c)

**Example: **Suppose C was {0,1}, and V was (x,y,z}. We will have pairs ((x+y), (0+1)) and ((y + z), (0 + 0)). Then substituting x with 1, and y and z with 0 makes the substituted pairs equivalent.

**Reduction: **I think this can be done with One-In-Three 3SAT. The SAT instance defines variables x_{1}..x_{k}. Each variable x_{i} in the SAT instance will correspond to 2 variables in the set V in our unification instance: x_{i} and ~x_{i}. Each clause in the SAT instance (l_{1}, l_{2}, l_{3}) will turn into the expression (e,f) where the “e side” is (l_{1}+l_{2}+l_{3}), where each l_{i} is the variable corresponding to the literal (i.e., either some x_{j} or some ~x_{j}). The “f side” of all expressions is (1+0+0), which corresponds to exactly one of the literals being true.

We also need to add some extra expressions to make sure that we set each x_{i} and ~x_{i} to opposite signs. So each variable x_{i} in the SAT instance gets a pair whose “e side” is (x_{i} + ~x_{i}), and whose “f side” is 0+1.

I think that the unification instance we’ve constructed has a solution if and only if we can find a way to:

- Set exactly one literal in each clause to true
- Set exactly one of x
_{i}and ~x_{i}to true, for all x_{i}

..which is exactly when the original One-In-Three 3SAT instance was solvable.

I’ll admit to being a little worried about whether this is correct, because the comment in G&J talked about there being at most 7 constants or variables in an expression, and I did it with just 3. Maybe it’s because I’m using One-In-Three 3SAT instead of regular 3SAT, or maybe I’m missing something.

**Difficulty: **4 if I’m right. I think starting from this version of 3SAT is a big hint.

**The problem: **Equilibrium Point. This is problem AN15 in the appendix.

**The description: ** Given a set X = {x_{1}..x_{n}} of variables, a collection F = {F_{1}..F_{n}} of integer product polynomials over the variables, and a set of “ranges” M = {M_{1}..M_{n}} of subsets of the integers. Can we find a sequence Y = {y_{1}..y_{n}}, where each y_{i} ∈ M_{i}, and for all y ∈ M_{i}, F_{i}(y_{1}, y_{2},…y_{i-1}, y_{i}, y_{i+1}, …y_{n}) ≥ F_{i}(y_{1}, y_{2},…y_{i-1}, y, y_{i+1}, …y_{n})?

**Example: **This concept of “Equilibrium point” is best through of from the perspective of Game Theory. The functions F are the utility functions for each player. The sequence Y is the set of choices each player makes. We are asking whether we can find a set of values in Y where any player i changing their y_{i} value to something else will not improve their personal F_{i }score.

So the classic “Prisoner Dilemma” problem can be represented in these terms: There are 2 players, so n is 2. Each range is with in {0,1}, where 0 means “stay silent” and 1 means “betray”. F_{1} is defined by a table:

Player 2 stays silent | Player 2 betrays | |

Player 1 stays silent | -1 | -3 |

Player 1 betrays | 0 | -2 |

F_{2} is defined similarly (the 0 and -3 scores switch places).

Notice that if we chose y_{1}=y_{2} = 0 (both sides stay silent). Then F_{1}(0,0)= F_{2}=(0,0) = -1. But this is < F_{1}(1,0), where player 1 betrays. So this is not an equilibrium point.

y_{1}=y_{2}=1 is an equilibrium point, where both functions return -2. Any player changing their choice from 1 to 0 will see their F function go from -2 to -3.

**Reduction: **Sahni does this in his “Computationally Related Problems” paper that we’ve used in the past to do some graph reductions. This reduction is from 3SAT. I’ll just say now that he could have avoided a lot of manipulation if he’d have used One-In-Three 3Sat. From a 3SAT instance, we build a game where there is one clause for each player, and the range of choices for each player is between {0,1}. The goal is to make a function f_{i} for a clause C_{i} that is 1 iff the corresponding clause is true. I’ll skip over the manipulations he does because he’s using a harder SAT problem than he needs to.

Define h_{i}(x’) to be 2* the product of all of the f_{i}(x’) values (for some literal x’. If x;’ is a positive literal, use the variable. If it’s a negated literal, use 1- the variable). F_{1} (x’) = h_{1}(x’) for all players. This means that if the formula was satisfiable, everyone could score 2, but if it wasn’t, they’d always score 0.

Now it gets weird. We’re going to set up a *second* game G, a 2 player game with no equilibrium point, then define a second payoff function for our original game F_{2} where F_{2} (x) = the g function of x for the first 2 players, but 0 for everyone else.

The paper says that the actual payoff for the actual game we’re creating is: F(X) = F_{1}(x) + F_{2}(x) * 2 – F_{1}(x)

The “2” is a payout of 2 for all players- since the above depends on matrix math, it’s an nx1 vector of all 2’s. This formula is very weird to me because the F_{1} and -F_{1} should cancel out. This is where I think there might be a typo. I’m pretty convinced there *is* a typo on the previous page where he was building his little f_{i} function (he uses a + where there should be a -). I’m thinking that there are missing parentheses in this formula, and it should be F(X) = F_{1}(x)+F_{2}(x)*(2-F_{1}(x))

Now two things can happen. If the formula was satisfiable, then F_{1}(x) is all 2’s, and that is the max payout for everyone and is an equilibrium point. If the formula was not satisfiable, then F_{1}(x) is all 0’s, and so the scores in the F_{2} part influence the score for F, but the F_{2} part has no equilibrium, so F doesn’t either.

**Difficulty: **8. I think I found the typo though.

**The problem: **Permanent Evaluation. This is problem AN13 in the appendix.

**The description: **Given an nxn matrix M of 0’s and 1’s, and a positive integer K, is the permanent of M equal to K?

**Example: **The permanent of M =

That is, for each permutation of the columns, we multiply down the main diagonal. The sum of all of those products is the permanent.

1 | 2 | 3 |

4 | 5 | 6 |

7 | 8 | 9 |

..then the permanent is 1*5*9 + 1*6*8 + 2*4*9 + 2*6*7 + 3*5*7 + 3*4*8 = 450

Of course, we’re looking at 0/1 matrices, so I think what we’re really asking is how many permutations of the columns have 1’s on the main diagonal.

**(Wrong) Reduction: **If I’m right above that all we’re doing is counting how many ways there are 1’s in the main diagonal, then this becomes a pretty easy Turing Reduction from Hamiltonian Path. Given an adjacency matrix of a graph, we want to know if the permanent of the adjacency matrix is 1 or more. (Any Hamiltonian Path will give a permutation that multiplies to 1, and any permutation of vertices that is not a Hamiltonian Path multiplies to 0). Given how complicated the “actual” reduction is, I’m a little worried that I missed something, though.

**Edit on 1/21: **This isn’t right. The problem is that while you’re premuting the columns, you’re not permuting the rows. So if we permute the column to be the second vertex in the Hamiltonian Path, the second row is still the vertices adjacent to vertex #2 (which might not be the second vertex in the path).

That’s a shame. I wonder if there is a way to manipulate the problem to make it work this way anyway.

**(Correct) Reduction:**

The reduction by Valiant that G&J point you to uses 3SAT, He shows that if you have a formula F, and define t(F) to be 2x the number of literals in F – the number of clauses in F, then there is some function f, computable by a deterministic Turing Machine in polynomial time, that maps a formula to a matrix. (The matrix has entries in {-1..3}, he does another transformation later to convert it to a 0/1 matrix). The permanent of that matrix = , where is the number of ways to satisfy F.

Since one of the consequences of Cook’s Theorem is that we can take an arbitrary non-deterministic Turing Machine and turn it into a Satisfiability formula, we get the reduction.

The actual construction of that function f is complicated. Given a formula, we construct a graph and use the matrix as the adjacency matrix of the graph. The variables, literals, and clauses get mapped to subgraphs.

**Difficulty: **If my way was right, I’d give it a 4- I think it’s easier than most Turing Reductions. The Valiant construction is an 8.

**The problem: **Cosine Product Integration. This is problem AN14 in the appendix.

**The description: **Given a sequence of n integers , does ?

**Example:**

Suppose our sequence was (1,2,3). Then our integral is:

This is just , which integrates to , which over the interval is

**Reduction: **This one is in Plaisted’s 1976 paper. In it, he notes that if you look at the function the constant term in the power series expansion of that product is 0 if and only if the cosine integral is 0. I have trouble seeing that myself. The cooler thing is that you can make that constant term 0 if and only if you can take the sequence of elements and partition them into 2 sets with the same sum. So we can take an instance of the Partition problem, use the elements of the set as the elements of our sequence and then feed them into the product formulas.

**Difficulty:** It really depends on how easily you can see the connection between the cosine integral and the product formula (and, of course, how easily you could have thought of it). I find it hard, so I’m giving it an 8.