Computational Logic General Game PlayingLecture 4 Michael Genesereth / Nat Love Spring 2006.

Slides:



Advertisements
Similar presentations
Some Prolog Prolog is a logic programming language
Advertisements

Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
AR for Horn clause logic Introducing: Unification.
Standard Logical Equivalences
Resolution.
Automated Reasoning Systems For first order Predicate Logic.
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
CSC 685 Logic Review. Logic: Modeling Human Reasoning syllogistic logic Syllogistic Logic (Aristotle). all/some X are/not Y Propositional Logic (Boole).
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Cs774 (Prasad)L7Negation1 Negation by Failure
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Inference and Resolution for Problem Solving
Catriel Beeri Pls/Winter 2004/5 type reconstruction 1 Type Reconstruction & Parametric Polymorphism  Introduction  Unification and type reconstruction.
CSE (c) S. Tanimoto, 2007 Unification 1 Unification Predicate calculus rules are sometimes so general that we need to create specializations of.
Logic Programming Part 2: Semantics James Cheney CS 411.
0 1 Todays Topics Resolution – top down and bottom up j-DREW BU procedure Subsumption – change to procedure Infinite Loops RuleML input – Prolog output.
PLANNING Partial order regression planning Temporal representation 1 Deductive planning in Logic Temporal representation 2.
The Foundations: Logic and Proofs
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
14/10/04 AIPP Lecture 7: The Cut1 Controlling Backtracking: The Cut Artificial Intelligence Programming in Prolog Lecturer: Tim Smith Lecture 7 14/10/04.
Logical Inference 2 rule based reasoning
First Order Predicate Logic
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Unification We can represent any substitution by a set of ordered pairs: s = { t 1 /v 1, t 2 /v 2, …, t n /v n } where: t i /v i means that the term i.
The AI War LISP and Prolog Basic Concepts of Logic Programming
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
1 Logic Programming Robert Kowalski’s equation: Algorithm = Logic + Control Definite logic program: A  B 1, B 2, …, B m (program clause) headbody  A.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Procedural Semantics Soundness of SLD-Resolution.
Automated Reasoning Systems For first order Predicate Logic.
1 Section 9.1 Automatic Reasoning Recall that a wff W is valid iff ¬ W is unsatisfiable. Resolution is an inference rule used to prove unsatisfiability.
CSE (c) S. Tanimoto, 2008 Predicate Calculus II 1 Predicate Calculus 2 Outline: Unification: definitions, algorithm Formal interpretations and satisfiability.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Resolution Preliminaries Computational LogicLecture 9 By Prof. Michael Genesereth, Computer Science, Stanford Univ Spring 2005 Modified by Charles Ling.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Converting arbitrary wffs to CNF A wff is in prenex form iff it consists of a string of quantifiers (called a prefix) followed by a quantifier free formula.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
O A procedure: a set of axioms (rules and facts) with identical signature (predicate symbol and arity). o A logic program: a set of procedures (predicates),
Automated Reasoning General Game PlayingLecture 3 Michael Genesereth Spring 2005.
CS5205: Foundation in Programming Languages Type Reconstruction
Horn Clauses and Unification
Prolog syntax + Unification
Soundness of SLD-Resolution
Horn Clauses and Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2004 Unification
CSE S. Tanimoto Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2002 Unification
Horn Clauses and Unification
Predicates and Quantifiers
Resolution Theorem Proving
Soundness of SLD-Resolution
Resolution Preliminaries
Presentation transcript:

Computational Logic General Game PlayingLecture 4 Michael Genesereth / Nat Love Spring 2006

2 Approaches to General Game Playing Logic - use logical reasoning for everything Computing roles Computing initial state Computing legality of moves Computing consequences of actions Computing goal achievement Computing termination Other - Convert to other representations Simplicity of logical formulation Simple, widely published algorithms

3 State Representation true(cell(1,1,x)) true(cell(1,2,b)) true(cell(1,3,b)) true(cell(2,1,b)) true(cell(2,2,o)) true(cell(2,3,b)) true(cell(3,1,b)) true(cell(3,2,b)) true(cell(3,3,x)) true(control(o))

