Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Notice that In SWI Prolog, queries are terminated by a full stop To answer this query, Prolog consults its database to see if this is

image text in transcribed
Notice that In SWI Prolog, queries are terminated by a full stop To answer this query, Prolog consults its database to see if this is a known fact. In example dialogues with Prolog, the text in green italics is what the user types. Your Assignment 1. Given the relations father(X,Y) mother(X, Y)X is the mother of Y female(X) male(X) 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 isn't 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(LI,L2) that is true if list LI 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. X is the father of Y X is female X is male

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

More Books

Students also viewed these Databases questions

Question

Know how productivity improvements impact quality and value.

Answered: 1 week ago

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago