1 / 8

Closed World Assumption

Explore the concept of Closed World Assumption in logic programming, where what is not in the program is assumed false. Learn about negation as failure and control facilities in Prolog with examples and past exam questions.

nancyhamm
Download Presentation

Closed World Assumption

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Closed World Assumption Go through some last year exam questions

  2. Closed World Assumption In logic program, we assume that the world is closed in the sense that everything that exists is in the program or can be derived from the program. Accordingly, if something is not in the program (or cannot be derived from it) then it is not true and consequently its negation is true. This deserves special care because we do not normally assume that the world is closed

  3. An Example If we ask Prolog: ?- not human('Mary'). Prolog will probably answer ‘yes’. But this should not be understood as Prolog saying Mary is not human. What Prolog really means to say is: ‘there is not enough information in the program to prove that Mary is human’.

  4. Negation as Failure Q. How is not(Goal) implemented? A. Prolog does not try to prove this goal directly. Instead, it tries to prove the opposite, and if the opposite cannot be proved then Prolog assume that the not(Goal) succeeds. This is called negation as failure.

  5. Negation as Failure (in code) not(G):- call(G), % if G succeeds !, % then we cut % backtracking, then fail. % make not(G) fail. not(G). % otherwise, not(G) % succeeds.

  6. Two Control Facilities in Prolog: call(G) and fail • call(G) – it treats the term G as a goal, executes G as if it appeared textually in its place. For example - if_then_else(P,Q,R): if P then Q else R if_then_else(P,Q,R):- call(P), !, call(Q). if_then_else(P,Q,R):- call(R). • fail is a goal that always fails. For example – a ‘fail loop’ to print out all top boy names find_all:- boy_names(X,Y,1), write((X,Y)), nl, fail. find_all.

  7. A Program likes(ben, amy). likes(amy, ben). likes(amy, logic). likes(amy, Who):- likes(Who, logic). likes(father(Who), What):- likes(Who, What).

  8. Past Exam Questions • Discuss how to define dislikes relation by using negation by finite failure. • Explain what is meant by the closed world assumption. • What result is obtained when the goal ?- dislikes(X,Y). is executed? Justify your answer.

More Related