% Template based on:
% https://www.cs.columbia.edu/~djhsu/coms4774-s21/scribe.html

\documentclass[12pt]{article}

\usepackage{amscd}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{bbold}
\usepackage{bm}
\usepackage{colonequals}
\usepackage{enumitem}
\usepackage[dvips,letterpaper,margin=1in]{geometry}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{xcolor}

\usepackage{csquotes}
\MakeOuterQuote{"}

\definecolor{cblack}{rgb}{0,0,0}
\definecolor{cblue}{rgb}{0.121569,0.466667,0.705882}
\definecolor{corange}{rgb}{1.000000,0.498039,0.054902}
\definecolor{cgreen}{rgb}{0.172549,0.627451,0.172549}
\definecolor{cred}{rgb}{0.839216,0.152941,0.156863}
\definecolor{cpurple}{rgb}{0.580392,0.403922,0.741176}
\definecolor{cbrown}{rgb}{0.549020,0.337255,0.294118}
\definecolor{cpink}{rgb}{0.890196,0.466667,0.760784}
\definecolor{cgray}{rgb}{0.498039,0.498039,0.498039}

\usepackage{hyperref}
\hypersetup{
  linkcolor  = cblue,
  citecolor  = cgreen,
  urlcolor   = corange,
  colorlinks = true,
}

% Lecture information
\newcommand\coursename{CPSC 664, Spring 2023}
\newcommand\scribe{Psi Vesely}
\newcommand\lecturer{Tim Kunisky}
\newcommand\lecturedate{January 29, 2023}
\newcommand\lecturetitle{Lecture $5$: Random $k$-SAT III}

% Define theorem environments here.
\newtheorem{claim}{Claim}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{remark}[theorem]{Remark}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{question}[theorem]{Question}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{conjecture}[theorem]{Conjecture}

% Some of my macros
\renewcommand{\AA}{\mathbb{A}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\DD}{\mathbb{D}}
\newcommand{\EE}{\mathbb{E}}
\newcommand{\FF}{\mathbb{F}}
\newcommand{\HH}{\mathbb{H}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\PP}{\mathbb{P}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\renewcommand{\SS}{\mathbb{S}}
\newcommand{\ZZ}{\mathbb{Z}}
\DeclareSymbolFont{bbold}{U}{bbold}{m}{n}
\DeclareSymbolFontAlphabet{\mathbbold}{bbold}
\newcommand{\One}{\mathbbold{1}}

\newcommand{\ba}{\bm a}
\newcommand{\bb}{\bm b}
\newcommand{\bc}{\bm c}
\newcommand{\bd}{\bm d}
\newcommand{\be}{\bm e}
\newcommand{\bg}{\bm g}
\newcommand{\bh}{\bm h}
\newcommand{\bi}{\bm i}
\newcommand{\bj}{\bm j}
\newcommand{\bk}{\bm k}
\newcommand{\bbm}{\bm m}
\newcommand{\bp}{\bm p}
\newcommand{\bq}{\bm q}
\newcommand{\br}{\bm r}
\newcommand{\bs}{\bm s}
\newcommand{\bt}{\bm t}
\newcommand{\bu}{\bm u}
\newcommand{\bv}{\bm v}
\newcommand{\bw}{\bm w}
\newcommand{\bx}{\bm x}
\newcommand{\by}{\bm y}
\newcommand{\bz}{\bm z}

\newcommand{\bA}{\bm A}
\newcommand{\bB}{\bm B}
\newcommand{\bC}{\bm C}
\newcommand{\bD}{\bm D}
\newcommand{\bE}{\bm E}
\newcommand{\bF}{\bm F}
\newcommand{\bG}{\bm G}
\newcommand{\bH}{\bm H}
\newcommand{\bI}{\bm I}
\newcommand{\bL}{\bm L}
\newcommand{\bM}{\bm M}
\newcommand{\bN}{\bm N}
\newcommand{\bP}{\bm P}
\newcommand{\bQ}{\bm Q}
\newcommand{\bR}{\bm R}
\newcommand{\bS}{\bm S}
\newcommand{\bT}{\bm T}
\newcommand{\bU}{\bm U}
\newcommand{\bV}{\bm V}
\newcommand{\bW}{\bm W}
\newcommand{\bX}{\bm X}
\newcommand{\bY}{\bm Y}
\newcommand{\bZ}{\bm Z}

\newcommand{\zero}{\bm{0}}
\newcommand{\one}{\bm{1}}

\newcommand{\sA}{\mathcal{A}}
\newcommand{\sB}{\mathcal{B}}
\newcommand{\sC}{\mathcal{C}}
\newcommand{\sD}{\mathcal{D}}
\newcommand{\sE}{\mathcal{E}}
\newcommand{\sF}{\mathcal{F}}
\newcommand{\sG}{\mathcal{G}}
\newcommand{\sH}{\mathcal{H}}
\newcommand{\sI}{\mathcal{I}}
\newcommand{\sJ}{\mathcal{J}}
\newcommand{\sK}{\mathcal{K}}
\newcommand{\sL}{\mathcal{L}}
\newcommand{\sM}{\mathcal{M}}
\newcommand{\sN}{\mathcal{N}}
\newcommand{\sO}{\mathcal{O}}
\newcommand{\sP}{\mathcal{P}}
\newcommand{\sQ}{\mathcal{Q}}
\newcommand{\sR}{\mathcal{R}}
\newcommand{\sS}{\mathcal{S}}
\newcommand{\sT}{\mathcal{T}}
\newcommand{\sU}{\mathcal{U}}
\newcommand{\sV}{\mathcal{V}}
\newcommand{\sX}{\mathcal{X}}
\newcommand{\sY}{\mathcal{Y}}

\newcommand{\fB}{\mathscr{B}}
\newcommand{\fC}{\mathscr{C}}
\newcommand{\fE}{\mathscr{E}}
\newcommand{\fH}{\mathscr{H}}
\newcommand{\fI}{\mathscr{I}}
\newcommand{\fP}{\mathscr{P}}
\newcommand{\fV}{\mathscr{V}}

\DeclareSymbolFont{sfoperators}{OT1}{cmss}{m}{n}
% don't waste a math group
\DeclareSymbolFontAlphabet{\mathsf}{sfoperators}
% tell LaTeX to use sfoperators for names of operators
\makeatletter
\renewcommand{\operator@font}{\mathgroup\symsfoperators}
\makeatother

\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator{\GOE}{GOE}
\DeclareMathOperator{\sym}{sym}
\DeclareMathOperator{\Part}{Part}
\DeclareMathOperator{\poly}{poly}
\DeclareMathOperator{\Unif}{Unif}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\obj}{obj}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\sgn}{sgn}

