Search (Cont.)


     fun( X ) :- red( X ),  car( X ).
     fun( X ) :- blue( X ), bike(X).
     red( apple_1 ).            /* database of red items */
     red( block_1 ).
     red( car_27 ).
     car( desoto_48 ).          /* database of cars */
     car( edsel_57 ).
     bike( iris_8 ). 
     bike( my_bike ). 
     bike( honda_81 ).

Search Step VI
We now have to prove the goal bike(flower_3) against our bike database as above. This again must fail, since flower_3 does not match against iris_8, my_bike, or honda_81. So as before, we must backtrack and find an alternate blue item. Recall our database:
     blue( flower_3 ).
     blue( glass_9 ).
     blue( honda_81 ).
We have tried flower_3 without luck, so next we try the second blue fact, blue(glass_9).
  1. We now try goal bike(glass_9). Again this fails to unify.

  2. As a result we must go back yet again and find another blue object. This time we will use the third clause of blue, blue(honda_81).

  3. The goal bike(honda_81) matches the clause three!.
So at last we have found something which is blue and a bike. As a result we can now conclude that it is fun, Prolog then displays the following:
     ?- fun( What ).
     What=honda_81
     yes