Question: 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.

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!