C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.
-
Upload
mario-footer -
Category
Documents
-
view
215 -
download
0
Transcript of C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.
![Page 1: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/1.jpg)
CO-INDUCTIVE LOGIC PROGRAMMING AND ITS
APPLICATIONS
![Page 2: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/2.jpg)
Overview
• Induction vs. co-induction• Co-inductive logic programming• A goal-directed approach for Answer Set
Computing
![Page 3: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/3.jpg)
Induction
Inductive definitions have 3 components:• Initiality (e.g., [] is a list)• Iteration (e.g., [H|T] is a list if T is a list, and H
is a number)• Minimality (e.g., nothing else is a list)Inductive definitions correspond to least fixed point interpretations of recursive definitions.
![Page 4: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/4.jpg)
Co-induction
• Eliminate the initiality condition• Replaces the minimality condition with maximality
• Iteration: [H|T] is a list if T is a list and H is a number• Maximality: the set of lists is the maximal set of
such lists
Co-induction corresponds to the greatest point interpretation of recursive definition
![Page 5: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/5.jpg)
Example - list
list([]).list([1|T]) :- list(T).• What is its inductive semantics?• What is its co-inductive semantics?
![Page 6: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/6.jpg)
Co-inductive logic programming
• Operational semantics relies on a co-inductive hypothesis set (CHS);
• During execution, if the current resolvent R contains a call C’ that unifies with a call C encountered earlier, then the call C’ succeeds; the new resolvent is R’ where = mgu(C, C’) and R’ is obtained by deleting C’ from R.
![Page 7: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/7.jpg)
Example - list
:- coinductive list/1.list([]).list([1|T]) :- list(T).?- list(X)X = [1|X]
list(X)
list(T)
X = [1|T]
![Page 8: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/8.jpg)
Example - list
:- coinductive list/1.list([]).list([1|T]) :- list(T).?- list(X)X = []X = [1|X]X = [1]X = [1, 1]…
list(X)
list(T)
X = [1|T]X = []
T = [] T = [1] … …
![Page 9: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/9.jpg)
Example - Stream
:- coinductive stream/1.stream([H|T]) :- number(H), stream(T).number(0).number(s(N)) :- number(N).?- stream([0, s(0), s(s(0)) | T]).
![Page 10: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/10.jpg)
Example – list membership
(1) member(H, [H|_]).(2) member(H, [_|T]) :- member(H, T).the desired element is the last element of some prefix of the listmembera(X, L) :- drop(X, L, _).drop(H, [H|T], T).drop(H, [_|T], T1) :- drop(H, T, T1).
![Page 11: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/11.jpg)
Example - comember
:- coinductive comember/2.comember(X, L) :- drop(X, L, L1), comember(X, L1).?- X = [1, 2, 3 | X], comember(2, X).?- X = [1, 2, 3, 1, 2, 3], comember(2, X).?- X = [1, 2, 3 | X], comember(Y, X).
comember/2 is true if and only if the desired element does occur in an infinite number of times in the list.
![Page 12: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/12.jpg)
APPLICATION ON COMPUTING ANSWER SETS (STABLE MODELS)
![Page 13: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/13.jpg)
Why does a stable model matter?
p.r :- p, q.s :- p, not q.
With negation as failure
p q r s
T F F T
p.r :- p, q.s :- p, not q.
Another model!!
p q r s
T T T F
What makes the left model so special?
![Page 14: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/14.jpg)
Stable model
• [Gelfond and Lifschitz, 1988]• For a program P not containing any negation, the stable
model is unique, defined as its least fixed point.• E.g., a model I = {p, s}• the reduct of P relative to I is the set of rules without
negation obtained from P by GL-transformation:– dropping each rule s.t. C in I and ‘not C’ in the body of the rule– dropping all the rest negative atom ‘not C’ from the bodies of
the remaining rules• I is a stable model of P if I is the stable model of the reduct
of P relative to I.
![Page 15: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/15.jpg)
Is a Stable Model
p.r :- p, q.s :- p, not q.
I = {p, s}
p q r s
T F F T
The reductp.r :- p, q.s :- p.
I is a stable model
![Page 16: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/16.jpg)
NOT a Stable Model
p.r :- p, q.s :- p, not q.
I = {p, q, r}
The reductp.r :- p, q.
I is NOT a stable modelp q r s
T T T F
![Page 17: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/17.jpg)
Non-monotonic reasoning (nmr)
q. p :- q, not p.
Is {q} a stable model?Is {p, q} a stable model? r :- not s.s :- not r. p :- s, not p.
// {q} is a stable model
// {r} or {s} is a stable model
![Page 18: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/18.jpg)
Goal-directed ASP
• Ordinary Rules– all non-cyclical rules– Cyclical rules which when used to expand a call to
a subgoal G lead to a recursive call to G through an even (but non-zero) number of negations. E.g., (1) p :- not q.(2) q :- not p.(3) r. (4) s :- r.
:- p CHS = {}
:- not q CHS = {p}
:- not not p CHS = {p, not q}
:- p CHS = {p, not q}
![Page 19: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/19.jpg)
Goal-directed ASP
• Odd Loops Over Negation (OLON)– Cyclical rules which when used to expand a call to
subgoal G lead to a recursive call to G that is in the scope of an odd number of negations.E.g., (1) p :- q, not r.(2) r :- not p.(3) q :- t, not p.
![Page 20: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/20.jpg)
OLON rules
• p :- q, r, not p.• If p is true through other parts of the
program, then it is useless.• If p is not true through the rest of the
program, then q or r has to be false.chk_p :- p.chk_p :- not q.chk_p :- not r.
![Page 21: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/21.jpg)
Goal-directed executionp :- q, not r. (od & olon)r :- not p. (od)q :- t, not p. (olon)q. (od)
p :- q, not r.r :- not p.q.
chk_p :- p.chk_p :- not q.chk_p :- r.chk_q :- q.chk_q :- not t.
nmr_chk :- chk_p, chk_q.
:- p, nmr_chk. {}:- q, not r, nmr_chk. {p, q}:- not r, nmr_chk. {p, q}:- not not p, nmr_chk {p, q, not r}:- p, nmr_chk {p, q, not r}:- nmr_chk {p, q, not r}
![Page 22: C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5518d26c550346b31f8b5d68/html5/thumbnails/22.jpg)
Issues
• Identifying OLON and ordinary rules– Through a graph travel algorithm in O(|P| * n)
• Partial answer set• If cyclical rules not through any number of
negations, then the recursive call fails.E.g., p :- p.