Download presentation

Presentation is loading. Please wait.

Published byMario Footer Modified over 2 years ago

1
C O - INDUCTIVE LOGIC PROGRAMMING AND ITS APPLICATIONS

2
Overview Induction vs. co-induction Co-inductive logic programming A goal-directed approach for Answer Set Computing

3
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.

4
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

5
Example - list list([]). list([1|T]) :- list(T). What is its inductive semantics? What is its co-inductive semantics?

6
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.

7
Example - list :- coinductive list/1. list([]). list([1|T]) :- list(T). ?- list(X) X = [1|X] list(X) list(T) X = [1|T]

8
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]…

9
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]).

10
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 list membera(X, L) :- drop(X, L, _). drop(H, [H|T], T). drop(H, [_|T], T1) :- drop(H, T, T1).

11
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.

12
A PPLICATION ON COMPUTING ANSWER SETS ( STABLE MODELS )

13
Why does a stable model matter? p. r :- p, q. s :- p, not q. With negation as failure pqrs TFFT p. r :- p, q. s :- p, not q. Another model!! pqrs TTTF What makes the left model so special?

14
Stable model

15
Is a Stable Model p. r :- p, q. s :- p, not q. I = {p, s} pqrs TFFT The reduct p. r :- p, q. s :- p. I is a stable model

16
NOT a Stable Model p. r :- p, q. s :- p, not q. I = {p, q, r} The reduct p. r :- p, q. I is NOT a stable model pqrs TTTF

17
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

18
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}

19
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.

20
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.

21
Goal-directed execution p :- 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}

22
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.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google