\renewcommand\Re{\operatorname{Re}}
\renewcommand\Im{\operatorname{Im}}
% These put symbols below.
\newcommand{\Px}{\mathop{\mathbb{P}}}
\newcommand{\Ex}{\mathop{\mathbb{E}}}
\newcommand{\Varx}{\mathop{\mathsf{Var}}}

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}

%
% Put your custom macros here if you want.
%

\begin{document}

% This creates the header for scribe notes.
\noindent \coursename \hfill Scribe: \scribe \\
\lecturedate \hfill Lecturer: \lecturer
\vspace{1em}

\hrule

\vspace{1.5em}
\begin{center}
  {\Large\lecturetitle}
\end{center}

In the previous lecture, we studied satisfiability of random $k$-SAT for fixed $k$: specifically $k=2$ and $k=3$. The probability a random formula will be satisfiable is determined by the number of variables $n$ it has in relationship to the number of clauses $m$. Let $n := \alpha m$. We sought to find $\alpha^* = \alpha^*(k)$ such that, for a randomly sampled formula $F$,
\begin{itemize}
  \item $\alpha > \alpha^* \Rightarrow F$ is unsatisfiable whp.
  \item $\alpha < \alpha^* \Rightarrow F$ is satisfiable whp.
\end{itemize}
We now wish to estimate $\alpha^*$ for the case of large $k$.

\section{First moment method for general $k$}

We begin by applying the first moment method (1MM) to the random variable $Z = \# \{x \in \{0,1\}^{n}: F(x) = 1\}$, which gives the expected number of solutions to a random formula $F$. Recall that the 1MM tells us that if $\EE Z$ vanishes as $n \to \infty$, then $F$ is unsatisfiable whp. We have
\[
  \EE Z = 2^n \left(1-\frac{1}{2^k}\right)^m = \left[2\left(1-\frac{1}{2^k}\right)^\alpha\right]^n
\]
This inner expression equals 1 when $\alpha^*(k) = \log(\frac{1}{2})/\log(1-\frac{1}{2^k})$. Using Taylor expansion we get that
\[
  \alpha^*(k) \approx \frac{{-}\log(2)}{0-\frac{1}{2^k}} = \log(2)\cdot 2^k
\]
This gives us a lower bound on $\alpha^*$: we know that for smaller $\alpha$ the expectation vanishes, however, for larger $\alpha$ we cannot rule out the case that random formula are mostly unsatisfiable, but occasionally have a huge number of solutions. To do this, we can bound $Z$'s variance using the second moment method (2MM).

\section{Second moment method for general $k$}

Recall that using the Cauchy-Schwarz inequality we can derive the following inequality:
\[
  \Pr[Z > 0] \geq \frac{(\EE Z)^2}{\EE Z^2}
\]
Thus we can show there is likely a satisfying assignment whenever the second moment of $Z$ is not much larger than the square of its expectation. We will try to find when this is the case. We begin by obtaining
\begin{align*}
  \EE Z^2 &= \EE_F \left(\sum_{x \in \{0,1\}^n} \mathbb{1}\{x \text{ satisfies } F\}\right)^2 \\
  &= \sum_{x,y \in \{0,1\}} \PP_{F} \left[x,y\text{ both satisfy }F\right] \\
  &= \sum_{x,y \in \{0,1\}} \left( \PP_{C} \left[x,y\text{ both satisfy }C\right] \right)^m
