A. Thomist/Augustinian account. There is a realm of necessary truths beyond God's control (that God exists, basic principles of logic, metaphysics, etc.), but God has real freedom, introducing real contingency into things. All contingent states of affairs are ultimately under God's control, and God knows them by knowing His own contingent will for them. God is impassive -- not affected in any way by the creation, only by His own active will toward the creation. There is real human freedom and other instances of secondary causation, but, in each case, it is God who determines how creatures employ their freedom. Adam freely chose to take the forbidden fruit, but it was God who determined that Adam would freely (and contingently) act in this way.
B. Molinist account. Facts divide into three categories: necessary truths, contingent facts under God's control, and contingent facts not under God's control. The third category includes facts about how finite creatures exercise their free will. God knows, not only how each creature does or will exercise its free will, but how every possible creature would exercise its free will under any possible circumstance. This is God's middle knowledge: his knowledge of conditionals of the form, "if creature A were put into circumstances C, A would freely choose to do B." These conditionals are all contingently true (if they were true of necessity, no free agent could ever act otherwise than he did), but it is not God who decides their truth or falsity. Since God knows these conditionals, although things happen that God would prefer didn't happen, He is never surprised or taken aback by any course of events, since He knew that this is how things would work out.
C. The "open theism" position. As in the Molinist position, there are three categories of fact. However, the facts beyond God's control consist only of facts about how actual creatures actually exercise their free will. There are no facts corresponding to the subjunctive conditionals mentioned above. Since there are no "middle facts" of this kind, God, despite being omniscient, lacks any middle knowledge. In creating free creatures and enabling them to act, God is always taking a real risk, "rolling dice".
A. It is possible to hold that God has no middle knowledge and yet that God knows everything that will actually happen in the future. This involves taking the so-called "block universe" view of time: the world is a four-dimensional object, time is the fourth dimension, and the past and the future are, in some sense, eternally "out there." When we refer to the present moment, we are merely referring to our location in the block universe: "now" functions very much like "here". Many defenders of foreknowledge (like the ancient Roman theologian Boethius) hold that God is "outside" time, that all moments in time are eternally present to God.
B. However, if God has foreknowledge, but lacks middle knowledge, then His foreknowledge is of absolutely no use to Him in fine-tuning His providence. God's foreknowledge includes knowledge of how He Himself will actually dispose matters -- He can't foresee that His present plan would prove disastrous and then change the plan to a more successful one. His foreknowledge is a knowledge of how He and others will in fact act in the future -- He can no more change His future actions in light of His foreknowledge than He can change His past actions in light of His memory.
The causal structure of foreknowledge works like this:
God's eternal plan -> Various human actions in time -> God's eternal foreknowledge
God's foreknowledge comes after human action in the order of causation and explanation.
The causal structure of middle knowledge works like this:
God's Middle Knowledge -> God's eternal plan -> Various human actions in time
God's knowledge of what would happen if He were to set into motion certain chains of events does not presuppose that those things actually will happen. Hence, God's middle knowledge is causally prior to the actual events in time, and it can be used by God in refining His plan.
Example: successful predictive prophecy.
In Luke 21, Jesus predicts the future destruction of Jerusalem, which occurred in 70 A.D. For God to realize a plan that includes such prophecy-fulfillment pairs and that avoids, with 100% probability, any cases of failed prophecy, He must either be in control of the events (Thomist) or have middle knowledge (Molinist). Simple foreknowledge is not enough.
In 1 AD, God foreknew that the temple would be destroyed in 70 AD. But, He also foreknew that Jesus would predict the temple's destruction in 33 AD. Thus, we cannot use God's foreknowledge of the events of 70 AD to explain the events of 33 AD (including the prophecy). God had to know that, if He were to arrange things a certain way, including the inspiration of a prophecy of this kind in 33 AD, that Jerusalem would be destroyed a few years later. This knowledge had to be independent of whether or not God actually arranged for the prophecy or not, if it is to be used to explain how and why God did inspire the prophecy. Hence, it is middle knowledge, not simple foreknowledge, that is needed to do the trick.
This argument against the efficacy of simple foreknowledge does depend on a crucial assumption: that there are no causal loops, that causation is a linear, asymmetric relation. If causal loops are possible, then it could be that God's foreknowledge of the temple's destruction was a cause of the prophecy in 33 AD, and that the prophecy in 33 AD, in turn, was part of the cause of the destruction of the temple.
Most, but not all philosophers, have rejected the possibility of causal loops. Thomistic philosophers have a compelling reason: if causal loops were possible, the creation might be self-caused, removing the need for a First Cause. In addition, causal loops threaten to lead to bizarre paradoxes, such as the paradoxical time-travel story in which the time-traveller goes back in time to kill his own father in the father's infancy. This seems to entail both that the time-traveller exists and that he does not exist.
A. Everything happens of necessity. Not even God was free to do otherwise. (Jonathan Edwards, Leibniz?) God's character and nature necessitated that He should realize the very best possible world, and this is it.
B. Everything is under God's control. There are no necessary facts. (Descartes) God could have made logical contradictions true, could have made 2+3= 4, could have made it the case that He Himself never existed. However, He did not choose to make such things the case: instead, He determined that the logical, mathematical and metaphysical principles we are acquainted with should obtain reality.
This seems to involve strange causal loops: God determined that He should exist and be all-powerful, and it is His actual existence and omnipotence that enabled Him to determine things so.