1/*
    2This program is inspired by the morphological characteristics of the Stromboli
    3Italian island.
    4The Stromboli island is located at the intersection of two geological faults,
    5one in the southwest-northeast direction, the other in the east-west direction,
    6and contains one of the three volcanoes that are active in Italy.
    7This program models the possibility that an eruption or an earthquake occurs at Stromboli.
    8
    9From
   10Elena Bellodi and Fabrizio Riguzzi. Structure learning of probabilistic logic
   11programs by searching the clause space. Theory and Practice of Logic
   12Programming, FirstView Articles, 2014
   13*/
   14:- use_module(library(pita)).   15
   16:- if(current_predicate(use_rendering/1)).   17:- use_rendering(c3).   18:- endif.   19
   20
   21:- pita.   22
   23:- begin_lpad.   24
   25eruption : 0.6 ; earthquake : 0.3 :-
   26  sudden_energy_release,
   27  fault_rupture(_).
   28% If there is a sudden energy release under the island and there is a fault
   29% rupture, then there can be an eruption of the volcano on the island with
   30% probability 0.6 or an earthquake in the area with probability 0.3
   31
   32sudden_energy_release : 0.7.
   33% The energy release occurs with probability 0.7
   34
   35fault_rupture(southwest_northeast).
   36fault_rupture(east_west).
   37% we are sure that ruptures occur in both faults
   38
   39:- end_lpad.

?- prob(eruption,Prob). % what is the probability of an eruption? % expected result 0.588 ?- prob(earthquake,Prob). % what is the probability of an earthquake? % expected result 0.357 ?- prob_bar(eruption,Prob). % what is the probability of an eruption? % expected result 0.588 ?- prob_bar(earthquake,Prob). % what is the probability of an earthquake? % expected result 0.357

*/