\end{align*}
where the last equality follows from the fact each clause is sampled iid. We further break down the probability that $x$ and $y$, both sampled iid from  $\mathsf{Unif}(\{0,1\}^n)$, satisfy an arbitrary clause $C$ as follows:
\begin{align*}
  \PP_{C} [x,y\text{ both satisfy }C] &= 1 - \PP[x,y\text{ don't both satisfy }C] \\
  &= 1 - \PP[x\text{ unsat}] - \PP[y\text{ unsat}] + \PP[x,y \text{ both unsat}] \\
  &= 1 - \frac{1}{2^k} - \frac{1}{2^k} + \PP[x,y \text{ both unsat}]
\end{align*}
This last probability term can be expressed
\[
  \PP[x,y \text{ both unsat}] = \frac{\#\{C \text{ that both violate}\}}{\#\{\text{all } C\}}
\]
We next define an ``overlap'' function $r := r(x,y) = \#\{i: x_i = y_i\}$, which we use to state
\[
 \frac{\#\{C \text{ that both violate}\}}{\#\{\text{all } C\}} = \frac{\binom{r}{k}}{2^k\binom{n}{k}} \approx \left(\frac{r}{2n}\right)^k
\]
where we use the fact $\binom{n}{k} \approx \frac{n^k}{k!}$ as shown in the previous lecture. We can now write
\begin{align*}
  \sum_{x,y \in \{0,1\}} \left( \PP_{C} \left[x,y\text{ both satisfy }C\right] \right)^m &\approx \sum_{x \in \{0,1\}^n}\sum_{r=0}^n \#\{y: r(x,y) = r\} \left(1-\frac{1}{2^{k-1}}+\left(\frac{r}{2n}\right)^k\right)^m \\
  &= 2^n \sum_{r=0}^n \binom{n}{r} \left(1-\frac{1}{2^{k-1}}+\left(\frac{r}{2n}\right)^k\right)^m \\
  &:= 2^n \sum_{r=0}^n \binom{n}{r} f\left(\frac{r}{n}\right)^m
\end{align*}
where we define a function $f$ for closer analysis. We first observe that when $\frac{r}{n} = \frac{1}{2}$ we have
\[
  f\left(\frac{r}{n}\right) = \left(1 - \frac{1}{2^{k-1}} +\frac{1}{4^k}\right)^m = \left(1 - \frac{1}{2^{k}}\right)^{m}
\]
Consider that the contribution to $f$ near $\frac{r}{n} = \frac{1}{2}$ is approximately
\[
  2^n \cdot \sum_{r=n/2-c\sqrt{n}}^{n/2+c\sqrt{n}} \binom{n}{r} f\left(\frac{r}{n}\right)^m  \approx f\left(\frac{1}{2}\right)^m\cdot 2^n\cdot 2^n = \left[2 \left(1-\frac{1}{2^k}\right)^\alpha\right]^{2n} = (\EE Z)^2
\]
The 2MM then tells us that for $\alpha$ for which the majority contribution of $f$ comes from its value near $\frac{n}{2}$, we can say $F$ is satisfiable whp. Equivalently, we must show that $x,y$ sampled iid from the uniform distribution over all satisfying assignments to $F$ satisfies $r(x,y) \approx \frac{n}{2}$. As it turns out, this is not the case: the set of satisfying solutions tends to have bias towards either True or False for each of the variables, and this bias grows stronger as $\alpha$ grows. We proceed to show that the majority contribution of $f$ does not come from its value near $\frac{n}{2}$, except for the vacuous case of $\alpha = 0$.

We write $r = tn$ for $t \in [0,1]$ and apply Stirling's approximation to $\binom{n}{tn}$:
\begin{align*}
  \binom{n}{tn} &= \frac{n!}{tn!((1-t)n)!} \\
  &\approx \frac{\left(\frac{n}{e}\right)^n}{\left(\frac{tn}{e}\right)^{tn}\left(\frac{(1-t)n}{e}\right)^{(1-t)n}} \\
  &= \left[ \frac{1}{t^t\left(1-t\right)^{1-t}}\right]^n \\
  &= \exp(n[-t\log t - (1-t) \log(1-t)]) \equalscolon \exp(n \cdot H(t))
\end{align*}
Using this newly defined function $H(t)$ we can then write
\[
  \binom{n}{tn}f(t)^m \approx \left(e^{H(t)} f(t)^\alpha\right)^n = \exp(n[H(t)+\alpha \log f(t)]) \equalscolon \exp(n \cdot g_\alpha(t))
\]
Finally, we look at the behavior of $g_\alpha(t)-g_\alpha(\frac{1}{2})$ as $\alpha$ grows.

{\centering
\includegraphics[width=.5\textwidth]{2023-01-31-fig1.png} \\
}
As claimed, we see that as $\alpha > 0$ grows that increasingly more of the contribution of $g_\alpha$ (and thus $f$) comes from its value at inputs greater than $\frac{n}{2}$. In the next lecture we'll see how to address the ``assignment drift'' of satisfying solutions through a restricted counting argument.
\end{document}