4 Getting Started Initial State:Current State: init(cell(1,1,b)) true(cell(1,1,b)) init(cell(1,2,b)) true(cell(1,2,b)) init(cell(1,3,b)) true(cell(1,3,b)) init(cell(2,1,b)) true(cell(2,1,b)) init(cell(2,2,b)) true(cell(2,2,b)) init(cell(2,3,b)) true(cell(2,3,b)) init(cell(3,1,b)) true(cell(3,1,b)) init(cell(3,2,b)) true(cell(3,2,b)) init(cell(3,3,b)) true(cell(3,3,b)) init(control(x)) true(control(x))

5 Simulation (Step 1) Current State:Next in Current State: true(cell(1,1,x)) next(cell(1,1,x)) true(cell(1,2,b)) next(cell(1,2,b)) true(cell(1,3,b)) next(cell(1,3,o)) true(cell(2,1,b)) next(cell(2,1,b)) true(cell(2,2,o)) next(cell(2,2,o)) true(cell(2,3,b)) next(cell(2,3,b)) true(cell(3,1,b)) next(cell(3,1,b)) true(cell(3,2,b)) next(cell(3,2,b)) true(cell(3,3,x)) next(cell(3,3,x)) true(control(o)) next(control(x)) Latest moves: does(x,noop) does(o,mark(1,3))

6 Simulation (Step 2) Next in Previous State:New Current State: next(cell(1,1,x)) true(cell(1,1,x)) next(cell(1,2,b)) true(cell(1,2,b)) next(cell(1,3,o)) true(cell(1,3,o)) next(cell(2,1,b)) true(cell(2,1,b)) next(cell(2,2,o)) true(cell(2,2,o)) next(cell(2,3,b)) true(cell(2,3,b)) next(cell(3,1,b)) true(cell(3,1,b)) next(cell(3,2,b)) true(cell(3,2,b)) next(cell(3,3,x)) true(cell(3,3,x)) next(control(x)) true(control(x))

7 Legality Current State:Legality: true(cell(1,1,x)) legal(x,noop) true(cell(1,2,b)) true(cell(1,3,b)) legal(o,mark(1,2)) true(cell(2,1,b)) legal(o,mark(1,3)) true(cell(2,2,o)) legal(o,mark(2,1)) true(cell(2,3,b)) legal(o,mark(2,3)) true(cell(3,1,b)) legal(o,mark(3,1)) true(cell(3,2,b)) legal(o,mark(3,2)) true(cell(3,3,x)) true(control(o))

8 Goals and Termination Current State:Goals: true(cell(1,1,x)) goal(x,0) true(cell(1,2,o)) goal(o,100) true(cell(1,3,b)) true(cell(2,1,b)) Termination: true(cell(2,2,o)) terminal true(cell(2,3,x)) true(cell(3,1,b)) true(cell(3,2,o)) true(cell(3,3,x)) true(control(x))

9 Game Descriptions Defnitions for Universal Intensional Relations: role(player) init(proposition) Intensional Relations defined using true and does : next(proposition) Intensional Relations defined in terms of true : legal(player,action) goal(proposition,score) terminal

10 Abstract Example of Inference Data: m(a,b) n(b,b) n(b,c) Rules: p(X,Z) :- m(X,Y) & n(Y,Z) q(Z) :- p(X,Z) & ~n(Z,Z) Results: p(a,b) p(a,c) q(c)

11 Ground Reduction

12 Example Data: m(a,b) n(b,b) n(b,c) Rules: p(a,c) :- m(a,c) p(a,c) :- m(a,b) & n(b,c) q(c) :- p(a,c) & ~n(c,c) Results: q(c)

13 Ground Reduction (Part 1) All problems are treated as conjunctions consisting of zero or more conjuncts. Basic Loop: Remove first conjunct from conjunction and replace by its reduction (another conjunction of zero or more conjuncts). If there is no reduction, fail. Succeed when there are no conjuncts left.

14 Ground Reduction (Part 2) Atomic Sentences with Extensional Relations If sentence is true is in the database, reduction is the empty conjunction Atomic Sentences with Intensional Relations For each rule with the first conjunct as head, remove conjunct, replace by body of rule, and loop. Goal: p(a,c) & ~n(c,c) Rule: p(a,c) :- m(a,b) & n(b,c) Reduction: m(a,b) & n(b,c) & ~n(c,c)

15 Ground Reduction (Part 3) Disjunctions multiple reductions, one for each disjunct Goal: ( p(a,c) | q(a,c)) & ~n(c,c) Reduction: p(a,c) & ~n(c,c) Reduction: q(a,c) & ~n(c,c) Negations (Negation as Failure) Try to prove the embedded sentence If succeed, negation is false, i.e. no reduction. If fail, reduction is the empty conjunction.

