Slide 14.31: Search (cont.) Slide 14.33: Search (cont.) Home |
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 ).
/* 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)
.