Necessary and Sufficient Conditions for Prediction Market Accuracy