\documentclass{article}
\usepackage{amsmath,amssymb,amsthm,fullpage,enumerate,hyperref}
\theoremstyle{definition}
\newtheorem{exmp}{Example}
\newtheorem{defi}{Definition}
\newtheorem{theo}{Theorem}
\newtheorem{coro}{Corollary}
\newtheorem{prop}{Proposition}
\begin{document}
In this talk I'm going work towards defining modular forms in the {\it correct} way. This means using Katz' definitions. The only problem is that in order to use his definitions, you need a very solid grasp of algebraic geometry and differential geometry.
\section{Lattices and modular forms}
Suppose you have two linearly independent elements in the complex plane, call them $\omega_1$ and $\omega_2$. Then you can form a lattice
\[L=\mathbb{Z}\omega_1+\mathbb{Z}\omega_2.\]
Topologically, the quotient
\[\mathbb{C}/L=\{\tau+L:\tau\in\mathbb{C}\},\]
is a torus. We can see this by the homeomorphism
\[\phi:\mathbb{C}/L\to I^2/{\sim}\text{, given by }x\omega_1+y\omega_2+L\mapsto [\mathrm{mod}(x,1),\mathrm{mod}(y,1)]_{\sim}.\]
Recall that for an integer weight $k$, the group $\mathrm{SL}_2(\mathbb{Z})$ acts on the right on functions $f:\mathbb{H}\to\mathbb{C}$ by
\[(f|_k\gamma)(\tau)=(c\tau+d)^{-k}f(\gamma.\tau),\]
where $(a,b;c,d)\in\gamma\in\mathrm{SL}_2(\mathbb{Z})$ and $\gamma.\tau=(a\tau+b)/(c\tau+d)$.

Classically, a modular form of integral weight $k$ and level $1$, is a holomorphic function on the upper-half plane satisfying:
\begin{enumerate}[(i)]
  \item $f|_k\gamma=f$ for every $\gamma\in\mathrm{SL}_2(\mathbb{Z})$, and
  \item $f(\tau)$ is bounded as $\tau\to i\infty$.
\end{enumerate}
This can be expressed in terms of lattices.
\begin{defi}[Modular form, lattice definition]
  Let $k$ be an integer. Then a modular form of weight $k$ and level $1$ is a function $F$ on lattices in $\mathbb{C}$ satisfying:
  \begin{enumerate}[(i)]
    \item $F(\lambda L)=\lambda^{-k}F(L)$ for every $\lambda\in\mathbb{C}\setminus\{0\}$.
    \item Let $\omega\in\mathbb{C}$ be fixed and define $L_\tau=\mathbb{Z}\omega+\mathbb{Z}\tau$. Then
      \[\mathbb{C}\ni\tau\mapsto F(L_\tau)\in\mathbb{C},\]
      is holomorphic.
    \item With $L_\tau$ as above, then $F(L_\tau)$ is bounded as $\tau\to i\infty$.
  \end{enumerate}
\end{defi}
These definitions are equivalent in the sense that given a modular form $f$ on the upper-half plane, then there's a unique modular form\footnote{Given by $\mathbb{Z}\omega_1+\mathbb{Z}\omega_2\mapsto \omega_2^{-k}f(\omega_1/\omega_2)$ for $\mathrm{Im}(\omega_1/\omega_2)>0$.} $F$ on lattices satisfying $F(\mathbb{Z}+\mathbb{Z}\tau)=f(\tau)$, and given a modular form $F$ on lattices, then there's a unique modular form\footnote{Given by $\tau\mapsto F(\mathbb{Z}+\mathbb{Z}\tau)$.} $f$ on the upper-half plane satisfying $f(\tau)=F(\mathbb{Z}+\mathbb{Z}\tau)$.

Since we vaguely know that lattices and elliptic curves are equivalent, this suggest that we can view modular forms (of level $1$) as functions on elliptic curves \ldots\ somehow.

This is Katz' starting point.
\section{How do we carry the weight?}
The way we carry the weight to the setting of elliptic curves is to associate a differential form to the curve.

In this section I want to establish the necessary notions that allows us to do this for the lattice $\mathbb{C}/L$. So, what we'll do is that in more generality that complex tori $\mathbb{C}^n/L$ are complex manifolds, and then make sense of the $1$-form $dz$ on $\mathbb{C}/L$ even means.
\subsection{Complex manifolds -- the very basics}
For this section, I decided to use the excellent book {\it From Holomorphic Functions to Complex Manifolds} by Grauert and Fritzsche.

Let's begin by defining what a complex manifold is.
\begin{defi}[Complex coordinate system, complex coordinates]
  An $n$-dimensional complex coordinate system $(U,\phi)$ in $X$ consists of an open set $U\subseteq X$ and a homeomorphism $\phi:U\to B$ where $B\subseteq\mathbb{C}^n$.

  If $p\in X$ is a point, then a complex coordinate system $(U,\phi)$ in $X$ with $p\in U$ is called a complex coordinate system at $p$. The entries $z_i=\mathbf{z}=\phi(p)$ are called the complex coordinates of $p$ with respect to $(U,\phi)$.

  If $f$ is a complex function in $U$, we view it as a function of the complex coordinates $(z_1,\dots,z_n)$ via
  \[(z_1,\dots,z_n)\mapsto f\circ\phi^{-1}(z_1,\dots,z_n).\]
\end{defi}
\begin{defi}[Compatible coordinate systems]
  Let $\mathcal{U}=(U,\phi)$ and $\mathcal{V}=(V,\psi)$ be two $n$-dimensional complex coordinate systems in a Hausdorff space $X$. Then we say that $\mathcal{U}$ and $\mathcal{V}$ are (holomorphically) compatible if $U\cap V=\emptyset$ or
  \[\phi\circ\psi^{-1}:\psi(U\cap V)\to\phi(U\cap V),\]
  is biholomorphic (bijective holomorphic with holomorphic inverse).
\end{defi}
Now we get to a notion that I believe most of you have heard of -- an atlas.
\begin{defi}[Atlas, complex structure]
  Let $X$ be a Hausdorff space. Then a covering of $X$ with pairwise compatible $n$-dimensional complex coordinate systems is called an $n$-dimensional complex atlas on $X$.

  Two atlases $\mathcal{A}_1$ and $\mathcal{A}_2$ on $X$ are called equivalent if {\it any} two coordinate systems $(U,\phi)\in\mathcal{A}_1$ and $(V,\psi)\in\mathcal{A}_2$ are compatible.

  An equivalence class of $n$-dimensional complex atlases on $X$ is called an $n$-dimensional complex structure on $X$.
\end{defi}
This is all we need to define a complex manifold.
\begin{defi}[Complex manifold]
  An $n$-dimensional complex manifold is a second-countable Hausdorff space $X$ together with an $n$-dimensional complex structure.
\end{defi}
The space $\mathbb{C}^n$ itself is a complex manifold.
\begin{exmp}
  Let $\mathbb{C}^n$ have the Euclidean topology coming from $\mathbb{R}^{2n}$. Then $\mathbb{C}^n$ is Hausdorff and second countable (take balls with rational radii and centers).

  Let $\mathcal{A}=\{(\mathbb{C}^n,\mathrm{id})\}$. Since $\mathrm{id}$ is biholomorphic, it's clear that $\mathcal{A}$ is an $n$-dimensional complex atlas. Hence $[\mathcal{A}]$ is a complex structure.
\end{exmp}
So is any non-empty open subset of a complex manifold.
\begin{exmp}
  Hello!
\end{exmp}

In order to talk about, we need the notion of quotients of manifolds, and for this we need to define
\begin{enumerate}
  \item Holomorphic maps.
  \item Holomorphic functions on complex manifolds.
  \item Holomorphic mappings between complex manifolds.
  \item Analytic subsets.
  \item Local Jacobian.
  \item The rank of a holomorphic map.
%  \item Immersion and submersion.
\end{enumerate}
\begin{defi}[Holomorphic maps]
  Let $B\subseteq\mathbb{C}^n$ be open. A map
  \[\mathbf{f}=(f_1,\dots,f_m):B\to\mathbb{C}^m,\]
  is called holomorphic if all components $f_i$ are holomorphic.
\end{defi}
\begin{defi}[Holomorphic functions on complex manifolds]
  Let $X$ be an $n$-dimensional complex manifold. A complex function $f$ on an open subset $B\subseteq X$ is called holomorphic if for each $p\in B$ there is a coordinate system $(U,\phi)$ at $p$ such that
  \[f\circ\phi^{-1}:\phi(U\cap B)\to\mathbb{C},\]
  is holomorphic. We denote the set of holomorphic functions on $B$ by $\mathcal{O}(B)$.
\end{defi}
\begin{defi}[Holomorphic mappings between complex manifolds]
  Let $X$ and $Y$ be complex manifolds and let $F:X\to Y$ be continuous. Then $F$ is called holomorphic if for any $p\in X$ there is a coordinate system $(U,\phi)$ at $p$ and a coordinate system $(V,\psi)$ at $F(p)$ with $F(U)\subseteq V$ such that
  \[\psi\circ F\circ\phi^{-1}:\phi(U)\to \psi(V),\]
  is a holomorphic map.
\end{defi}
\begin{defi}[Analytic subset]
  Let $X$ be an $n$-dimensional complex manifold. Then a subset $A\subseteq X$ is called analytic if for each point $p\in X$ there is a connected open neighborhood $U$ of $p$ and finitely many holomorphic functions $f_1,\dots,f_m$ on $U$ such that
  \[U\cap A=\{q\in U:f_i(q)=0\text{ for }i=1,\dots,m\}.\]
\end{defi}
\begin{defi}[Local Jacobian]
  Let $f_1,\dots,f_m$ be holomorphic functions defined on an open subset $U\subseteq X$. Let $p\in U$ be a point and $(V,\psi)$ a complex coordinate system in $X$ at $p$. Then the mapping $\mathbf{f}:(f_1,\dots,f_m):U\to\mathbb{C}^m$ is holomorphic and we define
  \[J_\mathbf{f}(p;\psi)=\Big(\frac{\partial(f_i\circ\psi^{-1})}{\partial z_j}(\psi(p))\Big)_{\substack{1\leq i\leq m\\1\leq j\leq n}},\]
  is the local Jacobian matrix at $(V,\psi)$ and $p$.
\end{defi}
One can show that
\[J_\mathbf{f}(p;\psi)=J_\mathbf{f}(p;\phi)\cdot\lambda,\]
for some invertible matrix $\lambda$. This shows that
\[\mathrm{rk}\,J_\mathbf{f}(p;\psi)=\mathrm{rk}\,J_\mathbf{f}(p;\phi),\]
for any pair of coordinate systems $(U,\phi)$ and $(V,\psi)$ at $p$ in $X$. Hence we can define:
\begin{defi}[Rank of holomorphic map]
  Let $X$ be an $n$-dimensional complex manifold and let $U\subset X$ be an open subset. Let $\mathbf{f}:U\to\mathbb{C}^m$ be a holomorphic map. Then we write
  \[\mathrm{rk}_p(\mathbf{f})=\mathrm{rk}(J(p;\psi)),\]
  where $(V,\psi)$ is any coordinate system at $p$ in $X$.
\end{defi}
%\begin{defi}[Submersion]
%  Let $X$ and $Y$ be complex manifolds with dimension $n$ and $m$, respectively, and let $f:X\to Y$ be a holomorphic map.
%\end{defi}
\subsection{Quotients of manifolds}
Let $X$ be an $n$-dimensional complex manifold and let $\sim$ be an equivalence relation. Then it's interesting to ask when $X/{\sim}$ carries the structure of a complex manifold such that $\pi:X\to X/{\sim}$ is a holomorphic map.

This is what we'll answer in this section. Let us begin by defining ``saturated'' sets.
\begin{defi}[Saturated set]
  Let $X$ be a complex manifold and let $\sim$ be an equivalence relation on $X$. Let $\pi:X\to X/{\sim}$ be the projection $\pi(x)=[x]$. We call a set $A$ saturated if
  \[\pi^{-1}(\pi(A))=A.\]
\end{defi}
\begin{theo}
  Let $X$ be a complex manifold of dimension $n$, and let $\sim$ be an equivalence relation.  Suppose the following conditions hold.
  \begin{enumerate}[(i)]
    \item With the quotient topology, $X/{\sim}$ is Hausdorff.
    \item For any $x_0\in X$ there exists a saturated open neighborhood $\hat{U}$ of $[x_0]$ in $X$ and a holomorphic map $\mathbf{f}:\hat{U}\to\mathbb{C}^{n-d}$ such that
      \begin{enumerate}[(a)]
        \item such that $\mathbf{f}^{-1}(\mathbf{f}(x))=[x]$ for all $x\in\hat{U}$.
        \item $\mathrm{rk}_x(\mathbf{f})=n-d$ for $x\in\hat{U}$.
      \end{enumerate}
  \end{enumerate}
  Then $X/{\sim}$ carries a unique structure of an $n-d$ dimensional complex manifold such that $\pi:X\to X/{\sim}$ is a holomorphic map (in fact a so-called ``submersion'').
\end{theo}
\begin{proof}
  {\tt Include only the part about the complex structure.}
\end{proof}
The above theorem has an important corollary.
\begin{coro}
  Let $X$ be an $n$-dimensional complex manifold and let $G$ be a group that acts freely and properly discontinuously on $X$. Then $X/G$ has the structure of an $n$-dimensional complex manifold. (It's more or less unique, but let's not delve into this.)
\end{coro}
\begin{proof}
  The fact that $G$ acts freely and properly discontinuously is what makes $X/G$ Hausdorff, so let's ignore this for now, and really try to focus on the complex structure.
\end{proof}
\begin{prop}
  Let $L$ be a lattice in $\mathbb{C}^n$. Then $L$ acts freely and properly discontinously on $\mathbb{C}^n$ by translation.
\end{prop}
\begin{proof}
  {\tt Definitely include.}
\end{proof}
Now we finally now can define complex tori.
\begin{defi}[Complex torus]
  Let $L$ be a lattice in $\mathbb{C}^n$. Then the $n$-dimensional complex torus associated to $L$ is the quotient manifold $\mathbb{C}^n/L$.
\end{defi}
\subsection{Complex differential forms on complex manifolds}
There is a lot of interesting content here, and I won't delve into the deep stuff. In fact, I'll only consider forms on $\mathbb{C}/L$. But still, we need to define:
\begin{enumerate}
  \item Derivations.
  \item Tangent vectors.
  \item Tangent space.
  \item Induced maps.
