Slide 14.31: Search (cont.)
Slide 14.33: Search (cont.)
Home

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 ).

Search Step V
Let us recall our program. It said that something was fun if it was red and a car or blue and a bike. Well, we couldn't find something that was both red and a car, so we now see if something blue and a bike. Let's recap the code:
   /* clause 1 */
   fun( X ) :-    /* we've tried this clause but without luck */
        red( X ),
        car( X ).

   /* clause 2 */
   fun( X ) :-   /* so lets have a go with this clause now */
        blue( X ),
        bike( X ).
Thus we will now try to prove that something is fun, by trying to find something that is blue, using the blue database:
   /* database of blue items */
   blue( flower_3 ).
   blue( glass_9 ).
   blue( honda_81 ).
In this case we now choose blue(flower_3).