“Theodicy” is a book of philosophy by the German polymath Gottfried Leibniz published in 1710, whose optimistic approach to the problem of evil is thought to have inspired Voltaire's “Candide”. Much of the work consists of a response to the ideas of the French philosopher Pierre Bayle, with whom Leibniz carried on a debate for many years. The “Theodicy” tries to justify the apparent imperfections of the world by claiming that it is optimal among all possible worlds. It must be the best possible and most balanced world, because it was created by an all powerful and all knowing God, who would not choose to create an imperfect world if a better world could be known to him or possible to exist. In effect, apparent flaws that can be identified in this world must exist in every possible world, because otherwise God would have chosen to create the world that excluded those flaws. Leibniz distinguishes three forms of evil: moral, physical, and metaphysical. Moral evil is sin, physical evil is pain, and metaphysical evil is limitation. God permits moral and physical evil for the sake of greater goods, and metaphysical evil is unavoidable since any created universe must necessarily fall short of God's absolute perfection.