Prime number theorem: $\#\{\text{primes} \leq x\} = (1 + o(1))\frac{x}{\log(x)}.$ Pigeonhole Principle $\implies$ among the primes${}\leq x$, there's a prime gap (at least one) $p_{n+1} - p_{n} \geq (1 - o(1))\log(x)$ where $(1 - o(1))$ is maybe some little error. An equivalent way of saying that is, $p_{n+1} - p_{n} \geq (1 - o(1))\log(p_n)$ the prime gap can be as big as small factor times $\log(p_n)$, the prime gap can be as big as logarithm of the prime (of say the first prime) infinitely often and this is an easy consequence of the prime number theorem and the pigeonhole principle.
My question is, how does the prime number theorem: (1) $\#\{\text{primes } \leq x\} = (1 + o(1))\frac{x}{\log(x)}$ when combined with the pigeonhole principle $\implies$ among the primes $\leq x$, there's a prime gap (at least one) (2) $p_{n+1} - p_{n} \geq (1 - o(1))\log(p_n)$. I know when you have x pigeons and x-1 containers so $\lceil \frac{x}{x-1} \rceil = 2$ by the pigeonhole principle. I'm confused if the $\log(x)$ was multiplied to the other side of the inequality and manipulated or how the pigeonhole principle was applied to get from (1) to (2)
Consider the number of numbers between $2$ and $x$, which is, of course $x - 1 = (1 - o(1)) x$.
Now the number of primes between $2$ and $x$ is $\pi(x)$, by definition.
Thus, the number of non-primes between 2 and x is $\pi(x) - x$.
Now each non-prime falls between two primes. That is, each non-prime between 2 and x falls between $p_i$ and $p_{i + 1}$ for exactly one $i$, where $1 \leq i \leq \pi(x)$.
So we have $\pi(x) - 1$ pidgeonholes (that is, $\pi(x) - 1$ gaps between primes) and $x - \pi(x)$ pidgeons to fill them with ($x - \pi(x)$ composite numbers). By the pidgeonhole principle, there must be some pidgeonhole with at least $\frac{\pi(x) - 1}{x - \pi(x)}$ pidgeons in it.
That is, there must be some gap between primes of size at least $\frac{\pi(x) - 1}{x - \pi(x)}$.
Thanks to the prime number theorem, we can state that $\frac{\pi(x) - 1}{x - \pi(x)} \sim \frac{\pi(x)}{x - \pi(x)} = \frac{1}{x / \pi(x) - 1} \sim \frac{1}{\frac{1}{\log x}} = \log x$.
Here, $f(x) \sim g(x)$ means $\lim\limits_{x \to \infty} \frac{f(x)}{g(x)} = 1$.
So we see that there is a gap of size at least $\sim \log(x)$ - that is, a gap of size at least $(1 - o(1)) \log x$ - between primes which are $\leq x$.