0% found this document useful (0 votes)
30 views1 page

AI Practical-1

The document outlines a practical assignment involving the implementation of various predicates in Prolog related to familial relationships, such as brother, cousin, grandson, and descendent, based on a specified genealogical tree. Additionally, it includes programming tasks to implement functions for calculating factorials, Fibonacci sequences, finding maximum and minimum of three numbers, checking if a number is even/odd or positive/negative, and determining if a number is a palindrome. The document also specifies queries to be executed in Prolog to test the defined predicates.

Uploaded by

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

AI Practical-1

The document outlines a practical assignment involving the implementation of various predicates in Prolog related to familial relationships, such as brother, cousin, grandson, and descendent, based on a specified genealogical tree. Additionally, it includes programming tasks to implement functions for calculating factorials, Fibonacci sequences, finding maximum and minimum of three numbers, checking if a number is even/odd or positive/negative, and determining if a number is a palindrome. The document also specifies queries to be executed in Prolog to test the defined predicates.

Uploaded by

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

AI Practical – 1

Que 1. Implement the following.


Define a predicate brother(X,Y) which holds iff X and Y are brothers.
Define a predicate cousin(X,Y) which holds iff X and Y are cousins.
Define a predicate grandson(X,Y) which holds iff X is a grandson of Y.
Define a predicate descendent(X,Y) which holds iff X is a descendent of Y.
Consider the following genealogical tree:
father(a,b).
father(a,c).
father(b,d).
father(b,e).
father(c,f).
Say which answers, and in which order, are generated by your definitions for
the following queries
in Prolog:
?- brother(X,Y).
?- cousin(X,Y).
?- grandson(X,Y).
?- descendent(X,Y).

Que 2. Implement the following programs.


1) Implement Factorial and Fibonacci of given numbers.
2) Find maximum of 3 numbers
3) Find minimum of 3 numbers.
4) Check given number is even/odd.
5) Check given number is positive/negative
6) Calculate Pailindrom of given number.

You might also like