Exercise 6: Let L = (V;C;R) with V = fw; yg, C = fd; eg and R = fr; sg where r h
ID: 3886790 • Letter: E
Question
Exercise 6:
Let L = (V;C;R) with V = fw; yg, C = fd; eg and R = fr; sg where r has arity 1 and
s has arity 2. Which of the following are atoms over L? Which are ground atoms? Justify your
answers.
(a) d(w;w)
(b) r(d; e)
(c) s(w;w)
(d) r(y)
Exercise 8:
Write a Datalog program which captures the following natural language sentences.
(a) If somebody is an orphan, then all his parents are dead.
(b) Every orphan is a human being.
(c) Somebody's father is also that person's parent.
(d) Harry Potter is an orphan.
(e) James Potter is the father of Harry Potter.
Exercise 9:
Give three distinct Herbrand interpretations for the following Datalog program, where
a; b are constants.
q(a)
p(b)
q(x) ! p(x)
q(y) ^ p(y) ! r(b)
Exercise 10:
Evaluate the following.
(a) (p(x; y; x) ^ q(x; y; y) ^ r(y; y) ! t(x))[x=a; y=b] = ...
(b) (p(x) ^ q(x) ! r(x))[x=c][x=d] = ...
(c) (q(a; x) ^ p(x; y) ^ q(y; a) ! r(y))[x=a][x=b] = ...
(d) (p(x; x) ^ q(x; y) ! p(x; y))[y=b][y=c][x=b] = ...
Exercise 11 :Which of the substitutions in Exericse 10 are ground substitutions?
Exercise 12: Give the grounding of the Datalog program from Exercise 9.
Exercise 13: Give a Herbrand model for the Datalog program in Exercise 9.
Exercise 14: Give three distinct Herbrand models for the Datalog program P consisting of the
following rules.
p(a; b)
q(c)
p(x; y) ! q(x)
Explanation / Answer
8) orphan(x) AND parent(x,y) <- dead(y)
orphan(x) <- human(x)
father(z,x) <- parent(z,x)
orphan(HarryPotter) <- true
father(HarryPotter,JamesPotter) <- true
9)
For a constant a, q(a) is true
For a constant b, p(b) is true
If q is true for any x then p is true for that x.
If both p and q are true then r is true for constant b.
Interpretation 1 :- p and q are similar attributes such that if p(x) is true then q(x) will also be true
Interpretation 2 :- r(b) is true for all b where p(b) is true
Interpretation 3 :- r(b) is true for all b where q(b) is true
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.