/* Very partial family relation program, as discussed in 2004-04-27 class */
father(alberto, marco).
father(marco, dante).
father(marco, clara).

is_father(X) :- father(X,Y).

/* A few other relations that you do not need for the 2004 take home! */
% del( Element, List1, List2) if List2 is List1 with one occurrence of
% Element deleted

del( X,[X|T],T).
del( X,[Y|T1],[Y|T2]) :- del( X,T1,T2).

sort1( X,Y) :- permutation( X,Y), sorted(Y).

sorted( []).
sorted( [_]).
sorted( [X | [Y | Ys]]) :- X =< Y, sorted( [Y|Ys]). 

permutation( [],[]).
permutation( X,[Y|Ys]) :- del(Y,X,Z), permutation(Z,Ys).
