0% found this document useful (0 votes)
2 views

Assignment 1 Practice

The document consists of a series of Prolog queries and facts related to comparisons and ownership of cars. It includes examples of how Prolog evaluates logical expressions and queries about ownership based on predefined facts. The queries test various conditions and relationships between variables and constants.

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)
2 views

Assignment 1 Practice

The document consists of a series of Prolog queries and facts related to comparisons and ownership of cars. It includes examples of how Prolog evaluates logical expressions and queries about ownership based on predefined facts. The queries test various conditions and relationships between variables and constants.

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/ 2

Assignment 1

1. How does Prolog answer to below Queries?


(1) ?- 3<5.

(2) ?- 4<2.

(3) ?- 6>5.

(4) ?- 12<=12.

(5) ?- 12 =<12.

(6) ?- 3+4 =< 7.

(7) ?- 5=\=5. // 5 is not equal to 5.

(8) ?- 5=\=4.

(9) ?- 5=\=(3+2).

(10) ?- 8=8.

(11) ?- 8=:=8. // 8 equal to 8.

(12) ?- 8=:=9.

(13) ?- (2+1)*10 = 30.

(14) ?- (2+1)*10 =:= 30.

(15) ?- X=2, X<3.

(16) ?- X=4, X<3.

(17) ?- *(2,3) = 2*3.

(18) ?- X = Z.

(19) ?-(X>3)=(4>3).

(20) ?- X = 3, C is X*X*X.
(21) ?- X = 3, X*X*X is C.

(22) ?- is(Y,^(2,2)).

Q.2 Check set of queries for given facts.


owns(jack, car(bmw)).

owns(john, car(chevy)).

owns(olivia, car(civic)).

owns(jane, car(chevy)).

sedan(car(bmw)).

sedan(car(civic)).

truck(car(chevy)).

1) What does John owns?

2) Does John own something?

3) Who owns car chevy?

4) Does Jane own sedan?

5) Does Jane own truck?

You might also like