Gottfried Leibniz's theory of pre-established harmony (French: harmonie préétablie) is a philosophical theory about causation under which every "substance" affects only itself, but all the substances (both bodies and minds) in the world nevertheless seem to causally interact with each other because they have been programmed by God in advance to "harmonize" with each other. Leibniz's term for these substances was "monads" which he described in a popular work (Monadology §7) as "windowless".
An example:
Leibniz's theory is best known as a solution to the mind-body problem of how mind can interact with the body. However, Leibniz also rejected the idea of physical bodies affecting each other, and explained all physical causation in this way.
Under pre-established harmony, the preprogramming of each mind must be extremely complex, since only it itself causes its own thoughts or movements, for as long as it exists. In order to appear to interact, each substance's "program" must contain a description of either the entire universe, or of how the object is to behave at all times, during all "interactions" which will appear to occur.
It can also be noted that if a mind behaves as a windowless monad, there is no need for any other object to exist in order to create that mind's sense perceptions, leading to a solipsistic universe consisting only of that mind. Leibniz seems to admit this in his Discourse on Metaphysics section 14. However, he claims that his Principle of Harmony, according to which God creates the best and most harmonious world possible, dictates that the perceptions (internal states) of each monad "expresses" the world in its entirety, and the world expressed by the monad actually exists. Although Leibniz says that each monad is "windowless," he also claims that it functions as a "mirror" of the entire created universe.
On occasion, Leibniz styled himself as "the author of the system of preestablished harmony".