Solution (source code)

= Solution

The <flatness problem> is that $|\Omega-1|$ grows during ordinary decelerating expansion, so its small present value requires the early density to have been extraordinarily close to critical. The <horizon problem> is the near uniformity of regions whose past light cones do not meet in a noninflationary hot Big Bang model.

Inflation requires accelerated expansion,
$$
\boxed{\ddot a>0}.
$$
For a constant equation of state $P=w\rho$, this means $w<-1/3$; representative scale factors are $a\propto t^p$ with $p>1$ and $a\propto e^{Ht}$. Equivalently, the comoving Hubble radius $(aH)^{-1}$ decreases. Since
$$
|\Omega-1|\propto(aH)^{-2},
$$
many e-folds drive the universe toward spatial flatness. A small region that was initially in causal contact is stretched to a size far larger than the later Hubble radius, allowing the observed universe to originate from one equilibrated patch.