This next problem is related to QBF and is proved in a similar way.

**The problem: **First Order Theory of Equality. This is problem LO12 in the appendix.

**The description: **Given a set U of variables {u_{1}..u_{n}}, and a sentence S over U in the first order theory of equality. Is S true in all models of the theory?

The first order theory of equality defines logical operations for equality (on variables), and the standard ∧, ∨, ¬, → operations (on expressions). It also lets us define ∀ and ∃ quantifiers on variables outside of an expression.

**Example: **My lack of mathematical logic knowledge is again letting me down as I’m not entirely sure what the difference between “models of the theory” and “assignments of truth values” is. It seems to me that this is very similar to QBF, with the addition of equality. So I think we can ask whether an expression like:

∀x ∀y ∀z (x=y) → (x = z) is always true. (It is).

I think, at least, this is the meaning that the Stockmeyer and Meyer paper use.

**Reduction: **Stockmeyer and Meyer again do a “generic transformation” using Turing Machines. What they do is the generic transformation for QBF (it’s Theorem 4.3), and then show this problem is a corollary to it because it follows from the “well-known fact that a first-order formula with n quantifiers and no predicates other than equality is valid iff it is valid for domains of all cardinalities between 1 and n”.

It’s not a well-known fact to me, so I guess I’ll just trust them.

**Difficulty: **I guess it depends on just how “well-known” that fact is for your class. If I gave the QBF reduction a 3, maybe this is a 5? But if you have to tell them the fact, maybe it’s too obvious? I don’t know.

**The problem: **Truth-Functionally Complete Connectives. This is problem LO10 in the appendix.

**The description: **Given a set U of variables, and a set C of well-formed Boolean expressions over U, is C truth-functionally complete? In other words, can we find a finite set of unary and binary operators D = {θ_{1}..θ_{k}} such that for each θ_{i} we can find an expression E in C, and a substitution s: U->{a,b} such that s(E) ≡ aθ_{i}b (if θ_{i} is binary) or s(E) ≡ θ_{i}a (if θ_{i} is unary)?

**Example: **So, “Truth-Functionally Complete” means that you can use the operations in D to generate all possible truth tables. So some possible candidates for D are {AND, NOT} or just {NAND}.

So, if U = {x,y} and C = {~x, x∧y}, then I can just choose D to be {NOT, AND} and use the obvious substitution. I think the hard part here is that the problem asks if such a D exists- I think the substitutions are probably always straightforward, once you get the functionally complete set D that gives you the best mapping..

**Reduction: **As I said above, this is a “Private Communication” problem, and so after a lot of searching, I found this paper by Statman, which I’m honestly am not even sure is the correct one. It at least talks about substitutions and deterministic polynomial time algorithms and things, but it very quickly goes into advanced Mathematical Logic that I wasn’t able to follow. If someone out there knows more about this than I do and wants to chime in, let me know!

**Difficulty: **10. This is why we have the level 10 difficulty- for problems I can’t even follow.

LO8 is DNF Non-Tautology.

The next problem’s paper was written in 1965, so before NP-Completeness was a concept. As a result, the paper doesn’t line up exactly with what we want to do, and I think I’m misunderstanding something.

**The problem: **Minimum Disjunctive Normal Form. This is problem LO7 in the appendix.)

**The description: **Given a set u_{1} through u_{n} of variables, a set A of n-tuples containing T or F symbols (possible truth assignments of the variables), and an integer K, can we create a DNF form expression E that is true for the variable set *exactly* for the truth assignments in A (everything in A and nothing more) using K clauses or less?

**Example: **Suppose we had 3 variables, and A was {(T,T,F), (T,F,F)}.

Then the DNF expression (u_{1} ∧ u_{2} ∧ ~u_{3}) ∨ (u_{1} ∧~u_{2 }∧ ~u_{3}) will be true only on the truth assignments listed in A.

We can get away with less than “one clause for each element of A” though. For example, if A = {(T,T,T), (T,T,F), (T,F,T), (F,T,T), (T,F,F), (F,T,F)} then we can just use u_{1} ∨ u_{2} to cover exactly those truth assignments.

**Reduction: **The paper by Gimpel was written in 1965 (before Cook’s 1971 paper), so wasn’t conceived of as an NP-Completeness reduction. But it does show how to translate from Set Covering.

