Q2 instructor(john,cs365). instructor(mary,cs311). enrolled(danielle,cs365). enrolled(danielle,cs446). § Which query provides a list of all the students enrolled in cs365? enrolled(Who, cs365).
Q5 § Given the following facts § cat(tom). § black_spots(tom). § dog(pluto). § white_spots(pluto) § Which rule defines in Prolog the following sentence: § "mary owns a Pet if it is a cat and it has black spots" owns(mary, Pet):- cat(Pet), black_spots(Pet).
Arithmetic Queries ?- X is 3 + 5. X=8 ?- X is 3 mod 2. X=1 ?- X is 3 mod 2 - 1 * 5 / 9. X=0.4444444444444444 ?- X is 5+4, Y is 5-4. X=9 Y=1 ?- X is 5*4, Y is 2^3. X=20 Y=8
Arithmetic Queries ?- X is 234556^100. X = 105841181316488988298177591518 4... ?- X is 5/3. X=1.66666667 ?- X is sqrt(3),Y is 3^0.5. X=Y Y=1.7320508075688772 ?- X is 8 mod 3. X=2 ?- Y is 10^3 * (1+1) + 3. Y=2003
Arithmetic Queries ?- X is 10+5. X = 15 ?- 6 is 10+5. false ?- 15 is 10+5. true ?- 10+5 is X. Error: Arguments are not sufficiently instantiated ?- 10+5 is 10+5. false
Spring 2018 Disclaimer. These slides can only be used as study material for the class CSE240 at ASU. They cannot be distributed or used for another purpose.