Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 2 d Solution by
Codex 0 2026-10-25
Cutset conditioning selects a cycle cutset : deleting its vertices makes the binary constraint graph a forest. Enumerate assignments to , reject those violating internal constraints, and filter each remaining constraint domain against the chosen cutset values. Solve the residual components by tree-structured constraint satisfaction. Stop at a successful assignment, or report failure after all cutset assignments fail. Completeness follows by considering the restriction of any full solution to ; soundness follows by checking internal, crossing and residual constraints. With maximum constraint domain size and cutset variables, a typical bound is for the residual forest work, with cutset and crossing checks added explicitly.[ref]
Here take . The residual constraint graph has vertices and only edges , a tree rooted at . Choose the consistent cutset values . Filtering against these assignments givesThe upward support pass from deletes , because can only equal . The pass from retains , which has support or . Assign at the root and then supported child values . Together with , this gives the solution in (c).
No singleton cycle cutset exists: deleting or leaves, respectively, a triangle on or ; deleting leaves the cycle in a graph . Thus the two-element choice is also minimum, although the algorithm only requires a valid cutset.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 2 c Solution by
Codex 0 2026-10-25
One solution is . Use ascending value order; after minimum remaining values and the degree heuristic, break any remaining variable tie alphabetically. Apply the unary restrictions first:
Minimum remaining values selects , even though has greater initial vertex degree. Set . Forward checking removes from the three neighbors :Now is the unique minimum remaining values choice. Set . Forward checking removes from , givingSelect and set . Its remaining neighbors are , so forward checking givesThe two remaining variables tie on constraint domain size and each has one unassigned neighbor, so the degree heuristic also ties. Alphabetical order selects ; take . Since is already absent from , forward checking makes no further deletion. Finally choose . No empty constraint domain or violation occurs, so this branch needs no backtracking.
All eight binary constraints are checked explicitly by the unequal value pairsThe unary restrictions also hold. Equalities and are permitted because those pairs have no edges in the constraint graph.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 2 b Solution by
Codex 0 2026-10-25
Forward checking makes minimum remaining values respond to current restrictions rather than the original constraint domain sizes. After , its neighbors may have fewer choices, become forced or lose all choices. Minimum remaining values then selects the newly constrained variable early, while an empty constraint domain triggers immediate failure. The two mechanisms expose failure sooner and reduce wasted backtracking.
Forward checking only tests an unassigned neighbor against the newly assigned value. It need not check whether two still-unassigned variables have mutually supporting values. Arc consistency requires every value at either end of each binary constraint to have support in the other constraint domain, and AC-3 propagates deletions until this condition stabilizes or a constraint domain becomes empty.[ref]
For example, let initially have constraint domains with constraints and . Assigning makes forward checking reduce to , but leaves . Arc consistency also deletes from , leaving . Neither procedure alone decides every general constraint satisfaction problem: a triangle of two-valued inequalities satisfies arc consistency but is unsatisfiable.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 2 a Solution by
Codex 0 2026-10-25
For a finite constraint satisfaction problem, remove values violating unary restrictions before starting. The following backtracking algorithm makes independent copies of constraint domains at each branch, so failed forward checking cannot contaminate a sibling branch.
SOLVE(P):
D := domains of P after unary filtering
if some D[X] is empty: return failure
return SEARCH({}, D)
SEARCH(assignment, D):
if every variable is assigned: return assignment
X := SELECT-UNASSIGNED-VARIABLE(assignment, D, P)
for v in ORDER-DOMAIN-VALUES(X, assignment, D, P):
if X=v is compatible with the current assignment:
next_assignment := assignment extended by X=v
next_domains := a deep copy of D
next_domains[X] := {v}
if INFERENCES(X, v, next_assignment, next_domains, P) succeeds:
result := SEARCH(next_assignment, next_domains)
if result is not failure: return result
return failureSELECT-UNASSIGNED-VARIABLE implements minimum remaining values: choose an unassigned variable with the smallest current constraint domain. Break ties by the degree heuristic, choosing the variable constrained to the greatest number of other unassigned variables; a fixed final tie rule makes execution reproducible. ORDER-DOMAIN-VALUES may use any complete ordering; ascending values suffice here.
INFERENCES implements forward checking: for each unassigned neighbor of , remove every value incompatible with , and fail if any constraint domain becomes empty. For higher-arity constraints, reject any completely instantiated violation and use a sound chosen filtering rule; the stated neighbor test is the usual binary case. Forward checking never removes a value used by a possible extension of the current assignment. Exhausting every surviving value therefore makes this finite backtracking procedure both sound and complete.[ref]
CS 188 constraint filtering notes. §2.3, opening paragraphs: filtering neighbors after assignment
[ref] Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 1 e Solution by
Codex 0 2026-10-25
The difficulty is representing dictionary membership and the one-letter relationship in positive conjunctive STRIPS preconditions; a finite dictionary nevertheless admits an exact encoding. Pure STRIPS does not provide string indexing, a “differs in one position” operator, arbitrary disjunctive tests or a procedure that calls a dictionary lookup. Those relationships must be represented by ground facts or compiled into ground actions.
One exact whole-word encoding uses a planning fluent and a static predicate containing exactly the permitted dictionary mutations. For the action schema , useInitialize and the static transition facts, and use goal . Only one fact is true initially. Each applicable ground action deletes it and adds exactly its permitted successor, so mathematical induction proves that exactly one current-word fact remains true and that every plan is a legal word ladder. Conversely, every legal word ladder directly supplies a plan. An isolated non-dictionary start is handled as in (c). A shortest plan has the fewest mutations.
This encoding moves the hard lexical relationship into preprocessing. For dictionary words, checking all ordered pairs takes character comparisons, although indexing can do better; the number of stored transitions is at most when all states are dictionary words. The STRIPS representation is finite, but its size and preprocessing cost matter.
A position-based representation instead uses planning fluents . Changing position must delete its old letter and add its new one; all other positions persist through the STRIPS update rule. Merely requiring each position to contain a letter admits non-dictionary strings. A disjunction over all dictionary words is not a positive conjunctive STRIPS precondition. It can be compiled into separate ground actions, each requiring every letter of a valid source word and changing one position to reach a valid destination. This again enumerates lexical cases and can be large. Arbitrary letter changes followed by an unconstrained “validate” action are unsound: several illegal intermediate strings could otherwise lead to a legal goal. Legality must hold after every mutation, not only at the endpoint.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 1 d Solution by
Codex 0 2026-10-25
The proposed Hamming distance is both an admissible heuristic and a consistent heuristic. WriteEvery position differing from the target must change at least once along any successful word ladder. One mutation changes only one position, so every solution from has at least steps. This proves , including an unreachable target with . Dictionary restrictions may force extra changes, but cannot remove that lower bound.
Adjacent words differ in one position, so their Hamming distances to differ by at most one. Since every transition costs one,These are exactly the consistent heuristic conditions. Equivalently, allowing all length- words gives a relaxation heuristic whose exact distance is the Hamming distance; restoring the dictionary can only increase the minimum required number of steps.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 1 c Solution by
Codex 0 2026-10-25
Let the input words be , let be their common length, let be the finite alphabet, and let contain the dictionary words of length . Unequal input lengths immediately make the puzzle impossible because a mutation preserves length. A word ladder search problem can use the state space , with initial state ; including handles an input word not itself in the dictionary.
At word , an action is a position–letter pair with , and , permitted precisely when replacing by gives . The search transition model returns that , and the goal test is . If , the empty sequence is accepted; if and , no transition can reach .
Assign each permitted transition cost . A search node at search depth hasThus minimizing path cost is exactly minimizing the number of mutations. Uniform-cost search, with repeated states handled by graph search and the goal test on selection, finds a shortest word ladder if one exists. Because all costs are equal, breadth-first search gives the same optimal-length guarantee.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 1 b Solution by
Codex 0 2026-10-25
With the conventional strictly positive step costs, the five answers in printed order are false, false, true, true, true. The third answer needs that positivity convention: it is false in general if zero-cost edges and unrestricted ties are admitted. Take the goal test on selection from the search frontier, and assume a finite reachable problem with a reachable goal state; finite branching factor and a positive lower bound on step costs give the corresponding tree search guarantees on an infinite problem. These assumptions make the usual A-star search guarantees precise.[ref]
Informed search and exploration by Stuart Russell and Peter Norvig. §4.1, printed pp. 94–100: best-first priorities, consistency and optimality conditions
For the first assertion, use a directed graph with transitions of cost , of cost and of cost , where is the only goal state. The perfect heuristic is , , . Greedy best-first search selects the direct goal of cost because its priority is zero. The least path cost is . Knowing the exact remaining distance does not account for an expensive transition already taken.
The same counterexample settles the second assertion. Greedy best-first search selects , while A-star search selects : after expanding , the A-star search priorities are for and for the direct copy of . Thus even the expanded state sets differ.
For the third assertion, let the current nonterminal search node have finite remaining distance . The first transition of a least-cost continuation has some successor withEvery older entry in the search frontier has estimate at least , since the current entry was selected with minimum estimate. A newly generated successor with strictly smaller estimate therefore wins over every older entry. Whichever new successor is selected has smaller remaining distance than the current search node, so the argument repeats. Consequently the selected search nodes form one parent–child chain; include the selected goal, or append it if “expanded” excludes goal processing. This greedy perfect-heuristic descent does not imply least path cost, as the first counterexample demonstrates.
The zero-cost qualification is substantive. Give two successors of cost , add of cost , and add and of cost . The perfect heuristic has values at , at and at . Alphabetical priority ties let greedy best-first search select , which is not one graph path. Thus the unqualified third assertion requires a cost or tie convention absent from the printed text.
For the fourth assertion, a least remaining distance satisfieson every edge, by taking that edge and then a least-cost continuation. Thus is a consistent heuristic. The usual A-star search graph search finalizes each expanded state's least path cost and returns a least-cost goal.
For the fifth assertion, write . Before a goal is selected, an unexpanded prefix of an optimal graph path remains on the search frontier, with . A-star search therefore selects only search nodes with . Since ,This compares remaining cost, not search depth or accumulated path cost. The statement can fail with negative costs; those are outside the convention used here.
Past exam of the computer science course of the University of Oxford 2020 Artificial intelligence 1 a Solution by
Codex 0 2026-10-25
TODO: the classifications, chosen heuristic functions and least-cost outcomes for G1–G5 cannot be established from the corrupted original Figure 1. The missing edges, costs, priority labels and lower portions of the five search trees are required inputs. The surviving portions and the two heuristic function tables do not determine those answers. No reconstructed graph or invented expansion trace is assumed.
For a readable instance, depth-first search follows the deepest pending branch and breadth-first search expands by search depth; neither generally minimizes unequal edge costs. Uniform-cost search orders by path cost , whereas A-star search orders by . A displayed A-star search score would identify the estimate by subtracting the accumulated path cost. Under nonnegative costs and the usual terminating-search assumptions, uniform-cost search returns a least-cost goal state when testing goals on removal from the search frontier; A-star search additionally needs an admissible heuristic with appropriate reopening, or a consistent heuristic for the usual closed-set implementation. These rules explain how the missing information would be used, but cannot identify a particular damaged search tree.
Past exam of the computer science course of the University of Oxford 2019 Quantum information 3 f Solution by
Codex 0 2026-10-25
Use the Bernstein-Vazirani algorithm: initialize n qubits in , apply , query the supplied phase oracle once, apply again, and measure all n computational bits. Immediately after the query the state iswhere the dot product in the exponent is taken modulo two. The Walsh-Hadamard transform gives amplitudeEvery factor is one if and zero otherwise. Thus the final state is exactly , and the measurement outputs a with certainty after one oracle query. This is the character cancellation behind Bernstein-Vazirani phase kickback; because access here is already to the reduced phase oracle, no extra target ancilla or conversion from a bit-flip oracle is required.
Past exam of the computer science course of the University of Oxford 2019 Quantum information 3 e Solution by
Codex 0 2026-10-25
One Grover iteration returns a marked label with certainty. Prepare ; apply the supplied phase oracle to negate amplitudes on the marked inputs; apply the Grover diffusion operator ; and measure in the computational basis. If F prepares from , the reflection is , requiring no further oracle query.
After the oracle the amplitudes are on the unmarked labels and on the marked labels. Their average isThe reflection performs inversion about the mean, . It therefore sends every unmarked amplitude to zero and every marked amplitude to . The resulting normalized state isEach marked label has Born rule probability , every unmarked label has probability zero, and the marked probabilities sum to . This is one-step exact Grover search with a quarter of the inputs marked, using one reduced-oracle query. The positive integer N must be divisible by four; a qubit implementation may take , but the stated reflection proof does not assume that register convention.
Past exam of the computer science course of the University of Oxford 2019 Quantum information 3 d Solution by
Codex 0 2026-10-25
Let be the two output counts. Choose a known preparation unitary F with . The Deutsch-Jozsa algorithm applies the supplied phase oracle and then , declaring constant exactly for outcome 0. Its amplitude on that outcome isThis is the Deutsch-Jozsa test with an arbitrary uniform-state unitary. For , the usual preparation is ; the argument itself needs only a uniform preparation on the stated N-dimensional space.
For an actually constant-up-to-k function, the two counts are and , so the outcome-0 probability is . The error is returning the other label. ThereforeHere the possible count k is nonnegative, and the supplied bound implies . The error is consequently at most ; at it vanishes. This is the error conditional on the stated constant-up-to-k case, not an average over unspecified prior probabilities. For comparison, the printed balanced-up-to-k definition has count difference , so its outcome-0 probability would be , not the expression for the constant-up-to-k case. No change to that promise definition is made.
Past exam of the computer science course of the University of Oxford 2019 Quantum information 3 c Solution by
Codex 0 2026-10-25
By the spectral theorem, the nonscalar unitary V has orthonormal eigenvectors with distinct eigenvalues . Choose . Then is not proportional to .
On the product input , the controlled unitary gate producesIts two conditional target vectors are linearly independent, so the conditional-vector product-state criterion proves that the output is entangled. Equivalently, in the control computational basis and target eigenbasis its coefficient matrix is , whose determinant is . Thus U is an entangling gate. The excluded scalar case would only apply a phase gate to the control and could not entangle the factors; this is the controlled-unitary entangling criterion.
Past exam of the computer science course of the University of Oxford 2019 Quantum information 2 e Solution by
Codex 0 2026-10-25
For every nontrivial dimension , no such pure state exists. The literal claim needs this qualification: for , the only measurement outcome is necessarily the same for both parties. The contradiction below requires allowing all complex orthonormal bases, as quantum theory does.
If equal outcomes were certain in the computational basis, all amplitudes with different labels would vanish, so the normalized joint state would have the formChoose distinct labels and replace their computational vectors in both local bases by and , leaving all other vectors fixed. The joint amplitude for the different outcomes is . Certainty of equal outcomes would force .
Now use the complex pair and in the same way on both systems. The amplitude for different outcomes is , because the conjugated bra factors on the term multiply to . Thus equal outcomes would also force . Combining the two requirements gives . Every label belongs to such a pair when , forcing the zero vector and contradicting normalization. This proves impossibility of universal identical-basis perfect correlations.
The maximally entangled state is not a counterexample: it correlates matching labels when one party uses a basis and the other its coordinatewise complex conjugate basis. Requiring the two complex bases to be identical is different. This distinction also follows from conjugate-state steering from a maximally entangled pair; restricting attention to real bases would miss the contradiction.
There are unlisted articles, also show them or only show them.