Spectral gaps of random graphs and applications

Abstract: We study the spectral gap of the Erdős--Rényi random graph through the connectivity threshold. In particular, we show that for any fixed $\delta > 0$ if $$p \ge \frac{(1/2 + \delta) \log n}{n},$$ then the normalized graph Laplacian of an Erdős--Rényi graph has all of its nonzero eigenvalues tightly concentrated around $1$. We estimate both the decay rate of the spectral gap to $1$ and the failure probability, up to a constant factor. We also show that the $1/2$ in the above is optimal, and that if $p = \frac{c \log n}{n}$ for $c < 1/2,$ then there are eigenvalues of the Laplacian restricted to the giant component that are separated from $1.$We then describe several applications of our spectral gap results to stochastic topology and geometric group theory. These all depend on Garland's "p-adic curvature" method, a kind of spectral geometry for simplicial complexes. These can all be considered to be high-dimensional expander properties.

\section{Introduction}

Studying the spectral properties of random matrices has played a central role in probability theory ever since Wigner's paper establishing the semi-circular law for symmetric matrices with independent centered entries above the diagonal~\cite{wigner}.  The theory of these matrices is rich and well-developed, and its techniques and theorems provide great insight into the adjacency matrix of an {Erd\H{o}s--R\'{e}nyi } random graph.

