Learn more about our help with Assignments: Prolog

Program(Queen Victoria's family):

male(albert).

male(edward).

female(alice).

female(victoria).

parents(edward,victoria,albert).

parents(alice,victoria,albert).

sister_of(X,Y):-

female(X),

parents(X,M,F),

parents(Y,M,F).

On the query sister_of(X,Y) more one answer can be

returned. Explain how all the answers are obtained,

and what they are.

Prolog

You are to write a simple program in Prolog to find a path through a maze. Your input will consist of facts of the form

` pway(a, b, 10).`

indicating that there is a passageway from intersection a to intersection b of length 10 meters. You are to write a rule

` solve(X, Y, P, N) :- ...`

that will find a path P of length N (if one exists) from intersection X to intersection Y. The intent is that the user will invoke solve as a query, specifying X and Y as constants and P and N as variables.

Here is a concrete example. Suppose the database contains the following rules:

```
pway(a, b, 10).
pway(b, c, 15).
pway(d, c, 5).
pway(d, b, 10).
```

If the user types

` solve(a, d, P, N)`

the Prolog interpreter might respond with

```
P = [a, b, c, d]
N = 30
```

Prolog

Arrange in ascending order the last THREE (3) elements in the list of 5 elements. For example, if the original list consists of [12, 3, 9,4,1] then the new list becomes [12,3,1,4,9]. For the ascending sorting, there is a built in predicate called sort(A,X). It sorts the elements in List A and the results of that sort is saved in List X

Prolog

Write a prolog program to convert any 4-bit binary number to octal number.

Prolog

Write a program to convert the given text, ‘Today, is a good day. Are you going out?’ into a list of words and rearrange the words to form a new text:

Are you going out? Today, is a good day.

Are you going out? Today, is a good day.

Prolog

Write a prolog program to convert any 4-bit binary number to octal number.

(b) Arrange in ascending order the last THREE (3) elements in the list of 5 elements. For example, if the original list consists of [12, 3, 9,4,1] then the new list becomes [12,3,1,4,9]. For the ascending sorting, there is a built in predicate called sort(A,X). It sorts the elements in List A and the results of that sort is saved in List X.

Implement prolog program on recipe recommendation as per available ingredients.

i need help in prolog

Prolog

Develop a logic expert sytem using PROLOG . The system should be

able to solve

i. 74+34

ii. 24*66

iii. 54-34

iv. 100/10

v. That , 44+5=50 is wrong

able to solve

i. 74+34

ii. 24*66

iii. 54-34

iv. 100/10

v. That , 44+5=50 is wrong