The basic idea is that we will represent a covering instance as a 0/1 table A. We start with an m by n table, with variables representing the rows and sets representing the columns (a_{ij} = 1 means that variable i is in set j)

We’re now going to build some boolean expressions over m+n variables:

p_{i} = u_{1} ∧ u_{2} ∧ … ∧ ~u_{i} ∧ … ∧ u_{m+n}

(All of the positive variables and-ed together, except the negation of u_{i})

f_{1} = p_{1} ∨ p_{1} ∨ … p_{n}

F_{i }= {j | a_{ij} = 0} (The set of all variables not in set i)

P_{i} = u_{n+i} ∧ u_{j} (the conjunct of all u_{j} where j ∈ F_{i})

f_{2} = P_{1} ∨ … P_{n}

Then he proves that f1 and f2 form a pair of functions for which A is the prime implicant table of those functions. By which he means that a_{ij} = 1 if and only if p_{j} ∈ P_{i}.

Then we build a table B that represents the prime implicant table of a related function. If we remove the last r rows and 2r columns from B (I think this is related to K somehow), we get a table that is equivalent to our A.

**Difficulty: **9. I’m pretty sure I’m missing something here. I don’t see how these tables relate. I don’t see how you can take f_{1} and f_{2} and make a single DNF formula out of them. I don’t see where K shows up- I guess it’s a limit on n? But how does it relate to the covering matrix?

LO1 is Satisfiability

LO2 is 3-Satisfiability

LO3 is Not all Equal 3SAT

LO4 is One-In-Three 3SAT

LO5 is Maximum 2SAT

After that we finally get to a new problem:

**The Problem: **Generalized Satisfiability. This is problem LO6 in the appendix.

**The description: **Given a list of positive integers k_{1} through k_{m} and a sequence S = <R_{1}..R_{m}>, where each R_{i }is a set of strings of k_{i} “T” or “F” symbols. We’re also given a set U of variables, and a set of collections C_{1} through C_{m}. Each C_{i} contains a k_{i}-tuple of variables from U.

Can we assign a truth value (“T” or “F”) to each variable in U such that for each tuple in C_{i} the truth value of each variable in the tuple matches the sequence of true and false values in R_{i}?

**Example: **Let all k_{i} = 3, and m = 2. R1 = {(T,T,T), (F,F,F)} R2 = {(T,F,F). (F,T,T)}

U = {x_{1}, x_{2}, x_{3}}. C1 = (x_{1}, x_{2}, x_{3}}. C_{2} = {x_{1}, x_{2}, x_{3}}

So, the question is: Can we assign truth values to x_{1} x_{2} and x_{3} so that the truth values map to a sequence in both R0 and R1? Since we have the same sequences of the same variables in both sets, the answer is no.

But, suppose we change C_{2} to (x_{4}, x_{2}, x_{3}). Then we can set x_{1}, x_{2}, and x_{3} to true and x_{4} to false. This will let the sequence in C_{1} map to the (T,T,T) sequence in R1, and the sequence in C_{2} map to the (F,T,T) sequence in R2.

**Reduction: **This reduction is in Shaefer’s paper, and it reduces from 3SAT. The idea is that we will build 4 R sets, thinking of them as functions. So:

R0 = {R(x,y,z) | x or y or z is true} = {(T,T,T), (T,T,F), (T,F,T), (T,F,F), (F,T,T), (F,T,F), (F,F,T)}

R1 =Same idea, but “~x or y or z is true”

R2 = “~x or ~y or z is true”

R3 = ” ~x or ~y or ~z is true”

Once we’re given a CNF instance, we replace each clause in the formula with one of the Ri formulas. Then build a C set that uses the variables in the clause. So, for example, if a clause in the CNF formula was ~x_{2} ∨ x_{5} ∨ ~x_{7}, we’d make the element in R corresponding to the clause R2, and we’d use the C formula (x_{2}, x_{7}, x_{5}). Notice that we changed the order of the variables in the C set because R2 expects its negated literals first.

Notice that we can find a way to assign the variables truth values to make each C_{i} map to its R set, we have satisfied the clause. So this new construction is satisfiable if and only if the 3SATinstance was satisfiable.

