The dilemma of freedom and foreknowledge