Computational Intelligence

Online Slides

October 24, 2002

These are slides from Computational Intelligence, A Logical Approach, Oxford University Press, 1998. Copyright ©David Poole, Alan Mackworth, Randy Goebel and Oxford University Press, 1999-2002. You may prefer the pdf interface for which these slides were designed (you can read pdf files using the free acrobat reader).

Chapter 6, Lecture 1


Knowledge Engineering

Overview:


Knowledge-based system architecture


Roles for people in a KBS


Users

How can users provide knowledge when

Querying the User


Yes/No questions


Electrical Domain

In the electrical domain:


Functional Relations


Getting information from a user


More General Questions

Example: For the subgoal p(a,X,f(Z)) the user can be asked:

for which X,Z is p(a,X,f(Z)) true?

Example: For which S,C is enrolled(S,C) true?


Re-asking Questions

When should the system repeat or not ask a question? Example:
Query Ask? Response
? p(X) yes p(f(Z))
? p(f(c)) no
? p(a) yes yes
? p(X) yes no
? p(c) no

Don't ask a question that is more specific than a query to which either a positive answer has already been given or the user has replied no.


Delaying Asking the User


Multiple Information Sources

Asking the user is just one instance of using multiple information sources. There are many types of subgoals: Each information source has its own characteristics.


Assumptions



Chapter 6, Lecture 2


Explanation


How did the system prove a goal?


Why Did the System Ask a Question?

It is useful to find out why a question was asked.

WHY question


Debugging Knowledge Bases

There are four types of nonsyntactic errors that can arise in rule-based systems:

Debugging Incorrect Answers


Debugging Missing Answers


Debugging Infinite Loops



Chapter 6, Lecture 3


Implementing Knowledge-based Systems

To build an interpreter for a language, we need to distinguish They could even be the same language!


Implementing the base language

Let's use the definite clause language as the base language and the metalanguage.


Representing the base level constructs


Example representation

The base-level clauses

connected_to(l_1,w_0).
connected_to(w_0,w_1) <- up(s_2).
lit(L) <- light(L) & ok(L) & live(L).

can be represented as the meta-level facts

clause(connected_to(l_1,w_0),true).
clause(connected_to(w_0,w_1),up(s_2)).
clause(lit(L), oand(light(L),oand( ok(L) , live(L)))).


Making the representation pretty


Example representation

The base-level clauses

connected_to(l_1,w_0).
connected_to(w_0,w_1) <- up(s_2).
lit(L) <- light(L) & ok(L) & live(L).

can be represented as the meta-level facts

connected_to(l_1,w_0)<=true.
connected_to(w_0,w_1)<=up(s_2).
lit(L)<=light(L)&ok(L) &live(L).


Vanilla Meta-interpreter

prove(G) is true when base-level body G is a logical consequence of the base-level KB.

prove(true).
prove((A&B)) <-
     prove(A) &
     prove(B).
prove(H) <-
     (H<=B) &
     prove(B).


Example base-level KB

live(W) <=
     connected_to(W,W_1)&
     live(W_1).
live(outside)<=true.
connected_to(w_6,w_5) <=ok(cb_2).
connected_to(w_5,outside)<=true.
ok(cb_2)<=true.
? prove(live(w_6)).


Expanding the base-level

Adding clauses increases what can be proved.

Expanded meta-interpreter

prove(true).
prove((A&B)) <-
     prove(A) & prove(B).
prove((A; B)) <- prove(A).
prove((A; B)) <- prove(B).
prove((N  is E)) <-
     N  is E.
prove(H) <-
     (H<=B) & prove(B).


Depth-Bounded Search

bprove(G,D) is true if G can be proved with a proof tree of depth less than or equal to number D.

bprove(true,D).
bprove((A&B),D) <-
     bprove(A,D) & bprove(B,D).
bprove(H,D) <-
     D >= 0 & D_1isD-1 &
     (H<=B) & bprove(B,D_1).



Chapter 6, Lecture 4


Ask-the-user meta-interpreter

aprove(G) is true if G is a logical consequence of the base-level KB and yes/no answers provided by the user.

aprove(true).
aprove((A&B)) <- aprove(A) & aprove(B).
aprove(H) <- askable(H) & answered(H,yes).
aprove(H) <-
      askable(H) & unanswered(H) & ask(H,Ans) &
      record(answered(H,Ans)) & Ans=yes.
aprove(H) <- (H<=B) & aprove(B).


Meta-interpreter to collect rules for why

wprove(G,A) is true if G follows from base-level KB, and A is a list of ancestor rules for G.

wprove(true,Anc).
wprove((A&B),Anc) <-
     wprove(A,Anc) &
     wprove(B,Anc).
wprove(H,Anc) <-
     (H<=B) &
     wprove(B,[(H<=B)|Anc]).


Delaying Goals

Some goals, rather than being proved, can be collected in a list.

Delaying Meta-interpreter

dprove(G,D0,D1) is true if D0 is an ending of list of delayable atoms D1 and KB & (D1-D0) G.

dprove(true,D,D).
dprove((A&B),D_1,D_3) <-
     dprove(A,D_1,D_2) & dprove(B,D_2,D_3).
dprove(G,D,[G|D]) <- delay(G).
dprove(H,D_1,D_2) <-
     (H<=B) & dprove(B,D_1,D_2).


Example base-level KB

live(W) <=
     connected_to(W,W_1)&
     live(W_1).
live(outside)<=true.
connected_to(w_6,w_5) <=ok(cb_2).
connected_to(w_5,outside)<=ok(outside_connection).
delay(ok(X)).
? dprove(live(w_6),[],D).


Meta-interpreter that builds a proof tree

hprove(G,T) is true if G can be proved from the base-level KB, with proof tree T.

hprove(true,true).
hprove((A&B),(L&R)) <-
     hprove(A,L) &
     hprove(B,R).
hprove(H,if(H,T)) <-
     (H<=B) &
     hprove(B,T).


©David Poole, Alan Mackworth, Randy Goebel and Oxford University Press, 1998-2002