**Difficulty: **Making the construction is probably a 5, mostly because you need a good way to explain how you’re making the R sets. The hardest thing here though is understanding what the problem says.

**The problem: **Generalized Instant Insanity. This is problem GP15 in the appendix.

**The description: **Given a set Q of cubes, and a set C of colors we paint on the sides of each cube (and where |Q| = |C|) is there a way to arrange the cubes in a stack such that each color in C appears exactly once on each side?

**Example: **The Wikipedia page for the Instant Insanity game has a good description of the game and an example of the solution when Q = 4.

**Reduction: **Roberson and Munro reduce from “Exact Cover”. I don’t think I’ve done this problem, but it’s basically X3C where the sizes of the sets can be any size. (So it’s a trivial reduction from X3C).

They start by designing a graph representation of the puzzle, similar to the one shown on the Wikipedia page. Vertices correspond to colors, an edge connects two vertices if they are on opposite sides of the came cube, and the edges are labeled with the name of the cube. The puzzle has a solution if and only if we can find two edge disjoint cycles that touch each vertex and edge label exactly once. The two cycles correspond to the two sets of opposite faces we can see (since 2 sides of each cube are hidden by the stack). Again, go look at the graphs in the Wikipedia article– they show this pretty nicely.

So, to perform the reduction, we’re given a set S {s_{1}..s_{m}} and a collection T of subsets of S, and need to make a graph (which corresponds to a puzzle). Each element in S will become a vertex in the graph. Each of these vertices will have a self-loop and be labeled ζ_{i} (So each vertex is a different color, and each self-loop is part of a different cube- so each cube has one color on opposite sides).

Each element s_{i} inside a set T_{h} of T will also have a vertex: v_{i,h}. This vertex has an edge with the next largest level s_{j} within T_{h}, wrapping around if we’re at the last element of T_{h}. These edges are labeled ϒ_{h,j}. We also have an edge from s_{j}to v_{h,j} if s_{j} is in T_{h} labeled with δ_{h,j}. We also have 2 copies of self-loops from each v_{h,j} to itself labeled ϒ_{h,j}.

They then add some extra edges to give the graph the properties:

- One of the self-loops from v
_{h,i}to itself has to be in one of the two cycle sets. - If the edge from v
_{h,i}to s_{j}(labeled ϒ_{h,j}) is in the other cycle set, then the edge from s_{j}to v_{h,j}(labeled δ_{h,j}) is also in that cycle set - The ζ
_{i}edge label has to be used, and so will have to be used on an s_{i}vertex the cycle that uses that vertex will also have to have the labels ϒ_{h,j}and δ_{h,j}for some h. - The loops (labeled ζ
_{j}and ϒ_{h,j}) are in one cycle set and the paths (labeled ϒ_{h,j}and δ_{h,j}) are in the other.

With these properties, then solving the puzzle means we have to find h_{1} through h_{m} that correspond to sets T_{h} in T, but also where there is a path ϒ_{h,j}.δ_{h,j} in the graph for each s_{j} in T_{h_i}. We make sure no elements in S are repeated by making sure the puzzle only uses each s_{j} vertex once.

**Difficulty: **8. I glossed over a lot of the construction, especially the definition of a “p-selector”, which is a subgraph that helps set up a lot of the properties above. That definition is very hard for me to follow.

**The problem: **Crossword Puzzle Construction. This is problem GP14 in the appendix.

**The description: **Given a set W of words (strings over some finite alphabet Σ), and an n x n matrix A, where each element is 0 (or “clear”) or 1 (or “filled”). Can we fill the 0’s of A with the words in W? Words can be horizontal or vertical, and can cross just like crossword puzzles do, but each maximally contiguous horizontal or vertical segment of the puzzle has to form a word.

**Example: **Here’s a small grid. *’s are 1, dashes are 0:

* | – | – | – | * |

– | – | – | – | – |

– | – | – | – | – |

* | * | – | – | * |

* | * | * | – | * |

Suppose our words were: {SEW, BEGIN, EAGLE, S, OLD, SEA, EGGO, WILLS, BE, SEA, NED}. (Notice the lone “S” is a word. That’s different from what you’d see in a normal crossword puzzle)

We can fill the puzzle as follows:

* | S | E | W | * |

B | E | G | I | N |

E | A | G | L | E |

* | * | O | L | D |

