:- use_module(library(clpbn)). weather(W, 0):-{W=weather(0) with p([sunny, rain],[0.33333, 0.66666],[])}. weather(W, T):- T2 is T-1, weather(W2, T2), umbrella(U, T), {W=weather(T) with p([sunny, rain],[0.6, 0.2, 0.7, 0.1, 0.4, 0.8, 0.3, 0.9],[W2, U])}. umbrella(U, T):- {U=umbrella(T) with p([yes, no],[0.5, 0.5],[])}.