Solution (source code)

= Solution

For $\mathbb P(B)>0$, the <conditional probability> is $\mathbb P(A\mid B)=\mathbb P(A\cap B)/\mathbb P(B)$. Since the <events> $B_i$ partition the <sample space>, their intersections with $A$ are disjoint and exhaust $A$. The <law of total probability> therefore gives $\mathbb P(A)=\sum_j\mathbb P(A\mid B_j)\mathbb P(B_j)$. Substituting this and $\mathbb P(A\cap B_i)=\mathbb P(A\mid B_i)\mathbb P(B_i)$ into the definition proves <Bayes' theorem>:
$$
\boxed{\mathbb P(B_i\mid A)=\frac{\mathbb P(A\mid B_i)\mathbb P(B_i)}{\sum_j\mathbb P(A\mid B_j)\mathbb P(B_j)}.}
$$
The denominator is positive by the given hypothesis on $A$.