* | * | * | S | * |

Notice that we can’t use the first two letters of “BEGIN” as our “BE”, because the word continues along. That’s what the “maximally contiguous” part of the definition is saying.

**Reduction: **From X3C. We’re given a set X with 3q elements, and a collection C of 3-element subsets of X. We’re going to build a 3q x q puzzle with no black squares. (We’ll get back to making this a square in a minute) Each word in W will be a bitvectorof length 3q, with a 0 in each position that does not have an element, and a 1 in the positions that do. So, if X was {1,2,3,4,5,6,7,8,9} the set {1,3,5} would be 101010000

We also add to A the 3q bitvectors that have exactly one 1 (and 0’s everywhere else). The goal is to find a subset of C across the “rows” of the puzzle, such that the “columns” of the puzzle form one of the bitvectors. If we can form each of the bitvectors, we have found a solution to X3C. If we have a solution to X3C, we can use the elements in C’ and place them in the rows of the 3q x q puzzle block to come up with a legal crossword puzzle.

We’re left with 2 additional problems: The grid needs to be a square, instead of a 3q x q rectangle, and the legal crossword puzzle solution needs to use *all* of the words in W, not the the ones that give us a C’. We can solve both by padding the grid with blank squares. Spaced out through the blank spaces are 1 x 3q sections of empty space surrounded by black squares. We can put any word in C-C’ in any of these sections, and that’s where we’ll put the words that are not used.

(This also means we’ll have to add 3x|(C’-C)| 1’s and (3q-3)|(C’-C)| 0’s to our word list for all of the 1-length words in those columns.) Then we add enough blank spaces around the grid to make it a square.

**Difficulty: **5 if I’m right, mainly because of the extra work you have to do at the end. The comments in G&J say that the problem is NP-Complete “even if all entries in A are 0”, which is usually a hint that the “actual” reduction used an empty square grid. I wonder if that reduction doesn’t have my hacky stuff at the end.

**The problem: **Square Tiling. This is problem GP13 in the appendix.

**The description: **Given a set C of colors, and a set T of tiles, where each of the 4 sides of the tile are colors from C (listed as a 4-tuple of (top, right, bottom, left) colors), and an integer N. Can we tile an NxN square of tiles using tiles from C? We can use a tile more than once, the tiles can’t be rotated, and adjacent edges need to match colors.

**Example: **Here are some example tiles I drew:

We can tile these into a 3×3 grid like this:

**Reduction: **As I said above, the reference in G&J is to an “unpublished result” by Garey, Johnson, and Papadimitriou. I did manage to find a “generic reduction” using Turing Machines in the Lewis and Papadimitriou Theory book.

The reduction is from the “N_{2}” language in the book, which (I think) is “Can a Turing Machine M halt in t steps or less with its head on the tape in configration uσv, where u and v are strings in Σ*, and σ is the location of the head (and a symbol in the alphabet)?

The idea is that we’ll build a set of tiles whose colors are based on the number of steps the computation has done so far. The colors are actually tuples. So, we have several kinds of tiles:

- For each a in Σ*, and each k from 1 to t, a tile with color (a, k+1) on the top, and (a,k) on the bottom. This simulates a move that stays in the same state and writes the same symbol.
- For each pair a,b in Σ*, and each state p,q in M (p can include the halt state, q can’t), a tile with the color (p,b,k+1) on the top and (q,a,k) on the bottom. This simulates going from state p to state q and replacing an a with a b.
- We can transition from one of the above types of tiles to another using a sideways move. (If the head moves left or right, we move to a tile to the left or right)
- There are special tiles for the start row and for when the machine halts.

We set our N (the size of the tiling grid we’re making) to t+2. What we’ve built is a system that:

- Has to have the tiles corresponding to one of the start states on the bottom row
- Has in row i a tile corresponding to a configuration of the machine after i steps. (A path of tiles from the bottom to row i show the computation needed to get to that state)
- Has at the top row a tile corresponding to a configuration after t+1 steps. If there is a legal tiling, one of those tiles must contain the halt state.

..which they claim is the same as the N_{2} langauge.

