\documentclass[landscape]{article}

\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{hyperref}

\title{Statistic Formulas}
\author{RobinXSI}
\date{Juli 2015}
\begin{document}
   \maketitle
   	\section{Introduction}

   		Wichtig beim aufstellen von Hypothesen ist, dass die Auswertung eine statistische Signifikanz haben.

   		Statistical significance means:
		\begin{itemize}
			\item rected the null hypothesis
			\item results are not likely due to chance (sampling error)
		\end{itemize}

		Als Endresultat der Statistik sollten folgendes Dokument erstellt werden können:
		\begin{itemize}
			\item Desciriptive Statistics
				\begin{itemize}
					\item M - Mean
					\item Sd - Standard Deviation
				\end{itemize}
			\item Inferential Statistics
				\begin{itemize}
					\item Hypothesis Test \(\alpha\)
					\begin{itemize}
						\item kind of test, bsp: one-sample t-test
						\item test statistic, bsp: t-value
						\item df - degrees of freedom
						\item p-value
						\item direction of test, bsp: one-tail-test or two-tail-test
					\end{itemize}
					\item APA style
						  \\\(t(df) = X.XX, p = X.XX,\) direction
						  \\bsp: \(t(24) = -2.50, p < .05,\) one-tailed
					\item Confidence intervals
					\begin{itemize}
						\item Confidence leve, bsp: 95\%
						\item Lower Limit
						\item Upper Limit
						\item CI on what?
					\end{itemize}
					\item APA style - CIs
						  \\Confidence interval on the mean difference;
						  \\95\% CI = (4 to 6)
					\item Effect size measures
						\begin{itemize}
							\item \(d\)
							\item \(r^2\)
						\end{itemize}
					\item APA style - CIs
						  \\\(d = X.XX\)
						  \\\(r^2 = .XX\)

				\end{itemize}
		\end{itemize}

	\section{Statistical Formulas}
		\pgfmathdeclarefunction{gauss}{2}{%
		  \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
		}

		\begin{tikzpicture}
			\begin{axis}[
			  no markers, domain=0:10, samples=100,
			  axis lines*=left, xlabel=$x$, ylabel=$y$,
			  every axis y label/.style={at=(current axis.above origin),anchor=south},
			  every axis x label/.style={at=(current axis.right of origin),anchor=west},
			  height=5cm, width=15cm,
			  xtick={4}, ytick=\empty,
			  enlargelimits=false, clip=false, axis on top,
			  grid = major
			  ]
			  \addplot [fill=cyan!20, draw=none, domain=0:2.4] {gauss(4,1)} \closedcycle;
			  \addplot [fill=cyan!20, draw=none, domain=5.6:10] {gauss(4,1)} \closedcycle;
			  \addplot [very thick,cyan!50!black] {gauss(4,1)};

			\draw [yshift=-0.6cm, latex-latex](axis cs:4,0) -- node [fill=white] {$1.96\sigma$} (axis cs:5.6,0);
			\end{axis}

		\end{tikzpicture}

		\subsection{Empirical Mean}
		\(\gamma = \frac{\sum{x}}{N}\)

		Properties (for independent random variables X and Y):
		\begin{enumerate}
			\item \(Mean(X + Y) = Mean(X) + Mean(Y)\)
			\item \(Mean(X \times Y) = Mean(X) \times Mean(Y)\)
		\end{enumerate}

		\subsection{Variance}
		\(\sigma^2 = Var(X)\newline
			\sigma^2 = \frac{\sum{(x_i - \gamma)^2}}{N}\newline
			\sigma^2 = \frac{\sum{X_i^2}}{N} - \frac{(\sum{X_i})^2}{N^2}\newline
			\sigma^2 = \frac{\sum{(x_i - \gamma)^2}}{N}\)\newline

		\subsection{Standard Deviation}
		\(\sigma = \sqrt{Var(X)}\newline
			\sigma = \sqrt{\frac{\sum{(X_i - \gamma)^2}}{N}}\)\newline

		\subsection{Standard Error}
		\(Sd = \frac{\sigma}{N}\)

		\subsection{Z-Score}
		Z-Score \(= \frac{x - \bar{x}}{Sd}\)

		\subsection{Standard Normal Distribution}
		\(\frac{1}{\sqrt{2 \cdot \pi \cdot \sigma^2}} \cdot e^{[-\frac{1}{2} \cdot \frac{(x-\gamma)^2}{\sigma^2}]}\)

		\subsection{Confidence Interval}
		\(CI = 1.96 \cdot \sqrt{\frac{p(1 - p)}{N}}\newline
			General Form:\newline
			Size of CI = a \cdot \sqrt{\frac{\sigma^2}{N}}\newline
			\frac{\sum{X_i \pm a \cdot \sqrt{\frac{\sigma^2}{N}}}}{N}\)

			\textbf{Note}

			\begin{enumerate}
			\item $a = 1.96 for N \geq 30$
			\item $a$ is the t-value computed for $(N - 1)$ degrees of freedom and confidence level $p$.
			\end{enumerate}

		\subsection{Additional Formulas}
		\begin{tabular}{lllll}
			\hline
			Name & Population Symbol & Sample Symbol & Sample Calculation & Beschreibung \\ \hline
			Mean &  & $\bar{x}$ & $\bar{x} = \frac{\sum{x}}{N}$ & Durchschnitt aller Daten \\
			Variance & $\sigma_x^2$ & $s_x^2$ & $s_x^2 = \frac{\sum{(x - \bar{x})^2}}{N - 1}$ & Abweichung \\
			Standard Dev & $\sigma_x$ & $s_x$ & $s_x = \sqrt{s_x^2}$ &  \\
			Covariance & $\sigma_xy$ & $s_xy$ & $s_xy = \frac{\sum{(x - \bar{x})(y - \bar{y})}}{N - 1}$ &  \\
			Correlation & $\rho_xy$ & $r_xy$ & \begin{tabular}[c]{@{}l@{}}$r_xy = \frac{s_xy}{s_x s_y}$\\ $r_xy = \frac{\sum{(z_x z_y)}}{N - 1}$\end{tabular} &  \\ \hline
			z-score & $z_x$ & $z_x$ & $z_x = \frac{x-\bar{x}}{s_x}; \bar{z} = 0; s_x^2 = 1$ &  \\ \hline
		\end{tabular}

	\subsection{T-Test}
		\[
		t = \frac{\bar{x_D} - 0}{s_D / \sqrt{n}}
		\]

	\section{Lesson 10 - Dependent samples}

		Dependent samples (repeated measures)
		\begin{itemize}
			\item Two Conditions
			\item Longitudinal
			\item Pre-Test, Post-Test
		\end{itemize}

		\subsection{Important formulas}
			\(x = [ARRAY of VALUES] \Rightarrow\) Population Data
			\(X = [ARRAY of VALUES] \Rightarrow\) Sample Data
			\\\(n \Rightarrow\) Sample und Population Size
			\\\(\mu = \frac{\sum{x_i}}{n}\Rightarrow\) Population Mean
			\\\(\bar{X} = \frac{\sum{X_i}}{n} \Rightarrow\) Sample Mean
			\\\(s_D = \sqrt{\frac{\sum{(X_i - \mu)^2}}{n}} \Rightarrow\) Standard Deviation for sample
			\\\(\alpha \Rightarrow\) tail probability on t-table
			\\\(t_{critical} \Rightarrow\) from \href{https://s3.amazonaws.com/udacity-hosted-downloads/t-table.jpg}{t-table}
			\\\(df = n - 1 \Rightarrow\) Degrees of Freedom
			\\\(SEM = \frac{s_D}{\sqrt{n}} \Rightarrow\) Standard Error of the Mean
			\\\(t = \frac{\bar{X} - \mu}{SEM} \Rightarrow\) One Sample t-Test
			\\margin of error \(= (t^{critical} \times SEM)\)
			\\\(CI = \bar{X} \pm \) margin of error \(\Rightarrow\) Confidence Interval
			\\\(d = \frac{\bar{X}-\mu}{s_D} \Rightarrow\) Cohen's d \(\Rightarrow\) Standardized mean difference
			\\\(r^2 = \frac{t^2}{t^2 + df} \Rightarrow\) bestimmt die Stärke des Zusammenhangs zwischen zwei Variablen als Proportion. Beispiel: \(r^2 gibt\) an wieviel das Geschlecht einer Person zum Unterschied der beiden Samples beigetragen hat

		\subsection{Hypothese}
			``US families spent an average of \$151 per week on food''
			\\Beispiel Null Hypothese: ``the program did not change the cost of food''
			\\Beispiel Alternative Hypothese: ``the program reduced the cost of food''
			\\
			\\\(null \rightarrow H_0:\mu_program >= 151\)
			\\\(alt \rightarrow H_A:\mu_program < 151\)

	\section{Lesson 11 - Independent Samples}
		Voneinander abhängige Daten brauchen nicht so viele Testkandidaten, ist kosteneffektiv und weniger zeitaufwendig. Diese Art an Daten zu kommen hat aber auch Nachteile. Beispielsweise könnten die Probanden beim zweiten Ausfüllen eines Tests die Antworten schon kennen.

		Aus diesem Grund braucht es Independent Samples, also je einen Teil des Samples, der das Treatment gemacht hat und einen anderen Teil der es nicht gemacht hat.
		\\\(s_1 \sqrt{\frac{\sum{(X_i1 - \mu)^2}}{n - 1}} \Rightarrow\) Standard Deviation for sample with
		 \href{Bessel\'s correction}{http://www.wikiwand.com/en/Bessel\%27s\_correction}
		\\\(s_2 \sqrt{\frac{\sum{(X_i2 - \mu)^2}}{n - 1}} \Rightarrow\) Standard Deviation for sample with \href{Bessel\'s correction}{http://www.wikiwand.com/en/Bessel\%27s\_correction}
		\\\(n_1 \Rightarrow\) Size of Sample 1
		\\\(n_2 \Rightarrow\) Size of Sample 2
		\\\(S_D = \sqrt{s_1^2 + s_2^2}\) Standard Deviation for Samples
		\\\(SEM = \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}} \Rightarrow\) Standard Error for independent samples
		\\\(df = n_1 + n_2 - 2 \Rightarrow\) Degrees of freedom for independent samples
		\\\(t = \frac{\bar{X}_1 - \bar{X}_2}{SEM} \Rightarrow\) Two Sample t-Test
		\\\(CI = (\bar{X}_1 - \bar{X}_2) \pm \) margin of error \(\Rightarrow\) Confidence Interval
		\\\(SS_x = \sum{(x_i - \bar{x})^2} \Rightarrow\) Sum of Squared Deviations
		\\\(S_p^2 = \frac{SS_1 + SS_2}{df_1 + df_2} \Rightarrow\) Pooled variance
		\\\(SEM_{CORRECTED} (S_{\bar{x_1} - \bar{x_2}}) = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_2}} \Rightarrow\) Corrected Standard Error
		\\\(t_{CORRECTED} = \frac{\bar{x_1} - \bar{x_2}}{S_{\bar{x_1}-\bar{x_2}}} \Rightarrow\) t-Statistic Corrected

	\section{Lesson 12 - ANOVA (Analysis of Variance)}
		ANOVA for samples with the same size
		\\\(N \Rightarrow\) number of values from all samples
		\\\(k \Rightarrow\) number of samples
		\\\(\bar{x}_G = \frac{\sum{\bar{x}_i}}{N}\Rightarrow\) Grand Mean
		\\\(df = N - k \Rightarrow\) degrees of freedom
		\\\(df_1 = k - 1)\)
		\\\(df_2 = N - k)\)
		\\\(df_{total} = N - 1 \Rightarrow\) total degrees of freedom
		\\\(F = \frac{n * \sum{(\bar{x}_K - \bar{x}_G)^2 / df_1}}{\sum{(x_i - \bar{x}_k)^2 / df_2}} \Rightarrow\) between-group variability / within-group variability. \href{http://www.socr.ucla.edu/applets.dir/f\_table.html}{F-Table}

\end{document}


%!TEX root = Tibt.tex

\chapter*{Notation}
\addcontentsline{toc}{chapter}{Notation}
\markboth{Notation}{Notation}

\begin{itemize}
    \item Data vectors/matrices are denoted with boldface letters, e.g.
      $\mathbf{X}$, $\bm{\epsilon}$, while single variable values or
      abstract random variables are denoted with standard letters,
      e.g. $X$, $\epsilon$.
    \item In case of vector or tensor-valued
      random variables, the sample dimension is always assumed to come first.
      For example, the matrix $\mathbf{X}$ containing $N$ samples of a
      vector variable of dimension $p$ has shape $(N, p)$.
     \item $e_p$ is the vector of ones of size $p$.
\end{itemize}


\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{ulem}
\usepackage{url}
\usepackage{graphicx}
 \usepackage{geometry}
\geometry{margin=1.0in}

\usepackage{lmodern}

\makeatletter

\makeatother

\usepackage{etoolbox}

%%%%%%%%% STUDENTS CHANGE THIS

\providetoggle{undergrad}
\settoggle{undergrad}{false}     %%% "true" if 3395 or "false" if 6390

\providetoggle{final}
\settoggle{final}{false}        %%% "true" for your final homework submission (removes instructions)

%%%%%%%%%%%%%%%%%%%%% ^^^^^
\usepackage[colorlinks=true]{hyperref}

\begin{document}

\setlength{\parskip}{0.3cm} \setlength{\parindent}{0cm}

\begin{center}
\textbf{{IFT 6390 Fundamentals of Machine Learning \\ Vijaya lakshmi Kuruba\\ Saadaoui Houda}}
\par\end{center}{\large \par}

\begin{center}
\textbf{\LARGE{{Model Card - SVM Linear Classifier}}}
\par\end{center}{\LARGE \par}

Our model is a supervised learning which consists of classifying gender using tweets and users profile description.
Since it is a supervised learning task we used a dataset consisting of tweets labeled with the gender “male” or “female”.

The dataset used has 20,000 samples and has many features but to build our model we chose only two features: tweets and description.

Before building our model, we first cleaned the data using the following steps:
\begin{itemize}
    \item Choosing only the gender "female" and "male" (the data has also unknown and brand as genders)
    \item Preprocessing the data using the Preprocessor library
\end{itemize}

After filetring and preprocessing the dataset, we ended up with 12,895 samples which we split into training and testing with 80\% and 20\% respectively of the dataset.  \\
We chose to use the linear classifier Support Vector Machine SVM to make the classification task.

Model parameter is validated with K fold cross validation and classifier metrics has been reported.

\paragraph{SVM Linear Classifier}:

$$\includegraphics[scale=.5]{svm.JPG}$$

We consider labeled data $(\mathbf{x},y)$, where $\mathbf{x}$ is a $d$-dimensional input, i.e. $\mathbf{x} \in \mathbb{R}^{d}$ and $y\in\{-1,1\}$. We have a dataset of $n$ such pairs $(\mathbf{x}_i,y_i)$. We want to train a linear classifier on this dataset. \\

\textbf{Linear Model:}
\begin{equation}
 f(x) = \mathbf{w}^T \mathbf{x} + b
\end{equation}
On Hyper plane :
\begin{equation}
f(x) =\mathbf{w}^T \mathbf{x} + b=0
\end{equation}
Constraints are:
\begin{equation}
 \mathbf{w}^T \mathbf{x_i} + b\geq 1 \quad \text{if} \quad y_i=1
 \end{equation}
\begin{equation}
 \mathbf{w}^T \mathbf{x_i} + b\leq -1 \quad \text{if} \quad y_i=-1
\end{equation}

In general
\begin{equation}
    y_i(\mathbf{w}^T \mathbf{x_i} + b)\geq 1 \quad \forall \quad i \in 1...N
\end{equation}

To simplify code and notation, we can get rid of the bias term $b$. To do  so, we concatenate $1$ to every $\mathbf{x}$ vector, so that $\mathbf{x}' = (\mathbf{x}, 1) \in \mathbb{R}^{d+1}$, and we concatenate $b$ to $\mathbf{w}$, so that $\mathbf{w}' = (\mathbf{w}, b)$. Then $\mathbf{w}^T \mathbf{x} + b = \mathbf{w}'^T \mathbf{x}'$. We can write everything in terms of linear transformations instead of affine transformations.

We will omit the bias term from now on, and consider $\mathbf{x}$ and $\mathbf{w}$ themselves as $\mathbf{x}'$ and $\mathbf{w}'$

New notation:
\begin{align}
    y_i(\mathbf{w}^T \mathbf{x_i} )\geq 1 \quad \forall \quad i \in 1...N
\end{align}

\textbf{Loss Function :} \\
\\The hinge loss is used for "maximum-margin" classification.\\
Loss function is given by:

\begin{equation}
 g(w;\mathbf{x}, y) =
\begin{cases}
0 \quad \quad \quad \quad\quad \text{if}\quad 1-yf(x) \geq 1 \\ 1-yf(x) \quad\text{otherwise.}
\end{cases}
\end{equation}

\textbf{Objective Function:}\\
 \\The loss function stated above is called convex surrogate losses. They are convex and have a gradient so we can optimize them with gradient descent.\\

The training objective that we are going to minimize is the average of the losses over each training example plus an $\ell^2$ regularization with hyperparameter $\lambda$:
\begin{align}
 L(w) = \frac{1}{n}\sum_{i=1}^n g(w;\mathbf{x_i}, y_i)  + \frac{\lambda}{2} \| \mathbf{w}\|^2
\end{align}

Note:  Minimising w allows to maximize the margen

where the parameter $\lambda$  determines the trade-off between increasing the margin size and ensuring that the $\mathbf {x} _{i}$ lie on the correct side of the margin. Thus, for sufficiently small values of $\lambda$ , the second term in the loss function will become negligible, hence, it will behave similar to the hard-margin SVM, if the input data are linearly classifiable, but will still learn if a classification rule is viable or not.

\textbf{Gradient Desecent:}

SVM classifier amounts to minimizing the loss funtion Equation 8 with Gradient descent technique.
We want to minimize the loss $L(w)$. It is differentiable, so we can use the gradient descent algorithm: start from any initialization parameter $\mathbf{w}_0$, and repeat for $t\in\{0, \dots, t_{\max} \}$:
$$\mathbf{w}_{t+1} = \mathbf{w}_t - \eta\ \nabla L (\mathbf{w}_t) \; .$$

Under some conditions on the step-size $\eta$ and the loss $L$, this algorithm is guaranteed to converge to a minimum of $L(w)$.

$$\nabla L (\mathbf{w}_t)
=
\begin{cases}
\lambda \| \mathbf{w}\| \quad \quad \quad \quad\quad \text{if}\quad 1-yf(x) \geq 1 \\ \lambda \| \mathbf{w}\|-y_ix_i \quad\text{otherwise.}
\end{cases}
$$

To choose the $\lambda $ parameter, we used a Randomized Search to get the best value among the following list [1e-4, 1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3]. The obtained value of $\lambda $ is 0.001

\paragraph{K fold Crossvalidation}:

To evaluate the performance of a model on a dataset, we need to measure how well the predictions made by the model match the observed data.
When data is scarce, we may not be able to afford using a validation set, So we use K fold crossvalidation technique.\\
Approach : split the dataset into K equal partitions.
\begin{itemize}
    \item 1. Set one partition aside for prediction/validation, and train the model on the remaining K-1 partitions.\\
   \item 2. Repeat the above step for each partition and report the average prediction error.

\end{itemize}

In pratice: common to pick 5-fold or 10-fold cross-validation.

Mathematically:
$$
        CV({\hat{f}}) = \frac{1}{N} \sum_{i=1}^{N} L(y_{i}, {\hat{f}}^{(\kappa(i))}(x_{i})) \enspace $$
where $\hat{f}(k)$ denotes the model obtained by removing the k-th partition and training on the
rest. Furthermore, k(i) is a function which, given a datapoint index, returns the partition to
which it belongs. If the i-th datapoint belongs to the j-th partion, then we want the model
$f^{(j)}$
, where the j-th partition has been excluded.

For our model, after cleaning and filtering the data we used K-Folds Cross Validation technique using k = 5 to validate it.

\paragraph{Classifier Accuracy }:
\begin{align*}
    Accuracy (y, {\hat{y}})= \frac{1}{N} \sum_{i=1}^{N} {1}_{{\hat{y_{i}}} = y}
\end{align*}
where ${1} (x)$  is the indicator function.

\paragraph{Time Complexity}:

N= Number of training examples\\
k=k is the number of iterations (epochs)\\
d=Dimensions of the features

Time complexity for training is : O(Nkd)

Time complexity for testing is : O(Nd)

\paragraph{Space Complexity}:

N= Number of training examples\\
d=Dimensions of the features

Space complexity for training is : O(Nd)

Space complexity for testing is : O(Nd)
\end{document}


\section{Nomenclature}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Nomenclature}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