16 Example Data: Rules: m(a,b) p(a,c) :- m(a,c) n(b,b) p(a,c) :- m(a,b) & n(b,c) n(b,c) q(c) :- p(a,c) & ~n(c,c) Call: q(c) Call: p(a,c) & ~n(c,c) Call: m(a,c) & ~n(c,c) Fail Call: m(a,b) & n(b,c) & ~n(c,c) Call: n(b,c) & ~n(c,c) Call: ~n(c,c) Call: n(c,c) Fail Exit …

17 General Reduction

18 Example Data: m(a,b) n(b,b) n(b,c) Rules: p(X,Z) :- m(X,Y) & n(Y,Z) q(Z) :- p(X,Z) & ~n(Z,Z) Question: Is q(c) true?

19 General Reduction Goal: p(a,Y) & q(Y,Z) Rule: p(X,b) :- m(X) & n(X) Reduction: m(a) & n(a) & q(b,Z)

20 Substititions A substitution is a finite set of pairs of variables and terms, called replacements. {X  a, Y  f(b), V  W} The result of applying a substitution  to an expression  is the expression  obtained from  by replacing every occurrence of every variable in the substitution by its replacement. p(X,X,Y,Z){X  a,Y  f(b),V  W}=p(a,a,f(b),Z)

21 Unification A substitution  is a unifier for an expression  and an expression  if and only if  = . p(X,Y) {X  a,Y  b,V  b} = p(a,b) p(a,V) {X  a,Y  b,V  b} = p(a,b) If two expressions have a unifier, they are said to be unifiable. Otherwise, they are nonunifiable. p(X,X) p(a,b)

22 Non-Uniqueness of Unification Unifier 1: p(X,Y){X  a,Y  b,V  b} = p(a,b) p(a,V){X  a,Y  b,V  b} = p(a,b) Unifier 2: p(X,Y){X  a,Y  f(W),V  f(W)} = p(a,f(W)) p(a,V){X  a,Y  f(W),V  f(W)} = p(a,f(W)) Unifier 3: p(X,Y){X  a,Y  V} = p(a,V) p(a,V){X  a,Y  V} = p(a,V)

23 Most General Unifier A substitution  is a most general unifier (mgu) of two expressions if and only if it is as general as or more general than any other unifier. Theorem: If two expressions are unifiable, then they have an mgu that is unique up to variable permutation. p(X,Y){X  a,Y  V} = p(a,V) p(a,V){X  a,Y  V} = p(a,V) p(X,Y){X  a,V  Y} = p(a,Y) p(a,V){X  a,V  Y} = p(a,Y)

24 Example Call: mgu( p(X,b), p(a,Y), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, a, {} ) Exit: {X  a} Call: mgu( b, Y, {X  a} ) Exit: {Y  b,X  a}

25 Example Call: mgu( p(X,X), p(a,b), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, a, {} ) Exit: {X  a} Call: mgu( X, b, {X  a} ) Call: mgu( a, b, {X  a} ) Exit: nil