The suggested reduction in the appendix is from Hamiltonian Path, and I spent some time thinking about how to make that work, but couldn’t do it. Do you make tiles correspond to vertices? Do you make colors correspond to vertices? How do you account for the fact that you can go in two dimensions? How do you account for the fact that you don’t know the order in which you visit the tiles? I think it might be similar to this way of thinking about configurations.

**Difficulty: **9 because it’s such a non-standard way of doing things. I bet the Hamiltonian Path reduction is a lot easier.

]]>

**The problem: **Left-Right Hackenbush for Redwood Furniture. This is problem GP12 in the appendix.

**The description: **Ok, here we go. First, a Hackenbush problem consists of an undirected, connected graph. The edges of the graph are marked as “Left” or “Right”(though the book has some very nice colored pictures, where the edges are labeled “Blue” and “Red”). Some of the vertices are on the ground (In G&J’s definition, there is one ground vertex, but it’s equivalent to having several vertices that are all on the ground).

On Left’s turn, they remove a blue edge and then all edges that are not connected to the ground are removed. On Right’s turn, they remove a red edge, and then all edges that are not connected to the ground are removed. A player loses if there are no remaining edges of their color.

A *redwood furniture* Hackenbush instance is one where:

- No red edges touch the ground
- Each blue edge (or “foot”) has one end on the ground and the other touches a unique red edge (the “leg”)

Here are some redwood furniture instances from the book:

The “value” of a Hackenbush position is the number of “spare” moves (with optimal play) one player has after the other player loses. A value of 0 means that whoever’s turn it is will lose (on an empty board). The definition can be extended to fractional values. For example, a value of 1/2 for (say) Left means that if we made two copies of the game, we would end up with a situation with a value of 1 for Left.

So, the question is, for some Redwood Furniture graph, and some K, is the value <= 2^{-K}?

**Reduction:**

I’m just going to sketch the process here since it takes several pages of the book (and depends on results and ideas from earlier in the book).

They show:

- The value of any redwood furniture graph is 2
^{-N}for some N. In the degenerate case, the graph with just one Left edge has a value of 1. (=2^{0}) - On Left’s turn, they will always remove a foot (by definition, that’s all they have). On Right’s turn, they should make a move that does not disconnect the graph, if possible.
- A “Bed” is a redwood furniture graph where every red edge that is not a leg connects to a leg. It has value 2
^{-(m+1)}, where m is the largest number of moves that do not disconnect the bed. - The value of the game depends on how many extra moves Red has to get down to just a bed.
- To find m, you need to know the size of the largest redwood tree (a tree is a graph that will be disconnected by the removal of any edge) that contains all of the legs.
- The edges of the bed (the red edges that are not legs) form a bipartite graph. So finding m is equivalent to the set covering problem, where the elements of the set are the vertices, and the edges are the sets.

Here’s how I think the Set Covering reduction works. Given a set covering instance: a set S of elements, and a collection C of subsets of S, we’ll build a bipartite graph. One set of the bipartite graph will correspond to the elements of S (and will be on the legs of the furniture graph). The other set will correspond to the elements in C (and will be the vertices in the bed that are not in the legs). An edge will go from each “C vertex” to each “S vertex” in its set. Now, the cover is the set of vertices from the bed that cover all of the legs.

The book says you want the “smallest redwood tree which contains all of the legs”, which I think is the same thing (smallest number of extra vertices), but I’m not 100% confident since the Hackenbush game involves removing edges, and we’re choosing vertices in the cover.

I’m a little sad that the book does such a great job describing the game, and the value function, and then glosses over the reduction part (and uses misleading terms like “Minimum Spanning Tree of a Bipartite Graph”, which is a polynomial problem). The actual reduction in G&J is to a private communication, so that’s not much help.

**Difficulty: **Boy, I don’t know, I think it depends on where you start from. If my Set Cover reduction is the right one, and all you ask a student to do is that, it’s probably a 4. If you’re going to make them prove all of the things I glossed over about the value number, then it probably goes up to at least an 8.

**The problem: **NxN Go. This is problem GP10 in the appendix.

**The description: **Given an integer N, and a position (consisting of black piece locations, white piece locations, and black piece locations) on an NxN go board, and the name of the current player’s turn, does white have a forced win on the game?

**Example:** Instead of a true example, what I think is most relevant here is a little discussion of the rules and basic strategy of Go. In Go, players take turns playing stones on a grid, with the goal of surrounding spaces on the board with pieces of your color:

