Solution

ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2020/artificial-intelligence/2/e/solution

Use an exactly-one constraint for each finite-domain variable and a Boolean clause forbidding each disallowed constraint tuple. Let the variables be , with explicitly listed finite constraint domains , and let constraint have distinct-variable scope and allowed relation . Introduce a Boolean variable for every , interpreted as . The direct SAT encoding of finite-domain constraints is
In the middle logical conjunction, each unordered distinct pair is included once. The first Boolean clause requires at least one value, the pairwise Boolean clauses permit at most one, and a final Boolean clause is false exactly when all coordinates of one forbidden tuple are selected. The formula is in conjunctive normal form. An empty constraint domain produces an empty Boolean clause, correctly making the instance unsatisfiable.
For soundness of the reduction, a solution of the constraint satisfaction problem gives the Boolean valuation exactly when . Every exactly-one constraint holds; a forbidden tuple differs from on at least one scoped coordinate, making its negative Boolean clause true. Thus supplies a satisfying assignment for .
Conversely, a satisfying assignment selects a unique value for every . If a constraint failed, the selected scoped tuple would belong to , and its entire negative Boolean clause would be false. That contradicts satisfiability. Hence is a solution. Decoding takes by scanning the value indicators. This proves has a solution if and only if is satisfiable.
For explicit size accounting, put , and . There are Boolean variables,
Boolean clauses, and
literal occurrences. These formulas count nonempty scopes; a false zero-arity constraint contributes an empty Boolean clause, while a true one contributes none. Formula storage is literal-sized records; a bit-level encoding also stores indicator indices. With maximum constraint domain size , constraints and maximum arity , this is bounded by for nontrivial domains and scopes. In the common binary case it is .
The input representation matters: listing all forbidden tuples costs up to tests per constraint. This is polynomial for bounded arity and explicitly represented domains, but can be exponential in the description length of a succinct high-arity constraint. The translation is valid in that case without constituting a polynomial-size reduction. If a compact constraint is supplied as a polynomial-size Boolean circuit, one may instead encode that circuit using auxiliary Boolean variables and local conjunctive normal form equivalences, with size proportional to the circuit. No compact representation is silently assumed.
For the instance in (c), after unary filtering there are indicators. The five at-least-one Boolean clauses, pairwise at-most-one Boolean clauses and forbidden-equality Boolean clauses give Boolean clauses. Setting only true encodes the displayed solution.

New to topics? Read the docs here!