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)

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

6. Describe to a manager the different types of distance learning.

Answered: 1 week ago