$W \equiv$ system width

$L \equiv$ system length

$y \equiv$ perpendicular position, varies between $0$ and $W$

$z \equiv$ parallel position, varies between $0$ and $L$

$\ell_{tmfp} \equiv$ transport mean free path

$k \equiv$ total wave number

$k_{\parallel} \equiv$ wave number parallel to wave propagation direction (along $z$), see Eq.~\ref{eq:k_parallel}

$k_{\bot} \equiv$ wave number perpendicular to wave propagation direction (along $y$), see Eq.~\ref{eq:k_perpendicular}

$\kappa \equiv$ imaginary total wave number, is similarly broken into parallel and perpendicular components

$n \equiv$ channel index, varies from $1$ to $\infty$

$N_o \equiv$ number of open channels, also known as $N_{open}$

$N_{max} \equiv$ number of open and closed channels (finite)

$\omega \equiv$ frequency

$E \equiv$ electric field

${\cal H} \equiv$ magnetic field

${\cal E} \equiv$ energy

$E^+ \equiv$ plane wave electric field propagating from left to right

$E^- \equiv$ plane wave electric field propagating from right to left

$E' \equiv$ first order electric field derivative wrt space

$\alpha \equiv$ scatterer strength (unitless)

$\Delta \equiv$ a small change in the variable

$c \equiv$ speed of light

$\mu_0 \equiv$ vacuum permeability

$\epsilon_0 \equiv$ vacuum permittivity


\subsection{Introduction}

ensemble confidence intervals
non-parametric confidence intervals
semi-parametric confidence intervals

one-sided, 2 sided confidence intervals

jackknife for bagging confidence interval


\documentclass[12pt]{report}
\usepackage{amsmath,textcomp,amssymb}
\usepackage{geometry}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{float}
\usepackage{expdlist}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{multicol}

\def\Title{BLOM Quick Start Guide}
\def\Name{MPC Lab}
\def\contacts{Jason Kong: \url{jasonjkong@berkeley.edu}\\ Tony Kelman: \url{kelman@berkeley.edu} \\ Kyle Chiang: \url{kylechiang@berkeley.edu}}
\title{\Title}
\author{\Name \\ \contacts}
\date{Last updated: \today}
\markboth{\Title}{\Title}
\pagestyle{myheadings}
\setlength\parindent{0pt}
\setlength{\parskip}{12pt}
\footskip = 0pt
\textheight = 670pt

\newenvironment{itemize*}
  {\begin{itemize}
    \setlength{\itemsep}{1pt}
    \setlength{\parskip}{1pt}}
  {\end{itemize}}