\end{enumerate}
A word on notation: if $X$ is a complex manifold and $B\subseteq X$ is open, we say that a function $f:B\to\mathbb{C}$ is smooth if for every complex coordinate system $(U,\phi)$ with $U\cap B\neq\emptyset$ it holds that $f\circ\phi^{-1}$ is smooth on $\phi(U\cap B)\subseteq\mathbb{C}^n$. The real vector space of real valued smooth functions on $B$ is denoted by $\mathcal{E}(B)$.
\begin{defi}[Derivation]
  Let $X$ be an $n$-dimensional manifold and let $a\in X$ be a point. Then a derivation on $X$ at $a$ is an $\mathbb{R}$-linear map $v:\mathcal{E}(X)\to\mathbb{R}$ such that
  \[v[f\cdot g]=v[f]\cdot g(a)+f(a)\cdot v[g],\]
  for $f,g\in\mathcal{E}(X)$.

  The (real) vector space of derivations on $X$ at $a$ is denoted by $T^\mathbb{R}_a(X)$.
\end{defi}
The notation hints at a connection with tangent vectors, and there is an isomorphisms to the space of tangent vectors, but I want to keep it simple.

The following proposition is useful.
\begin{prop}
  If $f\in\mathcal{E}(X)$ and $f|_U=0$ for some open neighborhood of $U$ of $a\in X$, then $v[f]=0$ for every derivation $v$ at $a$.
\end{prop}
\begin{proof}
  Let $g\in\mathcal{E}(X)$ satisfy $g|_V=0$ for some neighborhood $V$ of $a$, whose closure is compact and contained in $U$; and $g|_{X\setminus U}=0$. (This is just a cut-off/mollifier function, and they are no problem to construct.)

  Then $g\cdot f=f$ and also
  \[v[f]=v[g\cdot f]=v[g]\cdot f(a)+g(a)\cdot v[f]=0,\]
  because $a\in V\subseteq U$.
\end{proof}
The point of the previous proposition is that we can always restrict derivations to locally defined functions.
\begin{coro}
  Let $X$ be an $n$-dimensional complex manifold, and let $f,g$ be smooth functions on $X$ that agree on an open neighborhood of a point $a\in X$. Then for every derivation $v$ at $a$ it holds that $v[f]=v[g]$.
\end{coro}
\begin{proof}
  Apply the previous proposition to $f-g$.
\end{proof}
We now extend to complex valued functions.
\begin{defi}
  Let $f=g+ih$ be a complex valued smooth function on the open set $B\subseteq X$ and let $v$ be a derivation at $a\in B$. Then we define
  \[v[f]=v[g]+iv[h].\]
\end{defi}
This allows us to complexify $T^\mathbb{R}_a(X)$ to get $T_a(X)$.
\begin{prop}
  Let $J:T_a^\mathbb{R}(X)\to T_a^\mathbb{R}(X)$ satisfy
  \[J(v)[f]=iv[f],\]
  for every holomorphic function $f:X\to\mathbb{C}$. Then $J$ is a complex structure.
\end{prop}
We define $T_a(X)=(T^\mathbb{R}_a(X),J)$ and recall that $(a+ib)v=av+b\cdot J(v)$ for $a+ib\in\mathbb{C}$.

\begin{defi}[Induced mapping]
  Given a holomorphic map $F:X\to Y$ where $X$ and $Y$ are complex manifolds and a point $x\in X$, we can define a map $(F_\ast)_x:T_x(X)\to T_{F(y)}(Y)$, as follows.
  \[(F_\ast v)[g]=v[g\circ F],\]
  for derivations $v\in T_x(X)$ and functions $g\in\mathcal{E}(Y)$.

  This is called the tangential map, or the pushforward.
\end{defi}
This construction actually defines a covariant functor from the category of a complex manifolds with a distinguished point to the category of vector spaces. In the sense that given $F:X\to Y$, and $a\in X$ and $b=F(a)$, then we get a linear map $(F_\ast)_a:T_a(X)\to T_b(X)$ satisfying
\[(\mathrm{id}_X)_\ast=\mathrm{id}_{T_x(X)},\]
and
\[(G\circ F)_\ast=G_\ast\circ F_\ast.\]

Now we're finally ready to define what we mean by $dz$, or more generally $dz_i$ for $1\leq i\leq n$, on a complex $n$-dimensional manifold $X$. First, we set
\[T^\ast_x(X)=\mathrm{Hom}_\mathbb{R}(T_x(X),\mathbb{R}),\]
and define $F_x(X)=T^\ast_x(X)\oplus iT^\ast_x(X)$.

\begin{defi}[Differential of function]
  Let $X$ be an $n$-dimensional complex manifold and let $x\in X$. Let $f$ be a real of complex valued function, smooth on a neighborhood of $x$. Then we define $(df)_x\in F_x(X)$ by
  \[(df)_x(v)=v[f].\]
  In particular, if $(z_1,\dots,z_n)$ are local coordinates at $x$, we define
  \[dz_i=(dz_i)_x,\]
  so that $dz_i(v)=v[z_i]$.
\end{defi}
That's really it, now we know theoretically what Katz' means by $dz$ on $\mathbb{C}/L$.
\end{document}


\section{Introduction}
Hello, World! å ä ö

\begin{equation}
J^{\alpha,\beta} = -(1-x^2) \frac{d^2}{dx^2} - [\beta - \alpha - (\alpha + \beta +2)x]\frac{d}{dx}.
\end{equation}

\section{Lol}

\begin{eqnarray}
u(\theta,\, t) &=& \sum_{n \in \Z} \left( \int_{2n\pi}^{2n\pi+\pi} W_t(\theta-\phi)f(\phi-2n\pi) \dd \phi + \int_{2n\pi - \pi}^{2n\pi}W_t(\theta-\phi)  f(2n\pi - \phi)\dd \phi \right)\nonumber\\
&=& \sum_{n \in \Z} \left( \int_{0}^{\pi} W_t(\theta-\varphi-2n\pi) f(\varphi)\dd \varphi + \int_{0}^{\pi}W_t(\theta+\varphi-2 n \pi)  f(\varphi) \dd \varphi \right)\nonumber,
\end{eqnarray}

\subsection{Test}

\begin{defi}
For $t>0$ we define $h_t(x)$ by
\begin{displaymath}
h_t(x)=\frac{\vv'_t(x)}{ W'_t(x)}, \quad  0 < x \leq \pi,
%h_t(z)=\frac{d\vv_t}{dz} \left( \frac{d W_t}{dz} \right)^{-1}, \quad  z\in[0,\pi]
\end{displaymath}
and as $\lim_{x \rightarrow 0^+}h_t(x)$ at $x=0$.
\end{defi}

\begin{thm}\label{thm:integralformula}
Let $t>0$ and $\theta \in \zeropi$. Then
\begin{equation}\label{eq:estimationsintegral}
G^{0}_t(\cos\theta,\,1) =e^{t/4} \int_{\theta/2}^{\pi-\theta/2} \frac{ -\vv'_{t/4}(\gamma)  }{\sqrt{2\cos \theta - 2\cos 2\gamma}} \dd \gamma.
\end{equation}
\end{thm}

\begin{proof}[Proof of Theorem \ref{thm:integralformula}]
Let us first prove that $h_t(x) \leq 1$ for $x\in [0,\,\pi]$ and then prove that $h_t(x) \leq \frac{\pi}{t}(\pi -x) $ for $x\in [0,\,\pi]$.
\end{proof}


\documentclass{article}

\usepackage[margin=0.2cm]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{ulem}
\usepackage{hyperref}
\usepackage{minted}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfigure}

\begin{document}

\tableofcontents

\newpage
\section{Hall's marriage theorem}
Let $G=(V,E)=(X+Y,E)$ be a bipartite graph, $G$ has a complete matching from $X$ to $Y$ iff $\forall S\subseteq X\ |S|\leq |N(S)|$,\\
where $N_G(S)=\{y\in Y\mid \exists x\in S\ (x,y)\in E\}$.

\subsubsection{sufficiency}
($\Rightarrow$)\quad
Let $M=\{(x,f(x))\in E\mid x\in X\}\subseteq E$ be a complete matching.\\
$N_G(S)=\{y\in Y\mid \exists x\in S\ (x,y)\in E\}\supseteq \{f(x)\mid x\in S\}$.

\subsubsection{necessity}
($\Leftarrow$)\quad
Apply induction on $|X|$.
\begin{enumerate}
	\item When $|X|=1$, the necessity is hold.
	\item Suppose that the necessity is hold, for $|X|\leq k$
	\item For $|X|=k+1$, $\forall S\subseteq X\ |S|\leq |N_G(X)|$
	      \begin{itemize}
		      \item $\forall \varnothing\subsetneq S\subsetneq X\ |N_G(S)|>|S|$\\
		            Select any edge $e=(x,y)$. Remove the vertices $x,y$ and every edges $(u,v)$ to get $G'$ s.t. $x\in\{u,v\}\lor y\in\{u,v\}$.\\
		            In $G'$, $\forall \varnothing\subsetneq S\subseteq (X\setminus \{x\})\quad |N_{G'}(S)|\geq |N_{G}(S)|-1\geq |S|$.\\
		            So we can find a complete matching  $M':X'\to Y'$ in $G'$.\\
		            Thus A complete matching $M:X\to Y$ can generated by $M'\cup \{(x,y)\}$
		      \item $\exists \varnothing\subsetneq S\subsetneq X\ |N_G(S)|=|S|$\\
		            Let $G_0=(V_0,E_0),G_1=(V_1,E_1)$ be two induced subgraph of $G$, where $V_0=S+N_G(S),V_1=(X\setminus S)+ (Y\setminus N_G(S))$.
		            \begin{itemize}
			            \item For $G_0$: $\forall P\subseteq S\ N_{G_0}(P)=N_{G}(P)$ so $\forall P\subseteq S\ |N_{G_0}(P)|=|N_{G}(P)|\geq |P|$.
			            \item For $G_1$: We claim that $\forall Q\subseteq (X\setminus S)\ |N_{G_1}(Q)|\geq |Q|$.\\
			                  Otherwise, let $Q_0$ be a subset s.t. $|N_{G_1}(Q_0)|<|Q_0|$.\\
			                  Then $N_{G}(S\cup Q_0)=N_{G}(S)\cup N_{G}(Q_0)$, where $N_{G}(S)=N_{G_0}(S),\ N_{G}(Q_0)\subseteq (N_{G}(S)\cup N_{G_1}(Q)),\ N_{G_1(Q_0)}\cap N_G(S)=\varnothing$.\\
			                  which leads to $|N_{G}(S\cup Q_0)|=|\leq |N_G(S)|+|N_{G_0}(Q_0)| < |S|+|Q_0|$, however $|N_{G}(S\cup Q_0)|\geq |S\cup Q_0|=|S|+|Q_0|$.\\
			                  Therefore in $G_1$, $\forall Q\subseteq (X\setminus S)\ |N_{G_1}(Q)|\geq |Q|$.\\
		            \end{itemize}
		            We can find a complete matching by merging the complete matching in $G_0$ and $G_1$.
	      \end{itemize}
\end{enumerate}

\subsubsection{generalization}

In a bipartite graph $G=(X+Y,E)$
Let $\mathrm{def}_G(S)=|S|-|N_G(S)|$,
then the size of maximum matching in $G$ is $|X|-\max_{\varnothing\subseteq S\subseteq X}\mathrm{def}_G(S)$

\newpage
\section{Havel-Hakimi algorithm}

\subsubsection{the theorem}

Given a list of non-negative integers $(d_1,d_2\ldots d_n)$ where $d_1\geq d_2\geq d_3\ldots d_n\geq 0$.\\
Is there a undirected simple\footnote{no loops $(v,v)$, no dup-edges $k\times (v,v)$} graph $G=(V,E)$ s.t. the degree sequence of $G$ is $(d_1,d_2\ldots d_n)$?

\begin{minted}{python}
from typing import List
def check(deg_seq: List[int]) -> bool:
    if len(deg_seq)==0:
        return True

    head,seq = deg_seq[0],deg_seq[1:]
    if len(seq)>=head:
        for i in range(head):
            seq[i]=seq[i]-1
        seq = sorted(seq, reverse=True)
        return seq[-1]>=0 and check(seq)
    return False
\end{minted}

\subsubsection{proof}

\emph{TODO}

\newpage
\section{graph isomorphism invariant}

\subsection{degree sequence}

$G\cong H\implies f(G)=H(G)$, where $f(G)=\mathrm{multi-set}\{\deg_G(v)\mid v\in G\}$.\\
This is a necessary but not sufficient condition, see the following example, where $H,G$ have the same degree sequence but are not isomorphic to each other.

\begin{minted}{C}
//!/usr/bin/dot
// in graphviz dot
graph G{
	1 -- 2
	2 -- 3
	3 -- 4
	4 -- 5
	2 -- x
}
graph H{
	1 -- 2
	2 -- 3
	3 -- 4
	4 -- 5
	3 -- x
}
\end{minted}

\newpage
\section{Lower bound of $\max(\omega(G),\alpha(G))$}

