Coded function to calculate probability of a predicate given domain and
range.