(all pictures are taken from the tutorial at https://www.pandanet.co.jp/English/learning_go/learning_go_2.html):

In this case, white has surrounded 9 spaces (stones are placed at intersections, including the edges of the board).

If a stone of the other color can be surrounded on all 4 sides by a stone of your color, the stone is captured, scoring you a point at the end of the game:

In this case, the black play at “1” captures the white piece (and likely gains black an additional point for having surrounded territory at the end of the game)

More than one piece can be surrounded at a time, but not all configurations of stones can be surrounded. Most notably, a configuration with two “eyes” (or empty holes) cannot be captured, for example:

Here, the white play at “1” creates two eyes. There is no way for black to surround all of the white pieces since they would have to play in both empty holes, and as soon as black plays in one of the holes, the black piece is surrounded and immediately captured.

So, the main goal of Go (and the proof) revolves around creating “safe” structures that contain two eyes and using them to capture as much territory as possible.

**Reduction: **The paper by Lichtenstein and Sipser reduce from Planar Geography. The idea is to have a set of safe territory for White, and another threatened set of stones large enough that if it can be made safe, White will win, but if it can be captured, Black will win. Here’s the picture from the paper:

Black pieces surround white all the way around, so the only escape would be for white to extend the “pipe” on the left around to the safe white spaces (or some other group of two eyes, which will keep the large group alive). Then we encode the vertices and edges in the graph as sets of stones, where each “choice” of going through an edge is reflected by a choice of where stones are placed.

There are many types of subgraphs and corresponding board positions in the paper, here’s just one of them:

(Graph position)

(Board position)

Here’s the general structure of the arguments that show how the play “has” to go through this vertex. Suppose we are coming from the top, and white wants to go left.

- If White doesn’t play at 1, 2, or 3 first, Black will play at 2. White will now have to play at 1 to keep the middle vertical strip (which connects back to the big threatened set of pieces) alive. But then Black plays at 3 and takes them all anyway.
- Even if White plays at 3, Black wins by playing at 1, then White moves to 2, then Black plays at 5
- If White does play at 1 or 2, (let’s say 1, because that will take us left), Black has to respond at the other point (so, 2 for us). If they don’t, White plays at 2, and 3 black stones below the 1 and 2 are captured, and White will be able to connect to the two eye group below.
- After Black plays at 2, white needs to go to 3 to build a line of white stones coming in from the top, and going out to the left. Black plays at 4 to stop white from connecting to the group of 2 eyes on the left.

As a result, the “edge” going through this vertex and coming out to the left has been chosen.

**Difficulty: 7. **I think this is easier to see than the NxN checkers reduction, but still takes a lot of cases and structures to realize.

**The problem: **Planar Geography. This problem is not in the appendix (though the reference to this problem and the paper with this reduction appears in the notes to the “Generalized Geography” problem).

**The description: **Given an instance of the Generalized Geography problem, but where the graph G is planar, does Player 1 have a forced win?

**Example: **The example we had in the Generalized Geography problem is actually a planar graph:

**Reduction: **The paper by Lichtenstein and Sipser which has the reduction for next week’s NxN Go problem has this in the ramp-up.

What we’re doing to do is re-build the graph that was created in the Generalized Geography reduction. That graph may not be planar. Any time the graph has two edges that cross:

We replace it with the following construction

(figures are on pages 395 and 396 of the paper).

The important things to realize are these:

1) If we use this on the graph generated from the original Geography Construction, it will never be the case that we will use both crossing edges in one solution. This is an important point that isn’t really addressed in the paper. The Lichtenstein and Sipser paper has a slightly different reduction for Generalized Geography where it’s easier to see.

2) Suppose it’s player 1’s turn, and they enter the intersection going up. Then it will be their turn again once they hit the middle point. The point of the extra loop structures (instead of just adding a vertex at the intersection point) is to create a situation where if player 1 decides to turn right, player 2 can turn down, and make player 1 lose. This works in both directions.

**Difficulty:** I was hoping that this would be a good difficulty 4 or so problem in the middle of all of these really hard ones, but the whole “you’ll never use this intersection twice” problem makes the construction hard to see, and it’s a tough thing to think about why it matters, even if you told the student the rule. Maybe this is a 5 if you give them that information.