CP-logic: A Language of Causal Probabilistic Events and Its Relation to Logic Programming