Closed World Assumption - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Closed World Assumption

Description:

In logic program, we assume that the world is closed in the sense that ... For example a fail loop' to print out all top boy names ... – PowerPoint PPT presentation

Number of Views:124
Avg rating:3.0/5.0
Slides: 7
Provided by: rong94
Category:

less

Transcript and Presenter's Notes

Title: Closed World Assumption


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.
Write a Comment
User Comments (0)
About PowerShow.com