Solution

ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2015/logic-and-proof/1/d/solution

Enumerate the vertices as and introduce a Boolean variable for each ordered pair of vertices. Its intended meaning is that a proposed graph automorphism sends to . Build four groups of Boolean clauses.
First require exactly one image for each vertex:
Next require that distinct vertices have distinct images:
Together and specify an injective function . Since is finite, this function is a bijection; a separate surjectivity condition is unnecessary.
Write when and otherwise. Prohibit every pair of images that would change adjacency:
Checking both possible mismatches preserves both edges and nonedges. Finally require a moved vertex:
The desired propositional formula is
If a Boolean valuation satisfies , selects a unique image for every vertex, makes the resulting function a bijection, preserves adjacency in both directions, and makes this graph automorphism different from the identity function. Conversely, given such a graph automorphism , set true exactly when . Each of is then satisfied.
There are Boolean variables, image and injectivity Boolean clauses, and at most adjacency Boolean clauses. With the graph stored by its adjacency matrix, testing a mismatch takes constant time. Thus the construction has polynomial time and output length with binary-indexed variable names. For , interpret the empty logical disjunction as false; for , and conflict. These cases correctly have no nonidentity graph automorphism.

New to topics? Read the docs here!