

/*
The lion lies on mondays, tuesdays and wednesdays and tells the truth
the other days.

The unicorn lies on thursdays, fridays and saturdays and tells the truth
the other days.

Lion: 		yesterday was one of my lying days
Unicorn: 	yesterday was one of my lying days

Whay day is it?
*/


%precedence( [yes,mon,tues,wes,thurs,fri,sat,sun,lion,unicorn] ).
predicates( [ll,lu,day,lies,crea,we,th,fr,mo,tu,sa,su] ).
%first_predicate_precedence( [lies,ll,lu,day,crea,we,th,fr,mo,tu,sa,su] ).
%first_predicate_precedence( [lies,day,crea,ll,lu,we,th,fr,mo,tu,sa,su] ).

mo(mon).
tu(tues).
we(wes).
th(thurs).
fr(fri).
sa(sat).
su(sun).

mo(X1) -> ll(X1).
tu(X2) -> ll(X2).
we(X3) -> ll(X3).
th(X4), ll(X4) -> [].
fr(X5), ll(X5) -> [].
sa(X6), ll(X6) -> [].
su(X7), ll(X7) -> [].

mo(X1), lu(X1) -> [].
tu(X2), lu(X2) -> [].
we(X3), lu(X3) -> [].
th(X4) -> lu(X4).
fr(X5) -> lu(X5).
sa(X6) -> lu(X6).
su(X7),lu(X7) -> [].

mo(X1) -> day(X1).
tu(X2) -> day(X2).
we(X3) -> day(X3).
th(X4) -> day(X4).
fr(X5) -> day(X5).
sa(X6) -> day(X6).
su(X7) -> day(X7).

ll(X) -> day(X).
lu(Y) -> day(Y).

crea(lion).
crea(unicorn).

mo(X1) -> su(yes(X1)).
tu(X2) -> mo(yes(X2)).
we(X3) -> tu(yes(X3)).
th(X4) -> we(yes(X4)).
fr(X5) -> th(yes(X5)).
sa(X6) -> fr(yes(X6)).
su(X7) -> sa(yes(X7)).

day(X),day(Y),lies(lion,X,Y) -> ll(X),ll(Y).
day(X),ll(Y),day(Y) -> ll(X), lies(lion,X,Y).
day(X),day(Y),ll(X),lies(lion,X,Y),ll(Y) -> [].
day(X),day(Y),ll(X) -> lies(lion,X,Y),ll(Y).

day(X),day(Y),lies(unicorn,X,Y) -> lu(X),lu(Y).
day(X),day(Y),lu(Y) -> lu(X),lies(unicorn,X,Y) .
day(X),day(Y),lu(X),lies(unicorn,X,Y),lu(Y) -> [].
day(X),day(Y),lu(X) -> lies(unicorn,X,Y),lu(Y).




