Nicolas Malebranche was an Oratorian priest who came upon Descartes's Treatise on Man in a bookseller's in 1664 and was reportedly so agitated by it that he had to stop reading to calm his heartbeat. He spent the next decade writing The Search After Truth, and the rest of his life defending a system that tried to make Cartesian physics and Augustinian theology one thing.
Two doctrines carry his reputation. The first is the vision in God. Descartes had left an unsolved problem: how a mind, which is thought, can represent bodies, which are extension, when the two have nothing in common. Malebranche's answer is that it does not. We do not perceive bodies, nor images of them in our own minds; we perceive the ideas of them in God, who contains the archetypes of all things and to whom our minds are directly united. Knowledge is a kind of participation in the divine understanding.
The second is occasionalism, and it has the longer afterlife. If a cause is something whose effect follows necessarily, then no finite thing is ever a cause: I cannot conceive of any necessary connection between the motion of my arm and my willing it, or between one billiard ball and another. What we call causes are occasions on which God, acting according to general laws he has laid down, produces the effect. Nothing in nature has power; power belongs to God alone.
Hume read Malebranche closely and took over the crucial premise while discarding the conclusion. His argument that we never observe necessary connection, only constant conjunction, is Malebranche's analysis with God removed — leaving custom to do the work that divine volition had done. Berkeley took the vision in God in a different direction. Leibniz argued against occasionalism as a perpetual miracle, and constructed pre-established harmony to avoid it.
His Treatise on Nature and Grace, applying the same logic of general laws to providence — God acts by simple general volitions and does not intervene case by case, which is why the innocent suffer — drew a ferocious reply from Arnauld and was placed on the Index. The theodicy Leibniz would build owes it a great deal.
