let bernoulli (p:R) : O bool := prob sample x from prob S in ((x <= p)%R).