Question: Start this Prolog assignment by entering the following five facts and two in-rules into your Prolog engine inFact(bangor,penobscotCounty). inFact(portland,cumberlandCounty). inFact(penobscotCounty,maine). inFact(cumberlandCounty,maine). inFact(maine,newEngland). contains(A,B):-inFact(B,A). contains(A,B):-inFact(C,A),contains(C,B). 1.
Start this Prolog assignment by entering the following five facts and two in-rules into your Prolog engine
inFact(bangor,penobscotCounty).
inFact(portland,cumberlandCounty).
inFact(penobscotCounty,maine).
inFact(cumberlandCounty,maine).
inFact(maine,newEngland).
contains(A,B):-inFact(B,A).
contains(A,B):-inFact(C,A),contains(C,B).
1. What are the differences of the relations in Fact and the relation contains? Describe the difference in terms of the relation properties covered in the last homework.For the following queries and rules, do not use your intuition, but follow exactly the wording of the queries, even if you think the query could be reworded or if you think that the query would make more sense if reworded.
2. Write a query to determine all items that newEnglandcontains. Why does orono not show up as something newEnglandcontainswhen you query your data set?
3. Write a query to determine all items that maine contains and cumberland Countycontains. Briefly discuss the query result youobtained.
4. Write a query to determine all items that newHampshire contains.Briefly discuss the query result you obtained.
5.Write a rulein(A,B)that captures whether something A is in something B.Try to find the most concise way to formulate this rule.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
