Professional Documents
Culture Documents
Step 1. Code the following knowledge base about local restaurants in Prolog:
serves predicate:
Note: There are two ways in which you can define a predicate such as serves. One on hand, you
can enumerate each relationship:
serves(american, salad).
serves(american, steak).
serves(american, sandwiches).
A more concise way is to use lists in an auxiliary predicate, in conjunction with the built-in
member predicate which enumerates the relationships.
vegetarian dishes:
beans, bagan_bharta, enchiladas, falafel, hummus,
pizza, salad, soup, tempura, onion_rings, and all starch dishes
meat dishes:
burgers, enchiladas, gyros, pad_thai, pizza, steak, sandwiches,
fried_chicken, tacos, tandoori, larb
seafood dishes:
snapper, cioppino, sashimi, shrimp, clams, fish_tacos, tempura
starch dishes:
naan, papadam, bread, rice, noodles, pita, garlic_bread, pasta, fries
Use single Prolog queries to answer the following questions. In some cases, you may find it
helpful to define auxiliary predicates to assist.
Harder (Optional)
10. Which areas have more than one restaurant of some type of cuisine?
11. Which areas have more than one restaurant serving noodles?