Answered step by step
Verified Expert Solution
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.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started