26 Example Call: mgu( p(f(X),f(X)), p(Y,f(a)), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( f(X), Y, {} ) Exit: {Y  f(X)} Call: mgu( f(X), f(a), {Y  f(X)} ) Call: mgu( f, f, {Y  f(X)} ) Exit: {Y  f(X)} Call: mgu( X, a, {Y  f(X)} ) Exit: {X  a,Y  f(X)}

27 Example Call: mgu( p(X,X), p(Y,f(Y)), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, Y, {} ) Exit: {X  Y} Call: mgu( X, f(Y), {X  Y} ) Call: mgu( Y, f(Y), {X  Y} ) Exit: nil

28 General Reduction Example Data:Rules: m(a,b) p(X,Z) :- m(X,Y) & n(Y,Z) n(b,c) q(V) :- p(U,V) n(b,d) Call: q(c) {} Call: p(U,c) {V  c} Call: m(U,Y) & n(Y,c){V  c,X  U,Z  c} Call: n(b,c) {V  c,X  U,Z  c,U  a,Y  b} Exit: n(b,c) {V  c,X  U,Z  c,U  a,Y  b} Exit: m(a,b) & n(b,c){V  c,X  U,Z  c,U  a,Y  b} Exit: p(a,c) {V  c,X  U,Z  c,U  a,Y  b} Exit: q(c) {V  c,X  U,Z  c,U  a,Y  b}

29 Answer Extraction

30 Example Data: m(a,b) n(b,b) n(b,c) Rules: p(X,Z) :- m(X,Y) & n(Y,Z) q(Z) :- p(X,Z) & ~n(Z,Z) Question: Find all X such that q(X) true. (GGP version: Find all P such that next(P) true.)

31 Answer Extraction Set up the target pattern and a list of answers as global variables. Pattern: X Answers: {c, d} Each time the goal is proved with a different variable binding, compute a new answer by substituting the current binding list into the target pattern and then add the result to the answers list.

32 Example Data:Rules: m(a,b) p(X,Z) :- m(X,Y) & n(Y,Z) n(b,c) q(V) :- p(U,V) n(b,d) Call: q(W) {} Call: p(U,W) {V  W} Call: m(U,Y) & n(Y,W){V  W,X  U,Z  W} Call: n(b,W) {V  W,X  U,Z  W,U  a,Y  b} Exit: n(b,c) {V  W,X  U,Z  W,U  a,Y  b,W  c} c Redo: n(b,W) {V  W,X  U,Z  W,U  a,Y  b} Exit: n(b,W) {V  W,X  U,Z  W,U  a,Y  b,W  d} d Redo: n(b,W) Fail: n(b,W) Fail: m(U,Y) & n(Y,W) Fail: p(U,W) Fail: q(W)

33 More Tedious Details

34 Note Initial State Version 1: init(cell(1,1,b)) init(cell(1,2,b)) init(cell(1,3,b)) init(cell(2,1,b)) init(cell(2,2,b)) init(cell(2,3,b)) init(cell(3,1,b)) init(cell(3,2,b)) init(cell(3,3,b)) Initial State Version 2: init(cell(X,Y,b)) :- d(X) & d(Y) d(1) d(2) d(3)

35 Note This is the top-down method of deduction. There is also a bottom-up method that works from data to deduce answers “level by level”. Top-down is goal-oriented, does not expend energy on deductions unrelated to the goal. It has two serious disadvantages: redundant computation and the possibility of infinite loops. Bottom-up fixes these two problems but can waste energy on deducing things unrelated to the goal. Magic sets fixes this but it is very complicated.

36 Unification

37 Most General Unification function mgu (x, y, al) {if x = y then al else if varp(x) then mguvar(x, y, al) else if atom(x) then {if varp(y) then mguvar(y, x, al) else if atom(y) then if x = y} else if varp(y) then mguvar(y, x, al) else if atom(y) then nil else if al  mgu(car(x),car(y), al) then mgu(cdr(x), cdr(y),al)}

38 Most General Unification (concluded) function mguindvar (x, y, al) {var dum; if dum  assoc(x, al) then mgu(right(dum), y, al) else if cons(x  y, al)}

39 Problem ~hates(X,X) hates(Y,f(Y))

40 Solution Before assigning a variable to an expression, first check that the variable does not occur within that expression. This is called, oddly enough, the occur check test. Prolog does not do the occur check (and is proud of it).

41 Most General Unification (continued) function mguindvar (x, y, al) {var dum; if dum  assoc(x, al) then mgu(right(dum), y, al) else if mguchkp(x, y, al) then nil else if cons(x  y, al)} function mguchkp (p, q, al) {if p=q then true else if varp(p) then mguchkp(p,right(assoc(q,al)),al) else if atom(q) then false else some(lambda(x).mguchkp(p,x,al),q)}

42 Evaluation

43 Evaluation Subroutines Database: Call: theory Exit: {m(a,b),n(b,c),n(b,d)} Subroutines: Call: truep( m(X,Y)&n(Y,Z), theory) Exit: true Call: truex( Z, m(X,Y)&n(Y,Z), theory) Exit: c Call: trues( Z, m(X,Y)&n(Y,Z), theory) Exit: {c,d}

44 Evaluation var thing var theory var answers function trues (thing, p, theory) {var answers  nil; eval(p, nil, {} ); reverse(remove-duplicates(answers))} function eval(p, pl, al) {if atom(p) then evalrs(p, pl, al) else if car(p) = not then evalnot(p, pl, al) else if car(p) = and then eval(cadr(p),append(cddr(p), pl), al) else evalrs(p, pl, al)}

45 Evaluation (continued) function evalnot (p, pl, al) {if not eval(cadr(p), nil, al) then evalexit(pl, al)} function evalrs (p, pl, al) {var fact; var bl; for x in theory do if bl  mguexp(p, x, al) then evalexit(pl, bl)} function evalexit (pl, al) {if pl then eval(car(pl), cdr(pl), al) else answers  cons(plug(thing, al), answers)}

46 Example Call: trues( Z, m(X,Y)&n(Y,Z), {m(a,b),n(b,c),n(b,d)} ) Call: eval( m(X,Y)&n(Y,Z), nil, {} ) … Exit: nil answers = {d,c} Call: remove-duplicates( {d,c} ) Exit: {d,c} Call: nreverse( {d,c} ) Exit: {c,d}

47 Example (continued) Call: eval( m(X,Y)&n(Y,Z), nil, {} ) Call: evaland( m(X,Y)&n(Y,Z), nil, {} ) Call: eval( m(X,Y), [n(Y,Z)], {} ) … Exit: nil answers = {d,c}

48 Example (continued) Call: eval( m(X,Y), [n(Y,Z)], {} ) Call: evalrs( m(X,Y), [n(Y,Z)], {} ) Call: mguexp( m(X,Y), m(a,b), {} ) Exit: {Y  b,X  a} Call: evalexit( [n(Y,Z)], {Y  b,X  a} ) … Exit: nil answers = {d,c} Call: mguexp( m(X,Y), n(b,c), {} ) Exit: nil Call: mguexp( m(X,Y), n(b,d), {} ) Exit: nil Exit: nil answers = {d,c}

49 Example (continued) Call: eval( n(Y,Z), nil, {Y  b,X  a} ) Call: evalrs( n(Y,Z), nil, {Y  b,X  a} ) Call: mguexp( n(Y,Z), m(a,b), {Y  b,X  a} ) Exit: nil Call: mguexp( n(Y,Z), n(b,c), {Y  b,X  a} ) Exit: {Z  c,Y  b,X  a} Call: evalexit( nil, {Z  c,Y  b,X  a} ) Exit: nil answers = {c} Call: mguexp( n(Y,Z), n(b,d), {Y  b,X  a} ) Exit: {Z  d,Y  b,X  a} Call: evalexit( nil, {Z  d,Y  b,X  a} ) Exit: nil answers = {d,c}

50 Deduction

51 Reasoning Subroutines Database: Call: theory Exit: {m(a,b), m(b,c), p(W) <= m(W,X)} Subroutines: Call: findp( p(X), theory) Exit: true Call: findx( W, p(X), theory) Exit: a Call: finds( W, p(X), theory) Exit: {a,b}

52 Backward Chaining var thing var theory var answers function finds (thing, p, theory) {var answers  nil; chain(p, nil, {} ); nreverse(remove-duplicates(answers))} function chain(p, pl, al) {if atom(p) then chainrs(p, pl, al) else if car(p) = not then chainnot(p, pl, al) else if car(p) = and then chain(cadr(p),append(cddr(p), pl), al) else chainrs(p, pl, al)}

53 Backward Chaining (continued) function chainnot (p, pl, al) {if not chain(cadr(p), nil, al) then chainexit(pl, al)} function chainrs (p, pl, al) {var rule; var bl; for x in theory do {rule  stdize(x) if bl  mguexp(p, rule, al) then chainexit(pl, bl) else if bl  mguexp(p, cadr(rule), al) then chain(caddr(rule), append (cdddr(rule),pl),bl)} function chainexit (pl, al) {if pl then chain(car(pl), cdr(pl), al) else answers  cons(plug(thing, al), answers)}

54 Example Call: trues( W, p(W), {m(a,b),m(b,c),p(W)<=m(W,X)} ) Call: chain( p(W), nil, {} ) … Exit: nil answers = {b,a} Call: remove-duplicates( {b,a} ) Exit: {b,a} Call: nreverse( {b,a} ) Exit: {a,b}

55 Example (continued) Call: chain( p(X), nil, {} ) Call: chainrs( p(X), nil, {} ) Call: mguexp( p(X), m(a,b), {} ) Exit: nil Call: mguexp( p(X), p(WW), {} ) Exit: {X  W} Call: chain( m(WW,XX), {X  WW} ) Call: mguexp( m(WW,XX), m(a,b), {X  WW} ) Exit: {WW  a,XX  b,X  WW} Call: mguexp( m(WW,XX), m(a,b), {X  WW} ) Exit: {WW  b,XX  c,X  WW} Exit: nil answers = {b,a}

56