Question: Q1:- Write a prolog predicate classify(L) to classify the elements of a given list (L), whether each element is Number, Atom, Character or List. As
Q1:- Write a prolog predicate classify(L) to classify the elements of a given list (L), whether each element is Number, Atom, Character or List. As Example ?- classify(*6, orange, a, *2,3++) 6 is number orange is atom a is character [2,3] is list
Q3:- Suppose someone has already written Prolog clauses that define the following relationships:
| father(X, Y) mother(X, Y) male(X) female(X) parent(X, Y) diff(X, Y) | /* X is the father of Y */ /* X is the mother of Y */ /* X is male */ /* X is female */ /* X is a parent of Y */ /* X and Y are different */ |
| Write Prolog clauses (rule) to define the following relationships: | |
| is_mother(X) is_father(X) is_son(X) sister_of(X, Y) | /* X is a mother */ /* X is a father */ /* X is a son */ /* X is a sister of Y */ |
| grandpa_of(X, Y) /* X is a grandfather of Y */ | |
| sibling(X, Y) | /* X is a sibling of Y */ |
For example, we could write a rule for aunt, provided we were supplied with (or wrote) rules for female, sibling, and parent. aunt(X, Y) : female(X), sibling(X, Z), parent(Z, Y). This could also be written: aunt(X, Y) : sister_of(X, Z), parent(Z, Y) Q4:- Decibel A weighting (dBA) is an environmental noise measurement where the following table represent the noise influence
| dBA Evaluation |
| 20 Silent |
| 30 40 Quiet |
| 50 60 Moderate |
| 70 80 Loud |
| 90 100 Very noisy |
| 110 140 Extrimlly noisy |
Translate the pervious relation into prolog program then try to get the evaluation for the following dBA values ( 15,75, 105).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
