Loading in 5 sec....

Co-inductive logic programming and its applicationsPowerPoint Presentation

Co-inductive logic programming and its applications

- 114 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Co-inductive logic programming and its applications' - payton

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Overview

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

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.

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

Example - list

list([]).

list([1|T]) :- list(T).

- What is its inductive semantics?
- What is its co-inductive semantics?

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.

Example - list

:- coinductive list/1.

list([]).

list([1|T]) :- list(T).

?- list(X)X = [1|X]

list(X)

X = [1|T]

list(T)

Example - list

:- coinductive list/1.

list([]).

list([1|T]) :- list(T).

?- list(X)

X = []

X = [1|X]

X = [1]

X = [1, 1]

…

list(X)

X = []

X = [1|T]

list(T)

T= []

T= [1]

… …

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

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

Example - comember

:- coinductivecomember/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.

Application on computing answer sets (stable models)

Why does a stable model matter?

p.

r :-p, q.

s :- p, not q.

With negation as failure

p.

r :-p, q.

s :- p, not q.

Another model!!

What makes the left model so special?

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 Iand ‘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.

Is a Stable Model

p.

r :-p, q.

s :- p, not q.

I = {p, s}

The reduct

p.

r :-p, q.

s :- p.

I is a stable model

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

Non-monotonic reasoning (nmr)

// {q} is a stable model

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.

// {r} or {s} is a stable model

Goal-directed ASP

- Ordinary Rules
- all non-cyclical rules
- Cyclical rules which when used to expand a call to a subgoalG 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}

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.

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.

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}

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.

Download Presentation

Connecting to Server..