In theoretical computer science, nondeterministic constraint logic is a combinatorial system in which an orientation is given to the edges of a weighted undirected graph, subject to certain constraints. One can change this orientation by steps in which a single edge is reversed, subject to the same constraints. This is a form of reversible logic in that each sequence of edge orientation changes can be undone. Reconfiguration problems for constraint logic, asking for a sequence of moves to connect certain states, connect all states, or reverse a specified edge have been proven to be PSPACE-complete. These hardness results form the basis for proofs that various games and puzzles are PSPACE-hard or PSPACE-complete.
Constraint graphs
In the simplest version of nondeterministic constraint logic, each edge of an undirected graph has weight either one or two. (The weights may also be represented graphically by drawing edges of weight one as red and edges of weight two as blue.) The graph is required to be a cubic graph: each vertex is incident to three edges, and additionally each vertex should be incident to an even number of red edges. The edges are required to be oriented in such a way that at least two units of weight are oriented towards each vertex: there must be either at least one incoming blue edge, or at least two incoming red edges. An orientation can change by steps in which a single edge is reversed, respecting these constraints. More general forms of nondeterministic constraint logic allow a greater variety of edge weights, more edges per vertex, and different thresholds for how much incoming weight each vertex must have. A graph with a system of edge weights and vertex thresholds is called a constraint graph. The restricted case where the edge weights are all one or two, the vertices require two units of incoming weight, and the vertices all have three incident edges with an even number of red edges, are called and/or constraint graphs. The reason for the name and/or constraint graphs is that the two possible types of vertex in an and/or constraint graph behave in some ways like an AND gate and OR gate in Boolean logic. A vertex with two red edges and one blue edge behaves like an AND gate in that it requires both red edges to point inwards before the blue edge can be made to point outwards. A vertex with three blue edges behaves like an OR gate, with two of its edges designated as inputs and the third as an output, in that it requires at least one input edge to point inwards before the output edge can be made to point outwards. Typically, constraint logic problems are defined around finding valid configurations of constraint graphs. Constraint graphs are undirected graphs with two types of edges:
red edges with weight 1 {\displaystyle 1}
blue edges with weight 2 {\displaystyle 2}
We use constraint graphs as computation models, where we think of the entire graph as a machine. A configuration of the machine consists of the graph along with a specific orientation of its edges. We call a configuration valid, if it satisfies the inflow constraint: each vertex must have an incoming weight of at least 2 {\displaystyle 2} . In other words, the sum of the weights of the edges that enter a given vertex must be at least 2 {\displaystyle 2} more than the sum of the weights of the edges that exit the vertex. We also define a move in a constraint graph to be the action of reversing the orientation of an edge, such that the resulting configuration is still valid.
Formal definition of the Constraint logic problem Suppose we are given a constraint graph, a starting configuration and an ending configuration. This problem asks if there exists a sequence of valid moves that move it from the starting configuration to the ending configuration This problem is PSPACE-Complete for 3-regular or max-degree 3 graphs. The reduction follows from QSAT and is outlined below.
Variants
Planar Non-Deterministic Constraint Logic The above problem is PSPACE-Complete even if the constraint graph is planar, i.e. no the graph can be drawn in a way such that no two edges cross each other. This reduction follows from Planar QSAT.
Edge Reversal This problem is a special case of the previous one. It asks, given a constraint graph, if it is possible to reverse a specified edge by a sequence of valid moves. Note that this could be done by a sequence of valid moves so long as the last valid move reverses the desired edge. This problem has also been proven to be PSPACE-Complete for 3-regular or max-degree 3 graphs.
Constraint Graph Satisfaction This problem asks if there exists an orientation of the edges that satisfies the inflow constraints given an undirected graph G {\displaystyle G} . This problem has been proven to be NP-Complete.
Hard problems The following problems, on and/or constraint graphs and their orientations, are PSPACE-complete:
… excerpt ends here. Continue reading the full article.

![Nondeterministic constraint logic: Example of a constraint graph[1]](https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Constraintgraph.png/500px-Constraintgraph.png?utm_source=en.wikipedia.org&utm_campaign=parser&utm_content=thumbnail)
