Very basic examples

These examples are from the slides of various tutorials on ProbLog, e.g., at IJCAI 2015

This is a tiny version of friends and smokers. Uncomment the second fact to increase the probability of the query by adding another cause.

0.8::stress(ann). % 0.4::stress(bob). 0.6::influences(ann,bob). 0.2::influences(bob,carl). smokes(X) :- stress(X). smokes(X) :- influences(Y,X), smokes(Y). query(smokes(carl)).

A small game with a biased coin and two urns with balls:

0.4 :: heads. 0.3 :: col(1,red); 0.7 :: col(1,blue). 0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue). win :- heads, col(_,red). win :- col(1,C), col(2,C). query(heads). query(win). query(col(1,_)). query(col(2,_)). evidence(col(2,green)).

An example of independent causation:

throws(john). 0.5::throws(mary). 0.8 :: break :- throws(mary). 0.6 :: break :- throws(john). query(break). query(throws(_)).

An example with two non-disjoint proofs of the query:

0.4::heads(1). 0.7::heads(2). 0.5::heads(3). win :- heads(1). win :- heads(2),heads(3). query(heads(_)). query(win).