Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Given the relations father(X,Y) X is the father of Y mother(X, Y) X is the mother of Y female(X) X is female male(X )

1. Given the relations

father(X,Y) X is the father of Y mother(X, Y) X is the mother of Y female(X) X is female male(X ) X is male

Define prolog relations for the following:

a. sibling b. sister c. grandson d. descendant

Provide some facts for the father, mother, male, and female predicates and then test the entire thing using Prolog.

2. Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isnt a member of L.

What are all of the answers to the following queries?

ask remove(a,[b,a,d,a],R).

ask remove(E,[b,a,d,a],R).

ask remove(E,L,[b,a,d]).

ask remove(p(X),[a,p(a),p(p(a)),p(p(p(a)))],R).

3. Write a Prolog relation subsequence(L1,L2) that is true if list L1 contains a subset of the elements of L2 in the same order.

How many different proofs are there for each of the following queries?

ask subsequence([a,d],[b,a,d,a]).

ask subsequence([b,a],[b,a,d,a]).

ask subsequence([X,Y],[b,a,d,a]).

ask subsequence(S,[b,a,d,a]).

Explain why there are that many.

4. Write a Prolog relation that returns a list containing the union of the elements of two given lists.

5. Write another relation (anything you want) that does something not performed above. Explain what your relation does.

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago