Computation of counterfactuals