Go up to 1 Defining a Simple Relation
Solution to the happy question
The simplest solution is:
Alternatively, the last two clauses could be replaced by:
happy(P,D) <- student(P) & holiday(D).
happy(P,D) <- teaching(P,C) & midterm(C,D).
This is probably better as there may be many different Tuesdays that
we would want to consider as a Tuesday. We probaly don't want to do
the same thing for the constant david, as we mean a particular
David, not just anyone called David.
happy(david,D) <- tuesday(D).
happy(david,D) <- sunday(D).
material, ©David Poole, Alan Mackworth and Randy Goebel, 1999