Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The program used is Visual Studio Code. The lines of code need to be written in recursive. Help? the language used is prolog. 7340/Prolog/ 2-

The program used is Visual Studio Code. The lines of code need to be written in recursive. Help?image text in transcribed

the language used is prolog.
7340/Prolog/ 2- pwd. $ /Users/ Documents/ true. 7- consult('assignmento.pl"). true. 7- travelBetween(braintree, canton). true. 7- travelBetween(canton, braintree). true. 7- travelBetween(avon, milton). true. ?- travelBetween(milton, avon). true. 2-0 (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. direct Train(avon, braintree). direct Train(quincy, avon). directTrain(newton, boston). direct Train(boston, avon). direct Train(braintree,milton). direct Train(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 with AI-Powered 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

Students also viewed these Databases questions