Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a PROLOG program that investigates family relationships using lists. The facts should be organized as follows: m ([first_male_name, second_male_name, ..., last_male_name]). f([first female

image text in transcribed

1. Write a PROLOG program that investigates family relationships using lists. The facts should be organized as follows: m ([first_male_name, second_male_name, ..., last_male_name]). f([first female name, second female name, ..., last female name]). family ( [father, mother, [child 1, child_2,..., child_n]]). Write rules that define the following relations: male (X) female (X) father, mother, parent siblingsl, siblings2 brotherl, brother2 sisterl, sister2 cousins uncle, aunt grandchild, grandson, granddaughter greatgrandparent ancestor For each of these rules show an example of its use. 2. Write a PROLOG program that includes the following operations with lists: membership testing (is an element member of a list?) first element last element two adjacent elements three adjacent elements append list1 to list2 producing list3 delete element from a list append element to a list insert element in a list Compute the length of list reverse a list check whether a list is a palindrome display a list For each of these operations write your implementation of the operation and show an example of its use. If a predicate already exists (predefined in Prolog), modify its name (e.g. myappend or appendl). Lists to be processed can be created by an auxiliary program, defined as facts, or entered from the keyboard. 3. Write a PROLOG program that solves the 8 queens problem (location of 8 queens on a chess board so that no queens have each other in check, i.e. are not located in the same row/column/diagonal). 1. Write a PROLOG program that investigates family relationships using lists. The facts should be organized as follows: m ([first_male_name, second_male_name, ..., last_male_name]). f([first female name, second female name, ..., last female name]). family ( [father, mother, [child 1, child_2,..., child_n]]). Write rules that define the following relations: male (X) female (X) father, mother, parent siblingsl, siblings2 brotherl, brother2 sisterl, sister2 cousins uncle, aunt grandchild, grandson, granddaughter greatgrandparent ancestor For each of these rules show an example of its use. 2. Write a PROLOG program that includes the following operations with lists: membership testing (is an element member of a list?) first element last element two adjacent elements three adjacent elements append list1 to list2 producing list3 delete element from a list append element to a list insert element in a list Compute the length of list reverse a list check whether a list is a palindrome display a list For each of these operations write your implementation of the operation and show an example of its use. If a predicate already exists (predefined in Prolog), modify its name (e.g. myappend or appendl). Lists to be processed can be created by an auxiliary program, defined as facts, or entered from the keyboard. 3. Write a PROLOG program that solves the 8 queens problem (location of 8 queens on a chess board so that no queens have each other in check, i.e. are not located in the same row/column/diagonal)

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

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago

Question

How can the Internet be helpful in a job search? (Objective 2)

Answered: 1 week ago