In this paper we study the normalized Laplacian matrix of the {Erd\H{o}s--R\'{e}nyi } random graph. In particular, we work with the binomial random graph $G(n,p),$ which has $n$ vertices and whose every edge is included independently with probability $p.$  For a connected graph $G,$ the normalized Laplacian has smallest eigenvalue $\lambda_1=0,$ and the remainder of its eigenvalues $\{\lambda_i\}_{i=2}^n$ lie in the interval $0 < \lambda_i \le 2$.  The spectral gap, $\lambda_2,$ is the principal quantity of interest in many applications, and it has received much attention in the literature~\cite{Chung,ChungLuVu,ChungRadcliffe,CojaOghlan}.  For the {Erd\H{o}s--R\'{e}nyi } graph, the eigenvalues $\{\lambda_i\}_{i=2}^n$ tend to cluster around $1,$ and hence we define $\lambda(G)=\max_{i \neq 1}|1-\lambda_i|.$  The quantity $1-\lambda(G)$ is sometimes referred to as the absolute gap.
The methods in the previous papers are successful in establishing the correct order for $\lambda(G)$ of $C(np)^{-1/2}$ when the density of edges is sufficiently large,
but they do not extend to $p$ very near the connectivity threshold $\log n / n$.

Our main result is as follows.
\begin{theorem}
\label{thm:ergap_giant}
Fix $\delta > 0$ and let
\(p \geq (\frac12+\delta) \log n / n\).
Let $d=p(n-1)$ denote the expected degree of a vertex.
Let $\tilde G$ be the giant component of the {Erd\H{o}s--R\'{e}nyi } graph.
For every fixed $\epsilon > 0,$
there is a constant $C=C(\delta, \epsilon),$
so that
\[
\lambda(\tilde G)< \frac{C}{\sqrt{d}}.
\]
with probability at least $1-Cn\exp(-(2-\epsilon)d)-C\exp(-d^{1/4}\log n).$
\end{theorem}

This result improves on a number of previous results. These earlier results are discussed in more detail in Section \ref{sec:rmt_background}. In brief, the state of the art is due to Coja--Oghlan \cite{CojaOghlan} who obtains gap $1-O(d^{-1/2})$ for $p \ge C \log n / n$, where $C> 0$ is a sufficiently large constant.
We are able to extend this to $C=1,$ and appropriately modifying the statement for the giant component, we extend this to $C = \tfrac12$.

We note that Theorem \ref{thm:ergap_giant} is vacuous for $p \leq \frac{1}{2} \log n / n.$
Indeed, the next result shows that for smaller values of $p,$ the gap is no longer
$1-o(1).$
\begin{theorem}
\label{thm:ergap_giant2}
For $p$ satisfying $p = \omega(\sqrt{\log n}/n)$ and $p \leq \tfrac 12 \log n / n$
\[
\lambda(\tilde G) \geq \tfrac 12,
\]
with high probability.
\end{theorem}
Here, and throughout the paper, we use ``with high probability'' (w.h.p.) to mean that the probability approaches one as the number of vertices $n \to \infty$.  We additionally use ``with overwhelming probability'' to mean that the probability approaches $1$ faster than any power of $n.$

For $p = \Omega( \sqrt{\log n}/n),$ Fountoulakis and Reed~\cite{FR} show that the mixing time is large, and hence provide a lower bound for $\lambda(\tilde G)$ in this regime.
So $G(n,p)$ has $\lambda(\tilde G)$ bounded away from $0$, but at $ \frac{1}{2} \log n / n$ there is a phase transition, and at this point $\lambda(\tilde G) = o(1)$.  The proof in fact shows that both $\lambda_2(\tilde G)$ and $\lambda_{|\tilde G|}$ are separated from $1$ by at least $\tfrac 12 - o(1).$

We also consider an {Erd\H{o}s--R\'{e}nyi } process version of the spectral gap theorem. In particular, we show that if random edges are added one at a time, at the moment of connectivity the random graph already has spectral gap $1-o(1)$. More precisely, we have the following.

\begin{theorem} \label{thm:erstop}
Let $\tau_c$ be the connection time for the {Erd\H{o}s--R\'{e}nyi } graph process $G(n,m).$  Then there is a constant $C$ so that with high probability
\[
\lambda(G(n,\tau_c)) \leq C/\sqrt{\log n}.
\]
\end{theorem}

This theorem follows immediately from Theorem~\ref{thm:stopping_time}, which contains a stronger result about the {Erd\H{o}s--R\'{e}nyi } process valid for the spectral gap of the giant component.

\section*{Applications to random topology}

As we will see, Theorem \ref{thm:ergap_giant} is extremely useful in the study of random topological spaces and random groups. We now provide several examples where this theorem yields sharp results. All of these new results depend on the  combination of the spectral gap theorem with ``Garland's method'' and its refinements by Ballman and \'Swi\k{a}tkowski \cite{BS}, and by \.Zuk \cite{Zuk,zuk2}.

\vspace{.05in}\noindent{\bf $\bullet$ Kazhdan's property (T).}
Linial and Meshulam~\cite{LM06} introduce an analogous measure $Y_2(n,p)$ to the binomial random graph for random $2$-dimensional simplicial complexes.
This is the probability distribution on all simplicial complexes with vertex set $[n]=\{1,2,\dots,n\}$, with complete $1$-skeleton (i.e.\ with all possible $n \choose 2$ edges), and such that each of the ${n \choose 3}$ possible $2$-dimensional faces are included independently with probability $p$. We use the notation $Y \sim Y_2(n,p)$ to indicate a complex drawn from this distribution.

We first prove a structure theorem for the random fundamental group, for a certain range of $p$.

\begin{theorem} \label{thm:structure}
Suppose $\delta > 0$ is fixed,
$$ p \ge \frac{ ( 1 + \delta) \log n}{n},$$
and $Y \sim Y_2(n,p)$.
Then w.h.p.\ $\pi_1(Y)$ is isomorphic to the free product of a (T) group $G$, and a free group $F$, where the free group $F$ has one generator for every isolated edge in $Y$.
\end{theorem}

As a corollary, we also show that the threshold for $\pi_1(Y)$ to have property (T) agrees precisely with the homology-vanishing threshold found by Linial and Meshulam \cite{LM06}. This is true in the strong ``hitting time'' sense.

\vspace{.05in}\noindent{\bf $\bullet$ Random $d$-dimensional simplicial complexes.}
Meshulam and Wallach further generalize the $2$-dimensional model to random $d$-dimensional complexes $Y_d(n,p)$ \cite{MW09}. Their main result is that $ p = d \log n / n$ is a sharp threshold for vanishing of cohomology $H^{d-1}(Y, {\bf k})$ where ${\bf k}$ is a finite field of field of characteristic $0$. The proof requires delicate cocycle counting arguments.

The new spectral gap results give a completely different proof of the Meshulam--Wallach theorem, in the case that $k$ is a field of characteristic $0$. The Meshulam--Wallach theorem is stronger topologically, since it can handle positive characteristic. But our new proof is very short (given the spectral gap theorem), and the result is actually sharper probabilistically. For example, we obtain ``hitting time'' results in an accompanying stochastic growth process, and also we recover a simple proof of the Poisson distribution of Betti numbers in the critical window.

\vspace{.05in}\noindent{\bf $\bullet$ Density model of random groups.}
 Antoniuk et.\ al.\ study the phase transitions that occur in the density model of random graphs \cite{densitymodel}. Using our spectral bounds instead of those in \cite{CojaOghlan} their results can be strengthened to show a hitting time result like in the case of the Meshulam--Wallach model described above.

\vspace{.05in}\noindent{\bf $\bullet$ Random flag complexes.}
Using the spectral gap theorem and Garland's method, similar cohomology vanishing results were recently obtained for a different model of random simplicial complex by the second author in \cite{flag}. As a corollary, for every $d \ge 3$, there is a wide range of $p$ for which $X(n,p)$ is rationally homotopy equivalent to a wedge of $d$-spheres.

\vspace{.05in}\noindent{\bf $\bullet$ Right-angled Coxeter groups.} Group cohomology of random right-angled Coxeter groups were studied in \cite{DK12}. Applying the same techniques as in the random flag complex paper \cite{flag}, it is shown that for a certain measure and range of parameter, random right-angled Coxeter groups are rational duality groups with high probability. This is actually a special case of a more general statement that shows that the same holds for random graph products of finite groups.

\section*{Organization}

Section \ref{sec:rmt_background} contains the background about the spectrum of the normalized Laplacian of {Erd\H{o}s--R\'{e}nyi } random graphs. Section \ref{sec:rt} does the same for our applications of our spectral results to random topology.
In Section \ref{sec:est} we show how to transfer adjacency matrix estimates to the normalized Laplacian under some assumptions on the structure of the graph.
In Section~\ref{sec:pbnds} we show that an {Erd\H{o}s--R\'{e}nyi } graph satisfies these structural conditions with high probability.
In Section~\ref{sec:proc} we show that the Linial-Meshulam process has large gap in all its codimension-2 links.
In Section~\ref{sec:cohom} we show how to apply the {Ballman--\'Swi\k{a}tkowski } criterion to prove the structure theorem for rational cohomology, and in Section~\ref{sec:propT} we show how to apply \.Zuk's criterion to prove the structure theorem for the fundamental group.
In Section~\ref{sec:KSz} we apply the Kahn-Szemer\'erdi machinery to show that the adjacency matrix of the {Erd\H{o}s--R\'{e}nyi } graph has a gap of the correct order for any $p$ with $p = \Omega( \log n / n).$
Finally, we include one appendix which proves the precise versions of the tail bounds for binomial variables that we use.

\section{Background: random matrices and spectral gaps} \label{sec:rmt_background}
One of the central problems in modern probability theory is to understand the spectrum of a Wigner matrix, a random symmetric matrix with independent, centered, variance $1$ entries.  From Wigner's celebrated semicircle law, it can be inferred that the largest eigenvalue of such a matrix is around $2\sqrt{n}.$  In fact a much stronger result is known for a large class of Wigner matrices,
for which it is seen that
\[
\lambda_1 \sim 2\sqrt{n} + Xn^{-1/6}
\]
where $X$ follows the GOE Tracy-Widom law.  When the entry distributions are $\operatorname{Bernoulli}(p)$ -- i.e. when this is the adjacency matrix of an {Erd\H{o}s--R\'{e}nyi } graph -- it was recently shown by Knowles, L. Erd\H{o}s, Yau and Yin~\cite{KEYY} that for $p \gg n^{-1/3},$ the analogous results hold for the second largest eigenvalue.

A related question, and what we need here, is to determine the ``gap'' between the first and second eigenvalues of the spectrum.  In the Wigner case these two eigenvalues will be vanishingly close.  But the entries of our matrices have nonzero, identical expectations, and this has the effect of boosting the largest eigenvalue beyond the remainder of the spectrum, producing a large gap.  Estimating this gap typically arises in the study of adjacency and Laplacian matrices of graphs, where its applications include determining the mixing time of Markov chains and quantifying the expansion properties of a graph, to name a few (see~\cite{Chung} for further applications).

We study the normalized Laplacian matrix of a graph.
A good introduction to the properties of the normalized Laplacian are available in~\cite{Chung}.
Let $\pi_+$ be the projection map onto the vertices with positive degree, let $T$ be the diagonal matrix of degrees, and let $A$ be the adjacency matrix.
The normalized Laplacian is defined as
\[
{ L} = \pi_{+} - T^{-1/2}AT^{-1/2},
\]
where $T^{-1/2}$ is taken to be $0$ in coordinates where the degree is $0.$
For the rest of the paper we let $0 =\lambda_1 \leq \lambda_2 \leq \ldots \leq \lambda_n \leq 2$ be the eigenvalues of ${ L}.$
(Note that some authors use an alternate definition of normalized Laplacian, with a $\pi_{+}$ replaced by $\operatorname{Id}$.)  The principal nontrivial property we will employ about ${ L}$ is that the dimension of the kernel is equal to the number of components of $G$.  An immediate consequence is that for a graph with multiple nontrivial components, $\lambda_2=0.$ In particular, for $p \ll \log n / n,$ the normalized Laplacian has no spectral gap. That said, it still makes sense to consider the spectral gap of ${ L}$ restricted to the giant component.

Many of the tools which were developed for estimation of the spectral gap were designed with Wigner matrices in mind, and thus their usefulness for matrices of sparse graphs is limited.  In particular, we recall the bound of F\"uredi and Koml\'os~\cite{FurediKomlos} which can be extended to show that when $p \gg \log^6 n/n,$ the spectral gap of the adjacency matrix of an {Erd\H{o}s--R\'{e}nyi } graph is of smaller order than the largest eigenvalue.  Improvements along this line of reasoning bring the range of feasible $p$ to as low as $p \gg \log^2 n/n$ \cite{Vu07, ChungLuVu}.

The global dependence alone is not enough to disturb some of the Wigner-like features of ${ L};$ especially, for $p \gg \log^2 n / n,$ the smallest positive eigenvalue of ${ L}$ is $1-o(1).$  More generally, Chung, Lu and Vu~\cite{ChungLuVu} show that
\[
\max_{ i \neq 1} |1 - \lambda_i| \leq \frac{C}{\sqrt{np}} + \text{error}.
\]
As the entries of $T^{-1/2}AT^{-1/2}$ have variance roughly on the order of $1/n^2p$, the order of this bound agrees with what is seen in the Wigner case.

The method used to prove these bounds is the trace method, i.e. estimating the expectation of high powers of the trace of a matrix.  The state-of-the-art for this method is precisely what produces the spectral gap bound in the $p \gg \log^2 n/n$ regime.  This method starts to lose effectiveness as the density of edges decreases to the connectivity threshold, where it becomes difficult to analyze the powers necessary to get the desired results.

Other methods of attack include matrix martingales, which have been used to analyze the spectra of {Erd\H{o}s--R\'{e}nyi } graphs and other related models.  See for example Oliveria~\cite{Oliveira} or Chung and Radcliffe~\cite{ChungRadcliffe}.  However, these methods have limited success in the $p = O(\log n/n)$ regime.

Finally, there is the method of Kahn and Szemer\'edi~\cite{FKSz}, first developed for bounding the spectral gap of $d$-regular graphs, which has been adapted quite successfully for estimating the spectral gap in the $p = O(\log n / n)$ regime.  Coja-Oghlan~\cite{CojaOghlan} shows that with $p \geq c \log n/n,$ the gap is $1-O(1/\sqrt{np})$ with probability $1-o(1),$ and Feige and Ofek~\cite{FeigeOfek} show an analogous claim for the adjacency matrix. This method is one component of the argument in this paper.

The spectral gap of the normalized Laplacian is strongly related to other probabilistic quantities of the graph, in particular to properties of simple random walk (see~\cite{Chung} for more details) and to the Cheeger constant.  Direct analysis of these quantities is also possible, which then implicitly give bounds on the spectral gap.
Benjamani et.\ al. take a combinatorial approach and study the Cheeger constant (also called isoperimetric constant, or conductance) throughout the evolution of the random graph process \cite{cheegerconstant}.  Likewise Fountoulakis and Reed study the mixing time of simple random walk on the giant component through the conductance~\cite{FR} in the strictly supercritical regime $\tfrac{1+\epsilon}{n} < p < \tfrac{\sqrt{\log n}}{n}.$
Ding et.\ al.\ studied probabilistic aspects of the graph including the mixing time of simple random walk on the giant component as the graph emerges from the critical window \cite{peresrandomwalk}.  All these works show that the giant component can be written as a well connected expanding core together with small (logarithmic size) graphs attached to the core.  We also employ a version of this decomposition to analyze the spectral properties of the graph.

\subsection{Gap theorem proof approach} \label{sec:gap_proof}

To bound $\max_{i > 1} \left| 1 - \lambda_i\right|$ it suffices instead to bound the spectrum of what is essentially $I - { L}.$ Given the graph $G$ with vertices $\{1,2,\dots,n\}$ we define the matrix
\[
M_{u,v} =
\begin{cases}
\frac{1}{\sqrt{\deg(u)}\sqrt{\deg(v)}}& \text{if $u$ is adjacent to $v$,}
\\
0 &\text{otherwise.}
\end{cases}
\]
Thus if all degrees are positive we have
\[M = T^{-1/2}AT^{-1/2},\]
and it is easily checked that for any vertex set $W$ of a connected component of $V$, $T^{1/2}\one_{W}$ is an eigenvector with eigenvalue one.

Like in~\cite{CojaOghlan}, we prove this theorem in part by comparison with the spectrum of the adjacency matrix, which exhibits no transition in the $p = \Omega(\log n/ n)$ regime.  The spectra of the adjacency matrix is handled by the technique of Kahn and Szemer\'erdi, and is a slight improvement over an earlier estimate of Feige and Ofek~\cite{FeigeOfek}.  Letting $S=\{x~\vert~x^t\one = 0\},$ this states that
\[
|x^tAy| \leq C\sqrt{d} \|x\|\|y\|
\]
for all $x\in S$ and all $y \in \mathbb{R}^n,$ provided $p = \Omega(\log n / n).$

When $p > (1+\epsilon) \log n / n,$ the comparison is relatively straightforward, by virtue of the fact that with high probability all the degrees in the graph are larger than $d/M$ for some sufficiently large $M$.  In particular, this means that $\|T^{-1/2}\| = O(M/\sqrt{d}).$  One must additionally show that $T^{-1/2}\one$ is nearly parallel to $\one,$ i.e. $T^{-1/2}$ nearly maps the space $S$ to itself.  In sum, these two facts show that for $x\in S,$ $T^{-1/2}x$ is still nearly in $S$ and has norm $\|T^{-1/2}x\| \leq \sqrt{M}\|x\|/\sqrt{d}.$  Thus,
\[
|x^t M x| = |(T^{-1/2}x) A (T^{-1/2}x)| \approx C\sqrt{d} \|T^{-1/2}x\|^2 = O(\|x\|^2d^{-1/2}),
\]
giving the desired result.

Likewise, when $p > \frac{\log n + (\log n)^{1/2+\delta}\log\log n}{n},$ the degree of the graph is still at least $d^{1/2+\delta}$ w.h.p.  In this case, the $T^{-1/2}$ still nearly maps $S$ to $S$, but now $\|T^{-1/2}x\| = O(d^{-1/4-\delta/2}).$  This allows one to show that
\[
\max_{i > 1} \left| 1 - \lambda_i\right| < d^{-\delta},
\]
which is essentially the approach taken by an earlier version of this paper.

To get theorems all the way down to the connectivity threshold and below, where the minimum degree drops to $0,$ an additional argument is needed.  This is because it is no longer the case that $\|T^{-1/2}\| = O(1/\sqrt{d}).$ The key structure theorem that allows the comparison to go through is an analysis of the graph structure surrounding low-degree vertices.  Precisely, we show that near the connectivity threshold, there are no edges between low-degree vertices, and low-degree vertices and do not even have shared neighbors (see Proposition~\ref{prop:key_structure}).  Thus, they are only connected through the large, high-degree core.  This is enough to ensure that the desired spectral properties persist all the way down to around $p \sim 1/2 \log n / n.$

On the other hand, below $p \sim 1/2 \log n / n,$ low-degree vertices in the giant component begin to connect with high probability.  Indeed, it is possible to show that there are even two degree $2$ vertices that connect to each other and the high-degree core.  This is enough to ensure that $\lambda_2$ of the giant component is at most a little above $\tfrac12$ and $\lambda_n$ is at least $\tfrac32.$

\section{Random topology} \label{sec:rt}

In~\cite{LM06},
Linial and Meshulam introduce an analogous measure $Y_2(n,p)$ to the binomial random graph for random $2$-dimensional simplicial complexes.
This is a probability distribution over all simplicial complexes with vertex set $[n]=\{1,2,\dots,n\}$ with complete $1$-skeleton (i.e.\ with all possible $n \choose 2$ edges). Each of the ${n \choose 3}$ possible $2$-dimensional faces are included independently with probability $p$. We use the notation $Y \sim Y_2(n,p)$ to indicate a complex drawn from this distribution.
Meshulam and Wallach~\cite{MW09} extend this definition to a $d$-dimensional complex, formed by taking the complete $(d-1)$-skeleton of the $n$-vertex simplex, and including $d$-dimensional faces independently with probability $p.$

The distributions can be made into stochastic growth processes in a natural way.
Let $Y_2(n,m)$ be the random $2$-complex that has the uniform distribution over all simplicial complexes with $n$ vertices, $n \choose 2$ edges, and exactly $m$ two-dimensional faces. In the random complex process $\{ Y_2(n,m) \}$, faces are added one at a time, uniformly randomly from all faces which have not already been chosen.  In the same way, we can define the process $\{Y_d(n,m)\}$ by including $d$-faces one at a time.

We also define a time-changed version of this process $\LMP,$ more suitable to working with the binomial complex.  Instead of including the faces one at a time, create independent $\operatorname{Exp}(1)$ clocks for every $d$-face.  When one of the clocks rings, include the corresponding face.  If we let $p(t) = 1 - e^{-t},$ then $\LMP$ has the distribution $Y_d(n,p(t)).$

\subsection{Cohomology vanishing}

The foundational work on the Linial-Meshulam complexes is a cohomological analogue of the~{Erd\H{o}s--R\'{e}nyi } connectivity theorem.
\begin{LMW}
\label{thm:LMW}
Let ${\bf k}$ be any finite field, $d \ge 2$ fixed, $f(n) \to \infty$ be any slowly growing function, and $Y \sim Y_d(n,p)$.
If
$$ p \ge \frac{d\log n + f(n)}{n},$$
then w.h.p.\ $H^{d-1}(Y, k) = 0$, and
if
$$ p \le \frac{d\log n-f(n)}{n},$$
then w.h.p.\ $H^{d-1}(Y, k) \neq 0$.
\end{LMW}
For the case that $d=2$ and ${\bf k}={\mathbb{Z}}_2,$ this is due to Linial and Meshulam~\cite{LM06}, while for the version stated, this is due to Meshulam and Wallach~\cite{MW09}.  By the universal coefficient theorem, these results imply the corresponding theorem for the cohomology with $\mathbb{Q}$ coefficients.  It remains an open problem whether or not the same theorem holds with $\mathbb{Z}$ coefficients.  It is shown by the authors in~\cite{HKP} that for $p \geq 80d\log n / n$, $H^{d-1}(Y, \mathbb{Z}) = 0$ by other techniques.

The threshold $p \sim d\log n / n$ is also the threshold for the existence of isolated $(d-1)$-faces in the complex, i.e. faces that are not included in any $d$-face.  Indeed, the presence of isolated faces is precisely the reason that the cohomology is nonzero below this threshold.  In fact, a finer statement can be made about the number of isolated $(d-1)$-faces.
\begin{lemma}
\label{lem:poisson_faces}
Let $I$ denote the number of isolated $(d-1)$ faces in $Y_d(n,p).$  Suppose that for fixed $c,$
\[
p = \frac{d \log n + c+o(1)}{n}.
\]
Then $I$ converges in law to $\operatorname{Poisson}( e^{-c}/d!).$
\end{lemma}
The proof of this lemma is standard and can be proved in the same manner as the Poisson convergence of the number of isolated vertices in $G(n,p).$  See Proposition 4.13 of~\cite{Ross}.

Using spectral techniques, we give a new proof of the Linial-Meshulam-Wallach theorem, although only with $\mathbb{Q}$ coefficients.  However, for $\mathbb{Q}$ coefficients, we also sharpen the theorem by proving a process version.  More strikingly, this theorem shows that long before the last isolated $(d-1)$-faces disappear, the only obstruction to vanishing cohomology are those isolated $(d-1)$-faces.  Its proof follows almost immediately from spectral arguments and Garland's method (see Section~\ref{sec:cohom}).

\begin{theorem} \label{thm:Hhit}
Consider the random complex process $\{ \LMP \}$.  Let $I_t$ denote the number of isolated $(d-1)$-faces in the complex at time $t.$  Fix any $\delta >0$ and define $t_0$ so $p(t_0) = (d-1+\delta)\log n / n.$  Then w.h.p.\ for all time $t \geq t_0,$
\[
H_{d-1}(\LMP, \mathbb{Q}) \cong \mathbb{Q}^{I_t}.
\]
\end{theorem}

As w.h.p. $I_{t_0} > 0$ we immediately get the following hitting time corollary.

\begin{corollary} \label{cor:Hhit} Consider the random complex process $\{ Y_d(n,m) \}$. Let
$$M_1 = \min \{ m \mid Y(n,m) \mbox{ has no isolated } (d-1)-\mbox{dimensional faces}\},$$
and let
$$M_2 = \min \{ m \mid H^{d-1}(Y(n,m), \mathbb{Q}) = 0 \}.$$
Then w.h.p.\ $M_1 = M_2$.
\end{corollary}

Further, it is standard to show at this point that the Betti numbers are asymptotically Poisson.
\begin{corollary} \label{cor:HPoisson} Suppose that for fixed $c,$
\[
p = \frac{d \log n + c+o(1)}{n}.
\]
Then $b_{d-1}(Y_d(n,p))$ converges in law to $\operatorname{Poisson}( e^{-c}/d!).$
\end{corollary}
Note that this follows immediately from Lemma~\ref{lem:poisson_faces} and Theorem~\ref{thm:Hhit}.

\subsection{The fundamental group}

For the $2$-dimensional complex, a fair bit is known about the fundamental group $\pi_1(Y).$ Babson and the first two authors find the threshold for the fundamental group to be trivial~\cite{bhk11}.
\begin{theorem} [Babson--Hoffman--Kahle]
If
$p = n^{-\alpha}$ where $\alpha < 1/2$ then w.h.p. $\pi_1(Y)$ is a nontrivial word hyperbolic group.  If $p\geq n^{-1/2}\log(n)$ then $\pi_1(Y)$ is trivial.
\end{theorem}
Cohen et al. \cite{CCFK12} show that if
$p = o ( 1/n),$
then w.h.p.\ $\pi_1(Y)$ is free.  Finally, Costa and Farber describe the cohomological dimension $\operatorname{cd} \pi_1(Y)$ in various regimes \cite{CF12,CF13}.
\begin{theorem} [Costa--Farber] Let $Y \sim Y(n,p)$, and set $p = n^{-\alpha}$.
\begin{enumerate}
\item If $\alpha > 1$ then w.h.p.\ $\operatorname{cd} \pi_1(Y) = 1$,
\item if $1 > \alpha > 3/5$ then w.h.p.\ $\operatorname{cd}  \pi_1(Y)=2$, and
\item if $3/5 > \alpha > 1/2$ then w.h.p.\ $\operatorname{cd} \pi_1(Y) = \infty$.
\end{enumerate}
\end{theorem}

For the $2$-dimensional complex, we combine the new spectral results with Garland's method to show a threshold theorem for $\pi_1(Y)$ to have property~(T).
A group $G$ is said to have property~(T) if every unitary action of $G$ on a Hilbert space that has almost invariant vectors also has a nonzero invariant vector.  The first explicit examples of expanders, due to Margulis, were constructed using Cayley graphs on quotients of (T) groups such as $SL(3,\mathbb{Z})$ \cite{Margulis}.  Conversely, expansion properties of some graphs associated to the generating set of a group can imply property~(T) (see~\cite{Zuk}).

Property~(T) has found use in many different areas of mathematics.
For example, groups with property~(T) lead to good mixing properties in ergodic theory --- a process which mixes slowly must leave some subsets almost invariant. In particular, if a group $\Gamma$ has property~(T), then every ergodic $\Gamma$ system is also strongly ergodic \cite{glasner}.  See the monograph \cite{Bekka} for a comprehensive overview of property~(T).

We show the following:
\begin{theorem} \label{thm:structure}
Suppose $\delta > 0$ is fixed,
$$ p \ge \frac{ ( 1 + \delta) \log n}{n},$$
and $Y \sim Y_2(n,p)$.
Then w.h.p.\ $\pi_1(Y)$ is isomorphic to the free product of a (T) group $G$, and a free group $F$, where the free group $F$ has one generator for every isolated edge in $Y$.
\end{theorem}

Theorem \ref{thm:structure} might be viewed as a group-theoretic analogue of the fact that for $p \ge (1/2 + \delta) \log n / n$, the random graph $G \sim G(n,p)$ is w.h.p.\ a giant component, which is an expander, and isolated vertices.

We have the following corollary of Theorem \ref{thm:structure}, which shows that the threshold for property~(T) is the same as the Linial--Meshulam theorem for vanishing of $\mathbb{Z} / 2$-homology.

\begin{corollary} \label{cor:Twin}
Let $\omega \to \infty$ as $n \to \infty$, and $Y \sim Y_2(n,p)$.
If $$p \ge \frac{2 \log{n} + \omega}{n}$$  then $\mathbb{P}[\pi_1(Y) \mbox{ has property~(T)}] \to 1$.  \label{T}
\end{corollary}

We also describe a process version of this structure theorem that holds below the connectivity threshold.

\begin{theorem} \label{thm:Thit}
Consider the random complex process $\{ \LMP \}$.  Let $\tilde F_t$ be a free group with the number of generators equal to the number of isolated edges in the complex $\LMP$.  Fix any $\delta >0$ and define $t_0$ so $p(t_0) = (1+\delta)\log n / n.$  Then w.h.p.\ for all $t \geq t_0,$
\[
\pi_1(Y_2(n,p(t))) \cong G_{t} * \tilde F_{t}
\]
where $G_t$ has property~(T).
\end{theorem}

Note that Theorem~\ref{thm:structure} follows immediately from this.
As the number of isolated edges at time $t_0$ is positive w.h.p, we get the following hitting time corollary.

\begin{corollary} \label{cor:Thit}
Consider the random complex process $\{ Y_2(n,m) \}$. Let
$$M_1 = \min \{ m \mid Y(n,m) \mbox{ has no isolated edges} \},$$
and let
$$M_2 = \min \{ m \mid \pi_1( Y(n,m) ) \mbox{ is (T)} \}.$$
Then w.h.p.\ $M_1 = M_2$.
\end{corollary}

\begin{remark}
We can additionally give an explicit Kazhdan pair for the (T) group.  Setting $S$ to be the canonical generating set based at vertex $1,$ i.e. all loops cycles of the form $1 \to x \to y \to 1$ for distinct vertices $x$ and $y,$ then $(S,\sqrt{2}(1-o(1)))$ is a Kazhdan pair (see Remark 5.5.3 of~\cite{Bekka}).
\end{remark}

\section{Spectral estimates} \label{sec:est}

In this section we give some with conditions on an arbitrary graph $G$
on $n$ vertices which facilitate a large spectral gap.   Fix positive constants $C_1, C_2, C_3$ and $M$.
In this section $d$ can be any function of $n$ with $d=d(n) \geq 1,$ and this is always satisfied by $d=(n-1)p,$ the convention taken in other sections.

Recall that $T$ is the diagonal matrix of degrees.
Let $W$ denote the set of vertices $x$ for which $\deg x > 0$
and $I$ be the number of isolated vertices in the graph.
For any set of vertices $S,$ let $\one_{S}$ denote the vector that is one in every coordinate corresponding to $S$ and $0$ elsewhere.
Let $0= \lambda_1 \leq \lambda_2 \leq \cdots \leq \lambda_{n}$ be the eigenvalues of the normalized Laplacian ${ L}[G],$ so that $\lambda_1 = \lambda_2 = \cdots = \lambda_{I+1} = 0.$
 We also define a set of vertices of small degree.
 Let
\begin{equation} \label{the fuzz}
\ensuremath{\aleph_M} = \{
v \in V ~:~
\deg(v) \leq d/M
\}.
\end{equation}

We now define four conditions that will ensure a spectral gap.
\begin{enumerate}
\item {\bf Bounded degree  (b.d.c)} Every vertex has degree at most $C_1 d.$
\item {\bf Adjacency matrix}
\[
\sup_{ \substack{ \|x\| = 1, x^t \one = 0 \\ \|y\| = 1 } } | x^tAy| \leq C_2\sqrt{d}.
\]
\item {\bf Fuzz} There are no edges between vertices of $\ensuremath{\aleph_M},$ $|\ensuremath{\aleph_M}| \leq \frac{n}{2}$ and \[ \max_{u \in \ensuremath{\aleph_M}^c} \dset{u}{\ensuremath{\aleph_M}} \leq 1.\]
\item {\bf Parallel eigenspaces}
\[
\sup_{ \substack{ \|x\| = 1, \\ x^t T^{1/2}\one_{W} = 0 } } | x^t T^{-1/2} \one_{\ensuremath{\aleph_M}^c}| \leq C_3\frac{\sqrt{n}}{d}.
\]
\end{enumerate}
With these definitions we can now state our main result on spectral gaps.
\begin{lemma}
\label{lem:deterministic}
Let $G$ be a graph on $n$ vertices and let $C_1,C_2,C_3$ and $M$ be constants.
If $G$ satisfies the four conditions above
then there is a constant $C=C(C_1,C_2,C_3,M)$ so that
\[
\max_{i > I + 1} \left| 1 - \lambda_i\right| < \frac{C}{\sqrt{d}}.
\]
\end{lemma}
\begin{proof}
Let $W$ be the set of vertices $x$ for which $\deg x > 0.$  By the spectral theorem, ${ L}$ admits a basis of orthogonal eigenvectors.  Let $v$ be a normalized eigenvector of ${ L}$ corresponding to an eigenvalue $\lambda_i$ with $i > I+1.$  Setting $l_1,l_2,\ldots, l_I$ to be the isolated vertices, a basis for the kernel of ${ L}$ is given by $\{ T^{1/2}\one, \delta_{l_1},\delta_{l_2}, \ldots, \delta_{l_I}\},$ where $\delta_a$ is $1$ in the $a^{th}$ coordinate and $0$ elsewhere.  As $v$ is orthogonal to all of these, it is orthogonal to $T^{1/2}\one_{W}.$  Hence,
\[
\left| 1 - \lambda_i\right|
=
\left| v^t T^{-1/2} A T^{-1/2} v\right|
 \leq
\sup_{\substack{ \|x\| = 1, \\ x^tT^{1/2}\one_{W}=0}}
\left|
x^t T^{-1/2} A T^{-1/2} x
\right|.
\]
As this holds for all such $i > I+1,$ it suffices to bound the right hand side.

Orthogonally decompose $T^{-1/2}x = u + v,$ where $u$ is supported on vertices in $\ensuremath{\aleph_M}^c$ and $v$ is supported on vertices in $\ensuremath{\aleph_M}.$  Further decompose $u = u_0 + u_1$ by letting $u_1$ be the projection of $u$ along $\one_{\ensuremath{\aleph_M}^c}.$
Expanding the quadratic form, we may write
\begin{equation} \label{decomposition}
\left|
x^t T^{-1/2} A T^{-1/2} x
\right|
\leq 2|u_0^tAu| + |u_1^tAu_1| + |v^tAv| + 2|v^tAu|.
\end{equation}
Each of these terms will be seen to have the right order bound, completing the proof.

As $u_0 \perp \one_{\ensuremath{\aleph_M}^c}$ and is supported only on $\ensuremath{\aleph_M}^c,$ we have that $u_0 \perp \one.$
By the definitions of $\ensuremath{\aleph_M}$ and $x,$ we have that
\[
\|u_0\|^2 \leq \|u\|^2
= \sum_{i \in \ensuremath{\aleph_M}^c} \frac{|x_i|^2}{\deg i}
\leq \frac{M}{d}.
\]
Hence by the adjacency matrix condition and the above equation
we have that
\begin{equation} \label{partone}
|u_0^tAu| \leq C_2\sqrt{d} \|u_0\| \|u\| = \frac{C_2M}{\sqrt{d}}.
\end{equation}

As $u_1$ is the projection of $u$ along $\one_{\ensuremath{\aleph_M}^c},$ we have
\[
u_1
= (u^t \one_{\ensuremath{\aleph_M}^c}) \frac{ \one_{\ensuremath{\aleph_M}^c}}{|\ensuremath{\aleph_M}^c|}
= (x^t T^{-1/2} \one_{\ensuremath{\aleph_M}^c}) \frac{ \one_{\ensuremath{\aleph_M}^c}}{|\ensuremath{\aleph_M}^c|}.
\]
Because $\ensuremath{\aleph_M}^c \geq \frac{n}{2},$ the parallel eigenspaces condition implies that we have
\(
\|u_1\| \leq \frac{\sqrt{2}C_3}{d}.
\)
The norm of $A$ is at most the maximum degree of the graph, and by the bounded degree condition this is at most $C_1d.$  Hence, we get that
\begin{equation} \label{parttwo}
|u_1^tAu_1| \leq \frac{2C_1C_3^2}{d}
\end{equation}

For the third term, we note that by the $\ensuremath{\aleph_M}$ condition there are no edges between vertices of $\ensuremath{\aleph_M},$ and hence
\begin{equation} \label{partthree}
v^tAv = 0.
\end{equation}

Finally, we may expand $v^tAu$ as
\[
v^tAu =
\sum_{i \in \ensuremath{\aleph_M}} \frac{x_i}{\sqrt{\deg i}}
\sum_{\substack{ j\in \ensuremath{\aleph_M}^c,\\ j \sim i}} u_j.
\]
By Cauchy-Schwarz, this is bounded by
\[
|v^tAu|^2 \leq
\sum_{i \in \ensuremath{\aleph_M}} \frac{1}{{\deg i}}
\biggl(\sum_{\substack{ j\in \ensuremath{\aleph_M}^c,\\ j \sim i}} u_j\biggr)^2
\leq
\sum_{i \in \ensuremath{\aleph_M}}
\sum_{\substack{ j\in \ensuremath{\aleph_M}^c,\\ j \sim i}}
\left(u_j\right)^2.
\]
Now each $j \in \ensuremath{\aleph_M}^c$ has at most one neighbor in $\ensuremath{\aleph_M}$, and hence we have
\begin{equation} \label{partfour}
\left|v^tAu\right| \leq \|u\| = \frac{\sqrt{M}}{\sqrt{d}}.
\end{equation}

Plugging (\ref{partone}), (\ref{parttwo}), (\ref{partthree}) and (\ref{partfour}) into (\ref{decomposition}) completes the proof. \end{proof}

In the remainder of this section we prove
a condition on a graph that will imply an upper bound on the spectral gap. This lemma shows that our previous argument breaks down when the set $\ensuremath{\aleph_M}$ fails to be isolated.
\begin{lemma}
\label{lem:deterministic2}
Suppose that $H$ is connected graph and that there are vertices $u,v,w,x$ for which the induced graph on $u,v,w,x$ is a path with endpoints $u$ and $x$.  Suppose further that $\deg v = \deg w = 2$  and $\deg u, \deg x \geq m.$
Let $0= \lambda_1 \leq \lambda_2 \leq \cdots \leq \lambda_{|H|}$ be the eigenvalues of the normalized Laplacian ${ L}[H],$ then
\[
\lambda_{|H|} \geq \tfrac{3}{2}
\]
and
\[
\lambda_{2} \leq \tfrac{1}{2} + O(1/\sqrt{m})
\]
\end{lemma}
\begin{proof}
For each case, we construct an appropriate approximate eigenvector.  For the first, consider vector $f$ with $f(v) = 1,$ $f(w)=-1$ and $f(y)=0$ for all other $y$.  This vector is orthogonal to $T^{1/2}\one$, the first eigenvector of ${ L}.$
Now $T^{-1/2}f$ is just $f/\sqrt{2}$ while $f^tAf = -2.$  Thus,
\[
\frac{f^tT^{-1/2}AT^{-1/2}f}{\|f\|^2} = -\frac{1}{2},
\]
and so $\lambda_{|S|} \geq 1 - \tfrac{-1}{2} = \tfrac{3}{2}.$

For the lower bound let $f$ be given by $f(v) = f(w) = 1/\sqrt{2}$ while $f(x) = -1/\sqrt{\deg x}$ and $f(u) = -1/\sqrt{\deg u}.$  Then we have $f \perp T^{1/2}\one.$  By direct computation,
\[
{f^tT^{-1/2}AT^{-1/2}f} = \frac{1}{2} - \frac{1}{\deg x} - \frac{1}{\deg u},
\]
while
\[
\|f\|^2 \leq 1 + \frac{1}{\deg x} + \frac{1}{\deg u}.
\]
Thus, combining everything, we have that
\[
\lambda_{2} \leq 1- \frac{\tfrac12 - \tfrac{2}{m}}{\sqrt{1+\frac{2}{m}}}
= \tfrac{1}{2} + O(1/\sqrt{m}).
\]
\end{proof}

\section{Probability bounds} \label{sec:pbnds}

\begin{lemma}
\label{lem:regularity}
For each $\delta >0$ and $m \geq 0,$ there is a constant $C=C(\delta, m)$ so that the following conditions hold
with probability at least $1-C\exp(-md)$ and $1-C\exp(-md^{1/4}\log n)$ respectively.
\begin{enumerate}
\item {\bf Bounded degree condition (b.d.c)} Every vertex has degree at most $C d.$
\item {\bf Discrepancy} For every pair of vertex sets $A$ and $B$, letting $e(A,B)$ denote the number of edges between the sets and $\mu(A,B) = \tfrac{|A||B|d}{n}$, one of
\begin{enumerate}
\item
$
\tfrac{e(A,B)}{\mu(A,B)} \leq C
$
\item
$
e(A,B)\log \tfrac{e(A,B)}{\mu(A,B)} \leq C( |A| \vee |B|)\log \tfrac{n}{|A| \vee |B|}
$
\item
$
|A| \leq d^{1/4}/100, |B| \leq d^{1/4}/100
$
\end{enumerate}
occurs.
\end{enumerate}
\end{lemma}

Both of these bounds are consequences of tail bounds of binomial variables, and they are relatively standard in the literature (see, e.g. \cite{FKSz},\cite{FeigeOfek},\cite{CojaOghlan}).  This one differs in that we look for more control over the order of decay of the failure probability.

\begin{proposition}
\label{prop:adj}
For each $\delta >0$ and $m \geq 0,$ there is a constant $C=C(\delta, m)$ sufficiently large so that if
\(p \geq \delta \log n / n\)
then
\[
\sup_{ \substack{ \|x\| = 1, x^t \one = 0 \\ \|y\| = 1 } } | x^tAy| \leq C\sqrt{d}
\]
with probability at least $1-C\exp(-md^{1/4}\log n) - C\exp(-md).$
\end{proposition}

This follows from the standard Kahn-Szemer\'erdi argument, and it is essentially proven in both Feige and Ofek~\cite{FeigeOfek} and the original Friedman, Kahn and Szemer\'erdi paper~\cite{FKSz}.  This version has a sharper estimate on the failure probability than~\cite{FeigeOfek}, which in turn follows from Lemma~\ref{lem:regularity}.  We will delay the proof of both this and the previous lemma to Section~\ref{sec:KSz}.

Additionally, the bounded degree condition is needed to make estimates about low degree vertices.  Recall the definition of $\ensuremath{\aleph_M}$ from (\ref{the fuzz}).
We show that this set is both small and structurally very simple for sufficiently large $M.$

\begin{proposition}
\label{prop:key_structure}
For each $\delta >0$ and each $\epsilon >0,$ if
\(p \geq  \delta \log n / n\)
 there is an $M=M(\delta,\epsilon) > 1$
\begin{enumerate}
\item $|\ensuremath{\aleph_M}| < n/(100d)$
\item $\ensuremath{\aleph_M}$ is an independent set,
\item and \( \max_{u \in \ensuremath{\aleph_M}^c} \dset{u}{\ensuremath{\aleph_M}} \leq 1\)
\end{enumerate}
with probability at least $1 - Cn\exp(-(2-\epsilon)d)- C\exp(-cn)$ for some absolute constant $c>0.$
\end{proposition}

\begin{proof}

\noindent{\emph{ (i)}} We start by estimating the size of $\ensuremath{\aleph_M},$ which we do by a simple union bound.  Namely by symmetry we have
\begin{align*}
\Pr\left[
|\ensuremath{\aleph_M}| \geq k
\right]
\leq
{n \choose k}
\Pr\left[
\deg u_i \leq d/M, 1 \leq i \leq k
\right].
\end{align*}
Let $S$ be the set of vertices $u_{k+1},\ldots,u_n,$ then we have
\[
\Pr \left[
\deg u_i \leq d/M, 1 \leq i \leq k
\right]
\leq
\Pr \left[
\dset{u_i}{S} \leq d/M, 1 \leq i \leq k
\right],
\]
which are now independent $\operatorname{Binom}(n-k,p)$ variables.  Applying Lemma~\ref{magic}, we get
\begin{align*}
\log \Pr\left[
|\ensuremath{\aleph_M}| \geq k
\right]
\leq k\left[
(1+ \log\frac{n}{k})-(d - kp) + \frac{d}{M}( 1 + \log(M))
\right].
\end{align*}
Setting $k = [n/(100d)],$ we may make $M$ sufficiently large that
\[
(1+ \log\frac{n}{k})-(d - kp) + \frac{d}{M}( 1 + \log(M)) \leq -\frac{d}{2}
\]
for all $n \geq n_0(\delta).$
Hence we have that $|\ensuremath{\aleph_M}| < n/(100d)$ with probability at least $1 - O\exp(-cn)$ for some absolute constant $c>0.$

\noindent{\emph{ (ii)}} We begin by bounding the probability that there is an edge between any two vertices of $\ensuremath{\aleph_M}.$  Note that we may assume that $d < n/100,$ lest $\ensuremath{\aleph_M} = \emptyset$ by the previous bound.

From the union bound and symmetry, we have that
\[
\Pr \left[
\ensuremath{\aleph_M} \text{ is not an independent set}
\right] \leq
n^2 \Pr \left[
v \in S, w \in S, \ebetween{v}{w}
\right].
\]
Thus it suffices to compute this probability, which we do by conditioning $\deg v = d_1$ and $\deg w = d_2.$  Note that the law of the neighborhood $N$ of $\{v,w\}$ under this conditioning is \emph{not} uniform over all such neighborhoods.  For a possible neighborhood $H$ of $\{v,w\},$ let $E(H)$ denote the number of edges in this neighborhood.  Then we have that
\[
\Pr \left[
N = H \middle\vert \deg v = d_1, \deg w = d_2
\right] = \frac{1}{Z} \left(\frac{p}{1-p}\right)^{E(H)},
\]
for a suitable normalization constant $Z.$

Thus, we have that
\begin{align*}
\Pr \left[
\ebetween{v}{w} \middle\vert \deg v = d_1, \deg w = d_2
\right]
&\leq \frac{
\Pr \left[
\ebetween{v}{w} \middle\vert \deg v = d_1, \deg w = d_2
\right]
}{
\Pr \left[
\noebetween{v}{w} \middle\vert \deg v = d_1, \deg w = d_2
\right]
} \\
&=
\frac{1-p}{p}
\frac{
{ n - 2  \choose d_1 - 1}
{ n - 2  \choose d_2 - 1}
}
{
{n - 2 \choose d_1}
{n - 2 \choose d_2}
}.
\end{align*}
As we consider only $d_1$ and $d_2$ that are less than $d / M,$ and as $d < n/100,$ we may bound this as $Cd/n$ for some absolute constant $C.$  It remains to estimate the probability that both $v$ and $w$ are in $\ensuremath{\aleph_M}.$
Hence we have
\[
\Pr\left[
\deg v \leq d/M, \deg w \leq d/M
\right]
\leq
\Pr\left[
X \leq d/M
\right]^2,
\]
where $X \sim \Binomial(n-2,p).$  Applying Lemma~\ref{magic}, we have that
\begin{equation}
\label{eq:cofuzz}
\Pr\left[
\deg v \leq d/M, \deg w \leq d/M
\right]
\leq
\exp\left[
-2d + \frac{2d}{M}( 1+ \log M + O(1) )
\right]
\end{equation}
Thus by adjusting $M$ to be sufficiently large, we have
\[
\Pr \left[
\ensuremath{\aleph_M} \text{ is not an independent set}
\right] = O(nd\exp(-(2-\epsilon/2)d)) = O(n\exp(-(2-\epsilon)d)).
\]

\noindent{\emph{ (iii)}}  This follows in much the same way as the proof of (ii).  Here though, we require that the degrees of $\ensuremath{\aleph_M}^c$ are not too large.  By Lemma~\ref{lem:regularity}, these degrees can be bounded by some $Cd$ with probability at least $1-O(\exp(-2d)),$ and so it suffices to assume it.
From the union bound and symmetry, we have that
\begin{multline*}
\Pr \left[
\exists u \in \ensuremath{\aleph_M}^c~:~\dset{u}{\ensuremath{\aleph_M}} \geq 2
~\cap~\ensuremath{ \bf{b.d.c.}}
\right] \\
\leq
n^3 \Pr \left[
u \in \ensuremath{\aleph_M}^c, v \in \ensuremath{\aleph_M}, w \in \ensuremath{\aleph_M}, \ebetween{u}{v}, \ebetween{u}{w}~\cap~\ensuremath{ \bf{b.d.c.}}
\right].
\end{multline*}
Again we condition on the degrees $\deg u = d_1, \deg v = d_2,$ and $\deg w = d_3,$ and bound
\begin{align*}
\Pr \left[
\ebetween{u}{v}, \ebetween{u}{w}
\middle\vert \deg u = d_1, \deg v = d_2, \deg w = d_3
\right] \hspace{-2in}&\hspace{2in} \\
&\leq \frac{
\Pr \left[
\ebetween{u}{v}, \ebetween{u}{w}
\middle\vert \deg u = d_1, \deg v = d_2, \deg w = d_3
\right]
}{
\Pr \left[
\noebetween{u}{v}, \noebetween{u}{w}, \noebetween{v}{w}
\middle\vert \deg u = d_1, \deg v = d_2, \deg w = d_3
\right]
} \\
&=
\left(\frac{1-p}{p}\right)^2
\frac{
{ n - 3  \choose d_1 - 2}
{ n - 3  \choose d_2 - 1}
{ n - 3  \choose d_3 - 1}
+
\frac{p}{1-p}
{ n - 3  \choose d_1 - 2}
{ n - 3  \choose d_2 - 2}
{ n - 3  \choose d_3 - 2}
}
{
{n - 3 \choose d_1}
{n - 3 \choose d_2}
{n - 3 \choose d_3}
}.
\end{align*}
As before, we have $d_1$ and $d_2$ are less than $d / M.$  As we also require the $\ensuremath{ \bf{b.d.c.}}$ to hold, we may take $d_1 \leq c_{1} d$ and as $d < n/100,$ we may bound this as $C c_{1} d^2/n^2$ for some absolute constant $C.$

From~\eqref{eq:cofuzz}, we have that
\[
\Pr\left[
v \in \ensuremath{\aleph_M}, w \in \ensuremath{\aleph_M}
\right] = O(\exp(-(2-\epsilon/2)d)),
\]
and so we conclude that
\[
\Pr \left[
\max_{u \in \ensuremath{\aleph_M}^c} \dset{u}{\ensuremath{\aleph_M}} > 1
\right] = O(n\exp(-(2-\epsilon)d)).
\]

\end{proof}

Our next lemma shows that the variance of the degree distribution is not too much larger than its expectation.

\begin{lemma}
\label{lem:T_distortion}
For each fixed $\delta >0$ and $m \geq 0,$ there is a constant $C=C(\delta, m)$ sufficiently large so that if
\(p \geq \delta \log n / n\)
then
\[
\sum_{v \in V} \left(
\deg v - d
\right)^2
\leq Cnd.
\]
with probability at least $1-C\exp(-md).$
\end{lemma}
\begin{proof}
Note that this sum is the square Euclidean norm of the vector $(A-dI)\one.$  Further, it is possible to write the norm as
\[
\| (A-dI)\one \| = \sup_{\|x\|=1} |x^t(A-dI)\one|.
\]
For any fixed vector $x$, we orthogonally decompose it as $x = v + c\one,$ where $|c| \leq 1/\sqrt{n}.$  We have that $v^t(A-dI)\one = v^tA\one,$ and so by Proposition~\ref{prop:adj}, for any $m$ there is a constant $C$ so that
\[
\sup_{\substack{\|v\|=1 \\ v^t\one = 0}} |v^tA\one| \leq C\sqrt{nd}
\]
with probability at least $1-O(\exp(-md)).$  It remains to bound $\one^t(A-dI)\one,$ which is
\[
\one^t(A-dI)\one = \left(\sum_{v \in V} \deg v\right) - nd.
\]
Note that $\sum_{v \in V} \deg v \sim 2 \Binomial( {n\choose 2}, p),$ and so by standard Chernoff bounds, we have that
\[
\Pr \left[
\left|\one^t(A-dI)\one \right| \geq t
\right] \leq C\exp( - \frac{t^2}{Cnd} )
\]
for some absolute constant $C$ and all $t \leq nd.$  By taking $t = mn\sqrt{d},$ we have that $\left|\one^t(A-dI)\one \right| \leq mn\sqrt{d}$ with probability at least $1-O(\exp(-mn))$ for sufficiently large $n.$  Recalling that $|c| \leq 1/\sqrt{n},$ we have that
\[
\left|c\one^t(A-dI)\one\right| = O(\sqrt{nd}).
\]
which completes the proof.
\end{proof}
Using the previous lemma, we show that $T^{-1/2}$ tends to map the orthogonal complement of the first eigenvector of $M$ to the approximate orthogonal complement of the first eigenvector of $A$.

\begin{lemma}
\label{lem:T_flattens}
Let $W$ be the set of vertices $x$ for which $\deg x > 0,$
and let $\ensuremath{\aleph_M}$ be as in Proposition~\ref{prop:key_structure}.
For each $\delta >0$ and $m \geq 0,$ there is a constant $C=C(\delta, m)$ sufficiently large so that if
\(p \geq \delta \log n / n\)
then
\[
\sup_{ \substack{ \|x\| = 1, \\ x^t T^{1/2}\one_{W} = 0 } } | x^t T^{-1/2} \one_{\ensuremath{\aleph_M}^c} | \leq C\frac{\sqrt{n}}{d}
\]
with probability at least $1-C\exp(-md).$
\end{lemma}
\begin{proof}
As we have that $|\ensuremath{\aleph_M}| < n/(100d)$ by Proposition~\ref{prop:key_structure}, it follows that
\[
|x^tT^{1/2}\one_{\ensuremath{\aleph_M}}| \leq \| T^{1/2}\one_{\ensuremath{\aleph_M}}\| \leq \sqrt{d|\ensuremath{\aleph_M}|} = O\left(\sqrt{n}\right).
\]
Further, we have that
\(
x^tT^{1/2}\one_{\ensuremath{\aleph_M}}
=
-x^tT^{1/2}\one_{\ensuremath{\aleph_M}^c},
\)
and hence it suffices to show that
\[
\sup_{ \substack{ \|x\| = 1, \\ x^t T^{1/2}\one = 0 } }
\left|x^t( T^{-1/2} - T^{1/2}/d)\one_{\ensuremath{\aleph_M}^c}\right|
 \leq C\frac{\sqrt{n}}{d}.
\]
Taking norms,
\[
\left|x^t( T^{-1/2} - T^{1/2}/d)\one_{\ensuremath{\aleph_M}^c}\right|
\leq
\left\|( T^{-1/2} - T^{1/2}/d)\one_{\ensuremath{\aleph_M}^c}\right\|.
\]
Squaring this norm, we get
\[
\left\|( T^{-1/2} - T^{1/2}/d)\one_{\ensuremath{\aleph_M}^c}\right\|^2
=\sum_{v \in \ensuremath{\aleph_M}^c}
\left(
\frac{1}{\sqrt{\deg v}} - \frac{\sqrt{\deg v}}{d}
\right)^2
\leq
\frac{M}{d^3} \sum_{v \in \ensuremath{\aleph_M}^c} \left(
\deg v - d
\right)^2.
\]
Lemma~\ref{lem:T_distortion} completes the proof.
\end{proof}
\subsection*{Proofs of the main theorems}

\begin{pfofthm}{Theorem~\ref{thm:ergap_giant}}
By Lemma~\ref{lem:deterministic}, the theorem follows from Lemma~\ref{lem:regularity}, Proposition~\ref{prop:adj}, Proposition~\ref{prop:key_structure}, and Lemma~\ref{lem:T_flattens}.
\end{pfofthm}

We wish to now show the lower bounds for $\lambda(\tilde{G}).$  We will use Lemma~\ref{lem:deterministic2}, and this requires that we show:
\begin{proposition}
\label{prop:handles}
If $p = \omega(\sqrt{\log n}/n)$ and $p \leq \tfrac12\log n / n$ then with high probability, there are four distinct vertices $a,b,c,d$ in the giant component for which the degrees of $a$ and $d$ are at least $np/2,$ the degrees of $b$ and $c$ are $2,$ and the induced subgraph on $(a,b,c,d)$ is a path.
\end{proposition}

We first show by the second moment method that such four-tuples $(a,b,c,d)$ exist in the graph with high probability.  We then show that with high probability, the small components have maximal degree $o(np),$ and hence these four-tuples must have been part of the giant component.

\begin{lemma}
\label{lem:handles_exist}
Suppose that $p = \omega( 1 / n)$ and that $p \leq \tfrac12\log n / n.$
Then, with high probability, there are four-tuples $(a,b,c,d)$ for which the degrees of $a$ and $d$ are at least $np/2,$ the degrees of $b$ and $c$ are $2,$ and the induced subgraph on $(a,b,c,d)$ is a path.
\end{lemma}
\begin{proof}
Define the pair of events
\begin{align*}
A(a,b,c,d) &=
\{
a \leftrightarrow b \leftrightarrow c \leftrightarrow d, \deg b = \deg c = 2
\}~\text{ and } \\
B(a,b,c,d) &= A(a,b,c,d) \cap
\{
\deg a \geq np/2, \deg d \geq np/2
\}.
\end{align*}
Set $S$ to be the number of occurrences of $B,$ i.e.
\[
S = \sum_{ [n] \choose 4 } \one[B(a,b,c,d)].
\]
We need to show that $S > 0$ with high probability.

The probability of $A$ can be explicitly calculated as
\[
\Pr \left[
A(a,b,c,d)
\right] = p^3(1-p)^{2(n-3)}.
\]
Meanwhile, conditional on $A(a,b,c,d),$ the probability of $B(a,b,c,d)$ is exactly the probability of having two vertices of degree at least $np/2 - 1$ in $G(n-2,p).$  Set $Q = \Pr\left[ X \geq np/2 \right]$ where $X\sim \Binomial(n,p).$  Note that as $np \to \infty,$ we have that $Q=1-o(1).$

Furthermore, as $np \to \infty$ we have that
\[
\Pr \left[
B(a,b,c,d) ~\middle\vert~ A(a,b,c,d)
\right] = Q^2(1-o(1)),
\]
simply by conditioning on the edge between $a$ and $d.$
By summing over all possible tuples, it follows that
\(
\mathbb{E} S = \Theta( nQ^2(np)^3e^{-2np} ) = \omega(1).
\)
\newcommand{\bvec}{
(b_i)_{i=1}^4
}
\newcommand{\avec}{
(a_i)_{i=1}^4
}

For the variance of $S$, we need to compute probabilities of the pairs $B( \avec ) \cap B( \bvec).$  Note that if $a_2 = b_2$ then the only way both can happen is if $a_i = b_i$ for all $i \in [4].$  Analogous conclusions hold if $a_2 = b_3$ or if $a_3 \in \{b_2,b_3\}.$   Thus, the only nontrivial way for the events $B( \avec)$ and $B( \bvec)$ to intersect is if
\begin{enumerate}
\item all $a_i$ and $b_i$ are distinct,
\item $a_1 = b_1$ and the rest are distinct,
\item $a_1 = b_1,$ $a_4=b_4,$ and the rest are distinct, or
\item $a_i = b_i$ for all $i.$
\end{enumerate}
Note that there's no need to consider $a_1 = b_4,$ as the event $B( \bvec )$ is preserved under reversing the $a_i.$  Set $T_i$ to be the pairs of tuples satisfying each of the $4$ cases.

If the pair is in $T_1,$ then
\[
\Pr \left[
B( \avec) \cap
B( \bvec)
\middle\vert
A( \avec) \cap
A( \bvec)
\right]
=Q^4(1-o(1))
\]
as once more, this is the statement that four vertices in $G(n-4,p)$ have degree at least $(np/2-1)$.  We also have that
\[
\Pr \left[
A( \avec) \cap
A( \bvec)
\right] = p^6(1-p)^{4n-16},
\]
so that
\[
\Pr \left[
B( \avec) \cap
B( \bvec)
\right] =
\Pr \left[
B( \avec)
\right]^2(1-o(1)).
\]
Thus the contribution of the pairs in $T_1$ to the variance of $S$ is $o( (\mathbb{E} S)^2).$

For terms from $T_2,$ the same reasoning as above shows that
\[
\Pr \left[
B( \avec) \cap
B( \bvec)
\right] = Q^3p^6(1-p)^{4n}(1-o(1))
\]
For such pairs, however, we have that $|T_2| = \Theta(n^7),$ and hence the contribution to the variance of $S$ is $o( (\mathbb{E} S)^2).$  In the same way, the contributions of $T_3$ and $T_4$ are smaller still.  As each is individually of order $o( (\mathbb{E} S)^2 )$, we have that $S>0$ with high probability.
\end{proof}

\begin{lemma}
\label{lem:giant_component_size}
Suppose that $p = \omega(1/n),$ then for any $\epsilon >0,$ the number of vertices not in the giant component is at most $n e^{-(1-\epsilon)np}$ with high probability.
\end{lemma}
\begin{proof}
Set $R$ to be the number of vertices not in the giant component.  Then $R < r$ if and only if there is no collection $W$ of at least $r$ vertices for which $W$ is disconnected from $W^c.$  The expected number $\mathbb{E} N_r$ of such collections $W$ is given by
\[
\mathbb{E} N_r
= (1-p)^{r(n-r)} { n \choose r }.
\]
Set $r_0 = n e^{-(1-\epsilon)np}.$  We will show that
\(
\sum_{r=r_0}^{n/2} \mathbb{E} N_r \to 0,
\)
which implies the lemma.

Subdivide the sum into two pieces $S_1$ and $S_2,$ given by
$S_1 = \sum_{r_0}^{\lfloor \epsilon n/4 \rfloor} \mathbb{E} N_r$
and
$S_2 = \sum_{\lfloor \epsilon n/4 \rfloor}^{n/2} \mathbb{E} N_r.$ For $\lfloor \epsilon n/4 \rfloor \leq r \leq n/2,$
\[
\mathbb{E} N_r
= (1-p)^{r(n-r)} { n \choose r }
\leq e^{-c_\epsilon n^2p} 2^n,
\]
for some $c_\epsilon > 0,$ which decays exponentially in $n$ as $np \to \infty.$  Hence $S_2 \to 0.$

As for $S_1,$ we claim that for any $\alpha > 0$ there is an $n \geq n_0(\alpha,\epsilon)$ sufficiently large so that for all $r_0 < r < \epsilon n/4,$ $\mathbb{E} N_{r+1} \leq \alpha \mathbb{E} N_r$ for all $n \geq n_0(\alpha,\epsilon).$  Estimating for these $r,$
\begin{align*}
\frac{\mathbb{E} N_{r+1}}{\mathbb{E} N_r}
&= (1-p)^{n-2r+1} \frac{n-r-1}{r+1} \\
&\leq \frac{ne^{-np+2rp} }{r}.\\
&\leq \frac{ne^{-(1-\epsilon/2)np} }{r}.\\
&\leq e^{-\epsilon np/2}.
\end{align*}
Hence, as $np \to \infty,$ this is eventually less than any positive $\alpha.$

As $S_1$ is dominated by a geometric series, and $S_1 = O( \mathbb{E} N_{r_0}).$  For this leading term, we get that
\[
\mathbb{E} N_{r_0} \leq e^{-pr_0(n-r_0)} \left( \frac{en}{r_0}\right)^{r_0}
\leq \exp\left( -\epsilon n^2pe^{-(1-\epsilon)np}(1-o(1))
\right) \to 0,
\]
completing the proof.
\end{proof}

\begin{lemma}
\label{lem:dust_degree_bound}
If $p = \omega( \sqrt{\log n}/ n),$ then with high probability, the maximum degree of the vertices not in the giant component is at most $np/100$ with high probability.
\end{lemma}
\begin{proof}

Set $R$ to be the number of vertices not in the giant component.  By Lemma~\ref{lem:giant_component_size}, we have that $R \leq ne^{-np/2}$ with high probability.  Suppose that $W$ is a fixed collection of vertices of size $r.$  Conditional on there being no edges between $W$ and $W^c,$ the law of the induced graph on $W$ is simply that of $G(r,p).$

Let $X \sim \operatorname{Binom}(r-1,p).$  Then by Lemma~\ref{maybe} there are absolute constants $c>0$ and $M > 0$ so that
\[
\Pr \left[ X > np/100 \right]
\leq \exp(-cnp\log(n/r))
\]
provided $r<n/M.$  Setting $E_W$ to be the event that $W$ and $W^c$ are not connected
\[
\Pr \left[
\max_{w \in W} \deg w > np/100 ~\middle\vert~ E_W
\right] \leq r\exp(-cnp\log(n/r)).
\]
Let $Y$ be the max degree of all vertices not in the largest component
As the previous bound holds for all $W$ in consideration, we get that
\[
\Pr \left[
Y > np/100 ~\middle\vert~ R = r
\right] \leq r\exp(-cnp\log(n/r)).
\]
This bound is monotone increasing in $r,$ and so we get that
\[
\Pr \left[
Y > np/100 ~\middle\vert~ R \leq ne^{-np/2}
\right] \leq n\exp(-c(np)^2(1-o(1)))
\]
for some absolute constant $c$.
Thus by the assumption on $np,$ the desired claim holds.
\end{proof}

\begin{pfofthm}{
Theorem~\ref{thm:ergap_giant} and
Proposition~\ref{prop:handles}
}

For Proposition~\ref{prop:handles}, the previous three Lemmas~\ref{lem:handles_exist},~\ref{lem:giant_component_size}, and~\ref{lem:dust_degree_bound} show the desired claim that there are tuples $(a,b,c,d)$ of vertices in the giant component for which $\deg a$ and $\deg d$ are at least $np/2,$ vertices $b$ and $c$ have degree $2,$ and the induced graph on these vertices is a path.

Letting $H$ be the giant component of the graph, then there is a constant $C$ so that the eigenvalues of the Laplacian of $H$ satisfy
\[
\lambda_{|H|} \geq \tfrac{3}{2}
\]
and
\[
\lambda_{2} \leq \tfrac{1}{2} + C/\sqrt{np},
\]
by Lemma~\ref{lem:deterministic2}.
\end{pfofthm}

\section{Gap process theorem} \label{sec:proc}
In this section we prove a general process-version theorem for the spectral gap below the connectivity threshold.  We recall the definition of $\LMP[t][k],$ the continuous time Linial-Meshulam process.  Let $F_k$ denote the collection of all $k$-faces of the $n$-simplex, and let $\{T_\sigma, \sigma \in F_k\}$ be an i.i.d.\ family of $\operatorname{Exp}(1)$ variables.  Define $\{\LMP[t][k], t \geq 0\}$ to be the continuous time Markov process
where $\LMP[0][k]$ is the complete $(k-1)$-skeleton of the $n$-simplex and its $k$-faces are given by
\[
F_k(\LMP[t][k]) = \{ \sigma \in F_k~:~T_\sigma \leq t\}.
\]
Thus $\LMP[t][k]$ is the complex whose $k$-faces have been born up to time $t,$ and $\LMP[\infty][k]$ is the complete $k$-skeleton of the $n$-simplex.  For $k=1,$ this recovers the standard continuous time {Erd\H{o}s--R\'{e}nyi } process.  For fixed $t,$ $\LMP[t][k]$ is the Bernoulli complex $Y_k(n,p(t))$ with $p(t) = 1 - e^{-t}.$  Let $d(t) = (n-1)p(t).$ Fix a $\delta$ with $0 < \delta < \frac12$ and define $t_0$ to be that time so that
\[
p(t_0) = \begin{cases}
(\tfrac 12 + \delta) \log n /  n & k = 1, \\
(k - 1 + \delta) \log n /  n & k > 1.
\end{cases}
\]
\begin{theorem}
\label{thm:stopping_time}
Let $\tLMP[t][k]$ denote the process that has every isolated $(k-1)$-face removed.
There is a constant $C=C(k,\delta)$ so that
with high probability
the Laplacian of every $\mbox{lk}(f)$ of
\(
{\tLMP[t][k]}
\)
has
\[
\max_{i > 1} \left| 1 - \lambda_i\right| < \frac{C}{\sqrt{d(t)}}.
\]
for all $t \geq t_0.$
\end{theorem}
Note that any isolated $(k-1)$-face creates an isolated vertex in some link and a vertex in a codimension-2 link is isolated if and only if the corresponding $(k-1)$-face is isolated.
Thus, an equivalent formulation is that every link of $\LMP[t][k]$ consists of isolated vertices and a giant component whose gap is $1-C/\sqrt{d(t)}$ for all time $t \geq t_0.$
In the higher-dimensional setting, the proof is more complicated than simply studying each link individually and taking the union bound.  The key is to study the ``low-degree'' simplices globally.  To this end, for each $\mbox{lk}(f)$ and for any $M \geq 1,$ let
\begin{equation}
\label{eq:fuzz_t}
\ensuremath{\aleph_M}[f][t]
=\{
w \in \mathcal{V}(\mbox{lk}(f))~:~ \deg_{\mbox{lk}(f)}(w) \leq d(t_0)/M
\}.
\end{equation}
Note that this makes each $\ensuremath{\aleph_M}[f][t]$ monotone decreasing in $t.$

\begin{lemma}
\label{lem:supersmall}
There is an $M=M(k,\delta)$ and an $\epsilon=\epsilon(k,\delta)$ so that
\[
\sum_{f \in F_{k-2}}\left|
\ensuremath{\aleph_M}[f][t_0]
\right|^2
\leq n^{1 - \epsilon}
\]
with overwhelming probability.
\end{lemma}
\begin{proof}
For $k=1,$ there is only one link to consider, and so it suffices to show that
\(
\left|\ensuremath{\aleph_M}[\emptyset][t_0]\right| \leq n^{1/2 - \epsilon}.
\)
For $k>1,$ we proceed by showing that for any $\epsilon$ there is an $M$ so that both
\begin{enumerate}
\item
\(
\max_{f \in F_{k-2}} \left|
\ensuremath{\aleph_M}[f][t_0]
\right|
\leq n^{\epsilon}
\)
\item
\(
\sum_{f \in F_{k-2}}\left|
\ensuremath{\aleph_M}[f][t_0]
\right|
\leq n^{1 - 2\epsilon}
\)
\end{enumerate}
hold with overwhelming probability.

The first condition follows from an identical argument to the first part of Proposition~\ref{prop:key_structure}; the $k=1$ case follows from an identical argument, and we just sketch the $k>1$ case.  As before, for any $1 > \eta > 0,$ there is an $M(\delta,\eta)$ sufficiently large so that for a fixed set of vertices $w_1,w_2,\ldots,w_{\lceil {n}^{\epsilon} \rceil},$
\[
\Pr \left[
\deg_{\mbox{lk}(f)}(w_i) \leq d(t_0)/M,~\forall~1 \leq i \leq\lceil n^{\epsilon} \rceil
\right] = O(\exp(-{n}^{\epsilon}d(t_0)(1-\eta))).
\]
This overwhelms the $O(\exp( (1-\epsilon)n^{\epsilon}\log n))$ possible choices of vertices as
\[
d(t_0)/\log n > (1+\delta)(1+o(1))
\] and $\eta$ may be chosen sufficiently small.  As there are only $O(n^{k-1})$ many links to consider, this may be taken to hold for all links simultaneously with overwhelming probability.

We now turn to the second condition.
For a fixed $(k-1)$-dimensional face $f$, let $X_f$ denote the number of $k$-faces in $\LMP[t_0][k]$ containing $f.$  Note that every degree of every link of a $(k-2)$-dimensional face of $\LMP[t_0][k]$ can be identified with some $X_f,$ and in fact we have
\[
\frac{1}{k}
\sum_{f \in F_{k-2}}\left|
\ensuremath{\aleph_M}[f][t_0]
\right|
=
\sum_{f \in F_{k-1}}
\one[X_f \leq d(t_0)/M].
\]
Thus by adjusting $\epsilon,$ it suffices to show the claim for the right hand side.
Call a collection $S$ of $(k-1)$-faces \emph{balanced} if
\[
\max_{w \in F_{k-2}} \left| \{
\sigma \in S~:~ w \subset \sigma
\}\right| \leq n^{\epsilon}.
\]
Note that for each $w \in F_{k-2},$ the collection $\{
X_{\sigma} ~:~ \sigma \in S, w \subset \sigma
\}$
can be identified with the degrees of a collection of vertices in the link $\mbox{lk}(w).$
Therefore, we may assume that the collection is balanced.

By symmetry we have
\begin{multline*}
\Pr\left[
\exists~f_1, f_2,\ldots,f_r~:~ X_{f_i} \leq d(t_0)/M,~1\leq i \leq r,~\{f_i\}~\text{balanced}
\right] \\
\leq
{ {n \choose k} \choose r}
\Pr\left[
X_{f_i} \leq d(t_0)/M, 1 \leq i \leq r,~\{f_i\}~\text{balanced}
\right].
\end{multline*}
Let $X$ denote the number of $k$-faces that contain some $f_i.$  If every $X_{f_i} \leq d(t_0)/M,$ it follows that $X \leq rd(t_0)/M.$  Each $f_i$ is contained in $n-k$ possible $k$-faces, but it may be possible that some $f_i$ and $f_j$ are both contained in a single $k$-face.  If this occurs, however, it must be that $|f_i \cap f_j|=k-1.$ In other words, each contains a common $(k-2)$-face.  Furthermore, there is at most one $k$-face that contains both $f_i$ and $f_j.$

A fixed face $f_j$ contains $k$ distinct $(k-2)$-faces $q_1,q_2,\ldots,q_k.$
As $\{f_i\}$ is balanced, each $q_l$ is contained in at most $n^{\epsilon}$ distinct $f_i.$  Thus there are at most $n^{\epsilon}k$ many $k$-faces that contain $f_j$ and some other $f_i,$ and this implies there are at least $r(n-k-n^{\epsilon}k)$ distinct possible $k$-faces that contain some $f_i.$ It follows that $X$ stochastically dominates a
\(
\operatorname{Binom}\left( \bigl\lceil r(n-k-n^{\epsilon}k)\bigr\rceil, p(t_0)\right)
\)
variable.  Applying Lemma~\ref{magic}, we get
\begin{multline*}
\Pr\left[
X_{f_i} \leq d(t_0)/M, 1 \leq i \leq r,~\{f_i\}~\text{balanced}
\right]
\leq
\Pr\left[
X \leq rd(t_0)/M
\right]
\\
\leq
\exp\left(
-r(n-k-n^{\epsilon}k)p(t_0) + \tfrac{rd(t_0)}{M}(1 + \log\tfrac{M(1+r(n-k-n^{\epsilon}k))p(t_0)}{rd(t_0)})
\right).
\end{multline*}
Thus, we get
\begin{multline*}
\log \Pr\left[
\exists~f_1, f_2,\ldots,f_r~:~ X_{f_i} \leq d(t_0)/M,~1\leq i \leq r
\right] \\
\leq r\left[
(k\log n - \log r)-d(t_0) + \frac{d(t_0)}{M}( 1 + \log(M))
\right](1+o(1)).
\end{multline*}
Since $d(t_0) \geq (k - 1 + \delta) \log n - o(1),$ we can set $r = [n^{1 - \delta/2}]$ and make $M$ sufficiently large that
\[
(k\log n - \log r)-d(t_0) + \frac{d(t_0)}{M}( 1 + \log(M))
\to -\infty.
\]
Taking $\epsilon = \delta/4,$ we have shown the desired claim.
\end{proof}

With global control on the number of exceptional vertices, the proof now reduces to essentially a union bound over all later times and links.

\begin{lemma}
\label{lem:proc_easy}
There is a constant $C=C(k)$ so that with high probability,
every $\mbox{lk}(f)$ of $\LMP[t][k]$ satisfies
\begin{enumerate}
\item {\bf Bounded degree  (b.d.c)} Every vertex has degree at most $C d(t).$
\item {\bf Adjacency matrix} The adjacency matrix of the link satisfies
\[
\sup_{ \substack{ \|x\| = 1, x^t \one = 0 \\ \|y\| = 1 } } | x^tAy| \leq C\sqrt{d(t)}.
\]
\item {\bf Parallel eigenspaces} Setting $\ensuremath{\aleph_M} = \ensuremath{\aleph_M}[f][t]$ and $T$ to be the diagonal matrix of degrees of the link,
\[
\sup_{ \substack{ \|x\| = 1, \\ x^t T^{1/2}\one_{W} = 0 } } | x^t T^{-1/2} \one_{\ensuremath{\aleph_M}^c}| \leq C\frac{\sqrt{n}}{d(t)}.
\]
\end{enumerate}
for all $t \geq t_0.$
\end{lemma}
\begin{proof}
Let $I$ be the interval $[t_1,t_2],$ where $t_0 \leq t_1 \leq t_2.$  The probability that there are two faces that appear in this interval can be bounded by
\[
\Pr \left[
\exists~\sigma_1, \sigma_2~:~T_{\sigma_1} \in I \text{ and } T_{\sigma_2} \in I
\right] \leq { n \choose k}^2 \left( p(t_2)  - p(t_1) \right)^2.
\]
Let $r$ be the smallest integer so that $p(t_0) + rn^{-2k-1} \geq 1.$
Set $p_i = p(t_0) + i n^{-2k-1}$ for all $0 \leq i < r,$
and set $p_r = 1.$
Let $t_i$ be such that $p(t_i) = p_i,$ and set $t_r = \infty.$
Note that for $t \in [t_i, t_{i+1}),$ $\LMP[t][k] \neq \LMP[t_i][k]$ and $\LMP[t][k] \neq \LMP[t_{i+1}][k]$ implies there must be two faces $\sigma_1$ and $\sigma_2$ for which $T_{\sigma_1}, T_{\sigma_2} \in [t_i,t_{i+1}).$  Hence,
\begin{align*}
\Pr \left[
\exists ~t \geq t_0 ~:~ \LMP[t][k] \neq \LMP[t_i][k]~\forall~ 0 \leq i \leq r
\right]
&\leq \sum_{i=0}^{r-1}
\Pr \left[
\exists~\sigma_1, \sigma_2~:~T_{\sigma_1}, T_{\sigma_2} \in I
\right] \\
&\leq \sum_{i=0}^{r-1}
n^{-2k-2}
\leq n^{-2}.
\end{align*}

By applying Lemma~\ref{lem:regularity},Proposition~\ref{prop:adj}, and Lemma~\ref{lem:T_flattens} with $m$ sufficiently large, we may thus assure
that there is a constant sufficiently large
that these properties occur
for all links of all $\LMP[t_i][k],$ for $0 \leq i \leq {r-1}.$
\end{proof}

\begin{lemma}
\label{lem:fuzz_process}
There is an $M=M(k,\delta)$ and a constant $C=C(M,k)$ so that with $t_1$ satisfying $p(t_1) = C \log n / n,$ all
\(
\ensuremath{\aleph_M}[f][t] = \emptyset
\)
for $t \geq t_1$ with high probability.
Further, for all $t_1 \geq t \geq t_0$ every $\mbox{lk}(f)$ of $\LMP[t][k]$ satisfies
\begin{enumerate}
\item $|\ensuremath{\aleph_M}| \leq \frac{n}{2},$
\item $\ensuremath{\aleph_M}$ is an independent set,
\item and \( \max_{u \in \ensuremath{\aleph_M}^c} \dset{u}{\ensuremath{\aleph_M}} \leq 1\)
\end{enumerate}
with $\ensuremath{\aleph_M}=\ensuremath{\aleph_M}[f][t].$
\end{lemma}
\begin{proof}
There is an $M_1$ so that this holds for $\LMP[t_0][k]$ by Proposition~\ref{prop:key_structure} and by taking the union bound over all links.  Likewise, there is an $M_2$ so that the conclusions of Lemma~\ref{lem:supersmall} holds.  Take $M$ to be the maximum of these, and note that from monotonicity, the conclusions of both the proposition and lemma hold.  As $\ensuremath{\aleph_M}[f][t]$ is monotone in $t$ also, we have that
\[
|\ensuremath{\aleph_M}[f][t]| \leq
|\ensuremath{\aleph_M}[f][t_0]| \leq
n/2
\]
is satisfied for all $n$ sufficiently large.

From a union bound and Lemma~\ref{magic}, we may choose $C=C(M,k)$ sufficiently large so that with probability going to $1,$
\[
\ensuremath{\aleph_M}[f][t_1] = \emptyset
\]
for all $f \in F_{k-2}.$

Let $\tau_i$ be the times at which the $i^{th}$ face is added to $\LMP[t][k]$ after time $t_0,$ and let $\tau_0 = t_0.$  Likewise, let $\Delta_i$ denote the $i^{th}$ face, and let $\mathscr{F}(\tau_i) = \sigma(\LMP[\tau_i][k]).$   Let $N$ denote the largest $i$ so that $\tau_i \leq C\log n / n.$ From Chernoff bounds, there are at most $100 C (\log n) n^{k}$ many $k$-dimensional faces in $\LMP[t_1][k]$ with overwhelming probability, and hence $N \leq 100 (\log n) n^k$ with overwhelming probability.

We begin by bounding the probability that a newly added face creates an edge between two vertices of $\ensuremath{\aleph_M}[f][t]$ for some $f \in F_{k-2}.$
\begin{align}
\label{eq:indset}
\Pr\left[
\exists~ u,v \in \ensuremath{\aleph_M}[f][\tau_i]~:~u,v \in \Delta_{i+1} \middle \vert \mathscr{F}(\tau_i)
\right]
&\leq
\frac{
| \ensuremath{\aleph_M}[f][\tau_i] |^2
}{
|F_k| - |\LMP[\tau_i][k]|
} \\
\notag
&\leq
\frac{
| \ensuremath{\aleph_M}[f][\tau_0] |^2
}{
|F_k| - |\LMP[t_1][k]|
}.
\end{align}
Let $E_{i,f}$ denote the event that
\begin{enumerate}
\item
\(
|\LMP[t_1][k] | \leq 100 C n^k\log n,
\)
\item
\(
\sum_{f \in F_{k-2}}
| \ensuremath{\aleph_M}[f][t_0] |^2 \leq n^{1 - \epsilon},
\)
\item there exist $u$ and $v$ in $\ensuremath{\aleph_M}[f][\tau_i]$ so that $u \in \Delta_{i+1}$ and $v \in \Delta_{i+1}.$
\end{enumerate}
By conditioning, we have that
\begin{align*}
\Pr
\left[
\cup_{i,f} E_{i,f}
\right]
&\leq
\mathbb{E}
\sum_{i=0}^N
\sum_{f \in F_{k-2}}
\frac{
| \ensuremath{\aleph_M}[f][\tau_0] |^2 \one[E_{i,f}]
}{
|F_k| - |\LMP[t_1][k]|
} \\
&\leq
\mathbb{E}
\sum_{i=0}^N
\frac{
\sum_{f \in F_{k-2}}
| \ensuremath{\aleph_M}[f][\tau_0] |^2 \one[E_{i,f}]
}{
|F_k| - 100C n^k \log n
} \\
&\leq
\mathbb{E}
\sum_{i=0}^N
\frac{
n^{1-\epsilon}\one[\LMP[t_1][k] \leq 100Cn^k\log n]
}{
|F_k| - 100C n^k \log n
} \\
&\leq
\frac{
{(100Cn^k\log n)}
n^{1-\epsilon}
}{
|F_k| - 100C n^k \log n
} = O(n^{-\epsilon} \log n).
\end{align*}
Thus with high probability, no face added between $t_0$ and $t_1$ creates an edge between two elements of any $\ensuremath{\aleph_M}[f][t].$

We now turn to bounding the probability that a newly added face connects an element of $\ensuremath{\aleph_M}[f][t]$ to a neighbor of $\ensuremath{\aleph_M}[f][t].$  Let $\mathcal{N}_M^f(t)$ be the set of neighbors of $\ensuremath{\aleph_M}[f][t],$ and let $D(t)$ be an upper bound for the degree of a vertex of any link of $\LMP[t][k].$  Note that
\(
|\mathcal{N}_M^f(t)| \leq D(t) | \ensuremath{\aleph_M}[f][t] |.
\)
Then
\begin{align*}
\Pr\left[
\exists~ u\in \ensuremath{\aleph_M}[f][\tau_i],
v\in \mathcal{N}_M^f(t)
~:~u,v \in \Delta_{i+1} \middle \vert \mathscr{F}(\tau_i)
\right]
\leq
\frac{
D(\tau_i)| \ensuremath{\aleph_M}[f][\tau_i] |^2
}{
|F_k| - |\LMP[\tau_i][k]|
}.
\end{align*}
With high probability, there is a constant $K$ so that all the degrees can be bounded by $K \log n$ for all $t \leq t_1.$  This failure probability is at most a logarithmic factor more than the failure probability in~\eqref{eq:indset}.  Hence the same proof shows that with high probability, no added face increases
\[
\max_{u \in \mathcal{V}(\mbox{lk}(f)) \setminus \ensuremath{\aleph_M}[f][t]} e(u,\ensuremath{\aleph_M}[f][t]).
\]
\end{proof}

\begin{pfofthm}{Theorem~\ref{thm:stopping_time}}
We are essentially ready to apply Lemma~\ref{lem:deterministic}.  The only concern is that in~\eqref{eq:fuzz_t}, the set $\ensuremath{\aleph_M}[f][t]$ is defined in terms of $d(t_0)$ and not $d(t).$  However, as noted in Lemma~\ref{lem:fuzz_process}, all these sets disappear once $p(t_1)=C\log n / n,$ at which point $d(t)$ has only risen by a factor of $K=\frac{p(t_1)}{p(t_0)}.$  Thus,
\[
Q^f(t) = \{
w \in \mathcal{V}(\mbox{lk}(f))~:~ \deg_{\mbox{lk}(f)}(w) \leq d(t)/KM
\}
\subseteq \ensuremath{\aleph_M}[f][t],
\]
for all $t \leq t_1,$ and by monotonicity, all the desired properties of $\ensuremath{\aleph_M}[f][t]$ transfer to $Q^f(t).$
Thus Lemmas~\ref{lem:proc_easy} and~\ref{lem:fuzz_process} show all the needed properties of
Lemma~\ref{lem:deterministic} apply, completing the proof.
\end{pfofthm}

\section{Cohomology structure theorem} \label{sec:cohom}

The structure theorem for cohomology relies on the following theorem of {Ballman--\'Swi\k{a}tkowski }~\cite{BS}.

\begin{BSC} \label{thm:BStool}
If \( \Delta \) is a finite, pure \(d\)-dimensional simplicial complex,
so that for every $(d-2)$-dimensional face $\sigma,$
the normalized Laplacian $L= L [\mbox{lk}(\sigma) ]$ satisfies
\(
\lambda_2  > 1- \frac{1}{d}
\)
then \(H^{d-1}(\Delta, \mathbb{Q}) =0.\)
\end{BSC}

\begin{proof}[Proof of Theorem~\ref{thm:Hhit}]
Recall that we define $t_0$ so that $p(t_0) = (d-1+\delta)\log n / n.$  Let $\tilde{Y_t}$ denote the simplicial complex $\LMP$ with all its isolated $(d-1)$-faces deleted.
By Theorem~\ref{thm:stopping_time}, w.h.p. for all $t \geq t_0$, all links of $\tilde{Y_t}$ have $\lambda_2(L) = 1-o(1).$

We need to check that $\tilde{Y_t}$ is pure $d$-dimensional, i.e. that every face is contained in some $d$-dimensional face.  Note that this can only fail if there is some $(d-2)$-dimensional face of $\LMP[t]$ that is not contained in any $d$-dimensional face.  As this is a monotone property, it suffices to check that $\LMP[t_0]$ has no such $(d-2)$-faces.

Put $I$ to be the number of isolated $(d-2)$-faces in $\LMP[t_0].$  Then
\[
\mathbb{E} I = {n \choose d-1} (1-p(t_0))^{ n^2/2}(1-o(1)),
\]
which decays exponentially in $n.$  Hence, $\tilde{Y_t}$ is pure $d$-dimensional for all $t \geq t_0$, and so Theorem~\ref{thm:BStool} applies.  It follows that $H^{d-1}( \tilde{Y_t}, \mathbb{Q}) = 0,$ and it remains to compare $H^{d-1}( \tilde{Y_t}, \mathbb{Q})$ and $H^{d-1}( \LMP, \mathbb{Q}).$

For what remains, fix $t \geq t_0.$
It will follow from induction that each additional $(d-1)$-face we glue to $\tilde{Y}$ increases the dimension of the $(d-1)$ cohomology by $1.$  Let $Z$ be the complex formed by including one of the isolated $(d-1)$-faces of $Y$ back into $\tilde{Y}.$  Let $B$ be a neighborhood of the included $(d-1)$ face that is homotopic to a single $(d-1)$-simplex.  Then the Mayer-Vietoris sequence (see Chapter 3 of~\cite{Hatcher}) for the $(d-1)$-dimensional cohomology is
\[
\cdots
\rightarrow
H^{d-1}(Z,\mathbb{Q})
\rightarrow
H^{d-1}(\tilde{Y},\mathbb{Q}) \oplus
H^{d-1}(B,\mathbb{Q})
\rightarrow
H^{d-1}(\tilde{Y} \cap B,\mathbb{Q})
\rightarrow
H^{d}(Z,\mathbb{Q}).
\]
As \(\tilde{Y} \cap B\) is homotopic to a $(d-2)$-dimensional sphere,
\( H^{d-1}(\tilde{Y} \cap B,\mathbb{Q}) = 0 \).  Also,
\(H^{d-1}(B,\mathbb{Q}) = \mathbb{Q} \), and so this sequence becomes
\[
0
\rightarrow
H^{d-1}(Z,\mathbb{Q})
\rightarrow
H^{d-1}(\tilde{Y},\mathbb{Q}) \oplus \mathbb{Q}
\rightarrow
0,
\]
or otherwise stated,
\( H^{d-1}(Z,\mathbb{Q}) \cong
H^{d-1}(\tilde{Y},\mathbb{Q}) \oplus \mathbb{Q} \).  Each additional isolated $(d-1)$-faces increases the dimension by one by the very same argument, which completes the proof.
\end{proof}

\section{Property (T)} \label{sec:propT}

The proof here is nearly identical to the proof of the cohomology vanishing structure theorem.
To establish our results concerning property (T) of random fundamental groups, we will use the following theorem of \.Zuk.

\begin{Zuk} \label{thm:tool}
If $X$ is a pure $2$-dimensional locally-finite simplicial complex so that for every vertex $v$, the vertex link $\mbox{lk}(v)$ is connected and the normalized Laplacian $L= L [\mbox{lk}(v) ]$ satisfies $\lambda_2(L) > 1/2$, then $\pi_1(X)$ has property~(T).
\end{Zuk}

\begin{proof}[Proof of Theorem \ref{thm:structure}]

Recall that we define $t_0$ so that $p(t_0) = (d-1+\delta)\log n / n.$  Let $\tilde{Y_t}$ denote the simplicial complex $\LMP$ with all its isolated edges deleted.
By Theorem~\ref{thm:stopping_time}, w.h.p. for all $t \geq t_0$, all links of $\tilde{Y_t}$ have $\lambda_2(L) = 1-o(1).$  Then by \.Zuk's criterion, $\pi_1(\tilde{Y_t})$ has property~(T) for all $t \geq t_0.$

Fix $t \geq t_0.$
It only remains to compare the fundamental groups $\pi_1(\tilde{Y})$ and $\pi_1(Y)$. But attaching a $1$-cell to a connected CW complex $W$ adds a free $\mathbb{Z}$-factor to the fundamental group $\pi_1(W)$, by the Seifert--van Kampen theorem (see Theorem 1.20 of~\cite{Hatcher}). So we only need to check that deleting all the isolated edges in $Y$ does not result in a disconnected complex $\tilde{Y}$.

Removing less than $n-1$ edges from the complete graph $K_n$ can not disconnect it; indeed, to separate a component of order $k$ form the rest of the graph requires removing at least $k(n-k)$ edges, which is minimized when $k=1$.  Thus we need only check that the number of isolated edges is fewer than $n-1.$  From monotonicity, it suffices to show that at time $t_0$ the number of isolated edges is w.h.p. $o(n).$

By linearity of expectation, the expected number of edges deleted $\mathbb{E}[D]$ is given by
\begin{align*}
\mathbb{E}[D] &= { n \choose 2} (1 - p(t_0) )^{n-2}\\
& \le \frac{1}{2} n^2 \exp ( -p(t_0) (n-2) )\\
& \le O \left( n^{1-c} \right)
\end{align*}
for some constant $c > 0$.  By the second moment method, for example, $D$ is tightly concentrated around its mean, so w.h.p.\ $\tilde{Y}$ is connected. The claim follows.
\end{proof}

Corollary \ref{cor:Twin} quickly follows.

\begin{proof}[Proof of Corollary \ref{cor:Twin}]
Let $I$ denote the number of isolated edges. The expected number of isolated edges $\mathbb{E}[I]$ is
\begin{align*}
\mathbb{E} [i] &= {n \choose 2} (1 - p)^{n-2} \leq n^2 e^{-np}
\end{align*}
Taking $p = (2\log n + f(n))/n,$ where $f(n) \to \infty,$ this is seen to go to $0,$ completing the proof.
\end{proof}

\section{Kahn-Szemer\'erdi argument}
\label{sec:KSz}

We begin with a proof of the regularity conditions.
\begin{pfofthm}{Lemma \ref{lem:regularity}}
For any vertex $v,$
$\deg(v)$ is a binomial random variable with mean $d>\delta \log(n)$. By Lemma \ref{maybe},
\(
\mathbb{P}(\deg(v)>c_{0}  d) \leq \exp\left(-\tfrac{d c_{0}  \log c_{0} }{3}\right)
\)
provided $c_{0} > 4.$
Thus taking the union bound over all vertices, we get that
\[
\Pr\left[
\ensuremath{ \bf{b.d.c.}} \text{ fails }
\right] \leq \exp( d (\tfrac{1}{\delta}-\tfrac{c_{0}  \log c_{0} }{3})).
\]
By taking $c_{0}$ sufficiently large, we may take
\[
\frac{1}{\delta}-\frac{c_{0}  \log c_{0} }{3} \leq -m,
\]
completing the proof of the first claim.

We will now turn to showing the discrepancy property, for which we need to show there are constants $c_i=c_i(\delta,m)$ so that
\begin{enumerate}
\item
$
\tfrac{e(A,B)}{\mu(A,B)} \leq c_{1}
$
\item
$
e(A,B)\log \tfrac{e(A,B)}{\mu(A,B)} \leq c_{2}( |A| \vee |B|)\log \tfrac{n}{|A| \vee |B|}
$
\item
$
|A| \vee |B| \leq d^{1/4}/100
$
\end{enumerate}
Note that these properties are monotone in $c_i$, and so we are free to increase the constants as need be throughout the proof.

Let $D$ be the event that the discrepancy condition fails and let $D(A,B)$ be the event that the discrepancy condition fails for sets $A$ and $B$. Then by the union bound
\begin{eqnarray*}
\mathbb{P}(D)
&\leq& \mathbb{P}(\exists A,B \text{ with $|A| \wedge |B|\geq n/e$}): D(A,B) \text{ occurs})\\
&+& \mathbb{P}(\exists A,B \text{ with $|A| \vee |B| \geq n/e \geq |A| \wedge |B|$}): D(A,B) \text{ occurs})\\
&+&\sum_{A,B: \ |A| \vee |B|< n/e}\mathbb{P}(D(A,B))
\end{eqnarray*}
Taking $c_{1} > e^2$, then
when $|A| \wedge |B| \geq \tfrac{n}{e},$
\[
e(A,B)>c_{1} \mu(A,B)>c_{1} (n/e)^2d/n>nd.
\]
Thus, there are at least $nd$ edges in the graph. The distribution of the number of edges is binomial with mean $n(n-1)p/2=nd/2$, and so the probability of this is going to zero exponentially in $nd$, i.e.
\begin{equation} \label{verystupid}
\mathbb{P}(\exists A,B \text{ with $|A| \wedge |B|\geq n/e$}): D(A,B) \text{ occurs})= O(\exp(-cnd))
\end{equation}
for some absolute constant $c >0.$

If $|A| \vee |B| \geq \tfrac{n}{e}> |A| \wedge |B|,$
and if the bounded degree condition holds, then
$e(A,B) \leq (|A| \vee |B|)c_{0} d$ and
\[
\frac{e(A,B)}{\mu(A,B,n)} \leq \frac{c_{0} nd(|A| \vee |B|)}{|A||B|d} = \frac{c_{0} n}{|A| \wedge |B|} \leq c_{0} e
\]
Thus taking $c_{1} > c_{0} e$, we have that
\begin{eqnarray}
\mathbb{P}(\exists A,B \text{ with $|A| \vee |B| \geq n/e \geq |A| \wedge |B|$}): D(A,B) \text{occurs})
&\leq& \mathbb{P}(\ensuremath{ \bf{b.d.c.}} \text{fails}) \nonumber\\
&=&O(\exp(-md)). \label{twoam}
\end{eqnarray}

Now we need to deal with the case that both $A$ and $B$ are less than $\tfrac{n}{e},$ but at least one is greater than $d^{1/4}/100.$  Take $c_{2} > 18 + 1200m.$  For emphasis, we will write $\mu(A,B,n)=\mu(A,B) = \frac{|A||B|d}{n}.$ Choose $r=r(A,B,n)=c_{1}  \vee r_1$ where $r_1$ is the solution to
\[
\mu(A,B,n) r_1\log(r_1) = c_{2}(|A| \vee |B|)\log \tfrac{n}{|A| \vee |B|}.
\]

For any $A$, $B$  and $n$ we must have either
\begin{itemize}
\item $e(A,B) \leq r \mu (A,B,n)$ and $r =c_{1} $
\item $e(A,B) \leq r \mu (A,B,n)$ and $r =r_1$ or
\item $e(A,B)>r \mu(A,B,n)$
\end{itemize}
Thus if $D(A,B)$ occurs then at least one of the following three events occur.
\begin{itemize}
\item $D_1=D_1(A,B)=\bigg\{e(A,B)\leq r \mu(A,B,n),\,  r=c_{1}  \text{ and }\\
{} \hspace{1.9in} e(A,B)> c_{1}  \mu(|A|,|B|,n) \bigg\}$
\item $D_2=D_2(A,B)=\bigg\{e(A,B)\leq r{\mu(A,B,n)}, r=r_1 \text{ and } \\
{} \hspace{1.9in} e(A,B)\log \tfrac{e(A,B)}{\mu(A,B,n)}>
c_{2} (|A| \vee |B|)\log \tfrac{n}{|A| \vee |B|}\bigg\}$
\item $D_3=D_3(A,B)=\{e(A,B)>r \mu(A,B,n)\}$
\end{itemize}

For $D_1$ the conditions are mutually exclusive as $e(A,B)$ can not be
simultaneously greater than and less than or equal to $c_{1} \mu(A,B,n)$. Thus $D_1(A,B)$ is empty.
For $D_2$ we get similar contradiction after a little work.
\begin{eqnarray*}
e(A,B) \log\tfrac{e(A,B)}{\mu(A,B,n)}
&>&c_{2} (|A|\vee |B|)\log \tfrac{n}{|A| \vee |B|}\\
e(A,B) \log\tfrac{e(A,B)}{\mu(A,B,n)}
&>& \mu(A,B,n)r_1\log r_1 \\
\tfrac{e(A,B)}{\mu(A,B,n)} \log\tfrac{e(A,B)}{\mu(A,B,n)}
&>& r_1 \log r_1\\
\tfrac{e(A,B)}{\mu(A,B,n)}  &>& r_1 \\
e(A,B)  &>& r_1 \mu(A,B,n) \\
e(A,B)  &>& r \mu(A,B,n).
\end{eqnarray*}
This is a contradiction so $D_2(A,B)$ is also empty.

Now we bound $\mathbb{P}(D_3(A,B)).$
As $e(A,B)$ is binomial with mean at most $\mu(A,B,n)$, Lemma \ref{maybe} implies
\[
\mathbb{P}(D_3(A,B)) \leq \exp\left(-\tfrac{\mu(|A|,|B|,n) r \log r}{3}\right)
\]
for any $r\geq 4.$

For all $A,B$ we have $D \subset D_1 \cup D_2 \cup D_3$ and $\mathbb{P}(D_1(A,B))=\mathbb{P}(D_2(A,B))=0$. Combining this with (\ref{verystupid}) and (\ref{twoam}) we get
\begin{eqnarray*}
\mathbb{P}(D)
& \leq & \mathbb{P}(\exists A,B:\ D(A,B) \text{ occurs})\\
& \leq & \mathbb{P}(\exists A,B:\ |A|,|B|<n/e \text{ and } D(A,B) \text{ occurs})+O(\exp(-md))\\
& \leq & \mathbb{P}(\exists A,B:\ |A|,|B|<n/e \text{ and } D_3(A,B) \text{ occurs})+O(\exp(-md))\\
& \leq &
\sum_{|A|,|B|}\mathbb{P}(D_3(A,B)) +O(\exp(-md)) \\
& \leq &
\sum_{a,b} \sum_{|A|=a,|B|=b}
\exp\left(-\tfrac{\mu r \log r}{3}\right) +O(\exp(-md))\\
& \leq & \sum_{a,b}
{n \choose a} {n\choose b}\exp\left(-\tfrac{\mu(a,b,n) r \log r}{3}\right) +O(\exp(-md)),
\end{eqnarray*}
where the sums are over all pairs $(a,b)$ with $d^{1/4}/100 \leq a \vee b \leq n/e.$
To evaluate the last term we get
\begin{eqnarray*}
\tfrac{\mu r \log r}{3}
& \geq &\bigg(6 + 400m\bigg)\bigg((|A| \vee |B|) \log\tfrac{n}{|A| \vee |B|}\bigg)\\
& > &
\bigg(2+2+2+(400m))\bigg)\bigg((|A|\vee |B|) \log\tfrac{n}{|A|\vee|B|}\bigg)\\
& >&
2|A|( \log\tfrac{n}{|A|})
+2|B|( \log\tfrac{n}{|B|})
+2\log n
+4md^{1/4}\log\tfrac{100n}{d^{1/4}}
\\
& >&
|A|(1 + \log\tfrac{n}{|A|})
+|B|(1 + \log\tfrac{n}{|B|})
+2\log n
+3md^{1/4}\log n.
\end{eqnarray*}
The first line is due to the definitions of $r$ and $c_{2}$. In the third line we use the monotonicity of $x \log \tfrac{n}{x}$ on $[1,n/e]$ by
substituting in $|A|$, $|B|,$ $1$ and $d^{1/4}/100$ for $x$. In the fourth line we use that
$|A| \vee |B| \leq \tfrac{n}{e}$  so $\log \tfrac{n}{|A|},\log \tfrac{n}{|B|}>1$

Exponentiating we get
\[
\exp\left[
\tfrac{\mu r \log r}{3}
\right]
\geq \left(\tfrac{en}{|A|}\right)^n
\left(\tfrac{en}{|B|}\right)^n
n^2 \exp(3md^{1/4}(\log n))
\]
It follows that
\begin{eqnarray*}
{n \choose a} {n\choose b}\exp\left(-\tfrac{\mu(a,b,n) r \log r}{3}\right)
&\leq & {n \choose a}{n \choose b}\left(\tfrac{en}{a}\right)^{-n}
\left(\tfrac{en}{b}\right)^{-n} n^{-2}\exp(-3md^{1/4}\log n)\\
&\leq & n^{-2}\exp(-3md^{1/4}\log n).
\end{eqnarray*

Putting this together we get
\begin{eqnarray*}
\mathbb{P}(D)
& \leq &
\sum_{d/100 \leq a \vee b \leq n/e }{n \choose a} {n\choose b}\exp\left(-\tfrac{\mu(a,b,n) r \log r}{3}\right) +O(\exp(-md))\\
& \leq &
n^2n^{-2}\exp(-3md^{1/4}\log n)+O(\exp(-md)).
\end{eqnarray*}
Thus the lemma is satisfied.\end{pfofthm}

We finally give a quick sketch of how Proposition~\ref{prop:adj} follows from Lemma~\ref{lem:regularity}.  This is nearly the same as Theorem 2.5 of~\cite{FeigeOfek}, and so we will cite them heavily.
\begin{pfofthm}{ Proposition \ref{prop:adj}}

We recall that we wish to bound
\[
\sup_{ \substack{ \|x\| = 1, x^t \one = 0 \\ \|y\| = 1 } } | x^tAy| \leq C\sqrt{d}.
\]
For this we will relax the supremum to a finite, discrete space.
Define
\[
\mathcal{U}=\left\{ \frac{ z}{2\sqrt{n}} ~:~ z \in \mathbb{Z}^n, \|z\|^2 \leq 4n\right\}
~~~~~\text{ and }~~~~~
\mathcal{T}=\left\{ z \in \mathcal{U} ~:~ z \perp \one \right\}.
\]
As $\mathcal{U}$ is $\tfrac{1}{2}$-net of the sphere, and $S=\{x~:\|x\| = 1, x^t \one = 0\}$ is in the convex hull of $\mathcal{T}$ (by Lemma 2.3 of~\cite{FeigeOfek}), we have that
\[
\sup_{ \substack{ \|x\| = 1, x^t \one = 0 \\ \|y\| = 1 } } | x^tAy| \leq
4
\sup_{ \substack{ x \in \mathcal{T} \\ y \in \mathcal{U}} } | x^tAy|.
\]
Further, we have that $|\mathcal{T}| \leq |\mathcal{U}| \leq C^n$ for some absolute constant $C.$

For a fixed pair of vectors $(x,y) \in \mathcal{T} \times \mathcal{U},$ define the {\bf light couples} $\mathcal{L} = \mathcal{L}(x,y)$ to be all those ordered pairs $(u,v) \in \{1,2,\dots,n\}^2$ so that $|x_uy_v| \leq \tfrac{\sqrt{d}}{n},$ and let the {\bf heavy couples} $\mathcal{H}=\mathcal{H}(x,y)$ be all those pairs that are not light. We will use the notation
\[
\ensuremath{ \operatorname{light}(x,y)} =
\sum_{ (u,v) \in \mathcal{L}} x_uA_{uv}y_v,
\]
and the notation
\[
\ensuremath{ \operatorname{heavy}(x,y)} =
\sum_{ (u,v) \in \mathcal{H}} x_uA_{uv}y_v,
\]

Now the contribution of the light couples can be bounded by a martingale argument to show that for every $c > 0,$ there is a $K$ so that
\[
\Pr \left[
|\ensuremath{ \operatorname{light}(x,y)}| > K\sqrt{d}
\right] \leq e^{-cn}.
\]
(c.f. Claim 2.7 of~\cite{FeigeOfek}--note we are asserting a stronger claim than what Feige and Ofek claim, as $y \in \mathcal{U},$ but the same proof goes through without modification).  And thus, for each $m$ there is a constant $C=C(m)$ so that
\[
\Pr \left[
\sup_{(x,y) \in \mathcal{T} \times \mathcal{U}} |\ensuremath{ \operatorname{light}(x,y)}| > C\sqrt{d}
\right] \leq Ce^{-mn}.
\]
To control the heavy couples, the discrepancy property suffices (c.f. Corollary 2.11 of~\cite{FeigeOfek} or Section 2.3 of~\cite{FKSz}).  Again, the proof is identical to either of those two claims, although it is not exactly either one, and it shows that there is a constant $C=C(\delta,m)$ sufficiently large so that
\begin{multline*}
\Pr \left[
\sup_{(x,y) \in \mathcal{T} \times \mathcal{U}} |\ensuremath{ \operatorname{heavy}(x,y)}|  > C\sqrt{d}
\right] \\
\leq
\Pr \left[ \ensuremath{ \bf{b.d.c.}} \text{ fails } \right]
+
\Pr \left[ \text{ discrepancy fails } \right].
\end{multline*}

\end{pfofthm}

\begin{appendices}
\section{Estimates of Binomial Random Variables}
\begin{lemma} \label{magic}
Let $X$ be a binomial random variable with mean $\mu$. Then for any $t \leq \mu$
\[
\mathbb{P} \left[
X \leq t
\right] \leq \exp\left[
-\mu + t( 1+ \log \tfrac{\mu}{t})
\right],
\]
\end{lemma}

\begin{pfofthm}{Lemma~\ref{magic}}
The proof follows from a standard estimate on the Laplace transform combined with Markov's inequality.  For any $\lambda \in \mathbb{R},$ the Laplace transform of $X \sim \operatorname{Binomial}(n,p)$ can be bounded by
\begin{align*}
\mathbb{E} e^{\lambda X}
&= \left(pe^{\lambda} + (1-p)\right)^n \\
&= \left(1 + p(e^{\lambda}-1)\right)^n \\
&\leq \exp\left[\mu(e^{\lambda}-1)\right].
\end{align*}
Provided that $\lambda < 0,$ the tail bound now can be bounded by Markov's inequality by
\begin{align*}
\mathbb{P} \left[
X \leq t
\right] &=
\mathbb{P} \left[
e^{\lambda X} \geq e^{\lambda t}
\right] \\
&\leq \left[\mathbb{E} e^{\lambda X}\right] e^{-\lambda t} \\
&\leq \exp\left[\mu(e^{\lambda}-1) - \lambda t\right].
\end{align*}
Assuming that $t < \mu,$ this bound holds with $\lambda=\log (t/\mu),$ which upon evaluation gives
\[
\mathbb{P} \left[
X \leq t
\right]
\leq \exp\left[\mu(e^{\log (t/\mu)}-1) - \log (t/\mu) t\right]
= \exp \left[ -\mu + t(1 + \log \tfrac{\mu}{t}) \right].
\]
\end{pfofthm}

\begin{lemma} \label{maybe}
Let $X$ be a binomial random variable with mean $\mu$. Then for any $t>4$
\[
\mathbb{P} \left[
X \geq t \mu
\right] \leq \exp\left[
-\frac{t \mu \log(t)}{3}
\right],
\]
\end{lemma}

\begin{pfofthm}{Lemma \ref{maybe}}
The proof here is identical in approach to the proof of Lemma~\ref{magic}. As there, it is possible to bound the Laplace transform of $X$ as
\[
\mathbb{E} e^{\lambda X} \leq
\exp\left[\mu(e^{\lambda}-1)\right],
\]
for any real $\lambda.$  For $\lambda > 0,$ the tail bound follows from Markov's inequality by
\begin{align*}
\mathbb{P} \left[
X \geq t\mu
\right] &=
\mathbb{P} \left[
e^{\lambda X} \geq e^{\lambda t\mu}
\right] \\
&\leq \left[\mathbb{E} e^{\lambda X}\right] e^{-\lambda t\mu} \\
&\leq \exp\left[\mu(e^{\lambda}-1) - \lambda t\mu \right].
\end{align*}
For $t > 1,$ it is possible to take $\lambda = \log t.$  This gives the bound on the tail probability
\[
\mathbb{P} \left[
X \geq t\mu
\right]
\leq\exp\left[\mu\left(t - 1  -  t \log t\right)\right].
\]
To complete the proof, it remains to show that $t-1 \leq \tfrac{2}{3}t\log t$ when $t \geq 4.$ The function $\frac{t}{t-1}\log t$ is monotonically increasing for $t > 1,$ and thus it suffices to show that $\frac{4}{3}\log 4 \geq \tfrac{3}{2},$ or equivalently that $\log 4 \geq \tfrac{9}{8}.$  This follows from $\log 4 = \int_1^4 \tfrac 1 x dx$ and bounding the integral from below by a right Riemann sum.
\end{pfofthm}

\end{appendices}

\bibliographystyle{plain}

Combinatorics (math.CO); Geometric Topology (math.GT); Probability (math.PR)