Linear index assigned to an unordered pair $\{a, b\}$ with $a < b$, given by $\binom{b}{2} + a$. Used to enumerate edges of the complete graph $K_n$ as elements of $\mathrm{Fin}\binom{n}{2}$.
Instances For
The index of a pair with $a < b < n$ lies below $\binom{n}{2}$, ensuring that
pairToEdgeIndex produces a valid Fin (Nat.choose n 2).
The probability that $G(n, p)$ contains a triangle, computed by summing the
indicator of hasTriangle weighted by the Bernoulli$(p)$ product weights over all
$2^{\binom{n}{2}}$ edge configurations.
Instances For
The triangle-containment probability in $G(n, p)$ is nonnegative for $p \in [0, 1]$.
The triangle-containment probability in $G(n, p)$ is at most $1$ for $p \in [0, 1]$.
The expected number of triangles in $G(n, p)$, given by $\mathbb{E}[X] = \binom{n}{3} p^3$ (Proposition 4.1.2).
Instances For
The expected number of triangles in $G(n, p)$ is nonnegative when $p \ge 0$.
First moment bound for triangles. The probability that $G(n, p)$ contains a triangle is at most the expected number of triangles $\binom{n}{3} p^3$ (Markov's inequality applied to the triangle count).
Second moment bound for triangles. Using the variance bound $\mathrm{Var}(X) \le \mathbb{E}X + \binom{n}{4} p^5$ for the triangle count $X$, the probability of at least one triangle is at least $1 - (\mathbb{E}X + \binom{n}{4} p^5) / (\mathbb{E}X)^2$.
Upper bound for the expected number of triangles: $\binom{n}{3} p^3 \le (np)^3 / 6$, using $\binom{n}{3} \le n^3/3!$.
If $np_n \to 0$ then the expected number of triangles tends to $0$, by squeezing $\binom{n}{3} p_n^3$ between $0$ and $(np_n)^3 / 6$.
Below-threshold side of the triangle threshold. If $np_n \to 0$ and a triangle probability sequence is bounded above by the first moment, then it tends to $0$.
If $np_n \to \infty$, then the variance-over-squared-mean ratio for the triangle count tends to $0$, the key second-moment input for the above-threshold direction.
Above-threshold side of the triangle threshold (Theorem 4.1.11, second part). If $np_n \to \infty$, then $\mathbb{P}(G(n, p_n) \text{ contains a triangle}) \to 1$.
Triangle-free w.h.p. side of Theorem 4.1.11. If $np_n \to 0$, then $\mathbb{P}(G(n, p_n) \text{ contains a triangle}) \to 0$, i.e. $G(n, p_n)$ is triangle-free with high probability.