0% found this document useful (0 votes)
10 views4 pages

Lab12 + 13

This document contains details of several AI lab assignments completed by a student. It describes Prolog rules for family relationships, enclosure relationships and multi-level enclosure relationships.

Uploaded by

haidersheikh1221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Lab12 + 13

This document contains details of several AI lab assignments completed by a student. It describes Prolog rules for family relationships, enclosure relationships and multi-level enclosure relationships.

Uploaded by

haidersheikh1221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

COMSATS University, Islamabad

Department of Computer Science

Student Name: Mohammed Hasan Hael Alsalehi Reg: SP22-BSE-053

Class/Section: 5A Subject: AI Date: 13/5/2024

LAB 12:

Task 01:

male(hayl).
male(hasan).
male(sohuil).
male(mohammed).
female(najaht).

parent(hayl, hasan).
parent(hasan, mohammed).
parent(hasan, sohuil).
parent(najaht, mohammed).

father(X, Y) :- male(X), parent(X, Y).


mother(X, Y) :- female(X), parent(X, Y).
brother(X,Z) :- male(X), male(Z), parent(Y,X), parent(Y,Z), X \= Z.
grandparent(X, Z) :- parent(X, Y), parent(Y, Z).

Page | 1
LAB 13:
Task 01:

parent(alice, bob).
parent(alice, betsy).
parent(alice, bill).
parent(bob, carl).
parent(bob, charlie).
teacher(albert).
teacher(alice).

brother(X, Y) :-
parent(Z, X),
parent(Z, Y),
X \= Y.

uncle(X, Y) :-
parent(Z, Y),
brother(Z, X).

Page | 2
Task 02:

parent(albert, bob).
parent(albert, betsy).
parent(albert, bill).
parent(alice, bob).
parent(alice, betsy).
parent(alice, bill).
parent(bob, carl).
parent(bob, charlie).

grandparent(X, Y) :-
parent(X, Z),
parent(Z, Y).

Page | 3
Task 04:

encloses(b1, b2).
encloses(b1, b5).
encloses(b2, b3).
encloses(b2, b4).
encloses(b5, b6).
encloses(b6, b7).

encloses1(X, Y) :- encloses(X, Y).


encloses2(X, Y) :- encloses(X, Z), encloses(Z, Y).

Page | 4

You might also like