Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
48 views13 pages

Default Reasoning and Negation As Failure in General Logic Programming

The document discusses default reasoning and negation as failure in logic programming. It covers: - Default logic syntax and semantics, using examples to illustrate how default rules derive conclusions. - Limitations of default reasoning when there are multiple possible extensions from a knowledge base. - Syntax of general logic programs, including facts, rules, queries, and negation as failure. - Clark's completion semantics, which provides a logical equivalence for declarative semantics by partitioning clauses and replacing with disjunctions and conjunctions.

Uploaded by

Zeba Anwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views13 pages

Default Reasoning and Negation As Failure in General Logic Programming

The document discusses default reasoning and negation as failure in logic programming. It covers: - Default logic syntax and semantics, using examples to illustrate how default rules derive conclusions. - Limitations of default reasoning when there are multiple possible extensions from a knowledge base. - Syntax of general logic programs, including facts, rules, queries, and negation as failure. - Clark's completion semantics, which provides a logical equivalence for declarative semantics by partitioning clauses and replacing with disjunctions and conjunctions.

Uploaded by

Zeba Anwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

Default Reasoning and

Negation As Failure
in General Logic Programming
Jacques Robin

Ontologies
Reasoning
Components
Agents
Simulations
Outline

 Default Logic
 Syntax
 Semantics
 Examples
 Limitations
 Negation As Failure (NAF) in General Logic Programming (GLP)
 GLP Syntax
 GLP Example
 GLP Declarative Logical Semantics: Clark’s Completion
 Limitation of Clark’s Completion
 GLP Operational Semantics: SLDNF Resolution
Default Reasoning (DR)

 Extends deduction with certain knowledge and inference rules


 with derivation of uncertain but plausible default assumption
knowledge and inference rules
 for environment properties not known with certainty but needed for
decision making
 Example DR inference rules:
 Closed-World Assumption (CWA)
 Inheritance with overriding
 Classical DR knowledge example:
KB: X (bird(X) > flies(X) // default knowledge
 penguin(X)  flies(X)
 pigeon(X)  bird(X)
 penguin(X)  bird(X))
 pigeon(valiant)
 penguin(tux)
KB |= flies(valiant)  flies(tux)
Default Logic: Syntax

Default  Default rule: (P:J/C) where,


drb Theory  P: prerequisite formula
Normal  J: justification formula
Default /extension
1..*
prerequisite  C: conclusion formula
Theory
And  e.g.,
ndrb
Default justification Base Logic Base /groundExtension quaker(X)
{subset drb}
Rule Formula Logic {subset extension} : (pacifist(X)  political(X))
Formula
/ pacifist(X)
conclusion
 Normal default rule: P ~> C
Normal Classical Full inv: connective.name = “and” alias for P:C/C
1..*  e.g., bird(X) ~> flies(X)
Default First-Order
Rule Logic Formula alias for
bird(X) : flies(X) / flies(X)

inv: justification = conclusion

Classical INF Classical INF Classical Full Classical Horn Classical Horn
Propositional First-Order Propositional First-Order Propositional
Logic Formula Logic Formula Logic Formula Logic Formula Logic Formula
Default Logic: Semantics
Default  Default theory K = (L,D) where
drb Theory
/extension  L = l1 ... ln
1..*
prerequisite * is an and base logic formula,
And Ls = {l1, ..., ln}, and
Default justification Base Logic Base /groundExtension
Rule Formula Logic {subset extension}  D is the default rule base
Formula
conclusion

 Extension E(K) = e1 ... em |


ei 1i m, (Ls  {c | (p:j/c  D)  p{e1, ..., em}  j{e1, ..., em}) |= ei
 (Ls) = {d1, ..., dn} defined as
 minimal superset of Ls, i.e., (Ls  (Ls))  (S, Ls  S  (Ls)  S)
 closed under entailment, i.e., f, d1 ... dn | f  f{d1, ..., dn}
 such that: p:j/c  D  p(Ls)  jLs  c(Ls)
 Ground Extension Eg(K) = g1 ... gm | Eg(K) = (Eg(K))
Default Logic: Examples

 If K1 = (L1,D1), where
L1 = (X penguin(X)  flies(X))  (X pigeon(X)  bird(X))  (X penguin(X)  bird(X)) 
pigeon(valiant)  penguin(tux)
D1 = (X bird(X) ~> flies(X))
Then E(K1) = Eg(K1) L1  flies(valiant)  flies(tux) is the sole extension of K1

If K2 = (L2,D2), where


L2 = quaker(nixon)  republican(nixon)
D2 = (X quaker(X) ~> pacifist(X))  (X republican(X) ~> pacifist(X))
Then {E1(K2) = L2  pacifist(nixon), E2(K2) = L2  pacifist(nixon)} are the two extensions of K2

 A skeptical default reasoner will derive the intersection of all extensions: Es(K2) = L2
 A credulous default reasoner will derive one of the extensions, e.g., Ec(K2) = L2 pacifist(nixon)}
 Both approaches equally problematic in such cases:
 Skeptical derivation equivalent to not leveraging default knowledge
 Credulous derivation lacks criteria to choose among alternative extensions

 If K3 = (L3,D3), where
L3 = quaker(nixon)  republican(nixon)  (X republican(X)  political(X))  republican(carter) 
quaker(carter)
 D3 = (X (quaker(X) : (pacifist(X))  political(X)) / pacifist(X))  (X republican(X) ~> pacifist(X))
