A probabilistic calculus of cyber-physical systems