Thinking about a recent question mis-posted here (belonged on math), I noted the following.
A contrived example - probability that a or b are 1:
Probability[ a == 1 || b == 1, {a \[Distributed] DiscreteUniformDistribution[{0, 1}],
b \[Distributed] DiscreteUniformDistribution[{0, 1}]}]
outputs as expected 3/4. Now if one had a more complicated predicate, say ten variates involved, it would be a messy predicate to do manually. Of course, one could use various facilities to build it auto-magically, or just use something like (keeping it simple as above, but one can see how this makes extension to many variates simple):
Probability[Total[Unitize[{a, b}]] > 0, {a \[Distributed] DiscreteUniformDistribution[{0, 1}],
b \[Distributed] DiscreteUniformDistribution[{0, 1}]}]
which returns the expected result.
However, something that intuitively seems it should work, like:
Probability[
Count[{a, b}, 0] != 2, {a \[Distributed] DiscreteUniformDistribution[{0, 1}],
b \[Distributed] DiscreteUniformDistribution[{0, 1}]}]
does not, and somewhat worryingly returns a result (invalid) of 1 rather than an error or warning for an unusable predicate.
The same results occur with NProbability
.
(1) Is there any rhyme or reason around what works and what doesn't?
(2) Is there any method to get Mathematica to use such a construct directly, or at least spit back a "no can do"?