Then E1(K3) = L3  pacifist(nixon)  pacifist(carter) is the sole extension of K3
General Logic Programs (GLP):
Abstract Syntax
body * predicate
gc 2..* GLP GLP FOL
GLP
Clause Literal Atom arg
head arg 1..* 1..* {disjoint,
{disjoint, complete} {disjoint, complete} FOL complete}
FOL GLP NAF Term
Fact GLP GLP Atom a Literal
Rule Query
Ground Non Non Functional
Term Ground Functional Term
2..* GLP
DLP FOL ga Term Term
DLP Ground functor
{subset gc} Clause dBody Ground
{subset body} NAF
Atom Variable Symbol
Literal
{subset a}

context Fact inv: body->IsEmpty()


context GLPQuery inv: head->IsEmpty() and body->forall(oclIsKindOf(FOLAtom) or oclIsKindOf(GLPGroundNAFLiteral))
context GLPRule inv: head->NotEmpty() and body->NotEmpty()
context GroundTerm inv: oclIsKindOf(Symbol) or arg->forall(oclIsKindOf(GroundTerm))
context GroundFOLAtom inv: arg->forall(oclIsKindOf(GroundTerm))
GLP Declarative Logical Semantics:
Clark’s Completion
 Partitions program in clause sets, each one defining one predicate
(i.e., group together clauses with same predicate c(t1, ..., tn) as
conclusion)
 Replaces each such set by a logical equivalence
 One side of this equivalence contains c(X1, ..., Xn) where X1, ..., Xn are
fresh universally quantified variables
 The other side contains a disjunction of conjunctions, one for each
original clause
 Each conjunction is either of the form:
 Xi = ci ... Xj = cj, if the original clause is a ground fact
 Yi ... Yj Xi = Yi ... Xj = Yj  p1(...) ... pk(...)  l1(...) ... ll(...)
 if the original clause is a rule with body l1(...),...,ln(...),naf l1(...),...,naf ll(...)
containing variables Yi ... Yj
 Joins all resulting equivalences in a conjunction
 Adds conjunction of the form (ci = cj) for all possible pairs (ci,cj) of
constant symbols in pure Prolog program
GLP Clark’s Completion Semantics:
Example
P: founding(X) :- on(Y,X), onGround(X).
onGround(X) :- naf offGround(X).
offGround(X) :- on(X,Y) C
B
on(c,b).
A
on(b,a).

comp(P): (A (founding(A)  (X,Y (A = X  on(Y,X)  onGround(X))) 


(A (onGround(A)  (X (A = X   offGround(X)) 
(A (offGround(A)  (X,Y (A = X  on(X,Y))) 
(U,V (on(U,V)  ((U = c  V = b)  (U = b  V = a))))
GLP Operational Semantics:
SLDNF Resolution Principle
1. Consume the query literals Q1, ..., Qn from left to right
2. For each positive literal atom Qi = a
a. Call SLD resolution of a
b. If it finitely succeeds, then go to next literal, propagating to it the
unification substitutions executed during the successful SLD resolution
c. Else, if it finitely fails, then return fail
3. For each negative literal atom Qi = naf b
a. Call SLD resolution on b
b. If it finitely succeeds, then return fail
c. Else, if it finitely fails, then go to next literal, propagating to it the
unification substitutions executed during the successful SLD resolution
GLP Operational Semantics:
SLDNF Resolution Example
P: founding(X) :- on(Y,X), onGround(X). C
onGround(X) :- naf offGround(X). B
offGround(X) :- on(X,Y) A
on(c,b).
on(b,a).
GLP Clark’s Completion Semantics:
Limitations
 Only valid for stratified GLP  Example of non-stratified GLP
 i.e., GLP with no (direct or indirect) man(X) :- human(X), naf woman(X).
recursion through naf
woman(X) :- human(X), naf man(X).
 In a GLP P,
an atom A directly depends on an atom B female(X) :- woman(X).
iff P contains one clause with A as head and human(roberta).
B in its body ? – man(roberta)
 The dependencies of a GLP can be drawn as
...
a directed graph
 The GLP is stratified iff its dependency
graph contains no loop with a naf node man(X) female(X)

naf human(X) naf

founding(X)
woman(X)
onGround(X)

Strata 1
naf
Strata 0

on(Y,X) offGround(X)
GLP Clark’s Completion Semantics:
Limitations a c

 P: b d
 Limitation 1:
edge(a,b). edge(c,d). edge(d,c). comp(P) | reachable(c).
reachable(a). comp(P) | reachable(d).
reachable(X) :- edge(Y,X), reachable(Y). reachable(c)
sink(X) :- not edge(X,Y).  (c=a  Y(edge(Y,c)  reachable(Y))
?- reachable(c)  Y edge(Y,c)  reachable(Y)
...............  reachable(d)
?- sink(b).
yes  Limitation 2 (Floundering):
?- sink(X). comp(P) | sink(b)
no
sink(b)  (b=U  V edge(V,U))
 V edge(V,U)  b=U
 comp(P):
edge(a,b)  edge(c,d)  edge(d,c) 
(Vx reachable(Vx)  (Vx = a  Vx = X 
Y (edge(Y,X)  reachable(Y)))) 
((Vu sink(Vu)  (Vu = U  V edge(V,U)))

You might also like