Theory of Cosmic Inflation