1. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Probabilistic Logic Programming
with Well-Founded Negation
Spyros Hadjichristodoulou
David S. Warren
Stony Brook University
Computer Science Department
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 1 / 25
2. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Introduction
• Negation semantics for Logic Programming
1 Clark’s completion
2 Stable Models
3 Well-Founded Semantics
• Probabilistic inference in Logic Programming
1 Independent Choice Logic
2 ProbLog
3 PRISM
• Proving things True or False with a certain probability
makes sense, but what about Undefined?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 2 / 25
3. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Introduction
• Negation semantics for Logic Programming
1 Clark’s completion
2 Stable Models
3 Well-Founded Semantics
• Probabilistic inference in Logic Programming
1 Independent Choice Logic
2 ProbLog
3 PRISM
• Proving things True or False with a certain probability
makes sense, but what about Undefined?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 2 / 25
4. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Introduction
• Negation semantics for Logic Programming
1 Clark’s completion
2 Stable Models
3 Well-Founded Semantics
• Probabilistic inference in Logic Programming
1 Independent Choice Logic
2 ProbLog
3 PRISM
• Proving things True or False with a certain probability
makes sense, but what about Undefined?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 2 / 25
5. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- ¬ shaves(Y,Y).
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
6. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- ¬ shaves(Y,Y).
Who shaves the barber?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
7. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- ¬ shaves(Y,Y).
Who shaves the barber?
shaves(barber,barber) is Undefined in WFS
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
8. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- lives close(Y),
¬ shaves(Y,Y).
lives close(Y):- dist frm barber(Y,D),
succ with prob(D).
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
9. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- lives close(Y),
¬ shaves(Y,Y).
lives close(Y):- dist frm barber(Y,D),
succ with prob(D).
Who shaves the barber, and with what probability?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
10. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- lives close(Y),
¬ shaves(Y,Y).
lives close(Y):- dist frm barber(Y,D),
succ with prob(D).
Who shaves the barber, and with what probability?
shaves(barber,barber) is Undefined with some probability,
but what does that mean?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
11. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A motivating example
shaves(barber,Y) :- lives close(Y),
¬ shaves(Y,Y).
lives close(Y):- dist frm barber(Y,D),
succ with prob(D).
Who shaves the barber, and with what probability?
shaves(barber,barber) is Undefined with some probability,
but what does that mean?
It’s inconsistent to even think about it in that
percentage of the cases
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 3 / 25
12. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Well-Founded Semantics
• Introduced in 1991 by Van Gelder, Ross and Schlipf
• 3-valued models: a predicate can be proven True, False or
Undefined
• The computation strategy is the least fixed-point of the
WP operator (alternating fixed point)
• Total vs Partial Well-Founded Models
• Even if some propositions are Undefined, the others can
still be determined as True or False
• Implemented in XSB-Prolog
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 4 / 25
13. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
p:-q.
p:-¬q.
q:-p.
q.
T0 = {}, F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
14. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 1 : interpreting negatives as False
p:-q. p:-q.
p:-¬q.
q:-p. q:-p.
q. q.
T0 = {}, F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
15. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 1 : interpreting negatives as False
p:-q. p:-q.
p:-¬q.
q:-p. q:-p.
q. q.
T = { p, q}
T0 = {}, F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
16. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 1 : interpreting negatives as False
p:-q.
p:-¬q.
q:-p.
q.
T = { p, q}
T1 = { p, q}, F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
17. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 2 : interpreting negatives as True
p:-q. p:-q.
p:-¬q. p.
q:-p. q:-p.
q. q.
T1 = { p, q}, F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
18. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 2 : interpreting negatives as True
p:-q. p:-q.
p:-¬q. p.
q:-p. q:-p.
q. q.
true = { p, q}, F = {}
T1 = { p, q}, F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
19. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 2 : interpreting negatives as True
p:-q.
p:-¬q.
q:-p.
q.
true = { p, q}, F = {}
T1 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
20. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 3 : interpreting negatives from F1
p:-q. p:-q.
p:-¬q. p:-¬q.
q:-p. q:-p.
q. q.
T1 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
21. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 3 : interpreting negatives from F1
p:-q. p:-q.
p:-¬q.
q:-p. q:-p.
q. q.
T1 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
22. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 3 : interpreting negatives from F1
p:-q. p:-q.
p:-¬q.
q:-p. q:-p.
q. q.
T = { p, q}
T1 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
23. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 3 : interpreting negatives from F1
p:-q.
p:-¬q.
q:-p.
q.
T = { p, q}
T2 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
24. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 4 : interpreting negatives from T2
p:-q. p:-q.
p:-¬q. p:-¬q.
q:-p. q:-p.
q. q.
T2 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
25. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 4 : interpreting negatives from T2
p:-q. p:-q.
p:-¬q.
q:-p. q:-p.
q. q.
T2 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
26. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 4 : interpreting negatives from T2
p:-q. p:-q.
p:-¬q.
q:-p. q:-p.
q. q.
true = { p, q}, F = {}
T2 = { p, q}, F1 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
27. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
Step 4 : interpreting negatives from T2
p:-q.
p:-¬q.
q:-p.
q.
T2 = { p, q}, F2 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
28. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
A Well-Founded Example
p:-q. T = { p, q}
p:-¬q. F = {}
q:-p. U = {}
q.
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 5 / 25
29. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
PRISM
• Developed in the early 2000’s by Sato and Kameya
• An effort to incorporate parameter learning in
probabilistic logic programs
• Only works for definite programs
• Probabilistic predicate: msw(Var,Val)
• All the possible choices of Val for each Var define the set
of possible worlds each program can run on
• Computation strategy: the least fixed point of the
consequence (TP ) operator
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 6 / 25
30. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
PRISM evaluation
p:-msw(a,1),q.
p:-msw(a,2).
q:-msw(b,1).
q:-msw(b,2),r
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 7 / 25
31. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
PRISM evaluation
World w11 ( a = 1 ∧ b = 1) :
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2).
q:-msw(b,1). q:-msw(b,1).
q:-msw(b,2),r
msw(a,1).
msw(b,1).
T = { p, q}, F = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 7 / 25
32. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
PRISM evaluation
World w12 ( a = 1 ∧ b = 2) :
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2).
q:-msw(b,1).
q:-msw(b,2),r q:-msw(b,2),r.
msw(a,1).
msw(b,2).
T = {}, F = { p, q}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 7 / 25
33. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
PRISM evaluation
World w21 ( a = 2 ∧ b = 1) :
p:-msw(a,1),q.
p:-msw(a,2). p:-msw(a,2).
q:-msw(b,1). q:-msw(b,1).
q:-msw(b,2),r
msw(a,2).
msw(b,1).
T = { p, q}, F = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 7 / 25
34. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
PRISM evaluation
World w22 ( a = 2 ∧ b = 2) :
p:-msw(a,1),q.
p:-msw(a,2). p:-msw(a,2).
q:-msw(b,1).
q:-msw(b,2),r q:-msw(b,2),r.
msw(a,2).
msw(b,2).
T = { p }, F = { q }
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 7 / 25
35. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Computing the probabilities
p:-msw(a,1),q.
w11 : a = 1 ∧ b = 1 : 1
3 ×1=
4
1
12
p:-msw(a,2).
q:-msw(b,1). w12 : a = 1 ∧ b = 2 : 1
3 ×3=
4
3
12
q:-msw(b,2),r w21 : a = 2 ∧ b = 1 : 2
3 ×1=
4
2
12
a : [1 : 1 ; 2 : 2 ]
3 3
w22 : a = 2 ∧ b = 2 : 2
3 ×3=
4
6
12
b : [1 : 1 ; 2 : 3 ]
4 4
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 8 / 25
36. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Putting it all together
Proposition Truth Value Worlds Probability
9
p True w11 , w21 , w22 12
3
p False w12 12
3
q True w11 , w21 12
9
q False w12 , w22 12
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 9 / 25
37. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM
• Our goal: to combine probability with well-founded
negation
• PRISM is a good place to start
1 Straightforward distribution semantics given by l.f.p.
of TP
2 Same syntax as pure Prolog
• But, no unconstrained negation allowed in body of
programs
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 10 / 25
38. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM
• Our goal: to combine probability with well-founded
negation
• PRISM is a good place to start
1 Straightforward distribution semantics given by l.f.p.
of TP
2 Same syntax as pure Prolog
• But, no unconstrained negation allowed in body of
programs
• Solution: use the l.f.p. of WP instead of TP !
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 10 / 25
39. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM
• Our goal: to combine probability with well-founded
negation
• PRISM is a good place to start
1 Straightforward distribution semantics given by l.f.p.
of TP
2 Same syntax as pure Prolog
• But, no unconstrained negation allowed in body of
programs
• Solution: use the l.f.p. of WP instead of TP !
• Same procedure for computing probabilities as with
PRISM, but now what is not in the True or False lists, is
considered as undefined
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 10 / 25
40. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM Example
p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p.
q:-msw(b,2).
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 11 / 25
41. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM Example
World w11 ( a = 1 ∧ b = 1) :
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p. q:-msw(b,1),p.
q:-msw(b,2).
msw(a,1).
msw(b,1).
T = {}, F = { p, q}, U = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 11 / 25
42. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM Example
World w12 ( a = 1 ∧ b = 2) :
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p.
q:-msw(b,2). q:-msw(b,2).
msw(a,1).
msw(b,2).
T = { p, q}, F = {}, U = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 11 / 25
43. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM Example
World w21 ( a = 2 ∧ b = 1) :
p:-msw(a,1),q.
p:-msw(a,2),¬q. p:-msw(a,2),¬q.
q:-msw(b,1),p. q:-msw(b,1),p.
q:-msw(b,2).
msw(a,2).
msw(b,1).
T = {}, F = {}, U = { p, q}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 11 / 25
44. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
WF-PRISM Example
World w22 ( a = 2 ∧ b = 2) :
p:-msw(a,1),q.
p:-msw(a,2),¬q. p:-msw(a,2),¬q.
q:-msw(b,1),p.
q:-msw(b,2). q:-msw(b,2).
msw(a,2).
msw(b,2).
T = {q}, F = { p}, U = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 11 / 25
45. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Computing the probabilities
p:-msw(a,1),q.
w11 : a = 1 ∧ b = 1 : 1
3 ×1=
4
1
12
p:-msw(a,2),¬q.
q:-msw(b,1),p. w12 : a = 1 ∧ b = 2 : 1
3 ×3=
4
3
12
q:-msw(b,2). w21 : a = 2 ∧ b = 1 : 2
3 ×1=
4
2
12
a : [1 : 1 ; 2 : 2 ]
3 3
w22 : a = 2 ∧ b = 2 : 2
3 ×3=
4
6
12
b : [1 : 1 ; 2 : 3 ]
4 4
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 12 / 25
46. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Putting it all together
Proposition Truth Value Worlds Probability
3
p True w12 12
7
p False w11 , w22 12
2
p Undf w21 12
9
q True w12 , w22 12
1
q False w11 12
2
q Undf w21 12
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 13 / 25
47. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
The big picture
PRISM
LP with msws
S
S
S
S
/ w
S
LP + F (w1 ) ... LP + F (wn )
l.f.p. l.f.p. l.f.p
T
?P
T
?P
T
?P
Prob of w1 ... Prob of wn
S
S
w
/
Total probability for each predicate
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 14 / 25
48. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
The big picture
WF-PRISM
LP with msws
S
S
S
S
/ w
S
LP + F (w1 ) ... LP + F (wn )
l.f.p. l.f.p. l.f.p
?
WP ?
WP ?
WP
Prob of w1 ... Prob of wn
S
S
w
/
Total probability for each predicate
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 14 / 25
49. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
50. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
• Simple
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
51. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
• Simple but naive
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
52. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
• Simple but naive
• We evaluate |W | many logic programs to compute the
final probabilities
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
53. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
• Simple but naive
• We evaluate |W | many logic programs to compute the
final probabilities
• Can we avoid doing the same computations over and
over?
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
54. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
• Simple but naive
• We evaluate |W | many logic programs to compute the
final probabilities
• Can we avoid doing the same computations over and
over?
• Yes, we can!
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
55. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Can we optimize?
• We have defined a semantics for probabilistic logic
programs with well-founded negation
• In the end of the evaluation, propositions can be True,
False or Undefined with some probability
• Approach: use the least fixed point of WP instead of TP
• Simple but naive
• We evaluate |W | many logic programs to compute the
final probabilities
• Can we avoid doing the same computations over and
over?
• Yes, we can! Annotated Well-Founded Semantics
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 15 / 25
56. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Looking a little further
• Intuition: since we only have one Logic Program, do we
really have to do |W | many runs of the l.f.p. of WP ?
• Let’s use the fact that a random variable a can only have
one value in a single world
• To do that, we will need information about possible
worlds and assignments to random variables during the
computation
• All this information is already in the msw’s in each clause
of the LP
• So instead of throwing it away while computing the l.f.p.,
use it to exclude worlds that will make variable
assignments inconsistent
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 16 / 25
57. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated Well-Founded Semantics
• Key idea: annotate each derivation of the l.f.p. of WP
with a probability, and propagate it until saturation is
reached
• Formally, we need to extend the Herbrand Base of the
program to include ⟨literal : world⟩ pairs instead of just
literals
• At each derivation step, we will infer that some
proposition is True (False) in a particular set of worlds
• In the end of the computation, literals in pairs in the T
(F) list are True (False) in the worlds described in the
pairs, and Undefined in the worlds not described by any of
the pairs in the T,F lists
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 17 / 25
58. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p.
q:-msw(b,2).
T0 = {}
F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
59. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
Step 1 : interpreting negatives as False
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p. q:-msw(b,1),p
q:-msw(b,2). q:-msw(b,2).
T0 = {}
F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
60. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
Step 1 : interpreting negatives as False
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p. q:-msw(b,1),p
q:-msw(b,2). q:-msw(b,2).
T0 = {} T = {⟨q : b2 ⟩, ⟨ p : a1 ∧ b2 ⟩}
F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
61. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
Step 1 : interpreting negatives as False
p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p.
q:-msw(b,2).
T1 = {⟨q : b2 ⟩, ⟨ p : a1 ∧ b2 ⟩} T = {⟨q : b2 ⟩, ⟨ p : a1 ∧ b2 ⟩}
F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
62. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
Step 2 : interpreting negatives as True
p:-msw(a,1),q. p:-msw(a,1),q.
p:-msw(a,2),¬q. p:-msw(a,2).
q:-msw(b,1),p. q:-msw(b,1),p
q:-msw(b,2). q:-msw(b,2).
T1 = {⟨q : b2 ⟩, ⟨ p : a1 ∧ b2 ⟩}
F0 = {}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
76. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
Step 6 : interpreting negatives from T3
p:-msw(a,1),q.
p:-msw(a,2),¬q.
q:-msw(b,1),p.
q:-msw(b,2).
T3 = {⟨q : b2 ⟩, ⟨ p : a1 ∧ b2 ⟩} true = {⟨( p : a1 ∧ b2 ) ∨ ( a2 ∧ b1 )
⟨q : b2 ∨ (b1 ∧ a2 )⟩}
F3 = {⟨ p : ( a1 ∧ b1 ) ∨ ( a2 ∧ b2 )⟩, F = {⟨ p : ( a1 ∧ b1 ) ∨ ( a2 ∧ b2 )⟩,
⟨q : a1 ∧ b1 ⟩} ⟨q : a1 ∧ b1 ⟩}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
77. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Annotated WFS - Example
p:-msw(a,1),q. T = {⟨q : b2 ⟩, ⟨ p : a1 ∧ b2 ⟩}
p:-msw(a,2),¬q. F = {⟨ p : ( a1 ∧ b1 ) ∨ ( a2 ∧ b2 )⟩,
q:-msw(b,1),p. ⟨q : a1 ∧ b1 ⟩}
q:-msw(b,2). U = {⟨ p : a2 ∧ b1 ⟩, ⟨q : a2 ∧ b1 ⟩}
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 18 / 25
78. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Adding Probabilities
• All the information we need is encoded in the derivation
process, and that makes this final step easier than before
• The format of the final True, False and Undefined lists
makes it easy to compute the probability for each literal
being True, False and Undefined
• Each list has elements of the form ⟨ p : an ∧ bm . . .⟩
• To find the probability, multiply the probabilities of each
variable together
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 19 / 25
79. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Implementation
• There is an underlying similarity between logical variables
and random variables
• In a particular world, each random variable can only have
a single value
• Prolog variables are assign-once variables
• We exploited this connection to implement WF-PRISM in
XSB-Prolog as a meta-interpreter
• XSB’s tabled WAM-style engine computes the
Well-Founded Models of a LP
• All the underlying infrastructure was there!
• We only had to do the world encoding
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 20 / 25
80. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Example
cold : - msw (a ,1) , headache .
cold : - msw (a ,2) , ¬ headache .
headache : - msw (b ,1) , cold .
headache : - msw (b ,2) .
a : [1 : 0.34; 2 : 0.66]
b : [1 : 0.25; 2 : 0.75]
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 21 / 25
81. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Example
| ? - prob ( cold , TruthValue , Probabilty ) .
TruthValue = f
Probabilty = 0.5800;
TruthValue = u
Probabilty = 0.1650;
TruthValue = t
Probabilty = 0.2550;
no
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 22 / 25
82. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Example
| ? - prob ( headache , TruthValue ,
Probabilty ) .
TruthValue = f
Probabilty = 0.0850;
TruthValue = u
Probabilty = 0.1650;
TruthValue = t
Probabilty = 0.7500;
no
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 23 / 25
83. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Yet another big picture
WF-PRISM
LP with msws
l.f.p.
AWP
?
Total probability for each predicate
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 24 / 25
84. Introduction Background Annotated Well-Founded Semantics Implementation Conclusion
Conclusion
• This presentation described extensions in 2 previous works
1 Well-Founded Semantics
2 PRISM
• Combining these extensions we build WF-PRISM which is
a probabilistic logic programming framework implemented
in XSB-Prolog
• It allows literals to be proven True, False or Undefined
with certain probabilities, giving a two-level form of
uncertainty in inference
Spyros Hadjichristodoulou David S. Warren Probabilistic Logic Programming with Well-Founded Negation 25 / 25