Write all of Prolog’s answers to the following queries:
Second, improve it by adding green cuts.
Exercise 10.3 Without using cut, write a predicate split/3 that splits a list of integers into two lists: one containing the positive ones (and zero), the other containing the negative ones. For example:
Then improve this program, without changing its meaning, with the help of the cut.
Recall that in Exercise 3.3 we gave you the following knowledge base:
We asked you to write a recursive predicate travelFromTo/2 that told us when we could travel by train between two towns.
Now, it’s plausible to assume that 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. Add this information to the database. Then write a predicate route/3 which gives you a list of towns that are visited by taking the train from one town to another. For instance:
Exercise 10.5 Recall the definition of jealousy given in Chapter 1 .
In a world where both Vincent and Marsellus love Mia, Vincent will be jealous of Marsellus, and Marsellus of Vincent. But Marsellus will also be jealous of himself, and so will Vincent. Revise the Prolog definition of jealousy in such a way that people can’t be jealous of themselves.