Closed Book Examination COMP60121 Appendix: definition sheet (3 pages) Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE M.Sc. in Advanced Computer Science Automated Reasoning Tuesday 27 th January 2009 Time: 09:45 11:45 Please answer THREE out of FOUR Questions provided [PTO]
Page 2 of 4 COMP60121 1. a) Consider the signature consisting of a constant a, unary function symbols f and unary predicate symbol p. To avoid writing too many parentheses we will write applications of f without them, for example, f f x means f (f (x)). For each of the following formulas, find a Herbrand interpretation in which this formula is false. i) ( x)(p(x) p(f x)) ( x)p(x) (3 marks) ii) p(a) ( x)(p(x) (p(f x) p(f f x))) p(f f f f a)). (5 marks) b) Consider the clause p(x, f (y)) p( f(y), x) p(f(z), g(z)) in which all literals are selected. Write down all possible factors of this clause (i.e., clauses obtained by applying the factoring rule to this clause). (5 marks) c) Transform the formula ( y)( x)(p(x, y) ( x)p(x, y)) into negation normal form. (4 marks) d) Consider an inference process with deletion: S 0 S 1 S 2 Write the definitions of persistent clause and limit for this process. (3 marks) 2. a) Write Prolog programs defining i) The list concatenation. The concatenation of two lists a 1,..., a m and b 1,..., b n gives the list a 1,..., a m, b 1,..., b n. (2 marks) ii) The list reversal. The reversal of a 1,..., a m gives a m,..., a 1. (4 marks) b) Transform the formula (p (q r)) ( q s) into a set of clauses using the CNF transformation. (4 marks) c) Consider the formula ( x)(p(x) ( x)p(x)). Is this formula valid or not? If it is valid, explain why. If it is not, show a structure in which this formula is false. (6 marks) d) Apply the unification algorithm to i) The pair of terms h(z, f(x), x) and h(f(y), y, f(z)). (2 marks) ii) The pair of terms h(g(y, y)) and h(g(f(x), z)). (2 marks) If any of these pairs is unifiable, give a most general unifier.
Page 3 of 4 COMP60121 3. Orderings, model construction, application a) Let N be the set of these clauses. 1. P3 P3 P 2. P2 P5 3. P3 P5 4. P2 P4 5. P4 6. P P 1 2 2 i) Let the ordering on atoms be defined by P1 P2 P3 P4 P5. Sort the clauses in N with respect to C. (2 marks) ii) Compute the candidate model I N for N as described in Part II of the lectures. Is it a model of N? (5 marks) iii) Explain the role the candidate model I N plays in proving refutational completeness of resolution. (3 marks) b) By definition, any clause which contains at most one positive literal is called a Horn clause. i) For each of the following clauses say whether they are Horn clauses or are not? Give a short reason for each of your answers. (5 marks) A. P(x) P(g(a)) Q( b, x) B. P(x) Q( b,x) R( b) C. Q( b,x) R( b) D. Q( b,x) E. Px ( ) ii) iii) Show that the resolvent of any two Horn clauses is a Horn clause. (3 marks) Resolution without factoring is generally (refutationally) incomplete. Show that factoring on sets of Horn clauses is not needed, i.e. resolution alone suffices for completeness on sets of Horn clauses. (2 marks) [PTO]
Page 4 of 4 COMP60121 4. Redundancy, ordering & selection, ordered resolution a) Briefly explain the purpose of the notion of redundancy. Give two examples of instances of redundancy to illustrate your answer. (6 marks) b) Briefly explain the purpose of the ordering and the selection function in Res s. Give two advantages of orderings and a selection function. (4 marks) c) Let be a total and well-founded ordering on ground atoms such that, if the atom A contains more symbols than B, then A B. Let N be the following set of clauses: px ( ) p( f( x)) py ( ) pf ( ( f( y ))) Use Res s to derive from N, where S is the empty selection function. Justify each step in your derivation. (10 marks) END OF EXAMINATION Appendix: definition sheet (3 pages)
COMP60121: Part II, Definition Sheet for Examination 2008/2009 Orderings. Let (X, ) be an ordering. The multi-set extension ordering mul on (finite) multi-sets over X is defined by S 1 mul S 2 iff S 1 S 2 and x X, if S 2 (x) > S 1 (x) then y X : y x and S 1 (y) > S 2 (y) Suppose is a total and well-founded ordering on ground atoms. L denotes the ordering on ground literals and is defined by: [ ]A L [ ]B, if A B A L A C denotes the ordering on ground clauses and is defined by the multi-set extension of L, i.e. C = ( L ) mul. Maximal literals. Let be a total and well-founded ordering on ground atoms. A ground literal L is called [strictly] maximal wrt. a ground clause C iff for all L in C: L L [L L ]. A non-ground literal L is [strictly] maximal wrt. a (ground or non-ground) clause C iff there exists a ground substitution σ such that for all L in C: Lσ L σ [Lσ L σ]. Herbrand models. The Herbrand universe (over Σ), denoted T Σ, is the set of all ground terms over Σ. A Herbrand interpretation (over Σ), denoted I, is a set of ground atoms over Σ. Truth in I of ground formulae is defined inductively by: I = I = I = A iff A I, for any ground atom A I = F iff I = F I = F G iff I = F and I = G I = F G iff I = F or I = G Truth in I of any quantifier-free formula F with free variables x 1,...,x n is defined by: I = F(x 1,...,x n ) iff I = F(t 1,...,t n ), for every t i T Σ Truth in I of any set N of clauses is defined by: I = N iff I = C, for each C N October 2008 1 University of Manchester
COMP60121: Part II, Definition Sheet for Examination 2008/2009 Construction of candidate models. Let N, be given. For all ground clauses C over the given signature, the sets I C and C are inductively defined with respect to the clause ordering by: I C := C D D {A}, if C N, C = C A, A C C := and I C = C, otherwise We say that C produces A, if C = {A}. The candidate model for N (wrt. ) is given as I N := C N We also simply write I N, or I, for IN, if is either irrelevant or known from the context. C. Ordered resolution with selection calculus Res S. Let be an atom ordering and S a selection function. (Ordered resolution with selection rule) provided σ = mgu(a, B) and C A B D (C D)σ (i) Aσ strictly maximal wrt. Cσ; (ii) nothing is selected in C by S; (iii) either B is selected, or else nothing is selected in B D and Bσ is maximal wrt. Dσ. (Ordered factoring rule) provided σ = mgu(a, B) and C A B (C A)σ (i) Aσ is maximal wrt. Cσ and (ii) nothing is selected in C. October 2008 2 University of Manchester
COMP60121: Part II, Definition Sheet for Examination 2008/2009 Hyperresolution calculus HRes. (Ordered hyperresolution rule) C 1 A 1... C n A n B 1... B n D (C 1... C n D)σ provided σ is the mgu s.t. A 1 σ = B 1 σ,..., A n σ = B n σ, and (i) A i σ strictly maximal in C i σ, 1 i n; (ii) nothing is selected in C i (i.e. C i is positive); (iii) the indicated B i are exactly the ones selected by S, and D is positive. (Ordered factoring rule) provided σ = mgu(a, B) and C A B (C A)σ (i) Aσ is maximal wrt. Cσ and (ii) nothing is selected in C. Redundancy. Let N be a set of ground clauses and C a ground clause. C is called redundant wrt. N, if there exist C 1,..., C n N, n 0, such that (i) all C i C, and (ii) C 1,..., C n = C. A general clause C is called redundant wrt. N, if all ground instances Cσ of C are redundant wrt. G Σ (N). N is called saturated up to redundancy (wrt. Res S ) iff every conclusion of an Res S-inference with non-redundant clauses in N is in N or is redundant (i.e. Res S (N \ Red(N)) N Red(N), where Red(N) denotes the set of clauses redundant wrt. N). October 2008 3 University of Manchester