Prolog Part 1
In Prolog, a program consists of:
All of the above
Facts declare things that:
Are always true
In Prolog, a fact is:
Clause that has a head and an empty body
Which of the following are clauses in Prolog?
Fact, Rule, Question
Rules are clauses with a body but without a head.
False
In rules, goals could be separated by commas.
True
Consider the following relation: loves(john, ann). loves(ted, mary). loves(marc, liza). loves(ann, ted). loves(liza, marc). Select all possible answers to the following question (finding some of them might require typing a semicolon and backtracking): ?-loves(X, Y), loves (Y,X).
X = marc Y = liza, X = liza Y = marc
Consider the following relation: loves(john, ann). loves(ted, mary). loves(marc, liza). male(john). What is the answer to the following question: ?-loves(X, mary), male (X).
false
Consider the following relation: loves(john, mary). loves(ted, mary). loves(marc, mary). What is the answer to the following question: ?-loves(X, liza).
false
A variables scope
is in the clause in which it appears.