% mprtest.pl -- test file for MPR

parent(adam,able) if true.
parent(adam,cain) if true.
parent(eve,able) if true.
parent(eve,cain) if true.
male(adam) if true.
female(eve) if true.
father(X,Y) if parent(X,Y) and male(X).
mother(X,Y) if parent(X,Y) and female(X).
sibling(X,Y) if
  ~(X=Y) and
  father(Pa,X) and
  father(Pa,Y) and
  mother(Ma,X) and
  mother(Ma,Y).

%% control knowledge...

% prefer trivial goals to anything.
prefer(true,_) :- !.
prefer(false,_) :- !.

% postpone negated goals with variables!
prefer(_,~(P)) :- \+(ground(P)), !.

% prefer simple goals to compound ones.
prefer(P,Q) :-
  \+(compoundGoal(P)),
  compoundGoal(Q).

compoundGoal((_ and _)).
compoundGoal((_ or _)).


%% these are for testing...

prefer(a,b).
prefer(b,c).
prefer(c,d).

a.
b.
c.
d.
