\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{latexsym,amsfonts,amssymb,amsthm,amsmath,mathrsfs,mathtools}
\usepackage[makeroom]{cancel}
\usepackage {tikz}
\usepackage{hyperref}
\usetikzlibrary {positioning}
\usepackage{fdsymbol}

\usepackage[ruled,vlined]{algorithm2e}

\setlength{\parindent}{0in}
\setlength{\oddsidemargin}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{8.8in}
\setlength{\topmargin}{-0.7in}
\setlength{\headheight}{18pt}

\newcommand*{\union}{\cup}
\newcommand*{\inter}{\cap}

\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}

\definecolor {processblue}{cmyk}{0.96,0,0,0}

\makeatletter

\makeatother

\title{Topics in Algorithms - Assignment 2}
\author{Kishlaya Jaiswal}

\begin{document}

\maketitle

Following are the exercises from \href{http://math.mit.edu/~goemans/18453S17/matching-nonbip-notes.pdf}{http://math.mit.edu/~goemans/18453S17/matching-nonbip-notes.pdf}

\subsection*{Exercise 2.1}

Consider the following graph:
\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 ,
draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (G_1) at (9,0)  {1};
  \node[vertex] (G_2) at (6,0)  {2};
  \node[vertex] (G_3) at (3,0) {3};
  \node[vertex] (G_4) at (0.927,2.853)   {4};
  \node[vertex] (G_5) at (-2.427,1.763)  {5};
  \node[vertex] (G_6) at (-2.427,-1.763)  {6};
  \node[vertex] (G_7) at (0.927,-2.853)  {7};
  \node[vertex] (G_8) at (0.927,5.853)   {8};
  \node[vertex] (G_9) at (-5.427,1.763)  {9};
  \node[vertex] (G_10) at (-5.427,-1.763)  {10};
  \node[vertex] (G_11) at (0.927,-5.853)  {11};

  \draw (G_1) -- (G_2) -- cycle;
  \draw[ultra thick, red] (G_2) -- (G_3) -- cycle;
  \draw (G_3) -- (G_4) -- cycle;
  \draw[ultra thick, red] (G_4) -- (G_5) -- cycle;
  \draw (G_5) -- (G_6) -- cycle;
  \draw[ultra thick, red] (G_6) -- (G_7) -- cycle;
  \draw (G_7) -- (G_3) -- cycle;
  \draw (G_4) -- (G_8) -- cycle;
  \draw (G_5) -- (G_9) -- cycle;
  \draw (G_6) -- (G_10) -- cycle;
  \draw (G_7) -- (G_11) -- cycle;
\end{tikzpicture}
\end{center}

When we shrink the blossom, we would get
\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 ,
draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (G_1) at (6,0)  {1};
  \node[vertex] (G_2) at (3,0)  {2};
  \node[vertex] (G_3) at (0,0) {3};
  \node[vertex] (G_8) at (0,3)   {8};
  \node[vertex] (G_9) at (-3.427,1.763)  {9};
  \node[vertex] (G_10) at (-3.427,-1.763)  {10};
  \node[vertex] (G_11) at (0,-3)  {11};

  \draw (G_1) -- (G_2) -- cycle;
  \draw[ultra thick, red] (G_2) -- (G_3) -- cycle;
  \draw (G_3) -- (G_8) -- cycle;
  \draw (G_3) -- (G_9) -- cycle;
  \draw (G_3) -- (G_10) -- cycle;
  \draw (G_3) -- (G_11) -- cycle;
\end{tikzpicture}
\end{center}

An augmenting path in the graph $G/B$ is: $1 \rightarrow 2 \rightarrow 3 \rightarrow 11$, which gives the following maximum matching $M^*/B$ in $G/B$

\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 ,
draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (G_1) at (6,0)  {1};
  \node[vertex] (G_2) at (3,0)  {2};
  \node[vertex] (G_3) at (0,0) {3};
  \node[vertex] (G_8) at (0,3)   {8};
  \node[vertex] (G_9) at (-3.427,1.763)  {9};
  \node[vertex] (G_10) at (-3.427,-1.763)  {10};
  \node[vertex] (G_11) at (0,-3)  {11};

  \draw[ultra thick, red] (G_1) -- (G_2) -- cycle;
  \draw (G_2) -- (G_3) -- cycle;
  \draw (G_3) -- (G_8) -- cycle;
  \draw (G_3) -- (G_9) -- cycle;
  \draw (G_3) -- (G_10) -- cycle;
  \draw[ultra thick, red] (G_3) -- (G_11) -- cycle;
\end{tikzpicture}
\end{center}

But this leads to the augmenting path $1 \rightarrow 2 \rightarrow 3 \rightarrow 4 \rightarrow 5 \rightarrow 6 \rightarrow 7 \rightarrow 11$ in $G$ and gives the following matching $M^*$ (which is not a maximum matching):

\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 ,
draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (G_1) at (9,0)  {1};
  \node[vertex] (G_2) at (6,0)  {2};
  \node[vertex] (G_3) at (3,0) {3};
  \node[vertex] (G_4) at (0.927,2.853)   {4};
  \node[vertex] (G_5) at (-2.427,1.763)  {5};
  \node[vertex] (G_6) at (-2.427,-1.763)  {6};
  \node[vertex] (G_7) at (0.927,-2.853)  {7};
  \node[vertex] (G_8) at (0.927,5.853)   {8};
  \node[vertex] (G_9) at (-5.427,1.763)  {9};
  \node[vertex] (G_10) at (-5.427,-1.763)  {10};
  \node[vertex] (G_11) at (0.927,-5.853)  {11};

  \draw[ultra thick, red] (G_1) -- (G_2) -- cycle;
  \draw (G_2) -- (G_3) -- cycle;
  \draw[ultra thick, red] (G_3) -- (G_4) -- cycle;
  \draw (G_4) -- (G_5) -- cycle;
  \draw[ultra thick, red] (G_5) -- (G_6) -- cycle;
  \draw (G_6) -- (G_7) -- cycle;
  \draw (G_7) -- (G_3) -- cycle;
  \draw (G_4) -- (G_8) -- cycle;
  \draw (G_5) -- (G_9) -- cycle;
  \draw (G_6) -- (G_10) -- cycle;
  \draw[ultra thick, red] (G_7) -- (G_11) -- cycle;
\end{tikzpicture}
\end{center}

This does not contradict theorem $2.2$ because if $M^*$ were to be a maximum matching in $G$, then the theorem says: \textsl{Let $B$ be a blossom with respect to $M^*$ . Then $M^*$ is a maximum size matching in $G$ if and only if $M^*/B$ is a maximum size matching in $G/B$}. Notice that $B$ was a blossom with respect to initial matching $M$ and not $M^*$ and hence the hypothesis of the theorem is not satisfied.

\subsection*{Exercise 2.2}

Recall \textbf{Berge's lemma}: a matching $M$ in a graph $G$ is maximum if and only if there is no augmenting path wrt $M$ in $G$.

Further note that if a matching matches the vertices in $S$, then augmenting this matching along any augmenting path will still keep the vertices in $S$ matched.

Therefore, suppose a matching $M$ covers $S$; if $M$ is already maximum then we are done. Otherwise, by Berge's lemma there is an augmenting path wrt to $M$. Augment along this path to get a new matching $M'$. Then $|M'| > |M|$ and $M'$ also covers $S$. Thus, repeating this $O(|V|)$ times, we get a maximum matching $M^*$ which covers $S$.

\subsection*{Exercise 2.3}

\subsubsection*{(a)}
By Tutte's theorem, given any maximum matching $M$, we have
$$|M| = |U| + \sum_{i=1}^k \floor*{\frac{|K_i|}{2}} = \frac{1}{2}\left(|V| + |U| - o(G \setminus U)\right) (\spadesuit)$$

And after removing $U$, any maximum matching can $M$ can use atmost $k_i = \floor*{\frac{|K_i|}{2}}$ many edges from $K_i$, therefore it is certain that $M$ uses atmost $k_i$ edges from $G[K_i]$. If it uses strictly less than $k_i$ edges from $G[K_i]$ then note that size of $M$ is also strictly less than $|U| + \sum_{i=1}^k \floor*{\frac{|K_i|}{2}}$ which is a contradiction to $(\spadesuit)$.

Hence the vertices in $G[K_i]$ with even $|K_i|$ are perfectly matched whereas with odd $|K_i|$ are perfectly matched except for one vertex.

\subsubsection*{(b)}
First, suppose some vertex in $u \in U$ remains unmatched in $M$. Then even if we remove this vertex $u$ from the graph, the number of odd components after removing $U \setminus \{u\}$ remains unchanged, so for the new graph thus obtained, we have the following inequality:
$$|M| \leq \frac{1}{2}((|V|-1) + (|U|-1) - o(G \setminus U)) = \frac{1}{2}(|V| + |U| - o(G \setminus U)) - 1$$
which is again a contradiction to $(\spadesuit)$.

Now suppose that $u$ is matched to a vertex in $v \in U$. Then if we remove the vertices $\{u,v\}$ from the graph, then the number of odd components after removing $U \setminus \{u,v\}$ remains unchanged and also the size of $M$ decreases by $1$, so for the new graph thus obtained, we have the following inequality:
$$|M|-1 \leq \frac{1}{2}((|V|-2) + (|U|-2) - o(G \setminus U)) = \frac{1}{2}(|V| + |U| - o(G \setminus U)) - 2$$
which is again a contradiction to $(\spadesuit)$.

Thus, each vertex $u \in U$ is matched to a vertex not in $U$ but since all the vertices in even components are matched among themselves, the only possibility is that $u$ is matched to a vertex in some odd component $K_i$.

\subsubsection*{(c)}
From the above two results, we get that
\begin{itemize}
    \item Every vertex in $U$ is matched
    \item Every vertex in an even component $K_i$ is matched
\end{itemize}
Therefore, if some $v \in V$ is unmatched, then it has to belong to some odd component $K_i$.

\subsection*{Exercise 2.4}

Yes there could be several minimizers in the Tutte Berge formula. A simple example is that of two vertices joined by a single edge, in which case maximum matching is of size $1$ and we could choose $U$ to be either of the vertices to get $1 = \frac{1}{2}(2 + 1 - 1)$.

Another example with different sizes of $U$: Both $U=\phi$ and $U = \{v\}$ give $2 = \frac{1}{2}(5 + 0 - 1) = \frac{1}{2}(5 + 1 - 2)$ in the given graph below:

\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 ,
draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (G_1) at (8,0) {};
  \node[vertex] (G_2) at (5,0)  {v};
  \node[vertex] (G_3) at (2,0) {};
  \node[vertex] (G_4) at (-0.8,1.5) {};
  \node[vertex] (G_5) at (-0.8,-1.5) {};

  \draw (G_1) -- (G_2) -- cycle;
  \draw (G_2) -- (G_3) -- cycle;
  \draw (G_3) -- (G_4) -- cycle;
  \draw (G_4) -- (G_5) -- cycle;
  \draw (G_5) -- (G_3) -- cycle;
\end{tikzpicture}
\end{center}

\subsection*{Exercise 2.5}

For a graph $G$ and $S \subseteq V(G)$, define \textsl{deficiency of S} $def(S) = o(G \setminus S) - |S|$. And $def(G) = \max_{S \subseteq V} def(S)$.

Therefore, Tutte-Berge formula now translates to: for any maximum matching $M$, $|M| = \frac{1}{2}(|V| - def(G))$
\newline

\textbf{Parity Lemma} Let $|V| = n$ and $S \subseteq V$, then $def(S) \equiv n (\mod 2)$
\begin{proof}
Counting vertices in $S$ and the components in $G \setminus S$, we have $|S| + o(G \setminus S) \equiv n (\mod 2)$.
\end{proof}

\textbf{Lemma 2} Let $T$ be a maximal set of maximum deficiency in a graph $G$. Then every component of $G \setminus T$ is odd and factor-critical.
\begin{proof}
Let $C$ be any component of $G \setminus T$ and $u \in C$, then $\forall S \subseteq C-u$, we have
\begin{align*}
    def_G(T \union u \union S) &= o(G-T-u-S) - (|T|+1+|S|) \\
    &= (o(G \setminus T) - 1 + o(C-u-S)) - (|T|+1+|S|) \\
    &= o(G \setminus T) - |T| + o(C-u-S) - |S| - 2 \\
    &= def_G(T) + def_{C-u}(S) - 2 \\
    \implies def_{C-u}(S) &= def_G(T \union u \union S) - def_G(T) + 2
\end{align*}
By our choice of $T$, $def_G(T \union u \union S) < def_G(T)$ and by Parity lemma, $def_G(T \union u \union S)$ and $def_G(T)$ have same parity. Thus $def_{C-u}(S) \leq 0$, $\forall S \subseteq C-u$ and hence $C-u$ has a perfect matching (Tutte's theorem) and so $C$ is critical. It follows that $C$ is of odd-size.

(Alternatively, if $C$ is a component of even size, then adding to $T$ any leaf of a spanning tree of $C$ creates a larger set with the same deficiency as $T$ which contradicts the choice of $T$. And hence all components are odd).
\end{proof}

Next for any $T \subseteq V$, we define auxillary bipartite graph $H(T)$ by contracting each component of $G \setminus T$ to a single vertex and deleting edges within $T$. Let $U$ denote the set of contracted vertices of components then $H(T)$ is a $(T,U)$ bipartite graph with an edge $t-u$ for $t \in T, u \in U$ iff $t$ has a neighbour in G in the component of $G \setminus T$ corresponding to $u$.
\newline

\textbf{Lemma 3} If $T$ is a maximal set of maximum deficiency in a graph $G$. then $H(T)$ contains a matching that covers $T$.

\begin{proof}
For $S \subseteq T$ , all vertices of $U - N_{H(T)}(S)$ are odd components of $G \setminus (T \setminus S)$. By the choice of $T$ , we have $(|U|-|N_{H}(S)|) - |T \setminus S| \leq def(T \setminus S) \leq def(T)$. Since $def(T) = |U| - |T|$,
the inequality simplifies to $|S| \leq |N_H(S)|$. Thus Hall’s Condition holds, and $H(T)$ has a matching that covers $T$.
\end{proof}

Now let $T$ be a maximal set of deficiency $def(G)$. If we show that $def(C) = def(T)$, then for any maximum matching $M$:
$$|M| = \frac{1}{2}(n-def(G)) = \frac{1}{2}(n-def(C)) = \frac{1}{2}(|V|+|C|-o(G \setminus C))$$
and hence $C$ is a minimizer in the Tutte-Berge formula.

We begin by noting that $T$ is a minimizer of the Tutte-Berge formula and so $2|M| = n - def(G)$ implies that exactly $def(G)$ vertices are not covered by $M$. Furthermore. we have proved in exercise $2.3$ that $M$ matches each vertex of $T$ with a distinct component of $G \setminus T$ (which are all odd - lemma 2) and also since $M$ is maximum and each of these components is factor-critical (lemma 2), $M$ matches each of these components near-perfectly.

Now consider the bipartite-graph $H(T)$. By lemma 3, there is a $T$-saturating matching and therefore Hall's theorem says $|N_{H(T)}(S)| \geq |S|$, $\forall S \subseteq T$. Because $|N_{H(T)}(\phi)| = |\phi|$, we consider a maximal subset $R$ for which the equality is achieved in Hall's condition, so $|N_{H(T)}(R)| = |R|$. Let $R'$ be the union of all vertices of the components of $N_{H(T)}(R)$.
\newline

\begin{figure}[htp]
    \centering
    \includegraphics[width=12cm]{gallai.jpg}
    \caption{Gallai Decomposition}
    \label{fig:gallai}
\end{figure}

\textbf{Claim} $D = R \union R'$, $C = T \setminus R$ and $B = V \setminus (T \union R')$.
\begin{proof}
We observe that $D$ is defined to be the set of \textsl{essential} vertices which doesn't have any neighbours in \textsl{inessential} vertices. We show that the same property holds for $R \union R'$ as well. Since every maximum matching $M$ matches $T$, and hence $R$, we conclude that $R$ is a subset of essential vertices and so is $R'$ as any maximum matching matches $R$ to distinct components of $G[R']$. Furthermore, both $R$ and $R'$ don't have neighbour in other components of $G \setminus T$, that is $R \union R'$ doesn't have a neighbours in \textsl{inessential} vertices (as $T$ only consists of essential vertices). Therefore, $D = R \union R'$.

Let $H' = H(T) - (R \union N_{H(T)}(R))$. For any $S \subset T \setminus R$, we have $|N_{H(T)}(S)| > |S|$ (because if there was equality for some set, then we could have added it to $R$ thereby contradicting its maximality). This means even if we delete a vertex $v$ from $N_{H'}(T \setminus R)$, Hall's condition still holds and so it has a $T \setminus R$ saturating matching, which omits $v$. This tells us all vertices of $V \setminus (T \union R')$ are inessential. This can be seen as follows: fix a vertex $x \in V \setminus (T \union R')$. Let $C$ be the component to which it belongs. By lemma 2, $C$ is factor-critical. So if we delete $x$, then we can find a perfect matching in $C - x$. So we delete this component $C$ and note that it corresponds to deleting a vertex $v \in N_{H'}(T \setminus R)$ which has a maximum matching already.