\newcommand{\textbu}[1]{\textbf{\underline{#1}}}
\newcommand{\red}[1]{\textcolor{red}{#1}}

\begin{document}
\maketitle
\tableofcontents
\setcounter{secnumdepth}{0}

\clearpage \section{What is BLOM?}
\begin{itemize}
\item Provides a graphical interface to allow users to create optimization problems using Simulink blocks.
\item Exports mathematical model to solvers (eg. ipopt)
\item Great for optimization problems with "dynamics" that evolve over time
$$\min_x f(x)$$
$$g(x) \leq 0$$
$$h(x) = 0$$
\vspace{-50pt}
\end{itemize}•

\section{BLOM Library}
\begin{figure}[H]
\center
\includegraphics[width=100mm]{figures/BLOM_Lib.png}
\vspace{-40pt}
\end{figure}•

\textbu{Externals:} Labels External Variables that can be changed via script or command line for different calls of the solver \\[10pt]
\textbu{Inputs:} Labels Input Variables to be optimized by solver \\[10pt]
\textbu{Bounds:} Sets upper/lower bounds on a variable\\[10pt]
\textbu{Cost:} Cost variable to be minimized.  \\[10pt]
\textbu{Polyblocks:} BLOM's convenient way to create nonlinear functions\\[10pt]

\section{Polyblocks}
BLOM's internal representation of blocks.

$$ y_1=2x^2_1x_2 , \hspace{3mm} y_2=3x_1+x_2^4 $$
\[
P = \begin{bmatrix}
2 & 1 \\
1 & 0 \\
0 & 4
\end{bmatrix}
\hspace{3mm}
K = \begin{bmatrix}
2 & 0 & 0\\
0 & 3 & 1
\end{bmatrix}
\]

$$y_1 = 2x_1+3sin(x_2),  \hspace{3mm} y_2 = 3x_1^2e^{x_3}+0.2tan(x_2)x_4^3$$
\[P= \begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & \text{BLOM\_FunctionCode(`sin')} & 0 & 0\\
2 & 0 & \text{BLOM\_FunctionCode(`exp')} & 0 \\
0 & \text{BLOM\_FunctionCode(`tan')} & 0 & 3
\end{bmatrix}
\]
\section{Setting Up BLOM on Your Computer}
\begin{enumerate}
\item \url{http://mpclab.net/Trac/wiki/SVNsetup} Here are instructions on how to get SVN and how to get BLOM running
\item in command line, \texttt{svn checkout http://www.mpclab.net/BLOM/ \red{desired\_directory}}
\item Each time you open up BLOM, make sure to get the latest version by typing \texttt{svn update} within that folder (or update through TortoiseSVN)
\item On Mac or Linux machines, you may need to compile IPOPT and then run \texttt{BLOM\_Setup} (Instructions for doing so at \url{http://mpclab.net/Trac/wiki/CompilingIpopt})

\end{enumerate}•

\clearpage
\section{Creating Model Example}
\vspace{-20pt}$$\max  f(x)=3x_1+x_2-x_3^2+2x_3$$
$$x_1^2+x_2^2\leq5$$
$$x_1-x_2\leq1$$
$$x_3\geq0$$

\begin{figure}[H]
\textbu{Step 1:} Place Input and External Blocks for input and external variables
\center
\includegraphics[width=120mm]{figures/Example_Step1.png}
\end{figure}
\begin{figure}[H]
\textbu{Step 2:} For each bound limitation and cost function, drag and drop math blocks to satisfy equations.  Use subsystems and/or polyblocks as needed
\center
\includegraphics[width=50mm]{figures/Example_Step2_1_subsys.png}
\includegraphics[width=120mm]{figures/Example_Step2_1.png}
\end{figure}
\begin{figure}[H]
\textbu{Step 3:} Attach bound and cost blocks and set limits/time relevances
\center
\includegraphics[width=120mm]{figures/Example_Step3_1.png}
\includegraphics[width=60mm]{figures/Example_Step3_1_bound.png}
\end{figure}
\begin{figure}[H]
Repeat steps 2 and 3 as necessary
\center
\includegraphics[width=120mm]{figures/Example_Step3_2.png}
\end{figure}
\begin{figure}[H]
\center
\includegraphics[width=120mm]{figures/Example_final.png}
\end{figure}

\section{Calling BLOM}
\begin{enumerate}
\item Always remember to run \texttt{BLOM\_addpath} to add all the BLOM related files into your path
\item Create model in simulink
\item \texttt{BLOM\_SetDataLogging(\red{`ModelName'})}
\item \texttt{ModelSpec = BLOM\_ExtractModel(\red{`ModelName'}, \red{\#timesteps})}
\item \texttt{[RunResults ResultsVec] = BLOM\_RunModel(ModelSpec)}
\item \texttt{[OptGuess ExtVars InitialStates ] = BLOM\_SplitResults(ModelSpec,RunResults)}
\item \texttt{SolverStruct = BLOM\_ExportToSolver(ModelSpec,\red{`Solver'})}
\item \texttt{SolverStructData =  BLOM\_SetProblemData(SolverStruct,ModelSpec,OptGuess, ExtVars, InitialStates)}
\item \texttt{SolverResult  =  BLOM\_RunSolver(SolverStructData,ModelSpec)}
\end{enumerate}•
\textbu{Using Externals:} Items 7-9 can be run in a loop using outputs from \texttt{SolverResult} to populate \texttt{OptGuess} and \texttt{InitialStates} in subsequent iterations.  \texttt{OptGuess}, \texttt{ExtVars}, and \texttt{InitialStates} can all be filled in from the command line (e.g. \texttt{ExtVars.x1=5}, and \texttt{OptGuess=SolverResult})

\section{Optimizing Your Model}
\begin{itemize}
\item Use fewer blocks.  Outputs of blocks (with the exception of subsystems, from/goto tags, mux/demux) represent variables.  Having fewer blocks and therefore fewer variables allows for faster computation.
\item Switch to polyblocks.  Converting groups of mathematical operations into polyblocks can also reduce the number of variables
\item For polyblocks with sparse entries, create matrices using Matlab function sparse.  This reduces memory storage and computations are optimized within Matlab.
\end{itemize}•

\clearpage
\section{Currently Supported Simulink Blocks}
\begin{multicols}{2}
\begin{itemize*}
\item Sum, Add, Subtract
\item Product, Multiply, Divide
\item Gain
\item Unary Minus
\item Bias
\item Math
\vspace{-5pt}
	\begin{itemize*}
	\item square
	\item sqrt
	\item reciprocal
	\item exp
	\item 10\string^u
	\item log
	\item log10
	\item magnitude\string^2 (Reals only)
	\item 1/sqrt, rsqrt
	\item hypot
	\end{itemize*}•
\item Trigonometry
\vspace{-5pt}
	\begin{itemize*}
	\item sin
	\item cos
	\item tan
	\item asin
	\item acos
	\item atan
	\item sincos
	\end{itemize*}•
\item Polynomial
\item Constant
\item Unit Delay
\item Subsystem
\item From, Goto
\item Mux, Demux
\end{itemize*}•

\end{multicols}

\end{document}


\documentclass[12pt]{cdblatex}
\usepackage{bssn-eqtns}

\begin{document}

\section*{PhysRevD.67.084023 equation (19)}

\begin{cadabra}
   from shared import *
   import cdblib

   jsonfile = 'bssn-constraints.json'
   cdblib.create (jsonfile)

   # --------------------------------------------------------------------------
   # Hamiltonian constraint

   Ham := R + K_{a b} g^{a b} K_{c d} g^{c d} - K_{a b} K_{c d} g^{a c} g^{b d}.
                                                             # cdb(Ham.101,Ham)

   Ham := R + (2/3) (trK)**2 - ABar_{a b} ABar^{a b}.        # cdb(Ham.102,Ham)

\end{cadabra}

\begin{dgroup*}[spread=5pt]
   \begin{dmath*}
      {\cal H}
         = \Cdb*{Ham.101}
         = \Cdb*{Ham.102}
   \end{dmath*}
\end{dgroup*}

\clearpage

\section*{PhysRevD.67.084023 equation (20)}

\begin{cadabra}
   # --------------------------------------------------------------------------
   # Momentum constraint

   confMom := 6 ABar^{i a} \partial_{a}{\phi}
              + \partial_{a}{ABar^{i a}}
              + ABar^{a b} GammaBar^{i}_{a b}
              - (2/3) gBar^{i a} \partial_{a}{trK}.

   defGammaBar := GammaBar^{a}_{b c} ->
                  (1/2) gBar^{a e} (   \partial_{b}{gBar_{e c}}
                                     + \partial_{c}{gBar_{b e}}
                                     - \partial_{e}{gBar_{b c}}).

   substitute (confMom, defGammaBar)                       # cdb(confMom.101,confMom)
   distribute (confMom)                                    # cdb(confMom.102,confMom)

   confMom = product_sort (confMom)                        # cdb(confMom.103,confMom)

   rename_dummies (confMom)                                # cdb(confMom.104,confMom)
   canonicalise   (confMom)                                # cdb(confMom.105,confMom)

   foo := \partial_{a}{ABar^{i a}} -> \partial_{a}{gBar^{i c} gBar^{a d} ABar_{c d}}.

   substitute   (confMom, foo)                             # cdb(confMom.106,confMom)
   product_rule (confMom)                                  # cdb(confMom.107,confMom)

   confMom = product_sort (confMom)                        # cdb(confMom.108,confMom)

   rename_dummies (confMom)                                # cdb(confMom.109,confMom)
   canonicalise   (confMom)                                # cdb(confMom.110,confMom)

   cdblib.put ('Ham',Ham,jsonfile)
   cdblib.put ('confMom',confMom,jsonfile)
\end{cadabra}

\clearpage

\begin{dgroup*}
   \begin{dmath*}
      \exp(4\phi) {\cal D}^{j}
         = \Cdb*{confMom.101}
         = \Cdb*{confMom.102}
         = \Cdb*{confMom.103}
         = \Cdb*{confMom.104}
         = \Cdb*{confMom.105}
         = \Cdb*{confMom.106}
         = \Cdb*{confMom.107}
         = \Cdb*{confMom.108}
         = \Cdb*{confMom.109}
         = \Cdb*{confMom.110}
   \end{dmath*}
\end{dgroup*}

\end{document}


\documentclass[11pt,a4paper]{report}
\usepackage{amsmath,amsfonts,amssymb,amsthm,epsfig,epstopdf,titling,url,array}
\usepackage{enumitem}
\usepackage{changepage}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{listings}
\usepackage{color}
\usepackage{hyperref}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]
\newtheorem{exercise}{Exercise}[section]
\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\hypersetup{
	colorlinks=true,
	linkcolor=blue,
	filecolor=magenta,
	urlcolor=cyan,
}
\urlstyle{same}
\lstdefinestyle{mystyle}{
	backgroundcolor=\color{backcolour},
	commentstyle=\color{codegreen},
	keywordstyle=\color{magenta},
	numberstyle=\tiny\color{codegray},
	stringstyle=\color{codepurple},
	basicstyle=\footnotesize,
	breakatwhitespace=false,
	breaklines=true,
	captionpos=b,
	keepspaces=true,
	numbers=left,
	numbersep=5pt,
	showspaces=false,
	showstringspaces=false,
	showtabs=false,
	tabsize=2
}
\lstset{style=mystyle}
\begin{document}

\section*{Problem}
Suppose that you have one thousand single dollar bills and you want to put it into a set of envelopes in such a way that any amount up to \$1000 can be made by combining the contents of some subset of the envelopes.  What is the smallest number of envelopes that you need and how would you stuff them?
\\
\\
\textit{Source:} This problem is from \href{https://www.cartalk.com}{Car Talk}

\section*{Solution}
 Use 1, 2, 4, 8, 16, 32, 64, 128, 256 and 489.  To see why this will give all the sums, note that every number has a binary expansion and the expansion of any number up to 511 is a sum of the first nine powers of 2.  To get the rest of the numbers, you can start with 489 and then get the remainder in the same way.
 \\
 \\
 What is interesting to prove is that this can't be done with fewer than 10 envelopes and this solution is unique.

\end{document}


\lesson{5}{Dec 01 2021 Wed (19:09:04)}{Polynomial Identities and Proofs}{Unit 3}

\begin{definition}[Algebraic Proofs]
    \begin{itemize}
        \item \bf{Polynomial Identities} can be proven to be true by simplifying the identity through application of \bf{Algebraic Theorems} and \bf{Principles}.
        \item Start with the side of the identity that can be simplified the easiest.
        \item Sometimes, following a \it{“clue”} will lead to a dead-end in your \bf{Proof}. Do not give up. Just follow a different \it{“clue”}. The more practice you have with proofs, the more you will be able to predict the dead-ends.
    \end{itemize}
\end{definition}

\begin{example}

\end{example}

\subsubsection*{Application to Numerical Relationships}

Polynomial identities apply to more than just polynomials. Replacing the variables with numbers can help prove numerical relationships as well.

\newpage


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                 %
%  GEANT manual in LaTeX form                              %
%                                                                 %
%  Michel Goossens (for translation into LaTeX)                   %
%  Version 1.00                                                   %
%  Last Mod. Jan 24 1991  1300   MG + IB                          %
%                                                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Origin{R.Brun, F.Carena}
\Submitted{01.06.83}             \Revised{14.12.93}
\Version{Geant 3.16}\Routid{GEOM200}
\Makehead{Rotation matrices}

The relative position of a volume inside its mother is expressed in
{\tt GEANT} by a translation vector and a rotation matrix which are
arguments of the routines \Rind{GSPOS} and \Rind{GSPOSP}. The rotation
matrix expresses the transformation from the {\tt M}other {\tt R}eference
{\tt S}ystem to the {\tt D}aughter {\tt R}eference {\tt S}ystem.

A rotation matrix is described to {\tt GEANT} by giving the polar and
azimuthal angles of the axes of the {\tt DRS} ($x', y', z'$) in the
{\tt MRS} via the routine \Rind{GSROTM}.

\Shubr{GSROTM}{(IROT,THETA1,PHI1,THETA2,PHI2,THETA3,PHI3)}
\begin{DLtt}{MMMMMMMM}
\item[IROT] ({\tt INTEGER}) number of the rotation matrix;
\item[THETA1] ({\tt REAL}) polar angle for axis $x'$;
\item[PHI1] ({\tt REAL}) azimuthal angle for axis $x'$;
\item[THETA2] ({\tt REAL}) polar angle for axis $y'$;
\item[THI2] ({\tt REAL}) azimuthal angle for axis $y'$;
\item[THETA3] ({\tt REAL}) polar angle for axis $z'$;
\item[PHI3] ({\tt REAL}) azimuthal angle for axis $z'$.
\end{DLtt}
Stores rotation matrix {\tt IROT} in the data structure {\tt JROTM}. If the
matrix is not orthonormal, it will be corrected by setting $y' \perp x'$ and
then $z' = x' \times y'$. A warning message is printed in this case.

{\bf Note:}
the angles {\tt THETA} and {\tt PHI} must be given in degrees.

\section*{Examples of use}
The unit matrix is defined in the following way:

\[
\left . \begin{array}{lcl}
x' & \| & x \\
y' & \| & y \\
z' & \| & z
\end{array} \right \}
\Rightarrow
\left \{
\begin{array}{lcr@{\mbox{\hspace{3mm};\hspace{8mm}}}lcr}
\theta_1 & = & 90^{\circ} & \phi_1 & = & 0^{\circ} \\
\theta_2 & = & 90^{\circ} & \phi_2 & = & 90^{\circ} \\
\theta_3 & = & 0^{\circ} & \phi_3 & = & 0^{\circ}
\end{array} \right .
\]

This is just an example. There is in fact no need to define a unit rotation
matrix. Giving the value 0 to the rotation matrix number in the call to
\Rind{GSPOS} and \Rind{GSPOSP} is equivalent to a positioning without
rotation and it improves tracking performance.

The result of a $90^{\circ}$ counterclockwise rotation around $z$, followed
by a $90^{\circ}$ counterclockwise rotation around the new $x$ is a cyclic
shift of the axes: $x \rightarrow z', \; y \rightarrow x', \; z \rightarrow
y'$. This is expressed by the following rotation matrix:

\[
\left . \begin{array}{lcl}
x' & \| & y \\
y' & \| & z \\
z' & \| & x
\end{array} \right \}
\Rightarrow
\left \{
\begin{array}{lcr@{\mbox{\hspace{3mm};\hspace{8mm}}}lcr}
\theta_1 & = & 90^{\circ} & \phi_1 & = & 90^{\circ} \\
\theta_2 & = & 0^{\circ} & \phi_2 & = & 0^{\circ} \\
\theta_3 & = & 90^{\circ} & \phi_3 & = & 0^{\circ}
\end{array} \right .
\]

Sometimes the rotation matrix is known or it can be constructed. In this case
the arguments to the routine \Rind{GSROTM} can be calculated with the help
of the routine \Rind{GFANG} in the following way:

\begin{verbatim}
      DIMENSION ROTMAT(3,3), ROWMAT(3), PHI(3), THETA(3)
      LOGICAL ROTATE
      .
      .
      .
      DO 10 I=1,3
         ROWMAT(1) = ROTMAT(I,1)
         ROWMAT(2) = ROTMAT(I,2)
         ROWMAT(3) = ROTMAT(I,3)
         CALL GFANG(ROWMAT,COSTH,SINTH,COSPH,SINPH,ROTATE)
         THETA(I) = ATAN2(SINTH,COSTH)
         PHI(I)   = ATAN2(SINPH,COSPH)
  10  CONTINUE
      .
      . {\sl Transform to degrees}
      .
      CALL GSROTM(IROT,THETA(1),PHI(1),THETA(2),PHI(2),THETA(3),PHI(3))
\end{verbatim}

\Shubr{GPROTM}{(IROT)}
Prints the rotation matrix elements and angles.
\begin{DLtt}{MMMMMMMM}
\item[IROT]  ({\tt INTEGER}) rotation matrix number: if {\tt IROT}=0 all
rotation matrixes will be printed, if {\tt IROT}$<$0, matrix number
{\tt |IROT|} will be printed without header information.
\end{DLtt}


\subsection{Elliptical-curve cryptography}


%!TEX root = ../thesis.tex
%*******************************************************************************
%****************************** Third Chapter **********************************
%*******************************************************************************
\chapter{Complexity Conjectures} \label{chap:complexity}

% **************************** Define Graphics Path **************************
\ifpdf
    \graphicspath{{Chapter3/Figs/Raster/}{Chapter3/Figs/PDF/}{Chapter3/Figs/}}
\else
    \graphicspath{{Chapter3/Figs/Vector/}{Chapter3/Figs/}}
\fi

\section{Exponential Time Hypothesis}
Of all the algorithms covered in the previous chapter, they all had exponential computational
time complexity, with all of the backtracking based algorithms requiring $\mathcal{O}^*(2^n)$ in the worst case. Slightly better was
Sch\"oning's Algorithm \ref{alg:schoning}, which had a complexity of
$\mathcal{O}^*((2 - \frac{2}{k})^n)$. However, for a general formula in CNF
$k$ could be arbitrarily large and as $k \to \infty$ then we recover the same
complexity as the other algorithms. So even when considering the case where we
have a 3SAT instance, we are unable to improve over the
exponential complexity.

\nomenclature[x-Ostar]{$\mathcal{O}^{\ast}(\cdot)$}{Big-O ignoring polynomial factors}

We know that $k$-SAT is NP-COMPLETE for $k \geq 3$\cite{schaefer1978complexity},
so unless $P = NP$ we should not expect to find a polynomial time algorithm.
However, it is still theoretically possible, under the assumption that $P \neq NP$, for there to exist an algorithm which is superpolynomial but subexponential.
Here we say that $f(x)$ is subexponential if it is $\mathcal{O}^{\ast}(2^{\epsilon n})$ for all
$\epsilon > 0, \quad \epsilon \in \mathbb{R}$ with $\mathcal{O}^{\ast}(g(x))$ meaning $\mathcal{O}(poly(n) \cdot g(x))$,
i.e. ignoring polynomial factors. Such an algorithm
could have running time $T(n) = \mathcal{O}^{\ast}(2^{\frac{n}{\log n}})$ which is
$\mathcal{O}^{\ast}(2^{\epsilon n}),\quad \epsilon > 0$.
However, no such algorithm for SAT has been found.

Due to the seeming difficulty of finding significantly faster $k$-SAT algorithms
there have been two conjectures
put forward by Impagliazzo and Paturi, which
relate to the complexity of $k$-SAT. These are the ``Exponential Time Hypothesis'' and the ``Strong
Exponential Time Hypothesis'', abbreviated to ETH and SETH respectively \cite{impagliazzo2001complexity}.

\nomenclature[z-ETH]{ETH}{Exponential Time Hypothesis}
\nomenclature[z-SETH]{SETH}{Strong Exponential Time Hypothesis}

Informally ETH hypothesises that there does not exist a subexponential time algorithm solving SAT.
More formally, consider the set of all $k$-SAT algorithms and
express their time complexities in the form $\mathcal{O}^{\ast}(2^{\delta n})$
for some constant $\delta \in \mathbb{R}^{+} \cup \{0\}$.
Then for $k \in \mathbb{N}, \quad k \geq 3$ let $s_k$ be the infimum
of $\delta$s taken from this set
\begin{equation} \label{eq:ETH}
    s_k = \inf \{\delta: \text{$k$-SAT is solvable in time } \mathcal{O}^{\ast}(2^{\delta n})\}
\end{equation}
The ETH then states that $s_{3} > 0$ \cite{impagliazzo2001complexity}.
Intuitively this means that there must exist some non-zero constant $s_{3}$ such
that solving 3-SAT takes time $\Omega^{\ast}(2^{s_{3} n})$ which rules out
a subexponential time algorithm for 3-SAT.
The statement that $s_3 > 0$ is equivalent to the statement that
for all $k \in \mathbb{N}$ if $k \geq 3$ then $s_k > 0$,
i.e. there then cannot exist a subexponential time
algorithm for $k$-SAT with $k \geq 3$. This is because a 3-CNF can be easily
reduced to a $k$-CNF for all $k \geq 3$.

If we, instead of considering all $k$-SAT algorithms, consider just Sch\"oning's
algorithm, then we get a new sequence of $s'_k$ where
$\forall k \in \mathbb{N}: s'_k \geq s_k$. Rearranging the complexity
of Sch\"oning's algorithm we get that

\begin{equation} \label{eq:sk_schoing}
    s'_k = \log_2(2 - \frac{2}{k}), \quad k \geq 3
\end{equation}

which yields the sequence $\sim 0.415, \sim 0.585, \sim 0.678, \dots$ for
$k= 3,4,5, \dots$. It is clear from Equation \ref{eq:sk_schoing} that
as $k \to \infty$ then $s'_k \to 1$.
There are known algorithms that produce smaller constants \cite{hofmeister2002probabilistic},
however these algorithms still generate a sequence that tends to 1 as
$k \to \infty$.

The ``Strong Exponential Time Hypothesis'' (SETH) considers this limit
as $k$ tends to infinity. SETH states that
\begin{equation} \label{eq:SETH}
    \lim_{k \to \infty} s_{k} = 1
\end{equation}
Intuitively, if SETH were proven true,
this would mean that for general SAT there is no algorithm that is
asymptotically faster than brute force search and algorithms
such as DP, DPLL and CDCL would be optimal up to subexponential factors.
% highlight any differences between the formalism and the intuition

\subsection{Conditional Lower Bounds}
The ETH and SETH both imply that $P \neq NP$, so we should not hope to
prove either conjecture just yet. However, we can consider the implications
that these conjectures would have on other problems if they were proven true.
This allows for us to show that many problems have conditional lower bounds
on their complexity and for many problems that current algorithms
are optimal assuming one of these conjectures.

If we consider attempting to show lower bounds from an assumption of the ETH,
then since the ETH deals with the non-existence of subexponential time algorithms
for $k$-SAT, we could hope to reduce $k$-SAT to a number of different problems in
such a way that preserves subexponential time.

Since we are dealing with parameterized complexities for $k$-SAT with parameters
$n$ and $m$, when considering general problems we will use the mapping
$\kappa: \Sigma^* \mapsto \mathbb{N}$ to denote the parameter an instance
of the problem $x \in \Sigma^*$. Where $\Sigma^*$ is the set of problem instances.

\begin{definition}
    A Turing reduction from a problem $(A_1, \kappa_1)$ to a problem
    $(A_2, \kappa_2)$ is considered a SERF-T reduction if
    \begin{enumerate}
        \item The reduction on an instance $x$ of $A_1$
        runs in time $\mathcal{O}(2^{\epsilon \kappa_1(x)}|x|^{\mathcal{O}(1)})$
        for a choice of $\epsilon > 0$.
        \item For a query to $A_2$ with input $x'$:
        \begin{enumerate}
            \item $|x'| \leq |x|^{\mathcal{O}(1)}$
            \item $\kappa_2(x') \leq \alpha \kappa_1(x)$
        \end{enumerate}
        Where the constants hidden in the $\mathcal{O}(\cdot)$ do not
        depend on the choice of $\epsilon$.
        The constant $\alpha$ may depend on $\epsilon$
    \end{enumerate}
\end{definition}

To see how this works, consider two parameterized problems $(A_1, \kappa_1)$
and $(A_2, \kappa_2)$, where the second problem has a parameterized
subexponential time algorithm. We wish to show that if $(A_1, \kappa_1)$ is
SERF-T reducible to $(A_2, \kappa_2)$ then there also exists a parameterized
subexponential time algorithm for $(A_1, \kappa_1)$, i.e. for a choice of
$\epsilon > 0$ we need to show that $(A_1, \kappa_1)$ runs in time
$\mathcal{O}(2^{\epsilon \kappa_1(x)}|x|^{\mathcal{O}(1)})$.

Do show this, choose an $\epsilon > 0$.
Let $\epsilon' = \frac{\epsilon}{2}$ and run the SERF-T reduction
with parameter $\epsilon'$. Since this reduction runs in time
$\mathcal{O}(2^{\epsilon' \kappa_1(x)}|x|^{\mathcal{O}(1)})$ then this bounds
the number of calls to $(A_2, \kappa_2)$ by the same amount.
Each call to $(A_2, \kappa_2)$ has an instance $|x'| \leq |x|^{\mathcal{O}(1)}$
and $\kappa_2(x') \leq \alpha \kappa_1(x)$.
Since, from our assumption that $(A_2, \kappa_2)$ runs in parameterized subexponential
time we can choose $\epsilon'' = \frac{\epsilon'}{\alpha}$ and then each call to $(A_2, \kappa_2)$ can be made to run in time
\begin{equation}
    \mathcal{O}(2^{\epsilon' \kappa_1(x)}|x|^{\mathcal{O}(1)})
\end{equation}
Therefore, the total time for solving $(A_1, \kappa_1)$ is given by
\begin{equation}
    \mathcal{O}(2^{\epsilon' \kappa_1(x)}|x|^{\mathcal{O}(1)}) \cdot
    \mathcal{O}(2^{\epsilon' \kappa_1(x)}|x|^{\mathcal{O}(1)}) =
    \mathcal{O}(2^{\epsilon \kappa_1(x)}|x|^{\mathcal{O}(1)})
\end{equation}
which is what we wanted to show. \cite{lokshtanov2013lower}

\subsubsection{Lower Bounds for 3-colouring}

To show that ETH implies that there is no subexponential time algorithm for 3-colourability
we must show that the standard reduction from 3-SAT to 3-colourability is also
a SERF-T reduction. The first requirement that the reduction runs in time
$\mathcal{O}(2^{\epsilon \kappa_1(x)}|x|^{\mathcal{O}(1)})$ for all $\epsilon > 0$ is trivially
satisfied since the reduction runs in polynomial time.
Hence it also follows that the reduced instance $|x'| \leq |x|^{\mathcal{O}(1)}$.

Thus, the only thing left to show is that $\kappa_2(x') \leq \alpha \kappa_1(x)$ for
some constant $\alpha$. In this case $\kappa_2(x')$ would be the number of vertices
in the reduced instance and $\kappa_1(x) = n$.

To do this, recall the the standard reduction reduction from 3-SAT to 3-colourability
(see Figure \ref{fig:reduce_3col}).
We have a triangle and label the vertices as True, False and Base.
For each variable $x_i$ we create vertices labelled $x_i$ and $\neg x_i$ and
edges $(x_i, \neg x_i), (x_i, \text{Base}), (\neg x_i, \text{Base})$. Then
for each clause we have two ``or'' gadgets that consist of 3 vertices.
Thus, the total number of vertices in the instance $x'$ is given by
\begin{equation}
    \kappa_2(x') = 2n + 3m + 3
\end{equation}
This appears to be an issue, since we are unable to make $\kappa_2(x')$ linear in $n$
since $m$ could be a superlinear function of $n$ for an arbitrary instance of 3-SAT $x$.
However, we can make use of the sparsification lemma \cite{impagliazzo2001problems} to
reduce any $k$-SAT instance into a subexponential number of $k$-SAT instances where
$m$ is linear in $n$ and this takes subexponential time. We will detail the
sparsification lemma in Chapter \ref{chap:sparsication}.

Hence, to get our SERF-T reduction we first apply the sparsification lemma to
reduce our original instance $x$ into subexponentially many new $k$-SAT instances
and apply our standard 3-SAT to 3-colourability reduction to each new instance.
Since we can now guarantee that $m$ is $\mathcal{O}(n)$ then $2n + 3m + 3$ is also
$\mathcal{O}(n)$. We let $\alpha$ be the constant hidden in the $\mathcal{O}(\cdot)$.
Since the sparsification lemma produces a subexponential number of instances that
are no longer than the original instance and since it runs in subexponential time, then
we do not violate the time constraints of the SERF-T reduction.

Hence we have shown that this reduction satisfies all the requirements of a SERF-T
requirement. We can therefore say that if 3-colourability on $|V|$ vertices can
be solved in time $\mathcal{O}^{\ast}(2^{\epsilon \cdot |V|})$ for all $\epsilon > 0$
then 3-SAT could be solved in time $\mathcal{O}^{\ast}(2^{\epsilon \cdot n})$
for all $\epsilon > 0$, which would violate the ETH.

\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{scope}[auto,every node/.style={draw,circle,minimum size=2.5em}]
        % Pallet
        \node (T) at (-1,0) {T};
        \node (F) at (1,0) {F};
        \node (B) at (0,-1.5) {B};

        % Variables
        \node (x1) at (-2, -4) {$x_1$};
        \node (!x1) at (-4, -4) {$\neg x_1$};
        \node (x2) at (-2, -6) {$x_2$};
        \node (!x2) at (-4, -6) {$\neg x_2$};
        \node (x3) at (-2, -8) {$x_3$};
        \node (!x3) at (-4, -8) {$\neg x_3$};

        % Or gadets
        \node (or1a) at (1, -4) {};
        \node (or1b) at (2.5, -4.75) {};
        \node (or1c) at (1, -5.5) {};

        \node (or2a) at (5, -4.5) {};
        \node (or2b) at (6.5, -5.25) {};
        \node (or2c) at (5, -6) {};

        \node (or3a) at (1, -8) {};
        \node (or3b) at (2.5, -8.75) {};
        \node (or3c) at (1, -9.5) {};

        \node (or4a) at (5, -8.5) {};
        \node (or4b) at (6.5, -9.25) {};
        \node (or4c) at (5, -10) {};
        \end{scope}

        \path (T) edge (F) edge (B)
              (B) edge (F)
              (!x1) edge (x1)
              (!x2) edge (x2)
              (!x3) edge (x3)
              (or1a) edge (or1b)
              (or1b) edge (or1c)
              (or1c) edge (or1a)
              (or2a) edge (or2b)
              (or2b) edge (or2c)
              (or2c) edge (or2a)
              (or3a) edge (or3b)
              (or3b) edge (or3c)
              (or3c) edge (or3a)
              (or4a) edge (or4b)
              (or4b) edge (or4c)
              (or4c) edge (or4a)
              (x1) edge (or1a)
              (x2) edge (or1c)
              (or1b) edge (or2a)
              (x3) edge (or2c);

        \draw (!x1) -- (-5, -5) -- (-5 , -9) -- (-1, -9) -- (or3a)
              (!x2) -- (-5.2, -7.2) -- (-5.2, -9.5) -- (or3c)
              (or3b) -- (or4a)
              (!x3) -- (-4, -10.5) -- (4, -10.5) -- (or4c)
              (or2b) -- (7, -4.75) -- (7, -1.5) -- (B)
              (or2b) -- (7.4, -4.75) -- (7.4, 0) -- (F)
              (or4b) -- (7.2, -8.75) -- (7.2, -1.4) -- (B)
              (or4b) -- (7.6, -8.75) -- (7.6, 0.1) -- (F)
              (B) -- (-0.75, -2.25) -- (-3, -2.25) -- (-3, -7) -- (!x3)
              (B) -- (-0.75, -2.35) -- (-2.9, -2.35) -- (-2.9, -7) -- (x3)
              (B) -- (-0.75, -2.15) -- (-3.1, -2.15) -- (-3.1, -5) -- (!x2)
              (B) -- (-0.75, -2.45) -- (-2.8, -2.45) -- (-2.8, -5) -- (x2)
              (B) -- (-0.75, -2.05) -- (-3.2, -2.05) -- (-3.2, -3) -- (!x1)
              (B) -- (-0.75, -2.55) -- (-2.7, -2.55) -- (-2.7, -3) -- (x1);

    \end{tikzpicture}
    \caption[Reduction to 3-colourability]{Standard reduction of
    $(x_1 \lor x_2 \lor x_3) \land (\neg x_1 \lor \neg x_2 \lor \neg x_3)$ to 3-colourability}
    \label{fig:reduce_3col}
\end{figure}

Using similar techniques we can also establish that the ETH implies that
there are no subexponential time algorithms for the following \cite{lokshtanov2013lower}.
\begin{itemize}
    \item Independent Set
    \item Dominating Set
    \item Vertex Cover
    \item Hamiltonian Path
\end{itemize}

\subsubsection{Lower Bounds for Planar Graph Problems}
Note that the SERF-T reduction from 3-SAT to 3-colourability depended on the
fact that the number of vertices in the
3-colourability instance was linear in the in the number of variables
in the 3-SAT instance. Typically for planar graph problems, this
property cannot be obtained.

For instance the reduction from 3-SAT to planar hamiltonian cycle
creates a graph $G$ where the number of vertices is $\mathcal{O}(m^2)$ \cite{garey1976planar}.
As such we cannot establish a SERF-T reduction from 3-SAT to planar hamiltonian cycle
parameterized by the number of vertices.
However, if we let the parameter be $\kappa_2(x') = \sqrt{|V|}$, then it is obvious that
this parameter is $\mathcal{O}(m)$. Then we can use the same techniques as before to
establish that the ETH implies that there is no $2^{o(\sqrt{|V|})}$ algorithm for planar
hamiltonian cycle.

The same argument can be made for many planar graph problems. Taken in conjunction
with algorithms using the planar separator theorem \cite{lipton1979separator} this
then means that many planar graph algorithms are optimal \cite{lipton1977applications}.

\subsection{Further Conditional Lower Bounds for Algorithms in P}
Proofs of conditional lower bounds are not limited to problems that
have superpolynomial complexities. Here we will give an example
of a lower bound for the orthogonal vectors problem based on the assumption
of the SETH \cite{williams2004new}.

\begin{definition}
    The orthogonal vectors problem is, given two sets $U$ and $V$ of bit vectors of length
    $d$ where $|U| = |V| = n$ and $d$ is $\omega(\log n)$, does there exist $u \in U$ and
    $v \in V$ such that $\sum_{i = 1}^{d} u_i \cdot v_i = 0$
\end{definition}

Best known algorithms for orthogonal vectors take time $\mathcal{O}(n^{2 - o(1)})$ and
it is unknown whether there is any ``strongly subquadratic'' algorithm, i.e. an
algorithm taking time $\mathcal{O}(n^{2 - \epsilon})$ for some $\epsilon > 0$. However,
Williams et al. show that SETH implies that no such algorithm exists \cite{williams2004new}.

To show this we will need the concept a fine grained reduction. Such a reduction
has the property that for two problems $A$ and $B$ with best known running times
$a(n)$ and $b(n)$ respectively, an improvement on $B$ to $\mathcal{O}(b(n)^{1 - \epsilon})$
leads to an improvement on $A$ to $\mathcal{O}(a(n)^{1 - \delta})$ for all $\epsilon > 0$
and some $\delta > 0$. Such a reduction is often denoted as a $(a(n), b(n))$-reduction \cite{vassilevska2015hardness}

\begin{definition}
    A fine grained reduction $M$ from problem $A$ to problem $B$ with running times
    $a(n)$ and $b(n)$ respectively obeys the following:
    For all $\epsilon > 0$, there is some $\delta > 0$ and some constant $d$
    such that for all $n \geq 1$ there is some constant $k_n$ and
    \begin{itemize}
        \item $M$ runs in time $d \cdot (a(n))^{1 - \delta}$,
        \item $M$ produces at most $k_n$ instances of $B$ adaptively,
        \item $\sum_{i = 1}^{k_n}(b(n'_i)^{1 - \epsilon}) \leq d \cdot (a(n))^{1 - \delta}$, where $n'_i$ is the
        $i_{\text{th}}$ instance of $B$.
    \end{itemize}
    Instance sizes $n'_i$ may depend on $n$ and $\epsilon$, but $d$ can depend only on $\epsilon$ and not on $n$.
\end{definition}

The $(2^n, n^2)$-reduction from $k$-SAT to orthogonal vectors is then as follows. Apply the sparsification lemma
to the $k$-SAT instance, then partition the variables arbitrarily into two sets $D_1, D_2$ such
that each set contains $\frac{n}{2}$ variables. Construct two sets of vectors $U_1, U_2$ as follows:
For all $i \in \{1,2\}$ and for all assignments $\alpha$ to the variables in $D_i$, $v_{i, \alpha} \in U_i$
where for all clauses $C$, $v_{i, \alpha}[C] = 0$ if and only if the clause $C$ is satisfied by the
assignment $\alpha$ to the variables in $D_i$, $1$ otherwise. Therefore, if two vectors are orthogonal then
there exists an assignment to the variables in $D_1$ and $D_2$ such that for every clause it
is either satisfied by the assignment to $D_1$ or the assignment to $D_2$ \cite{williams2004new}.

Hence, any $\mathcal{O}(n^{2 - \epsilon})$ time algorithm for orthogonal vectors implies that there
is a $\mathcal{O}(2^{(1 - \delta)n})$ algorithm for $k$-SAT for all $k$. Therefore, the SETH
implies that there cannot be such an algorithm for orthogonal vectors.

Applying similar techniques, SETH implies
\begin{itemize}
    \item Fr\'echet distance cannot be computed in $\mathcal{O}(n^{2 - \epsilon})$ \cite{bringmann2014walking}
    \item Edit distance cannot be computed in $\mathcal{O}(n^{2 - \epsilon})$ \cite{backurs2015edit}
    \item Dynamic Time Warping distance cannot be computed in $\mathcal{O}(n^{2 - \epsilon})$ \cite{bringmann2015quadratic}
    \item Longest Common Subsequence cannot be computed in $\mathcal{O}(n^{2 - \epsilon})$ \cite{bringmann2018multivariate, polak2018hard}
\end{itemize}


% !TEX root = ../main.tex
% !TEX spellcheck = en_GB

\chapter{Discussion}

The original idea for this project was an auto tuner, which should help people with their singing, by changing the tones.
The idea for this project originates from listening to todays big idols, both on the live stage and their studio recordings.

An impressive complex and optimized algorithm must have been made for auto tuning to work on live performances.
Therefore a big challenge as an auto tuner seemed like a brilliant idea.
The project started with making the requirements.
After making the requirements and a guidance section with the supervisor, it was clear that this was to ambitious.
Hence the project was scaled down to a pitch shifter, which firstly should be able to change the frequency of a pure sine as the incoming signal and later on, be able to handle the harmonics in a tone as well as changing frequency.

The first method to change pure sine to another frequency was generally to change the sample frequency, fs.
But before changing the fs, the frequency of the input signal had to be found.
Since the frequency area that this project works around is as seen in \cref{tab:cmajor} very close to each other a high resolution of the FFT was needed.
And to get a high frequency resolution a lot of samples is needed.
But this brings another predicament since with the high fs, the amount of samples will both fill the memory but also use a lot of calculation time.
Therefore decimation before making the FFT, was decided this could give a high frequency resolution and doesn't fill the memory.
Both of these methods huge flaw is the time delay of approximately one second, and that is only the frequency determination that has been made at that point.
This method with decimation, fft and change of fs was manageable in Matlab, where the algorithm was written.
But at the implementation stage it was noticed that the fs, on the BF533, only had two possible values, thus a new solution was needed.

The new method was the use of Hilbert transformation to find the frequency with a high frequency resolution and a short amount of processing time.
A sinus generator from the $math.h$ library and a circular buffer to minimize the amount of sine waves to compute.
The brilliant and astonishing thing about the Hilbert transform, is the extremely high frequency resolution and minimal amount of samples needed.
It can be done quick and only with 512 samples, and even less samples if the use of a window was implemented as shown in \cref{sec:test}.
The cons of the Hilbert transform is the fact that it can only find the precise frequency of a pure sine wave meaning, if there are several sines mixed together it will find the average.
This could probably be handled in some way, if a good description of the harmonics for an instrument as well as each tone is described in the code.
Through the Hilbert transformation quantization errors also occurs, and result in a small deviation of the found frequency compared to the algorithm in Matlab.
After the Hilbert transformation, the sine wave generator is needed.
It was implemented in Matlab and a version on the Blackfin to measure the cycles usage.
A problem with the sine generator is, if a tone is the input signal, a generator for all the harmonics are also needed, and could escalate to become very heavy on the computation or memory.
To avoid computing a new sine every time the idea of reusing the data in a circular buffer was made up.
Since most of this method has not been implemented on the Blackfin, it is still very unclear how the sound will be, the total time delay and how it will work when it is upgraded to handle harmonics as well.

Through the whole process the synergy between algorithm writing in Matlab and afterwards implementation on the Blackfin has been very effective.
The synergy has also been used efficient to debug, to find the error in the implemented algorithm, by loading output files and see if they match the Matlab code.
This method was very efficient since it was very clear to find the exact place something went wrong, and handle it and in the end an outcome allowing the frequency to be determined.


\section{Catalan characterization}
\label{sec:catalan:characterization}

In this section we tackle a modular characterization for the Catalan array
$\mathcal{C}$ using the congruence relation $\equiv_{2}$ and we use
\autoref{fig:catalan-traditional-standard-ignore-negatives-centered-colouring-127-rows-mod2-partitioning-triangle}
as a driver that allows us to reason \emph{piece-wise}, studying each region of
$\mathcal{C}_{\equiv_{2}}$ independently.

An important object that is repeatedly used in the rest of this paper is a
subset of elements lying on column $k$ of $\mathcal{C}$ which is denoted by
$\vect{c}_{k}$.  Let $s,f,k\in\mathbb{N}$, then a \emph{segment}
$\diagup_{\lbrace\alpha_{i}\rbrace_{i\in S}}^{k}$ of $\vect{c}_{k}$ is defined
as
\begin{equation}
    \diagup_{(s,f) }^{k}
        %= \left(\vect{c}_{k},\lbrace k+\alpha_{i}\rbrace_{i\in S}\right)
        = \left\lbrace d_{k+j,k}\in\mathcal{C}:s\leq j\leq f\right\rbrace
    \label{eq:column:segment}
\end{equation}
and the set of the row indices involved in it is denoted by
$\displaystyle
    rows\left(\diagup_{(s,f)}^{k}\right)
        %= rows\left(\left(\vect{c}_{k},\lbrace k+\alpha_{i}\rbrace_{i\in S}\right)\right)
        = \lbrace k+i:s\leq i\leq f \rbrace
    \label{eq:column:segment:rows:function}
$.

\subsection{On the very first column of $\mathcal{C}_{\equiv_{2}}$}

This section characterizes the very first column $\vect{c}_{0}$ of
$\mathcal{C}_{\equiv_{2}}$ \textit{which is composed of Catalan numbers only},
formally $C_{j}=c_{j,0}\in\vect{c}_{0}$ for all $j\in\mathbb{N}$; as an example,
in \autoref{fig:catalan-first-column} the segment $\diagup_{(0,2^{4})}^{0}$ is
highlighted.

\begin{theorem}
    Let $j,\alpha\in\mathbb{N}$, then $C_{j} \equiv_{2} 0$ unless $j=2^{\alpha}-1$,
    in which case $C_{2^{\alpha}-1} \equiv_{2} 1$ holds.
\end{theorem}

\begin{proof}
The idea is to apply the congruence relation $\equiv_{2}$ to \autoref{eq:catalan:coeff:rewriting}
and to reason on the representation of $j = (j_{0},j_{1},\ldots,j_{k})_{2}$ in base $2$.

For the first value $j=0$ we have $C_{0} \equiv_{2} 1$ because $0 = 2^{\alpha}-1$ for $\alpha=0$.

On the contrary, for $j>0$ we proceed by cases on $j$'s parity:
\begin{itemize}
    \item let $j=2k$, for some $k\in\mathbb{N}$, so $j_{0}=0$
        makes the subtrahend of \autoref{eq:catalan:coeff:rewriting} vanish because
        \begin{displaymath}
            {{2j}\choose{j+1}}
            \equiv_{2} {{0}\choose{1}}{{0}\choose{j_{1}}}{{j_{1}}\choose{j_{2}}}
                \ldots{{j_{k-1}}\choose{j_{k}}}{{j_{k}}\choose{0}}\equiv_{2}0,
        \end{displaymath}
        also the minuend vanishes because
        \begin{displaymath}
            {{2j}\choose{j}}
            \equiv_{2} {{0}\choose{0}}{{0}\choose{j_{1}}}{{j_{1}}\choose{j_{2}}}
                \ldots{{j_{k-1}}\choose{j_{k}}}{{j_{k}}\choose{0}}\equiv_{2}0;
        \end{displaymath}

    \item let $j=2\alpha+1$, for some $\alpha\in\mathbb{N}$, so $j_{0}=1$
        makes the minuend of \autoref{eq:catalan:coeff:rewriting} vanish because
        \begin{displaymath}
            {{2j}\choose{j}}
            \equiv_{2} {{0}\choose{1}}{{1}\choose{j_{1}}}{{j_{1}}\choose{j_{2}}}
                \ldots{{j_{k-1}}\choose{j_{k}}}{{j_{k}}\choose{0}}\equiv_{2}0
                \quad\text{hence}\quad
            C_{j}\equiv_{2}-{{2j}\choose{j+1}}.
        \end{displaymath}
        The multiplicative inverse of $-1$ modulo $2$ equals $1$ because $(-1)\cdot 1 \equiv_{2}1$,
        formally $(-1)^{-1}~\mod~2~=~1$, therefore multiplying both members by $1$ yields
        $\displaystyle C_{j}\equiv_{2}{{2j}\choose{j+1}}$.

        Careful handling is necessary for the term $j+1$
        because $j$ is odd by hypothesis and increasing it could yield a chain of carries;
        in particular, let $\beta,\gamma\in\mathbb{N}$, such that $\beta>0$ and $\beta+\gamma=k$, in
        \begin{displaymath}
            j=\left(\underbrace{1,1,\ldots,1}_{\beta},0,j_{\beta+1},\ldots,j_{\beta+\gamma}\right)_{2}\,
            \rightarrow\,
            j+1=\left(\underbrace{0,0,\ldots,0}_{\beta},1,j_{\beta+1},\ldots,j_{\beta+\gamma}%,j_{\beta+\gamma+1}
                \right)_{2}
        \end{displaymath}
        which entails that the congruence relation
        \begin{displaymath}
            %\hspace{-2cm}
            C_{j}\equiv_{2}{{2j}\choose{j+1}}
                \equiv_{2} \underbrace{{{0}\choose{0}}{{1}\choose{0}}
                {{1}\choose{0}}\ldots{{1}\choose{0}}}_{\beta}
                    {{1}\choose{1}}{{0}\choose{j_{\beta+1}}}{{j_{\beta+1}}\choose{j_{\beta+2}}}
                    \ldots{{j_{\beta+\gamma-1}}\choose{j_{\beta+\gamma}}}{{j_{\beta+\gamma}}\choose{0}}%{\beta+\gamma+1}}
        \end{displaymath}
        simplifies to
        $\displaystyle C_{j}\equiv_{2} {{0}\choose{j_{\beta+1}}}
                {{j_{\beta+1}}\choose{j_{\beta+2}}}
                    \ldots{{j_{\beta+\gamma-1}}\choose{j_{\beta+\gamma}}}$.
        At last, $C_{j}\equiv_{2} 1$ holds if and only if coefficients
            $j_{\beta+1}, \ldots, j_{\beta+\gamma-1},j_{\beta+\gamma}$
        are $0$ them all and this implies that
        $\displaystyle j=\left(\underbrace{1,1,\ldots,1}_{\beta},\underbrace{0,0,\ldots,0}_{k-\beta+1}\right)_{2}, $
        in other words $j = 2^{\beta+1}-1$. As boundary case, to handle $C_{1}$ correctly
        (the argument above doesn't cover it because $\beta>0$) observe that
        $\displaystyle C_{1}\equiv_{2} {{2}\choose{2}}\equiv_{2} {{0}\choose{0}}{{1}\choose{1}}\equiv_{2}1, $
        as required.
\end{itemize}
\end{proof}

\iffalse
It is interesting to observe that if we use the ``traditional'' closed formula
for a Catalan coefficient $C_{j}$:
\begin{displaymath}
    (j+1)\,C_{j} = {{2j}\choose{j}}
\end{displaymath}
where $j=2\alpha+1$, it would have been hard to handle, because:
\begin{displaymath}
    2(\alpha+1)\,C_{j}\equiv_{2} {{0}\choose{1}}{{1}\choose{j_{1}}}
            \ldots{{j_{k-1}}\choose{j_{k}}} \equiv_{2} 0
\end{displaymath}
reduces to $0\equiv_{2}0$, giving no opportunity to derive any
property about coefficient $C_{j}$.
\fi

\input{catalan/first-column-include-figure.tex}

\subsection{On rows composed of \emph{odd} coefficients only}

\begin{theorem}
    Every row $\vect{r}_{2^{\alpha}-1}$ of $\mathcal{C}_{\equiv_{2}}$, with index $2^{\alpha}-1$,
    is composed of \emph{odd} coefficients only, for $\alpha\in\mathbb{N}$.
    \label{thm:odd:coeff:only:on:last:but:one:row}
\end{theorem}

\begin{proof}
    Choose any $\alpha\in\mathbb{N}$. The very first coefficient $d_{2^{\alpha}-1,0}$
    lying on row $\vect{r}_{2^{\alpha}-1}$ satisfies $d_{2^{\alpha}-1,0}\equiv_{2}1$.
    What about $d_{2^{\alpha}-1,1}$?  Recall that we can write it according to
    \autoref{eq:convolution:expansion:for:generic:element:in:catalan:array} as
    \begin{displaymath}
        d_{2^{\alpha}-1,1} = \sum_{i_{1}+ i_{2}=2^{\alpha}}{ C_{i_{1}-1}\,C_{i_{2}-1} }
    \end{displaymath}
    hence %indices $i_{1}$ and $i_{2}$ in the summation
    $2^{\alpha}$ divides $i_{1}+i_{2}$ \emph{exactly}, so
    $\displaystyle 1 = \frac{i_{1}}{2^{\alpha}}+\frac{i_{2}}{2^{\alpha}}$ for
            $i_{1},i_{2}\in\lbrace 0,\ldots,2^{\alpha}\rbrace$;
    %, which is the same to say that
    %$\frac{i_{1}}{2^{\alpha}}$ and $\frac{i_{2}}{2^{\alpha}}$ are both integers.
    this implies that there exists $\beta,\gamma\in\mathbb{N}$ both lesser or
    equal to  $\alpha$, such that $i_{1}=2^{\beta}$ and $i_{2}=2^{\gamma}$,
    respectively; by this fact, it follows that $C_{i_{1}-1}=C_{2^{\beta}-1}\equiv_{2}1$ and
    $C_{i_{2}-1}=C_{2^{\gamma}-1}\equiv_{2}1$, therefore $C_{i_{1}-1}\,C_{i_{2}-1}\equiv_{2}1$.

    By construction, if one index in
    $i_{1}+ i_{2}=2^{\alpha}$ gets fixed then the other does the same as well;
    in particular, there are $2^{\alpha}+1$ available choices for the first index and only
    $1$ for the second, formally
    \begin{displaymath}
        d_{2^{\alpha}-1,1} = \sum_{i_{1}+ i_{2}=2^{\alpha}}{ C_{i_{1}-1}\,C_{i_{2}-1} }
            \equiv_{2} \sum_{k=1}^{2^{\alpha}+1}{1}\equiv_{2} 2^{\alpha}+1\equiv_{2} 1\,.
    \end{displaymath}

    On the other hand, we write an arbitrary coefficient $d_{2^{\alpha}-1,s}$, where
    $s\in\lbrace{2,\ldots,2^{\alpha}-1}\rbrace$, as
    \begin{displaymath}
        d_{2^{\alpha}-1,s} = \sum_{i_{1}+i_{2}+\ldots+i_{s+1}=2^{\alpha}}
            {C_{i_{1}-1}\,C_{i_{2}-1}\ldots\,C_{i_{s+1}-1}}
    \end{displaymath}
    in order to repeat an argument similar to the previous one. In
    $\displaystyle 1 = \frac{i_{1}}{2^{\alpha}}+\ldots+\frac{i_{s+1}}{2^{\alpha}}$ there exists one
    index $i_{j}\in\lbrace 0,\ldots,2^{\alpha}\rbrace$ such that satisfies
    $i_{j}=2^{\alpha_{j}}$, for some $\alpha_{j}\leq\alpha$, which entails
    $C_{i_{j}-1}\equiv_{2}1$, for $j\in\lbrace1,\ldots,s+1\rbrace$. Therefore the congruences
    \begin{displaymath}
        d_{2^{\alpha}-1,s} \equiv_{2} \sum_{i_{1}+i_{2}+\ldots+i_{s+1}=2^{\alpha}}{1}
            \equiv_{2} {{s+2^{\alpha}}\choose{2^{\alpha}}},
    \end{displaymath}
    hold because the summation over indices $i_{1},\ldots,i_{s+1}$ asks to count the
    number of $2^{\alpha}$-combinations of $s+1$ distinct objects each of
    which may appear indefinitely often, in particular from $0$ to $2^{\alpha}$ times,
    hence the sought number is ${{(s+1)+2^{\alpha}-1}\choose{2^{\alpha}}}$
    according to \cite[equation 10 at page 7]{riordan:intro:combinatorial:analysis}.

    Again, we are interested in the parity of such coefficient, therefore
    write $s=s_{0}+s_{1}\,2+\ldots+s_{\alpha-1}\,2^{\alpha-1}$, because $s$ can equal
    $2^{\alpha}-1$ at most, and the application of the Lucas theorem yields
    \begin{displaymath}
        {{s+2^{\alpha}}\choose{2^{\alpha}}}\equiv_{2}
            {{s_{0}}\choose{0}}{{s_{1}}\choose{0}} \ldots
                {{s_{\alpha-1}}\choose{0}}{{1}\choose{1}}\equiv_{2}1
    \end{displaymath}
    which, in turn, entails that each coefficient lying on a row
    $\vect{r}_{2^{\alpha}-1}$ is odd, as required.
\end{proof}

\input{catalan/odd-row-include-figure.tex}
In \autoref{fig:catalan-odd-row} row $\vect{r}_{2^{4}-1}$ is highlighted.

\subsection{On rows composed of odd and even coefficients}

\begin{theorem}
    Let $\vect{r}_{2^{\alpha}}$ be a row of $\mathcal{C}_{\equiv_{2}}$,
    for some $\alpha\in\mathbb{N}$. Then, excluded the very first coefficient
    $d_{2^{\alpha},0}$ which is even, $\vect{r}_{2^{\alpha}}$ is composed of
    alternating even and odd coefficients. Formally:
    \begin{displaymath}
        d_{2^{\alpha},j}\equiv_{2}0 \leftrightarrow j = 2k+1
    \end{displaymath}
    for some $k\in\mathbb{N}$.
\end{theorem}

\begin{proof}
    Let $d_{2^{\alpha},j}$ be a coefficient lying on row $\vect{r}_{2^{\alpha}}$,
    for some $j\in\lbrace1,\ldots,2^{\alpha}\rbrace$. Since $\mathcal{C}$'s $A$-sequence is:
    \begin{displaymath}
        A_{\mathcal{C}}(t)=\frac{1}{1-t}=1+t+t^{2}+t^{3}+t^{4}+t^{5}+t^{6}+t^{7}+t^{8}+
            \mathcal{O}(t^{9})
    \end{displaymath}
    it follows that $d_{2^{\alpha},j}$ can be written as the combination of $r+2$
    coefficients lying on the previous row, namely $\vect{r}_{2^{\alpha}-1}$:
    \begin{displaymath}
        d_{2^{\alpha},j} = d_{2^{\alpha}-1,j-1} +d_{2^{\alpha}-1,j} +\ldots+d_{2^{\alpha}-1,j+r}
    \end{displaymath}
    where $r$ satisfies $r=2^{\alpha}-1-j$, so $2^{\alpha}-j+1$ coefficients are
    combined.  By \autoref{thm:odd:coeff:only:on:last:but:one:row},
    row $\vect{r}_{2^{\alpha}-1}$ is composed by \emph{odd}
    coefficients only, therefore proceed by cases on the parity of $j$:
    \begin{itemize}
        \item if $j$ is \emph{odd}, assume $j=2k+1$ for some $k\in\mathbb{N}$, then
            $2^{\alpha}-2k$ coefficients are combined, which is an \emph{even} number.
            Adding an \emph{even} number of \emph{odd} numbers yield an \emph{even} number;
        \item if $j$ is \emph{even}, assume $j=2k$ for some $k\in\mathbb{N}$, then
            $2^{\alpha}-2k+1$ coefficients are combined, which is an \emph{odd} number.
            Adding an \emph{odd} number of \emph{odd} numbers yield an \emph{odd} number.
    \end{itemize}
\end{proof}

\input{catalan/alternating-row-include-figure.tex}
In \autoref{fig:catalan-alternating-row} row $\vect{r}_{2^{4}}$ is highlighted.

\subsection{On the \emph{mirror} segment}

Before showing new theorems, we introduce the object
$\Phi^{(\alpha)}$ which denotes a particular segment contained
in the principal cluster $\mathcal{C}^{(\alpha+1)}$.
We call $\Phi^{(\alpha)}$ the \emph{mirror} segment in
$\mathcal{C}^{(\alpha+1)}$ and it is defined as follows:
\begin{displaymath}
    \Phi^{(\alpha)}=\diagup_{\lbrace 1,2,\ldots,2^{\alpha}-1\rbrace}^{2^{\alpha}-1}
\end{displaymath}

\begin{theorem}
    Choose any $\alpha\in\mathbb{N}$, then $\Phi^{(\alpha)}$ satisfies:
    \begin{displaymath}
        d_{s,2^{\alpha}-1}\in\Phi^{(\alpha)} \rightarrow d_{s,2^{\alpha}-1}\equiv_{2}0
    \end{displaymath}
    where $s\in rows\left(\Phi^{(\alpha)}\right)=\lbrace2^{\alpha},\ldots,2^{\alpha+1}-2\rbrace$.
    \label{thm:mirror:segment:definition}
\end{theorem}

\begin{proof}
Let $d_{s,2^{\alpha}-1}$ a coefficient in the segment $\Phi^{(\alpha)}$,
according to \autoref{eq:convolution:expansion:for:generic:element:in:catalan:array}
write it as:
\begin{displaymath}
    d_{s, 2^{\alpha}-1} = \sum_{i_{1}+i_{2}+\ldots+i_{2^{\alpha}}=s+1}
        {C_{i_{1}-1}\,C_{i_{2}-1}\cdots\,C_{i_{2^{\alpha}}-1}}
\end{displaymath}
Observe that, for $s\in\Phi^{(\alpha)}$, the number of Catalan
coefficients multiplied together in each summand is the same, namely
$2^{\alpha}$.  What changes respect to $s$ is the set of values each
index $i_{j}$ can take. In the following table we report instantiated sets
of values, depending on $s$, for both indexes and coefficients:
\begin{displaymath}
    \begin{array}{c|c|c}
        s = 2^{\alpha}
            & i_{j}\in\lbrace0,\ldots,2^{\alpha}+1\rbrace
            & C_{k}\in\lbrace C_{-1},\ldots,C_{2^{\alpha}}\rbrace\\
        s = 2^{\alpha} +1
            & i_{j}\in\lbrace0,\ldots,2^{\alpha}+2\rbrace
            & C_{k}\in\lbrace C_{-1},\ldots,C_{2^{\alpha}+1}\rbrace\\
        \vdots & \vdots&\vdots \\
        s = 2^{\alpha+1} -2
            & i_{j}\in\lbrace0,\ldots,2^{\alpha+1}-1\rbrace
            & C_{k}\in\lbrace C_{-1},\ldots,C_{2^{\alpha+1}-2}\rbrace\\
    \end{array}
\end{displaymath}
Set $\lbrace C_{-1},\ldots,C_{2^{\alpha}}\rbrace$ and set
$\lbrace C_{-1},\ldots,C_{2^{\alpha+1}-2}\rbrace$ are the smaller and the bigger one, respectively, and
have the same subset $\Omega^{(\alpha)}$ of \emph{odd} coefficients:
\begin{displaymath}
    \Omega^{(\alpha)}=\lbrace C_{-1}, C_{2^{\alpha-(\alpha-1)}-1},C_{2^{\alpha-(\alpha-2)}-1},\ldots,
        C_{2^{\alpha-1}-1},C_{2^{\alpha}-1}\rbrace
\end{displaymath}
where $\left|\Omega^{(\alpha)}\right|=\alpha+1$.
Since each summand term $C_{i_{1}-1}\,C_{i_{2}-1}\ldots\,C_{i_{2^{\alpha}}-1}$
has $2^{\alpha}$ coefficients, no matter if it contains each coefficient in $\Omega^{(\alpha)}$ and,
more importantly, one of them cannot belong to $\Omega^{(\alpha)}$:
the remaining ones make it vanish and $d_{s, 2^{\alpha}-1} \equiv_{2} 0$, for any suitable $s$,
as required.

\end{proof}

\input{catalan/mirror-segment-include-figure.tex}
In \autoref{fig:mirror-segment} the \emph{mirror} segment $\Phi^{(4)}$ is highlighted.

\subsection{On the \emph{dual} segment of the \emph{mirror} segment}

Next theorem needs a new piece of notation that allows us to identify a
new portion within a principal cluster $\mathcal{C}^{(\alpha+1)}$.
Let $\hat{\Phi}^{(\alpha)}$ denote the set $\left\lbrace d_{s,s-(2^{\alpha}-1)}\right\rbrace$,
for $s\in rows\left(\Phi^{(\alpha)}\right)$: we call $\hat{\Phi}^{(\alpha)}$
the \emph{dual} segment of the \emph{mirror} segment $\Phi^{(\alpha)}$.

\begin{theorem}
    Let  $\Phi^{(\alpha)}=\diagup_{\lbrace 1,2,\ldots,2^{\alpha}-1\rbrace}^{2^{\alpha}-1}$,
    be a \emph{mirror} segment in $\mathcal{C}^{(\alpha+1)}$, then:
    \begin{equation}
        d_{s,2^{\alpha}-1}\in\Phi^{(\alpha)}\rightarrow d_{s,s-(2^{\alpha}-1)}\equiv_{2}d_{s,2^{\alpha}-1}
    \end{equation}
    where $s\in rows\left(\Phi^{(\alpha)}\right)=\lbrace2^{\alpha},\ldots,2^{\alpha+1}-2\rbrace$.
\end{theorem}

\begin{proof}
    Use \autoref{eq:catalan:array:second:identity} on both members:
    \begin{displaymath}
        {{s+2^{\alpha}-1}\choose{2^{\alpha}-1}}- {{s+2^{\alpha}-1}\choose{2^{\alpha}-2}} \equiv_{2}
        {{2s-2^{\alpha}+1}\choose{s-2^{\alpha}+1}}- {{2s-2^{\alpha}+1}\choose{s-2^{\alpha}}}
    \end{displaymath}
    by symmetry property of binomial coefficients:
    \begin{displaymath}
        {{s+2^{\alpha}-1}\choose{s}}- {{s+2^{\alpha}-1}\choose{s+1}} \equiv_{2}
        {{2s-2^{\alpha}+1}\choose{s}}- {{2s-2^{\alpha}+1}\choose{s+1}}
    \end{displaymath}
    by simplification using $(-1)^{-1}\mod 2=1$:
    \begin{displaymath}
        {{s+2^{\alpha}-1}\choose{s}}+ {{s+2^{\alpha}-1}\choose{s+1}} \equiv_{2}
        {{2s-2^{\alpha}+1}\choose{s}}+ {{2s-2^{\alpha}+1}\choose{s+1}}
    \end{displaymath}
    by classic recurrence rule of binomial coefficients:
    \begin{displaymath}
        {{s+2^{\alpha}}\choose{s+1}} \equiv_{2} {{2s-2^{\alpha}+2}\choose{s+1}}
    \end{displaymath}
    since $s$ can assume $2^{\alpha}$ at least and $2^{\alpha+1}-2$ at most,
    $s$ can be written in base $2$ as follows:
    \begin{displaymath}
        s=s_{0} + s_{1}2 + s_{2}2^{2}+\ldots+s_{\alpha-1}2^{\alpha-1}+2^{\alpha}
    \end{displaymath}
    and applying Lucas theorem we get:
    \begin{displaymath}
        %\hspace{-2cm}
        {{s_{0}}\choose{s_{0}+1}}
        {{s_{1}}\choose{s_{1}}}
        \ldots
        {{s_{\alpha-1}}\choose{s_{\alpha-1}}}
        {{0}\choose{1}}
        {{1}\choose{0}}
        \equiv_{2}
        {{0}\choose{s_{0}+1}}
        {{s_{0}+1}\choose{s_{1}}}
        {{s_{1}}\choose{s_{2}}}
        \ldots
        {{s_{\alpha-2}}\choose{s_{\alpha-1}}}
        {{s_{\alpha-1}-1}\choose{1}}
        {{1}\choose{0}}
    \end{displaymath}
    simple algebra:
    \begin{displaymath}
        0
        \equiv_{2}
        {{0}\choose{s_{0}+1}}
        {{s_{0}+1}\choose{s_{1}}}
        {{s_{1}}\choose{s_{2}}}
        \ldots
        {{s_{\alpha-2}}\choose{s_{\alpha-1}}}
        {{s_{\alpha-1}-1}\choose{1}}
    \end{displaymath}
    %\marginpar{in order to finish this proof we have to introduce a lemma about
    %    the row of alternating odd and even coefficient, which can be proved using
    %    the $A$-sequence of $\mathcal{C}$}
    By cases on the parity of $s$:
    \begin{itemize}
        \item assume $s$ is \emph{even}, therefore $s_{0}=0$ and the right hand side vanishes due to ${{0}\choose{s_{0}+1}}=0$;
        \item assume $s$ is \emph{odd}, therefore $s_{0}=1$, so apply Lucas theorem to ${{0}\choose{2}}$ again,
            yielding ${{0}\choose{2}}\equiv_{2}{{0}\choose{0}}{{0}\choose{1}}\equiv_{2}0$.
    \end{itemize}
    both cases shows that right hand side is a multiple of $p$, as required.
\end{proof}

\input{catalan/dual-of-mirror-segment-include-figure.tex}
In \autoref{fig:dual-of-mirror-segment} the \emph{dual} segment $\hat{\Phi}^{(4)}$
    %$\left\lbrace d_{s,s-(2^{4}-1)}\right\rbrace$,
    %for $s\in rows\left(\Phi^{(4)}\right)$,
    of \emph{mirror} segment $\Phi^{(4)}$, within $\mathcal{C}_{\equiv_{2}}^{(5)}$, is highlighted.

\subsection{On the \emph{upside-down} zero-hole}

\begin{theorem}
    Let $\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$ be a principal cluster
    of order $\alpha+1$ of the Catalan array $\mathcal{C}$. Then, $\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$
    contains an \emph{upside-down} zero-hole of order $\alpha$, denoted by $H_{\bigtriangleup}^{({\alpha})}$,
    such that coefficient $d_{n,k}\in H_{\bigtriangleup}^{({\alpha})}$ if
    $n\in\lbrace 2^{{\alpha}},\ldots,2^{{\alpha}+1}-2\rbrace$ and
    $k\in\lbrace 0,\ldots, n-2^{{\alpha}}\rbrace$.
    \label{thm:upside:down:zero:hole}
\end{theorem}

%It is simple to observe that $H_{\bigtriangleup}^{({\alpha})}\subset \mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$.

\begin{proof}
We repeatedly use the approach
of the proof about the \emph{mirror} segment, considering the set of columns
$\Xi=\lbrace \vect{c}_{0},\ldots, \vect{c}_{2^{{\alpha}}-2}\rbrace$ and
for each column $\vect{c}_{k}\in\Xi$, the segment
    $\diagup_{\lbrace 2^{\alpha},2^{\alpha}+1,\ldots,2^{\alpha+1}-2-k\rbrace}^{k}$.

If we start from the column $\vect{c}_{0}$ on the very left,
then the corresponding set of row indices is a segment of Catalan numbers:
\begin{displaymath}
    S_{0}=\diagup_{\lbrace 2^{\alpha},2^{\alpha}+1,\ldots,2^{\alpha+1}-2\rbrace}^{0}
        = \lbrace C_{2^{\alpha}},C_{2^{\alpha}+1},\ldots,C_{2^{\alpha+1}-2}\rbrace
\end{displaymath}
since no coefficient $C_{j}\in S_{0}$ has the shape $C_{2^{\alpha}-1}$,
all coefficients in $S_{0}$ are even.

In turn, take into account column $\vect{c}_{1}$, so the corresponding segment is
%\begin{displaymath}
    $S_{1}=\diagup_{\lbrace 2^{\alpha},2^{\alpha}+1,\ldots,2^{\alpha+1}-3\rbrace}^{1}$
    %S_{1}=\lbrace d_{2^{{\alpha}}+1,1},\ldots,d_{2^{{\alpha}+1}-2,1} \rbrace
%\end{displaymath}
and coefficients in it are defined according to
$d_{s, 1} = \sum_{i_{1}+i_{2}=s+1} {C_{i_{1}-1}\,C_{i_{2}-1}}$,
where $s\in rows(S_{1})= \left\lbrace 2^{\alpha}+1,2^{\alpha}+2,\ldots,2^{\alpha+1}-2\right\rbrace$.
This is quite similar to the proof developed for the \emph{mirror} segment,
with the difference that summand term is composed of two coefficients, namely
$C_{i_{1}-1}\,C_{i_{2}-1}$ instead of $2^{{\alpha}}$ coefficients as in the previous proof,
therefore the same argument applies,
since if multiplying $2^{{\alpha}}$ coefficients fails to make \emph{not} vanish
the summand term, modulo $2$, the same failure is reached if multiplying only $2$ coefficients.

The same reasoning holds for remaining columns in $\Xi$: the last one of them is
$\vect{c}_{2^{\alpha}-2}$ (with only \emph{one} coefficient, namely $d_{2^{\alpha}-2,2^{\alpha}-2}$),
hence $H_{\bigtriangleup}^{({\alpha})}$ is an \emph{upside-down} zero-holes of order $\alpha$,
positioned at the very left in the bottom half of $\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$, as required.

\end{proof}

\input{catalan/zero-hole-include-figure.tex}
In \autoref{fig:catalan-zero-hole} is reported $H_{\bigtriangleup}^{(4)}$.

\subsection{On two \emph{mirrored} clusters}

\begin{theorem}
    Let $\Phi^{(\alpha)}=\diagup_{\lbrace 2,\ldots,2^{\alpha}-1\rbrace}^{2^{\alpha}-1}$
    be a \emph{mirror} segment and $d_{s,2^{{\alpha}}-1}$
    be a coefficient in $\Phi^{(\alpha)}$, for some $s\in rows\left(\Phi^{(\alpha)}\right)$. Then:
    \begin{displaymath}
        d_{s-e,2^{{\alpha}}-1-e} \equiv_{2} d_{s,2^{{\alpha}}-1+e}
    \end{displaymath}
    for $e\in\lbrace1,\ldots,s-2^{{\alpha}}\rbrace$.
    \label{thm:two:mirrored:clusters}
\end{theorem}

\begin{proof}
In this proof we use \autoref{eq:catalan:array:second:identity} as
an identity defining the generic coefficient. It allows to rewrite the left hand side
of the argument:
\begin{displaymath}
    d_{s-e,2^{{\alpha}}-1-e}= {{2(s-e)-(2^{{\alpha}}-1-e)}\choose{(s-e)-(2^{{\alpha}}-1-e)}}
        - {{2(s-e)-(2^{{\alpha}}-1-e)}\choose{(s-e)-(2^{{\alpha}}-1-e)-1}};
\end{displaymath}
in the same spirit, the same can be applied to the right hand side:
\begin{displaymath}
    d_{s,2^{{\alpha}}-1+e}={{2s-(2^{{\alpha}}-1+e)}\choose{s-(2^{{\alpha}}-1+e)}}
        - {{2s-(2^{{\alpha}}-1+e)}\choose{s-(2^{{\alpha}}-1+e)-1}},
\end{displaymath}
therefore:
\begin{displaymath}
    \begin{split}
        {{2s-e-2^{{\alpha}}+1}\choose{s-2^{{\alpha}}+1}}
            - {{2s-e-2^{{\alpha}}+1}\choose{s-2^{{\alpha}}}}
        &\equiv_{2}
        {{2s-2^{{\alpha}}+1-e}\choose{s-2^{{\alpha}}+1-e}}
            - {{2s-2^{{\alpha}}+1-e}\choose{s-2^{{\alpha}}-e}}\\
        {{2s-e-2^{{\alpha}}+1}\choose{s-e}}
            - {{2s-e-2^{{\alpha}}+1}\choose{s-e+1}}
        &\equiv_{2}
        {{2s-2^{{\alpha}}+1-e}\choose{s}}
            - {{2s-2^{{\alpha}}+1-e}\choose{s+1}}\\
    \end{split}
\end{displaymath}

Since $e\in\lbrace1,\ldots,s-2^{{\alpha}}\rbrace$, proceed by complete induction on $e$:
\begin{itemize}
    \item base case $e=1$ yield the following congruence:
        \begin{displaymath}
                {{2s-2^{{\alpha}}}\choose{s-1}}-{{2s-2^{{\alpha}}}\choose{s}}
                \equiv_{2}
                {{2s-2^{{\alpha}}}\choose{s}}-{{2s-2^{{\alpha}}}\choose{s+1}}\\
        \end{displaymath}
        which is the same to say:
        \begin{displaymath}
                {{2s-2^{{\alpha}}}\choose{s-1}}+{{2s-2^{{\alpha}}}\choose{s+1}} \equiv_{2} 0.
        \end{displaymath}
        Let $s=s_{0}+s_{1}\,2+s_{2}\,2^{2}+\ldots+s_{{\alpha}-1}\,2^{{\alpha}-1} + 2^{{\alpha}}$
        be the generic representation of $s$ in base $2$, since
        $s\in\lbrace 2^{{\alpha}}+1,\ldots,2^{{\alpha}+1}-2 \rbrace$; also
        let $2s-2^{{\alpha}}=s_{0}\,2+s_{1}\,2^{2}+s_{2}\,2^{3}+\ldots+s_{{\alpha}-1}^{*}\,2^{{\alpha}} + s_{{\alpha}}^{*}\,2^{{\alpha}+1}$,
        where $(s_{{\alpha}-1}^{*},s_{{\alpha}}^{*})$ equals $(0,1)$ if $s_{{\alpha}-1}=1$, otherwise equals $(1,0)$.
        By cases on the parity of $s$:
        \begin{itemize}
            \item assume $s$ even, therefore both $s-1$ and $s+1$ are odd, so
                let $\hat{s}=1+\hat{s}_{1}\,2+\hat{s}_{2}\,2^{2}+\ldots+
                    \hat{s}_{{\alpha}-1}\,2^{{\alpha}-1}+2^{{\alpha}}$ be one of them, hence:
                \begin{displaymath}
                        {{2s-2^{{\alpha}}}\choose{\hat{s}}}
                        \equiv_{2}
                        {{0}\choose{1}}
                        {{0}\choose{\hat{s}_{1}}}
                        {{s_{1}}\choose{\hat{s}_{2}}}
                        \ldots
                        {{s_{{\alpha}-2}}\choose{\hat{s}_{{\alpha}-1}}}
                        {{s_{{\alpha}-1}^{*}}\choose{1}}
                        {{s_{{\alpha}}^{*}}\choose{0}} = 0.
                \end{displaymath}
                Observe $\hat{s}_{{\alpha}}=1$ against boundary cases:
                if $s=2^{{\alpha}}+1$ then $\hat{s}=s-1=2^{{\alpha}}$, on the other
                hand if $s=2^{{\alpha}+1}-2$ then $\hat{s}=s+1=2^{{\alpha}+1}-1$,
                therefore in both cases the coefficient of $2^{{\alpha}}$ is $1$.
                Eventually we get $0+0 \equiv_{2}0$, which holds;

            \item assume $s$ odd, therefore both $s-1$ and $s+1$ are even,
                let's study the former:
                \begin{displaymath}
                        {{2s-2^{{\alpha}}}\choose{s-1}}
                        \equiv_{2}
                        {{0}\choose{0}}
                        {{1}\choose{s_{1}}}
                        {{s_{1}}\choose{s_{2}}}
                        \ldots
                        {{s_{{\alpha}-2}}\choose{s_{{\alpha}-1}}}
                        {{s_{{\alpha}-1}^{*}}\choose{1}}
                        {{s_{{\alpha}}^{*}}\choose{0}}
                \end{displaymath}
                in order for the right hand side to not vanish, modulo $2$,
                it is mandatory for coefficients $\lbrace s_{i}\rbrace_{i\in\lbrace1,\ldots,{\alpha}-2\rbrace}$
                to satisfy $s_{i}\geq s_{i+1}$: if any one of them is $0$, say $s_{j}$, then
                $s_{j+1},\ldots,s_{j+k}$, with $j+k={\alpha}-1$,
                have to be all $0$ too. In particular, if $s_{{\alpha}-1}=0$ then
                $(s_{{\alpha}-1}^{*},s_{{\alpha}}^{*})=(1,0)$
                therefore the right hand side reduces to $1$, modulo $2$.
                Observe that coefficients $\lbrace s_{i}\rbrace_{i\in\lbrace1,\ldots,{\alpha}-2\rbrace}$
                cannot be all $1$ otherwise
                $s=(\underbrace{1,1,1,\ldots,1}_{{\alpha}+1})_{2}=2^{{\alpha}+1}-1$ raises a contradiction, because
                $s$ can assume $2^{{\alpha}+1}-2$ at most.

                For the latter, namely $s+1$, assume $s$ can be represented as:
                \begin{displaymath}
                    (\underbrace{1,1,\ldots,1}_{r},0,s_{r+1},s_{r+2},\ldots,s_{{\alpha}-1},1)_{2}
                \end{displaymath}
                for $r\in\lbrace1,\ldots,{\alpha}-2\rbrace$. Since a $0$ must occur, otherwise $s=2^{{\alpha}+1}-1$
                which cannot be the case as we've already seen, adding $1$ yield the representation:
                \begin{displaymath}
                    (\underbrace{0,0,\ldots,0}_{r},1,s_{r+1},s_{r+2},\ldots,s_{{\alpha}-1},1)_{2}
                \end{displaymath}
                Therefore we have:
                \begin{displaymath}
                    %\hspace{-2cm}
                    {{2s-2^{{\alpha}}}\choose{s+1}}
                    \equiv_{2}
                    \underbrace{
                        {{0}\choose{0}}
                        {{1}\choose{0}}
                        {{1}\choose{0}}
                        \ldots
                        {{1}\choose{0}}
                    }_{r}
                    {{1}\choose{1}}
                    {{0}\choose{s_{r+1}}}
                    {{s_{r+1}}\choose{s_{r+2}}}
                    \ldots
                    {{s_{{\alpha}-2}}\choose{s_{{\alpha}-1}}}
                    {{s_{{\alpha}-1}^{*}}\choose{1}}
                    {{s_{{\alpha}}^{*}}\choose{0}}
                \end{displaymath}
                In order to not vanish, modulo $2$,
                $s_{r+1}$ has to be $0$; eventually, this property propagates among $s_{r+2}, \ldots, s_{{\alpha}-1}$.
                But if they are all $0$, %$s_{{\alpha}-1}=0$
                then $(s_{{\alpha}-1}^{*},s_{{\alpha}}^{*})=(1,0)$, therefore the right hand side reduces to $1$.

                Combining the above cases for $s$ odd we reach:
                \begin{displaymath}
                        {{2s-2^{{\alpha}}}\choose{s-1}}+{{2s-2^{{\alpha}}}\choose{s+1}} \equiv_{2} 1+1\equiv_{2} 0
                \end{displaymath}
        \end{itemize}

        \item assume the argument holds for $k\leq e$ and prove for $k=e+1$, so we need to show:
            \begin{displaymath}
                \footnotesize
                %\hspace{-3cm}
                \begin{split}
                    {{2s-(e+1)-2^{{\alpha}}+1}\choose{s-2^{{\alpha}}+1}}
                        - {{2s-(e+1)-2^{{\alpha}}+1}\choose{s-2^{{\alpha}}}}
                    &\equiv_{2}
                    {{2s-2^{{\alpha}}+1-(e+1)}\choose{s-2^{{\alpha}}+1-(e+1)}}
                        - {{2s-2^{{\alpha}}+1-(e+1)}\choose{s-2^{{\alpha}}-(e+1)}}\\
                    {{2s-(e+1)-2^{{\alpha}}+1}\choose{s-(e+1)}}
                        - {{2s-(e+1)-2^{{\alpha}}+1}\choose{s-(e+1)+1}}
                    &\equiv_{2}
                    {{2s-2^{{\alpha}}+1-(e+1)}\choose{s}}
                        - {{2s-2^{{\alpha}}+1-(e+1)}\choose{s+1}}\\
                    {{2s-e-2^{{\alpha}}}\choose{s-e-1}}
                        - {{2s-e-2^{{\alpha}}}\choose{s-e}}
                    &\equiv_{2}
                    {{2s-2^{{\alpha}}-e}\choose{s}}
                        - {{2s-2^{{\alpha}}-e}\choose{s+1}}\\
                \end{split}
            \end{displaymath}
            which follows directly by complete induction hypothesis.
\end{itemize}

\end{proof}

\input{catalan/mirrored-clusters-include-figure.tex}
In \autoref{fig:catalan-mirrored-clusters} some coefficients in \emph{mirrored}
cluster $\mathcal{C}_{\equiv_{2}}^{(4)}$ are highlighted.

\subsection{$\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$
    contains a copy of $\mathcal{C}_{\equiv_{2}}^{(\alpha)}$}

In order to fully characterize $\mathcal{C}$ in a modular context we are
left with a last theorem.

\begin{theorem}
    $\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$
    contains a copy of $\mathcal{C}_{\equiv_{2}}^{(\alpha)}$,
    located at the very right of its bottom half. Formally,
    let $\Phi^{(\alpha)}=\diagup_{\lbrace 2,\ldots,2^{\alpha}-1\rbrace}^{2^{\alpha}-1}$
    be a \emph{mirror} segment and $d_{s,2^{{\alpha}}-1}$
    be a coefficient in $\Phi^{(\alpha)}$, for some $s\in rows\left(\Phi^{(\alpha)}\right)$. Then:
    \begin{displaymath}
        d_{s,2^{{\alpha}}-1+e} \equiv_{2} d_{s-2^{{\alpha}},e-1}
    \end{displaymath}
    for $e\in\lbrace1,\ldots,s-2^{{\alpha}}\rbrace$.
    \label{thm:principal:cluster:copy:containment}
\end{theorem}

\begin{proof}
We tackle the proof using \autoref{eq:catalan:array:second:identity}:
\begin{displaymath}
    %\hspace{-4cm}
    \begin{split}
        {{2s-(2^{{\alpha}}-1+e)}\choose{s-(2^{{\alpha}}-1+e)}} - {{2s-(2^{{\alpha}}-1+e)}\choose{s-(2^{{\alpha}}-1+e)-1}}
        &\equiv_{2}
        {{2(s-2^{{\alpha}})-(e-1)}\choose{(s-2^{{\alpha}})-(e-1)}} - {{2(s-2^{{\alpha}})-(e-1)}\choose{(s-2^{{\alpha}})-(e-1)-1}}\\
        {{2s-2^{{\alpha}}+1-e}\choose{s-2^{{\alpha}}+1-e}} - {{2s-2^{{\alpha}}+1-e}\choose{s-2^{{\alpha}}-e}}
        &\equiv_{2}
        {{2s-2^{{\alpha}+1}-e+1}\choose{s-2^{{\alpha}}-e+1}} - {{2s-2^{{\alpha}+1}-e+1}\choose{s-2^{{\alpha}}-e}}\\
        {{2s-2^{{\alpha}}+1-e}\choose{s}} - {{2s-2^{{\alpha}}+1-e}\choose{s+1}} &\equiv_{2}
        {{2s-2^{{\alpha}+1}-e+1}\choose{s-2^{{\alpha}}}} - {{2s-2^{{\alpha}+1}-e+1}\choose{s-2^{{\alpha}}+1}}\\
    \end{split}
\end{displaymath}
Since $e\in\lbrace1,\ldots,s-2^{{\alpha}}\rbrace$, proceed by complete induction on $e$:
    \begin{itemize}
        \item for the base case $e=1$ we have:
            \begin{displaymath}
                %\begin{split}
                    {{2s-2^{{\alpha}}}\choose{s}} - {{2s-2^{{\alpha}}}\choose{s+1}} \equiv_{2}
                        {{2s-2^{{\alpha}+1}}\choose{s-2^{{\alpha}}}} - {{2s-2^{{\alpha}+1}}\choose{s-2^{{\alpha}}+1}}.
                %\end{split}
            \end{displaymath}
            In the previous proof a detailed (and boring) derivation has been performed,
            here we observe that upper terms of each binomial coefficient, $2s-2^{{\alpha}}$
            and $2s-2^{{\alpha}+1}$ respectively, have $2$ in their prime factorization, therefore
            expanding each binomial, $2$ can be factored out in turn, making congruent $0$
            each one of them. However an approach similar to the previous one can be
            taken as well.

        \item assume the argument holds for $k\leq e$ and prove for $k=e+1$, so we need to show:
            \begin{displaymath}
                %\hspace{-3cm}
                \footnotesize
                \begin{split}
                    {{2s-2^{{\alpha}}+1-(e+1)}\choose{s}} - {{2s-2^{{\alpha}}+1-(e+1)}\choose{s+1}}
                    &\equiv_{2}
                    {{2s-2^{{\alpha}+1}-(e+1)+1}\choose{s-2^{{\alpha}}}} - {{2s-2^{{\alpha}+1}-(e+1)+1}\choose{s-2^{{\alpha}}+1}}\\
                    {{2s-2^{{\alpha}}-e}\choose{s}} - {{2s-2^{{\alpha}}-e}\choose{s+1}}
                    &\equiv_{2}
                    {{2s-2^{{\alpha}+1}-e}\choose{s-2^{{\alpha}}}} - {{2s-2^{{\alpha}+1}-e}\choose{s-2^{{\alpha}}+1}}\\
                \end{split}
            \end{displaymath}
            which follows directly by complete induction hypothesis.
    \end{itemize}
\end{proof}

\input{catalan/principal-cluster-include-figure.tex}

Before concluding the modular characterization of $\mathcal{C}$,
we would like to observe that the last two
theorems do not say anything about the \emph{value} of remainder for
a coefficient belonging to sub triangles of interest:
we have only shown that a \emph{complete} sub triangle is repeated
when coefficients are taken modulo $2$.

\subsection{A cheaper procedure to build $\mathcal{C}_{\equiv_{2}}$}

We have used \autoref{thm:mirror:segment:definition},
\autoref{thm:upside:down:zero:hole}, \autoref{thm:two:mirrored:clusters} and
\autoref{thm:principal:cluster:copy:containment} to build an efficient
procedure, written using the Python language, that builds $\mathcal{C}_{\equiv_{2}}$
inductively without resorting to the hard-way approach. The latter consists of
computing the matrix expansion of $\mathcal{C}$ by doing convolutions and
series expansion of each column, then taking each coefficient $c_{n,k}\in\mathcal{C}$ modulo 2.
On the contrary, the former uses theorems to
assemble $\mathcal{C}_{\equiv_{2}}$ block-wise: it builds a principal cluster
$\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$ consuming a principal cluster
$\mathcal{C}_{\equiv_{2}}^{(\alpha)}$, treating it as a whole block. For the sake of clarity,
let us divide $\mathcal{C}_{\equiv_{2}}^{(\alpha+1)}$ in half obtaining two strips, then the former approach acts as follows:
first, it places $\mathcal{C}_{\equiv_{2}}^{(\alpha)}$ in the top strip -- which is a triangle itself;
second, it places another copy of $\mathcal{C}_{\equiv_{2}}^{(\alpha)}$ on the very right portion in the bottom strip;
third, it mirrors last copied block respect to the mirror segment;
finally, it fills with zeros the upside-down triangle on the very left portion in the bottom strip.
Such procedure is much faster and easier to code that the one that implements definitions explicitly.