PROLOG PROGRAM: ----------------------------------------------------------------
ID: 3873130 • Letter: P
Question
PROLOG PROGRAM:
--------------------------------------------------------------------
Given the following set of Prolog clauses"
father(X,Y):-parent(X,Y),male(X).
parent(sally,bob). parent(jim,bob). parent(alice,jane). parent(thomas,jane).
male(bob). male(jim). male(thomas).
female(sally). female(alice).
--------------------------------------------------------------------
(1) how many atoms are matched to the variable X before the following query reports a result:
?-father(X,jane).
--------------------------------------------------------------------
(2) How many different facts are given in this Prolog program?
--------------------------------------------------------------------
(3)What will the variable X be bound with when the query ?-father(X,jane). reports a result?
--------------------------------------------------------------------
(4) How many different rules are given in this Prolog program?
--------------------------------------------------------------------
(5) How many different variables are used in this Prolog program?
--------------------------------------------------------------------
(6) How many different atoms are specifid in this prolog program?
--------------------------------------------------------------------
(7) Add a rule that states parent bill had only sons (no daughters) and every such son became a parent of a child named frank, walkter, or george.
Explanation / Answer
1) 4 atoms are matched before the query reports results.
2) 9 facts are given in this prolog program.
3) alice is bounded to the query.
4) only 1 rule is given
5)only 2 variables are given X and Y
6) 13 atoms are specified.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.