Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

6 . Use your in rule to determine all items that are in orono . Briefly explain the query result.

7 . Write a query to determine in what items is orono .

8 . Extend your facts by adding inFact predicates for another five counties in Maine. Also add inFact predicates for the corresponding county seats. NOTE: A county seat is the city/town where the administrative tasks of the county occur.

9 . Write a query to determine all items that are in mai ne .

10 . In the contains rule (lines 6 and 7 in the facts and rules listed before question 1) , what would happen if you replaced the second predicate contains (A,B) : - inFact ( C,A ), contains ( C,B ). with contains (A,B) : - contains ( C,B ) , inFact ( C,A ). If you cannot find the answer, give it a try by making the change in your Prolog code and then run some of the Queries 1 - 3. What happens? Why? If you made these changes, be sure to revert afterwards to the original. For all rules that you write, use only basic Prolog statements as introduced in class (i.e., only Horn clauses, with each rule having a single consequent predicate and all antecedent predicates linked by commas representing conjunctions. Do not use any oth er syntax, even if Prolog parses and processes it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Have people who have high power in society earned their power?

Answered: 1 week ago

Question

To find integral of sin(logx) .

Answered: 1 week ago

Question

What is Centrifugation?

Answered: 1 week ago

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago