Any help is appreciated , I am working on a practice review for my class. 45. Gi
ID: 3840966 • Letter: A
Question
Any help is appreciated , I am working on a practice review for my class.45. Given the following facts and rules what would be the responses from Prolog interpret for the given queries Facts owns (jack, car(bmw) jack owns bmw car sedan(car(bmw) owns (john, car(chevy). john car owns chevy sedan(car(civic) owns(olivia, car(civic). olivia owns civic car truck(car(chevy)) owns (jane, car(chevy). jane owns chevy car Queries Goals & answers a) What does john own? d) Who owns car chevy? owns (john, X). owns(Who, car(chevy). b) Does John own something? owns(john, e) Does jane own truck? c) Does jane own sedan? owns(jane, X), truck(X). ?-owns(jane, xp, sedan bmw car is sedan civic car is sedan chevy car is truck
Explanation / Answer
Given below are answers to your queries / goals with explanation.
% a) What does john own?
? - owns(john, X).
Explanation:
i.e. Find X such that owns(john, X) is true.
Given,
owns(john, car(chevy)) is true.
Answer:
X = car(chevy)
% b) Does john own something?
? - owns(john, ...).
Explanation:
i.e. Whether there is ... such that owns(john, ...) is true.
Given,
owns(john, car(chevy)) is true.
Answer:
true
% c) Does jane own sedan?
? - owns(jane, X), sedan(X).
Explanation:
i.e. Find X such that owns(john, X) is true and sedan(X) is true.
Given,
owns(john, car(chevy)) is true.
sedan(car(chevy)) is false.
Therefore, this query evaluates to false.
Answer:
false
% d) Who owns car chevy?
? - owns(Who, car(chevy)).
Explanation:
i.e. Find values for Who so that owns(Who, car(chevy)) is true.
Given,
owns(john, car(chevy)) is true.
owns(jane, car(chevy)) is true.
Answer:
Who = john
Who = jane
% e) Does jane own truck?
? - owns(jane, X), truck(X).
Explanation:
i.e. Find X such that owns(jane, X) is true and truck(X) is true. If there is no such X, return false.
Given,
owns(jane, car(chevy)) is true.
truck(car(chevy)) is true.
Answer:
X = car(chevy)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.