Therefore, we get that $V \setminus (T \union R') \subseteq B$ but note that $T$ only consists of essential vertices. And so $B = V \setminus (T \union R')$ which implies $C = T \setminus R$.
\end{proof}

Finally we have $def(T) = o(G \setminus T) - |T| = (o(G[R']) + o(G[B])) - (|R| + |C|) = (|R| + o(G[B])) - (|R| + |C|) = o(G[B])-|C|$. Since $G[D]$ has a perfect matching, all it's components are even in size. Therefore the only odd components of $o(G \setminus C) = o(G[B])$. Thus, $def(T) = o(G \setminus C) - |C| = def(C)$.

\subsection*{Exercise 2.7}

\subsubsection*{(1)}

Fix any minimizer $U$. Let $u \in U$ if possible. Since $G$ is factor critical, there is maximum (perfect) matching which leaves $u$ unmatched, which contradicts $2,3(b) -$  any maximum matching $M$ covers $U$.

Therefore, $U = \phi$

\subsubsection*{(3a)}

We prove by induction on number of ears that if $G$ has an odd ear decomposition then $G$ is factor-critical.

\textsl{Inductive hypothesis}: Given $G$ with $n-$odd ear decomposition $(n \geq 0)$ then $G$ is factor critical

\textbf{Base case}: $n=0$. This means that $G$ is just an odd cycle. Then it is clear if we remove any vertex $v$, then we are left with an odd-length path, which has a perfect matching.

Suppose it is true for some $n \geq 0$. Consider $G$ with $(n+1)$ odd ears. Now we remove a vertex $v$ from $G$. Let the last year be $v_0 - v_1 - \cdots - v_{2k+1}$, then we have two cases:
\begin{itemize}
  \item \textsl{$v$ belongs internally to the last year}. that is $v \in \{v_1, \ldots, v_{2k}\}$, then note that after removing this vertex, we will left with an odd path and an even path in the last year. WLOG say that $v_0 - \cdots - v_{i-1}$ is an even-length path and $v_{i+1} - \cdots - v_{2k}$ is an odd-length path. Then we can add edges $(v_1,v_2), (v_3,v_4), \ldots$ to our matching. Furthermore, we can also add $(v_{2k}, v_{2k-1}), (v_{2k-2}, v_{2k-3}), \ldots$ to our matching but this will remove the vertex $v_{2k}$ from the second-last ear. Now consider the graph with only the first $n$ ears, with the vertex $v_{2k}$ removed. By inductive hypothesis this has a perfect matching. Hence combing with the above mentioned edges, we get a perfect matching for $G$ with $v$ removed.

  \item \textsl{$v$ doesn't belong internally to the last year}. In this case, we consider the graph with the last year $(v_1, \ldots, v_{2k})$ removed. Now when we remove the vertex $v$ then this graph has $n$ ears with one vertex removed, which has a perfect matching by inductive hypothesis. And since $v_1 - \cdots - v_{2k}$ is an odd-length path, it admits a perfect matching. Hence combining these two matchings we get a perfect matching for the entire graph with $v$ removed.
\end{itemize}

\subsubsection*{(3b)}

Suppose $G$ is factor critical. We want to show that $G$ has an odd-ear decomposition.

We claim that $G$ must be connected. Suppose not, then let $K$ be any connected-component such that $G \setminus K \neq \phi$. We first note $K$ cannot be even-sized connected-component, because $K \setminus \{v\}$ for any $v \in K$ doesn't admit a perfect matching. So $K$ is an odd-sized component but then choose $v \in G \setminus K$, and so $G \setminus \{v\}$ has a perfect matching which leads to a contradiction as $K$ (being odd in size) cannot admit a perfect matching.

To proceed with our main proof, we shall use structural induction on $G$.

Denote by $M_v$ the perfect matching obtained after removing $v$ from $G$. Consider any edge $(u,v)$ in $G$ and consider $M_u \oplus M_v$. It contains an alternating even-length path between $u$ and $v$. Thus alongwith the $(u,v)$ edge, we get an odd cycle in $G$. If $G$ is exactly equal to this odd cycle obtained then we are done (odd ear decomposition with $0$ ears).

Otherwise, we fix a vertex $v$ of this odd cycle. Suppose we have already found $k$ ears so far. Let $H$ be the subgraph induced by this odd cycle and $k$ ears. We shall also assume that no edge in $M_v$ crosses $H$ (and we will maintain this invariant in our inductive step).

Since $G$ was connected, there exists an edge $(a,b)$ crossing $H$ such that $a \in H$ and $b \not \in H$. By our above assumption $(a,b) \not \in M_v$. Now $M_b \oplus M_v$ contains an even-length alternating path from $b$ to $v$. This path crosses $H$ because $v \in H$ and $b \not \in H$, so let $(x,y)$ be the first edge on this path which crosses $H$ (where $x \not \in H, y \in H$). Again by our assumption $(x,y) \not \in M_v$. Now we note this $b \longrightarrow x$ subpath will be of odd-length. Hence the path $a \rightarrow b \longrightarrow x \rightarrow y$ is an odd length path whose internal vertices do not lie in $H$ and hence we have found a new odd-ear to be added to $H$ and we are done.

(It should be noted that there the invariant "no edge in $M_v$ crosses $H$" is still maintained because any other edge incident on this new ear cannot be from $M_v$ as this ear itself alternates between edges from $M_v$ and $M_b$. And this same reasoning applies in the base case as well).

\subsubsection*{(2)}

We shall use the notation and algorithm introduced in the given paper.

Note that we already showed that any factor-critical graph $G$ must be connected (in part $(3b)$). And next note that if $G$ is connected then after shrinking a blossom also, $G'$ remains connected ($\vardiamondsuit$).

Another observation that follows from the previous part $(3)$ is that if $G$ is factor-critical then after shrinking any odd-cycle, $G'$ remains factor-critical. This is because if $G$ is factor-critical then starting with the given odd-cycle we can find an odd-ear decomposition (as illustrated in the previous solution). Hence after shrinking this odd-cycle, the first ear becomes an odd-cycle and the subsequent ears remain as it is. And so $G'$ has an odd-ear decomposition implying $G'$ is factor-critical.

Therefore, consider the last step of the given Edmonds algorithm. Using previous part $(1)$, we know that $U=\phi$ is a minimizer in the Tutte-Burge formula and according to the algorithm: $ODD=U=\phi$. Now after removing $U=\phi$ from $G'$, we are left with a single connected component (because $G'$ is connected ($\vardiamondsuit$)). But after removing $U=ODD$ vertices, all the remaining vertices are $EVEN$ vertices with no edges between them. Thus, there can only be a single $EVEN$ vertex remaning (otherwise $G'$ would be disconnected).

Hence the Edmonds algorithm terminates with a single vertex.
\newline

Following are the exercises from \href{http://math.mit.edu/\~goemans/18453S17/flowscuts.pdf}{http://math.mit.edu/\~goemans/18453S17/flowscuts.pdf}

\subsection*{Exercise 4.1}

We first do some basic reductions.

1. We can assume that all entries are fractional (non-integer). This is because, we can choose a small enough $\epsilon > 0$ and let $A = (a_{ij})$ then we can replace it with:
\begin{equation*}
A =
\begin{pmatrix}
a_{1,1}+\epsilon & a_{1,2}+\epsilon & \cdots & a_{1,n-1}+\epsilon & a_{1,n}-(n-1)\epsilon \\
a_{2,1}+\epsilon & a_{2,2}+\epsilon & \cdots & a_{2,n-1}+\epsilon & a_{2,n}-(n-1)\epsilon \\
\vdots  & \vdots  & \ddots & \vdots  \\
a_{m-1,1}+\epsilon & a_{m-1,2}+\epsilon & \cdots & a_{m-1,n-1}+\epsilon & a_{m-1,n}-(n-1)\epsilon \\
a_{m,1}-(m-1)\epsilon & a_{m,2}-(m-1)\epsilon & \cdots & a_{m,n-1}-(m-1)\epsilon & a_{m,n}+(m-1)(n-1)\epsilon
\end{pmatrix}
\end{equation*}
Note that the row sums and column sums are unaltered.

2. We can assume all the entries $0 < a_{ij} < 1$. This is because we can write $A = I + F$ where $I$ is the integral part of each entry and $F$ is fractional part of each entry. Then since the row sum was integral, means row sum of both $I$ and $F$ are integral, means row sum of $F$ is integral. Similarly, for column sums as well.
\newline

Hence we have a matrix $A$ whose all entries are between $0$ and $1$ such that all row and column sums are integer. We construct a graph $G = (V,E)$ as follows: denote $i^{\text{th}}$ row by a vertex $v_i \in A$ and $j^{\text{th}}$ column by another vertex $u_j \in B$. Then $V = \{s\} \union A \union B \union \{t\}$ and $E = (\{s\} \times A) \union (A \times B) \union (B \times \{t\})$. Edge capacities are as follows:
$$
c(u,v) =
     \begin{cases}
       r_i, &\text{if } u=s, v=v_i\\
       c_j, &\text{if } v=t, u=u_j\\
       1, &\text{otherwise }\\
     \end{cases}
$$
where $r_i$ denote the $i^{\text{th}}$ row sum and $c_j$ denote the $j^{\text{th}}$ column sum.

We run Ford-Fulkerson algorithm on this graph $G$ to obtain a max-flow. \textsl{Observations}:
\begin{enumerate}
    \item Max flow value $\leq \sum_{i} r_i$ (sum of all edge capacities going out of $s$)
    \item Set $g(s,v_i)=r_i$, $g(v_i, u_j)=a_{ij}$, and $g(u_j, t)=c_j$, then the value of this flow is $\sum_{i} r_i$. ($g$ is a possible flow because of the given condition on $A$ about row sums and columns sums). And hence the max-flow value is $\sum_{i} r_i$.
    \item If the capacities are integral, then note that in the Ford-Fulkerson algorithm, we start with flow value $0$ and in each iteration we increment the flow value by the minimum capacity edge on the path, which is an integer. Thus, there exists an integral max-flow $f$.
\end{enumerate}

Finally, consider the matrix $A'$ such that $A'_{ij} = f(v_i,u_j)$, flow value along edge $(v_i, u_j)$, then
\begin{itemize}
    \item Row sums and column sums of $A$ and $A'$ are identical (because of flow conservation for each internal vertex)
    \item $A'_{ij} = 0$ (or $1$), and so $A'_{ij} = \floor{A_{ij}}$ (or $\ceil{A_{ij}}$) as $0 < A_{ij} < 1$ (from our initial assumption).
\end{itemize}

\textbf{Alternate algorithm}: Here's a more direct approach to find the values of $A'$ (assuming $0 < A_{ij} < 1$):

\begin{algorithm}[H]
\SetAlgoLined
\KwResult{0-1 matrix}
 \For{$i=0; i < n; i++$} {
    \For{$j=0; j<r_i$}{
        \If{$c_j == 0$}{
            continue\;
        }
        $a_{ij} \leftarrow 1$\;
        $c_j \leftarrow c_j - 1$\;
        $j \leftarrow j+1$\;
    }
 }
 \caption{Rounding each entry of A}
\end{algorithm}
(This algorithm demonstrates that the values $a_{ij}$ don't matter. We are just finding some $0/1$ matrix such each row and column has a specified number of $1'$s only - assuming existence of a solution).

\subsection*{Exercise 4.2}

We construct a graph $G = (V,E)$ as follows:
$V = \{s\} \union \{x_{ij} \mid 1 \leq i < j \leq n-1\} \union \{y_i \mid 1 \leq i \leq n-1\} \union \{t\}$ and add edges:
\begin{itemize}
    \item $(s, x_{ij})$ of capacity $g_{ij}$, $\forall 1 \leq i < j \leq n-1$
    \item $(x_{ij}, y_i)$, $(x_{ij}, y_j)$, both of capacity $g_{ij}$, $\forall 1 \leq i < j \leq n-1$
    \item $(y_i, t)$ of capacity $W - w_i$, $\forall 1 \leq i < j \leq n-1$
\end{itemize}
where $W = w_n + \sum_{i=1}^{n-1} g_{i,n}$, denotes the total number of games team $n$ can win. (We remark here that if there is a possible outcome of games such that team $n$ has at least as many victories as all the other teams, then there is also a possible outcome in which team $n$ has as many victories as all other teams but team $n$ wins all the games to be played by them).

\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 , draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (s) at (-6,0) {s};
  \node[vertex] (G_1) at (-2,4) {};
  \node[vertex] (G_2) at (-2,0) {$x_{ij}$};
  \node[vertex] (G_3) at (-2,-4) {};
  \node[vertex] (H_1) at (2,5) {};
  \node[vertex] (H_2) at (2,3) {};
  \node[vertex] (H_3) at (2,1) {$y_i$};
  \node[vertex] (H_4) at (2,-1) {$y_j$};
  \node[vertex] (H_5) at (2,-3) {};
  \node[vertex] (H_6) at (2,-5) {};
  \node[vertex] (t) at (6,0) {t};

  \draw (s) -- (G_1);
  \draw (s) edge node[above]{$g_{ij}$} (G_2);
  \draw (s) -- (G_3);

  \draw (G_1) -- (H_1);
  \draw (G_1) -- (H_2);
  \draw (G_2) edge node[above]{$g_{ij}$} (H_3);
  \draw (G_2) edge node[above]{$g_{ij}$} (H_4);
  \draw (G_3) -- (H_5);
  \draw (G_3) -- (H_6);

  \draw (H_1) -- (t);
  \draw (H_2) -- (t);
  \draw (H_3) edge node[above]{$W - w_i$} (t);
  \draw (H_4) edge node[above]{$W - w_j$} (t);
  \draw (H_5) -- (t);
  \draw (H_6) -- (t);
\end{tikzpicture}
\end{center}

Here $x_{ij}$ corresponds to the game between teams $i$ and $j$ and $y_i$ corresponds to team $i$. If there are $x$ games played between team $i$ and $j$, then $x$ units of flow in $x_{ij}$, is divided among $y_i$ and $y_j$ depending upon which team won how many games. Finally, the flow from $y_i$ to $t$ corresponds to the number of games won by team $i$, which can be no more than $W - w_i$, for team $n$ to have at least as many victories as all the other team.

Thus, team $n$ has at least as many victories as all the other team iff all games have an outcome, that is all the edges out of $s$ are saturated, implying the maximum flow is of size $\sum_{1 \leq i < j \leq n-1} g_{ij}$.
\newline

It suffices to give a necessary and sufficient condition for team $n$ to lose the game, which is as follows: there exists a subset $R \subseteq \{1,\ldots,n-1\}$ such that $W < \frac{w(R) + g(R)}{|R|}$ where $w(R) = \sum_{i \in R} w_i$ and $g(R) = \sum_{i.j \in R, i<j} g_{ij}$.

To prove this, suppose that team $n$ loses, which means that the flow is of strictly lesser value and so all the edges out of $s$ are not saturated. So we find the min cut $(S,T)$ ($S$ is nodes reachable from $s$ in the residual graph) in this graph and let $R$ be the team nodes $y_j$ which are reachable from $s$ in the residual graph. We claim that:
\begin{enumerate}
    \item $R$ is non-empty. Because all edges out of $s$ are not-saturated implies there is a $x_{ij}$ such that $s \rightarrow x_{ij}$ is an edge in the residual graph. And since total incoming flow in $x_{ij}$ is strictly less than $g_{ij}$, it is clear that $x_{ij} \rightarrow y_i$ and $x_{ij} \rightarrow y_j$ are both edges in the residual graph, as both have capacity $g_{ij}$ and cannot get saturated.

    \item $x_{ij} \in S$ iff $y_i, y_j \in R$. If $x_{ij} \in S$ then from the above argument it follows that both $y_i ,y_j \in R$. Conversely if $y_i ,y_j \in R$ and $x_{ij} \not \in S$ then adding this vertex to $S$ decreases the capacity of the cut.
\end{enumerate}

Finally, we compare the cuts $(S,T)$ and $(\{s\}, G \setminus \{s\})$.
\begin{align*}
    &c(\{s\}, G \setminus \{s\}) &&>&& c(S,T) \\
    \iff &\sum_{1 \leq i < j \leq n-1} g_{ij} &&>&& c(S,T) \\
    \iff &\sum_{1 \leq i < j \leq n-1} g_{ij} &&>&& \sum_{i,j \not \in R} g_{ij} + \sum_{i \in R} (W-w_i) \\
    \iff &\sum_{i,j \in R} g_{ij} &&>&& |R|W - \sum_{i \in R} w_i \\
    \iff &w(R) + r(R) &&>&& |R|W \\
    \iff &W &&<&& \frac{w(R) + r(R)}{|R|}
\end{align*}

\subsection*{Exercise 4.3}

Let $G = (V,E)$ be the given graph. We construct a graph $G' = (V',E')$ as follows:
$V' = \{s\} \union \{i \leftrightarrow j \mid \{i,j\} \in E\} \union \{i \mid i \in V\} \union \{t\}$ and add edges:
\begin{itemize}
    \item $(s, i \leftrightarrow j)$ of capacity $1$, $\forall \{i,j\} \in E$
    \item $(i \leftrightarrow j, i)$, $(i \leftrightarrow j, j)$, both of capacity $1$, $\forall \{i,j\} \in E$
    \item $(i, t)$ of capacity $p(i)$, $\forall i \in V$
\end{itemize}

\begin{center}
\begin{tikzpicture}[shorten >=1pt,->]
  \tikzstyle{vertex}=[circle ,top color =white , bottom color = processblue!20 , draw,processblue , text=blue , minimum width =1 cm]
  \node[vertex] (s) at (-5,0) {s};
  \node[vertex] (G_1) at (-2,2) {$k \leftrightarrow j$};
  \node[vertex] (G_2) at (-2,0) {$i \leftrightarrow j$};
  \node[vertex] (G_3) at (-2,-2) {};
  \node[vertex] (H_1) at (2,5) {$k$};
  \node[vertex] (H_3) at (2,1) {$j$};
  \node[vertex] (H_4) at (2,-1) {$i$};
  \node[vertex] (H_5) at (2,-3) {};
  \node[vertex] (H_6) at (2,-5) {};
  \node[vertex] (t) at (6,0) {t};

  \draw (s) edge node[above] {1} (G_1);
  \draw (s) edge node[above]{1} (G_2);
  \draw (s) edge node[above]{1} (G_3);

  \draw (G_1) edge node[above]{1} (H_1);
  \draw (G_1) edge node[above]{1} (H_3);
  \draw (G_2) edge node[above]{1} (H_3);
  \draw (G_2) edge node[above]{1} (H_4);
  \draw (G_3) edge node[above]{1} (H_5);
  \draw (G_3) edge node[above]{1} (H_6);

  \draw  (H_1) edge node[above]{p(k)} (t);
  \draw  (H_3) edge node[above]{p(j)} (t);
  \draw  (H_4) edge node[above]{p(i)} (t);
  \draw  (H_5) -- (t);
  \draw  (H_6) -- (t);
\end{tikzpicture}
\end{center}

\subsubsection*{(a)}
Here if the node $i \leftrightarrow j$ has an incoming unit flow then either it will be directed towards $i$ or $j$, which will determine the orientation of this edge as: if it's directed towards $i$ then orient $j \rightarrow i$ and if it's directed towards $j$ then orient $i \rightarrow j$. And if $i \leftrightarrow j$ has an incoming zero flow then that means whatever the orientation of this edge be, it will violate some constraint.

Next, the incoming unit flow in each $i \in V$ contributes to the in-degree of $i$ and since the capacity of $(i,t)$ edge is $p(i)$, we can't have more than $p(i)$ units of flow incoming into $i$.

Thus, the max flow in this graph is of size $|E|$ (that is all the outgoing edges from $s$ are saturated) iff there exists a possible orientation of the edges such that all in-degree constraints are satisfied.
\newline

\subsubsection*{(b)}
Suppose that graph cannot be oriented, then the max flow is of size strictly less than $|E|$. We consider the min-cut $(S,T)$ ($S$ is nodes reachable from $s$ in the residual graph). Since some outgoing edges from $s$ are not saturated so $S \setminus \{s\}$ is non-empty.

We note that $i, j \in S$ iff $i \leftrightarrow j \in S$, because if $i \leftrightarrow j \in S$ then $(s) \longrightarrow (i \leftrightarrow j) \longrightarrow (j)$ and $(s) \longrightarrow (i \leftrightarrow j) \longrightarrow (i)$ are paths in the residual graph. Conversely, if $i,j \in S$ and $(i \leftrightarrow j) \not \in S$ then it can be added to $S$ and reduce the cut size.

Let $R$ be the set of vertex nodes $i$ reachable from $s$. Since $S \setminus \{s\}$ is non-empty, $R$ is also non-empty because of the above-mentioned fact.

Finally, we compare the cuts $(S,T)$ and $(\{s\}, V' \setminus \{s\})$.
$$c(\{s\}, V' \setminus \{s\}) > c(S,T)$$

But $c(\{s\}, V' \setminus \{s\}) = |E|$ and $c(S,T) = |\#\{i \leftrightarrow j \mid i \not \in R \wedge j \not \in R\}| + \sum_{v \in R} p(v)$ (edges going from $s$ to $i \leftrightarrow j$ and edges going from $i$ to $t$).

But $|E| - |\#\{i \leftrightarrow j \mid i \not \in R, j \not \in R\}| = |\#\{i \leftrightarrow j \mid i \in R \vee j \in R\}| = |E(R)|$. Hence, $|E(R)| > \sum_{v \in R} p(v)$

\subsection*{Exercise 4.4}

\textbf{Theorem} Given a digraph $G$ and $s,t \in G$ with all edge capacities $1$. There is a flow of value $k$ from $s$ to $t$ iff there are $k$-disjoint paths between $s$ and $t$.

\begin{proof}
Suppose there are $k$-disjoint paths between $s$ and $t$, then set $f(e)=1$ for all the edges on these paths and $f(e)=0$ otherwise. Since paths were disjoint, this gives us a flow of value $k$.
\end{proof}

Conversely, suppose there is a flow of value $k$, Choose a vertex $v$ such that $f(s,v)=1$. By conservation there must be a vertex $w$ such that $f(v,w)=1$. Extending this way until we reach $t$, everytime choosing a new edge, we get a path from $s$ to $t$. But now note that there are $k$ vertices such that $f(s,v)=1$. So for each such vertex we can perform the above process and obtain $k$ edge-disjoint paths from $s$ to $t$.
\newline

Now, we are given an undirected graph $G$. We find it's \textsl{maximum adjacency ordering} $v_1, v_2, \ldots, v_n$. Using claim 4.6 (from the paper), we conclude that $(\{v_1, \ldots , v_{n-1}\}, \{v_n\})$ is a $(v_{n-1}, v_n)$ cut. But since the degree of each vertex is atleast $k$, this cut size is also atleast $k$.

Finally, we convert graph $G$ into a digraph by replacing each edge $\{u,v\}$ with two edges $(u,v)$ and $(v,u)$ all of capacity $1$. Now by our above argument, the $(v_{n-1}, v_n)$ min cut size is $\geq k$ and so the max-flow is $\geq k$. Using above-mentioned theorem, we get that there are atleast $k$ edge-disjoint paths between $v_n$ and $v_{n-1}$.

\subsection*{Exercise 4.5}

Want to show that
$$u(\delta(A)) + u(\delta(B)) \geq u(\delta(A \cup B)) + u(\delta(A \cap B))$$
where $u(\delta(S)) = \sum_{e \in \delta(S)} u(e)$

Since the capacities are non-negative, it suffices to show that each term on the right also appears on the left (same number of times).

Therefore, $u(\delta(A \cup B)) + u(\delta(A \cap B)) = \sum_{e \in \delta(A \cup B)} u(e) + \sum_{f \in \delta(A \cap B)} u(f) = \sum_{e \in \delta(A \Delta B)} u(e) + 2\sum_{f \in \delta(A \cap B)} u(f)$. Now each term $u(e)$ where $e \in \delta(A \Delta B)$ is also counted once either for $e \in A$ or $e \in B$ on the left. Similarly, each term $u(f)$ where $f \in A \cap B$ is counted twice for both $f \in A$ and $f \in B$. So $u(\delta(A)) + u(\delta(B)) \geq u(\delta(A \cup B)) + u(\delta(A \cap B))$.

\subsection*{Exercise 4.6}

Suppose $f$ is submodular then consider $A = S \cup \{e\}, B = T$:
$$f(S \cup \{e\}) + f(T) \geq f(T \cup \{e\}) + f(S)$$
because $(S \cup \{e\}) \cup T = T \cup \{e\}$ and $(S \cup \{e\}) \cap T = (S \cap T) \cup (T \cap \{e\}) = S$ as $S \subseteq T$ and $e \not \in T$. After re-arranging, we get that submodularity implies diminishing returns.
\newline

Conversely, let $A \setminus B = \{a_1, a_2, \ldots, a_n\}$ then define $A_0 = A \inter B$, $A_i = A_{i-1} \union \{a_i\}$, $\forall i \geq 1$ and $B_0 = B$, $B_i = B_{i-1} \union \{a_i\}$, $\forall i \geq 1$.

Now we note that, $A_i \subseteq B_i$. Proof by induction: $A \inter B = A_0 \subseteq B_0 = B$. Assuming $A_{i-1} \subseteq B_{i-1}$, $A_{i-1} \union \{a_i\} = A_i \subseteq B_i = B_{i-1} \union \{a_i\}$.

Furthermore, $a_{i+1} \not \in B_i$ by construction. Hence we can apply property of diminishing returns on these sets as:
\begin{align*}
    f(A_1) - f(A_0) &\geq f(B_1) - f(B_0) \\
    f(A_2) - f(A_1) &\geq f(B_2) - f(B_1) \\
    &\vdots \\
    f(A_n) - f(A_{n-1}) &\geq f(B_n) - f(B_{n-1}) \\
\end{align*}

Adding them up, we get $f(A_n) - f(A_0) \geq f(B_n) - f(B_0)$. But $f(A_n) = A$ and $f(B_n) = f(A \cup B)$. Hence
$$f(A) - f(A \cap B) \geq f(A \cup B) - f(B)$$

After re-arranging, we get that diminishing returns implies submodularity.

\vspace{2in} %Leave more space for comments!

[References: Douglas B. West notes on Gallai Edmonds Structure Theorem for problem 2.5 and discussion with Sricharan AR and Satya P. Nayak for problem 4.4]

\end{document}


%!TEX root = Economics and Behaviour.tex

\section{Strategic form}

In this first section we will merely consider \begriff{static games} where all players choose their individual actions simultaneously (see One-Shot games). Yet, the term simultaneously is meant figuratively, it is not decisive that all players act at the same time but that at the time of their choice the decisions of all other players are unknown\footnote{Some experiments have shown that even if theoretically the decision process should be the same people tend to behave differently if they have knowledge about a decision order  (see Rapoport 1997, Guth, Huck und Rapoport 1998)}.

In static games of complete, perfect information, a strategic form or normal-form representation of a game is a specification of players' strategy spaces and payoff functions. \\

First let's take a look at the definition of a strategy, which we will then use to define the strategic form of games:

\begin{definition}[Strategy]
	Let $\mathcal{H}_{i}$ denote the collection of player $i$'s sets of information, $\mathcal{A}$ the set of possible actions in the game and $C(H) \subseteq \mathcal{A}$ the set of actions possible at information set $H$. A \begriff{strategy} for player $i$ is a function $s_{i} \colon \mathcal{H}_{i} \rightarrow \mathcal{A}$ such that
	\[ s_{i}(H) \in C(H) \text{ for all } H \in \mathcal{H}_{i} \]
\end{definition}

We call a set of strategies a \begriff{complete plan} of actions for each situation in a game and with $S_{-i}$ we denote the strategies of all players except player $i$.\\

\begin{definition}[Strategic form representation]
To be fully defined a game in \begriff{strategic form} must specify the set $\{ N, S, u \}$ where
	\begin{enumerate}
		\item $N$ is the finite number of players and for player $i$ that would mean $i \in \{ 1, \dotsc, N \}$.
		\item For each player $i$ we have a set of strategies $S_{i}$, such that $S = \bigotimes S_{i}$.
		\item For each player $i$ we have an expected utility function $u_{i} : S \rightarrow \MdR$, such that $u = \{ u_{1}, \dotsc, u_{N} \}$.
	\end{enumerate}
\end{definition}

To visualise a static game with two players ($P1$ and $P2$) and a finite number of possible strategies (for simplicity let's assume that there are only two signals and call them $a$ and $b$) one commonly uses the \begriff{matrix form}, where $u_{i}(x, y)$ represents the utility function for player $i$ given the strategy $x$ for $P1$ and $y$ for $P2$ with $x, y \in \{ a, b\}$.
\begin{center}
	\begin{tabular}{|c|c|c|}
		\hline\hline
  			$P1$ / $P2$ & \textbf{a} & \textbf{b} \\
         		\cline{1-3}
   					\textbf{a} & $( u_{1}(a, a) , u_{2}(a, a))$ & $(u_{1}(a, b), u_{2}(a, b))$	\arrayrulewidth2pt \\
            	\cline{1-3}
   					\textbf{b} & $( u_{1}(b, a), u_{2}(b, a))$ & $(u_{1}(b, b), u_{2}(b, b))$\\ \hline\hline
	\end{tabular}
\end{center}

\begin{example}[Prisoner's Dilemma] \label{prisonersdilemma} \index{Prisoner's Dilemma}
	 Imagine, two members of a criminal gang are arrested and imprisoned. Each prisoner is in solitary confinement with no means of communicating with the other. The prosecutors lack sufficient evidence to convict the pair on the principal charge. They hope to get both sentenced to a year in prison on a lesser charge. Simultaneously, the prosecutors offer each prisoner a bargain. Each prisoner is given the opportunity either to: betray the other by testifying that the other committed the crime, or to cooperate with the other by remaining silent. The offer is:
	\begin{itemize}
		\item If A and B betray each other, each of them serves 6 years in prison
		\item If A betrays B but B remains silent, A will be set free and B will serve 9 years in prison (and vice versa)
		\item If A and B both remain silent, both of them will only serve 1 year in prison (on the lesser charge)
	\end{itemize}

	\begin{center}
		\begin{tabular}{|l|l|r|}
			\hline\hline
  				P1 / P2 & \textbf{defects} & \textbf{cooperates} \\
         			\cline{1-3}
   				\textbf{defects} & $(-6, -6)$ & $(0, -9)$ 	\arrayrulewidth2pt \\
            		\cline{1-3}
   				\textbf{cooperates} & $(-9, 0)$ & $(-1, -1)$ \\
			\hline\hline
		\end{tabular}
	\end{center}
\end{example}

There are many different possibilities to extrapolate the Prisoner's Dilemma to apply it in a variety of problems, other interpretations are for example:
\begin{itemize}
	\item Collusion on prices
	\item Investing in human capital vs. arming for a war
	\item Buying a SUV vs. a smaller car
\end{itemize}

Now that we got to know an example for a game we should discuss some solution concepts and the first obvious choice is the strict dominance.

\begin{definition}[Strict dominance]
	A strategy $s_{i} \in S_{i}$ is \begriff{strictly dominant} for player $i$ if for all $s_{i}' \neq s_{i} (s_{i}'  \in S_{i})$:
	\[ u(s_{i}, s_{-i}) > u(s_{i}', s_{-i}), \quad \forall s_{-i} \in S_{-i} \]
\end{definition}

Analysing \hyperref[prisonersdilemma]{Prisoner's Dilemma} one can see that $cooperate$ is strictly dominated by $defect$. Simply the elimination of strictly dominated strategies leads to the prediction that the players choose $(defects, defects)$ even though $(cooperates, cooperates)$ would result in a lower prison sentence.

This leads us to the elimination of irrational strategies:

\begin{definition}[Best response]
	The strategy $s_{i}$ is a \begriff{best response} for player $i$ to the opponent's strategies $s_{-i}$ if
	\[ u_{i}(s_{i}, s_{-i}) \geq u_{i}(s_{i}', s_{-i}) \text{ for all } s_{i}' \in S_{i} \]
	A strategy $s_{i}$ is never a best response if there is no $s_{-i}$ for which $s_{i}$ is a best response.
\end{definition}

\begin{definition}[Rationalisable Strategies]
	The strategies that survive the iterated elimination of strategies that are never a best response are known as player $i$'s \begriff{rationalisable strategies}.
\end{definition}

Iteratively eliminating dominated strategies leads to a set of rationalisable strategies; let's take a look for example at the following game:

	\begin{center}
		\begin{tabular}{|r|r|r|r|}
			\hline\hline
  				P1 / P2 & \textbf{l} & \textbf{m} & \textbf{r} \\
         			\cline{1-4}
   				\textbf{u} & $(1, 1)$ & $(2, 2)$ & $(2, 0)$ \arrayrulewidth2pt \\
            		\cline{1-4}
   				\textbf{m} & $(2, 0)$ & $(0, 1)$ & $(1, 0)$ \arrayrulewidth2pt \\
            		\cline{1-4}
   				\textbf{d} & $(0, 2)$ & $(1, 1)$ & $(1, 1)$ \\			\hline\hline
		\end{tabular}
	\end{center}

Here, an iterated elimination leads to $(u, m)$ as rationalisable strategies:
\begin{itemize}
	\item For Player 1 $d$ is strictly dominated by $u$ and should therefore never be played.
	\item For Player 2 $r$ is strictly dominated by $m$.
	\item Since Player 1 would never play $d$, $m$ dominates in the iterative subgame $l$
	\item Now knowing Player 2 should play $m$, $u$ is the rational choice for Player 1
\end{itemize}

Important to notice is that here, the predictions we derived rely immensely on the rationality of all players.

Since there is not always a strictly dominant strategy we extend our solution concepts with the Nash-Equilibrium.

\begin{definition}[Nash-Equilibrium] \label{nashequilibrium}
A strategy set $s = (s_{1}, \dotsc, s_{N})$ constitutes a \begriff{Nash-Equilibrium} of a game if for every $i = 1, \dotsc, N$ (where $N$ is the number of players)
	\[ u_{i}(s_{i}, s_{-i}) \geq u_{i}(s_{i}', s_{-i}) \text{ for all } s_{i}' \in S_{i} \]
\end{definition}

In other words, a \begriff{Nash-Equilibrium} is the mutual best response for every player, therefore a set of strategies in which no player can do better by unilaterally changing their strategy. \\

\begin{example}[Battle of the sexes] \label{battleofthesexes} \index{Battle of sexes}
		Imagine a couple that agreed to meet this evening, but both individually cannot recall if they will be attending the opera or a football match. The husband would most of all like to go to the football game. The wife would like to go to the opera. Both would prefer to go to the same place rather than different ones. \\ \\
		Hence, the Battle of the sexes in strategic form could, of course depending on their utility function, look something like:
		\begin{center}
			\begin{tabular}{|l|l|r|}
				\hline\hline
  					M / F & \textbf{football} & \textbf{opera} \\
         				\cline{1-3}
   					\textbf{football} & $(1, 2)$ & $(0, 0)$ 	\arrayrulewidth2pt \\
            			\cline{1-3}
   					\textbf{opera} & $(0, 0)$ & $(2, 1)$ \\ \hline\hline
			\end{tabular}
		\end{center}

		and the two Nash-Equilibriums in this game are $(opera, opera)$ and $(football, football)$.
\end{example}

\begin{example}[The Beauty-Contest] \index{Beauty-Contest} \label{Beauty-Contest}
John Keynes described the action of rational agents in a market using an analogy based on a fictional newspaper contest, in which entrants are asked to choose the six most attractive faces from a hundred photographs. Those who picked the most popular faces are then eligible for a prize. An agent has to consider that not his preferred choice is the optimal strategy but the one with the highest chances to be chosen by all others.
\end{example}
We can generalise this example to the following \\
\begin{example}[Guessing-Game] \index{Guessing-Game} \label{Guessing-Game}
	 A Guessing-Game (e.g. the \hyperref[Beauty-Contest]{Beauty-Contest}) is a game with at least two players in which the sequel can be described as follows:
	\begin{itemize}
		\item Every player guesses a number $b_{i} \in \{0, 1, 2, \dotsc, 100 \}$
		\item The player with the closest guess to $p \cdot \sum_{i = 1}^{n} \frac{b_{i}}{n} = p \cdot \varnothing$ with $p \in (0, 1)$ wins
		\item In case of tie a random device that is 'fair' decides who wins the prize $P > 0$
	\end{itemize}
	\textbf{1. Question:} Is $(0, \dotsc, 0)$ a Nash-Equilibrium? \\
	\textbf{Answer:} Yes. Assume player $i$ bids $b > 0$ and all others bid $0$.
		\begin{itemize}
			\item if bidder $i$ bids $0$ expected win equals $\frac{1}{n} P $
			\item we can rewrite $p$ times the mean with
				\[ p \cdot \varnothing = p \cdot \frac{(n - 1)0 + 1 b}{n} = p \cdot \frac{b}{n}. \]
			Then, his expected profit is $0$, as $0$ is closer to $p \cdot \varnothing$ then the bet $b > 0$, since
			\[ \left| b - p \cdot \frac{b}{n} \right| =  \left|(n-p) \cdot \frac{b}{n} \right| \overset{\substack{p < 1, \\ n \geq 2}}{>} \left| p \cdot \frac{b}{n} \right| = \left| 0 - p \cdot \frac{b}{n} \right| \]
		\end{itemize}

	\textbf{2. Question:} Is $(0, \dotsc, 0)$ the unique Nash-Equilibrium here? \\
	\textbf{Answer:} Yes, and to bring this to proof we take a look at player $i$'s optimal strategy $b_{i}^{*}$ given the optimal responses of all others:

	First, as a consequence our proof of the 1. Question the optimal strategy $b_{i}^{*}$ has to be smaller or equal to the others' winning number: $b_{i}^{*} \leq p \cdot \frac{\sum_{j \neq i} b_{j}^{*}}{n - 1}$.

	Considering all players, in terms of summing up over all $i$, yields then
	\[ \sum_{i = 1}^{n} b_{i}^{*} \leq p \cdot \frac{\sum_{i = 1}^{n} \sum_{j \neq i} b_{j}^{*}}{n - 1} = p \cdot \frac{(n - 1) \sum_{j = 1}^{n} b_{j}^{*}}{n - 1} = p \cdot \sum_{j = 1}^{n} b_{j}^{*}. \]
	Thus
		\[ \sum_{i = 1}^{n} b_{i}^{*} \leq p \cdot \sum_{i = 1}^{n} b_{i}^{*}, \quad p \in (0, 1) \]
	has to hold true and with that $b_{i}^{*} = 0$ for all $i$.

	Now that a Nash-Equilibrium consists of the mutual best responses only $(0, \dotsc,  0)$ can be a Nash-Equilibrium in this situation. \\

	\textbf{3. Question:} Is $(0, \dotsc, 0)$ also a strictly dominant strategy? \\
	\textbf{Answer:} No. Imagine following situation: \\
	If $48$ of $50$ players bid the number $100$ and the $49$th bids $0$ then the best response for player $50$ is to bid $97$ \footnote{$97$ is the closest whole number to $p \cdot \varnothing$}, which is much larger than 0, so $0$ is not the best answer and therefore cannot be a strictly dominant strategy.
\end{example}

\newpage


\chapter{Introduction}

Dependent type theories are now well-established as a technology for certifying
software and formalising mathematics. Yet they remain rough around some edges,
one of which is termination checking. If a type theory is to be consistent as a
logic, it must ensure that all recursive programs terminate (and that all
corecursive programs are productive). In mainstream dependently typed languages
such as Coq, Agda, Idris and Lean, this termination check is implemented by
heuristics based on a simple syntactic criterion for termination, the principle
of structural recursion.

Despite its simplicity, structural recursion is surprisingly powerful in
practice. Still, it suffers from some flaws that are directly related to its
syntactic nature. It makes type checking non-compositional: we cannot always
replace a term by another term of the same type because some terms have special
meaning to the termination checker. It does not play well with more complex data
types such as the nested inductive type of rose trees. It does not easily
accommodate corecursive definitions, which require a separate productivity
check. And when structural checkers are extended to handle more complex
scenarios, such as mutual and nested recursion, they tend to become complex and
therefore hard to implement correctly.

To address the problems with structural recursion, several other termination
checking regimes have been proposed. One of these is \emph{sized types}, an
umbrella term for a family of broadly similar type systems that use type
annotations to ensure termination. In these systems, inductive types are
annotated with a size: $\Nat{n}$, for example, is the type of natural numbers
with size $n$. For the moment, we can view $n$ as a natural number and say that
$\Nat{n}$ contains only natural numbers $m ≤ n$. This interpretation suggests a
simple termination criterion: if, in a recursive definition, we receive an input
in $\Nat{n}$ and only recurse on terms in $\Nat{m}$ for some $m < n$, then the
recursion must stop (at the latest) when it reaches the size zero.

Since this termination check is based entirely on type-level information, it
avoids the non-compositionality of syntactic approaches. It also handles nested
inductive data types well and, when combined with copatterns \cite{abel2016},
can be used to check productivity of corecursive definitions in a similarly
natural way. The dependently typed language Agda features an implementation of
sized types that demonstrates these advantages. \chapref{background} gives a
brief comparison between structural termination checking and Agda's sized types.

Motivated by the desirable properties of sized types, this thesis investigates a
custom lambda calculus with sized types called λST, defined in \chapref{source}.
The calculus extends the simply-typed lambda calculus with sized types that
closely resemble Agda's. As such, it provides a setting for
\enquote*{experiments} with Agda's sized types: investigations of the properties
of sized types without the surrounding complexity of a full dependently-typed
language.

Of these properties, two are of special interest. The first is normalisation:
the type system should ensure that all programs do actually terminate. This is
the raison d'être of sized types and thus the focus of existing work. The
second property we are interested in is size irrelevance: sizes should only be
used during type checking to ensure termination/productivity and should not
affect the runtime behaviour of programs. This means that sizes can be erased at
runtime, which is good for performance.

In \chapref{model}, I give a denotational semantics of λST that incorporates a
notion of size irrelevance. In the semantics, types are interpreted as reflexive
graphs. This technique is usually used to establish parametricity properties,
for example of type quantification in System F or Π-types in dependent type
theories. It is not surprising that reflexive graphs also yield a model of λST
since size irrelevance can be viewed as a parametricity property: it just means
that any term which depends on a size is parametric in that size. The model is
fully formalised in Agda (without sized types); \chapref{formalisation}
discusses the formalisation and some of its technical challenges.

Before I settled on the reflexive graph approach, I also investigated two
category-theoretical modelling approaches which looked promising, but turned out
to be inadequate. \chapref{negative} briefly discusses these models and their
problems.


\documentclass{pset_template}

\title{FSA/Regular Expressions}
\date{February 8, 2019}
\editorOne{Sanjit Bhat}
\editorTwo{Alexander Sun}
\lectureNum{3}
\contestMonth{February}

\begin{document}
\maketitle

\section{Fun Facts}
\begin{itemize}
\item Developed in 1951 by mathematician Stephen Cole Kleene.
\item Ken Thompson (one of the guys who developed UNIX) used regular expressions on an early Unix editor.
This eventually lead to its use in the famous UNIX tool grep.
\item Applications include string searching algorithms,  input verification, and search engines.
\item You can even use it inside your programming editor to find where you've put stuff.
\end{itemize}

\section{Background}
\paragraph{What are regular expressions?}
According to Wikipedia, regular expressions (regex) are ``a sequence of characters that define a search pattern.''
In other words, a regex defines a set of possible strings in a concise manner for
some later purpose.
For example, reali[sz]e defines the set \{realize, realise\} of possible strings.
This set can be later used for cross-referencing American-English spellings with
British-English spellings.

\paragraph{All the regex syntax you need to know.}
Regex includes \textit{metacharacters} that define more complex types
of string matching.
The following is a list of all the regex metacharacters you need to know:

\begin{enumerate}
\item \textbf{|, or, $\cup$}
These are booleans that tell the processor to take the set union of the regexes
on the left- and right-hand sides.
For instance, gr(a|e)y, gray or grey, and gr(a$\cup$e)y all define the set
\{gray, grey\}.

\item \textbf{$\lambda$}
The null or empty string.

\item \textbf{Quantification}
Defining the number of something allowed to occur.
Note that these all operate on a regex left of the operator.
    \begin{enumerate}
    \item \textbf{?}
    Zero or one.
    E.g., colou?r = \{color, colour\}.
    \item \textbf{*}
    Zero or more.
    This is also called the Kleene Star (named after the inventor, Stephen Kleene).
    \item \textbf{+}
    One or more.
    \end{enumerate}

\item \textbf{.}
Wildcard (a fill in for any character).
Combine . and * for a.*b, which accepts any string with a and b as the leftmost and rightmost
characters, respectively, with an arbitrary number of arbitrary characters inbetween.

\item \textbf{[\ldots]}
Set of possible character matches.
Think the reali[sz]e example above.
This can get slightly more complex by using hyphens to define ranges of possible characters.
E.g., [a-z] means every \textit{lowercase} char from a to z;
[abcx-z] means a, b, c, and x, y, z; and [a-cx-z] means a, b, c and x, y, z.

\item \textbf{[\string^\ldots]}
Set of characters not contained withing the brackets.
E.g., [\string^a-z] matches any character that is not a lowercase character from a to z.

\item \textbf{()}
Just like in math, parentheses imply grouping.
E.g., if we wanted the set \{gray, grey\}, gra|ey would give us \{gra, ey\}.
Instead, using parentheses we can get gr(a|e)y, which gives us the correct regex.
A more complex example is H(\"{a}|ae?)ndel, which matches \{Handel, H\"{a}ndel, Haendel\}.
\end{enumerate}

Order of operations: Kleene Star (*), concatenation (ab), and union($\cup$).
Because Kleene Star has the highest priority, a.*b accepts a string
with an arbitrary number of \textit{several different arbitrary} characters
 (e.g., \{acdb, \ldots\}), as opposed
to only an arbitrary number of a single arbitrary character (e.g., \{accb, \ldots\}).

\paragraph{Practicing the syntax via identity proofs.}
To make sure you understand the syntax and order of operations,
see if you can prove the following identities:
\begin{enumerate}
\item (a*)* = a*
\item aa* = a*a
\item aa* $\cup \lambda$ = a*
\item a(b $\cup$ c) = ab $\cup$ ac
\item a(ba)* = (ab)*a
\item (a $\cup$ b)* = (a* $\cup$ b*)*
\item (a $\cup$ b)* =(a*b*)*
\item (a $\cup$ b)* = a*(ba*)*
\end{enumerate}

\paragraph{How are regex interpreted by the computer?}
In a regex, there are two types of chars: literals and metacharacters.
Literals define regular characters, while metacharacters indicate
more nuanced behaviors.
After creating a regex, a regex processor transforms the characters into an internal
representation that can be thought of as a Finite State Automata (FSA).
FSAs are an abstract concept in theoretical computer science consisting of the following:
\begin{enumerate}
\item A finite number of states, of which exactly one is active at any given time
\item Transition rules to change the active state
\item An initial state
\item One or more final states
\end{enumerate}
We can draw an FSA by representing each state as a circle, the final state
as a double circle, the start state as the only state with an incoming arrow,
and the transition rules as labeled-edges connecting the states.
For instance, the following is an FSA diagram for the regex x+y+:

{\centering
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
   \node [state,initial, initial text=] (q_0) {A};
   \node [state, right of=q_0] (q_1) {B};
   \node [state, accepting, right of=q_1] (q_2) {C};
    \path[->]
    (q_0) edge node {x} (q_1)
    (q_1) edge node {y} (q_2)
          edge [loop above] node {x} ()
    (q_2) edge [loop above] node {y} ();
\end{tikzpicture}

}

If you would like to learn more about FSAs, I recommend the Wikipedia page.
Outside the ACSL bubble, automata and finiteness
are an important field of research in theoretical CS\@.
They connect back to problems such as P vs. NP and whether a program
will stop in a reasonable amount of time or even in an infinite amount of time.

\paragraph{Testing regex syntax.}
If you would like to practice regex and have your code actually
matched against strings, I recommend \href{https://regexr.com/}{this} website.

\section{Exercises}
\subsection{Translate an FSA to a Regular Expression}
\label{par:translate}
\begin{enumerate}
\item Find a simplified Regular Expression for the following FSA:

{\centering
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
   \node [state,initial,initial text=] (q_0) {};
   \node [state, right of=q_0] (q_1) {};
   \node [state, right of=q_1] (q_2) {};
   \node [state, accepting, right of=q_2] (q_3) {};
    \path[->]
    (q_0) edge node {0} (q_1)
    (q_1) edge node {0} (q_2)
          edge [loop above] node {1} ()
    (q_2) edge node {1} (q_3);
\end{tikzpicture}

}

\item Find a simplified Regular Expression for the following FSA:

{\centering
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
   \node [state,initial,initial text=] (q_0) {};
   \node [state, above right=of q_0] (q_1) {};
   \node [state, below right=of q_0] (q_2) {};
   \node [state, accepting, below right=of q_1] (q_3) {};
    \path[->]
    (q_0) edge node {a} (q_1)
          edge node {b} (q_2)
    (q_1) edge node {c} (q_3)
    (q_2) edge node {c} (q_3);
\end{tikzpicture}

}

\item List all of the following FSAs which represent 1*01*0:

    \begin{enumerate}
    \item
    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
       \node [state,initial,initial text=] (q_0) {};
       \node [state, right of=q_0] (q_1) {};
       \node [state, accepting, right of=q_1] (q_2) {};
        \path[->]
        (q_0) edge [loop above] node {1} ()
              edge node {0} (q_1)
        (q_1) edge [loop above] node {1} ()
              edge node {0} (q_2);
    \end{tikzpicture}

    \item
    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
       \node [state,initial,initial text=] (q_0) {};
       \node [state, accepting, right of=q_0] (q_1) {};
        \path[->]
        (q_0) edge [loop above] node {1} ()
              edge node {0} (q_1);
    \end{tikzpicture}

    \item
    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
       \node [state,initial,initial text=] (q_0) {};
       \node [state, right of=q_0] (q_1) {};
       \node [state, accepting, right of=q_1] (q_2) {};
        \path[->]
        (q_0) edge [loop above] node {0,1} ()
              edge node {1} (q_1)
        (q_1) edge [loop above] node {0,1} ()
              edge node {0} (q_2);
    \end{tikzpicture}

    \item
    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
       \node [state,initial,initial text=] (q_0) {};
       \node [state, above right=of q_0] (q_1) {};
       \node [state, below right=of q_0] (q_2) {};
       \node [state, accepting, below right=of q_1] (q_3) {};
        \path[->]
        (q_0) edge node {0} (q_1)
              edge node {1} (q_2)
        (q_1) edge [loop above] node {1} ()
              edge node {1} (q_3)
        (q_2) edge [loop below] node {0} ()
              edge node {1} (q_3)
        (q_3) edge [loop above] node {0} ();
    \end{tikzpicture}
    \end{enumerate}
\end{enumerate}

\subsection{Simplify a Regular Expression}
\label{par:simplify}

\subsection{Determine which Regular Expressions or FSAs are equivalent}
\label{par:equivalent}
\begin{enumerate}
\item Which, if any, of the following Regular Expressions are equivalent?
    \begin{enumerate}
    \item (a$\cup$b)(ab*)(b*$\cup$a)
    \item (aab*$\cup$bab*)a
    \item aab*$\cup$bab*$\cup$aaba$\cup$bab*a
    \item aab*$\cup$bab*$\cup$aab*a$\cup$bab*a
    \item a*$\cup$b*
    \end{enumerate}
\end{enumerate}

\subsection{Determine which strings are accepted by either an FSA or a Regular Expression}
\label{par:accepted}
\begin{enumerate}
\item Which of the following strings are accepted by the following Regular Expression     ``00*1*1U11*0*0''?
    \begin{enumerate}
    \item 0000001111111
    \item 1010101010
    \item 1111111
    \item 0110
    \item 10
    \end{enumerate}
\item Which of the following strings match the regular expression
pattern ``[A-D]*[a-d]*[0-9]''?
    \begin{enumerate}
    \item ABCD8
    \item abcd5
    \item ABcd9
    \item AbCd7
    \item X
    \item abCD7
    \item DCCBBBaaaa5
    \end{enumerate}
\item Which of the following strings match the regular expression
pattern ``Hi?g+h+[\string^a-ceiou]''?
    \begin{enumerate}
    \item Highb
    \item HiiighS
    \item HigghhhC
    \item Hih
    \item Hghe
    \item Highd
    \item HgggggghX
    \end{enumerate}
\end{enumerate}

\section{Solutions}

\subsection{Answers for Section~\ref{par:translate}}
\begin{enumerate}
\item 01*01
\item (a|b)c or ac $\cup$ bc
\item a. The other choices correspond to 1*0, (0$\cup$1)*1(0$\cup$1)*0, and 01*10*$\cup$10*10*
\end{enumerate}

\subsection{Answers for Section~\ref{par:equivalent}}
\begin{enumerate}
\item B is different from the rest because it requires an ending `a'.
E is different from the rest because it doesn't allow for alternating a's and b's.
C and D are different because of the third `or' condition.
Upon very close inspection, A and D are equivalent (check this carefully yourself).
Therefore, A and D are the answers.
\end{enumerate}

\subsection{Answers for Section~\ref{par:accepted}}
\begin{enumerate}
\item 0000001111111 and 10
\item ABCD8, abcd5, ABcd9, and DCCBBBaaaa5
\item HigghhhC, Highd, and HgggggghX
\end{enumerate}
\end{document}


\documentclass[pre,aps,superscriptaddress,longbibliography,notitlepage]{revtex4-1}

\usepackage{amsmath,amsfonts,amssymb,bm,graphicx,hyperref,listings,xcolor,float,aligned-overset,hyperref,multirow,rotating}
\usepackage[ddmmyyyy,24hr]{datetime}
\setlength{\parindent}{0pt}
\raggedbottom

\begin{document}

\title{Activity-driven dynamics algorithm}
\author{Yann-Edwin Keta}
\date{\today, \currenttime}
\maketitle
\tableofcontents

\section{Introduction}

Ref.~\cite{mandal2020study} introduces ``activity-driven dynamics'' (ADD) from the observation that, for any given set of self-propulsion vectors, the time for the particles to reach a force-balanced state does not grow with the persistence time $\tau_p$ of self-propulsion. Therefore, on the time scale of $\tau_p$ and in the limit $\tau_p \to \infty$, the particle configuation instantaneously adapts to changes of the self-propulsion -- the time evolution of the system is driven only by changes in the active forces, hence the name ``ADD''.\\

This separation of time scale, between (1) the evolution of the self-propulsion and (2) the movement towards a corresponding force-balanced state, is exploited in ADD by computing (1) for each time step of $\mathcal{O}(\tau_p)$ and (2) accordingly over a $\tau_p$-independent time. It is therefore possible to reach the large-$\tau_p$ limit with a dramatic reduction in computation time.\\

Ref.~\cite{mandal2020extreme} describes an ``intermittent'' regime at intermediate persistence time and low active driving. Would this regime be the consequence of particles reaching a force-balanced state before the diffusion of self-propulsion directions destabilises the configuration, the ADD alorithm should be relevant to simulate it -- Ref.~\cite{mandal2020study} applies ADD to study Eshelby-like events, which are presented in Ref.~\cite{mandal2020extreme} as a characteristic of the intermittent regime.\\

We highlight some similarities with the ``athermal quasi-static random displacement'' (AQRD) method of Ref.~\cite{morse2020direct} in which a random local strain vector is first associated to each particle, these are then moved quasi-statically in these directions, with a minimisation at each step to find the constrained local minimum of potential energy. This method is equivalent to self-propelled forcing in the limit of zero rotational noise, where the forcing is slower than any other relaxation process.

\section{ADD for inertial ABPs}

\subsection{Model}

Refs.~\cite{mandal2020study,mandal2020multiple} introduce the ADD algorithm for inertial active Brownian particles (ABPs) without thermal noise
\begin{eqnarray}
\label{orig-abpr}
m \ddot{\boldsymbol{r}}_i(t) = - \gamma \dot{\boldsymbol{r}}_i(t) - \nabla_i U(t) + \gamma v_0 \boldsymbol{u}(\theta_i(t))\\
\label{orig-abptheta}
\dot{\theta }_i(t) = \sqrt{2/\tau_p} \, \eta_i(t)
\end{eqnarray}
with $\boldsymbol{r}_i$ and $\theta_i$ the position and orientation of the $i$-th particle, $m$ the particle mass, $\gamma$ the friction coefficent, $U$ the interaction potential, $v_0$ the self-propulsion velocity, $\boldsymbol{u}(\theta_i) = (\cos\theta_i, \sin\theta_i)$, $\tau_p$ the persitence time, and $\eta_i$ a zero-mean unit-variance Gaussian white noise.\\

Ref.~\cite{mandal2020study} highlights that $U$ can in general contain arbitrary many-body interactions.\\

We want to compute the dynamics on a time scaled by the persistence time
\begin{equation}
t^{\prime} = t/\tau_p
\label{time-scale}
\end{equation}
and thus rewrite Eqs.~\ref{orig-abpr},~\ref{orig-abptheta}
\begin{eqnarray}
\label{scaled-abpr}
m\frac{1}{\tau_p^2} \frac{\mathrm{d}^2 \boldsymbol{r}_i}{{\mathrm{d}t^{\prime}}^2}(t^{\prime}) + \gamma \frac{1}{\tau_p} \frac{\mathrm{d}\boldsymbol{r}_i}{\mathrm{d}t^{\prime}}(t^{\prime}) = - \nabla_i U(t^{\prime}) + \gamma v_0 \boldsymbol{u}(\theta_i(t^{\prime}))\\
\label{scaled-abptheta}
\frac{\mathrm{d}\theta_i}{\mathrm{d}t^{\prime}}(t^{\prime}) = \sqrt{2} \, \eta^{\prime}_i(t^{\prime})
\end{eqnarray}
with $\eta^{\prime}_i$ a zero-mean unit-variance Gaussian white noise in the scaled time variables ($\eta_i^{\prime} = \sqrt{\tau_p} \eta_i$). In the $\tau_p \to \infty$ limit, the left hand side of Eq.~\ref{scaled-abpr} vanishes and the particle configuration thus always satisfies
\begin{equation}
0 = -\nabla_i \left(U - \sum_i v_0 \boldsymbol{u}(\theta_i) \cdot \boldsymbol{r}_i\right) = - \nabla_i U_{\rm eff}
\label{Ueff}
\end{equation}
hence minimising an effective potential tilted by the active forces $U_{\rm eff}$.

\subsection{Numerical implementation}

Orientation dynamics (Eq.~\ref{scaled-abptheta}) is integrated first over a time step $\delta t^{\prime}$
\begin{equation}
\theta_i(t^{\prime} + \delta t^{\prime}) = \theta_i(t^{\prime}) + \sqrt{2 \delta t^{\prime}} \, \eta^{\prime}_i
\end{equation}
where $\eta^{\prime}_i$ is random number taken from a Gaussian distribution with zero-mean and unit-variance.\\

Position dynamics (Eq.~\ref{scaled-abpr}) is then integrated with time step $\Delta t$ to minimise $U_{\rm eff}$ (Eq.~\ref{Ueff}) -- this is done for a time $t_{\rm min}$ until either (i) the total force on each particle falls below a threshold
\begin{equation}
\sqrt{\frac{1}{N}\sum_i \left|-\nabla_i U_{\rm eff}\right|^2} \leq F_c
\label{force-threshold}
\end{equation}
or (ii) the minimisation time $t_{\rm min} \propto \Delta t$ reaches a threshold
\begin{equation}
t_{\rm min} \leq t_{\rm step}
\label{time-threshold}
\end{equation}
and such that, in the $\tau_p \to \infty$ limit, we have $t_{\rm step} \ll \tau_p \delta t^{\prime}$.\\

In order to perform this minimisation, authors of Ref.~\cite{mandal2020study} use the exponential Euler method \cite{hochbruck2010exponential} on
\begin{eqnarray}
\dot{\boldsymbol{v}}_i(t) = -\frac{\gamma}{m} \boldsymbol{v}_i(t) + \frac{1}{m}\left[-\nabla_i U(t) + \gamma v_0 \boldsymbol{u}(\theta_i(t^{\prime} + \delta t^{\prime}))\right]\\
\dot{\boldsymbol{r}}_i(t) = \boldsymbol{v}_i(t)
\end{eqnarray}
thus yielding
\begin{eqnarray}
\boldsymbol{v}_i(t + \Delta t) = \Gamma \boldsymbol{v}_i(t) + \frac{1}{\gamma}(1 - \Gamma)\left[-\nabla_i U(t) + \gamma v_0 \boldsymbol{u}(\theta_i(t^{\prime} + \delta t^{\prime}))\right]\\
\boldsymbol{r}_i(t + \Delta t) = \boldsymbol{r}_i(t) + c_1 \boldsymbol{v}_i(t) + c_2 \left[-\nabla_i U(t) + \gamma v_0 \boldsymbol{u}(\theta_i(t^{\prime} + \delta t^{\prime}))\right]
\end{eqnarray}
where
\begin{eqnarray}
c_1 = \frac{m}{\gamma} \left(1 - \Gamma\right)\\
c_2 = \frac{m}{\gamma^2}\left(\frac{\gamma \Delta t}{m} - 1 + \Gamma\right)\\
\Gamma = \exp\left(-\frac{\gamma\Delta t}{m}\right)
\end{eqnarray}
and $\boldsymbol{v}_i$ is the velocity of $i$-th particle.

\section{ADD for overdamped AOUPs}

Ref.~\cite{mandal2020study} already mentions the applicability of ADD to overdamped active Ornstein-Uhlenbeck particles (AOUPs). We develop here the corresponding equations and numerical implementation.\\

We consider overdamped AOUPs without thermal noise
\begin{eqnarray}
\label{orig-aoupr}
\dot{\boldsymbol{r}}_i(t) = -\nabla_i U(t) + \boldsymbol{p}_i(t)\\
\label{orig-aoupp}
\dot{\boldsymbol{p}}_i(t) = -D_r \boldsymbol{p}_i(t) + \sqrt{2 D D_r^2} \, \boldsymbol{\eta}_i(t)
\end{eqnarray}
with $\boldsymbol{r}_i$ and $\boldsymbol{p}_i$ the position and propulsion vector of the $i$-th particle, $U$ the interaction potential, $D_r = \tau_p^{-1}$ the rotational diffusivity, $D$ the translational diffusivity, and $\boldsymbol{\eta}_i$ a zero-mean unit-variance Gaussian white noise on each component -- note that we have set the mobility $\mu = 1/\gamma = 1$.\\

On the time scale (Eq.~\ref{time-scale})
\begin{equation}
t^{\prime} = D_r t
\end{equation}
we then rewrite Eqs.~\ref{orig-aoupr},~\ref{orig-aoupp}
\begin{eqnarray}
\label{scaled-aoupr}
D_r \frac{\mathrm{d}\boldsymbol{r}_i}{\mathrm{d}t^{\prime}}(t^{\prime}) = -\nabla_i U(t^{\prime}) + f \tilde{\boldsymbol{p}}_i(t^{\prime})\\
\label{scaled-aoupp}
\frac{\mathrm{d}\tilde{\boldsymbol{p}}_i}{\mathrm{d}t^{\prime}}(t^{\prime}) = -\tilde{\boldsymbol{p}}_i(t^{\prime}) + \sqrt{2} \, \boldsymbol{\eta}^{\prime}_i(t^{\prime})\\
f = \sqrt{D D_r}
\end{eqnarray}
with $\boldsymbol{\eta}^{\prime}_i$ a zero-mean unit-variance Gaussian white noise in the scaled time variables ($\boldsymbol{\eta}^{\prime}_i = \sqrt{D_r^{-1}} \boldsymbol{\eta}_i$). In the $D_r^{-1} \to \infty$ limit, at constant $f = \sqrt{D D_r}$, the left hand side of Eq.~\ref{scaled-aoupr} vanishes and the particle configuration thus always satisfy
\begin{equation}
0 = -\nabla_i\left(U - f \sum_i \tilde{\boldsymbol{p}}_i\cdot\boldsymbol{r}_i\right) = -\nabla_i U_{\rm eff}
\label{Ueff-aoup}
\end{equation}
hence minimising an effective potential tilted by the active forces $U_{\rm eff}$.\\

With the initial distribution, corresponding to steady state,
\begin{equation}
P(\tilde{\boldsymbol{p}}_i(0)) = \frac{1}{2 \pi} \exp\left(-\frac{1}{2} |\tilde{\boldsymbol{p}}_i(0)|^2\right)
\end{equation}
propulsion dynamics (Eq.~\ref{scaled-aoupp}) is integrated first on a time step $\delta t^{\prime}$
\begin{equation}
\tilde{\boldsymbol{p}}_i(t^{\prime} + \delta t^{\prime}) = (1 - \delta t^{\prime}) \tilde{\boldsymbol{p}}_i^{\prime} + \sqrt{2 \delta t^{\prime}} \, \boldsymbol{\eta}^{\prime}_i
\end{equation}
where $\boldsymbol{\eta}^{\prime}_i = (\eta^{\prime}_{i, x}, \eta^{\prime}_{i, y})$ are two random numbers taken from a Gaussian distribution with zero-mean and unit-variance.\\

Position dynamics (Eq.~\ref{scaled-aoupr}) is then integrated with time step $\Delta t$ to minimise $U_{\rm eff}$ (Eq.~\ref{Ueff-aoup}), with the stopping conditions Eqs.~\ref{force-threshold},~\ref{time-threshold}
\begin{eqnarray}
\boldsymbol{r}_i(t + \Delta t) = \boldsymbol{r}_i(t) + \Delta t\left[-\nabla_i U(t) + f \tilde{\boldsymbol{p}}_i(t^{\prime} + \delta t^{\prime})\right]
\end{eqnarray}
where we have used Euler method, in analogy with Ref.~\cite{mandal2020study}, although a FIRE minimisation \cite{bitzek2006structural,guenole2020assessment} of $U_{\rm eff}$ may also be appropriate.\\

At high packing fraction $\phi$ and intermediate persitence time $D_r^{-1}$, we expect $|-\nabla_i U|^2 = \mathcal{O}(f^2)$ while $|\dot{\boldsymbol{r}}_i|^2 \ll f^2$, therefore Eq.~\ref{Ueff-aoup} also holds. ADD might thus also be suitable for this regime.

\section{Limits}

As we have introduced it, ADD relies on the separation of time scales between the propulsion dynamics and the relaxation to an effective potential energy minimum, hence making $\tau_p \to \infty$ a necessary but not sufficient condition for the procedure to work.\\

In particular, at low density (dilute limit) and intermediate density (\textit{e.g.}, such that MIPS may be observed), we do not expect the dynamics to be dominated by the minimisation of the effective potential.

\bibliography{ref}

\end{document}


%!TEX root = ../thesis.tex
%*******************************************************************************
%****************************** Third Chapter **********************************
%*******************************************************************************
\chapter{Internal Magnetic Fields}

\section{Solar Magnetic Field}\label{mag_intro}

It is well known through the observation of much surface solar phenomenon like active regions, solar flares, coronal mass ejections etc, that the sun has in its interior, often highly localised, significant magnetic fields. The source of this magnetic field is theorised to be a primordial current which started a dynamo process that is kept going at the expense of continuous dissipation of energy from the solar bulk. It is also widely believed however that mean magnetic field throughout the solar bulk is fairly weak. This chapter is devoted to finding a method to observe signature of this magnetic field in the p-mode frequency spectrum.

Most of high intensity magnetic activity is limited to the solar surface. The tachocline is believed to contain toroidal fields as high as $10^5 \text{G}$. outside the tachocline the magnetic field is believed to be mostly dipolar such that mean surface magnetic field is about $10\text{G}$. Very strong time varying local magnetic fields apart from these are also known to exist near the surface, but detection of such time dependent fields is outside the scope of this work; here we shall only investigate the effects of steady fields.

%cite for tachocline B field
%cite for fairly weak B field
%cite for core B field
%cite for dynamo
\section{Equation of Motion}

In the presence of background magnetic field $\Bv$, the equation of motion is governed by the new operator $\cL \rightarrow \cL + \dL^{B}$, where $\dL^B$ is estabished in \cite{hanasoge17} as below.
\begin{align}
    \dLB \boldsymbol{\xi} &= \frac{-1}{4\pi}\boldsymbol{\nabla \cdot} [\Bv\Bv\cdot \boldsymbol{\nabla} \boldsymbol{\xi} + \Bv {\cdot} \boldsymbol{\nabla}\boldsymbol{\xi}\Bv - 2 \Bv\Bv\boldsymbol{\nabla \cdot}\boldsymbol{\xi} - (\boldsymbol{\xi \cdot \nabla} \Bv)\Bv - \Bv(\boldsymbol{\xi \cdot \nabla}\Bv)\notag
    \\& + B^2 \boldsymbol{\nabla \cdot \xi I} - \Bv\Bv :\boldsymbol{\nabla \xi I} + \boldsymbol{\xi \cdot \nabla}\frac{B^2}{2}\boldsymbol{I}]
     \label{eqn:dLB}
\end{align}
where the $:$ stands for contraction of two second rank tensors ($\mathbf{P}:\mathbf{Q} \equiv P_{ij}Q_{ji} $).

Note that in above expression $\Bv$ only appears in the second order. \cite{goedbloed2004} contains a detailed derivation of this and a proof of self adjointedness for $\dL^B$.

This expression can be put in a more convenient form involving the Lorentz stress tensor $\cH \equiv \Bv\Bv$ as
\begin{equation} \label{eqn: mag_pert_H}
    \dLB \boldsymbol{\xi} = \frac{-1}{4\pi}\boldsymbol{\nabla\cdot} [\boldsymbol{\mathcal{H}\cdot\nabla \xi} + (\boldsymbol{\nabla \xi})^T \boldsymbol{\cdot \mathcal{H}} - 2\boldsymbol{\mathcal{H}\nabla \cdot \xi} - \boldsymbol{\xi \cdot \nabla \mathcal{H}} + \boldsymbol{\mathcal{H}:I \nabla \cdot \xi I} - \cH{:}\boldsymbol{\nabla \xi I} + \boldsymbol{\xi \cdot \nabla} \enc{\frac{\cH{:}\boldsymbol{I}}{2}}\boldsymbol{I}]
\end{equation}

\section{Coupling Matrix}
\subsection{Lorentz Stress components}\label{sec:lorentz_stress_comps}
The process of taking integrals over a sphere becomes simplified if we're operating in the Generalised Spherical Harmonics formalism. In this formalism (Appendix \ref{app_gsh}), magnetic field and Lorentz stress are decomposed as
$$\Bv = \sum_{st}\sum_{\alpha} B^{\alpha}_{st}(r) Y_{st}^{\alpha}(\theta,\phi) \ev{\alpha}$$
$$\cH = \sum_{st}\sum_{\mu\nu} h_{st}^{\mu\nu}(r) Y^{\mu+\nu}_{st}(\theta,\phi) \ev{\mu}\ev{\nu}$$
where the generalised spherical harmonic (GSH) coordinate indices given by Greek symbols run from $-1$ to $+1$.
Equation (\ref{eqn:h_B_relation}) relates the components of $\cH$ to $\Bv$. $\cH$ by construction satisfies the symmetry property $h^{\mu\nu}_{st} = h^{\nu\mu}_{st}$ ($\because \cH = \Bv\Bv$), and $\enc{h^{\mu\nu}_{st}}^* = (-1)^t h_{s\bar{t}}^{\bar{\mu}\bar{\nu}}$, where overbars represent negatives, follows from its realness condition.

\subsection{Sensitivity Kernels}\label{sec:mag_kern}
Coupling matrix element is given as on integral transform over $\cH$ as
\begin{equation}\label{lor_kernel_intro}
\LamB_{k'k} = \inner{\xiv_{k'}}{\dLB\xiv_{k}}=\int_0^{R_{\odot}} dr r^2 \sum_{\substack{st \\ \mu\nu}} \cB_{st}^{\mu\nu}(r) h_{st}^{\mu\nu}(r)
\end{equation}
where $\cB_{st}^{\mu\nu}$ are the eigenfunction dependent magnetic sensitivity kernels. Prescription for evaluating these kernels and the explicit expressions can be found in \cite{hanasoge17}. It should be noted however that the coupling integral $\inner{\xiv_{k'}}{\dLB\xiv_{k}}$ can be reduced to the radial integral form obtained in  (\ref{lor_kernel_intro}) contains no boundary terms. It is indeed the case that the magnetic field is assumed to vanish at the surface in this analysis. Relaxing this assumption will introduce boundary terms which involve integrals only over the solar surface.
Since $h_{st}^{\mu\nu}$ is symmetric in interchange of $\mu$ and $\nu$, we may ascribe the same symmetry to $\cB_{st}^{\mu\nu}$ too without any loss in generality.

Using the Mathematica package developed for this work \cite{GSH_repo} which automates manipulation of tensor spherical harmonics via the method of GSHs, the following forms of the kernels were found

\begin{dmath}\label{eq:kern_mm}
\cB_{st}^{--} = \frac{(-1)^{m'+1}}{r^2}\gam{l}\gam{l'}\gam{s}\wigred{-m'}{t}{m} \enccrl{\wigred{1}{-2}{1}\om{l}{0}\om{l'}{0} \encsqr{\enc{U+{\om{l'}{2}}^2 V}V' - UU'-rV\dot{V}'} +\wigred{2}{-2}{0} \om{l'}{0}\om{l'}{2}\encsqr{(U+r\dot{U})V'-rU\dot{V}'} +\wigred{0}{-2}{2} \om{l}{0}\om{l}{2}rV\dot{U}' + \wigred{3}{-2}{-1} \om{l}{0}\om{l'}{0}\om{l'}{2}\om{l'}{3}VV'}
\end{dmath}

\begin{dmath}\label{eq:kern_0m}
2\cB_{st}^{0-} = \frac{(-1)^{m'}}{r^2}\gam{l}\gam{l'}\gam{s}\wigred{-m'}{t}{m} \enccrl{\wigred{0}{-1}{1}\om{l}{0}\encsqr{\enc{2U+{\om{l'}{2}}^2 V}U' +{\om{l'}{0}}^2 \enc{-2UV'-VV'+rV\dot{V}'} -r\enc{U+V-r\dot{V}'}\dot{U}'} - \wigred{1}{-1}{0}\om{l'}{0}\encsqr{(-2U+{\om{l}{0}}^2V)U' + {\om{l}{0}}^2V\enc{r\dot{V}'-V'} + U\enc{2V' + r (\dot{U}' - 2\dot{V}' + r\ddot{V}')}}  +\wigred{-1}{-1}{2}\om{l}{0}\om{l'}{0}\om{l}{2}V\encsqr{U'-V'+r\dot{V}'} + \wigred{2}{-1}{-1}\om{l}{0} \om{l'}{0} \om{l'}{2}\encsqr{V\enc{U'-3V'+r\dot{V}'}+2r\dot{V}V'}}
\end{dmath}

\begin{dmath}\label{eq:kern_00}
\cB_{st}^{00} = \frac{(-1)^{m'}}{2r^2}\gam{l}\gam{l'}\gam{s}\wigred{-m'}{t}{m} \enc{1+p}\enccrl{\frac{1}{2}\wigred{0}{0}{0}\encsqr{ \enc{6U-4{\om{l}{0}}^2 V-2 r \dot{U}} \enc{U'-{\om{l'}{0}}^2V'} + 2{\om{l'}{0}}^2 rU\dot{V}' + r\enc{\enc{-4U+2{\om{l}{0}}^2V+r\dot{U}}}\dot{U}'+rU\ddot{U}' } -\wigred{-1}{0}{1}\om{l'}{0}\om{l}{0} \encsqr{V\enc{-4U'+2\enc{1+{\om{l'}{0}}^2} V'+r\enc{\dot{U}'-2\dot{V}'}} +2r\dot{V}\enc{U'-V'+r\dot{V}'}}
}
\end{dmath}

\begin{dmath}\label{eq:kern_pm}
2\cB_{st}^{+-} = \frac{(-1)^{m'}}{r^2}\gam{l}\gam{l'}\gam{s}\wigred{-m'}{t}{m}\enc{1+p} \enccrl{-2\wigred{-2}{0}{2}\om{l}{0}\om{l}{2} \om{l'}{0}\om{l'}{2} VV' + \wigred{-1}{0}{1}\om{l'}{0}\om{l}{0}\encsqr{-rV\dot{U}' + U \enc{U'-V'+r\dot{V}'}}
+\wigred{0}{0}{0}r^2\encsqr{U\ddot{U}'-\dot{U}\dot{U}'}
}
\end{dmath}
where $p \equiv (-1)^{l'+l+s}$, $U,V \equiv U_{nl},V_{nl}$, and $U',V' \equiv U_{n'l'},V_{n'l'}$.
\clearpage
Kernel components $\cB_{st}^{\mu\nu}$ are found to have these following properties:
\begin{enumerate}
\item $\cB_{st}^{\mu\nu} = \cB_{st}^{\nu\mu}$ (by construction)
\item $\cB_{st}^{--} = (-1)^{l+l'+s}\cB_{st}^{++}$
\item $\cB_{st}^{0-} = (-1)^{l+l'+s}\cB_{st}^{+0}$
\item $\cB_{st}^{00} = \cB_{st}^{+-}=\cB_{st}^{-+}=0$ for odd $\enc{l'+l+s}$
\end{enumerate}

\begin{figure}[t]
\includegraphics[scale=0.55,center]{Chapter3/figs/kern_self.eps}
\caption{Self coupling Kernels for the modes $\mode{4}{3}$, $\mode{1}{10}$, and $\mode{0}{20}$.}
\label{fig:kern_plot}
\end{figure}

Figure (\ref{fig:kern_plot}) shows the four independent components of the sensitivity kernel under self coupling for some modes. It is clear from the plots that for all modes, sensitivity is mostly localised to the solar boundary. This effect is most striking for $\cB^{+-}_{st}$ across modes. This is a an indirect consequence of the background density profile of the sun which falls almost exponentially fast with respect to radius towards the outer regions of the sun. The low density near the boundary makes the eigenfunction peak distinctly near the boundary. However, as can be seen in equations (\ref{eq:kern_mm}) - (\ref{eq:kern_pm}), the kernels depend quadratically on $U$ and $V$, which finally makes them peak at the boundary. This implies that most of the magnetic splitting caused is due to the fields near the surface and acts as limitation to imaging the interior magnetic field precisely via an inversion of frequency splitting data.

We can see that how it is ultimately the components of $\cH$ that couple with the sensitivity kernel; components of $\Bv$ cannot be related to frequency splittings in a straightforward manner like equation (\ref{lor_kernel_intro}). Hence, any procedure inverting splitting data will first determine the $\cH$ components. It remains unclear if the magnetic field can be recovered from just the knowledge of components of $\cH$.

\section{Synthetic Magnetic Field}
Using some basic pieces of information about mean solar magnetic field as given in \ref{mag_intro}, we can posit the following form of a synthetic magnetic field which will be used for validating our routine of finding frequency splits. We give the following form of the magnetic field which is comoposed of an internal toroidal field concentrated at the core and the tachocline, and a dipolar field which extends from the tachocline to the surface.

\subsection{Construction of $\Bv$}\label{sec:B_construction}
Using the identities $\grad_1 Y_l^m = \om{l}{0} \enc{Y_{lm}^{-1} \ev{-} + Y_{lm}^{1} \ev{+}}$, $\ev{r} \times\grad_1 Y_l^m = i\om{l}{0} \enc{Y_{lm}^{-1} \ev{-} - Y_{lm}^{1} \ev{+}}$, and $Y_1^0(\theta,\phi) = \gam{1}\cos\theta$ we see following things: (1) A toroidal field $\Bv = \alpha(r) \sin\theta \ev{\phi}$ can be given as $B_{10} = i \alpha(r) / \gam{1} \enc{-1,0,1}$ with all other $B_{st}$ components being $0$, and (2) A dipolar field $\Bv = \beta(r) (2\cos\theta \ev{r} + \sin\theta\ev{\theta})$ with $\beta \propto r^{-3}$ can be given as $B_{10} = -\beta(r)/\gam{1} \enc{1,-2,1}$ with all other $B_{st}$ components being $0$. Note that the row vector refers to the GSH coordinate index $\mu$. This leads to the following final form of $\Bv$

\begin{equation}\label{mag_field}
B_{st}(r) =
\begin{cases}
-i \frac{\alpha(r)}{\gam{1}} \gshvec{1}{0}{-1}  - \frac{\beta(r)}{\gam{1}} \gshvec{b-r\dot{b}}{-2b}{b-r\dot{b}}, & \text{for} (s,t) = (1,0) \\
0, & \text{for} (s,t) \neq (1,0)
\end{cases}
\end{equation}
where $b(r)=1$ where field is perfectly dipolar. The term $r\dot{b}(r)$ appear as a consequence of fixing the diveregence to zero and is only nonzero in the transition region where $b(r)$ goes from $0$ to $1$. It was can be checked via using $\grad \cdot \Bv = g_{\alpha\beta} (\grad\Bv)^{\alpha\beta}$ (\cite{GSH_repo} was used) that the two parts in (\ref{mag_field}) (toroidal and dipolar) satisfy the solenoidal condition independently. We plot the forms of the $\alpha$, $\beta$, and $b$ used in our frequency splitting calculations.

\begin{figure}[t]
\begin{subfigure}{0.5\linewidth}
\centering
\includegraphics[scale=.5]{Chapter3/figs/alpha_beta}
\caption{$\alpha(r)$ and $b(r) \beta(r)$ in $G$}
\label{fig:alpha_beta}
\end{subfigure}
\begin{subfigure}{0.5\linewidth}
\centering
\includegraphics[scale=0.5,center]{Chapter3/figs/b}
\caption{$b(r)$ and $a(r) = b(r)-r\dot{b}(r)$}
\label{fig:a_b}
\end{subfigure}
\caption{$\alpha(r)$ is addition of two Gaussians centred at $r=0$ with peak $10^7 G$ and at $r=0.7R_{\odot}$ with peak $10^5 G$ respectively. $b$ transitions smoothly from $0$ to $1$ as a sigmoid around $r=0.7R_{\odot}$. $r=0.7R_{\odot}$ mark is roughly where the tachocline is placed. Figure (\ref{fig:alpha_beta}) shows the poloidal (dipolar) field $\beta$ starting to dominate over the toroidal field by atleast three orders of magnitude as $r$ exceeds $\sim 0.8 R_{\odot}$.}
\end{figure}

\subsection{Construction of $\mathcal{H}$}

After the form of $\Bv$ has been ascertained, it is straighforward to derive components of $\cH$ via taking a tensor product. Decomposing either field in their GSH forms as in \ref{sec:lorentz_stress_comps}, and using orthonormality relation
\begin{equation}
\int d\Omega \enc{Y_{l_1m_1}^{n_1}}^*Y_{l_2m_2}^{n_2} = \delta_{l_1l_2}\delta_{m_1m_2}\delta_{N_1N_2}
\end{equation}

and the triple integral result

\begin{equation}\label{eq:triple_integral}
\int d\Omega \enc{Y_{l_1m_1}^{N_1}}^*Y_{l_2m_2}^{N_2}  Y_{l_3m_3}^{N_3}= (-1)^{m_1+N_1}4\pi \gam{l_1}\gam{l_2}\gam{l_3} \wigfull{l_1}{l_2}{l_3}{-m_1}{m_2}{m_3} \wigfull{l_1}{l_2}{l_3}{-N_1}{N_2}{N_3}
\end{equation}

one can write
\begin{equation}
h^{\mu\nu}_{st} = \sum_{\substack{s_1t_1\\ s_2t_2}} \langle Y_{st}^{\mu+\nu}, Y_{s_1 t_1}^{\mu}  Y_{s_2 t_2}^{\nu}\rangle B_{s_1t_1}^{\mu} B_{s_2t_2}^{\nu}
\label{eqn:h_B_relation}
\end{equation}
Where $\langle Y_{l_1m_1}^{n_1}, Y_{l_2m_2}^{N_2}  Y_{l_3m_3}^{N_3}\rangle$ stands for the integral in equation (\ref{eq:triple_integral}).
If $\Bv$ has only $s=s_0$ and $t=t_0$ features, that is $\Bv = \sum_{\alpha}B_{s_0t_0}^{\alpha}Y_{s_0t_0}^{\alpha} \ev{\alpha}$, components of $\cH$ are given by
\begin{equation}\label{eq:single_feature_B}
h_{st}^{\mu\nu} = B^{\mu}_{s_0 t_0}B^{\nu}_{s_0 t_0} (-1)^{\mu + \nu + t} (2s_0+1) \gam{s} \wigfull{s_0}{s}{s_0}{\mu}{-(\mu+\nu)}{\nu} \wigfull{s_0}{s}{s_0}{t_0}{-t}{t_0}
\end{equation}

For the axis symmetric magnetic field constructed in \ref{sec:B_construction}, we may set $s_0=1$ and $t_0=0$. Wigner 3j selection rules given in \ref{sec:selec_rules} dicate that $\cH$ can only have $s=0,1,2$ and $t=0$. Then we have the form

\begin{equation}
h_{s0}^{\mu\nu} = 3 \gam{s} B^{\mu}_{10}B^{\nu}_{10} (-1)^{\mu + \nu} \wigfull{1}{s}{1}{\mu}{-(\mu+\nu)}{\nu} \wigfull{1}{s}{1}{0}{0}{0}
\end{equation}

But we know that $\wigfull{1}{s}{1}{0}{0}{0}$ vanishes for odd s. Thus we note here that $\cH$ has no $s=1$ and has non-zero $s=0$ components, which is different from how differential rotation couples modes. The $s=0$ feature of the Lorentz stress tensor indicates a net shift from the unperturbed mode frequency $\omega_{{nl}}$ for a particular multiplet $\mode{n}{l}$ as this term couples with $\wigfull{l'}{0}{l}{-m}{0}{m}$ which is independent of $m$.