\subsection{futher readings}
\href{https://en.wikipedia.org/wiki/Ramsey_theory}{wikipedia: Ramsey theory}

\subsection{statement}

(Ramsey's Theorem) Every graph with $n$ vertices contains either a clique or an independent set with at least $\frac{1}{2}\log_2 n$ vertices.\\
$\omega(G)$: the clique number.
$\alpha(G)$: the independence number.

\subsection{proof}

\begin{enumerate}
	\item $n=1$, hold
	\item $n=2$, hold
	\item Suppose that $n=1,2,3\ldots k$, the statement is true\\
	      For $n=k+1$, select a arbitary vertex $u$.
	      Let $A=\{v\mid \{u,v\}\in E,v\neq u\},\, B=\{v\mid \{u,v\}\not\in E,v\neq u\}$
	      \begin{itemize}
		      \item $A$, there exists a clique $C$ of at least $\frac{1}{2}\log_2 |A|$ vertices.
		            $C+\{u\}$ is still a clique.
		      \item $B$, there exists a independent set $I$ of at least $\frac{1}{2}\log_2 |B|$ vertices.
		            $I+\{u\}$ is still an independent set.
	      \end{itemize}
	      Therefore, we can find either a clique or an independent set consisting of at least $1+\frac{1}{2}\max\left(\log_2 |A|+\log_2 |B|\right)$\\
	      $|A+B|=|A|+|B|=n-1=k\implies \max(|A|,|B|)\geq \frac{1}{2}k\implies \max\left(\log_2 |A|,\log_2 |B|\right)\geq -1+\log_2 k$\\
	      Thus $\max(\omega(G),\alpha(G))\geq 1+\left(-1+\log_2 k\right)=\log_2 k\geq \frac{1}{2}\log_2 n$
\end{enumerate}

\newpage
\section{Sufficient conditions for existence of a hamilton circuit }

\begin{itemize}
	\item Dirac's Theorem:
	      A simple graph $G=(V,E)$ s.t. $|V|\geq 3$ and $\forall v\in V\ \deg(v)\geq \frac{|V|}{2}$ has a Hamilton circuit.
	\item Ore's Theorem:
	      A simple graph $G=(V,E)$ s.t. $|V|\geq 3$ and $\forall \{u,v\}\left( \{u,v\}\not\in E\rightarrow \deg(u)+\deg(v)\geq |V|\right)$
\end{itemize}

\subsection{proof}

\newpage
\section{Kuratowski's Theorem: the equivalent condition of planar graph}

\subsection{statement}

\begin{itemize}
	\item \emph{elementary subdivision (expansion)}: Let $G=(V,E)$ be a undirected graph.\\
	      Delete an edge $\{u,v\}$ and add a vertex $w$, two edges $\{u,w\},\{w,v\}$.\\
	      (adding a new vertex in the middle of an edge)
	\item \emph{subdivision (expansion)}: subdivision of $G$: graphs that can be obtained by performing a series of elementary subdivision on $G$.
	\item \emph{smoothing}: the reverse process of subdivision (or expansion).
	\item \emph{homeomorphic}: Two graphs $G,H$ are call homeomorphic to each other
	      if a subdivision of $G$ is isomorphic to $H$
	      or a subdivision of $H$ is isomorphic to $G$.
	\item \emph{theorem} if $H,G$ are homeomorphic graphs then $H$ is an planar graphs iff $G$ is planar.
	\item \emph{Kuratowski's Theorem}: A graph $G$ is planar iff it does not have a subgraph that is homeomorphic to $K_{3,3}$ or $K_5$.
\end{itemize}

\newpage
\section{coloring planar graphs}

\emph{the graphs discussed in this section should be simple graphs (no self-loops nor multi-edges)}

\subsection{lemmans}

\begin{itemize}
	\item A graph is planar iff its dual graph is planar.
	\item \emph{Euler's formula for (connected) planar graph}: $V-E+R=2$,
	      where $V,E,R$ be the number of vertices, the number of edges, the number of regions.
	\item \emph{degree} Define the degree of a vertex and a region,
	      $\deg(v)=\left|\{e\in E\mid e=\{u,v\}\}\right|$
	      and
	      $\deg(r)=\left|\{e\in E\mid \text{$e$ is on the boundary of $r$}\}\right|$
	\item \emph{hand-shaking lemma}: For any undirected graph $G=(V,E)$, we have $2|E|=\sum_{v\in V}\deg(v)$\\
	      Apply it on the dual graph of a planar graph to get the practical property: $2|E|=\sum_{r\in \text{regions}}\deg(r)$
	\item \emph{upper bound of edges in planar graph}: For a connected planar graph, if every region $r_i$ has $\deg(r_i)\geq d$,\\
	      then $2E=\sum_{r\in \text{region}}\deg(r)\geq dR=d(2+E-V)$,
	      thus $E\leq \frac{d}{d-2}(V-2)$\\
	      helpful collaries
	      \begin{itemize}
		      \item $V\geq 3$, planar, connected $\Rightarrow$ $E\leq 3V-6$
		      \item $V\geq 3$, planar, connected, no 3-cycle $\Rightarrow$ $E\leq 2V-4$
		      \item \emph{5 is an upper bound of $\delta$}: Every planar graph has a vertex of degree at most $5$
	      \end{itemize}
\end{itemize}

\subsection{The Six coloring theorem}

Induction, find the vertex $u$ with the least degree (by previous lemma $\deg(u)\leq 5$), assign a color that differs from all its neighbors' colors to $u$.

\subsection{The Four coloring theorem}

\subsection{The Five coloring theorem}

\begin{enumerate}
	\item $V\leq 5$, hold.
	\item Suppose that property is hold for $V=1,2,3\ldots k$
	\item For $V=k+1$, find the vertex with the least degree denoted as $u$, find a $5$-coloring of $G-u$\\
	      WLOG, let $\deg(u)=5$, and the five neighbors are colorized with $A,B,C,D,E$.\\
	      Denote $v_1,v_2,v_2,v_4,v_5$ the neighbors of $v$ \emph{in clockwise order}\footnote{we would partition the plane with the edges $\{u,v_1\},\{u,v_2\},\{u,v_3\},\{u,v_4\},\{u,v_5\}$}\\
	      \begin{itemize}
		      \item If there is a path $P$ from $v_1$ to $v_3$ such that the vertices on the path have either color $A$ or color $C$.\\
		            Consider the circuit $u\to v_1\to P\to v_3\to u$, it split the plane into two region (namely, inner and outer part) where $v_2$ is inside and $v_4,v_5$ are outside.\\
		            Perform the re-coloring opertion $(A,B,C,D,E)\to (A,D,C,B,E)$ inside the circle.\\
		            This is still a valid $5$-coloring of $G-u$ and we can now assign color $B$ to $u$ obtaining a $5$-coloring of $G$.
		      \item $v_1,v_3$ are not connected only using the vertices of color $A$ or $C$.\\
		            Take the subgraph $H$ induced by all vertices of color $A$ and $C$, $v_1,v_3$ are in different connected component. Perform re-coloring opertion $(A,C)\to (C,A)$ in the connected component of $H$ that contains $v_1$\\
		            This is still a valid $5$-coloring of $G-u$ and we can now assign color $A$ to $u$ obtaining a $5$-coloring of $G$.
	      \end{itemize}
\end{enumerate}

\newpage
\subsection*{illustration}
\includegraphics{images/ch5-five-coloring-p1.png}
\includegraphics{images/ch5-five-coloring-p2.png}

\newpage
\section{Number of centroid/center s in a (unrooted) tree}

\newcommand{\ECC}{\mathrm{ECC}}
\newcommand{\V}{\mathrm{Vertex}}
\newcommand{\N}{\mathrm{Neighbor}}
\newcommand{\dis}{\mathrm{dis}}
\newcommand{\subtree}{\mathrm{subtree}}
\newcommand{\height}{\mathrm{height}}

\subsection{center of a tree}

The eccentricity of a vertex in an unrooted tree is the length of the longest simple path beginning at this vertex.
A vertex is called a center if no vertex in the tree has smaller eccentricity than this vertex.\\
Let $\ECC{u}=\max_{v\in \V{T}}\dis{u}{v}$, the vertices with maximum ECC is called centers.

\subsection{counting centers}
only two cases
\begin{itemize}
	\item a unique center.
	\item two adjacent centers.
\end{itemize}

Suppose that $c\in \V(T)$ is a center of $T$.
Make $c$ the root of $T$ to obtain a rooted tree $T'$.\\
Let $\N(c)=\{u_1,u_2\ldots u_k\}$
s.t. $\height (u_1)=H_1\geq \height (u_2)=H_2\cdots \height (u_k)=H_k$,
then $\ECC_T(u)=H_1+1$\\
Denote the leaf with maximum level in $\subtree(u_i)$ using $L_i$.

\begin{enumerate}
	\item $H_1=H_2\geq H_3\geq H_4\cdots H_k$\\
	      $c$ is the unique center of $T$
	      \begin{itemize}
		      \item Centers in $\subtree(u_1)$ or $\subtree(u_2)$ do not exist.\\
		            Consider the path $c'\to c\to u_2\to L_2$,
		            we have $\ECC(c')\geq 1+1+H_2=2+H_1>\ECC(u)$.
		      \item Centers in $\subtree(u_3)\ldots \subtree(u_k)$  do not exist.\\
		            The path $c'\to u_i\to c\to u_1\to L_1$,
		            we have $\ECC(c')\geq 1+1+H_1> \ECC(u)$.
	      \end{itemize}
	\item $H_1-1=H_2\geq H_3\geq H_4\cdots H_k$\\
	      $c,u_1$ are the two adjacent centers of $T$.
				The longest simple path from $u_1$ is $u_1\to c\to u_2\to L_2$, $\ECC(u_1)=2+H_2=H_1+1=\ECC(c)$
	      \begin{itemize}
		      \item Centers in $\subtree(u_1)-\{u_1\}$ do not exist.\\
		            path $c'\to u_1\to c\to u_2\to L_2$,
								we have $\ECC(c')\geq 2+1+H_2=H_1+2>\ECC(c)$
		      \item Centers in $\subtree(u_2)\ldots \subtree(u_k)$  do not exist.\\
		            path $c'\to u_k\to c\to u_1\to L_1$,
								we have $\ECC(c')\geq 2+1+H_1>\ECC(c)$
	      \end{itemize}
	\item $H_1-2=H_2\geq H_3\geq H_4\cdots H_k$\\
	      This is impossible.
	      Otherwise $\ECC(u_1)=\max(H_1,H_2+1)=H_1<H_1+1 =\ECC(c)$,
	      $c$ can not be a center of $T$.
	      Contradiction.

\end{enumerate}

\end{document}


\documentclass{article}

\usepackage{amssymb}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

\usepackage{biblatex}
\addbibresource{bibliography.bib}

\begin{document}

\section{Background}

Given data $(y_i, x_i, z_i), i = 1, \dots, n$ with outcome $y_i \in \mathbb{R}$, covariates $x_i \in \mathbb{R}^p$ and effect modifiers $z_i \in \mathbb{R}^q$ one assumes the varying coefficient model
%
\begin{equation}
y_i = \sum_{j=1}^p x_{ij} \beta_j(z_i) + \varepsilon_i = x_i^T \beta(z_i) + \varepsilon_i,
\end{equation}
%
\cite{hastie1993varying}. The coefficients $\beta(\cdot) = (\beta_1(\cdot), \dots, \beta_p(\cdot))^T$ determine a (rather simple) functional, relationship between outcome $y$ and (likely low dimensional) covariate $x$. The coefficients themselves are considered to be (potentially complex) functions of the (potentially high dimensional) effect modifier $z$.\\
Each varying coefficient mapping $\beta_j(\cdot)$ is estimated using an ensemble of gradient
boosted decision trees. This is done by iteratively minimizing a loss function
%
\begin{equation}
    L(y, \beta) = \sum_{i=1}^n l(y_i, x_i^T\beta(z_i)).
\end{equation}
%
The generic gradient boosting algorithm described in \cite{friedman2001greedy} is adapted for the varying coefficient scenario. The resulting procedure is sketched in Algorithm~\ref{alg:vcboost} below. A similar algorithm has already been described by \cite{zhou2019tree}.
%
\begin{algorithm}[h]
\caption{VCBoost}
\label{alg:vcboost}
	\begin{algorithmic}[1]
		\State $\beta_j^{(0)}(z) = 0$, $j = 1, \dots, p$
		\For{$m = 1, \dots$, maxiter}
			\For{$j = 1, \dots, p$}
				\State $\tilde{y_i} = - \frac{\partial l(y_i, x_i^T\beta^{(m-1)}(z_i))}{\partial \beta_j^{(m-1)}(z_i)}$ \Comment{negative gradient wrt. $\beta_j$}
				\State $h = $ regression tree fit on $\{\tilde{y_i}, z_i\}_{i=1, \dots, n}$
				\State $\rho = $ argmin$_{\rho} \left[ \sum_{i=1}^n l (y, x_i^T\beta^{(m-1)}(z_i) + \rho h(z_i) x_{ij}) \right]$ \Comment{line search}
				\State $\beta_j^{(m)}(\cdot) = \beta_j^{(m-1)}(\cdot) + \rho h(\cdot)$
			\EndFor
		\EndFor
	\end{algorithmic}
\end{algorithm}\\
%
The pseudoresponses $\tilde{y_i}$ in Line 4 are obtained by noting that
%
\begin{equation}
\tilde{y_i} = - \frac{\partial l(y_i, x_i^T\beta^{(m-1)}(z_i))}{\partial \beta_j^{(m-1)}(z_i)} = - \frac{\partial l(y_i, x_i^T\beta^{(m-1)}(z_i))}{\partial x_i^T\beta^{(m-1)}(z_i)}x_{ij}
\end{equation}
%
and the derivative remaining on the right hand side is the usual gradient based on the previous fitted responses $x_i^T\beta^{(m-1)}(z_i)$. Hence, this is easily determined for common loss functions. Also this part of the pseudo response is the same, regardless of the coordinate ($j = 1, \dots, p$) currently handled in the inner loop. A variation of the algorithm only computes $\frac{\partial l(y_i, x_i^T\beta^{(m-1)}(z_i))}{\partial x_i^T\beta^{(m-1)}(z_i)}$ once during the outer loop and then updates all coefficient estimates before recomputing.\\
Also the line search determining the step size $\rho$ can be done globally, e.g. determining one $\rho$ based on all observations $i = 1, \dots n$ as shown above. Alternatively, the line search can be done separately for each leaf in the regression tree $h$ (see Eq. (18) in \cite{friedman2001greedy}).\\
As usual one can also introduce a learning rate $ < 1$ to shrink the step size for the update in row 7 of the algorithm.\\
Finally there would also be many hyper-parameters controlling the tree building process in line 5.

\subsection{Details for specific loss functions}
...

\printbibliography

\end{document}


\graphicspath{{Pics/}}

\newpage
\section{Conjugates}

\subsection{Isogonal Conjugate}

\begin{minipage}{.5\linewidth}
    \theo{https://artofproblemsolving.com/community/c2771h1181729}
    {Isogonal Line Lemma}{
        Let $AP,AQ$ are isogonal lines with respect to $\angle BAC$. Let $BP \cap
        CQ = F$ and $BQ \cap CP = E$. Then $AE,AF$ are isogonal lines with respect
        to $\angle BAC$.
    }

    \proof{
        \[\begin{aligned}
            A(B, F; P, X) &= (B, F; P, X) = C(B, Q; E, X) \\
                          &= (B, Q; E, X) = (X, E; Q, B)
        \end{aligned}\]
        So if we define a projective transformation that swaps isogonal lines wrt $
        \angle BAC $, we see $ AE, AF $ are conjugates of each other.
    }
\end{minipage}\hfill%
\begin{minipage}{.47\linewidth}
    \figdf{}{Isogonal_Lemma}{}
\end{minipage}

\prob{}
{India Postals 2015 Set 2}{E}{
    Let $ABCD$ be a convex quadrilateral. In the triangle $ABC$ let $I$ and
    $J$ be the incenter and the excenter opposite the vertex $A$,
    respectively. In the triangle $ACD$ let $K$ and $L$ be the incenter and
    the excenter opposite the vertex $A$, respectively. Show that the lines
    $IL$ and $JK$, and the bisector of the angle $BCD$ are concurrent.
}

\solu{
    Using \autoref{theorem:Isogonal Line Lemma}
}

\lem{}{
    Let $ \w_1, \w_2 $ be two circles such that $ \w_1 $ passes through $
    A, B $ and is tangent to $ AC $ at $ A $. $ \w_2 $ is defined similarly by
    swapping $ B $ with $ C $. $ \w_1\cap\w_2 = X $.

    Let $ \gamma_1, \gamma_2 $ be two circles such that $ \gamma_1 $ passes
    through $ A, B $ and is tangent to $ BC $ at $ B $. $ \gamma_2 $ is
    defined similarly by swapping $ B $ with $ C $. $ \gamma_1\cap\gamma_2 = Y$.

    Then $ X, Y $ are isogonal conjugates wrt $ \triangle ABC $.
}

\begin{minipage}{.5\linewidth}
    \lem{Isogonality in quadrilateral}{
        For a point $ X $, its isogonal conjugate wrt a quadrilateral $ ABCD $
        exists iff \[ \measuredangle BXA + \measuredangle DXC = 180^\circ\]
    }
    \solu{
        Draw the cirles, look for similarity.
    }
\end{minipage}\hfill%
\begin{minipage}{.49\linewidth}
\figdf{1}{isogonal_in_quad}{Isogonality in quadrilateral}
\end{minipage}

\begin{minipage}{.5\linewidth}
    \lem{Ratio}{
        Given a $ \triangle ABC $ with isogonal conjugate $ P, $ $ Q. $ Let $ AP,
        $ $ AQ $ cut the circumcircle of $ \triangle ABC $ again at $ U, $ $ V, $
        respectively and let $ D $ $ \equiv $ $ AP $ $ \cap $ $ BC. $ Then
        \[\frac{AQ}{QV} = \frac{PD}{DU}\]
    }
    \begin{prooof}
        By using cross ratio:
        \[\begin{aligned}
            (A, F; Q, V) &= C(A, F; Q, V)\\
                         &=C(D, A; P, V*) =(D, A; P, V*)\\
                         &=(A, D; V*, P)
        \end{aligned}\]
    \end{prooof}
\end{minipage}\hfill%
\begin{minipage}{.45\linewidth}
    \figdf{.9}{AoPS_c284651h2018537_cute_problem_on_radical_axis_1}{}
\end{minipage}

\newpage\subsubsection{Symmedians}

\begin{minipage}{.5\linewidth}
    \den{Symmedians}{
        In $ \triangle ABC $, let $ T_a, T_b, T_c $ be the meet points of the
        tangents at $ A, B, C $. Let $ \triangle N_aN_bN_c $ be the cevian
        triangle of $ AT_a, BT_b, CT_c $. Let $ S $ be the symmedian point of $
        \triangle ABC $. Let $ M_a, M_b, M_c $ be the midpoints of $ BC, CA, AB $.
    }

    \lem{Most Important Symmedian Property}{
        Let the circles tangent to $ AC, AB $ at $ A $ and passes through $ B, C $
        respectively meet at $ T' $ for the second time. Let $ AT_a\cap \odot ABC
        = A' $. Let the tangents to $ \odot ABC $ at $ A, A' $ meet $ BC $ at $ T
        $. Prove that, $ A, T', T_a, \text{ and } T, T', O $ are collinear.
    }

\end{minipage}\hfill%
\begin{minipage}{.47\linewidth}
    \figdf{}{Symmedian_Lemma_1}{$ T' $ is quite special!}
\end{minipage}

\vspace{2em}

\begin{minipage}{.5\linewidth}
    \prob{https://artofproblemsolving.com/community/c5h202907p1116181}
    {USAMO 2008 P2}{E}{
        Let $ ABC$ be an acute, scalene triangle, and let $ M$, $ N$, and $ P$
        be the midpoints of $ {BC}$, $ {CA}$, and $ {AB}$, respectively. Let
        the perpendicular bisectors of $ {AB}$ and $ {AC}$ intersect ray $ AM$
        in points $ D$ and $ E$ respectively, and let lines $ BD$ and $ CE$
        intersect in point $ F$, inside of triangle $ ABC$. Prove that points
        $ A$, $ N$, $ F$, and $ P$ all lie on one circle.
    }

    \begin{solution}[Phantom Point]
        First assume $ F\in BD, \text{ and } F=T' $ (Where $ T' $ comes from
        \autoref{lemma:Most Important Symmedian Property}, and prove that $
        F\in CE $.)
    \end{solution}
\end{minipage}\hfill%
\begin{minipage}{.47\linewidth}
    \figdf{}{USAMO_2008_P2}{USAMO 2008 P2}
\end{minipage}

\vspace{1em}

\begin{solution}[Isogonal Conjugate]
    Construct the isogonal conjugate of $ F $, which is the intersection of the circles touching $ BC $ and passing through $ A, B $ and $ A, C $.
\end{solution}
\solu{Using \autoref{theorem:Isogonal Line Lemma} by taking the reflections of $ B , C $ over $ D, F $}

\prob{https://artofproblemsolving.com/community/c6h1095220p4902494}
{IRAN TST 2015 Day 3, P3}{M}{
    $AH$ is the altitude of triangle $ABC$ and $H^\prime$ is the reflection of $H$
    trough the midpoint of $BC$. If the tangent lines to the circumcircle of $ABC$
    at $B$ and $C$, intersect each other at $X$ and the perpendicular line to
    $XH^\prime$ at $H^\prime$, intersects $AB$ and $AC$ at $Y$ and $Z$
    respectively, prove that $\angle ZXC=\angle YXB$.
}

\begin{minipage}{.5\linewidth}
    \prob{https://web.facebook.com/photo.php?fbid=539157073197109}
    {Two Symmedian Points}{E}{
        Let $E, F$ be the feet of $B, C$-altitudes. Let $K, K_A$ be the symmedian
        points of $\triangle ABC, \triangle AEF$. Prove that $KK_A\perp BC,
        KK_A\cap BC = P$ and $KK_A=KP$
    }
\end{minipage}\hfill%
\begin{minipage}{.45\linewidth}
    \figdf{.8}{Two_Symmedian_Points}{$KK_A\perp BC$}
\end{minipage}

\newpage\subsection{Isotonic Conjugate}

\theo{}{Isotonic Lemma}{Let $ M $ be the midpoint of $ BC $, and $ PQ $ such that $ Q $ is the reflection of $ P $ on $ M $. Two points $ Q, R $ on $ AP, AQ $, $ BQ\cap CR = X,\ BR\cap CQ = Y $. Then $ AX, AY $ are isotonic wrt $ BC $.
    \fig{1}{Isotonic_Lemma}{}
}\label{isotonic_lemma}

\prob{https://artofproblemsolving.com/community/c6h626330p3756450}{IGO 2014 S5}{M}{Two points $P$ and $Q$ lying on side $BC$ of triangle $ABC$ and their distance from the midpoint of $BC$ are equal.The perpendiculars from $P$ and $Q$ to $BC$ intersect $AC$ and $AB$ at $E$ and $F$,respectively.$M$ is point of intersection $PF$ and $EQ$.If $H_1$ and $H_2$ be the orthocenters of triangles $BFP$ and $CEQ$, respectively, prove that $ AM\perp H_1H_2 $.}

\solu{We first show that the slope of $ H_1H_2 $ is fixed, and then show that $ AM $ is fixed where we use \hrf{isotonic_lemma}{isotonic lemma}, and finally show that these two lines are perpendicular.}

\newpage\subsection{Reflection}

\lem{Homothety and Reflection}{Let two oppositely oriented congruent triangles be $ \triangle ABC, \triangle DEF $. Prove that the midpoints of $ AD, BE, CF $ are collinear.
    \fig{.7}{homothety+reflection}{Oppositely oriented congruent triangles}
}

\prob{}{Autumn Tournament, 2012}{E}{Let two oppositely oriented equilateral triangles be $ \triangle ABC, \triangle DEF $. What is the least possible value of $ \max{\left (AD, BE, CF\right )} $?}


\chapter{Literature Review}
\label{ch:review}
\vspace{2em}

P. Erdős and  A. Rényi started the study of Random Graphs \cite{erds:rand} in 1960, and in the same paper also asked the question about the existence of a Hamiltonian path in a random undirected graph.
This problem has been extensively studied over the years with a recent survey by Frieze \cite{frieze:2019survey} giving a very good introduction to all the different directions that this study of Hamiltonian Cycles in Random graphs has taken.

Pósa\cite{posa:ham} and Komlós$\&$ E. Szemerédi\cite{komlos:undir} made significant advances in the undirected version of the problem, showing that in $G_{n, m}$, $m \in \bigO(n\log n)$ is sufficient for a graph to be Hamiltonian.

Bollobas \cite{boll:ham} improved this result by showing that
\[ \lim_{n \rightarrow \infty} Pr( G_{m^*} \text{is hamiltonian}) = 1 \]
where $G_m$ is defined as the graph obtained by taking the first $m$ edges from the list $E = \{ e_1, e_2, \cdots e_{\frac{n(n-1)}{2}} \}$ obtained by permuting the edges of a complete graph on $n$ vertices, and $m^* = min\{m : \delta(G_m) \ge 2\}$

An analogous result for directed graphs was given by Frieze \cite{frieze:dham} while also giving a $\bigO(n^{1.5})$ algorithm(DHAM)  showing that
\[ \lim_{n \rightarrow \infty} Pr( \text{DHAM finds a hamilton cycle in } D_{m^*} ) = 1 \]
where $D_m$ is the directed analogue of $G_m$ defined above, and $m^* = min\{m : \delta^+(D_m) \ge 1, \delta^-(D_m) \ge 1\}$

The algorithm is divided into 3 phases, the first obtains a permutation digraph from the given graph (which is obtaining a permutation on the set of vertices such that they form $\bigO(\log n)$ cycles). The second merges some of the these cycles to get an asymptotically larger cycle. And the final phase merges all cycles to obtain the desired Hamiltonian cycle.

A somewhat similar 3-phase method has been used to obtain existential results on more classes of graphs (cite a few papers here and elaborate). These results do not usually explicitly give an algorithm, or try to bound the runtime of the same. In our thesis, we attempt to use the above 3-phase algorithm, to experimentally see, if the DHAM algorithm also runs successfully with polynomial growth on these classes of graphs.


% \documentclass[draft,11pt]{article}
%\documentclass[11pt]{article}

\subsection{Eigenvalue Bounds Beyond Test Vectors}

In the previous sections, we first saw a complete characterization of the
eigenvalues and eigenvectors of the unit weight complete graph on $n$
vertices, $K_n$. Namely, $\LL_{K_N} = n\II - \vecone \vecone^\trp$, and
this means that \emph{every} vector $\yy \perp \vecone$ is an
eigenvector of eigenvalue $n$.

We then looked at eigenvalues of $P_n$, the unit weight path on $n$
vertices, and we showed using \emph{test vector} bounds that

\begin{equation}
  \label{eq:testvectorbounds}
\lambda_2(\LL_{P_n}) \leq \frac{12}{n^2} \text{ and } 1 \leq
\lambda_n(\LL_{P_n}).
\end{equation}
%
Ideally we would like to prove an almost matching upper bound on
$\lambda_2$ and an almost matching lower bound on $\lambda_n$, but it
is not clear how to get that from the Courant-Fischer theorem.

To get there, we start we need to introduce some more tools.
% The Courant-Fischer theorem is not as helpful when we want to prove lower bounds on $\lambda_2$. To prove lower bounds, we need the form with a maximum on the outside, which gives
% \begin{align*}
% \lambda_2 \geq \max_{S : \dim{S} = n - 1 } \min_{ \vv\in S } \frac{ \vv^\top \LL \vv}{ \vv^\top \vv}
% \end{align*}
% This is not too helpful, as it is difficult to prove lower bounds on
% \begin{align*}
% \min_{ \vv\in S } \frac{ \vv^\top \LL \vv}{ \vv^\top \vv}
% \end{align*}
% over a space $S$ of large dimension. We need another technique.

\subsection{The Loewner Order, aka. the Positive Semi-Definite Order}
We'll now introduce an ordering on symmetric matrices called the
\emph{Loewner order}, which I also like to just call the positive
semi-definite order.
As we will see in a moment, it is a partial order on symmetric matrices, we denote
it by ``$\preceq$''.
For conveniece, we allow ourselves to both write  $\AA \preceq \BB$
and equivalently $\BB \succeq \AA$.

For a symmetric matrix $\AA \in \R^{n \times n}$ we define that
\begin{align*}
\AA \succeq \matzero
\end{align*}
if and only if $\AA$ is positive semi-definite.

More generally, when we have two symmetric matrices $\AA, \BB \in
\R^{n \times n}$, we will write

\begin{equation}
  \label{eq:psdorder}
  \AA \preceq \BB
  \text{ if and only if for all } \xx \in \R^n
  \text{ we have } \xx^{\trp} \AA \xx \leq \xx^{\trp} \BB
  \xx
\end{equation}

This is a partial order, because it satisfies the three requirements
of
\begin{enumerate}
\item Reflexivity: $\AA \preceq \AA$.
\item Anti-symmetry:
  $\AA \preceq \BB$ and $\BB \preceq \AA$
  implies $\AA = \BB$
\item Transitivity:    $\AA \preceq \BB$ and $\BB \preceq \CC$
  implies $\AA \preceq \CC$
\end{enumerate}
Check for yourself that these properties hold!

The PSD order has other very useful properties:
$\AA \preceq \BB$ implies $\AA + \CC \preceq \BB + \CC$ for any
symmetric matrix $\CC$. Convince yourself of this too!

And, combining this observation with transitivity, we can see that
$\AA \preceq \BB$  and $\CC\preceq \DD$
implies ${\AA + \CC \preceq \BB + \DD}$.

Here is another useful property: If $\matzero \preceq \AA$ then for all $\alpha \geq 1$
\[
 \frac{1}{\alpha} \AA \preceq \AA \preceq \alpha \AA.
\]

Here is another one:
\begin{claim}
  \label{clm:eigorderfrompsdorder}
If $\AA \preceq \BB$, then for all $i$
\[
\lambda_i(\AA) \leq \lambda_i(\BB).
\]
\end{claim}
\begin{proof}
  We can prove this Claim by applying the subspace version of the
  Courant-Fischer theorem.
\[
\lambda_i(\AA) =
\min_{
      \substack{
        \mathrm{subspace~} W \subseteq \R^n
        \\
        \dim{W} = i
      }
    }
    \max_{
      \xx \in W, \xx \neq \veczero
    }
    \frac{\xx^\trp \AA\xx}{\xx^\trp\xx}
\leq
 \min_{
      \substack{
        \mathrm{subspace~} W \subseteq \R^n
        \\
        \dim{W} = i
      }
    }
    \max_{
      \xx \in W, \xx \neq \veczero
    }
    \frac{\xx^\trp \BB\xx}{\xx^\trp\xx}
= \lambda_i(\BB).
\]
\end{proof}
Note that the converse of Clam~\ref{clm:eigorderfrompsdorder} is very
much false, for example the matrices
$ \AA =
\begin{pmatrix}
  2 & 0 \\
  0 & 1
\end{pmatrix}$
and $\BB = \begin{pmatrix}
  1 & 0 \\
  0 & 2
\end{pmatrix}$ have equal eigenvalues, but both $\AA \not\preceq \BB$ and
$\BB \not\preceq \AA$.

\begin{remark}
  It's useful to get used to and remember some of the properties of the Loewner
  order, but all the things we have established so far are almost
  immediate from the basic characterization in
  Equation~\eqref{eq:psdorder}.
  So, ideally, don't memorize all these facts, instead, try to see that
  they are simple consequences of the definition.
\end{remark}

\subsection{Upper Bounding a Laplacian's $\lambda_n$ Using Degrees}
In an earlier lecture, we observed that for any graph $G=(V,E,\ww)$,
$\LL = \DD - \AA \succeq \matzero$.
We can see this from
$\xx^\top (\DD-\AA) \xx = \sum_{ (u,v) \in E } \ww(u,v)
( \xx(u) - \xx(v) )^2 \geq 0$.
Similarly $\DD + \AA \succeq \matzero$. because
$\xx^\top (\DD+\AA) \xx = \sum_{ (u,v) \in E } \ww(u,v)
( \xx(u) + \xx(v) )^2 \geq 0$.
But this means that $-\AA \preceq \DD$ and hence $\LL = \DD-\AA
\preceq 2\DD$.

So, for the path graph $P_n$, we have
$\LL_{P_n} \preceq \DD-\AA \preceq 2\DD \preceq 4 \II$.
So by Claim~\ref{clm:eigorderfrompsdorder}
\begin{equation}
  \label{eq:pathlambdamaxub}
\lambda_n(\LL_{P_n}) \leq 4.
\end{equation}
We can see that our test vector-based lower bound on $\lambda_n(\LL_{P_n})$ from
Equation~\eqref{eq:testvectorbounds} is tight up
to a factor 4.

Since this type of argument works for any unit weight graph, it proves the following claim.
\begin{claim}
  \label{clm:lambdamaxfromeig}
  For any unit weight graph $G$,
  $\lambda_{n}(\LL_G) \leq 2 \max_{v
    \in V} \mathop{degree}(v)$.
\end{claim}
This is tight on a graph consisting of a single edge.

\subsection{The Loewner Order and Laplacians of Graphs.}
It's sometimes convenient to overload the for the PSD order to also
apply to graphs. We will write
\begin{align*}
G \preceq H
\end{align*}
if $\LL_{G} \preceq
\LL_H$.

For example, given two unit weight graphs
$G = (V,E)$ and $H = (V,F)$, if $H = (V,F)$ is a subgraph of $G$,
then
\begin{align*}
\LL_H \preceq \LL_G.
\end{align*}

We can see this from the Laplacian quadratic form:
\begin{align*}
\xx^\top \LL_G \xx = \sum_{ (u,v) \in E } \ww(u,v) ( \xx(u) - \xx(v) )^2.
\end{align*}
Dropping edges will only decrease the value of the quadratic form. The
same is for decreasing the weights of edges.
The graph order notation is especially useful when we allow for
scaling a graph by a constant, say $c > 0$,
\begin{align*}
c \cdot H \preceq G
\end{align*}
What is $c \cdot H$? It is the same graph as $H$, but the weight of
every edge is multiplied by $c$.
Now we can make statements like $\frac{1}{2} H \preceq G \preceq 2 H$,
which turn out to be useful notion of the two graphs approximating
each other.

% \subsection{Dan}
% I begin by recalling an extremely useful piece of notation that is used in the Optimization community. For a symmetric matrix $\AA$, we write
% \begin{align*}
% \AA \succeq 0
% \end{align*}
% if $\AA$ is positive semidefinite. That is, if all of the eigenvalues of $\AA$ are nonnegative, which is equivalent to
% \begin{align*}
% \vv^\top \AA \vv\geq 0,
% \end{align*}
% for all $\vv$. We similarly write
% \begin{align*}
% \AA \succeq {\bf B}
% \end{align*}
% if
% \begin{align*}
% \AA - {\bf B} \succeq 0
% \end{align*}
% which is equivalent to
% \begin{align*}
% \vv^\top \AA \vv\geq \vv^\top {\bf B} \vv
% \end{align*}
% for all $\vv$.

% The relation $\preceq$ is an example of a partial order. It applies to some pairs of symmetric matrices, while others are incomparable. But, for all pairs to which it does apply, it acts like an order. For example, we have
% \begin{align*}
% \AA \succeq {\bf B}, \mathrm{~and~} {\bf B} \succeq {\bf C} \mathrm{~implies~} \AA \succeq {\bf C},
% \end{align*}
% and
% \begin{align*}
% \AA \succeq {\bf B} \mathrm{~implies~} \AA + {\bf C} \succeq {\bf B} + {\bf C},
% \end{align*}
% for symmetric matrices ${\cal A}$, ${\cal B}$ and ${\cal C}$.

% I find it convenient to overload this notation by defining it for graphs as well. Thus, I'll write
% \begin{align*}
% G \succeq H
% \end{align*}
% if $\LL_{G} \succeq \LL_H$.

% For example, if $G = (V,E)$ is a graph and $H = (V,F)$ is a subgraph of $G$, then
% \begin{align*}
% \LL_G \succeq \LL_H.
% \end{align*}

% To see this, recall the Laplacian quadratic form:
% \begin{align*}
% \xx^\top \LL_G \xx = \sum_{ (u,v) \in E } w_{u,v} ( \xx(u) - \xx(v) )^2.
% \end{align*}
% It is clear that dropping edges can only decrease the value of the quadratic form. The same holds for decreasing the weights of edges.

% This notation is most powerful when we consider some multiple of a graph. Thus, I could write
% \begin{align*}
% G \succeq c \cdot H, \mathrm{~for~some~} c > 0.
% \end{align*}
% What is $c \cdot H$? It is the same graph as $H$, but the weight of every edge is multiplied by $c$.

% Using the Courant-Fischer Theorem, we can prove
% \begin{lemma}
% If $G$ and $H$ are graphs such that
% \begin{align*}
%  G \succeq c \cdot H,
% \end{align*}
% then
% \begin{align*}
% \lambda_k (G) \geq c \cdot \lambda_k(H), \mathrm{~for~all~} k.
% \end{align*}
% \end{lemma}
% \begin{proof}
% The Courant-Fischer Theorem tells us that
% \begin{align*}
% \lambda_k (G)
% = & ~ \min_{ S \subseteq \R^n, \dim{S} = k } \max_{ \xx \in S }
%  \frac{ \xx^\top \LL_G \xx }{ \xx^\top \xx } \\
% \geq & ~ c \dot \min_{ S \subseteq \R^n, \dim{S} = k } \max_{ \xx \in S } \frac{ \xx^\top L_H \xx }{ \xx^\top \xx } \\
% = & ~ c \cdot \lambda_k (H).
% \end{align*}
% \end{proof}

% \begin{corollary}
% Let $G$ be a graph and let $H$ be obtained by either adding an edge to $G$ or increasing the weight of an edge in $G$. Then, for all $i$,
% \begin{align*}
% \lambda_i (G) \leq \lambda_i (H).
% \end{align*}
% \end{corollary}

% \subsection{Approximations of Graphs}
% An idea that we will use in later lectures is that one graph approximations another if their Laplacian quadratic forms are similar. For example, we will say that $H$ is a $c$-approximation of $G$ if
% \begin{align*}
% c \cdot H \succeq G \succeq H /c.
% \end{align*}
% Surprising approximations exist.

% For example, expander graphs are very sparse approximations of the complete graph. For example, the following is known
% \begin{theorem}
% For every $\epsilon > 0$, there exists a $d > 0$ such that for all sufficiently large $n$ there is a $d$-regular graph $G_n$ that is $(1+\epsilon)$-approximation of $K_n$.
% \end{theorem}

% These graphs have many fewer edges than the complete graphs!
% In a latter lecture we will also prove that every graph can be well-approximated by a sparse graph.

\subsection{The Path Inequality}
Now, we'll see a general tool
for comparing two graphs $G$ and $H$ to prove
an inequalities like $c H
\preceq G$ for some constant $c$.
Our tools won't necessarily work well for all cases, but we'll see
some examples where they do.

% By now you should be wondering, ``how do we prove that $G \succeq c \cdot H$ for some graph $G$ and $H$?'' Not too many ways are known. We'll do it by proving some inequalities of this form for some of the simplest graphs, and then extending them to more general graphs.
In the rest of the lecture, we will often need to compare two graphs
define on the same vertex set $V = \setof{1,\ldots,n} = [n]$.

We use $G_{i,j}$ to denote the unit weight graph on vertex set $[n]$
consisting of a single edge between vertices $i$ and $j$.

\begin{lemma}[The Path Inequality]
  \label{lem:pathineq}
\begin{align*}
(n-1) \cdot P_n \succeq G_{1,n},
\end{align*}
\end{lemma}
% The following very simple proof of this inequality was discovered by Sam Daitch.
% \begin{lemma}
% \begin{align*}
% (n-1) \cdot P_n \succeq G_{1,n}.
% \end{align*}
% \end{lemma}
\begin{proof}

We want to show that for every $\xx \in \in \R^n$,
\begin{align*}
(n-1) \cdot \sum_{i=1}^{n-1} ( \xx(i+1) - \xx(i) )^2 \geq ( \xx(n) - \xx(1) )^2.
\end{align*}
For $i \in [n-1]$, set
\begin{align*}
\DDelta (i) = \xx(i+1) - \xx(i).
\end{align*}
The inequality we want to prove then becomes
\begin{align*}
(n-1) \sum_{i=1}^{n-1} ( \DDelta(i) )^2 \geq \left( \sum_{i=1}^{n-1} \DDelta (i)  \right)^2.
\end{align*}
But, this is immediate from the Caucy-Schwarz inequality
$\aa^{\trp}\bb \leq \norm{\aa}_2\norm{\bb}_2$:
\begin{align*}
(n-1) \sum_{i=1}^{n-1} ( \DDelta (i) )^2
= & ~ \| \vecone_{n-1} \|^2 \cdot \| \DDelta \|^2 \\
= & ~ ( \| \vecone_{n-1} \| \cdot \| \DDelta \| )^2 \\
\geq & ~  ( \vecone^\top_{n-1} \DDelta )^2  \\
= & ~ (  \sum_{i=1}^{n-1} \DDelta(i) )^2
\end{align*}
\end{proof}
% \Zhao{We skip Lemma 4.6.2}

\subsection{Lower Bounding $\lambda_2$ of a Path Graph}

We will now use Lemma~\ref{lem:pathineq} to prove a lower bound on $\lambda_2(\LL_{P_n})$.
% I'll now demonstrate the power of Lemma 4.6.1 by using it to prove a lower bound on $\lambda_2 (P_n)$ that will be very close to the upper bound we obtained from the test vector.
% To prove a lower bound on $\lambda_2 (P_n)$, we
Our strategy will be to prove that the path $P_n$ is at least some multiple of the
complete graph $K_n$, measured by the Loewner order, i.e. $K_n \preceq
f(n) P_n$ for some function $f: \N \to \R$.
We can combine this with our observation from the previous lecture
that $\lambda_2 (\LL_{K_n}) = n$ to show that
\begin{align}
  \label{eq:pathtocompleteeig}
f(n) \lambda_2(\LL_{P_n}) \geq \lambda_2(\LL_{K_n}) = n,
\end{align}
and this will give our lower bound on $\lambda_2(\LL_{P_n}).$
% will prove that some multiple of the path is at least the complete
% graph. To this end, write
When establishing the inequality between $P_n$ and $K_n$, we can treat
each edge of the complete graph separately, by first noting that
\begin{align*}
\LL_{K_n} = \sum_{i < j} \LL_{G_{i,j}}
\end{align*}
For every edge $(i,j)$ in the complete graph, we apply the Path
Inequality, Lemma~\ref{lem:pathineq}:
\begin{align*}
  \label{eq:1}
G_{i,j}
\preceq & ~ (j-i) \sum_{k=i}^{j-1} G_{k,k+1} \\
\preceq & ~ (j-i) P_n
\end{align*}
This inequality says that $G_{i,j}$ is at most $(j-i)$ times the part of the path connecting $i$ to $j$, and that this part of the path is less than the whole.

Summing inequality (4.3) over all edges $(i,j) \in K_n$ gives
\begin{align*}
K_n = \sum_{i < j} G_{i,j} \preceq \sum_{i < j}  (j-i)P_n.
\end{align*}
To finish the proof, we compute
\begin{align*}
\sum_{i < j}  (j-i) \leq \sum_{i < j}  n \leq n^3
\end{align*}

So
\begin{align*}
L_{K_n} \preceq n^3 \cdot L_{P_n}.
\end{align*}

Plugging this into Equation~\eqref{eq:pathtocompleteeig}
we obtain
\begin{align*}
\frac{1}{ n^2 } \leq \lambda_2 (P_n).
\end{align*}
This only differs from our test vector-based upper bound in
Equation~\eqref{eq:testvectorbounds} by a factor 12.

We could make this consirably tigher by being more careful about the sums.

\subsection{Laplacian Eigenvalues of the Complete Binary Tree}

Let's do the same analysis with the complete binary tree with unit
weight edges on $n =
2^{d+1}-1$ vertices, which we
denote by $T_d$.

$T_d$ is the balanced binary tree on this many vertices, i.e. it
consists of a root node, which has two children, each of those
children have two children and so on until we reach a depth of $d$
from the root, at which point the child vertices have no more
children.
A simple induction shows that indeed $n = 2^{d+1}-1$.

We can also describe the edge set by saying that each node $i$ has
edges to its children $2i$ and $2i+1$ whenever the node labels do not
exceed $n$.
We emphasize that we still think of the graph as undirected.

\paragraph{The largest eigenvalue.}
We'll start by above bounding $\lambda_n(\LL_{T_d})$ using a test
vector.

We let $\xx(i) = 0$ for all nodes that have a child node, and $\xx(i)
= -1$ for even-numbered leaf nodes and $\xx(i) = +1$ for odd-numbered
leaf nodes.
Note that there are $(n+1)/2$ leaf nodes, and every leaf node has a
single edge, connecting it to a parent with value $0$.
Thus
\begin{align}
\lambda_n(\LL) = \max_{ \substack{ \vv \neq \veczero} } \frac{
  \vv^\top \LL \vv}{ \vv^\top \vv}
  \geq
  \frac{\xx^\top \LL \xx}
  { \xx^\top \xx}
  =
  \frac{ (n+1)/2 }{ (n+1)/2 }
  = 1
  .
\end{align}
Meanwhile, every vertex has degree at most 3, so by
Claim~\ref{clm:lambdamaxfromeig}, $\lambda_n(\LL) \leq 6$.
So we can bound the largest eigenvalue above and below by constant.

\paragraph{$\lambda_2$ and diameter in any graph.}
The following lemma gives a simple lower bound on $\lambda_2$ for any
graph.
\begin{lemma}
  \label{lem:lambda2diam}
  For any unit weight graph $G$ with diameter $D$,
  \[
    \lambda_2(\LL_G) \geq \frac{1}{nD}.
    \]
\end{lemma}
\begin{proof}
  We will again prove a lower bound comparing $G$ to the complete
  graph. For each edge $(i,j) \in K_n$, let $G^{i,j}$ denote a
  shortest path in $G$ from $i$ to $j$. This path will have length at most $D$. So, we have
\begin{align*}
K_n
= & ~ \sum_{i < j} G_{i,j} \\
\preceq & ~ \sum_{i < j} D G^{i,j} \\
\preceq & ~ \sum_{i < j} D G \\
\preceq & ~ n^2 D G.
\end{align*}
So, we obtain the bound
\begin{align*}
n^2D \lambda_{2} (G) \geq n,
\end{align*}
which implies our desired statement.
\end{proof}

\paragraph{$\lambda_2$ in a tree.}
Since a complete binary tree $T_d$ has diameter $2d \leq 2\log_2(n)$,
by Lemma~\ref{lem:lambda2diam}, $\lambda_2(\LL_{T_d}) \geq
\frac{1}{2n\log_2(n)}$.

Let us give an upper bound on $\lambda_2$ of the tree using a test
vector.
Let $\xx \in \R^v$ have $\xx(1) = 0$ and $\xx(i) = -1$ for $i$ in the left
subtree and $\xx(i) = +1$ in the right subtree.
Then
\begin{align*}
\lambda_2(\LL_{T_d}) = \min_{ \substack{ \vv \neq \veczero \\ \vv^\top
  \vecone = 0} } \frac{ \vv^\top \LL \vv}{ \vv^\top \vv}
  \leq
  \frac{ \xx^\top \LL \xx}{ \xx^\top \xx}
  =
  \frac{2}{n-1}.
\end{align*}
So, we have shown
$\frac{1}{2n\log_2(n)} \leq \lambda_2(\LL_{T_d})
\leq \frac{2}{n-1}$, and unlike the previous examples, the gap is more
than a constant.

In the exercises for Week 3, I will ask you to improve the lower bound to
$1/(cn)$ for some constant $c$.

% \FloatBarrier
% \bibliographystyle{alpha}
% \bibliography{refs}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "agao21_script"
%%% TeX-engine: luatex
%%% End:


\par
\section{Driver programs for the {\tt A2 object}}
\label{section:A2:drivers}
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
test_norms msglvl msgFile type nrow ncol inc1 inc2 seed
\end{verbatim}
This driver program tests the {\tt A2} norm methods.
Use the script file {\tt do\_norms} for testing.
When the output file is loaded into matlab,
the last two lines contain matrices whose
entries should all be around machine epsilon.
\par
\begin{itemize}
\item
The {\tt msglvl} parameter determines the amount of output.
Use {\tt msglvl = 1} for just timing output.
\item
The {\tt msgFile} parameter determines the message file --- if {\tt
msgFile} is {\tt stdout}, then the message file is {\it stdout},
otherwise a file is opened with {\it append} status to receive any
output data.
\item
The {\tt type} parameter denotes the type of entries ---
{\tt SPOOLES\_REAL} or {\tt SPOOLES\_COMPLEX}
\item
The {\tt nrow} parameter is the number of rows.
\item
The {\tt ncol} parameter is the number of rows.
\item
The {\tt inc1} parameter is the row increment.
\item
The {\tt inc2} parameter is the column increment.
\item
The {\tt seed} parameter is a random number seed.
\end{itemize}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
test_QR msglvl msgFile type nrow ncol inc1 inc2 seed
\end{verbatim}
This driver program tests the {\tt A2\_QRreduce()} and
{\tt A2\_QRreduce2()} methods which reduce $A$ to $QR$
via rank-1 and rank-2 updates.
Use the script file {\tt do\_QR} for testing.
When {\tt msglvl > 1}, the matrix $A$ and matrices $R1$ and $R2$
(computed from {\tt A2\_QRreduce()} and
{\tt A2\_QRreduce2()}, respectively)
are printed to the message file.
When the output file is loaded into matlab,
the errors $A^TA - R_1^TR_1$ and $A^TA - R_2^TR_2$
(if $A$ is real)
or
the errors $A^HA - R_1^HR_1$ and $A^HA - R_2^HR_2$
(if $A$ is complex) are computed.
\par
\begin{itemize}
\item
The {\tt msglvl} parameter determines the amount of output.
Use {\tt msglvl = 1} for just timing output.
\item
The {\tt msgFile} parameter determines the message file --- if {\tt
msgFile} is {\tt stdout}, then the message file is {\it stdout},
otherwise a file is opened with {\it append} status to receive any
output data.
\item
The {\tt type} parameter denotes the type of entries ---
{\tt SPOOLES\_REAL} or {\tt SPOOLES\_COMPLEX}
\item
The {\tt nrow} parameter is the number of rows.
\item
The {\tt ncol} parameter is the number of rows.
\item
The {\tt inc1} parameter is the row increment.
\item
The {\tt inc2} parameter is the column increment.
\item
The {\tt seed} parameter is a random number seed.
\end{itemize}
%-----------------------------------------------------------------------
\end{enumerate}


\chapter{k-Nearest Neighbors}
\label{ch:knn}

The idea of k-nearest neighbors is simple - find k instances that are the most similar to each data instance. We make the prediction or estimate probabilities based on the classes of these k instances. For classification, the final label is the majority label of k nearest instances. For regression, the final value is the average value of k nearest instances.

\begin{marginfigure}
    \includegraphics[width=50mm]{knn.png}%
    \caption{kNN classifier looks at k nearest neighbors, say 5, of instance X. 4 neighbors belong to the red class and 1 to the blue class. X will thus be classified as red with 80\% probability.}
\end{marginfigure}

Unlike most other algorithms, kNN does not construct a model but just stores the data. This kind of learning is called \textit{lazy learning}.

\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{workflow.png}
    \caption{$\;$}
\end{figure}

The advantage of kNN algorithm is that it can successfully model the data, where classes are not linearly separably. It can also be re-trained quickly, because new data instances effect model only locally. However, the first training is can be slow for large data sets, as the model has to estimate k distances for data instance.

\begin{figure*}[h]
    \centering
    \includegraphics[scale=0.4]{knn-orange.png}
    \caption{$\;$}
\end{figure*}


\subsection{Metropolis-Hastings Accept/Reject}
Written in terms of these transformations, the augmented leapfrog operator
$\mathbf{L}_{\theta}$ consists of $M$ sequential applications of the
single-step leapfrog operator $\mathbf{L}_{\theta} \xi = \mathbf{L}_{\theta}(x,
v, d) = (x^{\prime\prime\times M}, v^{\prime\prime\times M}, d)$, followed by
the previously-defined momentum flip operator $\mathbf{F}$ which flips the
direction variable $d$, i.e.\ $\mathbf{F}\xi = (x, v, -d)$.
%
Using these, we can express a complete molecular dynamics update step as
$\mathbf{FL}_{\theta}\xi = \xip$, where now the Metropolis-Hastings acceptance
probability for this proposal is given by
%
\begin{equation}
    A(\mathbf{F}\mathbf{L} \xi | \xi) = \min\left(1,
        \frac{p(\mathbf{F}\mathbf{L}\xi)}{p(\xi)}\left|
        \frac{\partial\left[\mathbf{F}\mathbf{L}\xi\right]}
            {\partial\xi^{T}}\right|\right),
\end{equation}
%
Where $\left|\frac{\partial\left[\mathbf{F}\mathbf{L}\xi\right]}
{\partial\xi^{T}}\right|$ denotes the determinant of the Jacobian describing
the transformation.

In contrast to generic HMC where
$\left|\frac{\partial\left[\mathbf{F}\mathbf{L}\xi\right]}
{\partial\xi^{T}}\right| = 1$, we now have non-symplectic transformations
(i.e.\ non-volume preserving) and so we must explicitly account for the
determinant of the Jacobian.
%
These non-volume preserving transformations have the effect of deforming the
energy landscape, which, depending on the nature of the transformation, may
allow for the exploration of regions of space which were previously
inaccessible.
%
\newcommand{\energyA}{\includegraphics[width=0.4\textwidth]{energy_landscape/original_energy_landscape.pdf}}
\newcommand{\energyB}{\includegraphics[width=0.4\textwidth]{energy_landscape/modified_energy_landscape.pdf}}
%
\begin{figure}
  \centering
  \Huge
  \parbox{\widthof{\energyA}}{\energyA} $\overset{\mathcal{J}}{\longrightarrow}$
  \parbox{\widthof{\energyB}}{\energyB}
  \normalsize
  \caption{Example of how the determinant of the Jacobian can deform the energy landscape.}
\end{figure}

To simplify our notation, introduce an additional operator $\mathbf{R}$ that
re-samples the momentum and direction, e.g.\ given $\xi = (x, v, d)$,
$\mathbf{R}\,\xi = (x, v^{\prime}, d^{\prime})$ where $v^{\prime} \sim
\mathcal{N}(0, I)$, $d^{\prime} \sim \mathcal{U}\left(\{-1, 1\}\right)$.
%
A complete sampling step of our algorithm then consists of the following two
steps:
%
\begin{enumerate}
    \item $\xi^{\prime} = \mathbf{FL}_{\theta} \,\xi$ with probability
        $A(\mathbf{FL}_{\theta}\,\xi|\xi)$ %(Eq.~\ref{eq:metropolis_hastings}),
        otherwise $\xi^{\prime} = \xi$.
    \item $\xi^{\prime} = \mathbf{R}\,\xi$.
\end{enumerate}
%
Note however, that for MH to be well-defined, this deterministic operator must
be \emph{invertible} and \emph{have a tractable Jacobian} (i.e.\ we can compute
its determinant).
%
In order to make this operator invertible, we augment the state space $(x, v)$
into $(x, v, d)$, where $d \in \{-1, 1\}$ is drawn with equal probability and
represent the direction of the update.
%
All of the previous expressions for the augmented leapfrog updates represent
the forward ($d = 1$) direction.
%
We can derive the expressions for the backward direction ($d = -1$) by
reversing the order of the updates (i.e.\ $\vpp \rightarrow \vp$, then $\xpp
\rightarrow \xp$, followed by $\xp \rightarrow x$ and finally $\vp \rightarrow
v$).
%
For completeness, we include in Sec.~\ref{sec:lf_forward} and
Sec~\ref{sec:lf_backward} all of the equations (both forward and backward
directions) relevant for updating the variables of interest in our augmented
leapfrog sampler.
\section{Forward Direction \texorpdfstring{$(d = 1)$}{(d = 1)}:}%
\label{sec:lf_forward}
% \vspace{-20pt}
\begin{align}
  \label{eq:forward_update}
  \vp &= v \odot \exp{\left(\frac{\eps}{2}S_{v}(\zeta_{1})\right)}%
        - \frac{\eps}{2}\left[\partial_{x}\,U(x)\odot \exp{\left(\eps
          Q_{v}(\zeta_{1})\right)}%
        + T_{v}(\zeta_{1})\right] \\
  \xp &= x_{\bar{m}^{t}} + m^{t}\odot \left[x \odot \exp{\left(\eps
    S_{x}(\zeta_{2})\right)}%
        + \eps\left(\vp\odot\exp{\left(\eps Q_{x}(\zeta_{2})\right)}
          + T_{x}(\zeta_{2})\right)\right] \\
  \xpp &= x^{\prime}_{m^{t}} + \bar{m}^{t}\odot \left[\xp \odot \exp{\left(\eps
    S_{x}(\zeta_{3})\right)}%
        + \eps\left(\vp\odot\exp{\left(\eps Q_{x}(\zeta_{3})\right)} +
      T_{x}(\zeta_{3})\right)\right] \\
  \vpp &= \vp \odot \exp{\left(\frac{\eps}{2}S_{v}(\zeta_{4})\right)}%
        - \frac{\eps}{2}\left[\partial_{x}\,U(\xpp)\odot \exp{\left(\eps
          Q_{v}(\zeta_{4})\right)}%
          + T_{v}(\zeta_{4})\right]
\end{align}
%
With $\zeta_{1} = (x, \partial_{x}\, U(x), t)$, $\zeta_{2} = (x_{\bar{m}^{t}},
v, t)$, $\zeta_{3} = (x^{\prime}_{m^{t}}, v, t)$, $\zeta_{4} = (\xpp,
\partial_{x}\, U(\xpp), t)$.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\section{Backward Direction \texorpdfstring{$(d = -1)$}{(d = -1)}:}%
\label{sec:lf_backward}
%
\begin{align}
  \label{eq:backward_update}
  v^{\prime} &= {\left\{v + \frac{\eps}{2}\left[\partial_{x}\,U(x)\odot
        \exp{\left(\eps Q_{v}(\zeta_{1})\right)}%
    + T_{v}(\zeta_{1})\right]\right\}} \odot
    \exp{\left(-\frac{\eps}{2}S_{v}(\zeta_{1})\right)} \\
  \xp &= x_{m^{t}} + \bar{m}^{t}\odot%
    {\left[x - \eps{\left(\exp{\left(\eps Q_{x}(\zeta_{2})\right)}\odot \vp%
    + T_{x}(\zeta_{2})\right)}\right]}\odot \exp{\left(-\eps
    S_{x}(\zeta_{2})\right)} \\
  \xpp &= x_{\bar{m}^{t}} + m^{t}\odot%
    {\left[\xp - \eps{\left(\exp{\left(\eps Q_{x}(\zeta_{3})\right)}\odot \vp%
    + T_{x}(\zeta_{3})\right)}\right]}\odot \exp{\left(-\eps
    S_{x}(\zeta_{3})\right)} \\
  v^{\prime\prime} &= {\left\{\vp +
      \frac{\eps}{2}\left[\partial_{x}\,U(\xpp)\odot%
        \exp{\left(\eps Q_{v}(\zeta_{1})\right)}
  + T_{v}(\zeta_{1})\right]\right\}}\odot
    \exp{\left(-\frac{\eps}{2}S_{v}(\zeta_{4})\right)}
\end{align}
%
With $\zeta_{1} = (x, \partial_{x}\, U(x), t)$, $\zeta_{2} = (x_{m^{t}}, v,
t)$, $\zeta_{3} = (x^{\prime}_{\bar{m}^{t}}, v, t)$, $\zeta_{4} = (\xpp,
\partial_{x}\, U(\xpp), t)$.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Determinant of the Jacobian}
In terms of the auxiliary functions $S_{i}, Q_{i}, T_{i}$, we can compute the
Jacobian:
%
\begin{align}
  \log|\mathcal{J}|
  &= \log\bigg|\frac{\partial{\left[\mathbf{FL}_{\theta}\xi\right]}}{\partial
  \xi^{T}}\bigg|\\
  &= d \sum_{t\leq N_{\mathrm{LF}}}
    {\left[\frac{\eps}{2} \mathbbm{1}\cdot S_{v}(\zeta_{1}^{t}) + \eps m^{t}
        \cdot S_{x}(\zeta_{2}^{t})
      + \eps \bar{m}^{t} \cdot S_{x}(\zeta_{3}^{t}) + \frac{\eps}{2}\mathbbm{1}
\cdot S_{v}(\zeta_{4}^{t})\right]}.  \end{align}
%
where $N_{\mathrm{LF}}$ is the number of leapfrog steps, and $\zeta_{i}^{t}$
denotes the intermediary variable $\zeta_{i}^{t}$ at time step $t$ and $d$ is
the direction of $\xi$, i.e.\ $d = 1 \,\, (-1)$ for the forward (backward)
update.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\subsection*{Generating Adversarial Samples}
Randomly sampling the noise field to find samples close to a certain image would be time-consuming and inefficient. Luckily generating adversarial input images can be done by using the Fast Method (eq \ref{FastMethod}) proposed by \citeauthor{goodfellow2015explaining}.
\begin{equation}
    X^{adv} = X + \epsilon * sign(\nabla_{x}J(X, y_{true}))
    \label{FastMethod}
\end{equation}
With $X$ being the input image, $\epsilon$ a hyperparameter determining much the original image can be perpetrated and $J(X, y_{true})$ the loss function which to, in the adversarial case, maximize.

\subsection*{Steering Adversarial Samples}
To steer the network towards a specific output we can adjust the equation \ref{FastMethod} to minimize a loss function with a given target $y$.
\begin{equation}
    X^{steer} = X - \epsilon * sign(\nabla_{x}J(X, y_{target}))
\end{equation}
Where $y_{target}$ can be determined to be anything.

\subsection*{Evaluation}
To determine if the model is indeed susceptible the BLEU scores will be calculated for different values of $\epsilon$. Furthermore, to also investigate if the semantic meaning of the sentence is significantly affected, the cosine similarity of the original and adversarial output will be calculated using universal sentence embedding proposed by \citeauthor{DBLP:journals/corr/abs-1803-11175}.
To see if the model can also be steered the BLEU score and cosine similarity are calculated with respect to the $y_{target}$.


\section{Bitvector reasoning}
\label{sect:bv}

Remember our first \vcc{min()} example?  Surprisingly it can get more involved.
For example the one below does not use a branch.

\vccInput[linerange={begin-}]{c/01_min5.c}

\noindent
The syntax:
\begin{VCC}
_( assert {bv} \forall int x; (x & -1) == x )
\end{VCC}

\noindent
VCC to prove the assertion using the fixed-length bit vector theory, a.k.a. machine integers.
This is then used as a lemma to prove the postcondition.


\section{Response Theory for (3+1)D Topological Insulator}
The response theory has action
\begin{align}
    S[A,g] &=
    \theta\cdot \frac{1}{32\pi^2}
    \int_{M^4} F_{\mu\nu}F_{\lambda\sigma} \epsilon^{\mu\nu\lambda\sigma}
    - \frac{1}{48}
    \int \frac{1}{\left( 2\pi \right)^2} \Tr R\wedge R
\end{align}
where $\theta=\pi$ for non-trivial and $\theta=0$ for trivial.
Recall that
\begin{align}
    \int F_{\mu\nu}F_{\lambda\sigma} \epsilon^{\mu\nu\lambda\sigma}
    =
    \vec{E}\cdot\vec{B}
\end{align}

The physical consequences are TME:
\begin{enumerate}
    \item Domain wall in $\theta$, $\frac{1}{2}$ integer Hall conductance at
        surface.
    \item Witten effect
        \begin{align}
            Q_e &= \frac{1}{2}Q_m
        \end{align}
    \item Magnetic field induces charge polarization
\end{enumerate}
the current is
\begin{align}
    j^{\mu} &= \frac{\delta S}{\delta A^\mu}
    = \frac{1}{2\pi} \epsilon^{\mu\nu\lambda\sigma}
    \partial_\nu \theta \partial_\lambda A_\sigma
\end{align}
Let $\theta$ be uniform and time-dependent
\begin{align}
    j^i &=
    -\frac{1}{2\pi}
    \epsilon^{tijk} \partial_t \theta \partial_j A_k\\
    &= -\frac{1}{2\pi}\partial_t \theta\cdot B^i
\end{align}
so then the current is
\begin{align}
    \vec{j} &=
    \frac{\partial\vec{p}}{\partial t}\\
    &=
    -\frac{1}{2\pi} \partial_t \theta \vec{B}
\end{align}
and so the magnetic polarizability is
\begin{align}
    \vec{P} &=
    -\frac{\theta}{2\pi}\vec{B} + \mathrm{const}
\end{align}
For a topological insulator $\theta=\pi$.
It's a bulk polarization but poarlizaiton only has an effect on the surface.
When I change $\theta$ from 0 to $3\pi$ for example,
my quantum hall effeect on the surface is $\left(1 + \frac{1}{2}\right)e^2/h$.

In 1D I can always add an integer charge on the surface.
If I put $2\pi$ here,
the efect is tackign on a quantum hall effect on the surace.
The bulk didn't play a special role,
it's just something intrinsicaly 2D you can do.

\begin{question}
    Why is QHE layer the same as surface charge?
\end{question}
The magnetic field induces the surface carge.
Charge density is attached to magnetic field in the integer quantum hall effect.

\begin{question}
    How do you physically increase $\theta$?
    Whatif you wanted to?
\end{question}
This was just a trick to get this eqution.
Every insulator in 3D has a $\theat$.
Could be anything.
Buti f it's time-reversal invariatn,
it's pinned to $0$ or $\pi$.
What $\theta$ is for a specific material,
its' a aproperty of hte matieral.

\begin{question}
    Insead of magnetic field, the charge goes ot the edge of the system?
\end{question}
If I insert a magnetic field localy,
I locally get a charge.
If I insert a uniform magnetic field then I get a uniform charge.

\begin{question}
    So the divergence of $\vec{B}$ is zero,
    does that mean there's no net charge within anywhere in the system?
\end{question}
From the Witten effect,
charge is attached to the monopole.
If you have no monopoles,
then you won't have any.

I told you all thsi stuff,
just asserted the response theory of the TI  has a $\theta$ term,
but I didn't derive it from any mdoel.
I want to give you one type of model.
This goes back to the dimensional reduction from (4+1)D.

To describe (3+1)D TI,
it's useful to start with a (4+1)D analogue of the Chern insulator.

What is a (4+1)D Chern insualtor?
In 2+1D,
we wrote the berry connection.
But now you have to define a non-abelian Berry connection.
\begin{align}
    a_i^{\alpha\beta} &=
    -i \bra{\alpha,k} \frac{\partial}{\partial k_i} \ket{\beta,k}\\
    f_{ij}^{\alpha\beta} &=
    \partial_i a_j^{\alpha\beta}
    - \partial_j a_i^{\alpha\beta}
    + i\left[ a_i, a_j \right]^{\alpha\beta}
\end{align}
where $i,j$ are spatial indices and $\alpha\beta$ are band indices.
The second Chern number is
\begin{align}
    C_2 &=
    \frac{1}{32\pi^2} \int d^4k
    \epsilon^{ijkl} \Tr f_{ij}f_{kl}
\end{align}
Here we get a (4+1)D Chern-Simons term
\begin{align}
    S_{CS,4+1} &=
    \int
    \frac{C_2}{24\pi^2} A_{\mu}\partial_\nu A_\lambda \partial_\rho A_\sigma
    \epsilon^{\mu\nu\lambda\sigma}
\end{align}
There isa Maxwell term with two factors of $A$,
but here we have3 factors of $A$,
so this is subleading,
but this term is topological,
wherease Maxwell si not toolgocial.

In (2+1)D we had a model for the Chern Insulator,
where it's basically a massive Dirac fermion you put on a lattice.

Here we write a $(4+1)D$ massive Dirac fermion instead.
So the mdoel for the $(4+1)D$ Chern insulator is a massive Dirac fermion,
which in momentum space you would write
\begin{align}
    H &= \sum_k \psi_k^\dagger d_a(k)\Gamma^a \psi_k
\end{align}
where the $\psi_k$ are 4-component fermions,
and these $\Gamma$ are $(4+1)D$ Dirac matrices which satisfy the Clifford
algebra
\begin{align}
    \left\{ \Gamma^\mu, \Gamma^\nu \right\} = 2\delta_{\mu\nu}
\end{align}
where $\mu,\nu=0,\ldots,4$.
And our lattice vectors are
\begin{align}
    d(k) &=
    \left(
    m + c\sum_{i}\cos k_k,
    \sin k_x,
    \sin k_y,
    \sin k_z,
    \sin k_w,
    \right)
\end{align}
and to be concrete,
we can write explicityly the Gamma matrices
\begin{align}
    \Gamma^a &=
    \sigma^a \otimes \tau^2
\end{align}
for $a=1,2,3$
and
\begin{align}
    \Gamma^4 = I\otimes \tau^1\\
    \gamma^0 &= I\otimes \tau^3
\end{align}
and the lattice vectors
\begin{align}
    \hat{d}(k) &=
    \frac{\vec{d}(k)}{|d(k)|}
\end{align}
The second Chern number is
\begin{align}
    C_2 &=
    \frac{3}{8\pi^2}
    \int d^4k
    \epsilon^{abcde}
    \hat{d}_a
    \partial_x \hat{d}_b
    \partial_y \hat{d}_c
    \partial_z \hat{d}_d
    \partial_w \hat{d}_2\\
    &=
    \begin{cases}
        0 & m < -4c, m >4c\\
        1 & -4c < m < -2c
    \end{cases}
\end{align}
and just like before,
there are $(3+1)D$ gapless chiral fermions on the surface with
$|C_2|$ flavours.

The surface Hamiltonian will be
\begin{align}
    H_{\mathrm{surface}} &=
    \sgn(C_2)
    \int \frac{d^3k}{(2\pi)^3}
    \sum_{i=1}^{|C_2|}
    V_i \psi_i^\dagger \vec{\sigma}\cdot\vec{k} \psi_i
\end{align}
where these are 2-component fermions.

There is a chiral anomaly
\begin{align}
    \partial_\mu j^\mu \propto FF
\end{align}

Now that we have this $(4+1)D$ cherin insulator,
we can dimension-reduce and view one of these $A$ componetns as a parameter,
and we effectively get an $F\wedge F$ term in the dmiensinoally reduce dmouel

These chircal fermions onthe surface descend into Dirac cones on the surface of
the $(3+1)D$ topological insulator.

\begin{question}
    Why are there $C_2$ flavours?
\end{question}
It is the analogue of $C_1$ flarous in $(2+1)D$.

It's always a 2-component fermion,
buti t's a question of how many you have.
The Chern numbero f bulk is just like the $(2+1)D$ case.

\begin{question}
    Why 2 component fermions?
\end{question}
I don't have a quick answer.

The point is you decompose your fermions
with a chirality operator,
so you split the 4 componet into 2, 2 components,
and because it's chiral,
you only have 2.
They are $C_2$ flarous of the 2-compoent fermion.

\begin{question}
    How do you visualize a $(2+1)D$ chiral fermion.
\end{question}
I don't have a godo visualization.
There's chirality operator,
and you project them onto two eigenvectors.

If you have massless particles moving in a direciton,
you can attribute a handedness of the particles,
which you cannot Loretnz boost out of.

Yeah, it's basically in this language,
$1\pm \Gamma^0$,
that's how you define the Chirality operator.
Projection onto some particular chirality.

\begin{question}
In 2 spatial dimensions,
you have only clockwise and anti-clockwise.
What's the analog of this?
\end{question}
I don't usually think of chiral fermions in 3 dimensions.

\begin{question}
    In the 1D case,
    you could think of the Chern number as the wrapping of the sphere?
\end{question}
Oh yes.
The $\hat{d}$ vector is a map from the Brilluoin zone $\hat{d}:T^4\to S^4$.
This is computing the winding numbero f the map from $S^4\to S^4$.

If you take $k\to\infty$, it is the case that it all points in the same
direction,
I don't know if there's an easy way of saying it.

His point is if I take $k_x$ to $\infty$ but not the other ones,

I was plannig on presenting the dimensinoal reduction from $(4+1)D$
to $(3+1)D$.

The point is the $(4+1)D$ model can be thought of as
decoupled $(3+1)D$ models parameterized by $k_w$.
We did a version of this in $(2+1)D$,
where we thoguht of it as a $(1+1)D$ Hamiltonian parametrized by $k_y$.

Let's write the Hamiltnoian first in real space on a lattice.
On real space on a lattice,
that Hamiltnoian will look like
\begin{align}
    H_{(4+1)D} &=
    \sum_{\sigma,a=1,\ldots,4}\left[
    \psi_{\vec{r}}^\dagger
    \left(
    \frac{c\Gamma^0 - i\Gamma^i}{2}
    \right)
    \psi_{\vec{r} + \hat{a}}
    e^{i A_{\vec{r},\vec{r} + \hat{a}}}
    + \mathrm{h.c.}
    + m\psi_{\vec{r}}^\dagger \Gamma^0 \psi_r
    \right]
\end{align}
and then I can write it in the ``Landau gauge''
translationlaly invariatn in $w$ direction
\begin{align}
    H_{(2+1)D}[A] &=
    \sum_{k_w} H_{(3+1)D}[k_w, A]
\end{align}
and then
\begin{align}
    H_{(3+1)D} [k_w, A] &=
    \sum_{\vec{r}, a=1,\ldots,3}\left[
    \psi_{\vec{r}, k_w}^\dagger
    \left(
    \frac{c\Gamma^0 - i\Gamma^a}{2}
    \right)
    \psi_{\vec{r} + \hat{a}, k_w}
    e^{i A_{\vec{r},\vec{r} + \hat{a}}}
    +
    \mathrm{h.c.}
    \right]\\\nonumber
    &\qquad+
    \sum_{\vec{r}}
    \psi_{\vec{r}, k_w}^\dagger\left[
    \sin\left( k_w + A_{\vec{r}, w} \right)\Gamma^4
    +
    \left( m + c\cos\left( k_w + A_{\vec{r},w} \right)\right)\Gamma^0
    \right]
\end{align}
So if I set $\theta=k_w + A_{\vec{r},w}$,
I just replace $k_w + A_{\vec{r},w} = \theta_{\vec{r}}$
and this gives us
$H_{(3+1)D}[A,\theta]$.

At the level of the effective action,
we can figure out the efective response theory
by doing dimensinoal reduction in the response theory.

And so
\begin{align}
    S_{(4+1)D} &=
    \frac{C_2}{24\pi^2} \int d^4x \, dt\,
    \epsilon^{\mu\nu\rho\sigma\tau}
    A_{\mu} \partial_\nu A_\rho \partial_\sigma A_\tau
\end{align}
and under dimensional reduction $C_2=$,
and I can just rewrie this action as
\begin{align}
    S &=
    \frac{1}{24\pi^2} 3
    \int d^3x \, dt\,
    \epsilon^{w \mu\nu\rho\sigma}
    A_w \partial_\mu A_\nu \partial_\rho A_\sigma\\
    &=
    \frac{\theta}{32\pi^2}
    \int \epsilon^{\mu\nu\rho\sigma} F_{\mu\nu}F_{\rho\sigma}
\end{align}

Why did we set $C_2=1$?
Because I want to describe the non-trivial topological insulator.
If I set $C_2=2$, then I would just get two copies of the TI.

You can just do perturbation theory to see what the response theory looks like.

\begin{question}
    Is $\theta$ here defined on $2\pI$ and does it save the time-reversal
    symmetry?
\end{question}
Here it does, just follows from the same argumetn I made before.

This $k_w + A_{r,w}=\theta_r$,
which you can see is periodic in $2\pi$.

If you write the time-reversal operator,
this term does not commute with the time-reversal operator,
so $\theta$ has to be $0$ or $\pI$.

\begin{question}
    When is dimensional reduction not possible?
    This is quite general argumetn.
\end{question}
You can always do dimensional reduction,
but it's not necesarily the case that you start with some theory,
and you do dimesnional reductino and yo uget an interseting and nontrivial
theory.

For example, if I set $C_2=2$,
I get two copies and I get the trivial insulator.

In $(2+1)D$ where we did dimesniaonl reductnio,
the $(1+1)D$ theory was not trivial because it realised a topological pump.

We start with a topological pahse characterised by integer $C_2$,
and then $\mathbb{Z}_2$ invariants.

You could dmiensional reduce one more time,
and yo uget the $(2+1)D$ topological insulator,
which is time-reversal invariant.

\begin{question}
    Do we need the model gapped?
\end{question}
If you start witha gapped model,
you usually wind up with a gapped model.
But if you started with a gapless mdoel,
you might not end up with a gapless model.

Now you can also do the $(2+1)D$ surface.
If we take $C_2=1$,
we would only have one flavour,
and if I dmeinosaly reduce,
and set $k_w=0$,
then I would just get a single Dirac cone.
This ia nice way to se the (2+1)D surface
would jsut beceom a (2+1)D Dirac cone.
I won't write it out,
because it's obvious from this.

Let me write out one more thing to be a little more clear.
Wen you do dimensinoal reduction,
you can think of putting a system on a cylinder,
in which case the azimuthal direction is $w$.
Then your momentum would be quantized
\begin{align}
    k_w &= \frac{2\pi}{L-w}n
\end{align}
and the low-energy mode is the one where $n=0$.
If you start with Chiral fermions and do dimesnioanl reductio
you have one massless fermion, the zero-ommentum mode
that descends to the massless dirac cone,
but you would have higher dmieinosal massive Dirac fermions.

Intersting commetn:
If you start with the $(2+1)D$ surface Dirac cone,
I mentinoed before this theory has a Perry anomaly,
hwich is a mix of U(1) and TR symmetry,
but you see the theory has problems,
you can decude the fact that the only way of preserving the symmetyra nd makig
making the theory well-define is to inroduce a bulk (3+1) respone theory.

So start with a (2+1)D surface theory with a Dirac cone,
then try to make the path integral well-defined with
$T$, $U(1)$.
Then educe a $(3+1)D$ bulk with
\begin{align}
    S_{eff} &=
    \int F\wedge F + R\wedge R
\end{align}
There's a paper by Witten in 2015,
which is nice because he uses the APS index therem by Atiyah.
I would go thorugh it,
but it would be an entire lecture.

\begin{question}
    Does it go up to higher dimensions?
\end{question}
In Witen's paper,
he only does $(3+1)D$ topological theories,
but the index theorem hsould work.

The thing is,
this parity anomaly you don't have in every dimension,
you have it in every 8 dimensisno.
There's a periodicity of 8.
Everything we did for free fermions has periodicity 8.
Deep,
but we don't care beyond 3 dimensions.

\begin{question}
    Are zero modes of (3+1)D a subset of zero modes in (4+1)D
\end{question}
I don't know, it's not obvious.

\begin{question}
    Experimental progress in realising these?
\end{question}
There are multiple generations of people who predicted various matirerals.
The first material is BismuthAntimony,
but since then many materials have been porpsoed.
There's no problem gettinga band structure exhitibing this topolgoical
insulator,
but the problem is getting the chemical potential in the gap.
You can't tune the chemical potential like in 2D,
you need to use doping,
but it's hard to get hese materials into actual insualtors.
Early on,
it was difficult getting the chmiceal potential in the right place.
But in the band structre,
you could confirm things like an odd numberof Dirac conesno the surface.
I don't know if people actually sucessfully made an insulating matieral that was
topogoloical and gets the chemcial potential in the right palce.

Was anyone following?

Now I want to switch gears a little bit.
Let's summarize what we did.

We talked about a $(1+1)D$ Majorana system with
$G_f = \mathbb{Z}_2^f$,
and there is a $\mathbb{Z}_2$ invariant.

Then we considered $(2+1)D$ systems with $G_f=\mathbb{Z}_2^f$.
There is a $\mathbb{Z}$ invariatn which si the chiral central charge,
which is realised by the $p+ip$ superconductor.
$G_f = U(1)^f$And there is a $\mathbb{Z}$ invariant Chern insulator.
And we studied
$G_f = U(1)^f \rtimes \mathbb{Z}_4^{t,f}/\mathbb{Z}_2$
which results in a $\mathbb{Z}_2$ invariatn in class AII.

Then in $(3+1)D$,
we geta $\mathbb{Z}_2$ invariant to class AII.

All the above are examples of invertible topological phases.
They all have free fermion realisations.
These are all examples,
once we look at what states are at the free fermion level,
all states were stable to added interaciton.
They all had phsycal propblems.
the $\mathbb{Z}$ invairnat is jus the QHE conducatnce.
And we also solved for hte phsycial properties of these invariats.
We didn't formally argue it,
but it is plausible because iti s a physical quantitiy you could measure its
properties.

There are other tings tha could hapepen.
thera resiutaltios in free fermions you get $\mathbb{Z}$ invariatns,
but when you add interactinos,
it drops to $\mathbb{Z}_8$.

And then you could have invertible models with no fre fermion ralisations.
And then you have non-invertible models.

\section{Bosonic in (1+1)D}
Theseare inrinsically strongly interacting,
because if not they will condense into superfuliud state.
I necessarily need a strongly interacting system.
So all the tools we had for free fermion models become useless.
In $(1+1)D$ for bosons,
bosons can only realize a certina subclass of invertible phases.

There are some aspects.
\begin{enumerate}
    \item There's no topological order in 1D.
        This means if you forget about any symmetries of your model,
        any gapped bosonic state in 1D can be adiabatically conencted to trivila
        state.
        That's difernt to the fermionic case,
        where if you ignore all pases,
        it's still non-trivial bcause thereare stil MZMs.
        For bosons,
        if you ignore symmetries,
        everything can be adiabatically connected to the trivial phase.
        So no topological order in 1D.
    \item If you add symmetry,
        then we couldh ave a class of topological phases called SPT phases.
        SPT stands for symmetry protected topological.
        These are a subset of invertible phases,
        which has the property that if you break the symmetry,
        it can be adiabatically connected to a trivail state,
        but if you have the symmetyr,
        it cannot be in a way that preserves the symmetry.
        These are classified by a quantitiy called the group cohomology
        $H^2(G, U(1))$.
        The second cohomology group with group elements of $G$ wiht coefficients
        in $U(1)$.
\end{enumerate}
Rigorous proof will require mathematical frameowrks not in this class.
We can establish this using matrix product states.

Ther eare no invertible phaess that are not SPTs.
There are no chiral phases.
You wouldn't be able to define chiral,
the boundary is zero dmiensional,
so there are no chiral moedes.
$(2+1)D$ is special,
even bosons have an nivertible phase that is not an SPT.

Let me start off by giving an example of an interesting 1D state.
The most important example is the AKLT state.

These guys considered a spin-1 chain,
with $G=SO(3)$ symmetry.

The Hamiltonian includes a Heisenberg term,
but in addition,
there's an extra term that is the square of he Heisenberg term
and a constant offset
\begin{align}
    H_{AKLT} &=
    \frac{1}{2} \sum_{i} \left(
    \vec{S}_i\cdot \vec{S}_{i+1}
    + \frac{1}{3} \left( \vec{S}_i\cdot\vec{S}_{i+1} \right)^2
    + \frac{2}{3}
    \right)\\
    &= \sum_i P_{i,i+1}^{(2)}
\end{align}
where $S_i^{\alpha}$ is a $3\times 3$ matrix
and $P_{i,i+1}^{(2)}$ is a projector onto spin-2 subspace of neighbouring spin
1s.

This is simply the explicit form of this projector.
For spin $1/2$ particles,
there is no square term.
Once we have this sum of projectors,
G
the ground state is the state that is annihilated by all projects.

I have a spin chain,
and I am summing over every site on the spin chain.
The first term would be $P_{1,2}$,
where I project 1 and 2 onto spin 2, etc.

Is there a non-trivial state that si annihilated by all $P$s.
You might be worried thesubspace annihlated by this is zero-dimensiona,
but it's one-dimensional on a periodic chain.

The one way to construct the ground state is a cool trick.
Think of every spin 1 as coming from 2 spin 1/2 systems,
but project onto the spin 1 subspace.

This is site $i$ for example,
would have two spin $\frac{1}{2}$ systems,
which I project onto spin-1 subspace.
You'll notice that in order for these two sites $i$ and $i=1$,
the only way this projector is going to give something non-trival
is if every pair of spin-1/2 fuses into a state of spin-1.

If any two spin-$\frac{1}{2}$ fuse to spin 0,
that subspace is going to be annihilated by this projector
$P^{(2)}$.

Imagine if you had
\begin{align}
    \frac{1}{2}\otimes \frac{1}{2}\otimes
    \frac{1}{2}\otimes \frac{1}{2}
    =
    (0 \oplus 1) \oplus (0 + 1)
\end{align}
I can consider where these spin-1/2s from neighbouring parts fouse across.o

consider a state
where each spin-1 you break down into spin-1/2s,
and then project them onto spin1.
Andthen you draw lines connecting adjacent spin-1/2s in different proejctors.

If you put this on a zero chain,
you won't hvae ege modé.o

The 0-energy ground state í the unique gapped grouned sate in AKLT.

This is a ``frustration free'' state.
There will be dangling spin-1/2 degrees of freedon.
On an open chin,

Just likewe found we have anomalies for the boundaries,
this eges system is ano.

Spin-1 degrese offreedom form faithful linear optaions of SO(3) symmetry,
wherease spin-$\frac{1}{2}$ is only a projection.

There will be dangling spin-$\frac{1}{2}$ degrees of freedom.
Edge degeneracy forms a projective representation of $SO(3)$.
Wahereas,

There's anomalies associated iwth global symemtries,
and then there are graviational anomalies,
and they are more severe.
The edges system is

Some boudnary theories might be in conflict iwththe.