Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IM USING SWI PROLOG AND VISUAL STUDIO CODE FOR THE CODING. HELP APPRECIATED ?- travelBetween(canton, braintree). true . ?- travelBetween(avon,milton). true. '?- travelBetween(milton, avon). true.

image text in transcribed

IM USING SWI PROLOG AND VISUAL STUDIO CODE FOR THE CODING. HELP APPRECIATED

?- travelBetween(canton, braintree). true . ?- travelBetween(avon,milton). true. '?- travelBetween(milton, avon). true. ?- ] (10 points) We have the following knowledge base: That is, this knowledge base holds facts about towns it is possible to travel between by taking a direct train. But of course, we can travel further by 'chaining together' direct train journeys. Write a recursive predicate travelBetween/2 that tells us when we can travel by train between two towns. directTrain(avon, braintree). direct Train(quincy,avon). directTrain(newton,boston). directTrain(boston,avon). directTrain(braintree,milton). directTrain(westwood,newton). direct Train(canton, Westwood). For example, when given the query o travelBetween(canton, braintree). It should reply true. Whenever it is possible to take a direct train from A to B, it is also possible to take a direct train from B to A. For example, below query should return true. o travelBetween(braintree, canton). ?- travelBetween(canton, braintree). true . ?- travelBetween(avon,milton). true. '?- travelBetween(milton, avon). true. ?- ] (10 points) We have the following knowledge base: That is, this knowledge base holds facts about towns it is possible to travel between by taking a direct train. But of course, we can travel further by 'chaining together' direct train journeys. Write a recursive predicate travelBetween/2 that tells us when we can travel by train between two towns. directTrain(avon, braintree). direct Train(quincy,avon). directTrain(newton,boston). directTrain(boston,avon). directTrain(braintree,milton). directTrain(westwood,newton). direct Train(canton, Westwood). For example, when given the query o travelBetween(canton, braintree). It should reply true. Whenever it is possible to take a direct train from A to B, it is also possible to take a direct train from B to A. For example, below query should return true. o travelBetween(braintree, canton)

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

2. What are the different types of networks?

Answered: 1 week ago