1.pl
3.pl
4.pl
5.pl
eats(Person, Thing) :- likes(Person, Thing); hungry(Person), edible(Thing).
likes(bob, chocolate).
test_answer :- eats(bob, chocolate),
write(‘Bob eats chocolate.’).
test_answer :- write(‘Wrong answer!’).
reflection(point(Xa, Ya), point(Xb, Yb)) :-
=(Xa, Yb), =(Ya, Xb).
test_answer :-
reflection(point(-5, 8), point(X, Y)),
write(point(X, Y)),
halt.
test_answer :- write(‘Wrong answer!’),
halt.
f(a).
f(b).
f(c).
g(b).
g(c).
h(c).
k(X):-f(X), g(X), h(X).
Search Tree
f(a), g(a) –> fail
f(b), g(b), h(b) –> fail
f(c), g(c), h(c) –> success
is_hard(Lense) -: = (Lense, hard_lense).
/* tear rate related clauses */
normal_tear_rate(RATE) :- RATE >= 5.
low_tear_rate(RATE) :- RATE < 5.
/* age-related clauses */
young(AGE) :- AGE < 45.
diagnosis(Recommend, Age, Astigmatic, Tear_Rate) -: true