I have to write the statement apple implies red or green in my prolog program. Here is a sample of the code I implemented:
:-dynamic(red/1).
:-dynamic(green/1).
apple(a).
apple(b).
apple(A):-red(A);green(A).
My problem is that ?- red(a)
and ?-green(a)
should return false because this is not a given fact I place them as dynamic and now ?-red(a)
and ?-green(a)
do return false.
However red(A);green(A).
should return true because an apple is either red OR green
Thank for your responses: however me whole problem is that ?-red(a) and green(a) are both surpose to return false when ran separately. while ?-red(a);green(a) should return true. This is where I'm lost. If you have any suggestion on how to get there result the will be greatly welcomed.