% vim: ft=tex

\chapter{The Stabilizer Formalism}

The stabilizer formalism was originally introduced by Gottesman
\cite{gottesman1997} for quantum error correction and is a useful tool to
encode quantum information such that it is protected against noise. The
prominent Shor code \cite{shor1995} is an example of a stabilizer code
(although it was discovered before the stabilizer formalism was discovered), as
are the 3-qbit bit-flip and phase-flip codes.

It was only later that Gottesman and Knill discovered that stabilizer states
can be simulated in polynomial time on a classical machine
\cite{gottesman2008}. This performance has since been improved to $n\log(n)$
time on average \cite{andersbriegel2005}.

\section{Stabilizers and Stabilizer States}

\subsection{Local Pauli Group and Multilocal Pauli Group}

\begin{definition}
    \begin{equation}
        P := \{\pm I, \pm X, \pm Y, \pm Z, \pm iI, \pm iX, \pm iY, \pm iZ\}
    \end{equation}

    with the matrix product is called the Pauli group \cite{andersbriegel2005}.
\end{definition}

The group property of $P$ can be verified easily. Note that the elements of $P$
either commute or anticommute.

\begin{definition}
    For $n$ qbits

    \begin{equation}
        P_n := \left\{\bigotimes\limits_{i=0}^{n-1} p_i \middle| p_i \in P\right\}
    \end{equation}

    is called the multilocal Pauli group on $n$ qbits \cite{andersbriegel2005}. 
\end{definition}

The group property of $P_n$ and the (anti-)commutator relationships follow
directly from its definition via the tensor product.
%Further are $p \in P_n$ hermitian and have the eigenvalues $\pm 1$ for
%$p \neq \pm I$, $+1$ for $p = I$  and $-1$ for $p = -I$.

\subsection{Stabilizers}

The discussion below follows the argumentation given in \cite{nielsen_chuang_2010}.

\begin{definition}
    \label{def:stabilizer}
    An abelian subgroup $S = \{S^{(0)}, ..., S^{(N)}\}$ of $P_n$ is called a set of stabilizers iff
    \begin{enumerate}
        \item{$\forall i,j = 1, ..., N$: $[S^{(i)}, S^{(j)}] = 0$%: $S^{(i)}$ and $S^{(j)}$ commute
            }
        \item{$-I \notin S$ }
    \end{enumerate}
\end{definition}

\begin{lemma}
    If $S$ is a set of stabilizers, the following statements follow
    directly:

    \begin{enumerate}
        \item{$\pm iI \notin S$}
        \item{$(S^{(i)})^2 = I$ for all $i$}
        \item{$S^{(i)}$ are hermitian for all $i$ }
    \end{enumerate}
\end{lemma}
\begin{proof}

    \begin{enumerate}
        \item{$(iI)^2 = (-iI)^2 = -I$. Which contradicts the definition of $S$.}
        \item{From the definition of $S$ ($P_n$ respectively) follows that any
            $S^{(i)} \in S$ has the form $\pm i^l \left(\bigotimes\limits_{j=0}^{n-1} \tilde{p}_j\right)$ where
            $\tilde{p}_j \in \{X, Y, Z, I\}$ and $l \in \{0, 1\}$. As $\left(\bigotimes\limits_{j=0}^{n-1} \tilde{p}_j\right)$
            is hermitian and unitary $(S^{(i)})^2$ is either $+I$ or $-I$. As $-I \notin S$ $(S^{(i)})^2 = I$ follows directly. 
            }
        \item{Following the argumentation above $\left(S^{(i)}\right)^2 = -I \Leftrightarrow l=1$ 
            therefore $\left(S^{(i)}\right)^2 = -I \Leftrightarrow \left(S^{(i)}\right)^\dagger \neq S^{(i)}$.}
    \end{enumerate}

\end{proof}

Considering all the elements of a group can be impractical for some
calculations, the generators of a group are introduced. Often it is enough to
discuss the generator's properties in order to understand the properties of the
group.

\begin{definition}
    For a finite group $G$ and some $m \in \mathbb{N}$ one denotes the
    generators of G

    \begin{equation} \langle g_1, ..., g_m \rangle \equiv \langle g_i
    \rangle_{i=1,...,m}\end{equation}

    where $g_i \in G$, every element in $G$ can be written as a product of the
    $g_i$ and $m$ is the smallest integer for which these statements hold.
\end{definition}

In the following discussions $\langle S^{(i)} \rangle_{i=0, ..., n-1}$ will be
used as the required properties of a set of stabilizers that can be studied on
its generators.

\subsection{Stabilizer States}
\label{ref:stab_states}

One important basic insight from quantum mechanics is that hermitian operators
have real eigenvalues and eigenspaces which are associated with these
eigenvalues. Finding these eigenvalues and eigenvectors is what one calls
solving a quantum mechanical system. One of the most fundamental insights of
quantum mechanics is that commuting operators have a common set of
eigenvectors, i.e. they can be diagonalized simultaneously. This motivates and
justifies the following definition.

\begin{definition}
    For a set of stabilizers $S$ the vector space

    \begin{equation}
        V_S := \left\{\ket{\psi} \middle| S^{(i)}\ket{\psi} = +1\ket{\psi} \forall S^{(i)} \in S\right\}
    \end{equation}

    is called the space of stabilizer states associated with $S$ and one says
    $\ket{\psi}$ is stabilized by $S$ \cite{nielsen_chuang_2010}.
\end{definition}

It is clear that to show the stabilization property of $S$ the proof for the
generators is sufficient, as all the generators forming an element in $S$ can
be absorbed into $\ket{\psi}$.  The dimension of $V_S$ is not immediately
clear. One can however show that for a set of stabilizers $\langle S^{(i)}
\rangle_{i=1, ..., n-m}$ the dimension $\dim V_S = 2^m$ \cite[Chapter
10.5]{nielsen_chuang_2010}. This yields the following important result:

\begin{theorem} \label{thm:unique_s_state} For a $n$ qbit system and
    stabilizers $S = \langle S^{(i)} \rangle_{i=1, ..., n}$ the stabilizer
    space $V_S$ has $\dim V_S = 1$, in particular there exists an up to
    a trivial phase unique state $\ket{\psi}$ that is stabilized by $S$.
    
    Without proof.  \end{theorem}

In the following discussions for $n$ qbits a set $S = \langle S^{(i)}
\rangle_{i=1,...,n}$ of $n$ independent stabilizers will be assumed.


\subsection{Dynamics of Stabilizer States}
\label{ref:dynamics_stabilizer}

Consider a $n$ qbit state $\ket{\psi}$ that is the $+1$ eigenstate of $S
= \langle S^{(i)} \rangle_{i=1,...,n}$ and a unitary transformation $U$ that
describes the dynamics of the system, i.e. 

\begin{equation} \ket{\psi'} = U \ket{\psi} \end{equation}

It is clear that in general $\ket{\psi'}$ will not be stabilized by $S$
anymore. There are however some statements that can be made
\cite{nielsen_chuang_2010}:

\begin{equation}
    \begin{aligned}
    \ket{\psi'} &= U \ket{\psi} \\
                &= U S^{(i)} \ket{\psi} \\
                &= U S^{(i)} U^\dagger U\ket{\psi} \\
                &= U S^{(i)} U^\dagger \ket{\psi'} \\
                &= S^{\prime(i)} \ket{\psi'} \\
    \end{aligned}
\end{equation}

Note that in Definition \ref{def:stabilizer} it has been demanded that
stabilizers are a subgroup of the multilocal Pauli operators. This does not
hold true for an arbitrary $U$ but there exists a group for which $S'$ will be
a set of stabilizers.

\begin{definition}
    \label{def:clifford_group}
    For $n$ qbits
    \begin{equation}
        C_n := \left\{U \in U(2^n) \middle| \forall p \in P_n: UpU^\dagger \in P_n \right\}
    \end{equation}

    is called the Clifford group. $C_1 =: C_L$ is called the local Clifford
    group \cite{andersbriegel2005}.
\end{definition}

\begin{theorem}
    \label{thm:clifford_group_approx}
    \begin{enumerate}
        \item{$C_L$ can be generated using only $H$ and $S$.}
        \item{$C_L$ can be generated from $\sqrt{iZ} = \exp(\frac{i\pi}{4}) S^\dagger$ 
            and $\sqrt{-iX} = \frac{1}{\sqrt{2}} \left(\begin{array}{cc} 1 & -i
            \\ -i & 1 \end{array}\right)$. 

                Also $C_L$ is generated by a product of at most $5$ matrices
            $\sqrt{iZ}$, $\sqrt{-iX}$.  }
            \item{$C_n$ can be generated using $C_L$ and $CZ$ or $CX$.} 
    \end{enumerate} 
\end{theorem}

\begin{proof}
    \begin{enumerate}
        \item{See \cite[Theorem 10.6]{nielsen_chuang_2010}}
        \item{
            One can easily verify that $\sqrt{iZ} \in C_L$ and $\sqrt{-iX} \in C_L$.
            Further one can show that (up to a global phase)
            $H = \sqrt{iZ} \sqrt{-iX}^3 \sqrt{iZ}$ and $S = \sqrt{iZ}^3$.

            The length of the product can be seen when explicitly calculating 
            $C_L$.
            }
        \item{See \cite[Theorem 10.6]{nielsen_chuang_2010}}
    \end{enumerate} 
\end{proof}

This is quite an important result: As under a transformation $U \in C_n$ $S'
= U S U^\dagger$ is a set of $n$ independent stabilizers and $\ket{\psi'}$ is
stabilized by $S'$ one can consider the dynamics of the stabilizers instead of
the actual state. This is considerably more efficient as only $n$ stabilizers
have to be modified, each being just the tensor product of $n$ Pauli matrices.
This has led to the simulation using stabilizer tableaux
\cite{gottesman_aaronson2008}\cite{CHP}.

\subsection{Measurements on Stabilizer States} \label{ref:meas_stab}

Interestingly also measurements are dynamics covered by the stabilizers
\cite{nielsen_chuang_2010}.  When an observable $g_a \in \{\pm X_a, \pm Y_a,
\pm Z_a\}$ acting on qbit $a$ is measured one has to consider the projector

\begin{equation} 
P_{g_a,s} = \frac{I + (-1)^s g_a}{2}.  
\end{equation}

If now $g_a$ commutes with all $S^{(i)}$ a result of $s=0$ is measured with
probability $1$ and the stabilizers are left unchanged:

\begin{equation}
    \begin{aligned}
        \ket{\psi'} &= \frac{I + g_a}{2}\ket{\psi} \\
                    &= \frac{I + g_a}{2}S^{(i)} \ket{\psi} \\
                    &= S^{(i)} \frac{I + g_a}{2}\ket{\psi} \\
                    &= S^{(i)}\ket{\psi'} \\
    \end{aligned}
\end{equation}

As the state that is stabilized by $S$ is unique $\ket{\psi'} = \ket{\psi}$
\cite{nielsen_chuang_2010}.  

If $g_a$ does not commute with all stabilizers the following lemma gives the
result of the measurement.

\begin{lemma}
    \label{lemma:stab_measurement} Let $J := \left\{ S^{(i)} \middle| [g_a,
    S^{(i)}] \neq 0\right\} \neq \{\}$ and $J^c := \left\{S^{(i)} \middle|
S^{(i)} \notin J \right\}$. When measuring $\frac{I + (-1)^s g_a}{2} $ $s=1$
and $s=0$ are obtained with probability $\frac{1}{2}$ and after choosing a $j
\in J$ the new state $\ket{\psi'}$ is stabilized by \cite{nielsen_chuang_2010} 
    \begin{equation}
        \langle \{(-1)^s g_a\} \cup \left\{S^{(i)} S^{(j)} \middle| S^{(i)} \in J \setminus \{S^{(j)}\} \right\} \cup J^c \rangle.
    \end{equation}
\end{lemma}

\begin{proof}
    As $g_a$ is a Pauli operator and $S^{(i)} \in J$ are multi-local Pauli
    operators, $S^{(i)}$ and $g_a$ anticommute. Choose a $S^{(j)} \in J$. Then

    \begin{equation}
    \begin{aligned}
        P(s=0) &= \left|\hbox{Tr}\left(\frac{I + g_a}{2}\ket{\psi}\bra{\psi}\right) \right|\\
                &= \left|\hbox{Tr}\left(\frac{I + g_a}{2}S^{(j)} \ket{\psi}\bra{\psi}\right)\right|\\
                &= \left|\hbox{Tr}\left(S^{(j)}\frac{I - g_a}{2}\ket{\psi}\bra{\psi}\right)\right|\\
                &= \left|\hbox{Tr}\left(\frac{I - g_a}{2}\ket{\psi}\bra{\psi}S^{(j)}\right)\right|\\
                &= \left|\hbox{Tr}\left(\frac{I - g_a}{2}\ket{\psi}\bra{\psi}\right)\right|\\
                &= P(s=1)
    \end{aligned}
    \notag
    \end{equation}

    With $P(s=+1) + P(s=-1) = 1$ follows $P(s=+1) = \frac{1}{2} = P(s=-1)$.
    Further for $S^{(i)},S^{(j)} \in J$:

    \begin{equation}
    \begin{aligned}
        \frac{I + (-1)^sg_a}{2}\ket{\psi} &= \frac{I + (-1)^sg_a}{2}S^{(j)}S^{(i)} \ket{\psi} \\
            &= S^{(j)}\frac{I + (-1)^{s + 1}g_a}{2}S^{(i)} \ket{\psi} \\
            &=  S^{(j)}S^{(i)}\frac{I + (-1)^{s + 2}g_a}{2}\ket{\psi} \\
            &=  S^{(j)}S^{(i)}\frac{I + (-1)^sg_a}{2}\ket{\psi}
    \end{aligned}
    \notag
    \end{equation}

    The state after measurement is stabilized by $S^{(j)}S^{(i)}$ $i,j \in J$,
    and by $S^{(i)} \in J^c$. $(-1)^sg_a$ trivially stabilizes $\ket{\psi'}$
    \cite{nielsen_chuang_2010}.
\end{proof}

\section{The VOP-free Graph States}
This section will discuss the vertex operator (VOP)-free graph states. Why they
are called vertex operator-free will be clear in the following section about
graph states.

\subsection{VOP-free Graph States}

\begin{definition} \label{def:graph} The tuple $(V, E)$ is called a graph iff
    $V$ is a set of vertices with $|V| = n \in \mathbb{N}$ elements.  In the
    following $V = \{0, ..., n-1\}$ will be used.  $E$ is the set of edges $E
    \subset \left\{\{i, j\} \middle| i,j \in V, i \neq j\right\}$.

    For a vertex $i$ $n_i := \left\{j \in V \middle| \{i, j\} \in E\right\}$ is
called the neighbourhood of $i$ \cite{hein_eisert_briegel2008}.
\end{definition}

This definition of a graph is way less general than the definition of a graph
in graph theory.  Using this definition will however allow to avoid an
extensive list of constraints on the graph from graph theory that are implied
in this definition.

\begin{definition}
    For a graph $G = (V = \{0, ..., n-1\}, E)$ the associated stabilizers are 
    \begin{equation}
        K_G^{(i)} := X_i \prod\limits_{\{i,j\} \in E} Z_j
    \end{equation}
    for all $i \in V$. The vertex operator free graph state $\ket{\bar{G}}$ is
    the state stabilized by $\langle K_G^{(i)} \rangle_{i = 0, ..., n-1}$
    \cite{hein_eisert_briegel2008}.
\end{definition}

It is clear that the $K_G^{(i)}$ are multilocal Pauli operators. That they
commute is clear if $\{a,b\} \notin E$. If $\{a, b\} \in E$

\begin{equation}
\begin{aligned}
    K_G^{(a)} K_G^{(b)} &= X_a \left(\prod\limits_{i \in n_a} Z_i\right)
                            X_b \left(\prod\limits_{j\in n_b} Z_j\right)\\
                        &= X_a \left(\prod\limits_{i \in \setminus \{b\}} Z_i\right) Z_b
                            X_b \left(\prod\limits_{j\in n_b\setminus \{b\}} Z_j\right) Z_a\\
                        &= X_a Z_b X_b Z_a 
                            \left(\prod\limits_{j\in n_b\setminus \{b\}} Z_j\right)
                            \left(\prod\limits_{i \in \setminus \{b\}} Z_i\right)\\
                        &= -X_b Z_b X_a Z_a
                            \left(\prod\limits_{j\in n_b\setminus \{b\}} Z_j\right)
                            \left(\prod\limits_{i \in \setminus \{b\}} Z_i\right)\\
                        &= X_b Z_a X_a Z_b
                            \left(\prod\limits_{j\in n_b\setminus \{b\}} Z_j\right)
							\left(\prod\limits_{i \in \setminus \{b\}} Z_i\right)\\
					    &=  K_G^{(b)} K_G^{(a)}.\\
\end{aligned}
\end{equation}


This definition of a graph state might not seem to be straight forward but
recalling Theorem \ref{thm:unique_s_state} it is clear that $\ket{\bar{G}}$ is
unique. The following lemma will provide a way to construct this state from the
graph. 

\begin{lemma}
    For a graph $G = (V, E)$ the associated state $\ket{\bar{G}}$ is
    constructed using \cite{hein_eisert_briegel2008}

    \begin{equation}
        \begin{aligned}
            \ket{\bar{G}} &= \left(\prod\limits_{\{i,j\} \in E} CZ_{i,j}\right)\left(\prod\limits_{i \in V} H_i\right) \ket{0} \\
                        &= \left(\prod\limits_{\{i,j\} \in E} CZ_{i,j}\right) \ket{+} .\\
        \end{aligned}
    \end{equation}
\end{lemma}
\begin{proof}
    The proof is done using mathematical induction over the edges $\{i,j\} \in
    E$. A similar proof can be found in \cite{hein_eisert_briegel2008}. 

    \textbf{Base Case:} If $E = \{\}$ the stabilizers are $K_G^{(i)} = X_i$
    and stabilize the state $\ket{+}$.

    \textbf{Inductive Step:} Let $G' := (V, E \setminus \{\{l,j\}\})$. 
    By the induction hypothesis the state $\ket{\bar{G}'}$ is stabilized
    by $K_{G'}^{(i)}$. Applying a $CZ_{l,j}$ to the state $\ket{\bar{G}'}$
    now transforms the stabilizers to 


    \begin{equation}
    \begin{aligned}
        S^{(i)} &= CZ_{l,j} K_{G'}^{(i)} CZ_{l,j}.\\
    \end{aligned}
    \end{equation}

    Note that $CZ_{l,j}$ commutes with $K_{G'}^{(i)}$ for $l \neq i \neq j$.
    Further $CZ_{l,j} = CZ_{j,l}$. Consider now the case $l = i$:

    \begin{equation}
    \begin{aligned}
        S^{(i)} &= CZ_{i,j} K_{G'}^{(i)} CZ_{i,j} \\
                &= \left( \ket{1}\bra{1}_j \otimes Z_i + \ket{0}\bra{0}_j \otimes I_i \right)
                    X_i \prod\limits_{l \in n'_i} Z_l
                    \left( \ket{1}\bra{1}_j \otimes Z_i + \ket{0}\bra{0}_j \otimes I_i \right)\\
                &=           \left(\ket{1}\bra{1}_j \otimes Z_i\right) X_i \prod\limits_{l \in n'_i} Z_l \left(\ket{1}\bra{1}_j \otimes Z_i\right)\\
                &\mbox{   }+ \left(\ket{1}\bra{1}_j \otimes Z_i\right) X_i \prod\limits_{l \in n'_i} Z_l \left(\ket{0}\bra{0}_j \otimes I_i\right)\\
                &\mbox{   }+ \left(\ket{0}\bra{0}_j \otimes I_i\right) X_i \prod\limits_{l \in n'_i} Z_l \left(\ket{1}\bra{1}_j \otimes Z_i\right)\\
                &\mbox{   }+ \left(\ket{0}\bra{0}_j \otimes I_i\right) X_i \prod\limits_{l \in n'_i} Z_l \left(\ket{0}\bra{0}_j \otimes I_i\right)\\
                &=           \left(\ket{1}\bra{1}_j \otimes Z_i\right) X_i \prod\limits_{l \in n'_i} Z_l \left(\ket{1}\bra{1}_j \otimes Z_i\right)\\
                &\mbox{   }+ \left(\ket{0}\bra{0}_j \otimes I_i\right) X_i \prod\limits_{l \in n'_i} Z_l \left(\ket{0}\bra{0}_j \otimes I_i\right)\\
            &= \left(\left(-\ket{1}\bra{1}_j + \ket{0}\bra{0}_j\right) \otimes I_i\right) X_i \prod\limits_{l \in n'_i} Z_l \\
                &= \left(Z_j \otimes I_i\right) X_i \prod\limits_{l \in n'_i} Z_l \\
                &= X_i \prod\limits_{l \in n_i} Z_l \\
                &= K_G^{(i)}
    \end{aligned}
    \end{equation}



    %FIXME: This


    %Let $\ket{+} := \left(\prod\limits_{l \in V} H_l\right) \ket{0}$ as before.
    %Note that for any $X_i$: $X_i \ket{+} = +1 \ket{+}$.  In the following
    %discussion the direction $\prod\limits_{\{l,k\} \in E} :=
    %\prod\limits_{\{l,k\} \in E, l < k}$ is introduced as the graph is
    %undirected and edges must not be handled twice.  Set $\ket{\tilde{G}} :=
    %\left(\prod\limits_{\{l,k\} \in E} CZ_{l,k} \right)\ket{+}$.

    %\begin{equation}
    %    \begin{aligned}
    %        K_G^{(i)} \ket{\tilde{G}} 
    %        & = X_i \left(\prod\limits_{\{i,j\} \in E} Z_j\right)
    %            \left(\prod\limits_{\{l,k\} \in E} CZ_{l,k} \right) \ket{+} \\
    %        & = \left(\prod\limits_{\{i,j\} \in E} Z_j\right)X_i\prod\limits_{\{l,k\} \in E}
    %            \left( \ket{0}\bra{0}_k \otimes I_l + \ket{1}\bra{1}_k \otimes Z_l\right) \ket{+} \\
    %        & = \left(\prod\limits_{\{i,j\} \in E} Z_j\right)\prod\limits_{\{l,k\} \in E}
    %            \left( \ket{0}\bra{0}_k \otimes I_l + (-1)^{\delta_{i,l}}\ket{1}\bra{1}_k \otimes Z_l\right) X_i \ket{+} \\
    %    \end{aligned}
    %\end{equation}
    %As $X,Z$ anticommute. $X_i$ can now be absorbed into $\ket{+}$. The next
    %step is a bit tricky: A $Z_j$ can be absorbed into a $\ket{0}\bra{0}_j$
    %giving no phase or into a $\ket{1}\bra{1}_j$ yielding a phase of $-1$. If
    %there is no projector on $j$ the $Z_j$ can be commuted to the next
    %projector.  It is guaranteed that a projector on $j$ exists by the
    %definition of $\ket{\tilde{G}}$.

    %\begin{equation}
    %    \begin{aligned}
    %        K_G^{(i)} \ket{\tilde{G}} 
    %        & = \prod\limits_{\{l,k\} \in E}\left( \ket{0}\bra{0}_k \otimes I_l + (-1)^{\delta_{i,l} + \delta_{j,k}}\ket{1}\bra{1}_k \otimes Z_l\right) \ket{+} \\
	%		& = \prod\limits_{\{l,k\} \in E}\left( \ket{0}\bra{0}_k \otimes I_l + \ket{1}\bra{1}_k \otimes Z_l\right) \ket{+} \\	
	%	    & = +1 \ket{\tilde{G}}	
    %    \end{aligned}
    %\end{equation}

    %The $\delta_{i,l} + \delta_{j,k}$ is either $0$ or $2$ by the definitions
    %of $K_G^{(i)}$ and $\ket{\tilde{G}}$.
\end{proof}

\subsection{Dynamics of the VOP-free Graph States}

This representation gives an immediate result to how the stabilizers $\langle
K_G^{(i)} \rangle_i$ change under the $CZ$ gate: When applying $CZ_{i,j}$ on $G
= (V, E)$ the edge $\{i,j\}$ is toggled, resulting in a multiplication of $Z_j$
to $K_G^{(i)}$ and $Z_i$ to $K_G^{(j)}$. Toggling edges is done by using the
symmetric set difference:

\begin{definition}
    For two finite sets $A,B$ the symmetric set difference $\Delta$ is 
    defined as \cite{hein_eisert_briegel2008}

    \begin{equation}
        A \Delta B = (A \cup B) \setminus (A \cap B).
    \end{equation}
\end{definition}

Toggling an edge $\{i, j\}$ updates $E' = E \Delta \left\{\{i,j\}\right\}$.
Another transformation on the VOP-free graph states for a vertex $a \in V$ is
\cite{andersbriegel2005}

\begin{equation}
    M_a := \sqrt{-iX_a} \prod\limits_{j\in n_a} \sqrt{iZ_j}.
\end{equation}

This transformation toggles the neighbourhood of $a$ which is an operation
that will be used later\cite{andersbriegel2005}.

\begin{lemma}
    \label{lemma:M_a}
    When applying $M_a$ to a state $\ket{\bar{G}}$ the new state
    $\ket{\bar{G}'}$ is again a VOP-free graph state and the 
    graph is updated according to\cite{andersbriegel2005}:
    \begin{equation}
        \begin{aligned}
            n_a' &= n_a \\
            n_j' &= n_j, \hbox{ if } j \notin n_a\\
            n_j' &= n_j \Delta n_a, \hbox{ if } j \in n_a
        \end{aligned}
    \end{equation}
\end{lemma}
\begin{proof}
    $\ket{\bar{G}'}$ is stabilized by $\langle M_a K_G^{(i)} M_a^\dagger
    \rangle_i$, so it is sufficient to study how the $ K_G^{(i)}$ change under
    $M_a$.  At first note that $M_a^2 \alpha K_G^{(a)} \Rightarrow [K_G^{(a)},
    M_a] = 0$.  Further $\forall i\in V\setminus n_a$ $[K_G^{(i)}, M_a] = 0$,
    so the first two equations follow trivially. For $j \in n_a$ set 

    \begin{equation}
        \begin{aligned}
            S^{(j)} &= M_a K_G^{(j)} M_a^\dagger \\
                &= \sqrt{-iX_a} \left(\prod\limits_{l \in n_a \setminus \{j\}} \sqrt{iZ_l}\right)
                                 \sqrt{iZ_j}  K_G^{(j)} \sqrt{iZ_j}^\dagger 
                                 \left(\prod\limits_{l \in n_a \setminus \{j\}} \sqrt{iZ_l}^\dagger\right)
                                 \sqrt{-iX_a}^\dagger \\
                &= \sqrt{-iX_a} \left(\prod\limits_{l \in n_a \setminus \{j\}} \sqrt{iZ_l}\right)\sqrt{iZ_j}
                                X_j \left(\prod\limits_{m \in n_j \setminus \{a\}} Z_m\right) Z_a
                                \sqrt{iZ_j}^\dagger
                                \left(\prod\limits_{l \in n_a \setminus \{j\}} \sqrt{iZ_l}^\dagger\right)
                                \sqrt{-iX_a}^\dagger \\
                &= \sqrt{iZ_j} X_j\sqrt{iZ_j}^\dagger\left(\prod\limits_{m \in n_j \setminus \{a\}} Z_m\right) 
                                \sqrt{-iX_a} Z_a \sqrt{-iX_a}^\dagger \\
                &= (-1)^2 Y_j Y_a \left(\prod\limits_{m \in n_j \setminus \{a\}} Z_m\right)\\
                &= (-1)i^2 Z_j X_a X_j Z_a \left(\prod\limits_{m \in n_j \setminus \{a\}} Z_m\right)
        \end{aligned}
    \end{equation}

    One can now construct a new set of $K_{G'}^{(i)}$ such that $M_a
    \ket{\bar{G}}$ is the $+1$ eigenstate of the new $K_{G'}^{(i)}$. Because
    $\forall i\in V\setminus n_a$ $[K_G^{(i)}, M_a] = 0$ it is clear that
    $\forall j \notin n_a$  $K_{G'}^{(j)} = K_G^{(j)}$.  To construct the
    $K_{G'}^{(i)}$ let for some $j \in n_a$ $n_a =: \{j\} \cup F$ and $n_j =:
    \{a\} \cup D$.  Then follows:

    \begin{equation}
        \begin{aligned}
            S^{(j)} &= Z_j X_a X_j Z_a \prod\limits_{l \in D} Z_l\\
                    &= Z_j X_a X_j Z_a \left(\prod\limits_{l \in D} Z_l\right)
                                        \left(\prod\limits_{l \in F}Z_l\right)
                                        \left(\prod\limits_{l \in F}Z_l\right) \\
                    &= Z_j X_a X_j Z_a \left(\prod\limits_{l \in ((F\cup D) \setminus (F\cap D))} Z_L\right)
                                        \left(\prod\limits_{l \in F}Z_l\right) \\
                    &= K_{G'}^{(a)} K_{G'}^{(j)} \\
                    &= K_{G}^{(a)} K_{G'}^{(j)}
        \end{aligned}
    \end{equation}

    Using this one can show that $\ket{\bar{G}'}$ is a $+1$ eigenstate of $K_{G'}^{(j)}$:

    \begin{equation}
        \ket{\bar{G}'} = S^{(j)}\ket{\bar{G}'} = K_{G}^{(a)} K_{G'}^{(j)}\ket{\bar{G}'} 
                        = K_{G'}^{(j)}K_{G}^{(a)}\ket{\bar{G}'} = K_{G'}^{(j)}\ket{\bar{G}'}
    \end{equation}

    Because $\left\{K_G^{(i)} \middle| i \notin n_a\right\} \cup \left\{S^{(i)}
    \middle| i\in n_a\right\}$ and $\left\{K_G^{(i)} \middle| i \notin
n_a\right\} \cup \left\{K_{G'}^{(i)} \middle| i\in n_a \right\}$ are both $n$
commuting multi-local Pauli operators where the $S^{(i)}$ can be generated from
the $K_{G'}^{(i)}$ and $\ket{\bar{G}'}$ is a $+1$ eigenstate of $K_{G'}^{(j)}$
$\langle\left\{K_G^{(i)} \middle| i \notin n_a\right\} \cup \left\{K_{G'}^{(i)}
\middle| i\in n_a \right\}\rangle$ are the stabilizers of $\ket{\bar{G}'}$.
Therefore the associated graph is changed as given in the third equation.
\end{proof}

\section{Graph States}

The definition of a VOP-free graph state above raises an obvious question: Can
any stabilizer state be described using just a graph?  The answer is straight
forward: No. The most simple cases are the single qbit states $\ket{0},\ket{1}$
and $\ket{+_Y}, \ket{-_Y}$. But there is an extension to the VOP-free graph
states that allows the representation of an arbitrary stabilizer state. The
proof that indeed any state can be represented is purely constructive. As seen
in Theorem \ref{thm:clifford_group_approx} any $c \in C_n$ can be constructed
from $CZ$ and $C_L$. In the following discussion it will become clear that both
$C_L$ and $CZ$ can be applied to a general graph state
\footnote{
    One can show that any stabilizer state is local Clifford equivalent to
    a VOP-free graph state, i.e. only tensor products of $C_L$ matrices are
    required to map a stabilizer state to a VOP-free graph state \cite{andersbriegel2005}.
}.

\subsection{Graph States and Vertex Operators}
\label{ref:g_states_vops}

\begin{definition}
    \label{def:g_state}
    A tuple $(V, E, O)$ is called the graphical representation of a stabilizer
    state if $(V, E)$ is a graph as in Definition \ref{def:graph} and $O
    = \{o_1, ..., o_n\}$ where $o_i \in C_L$.

    The state $\ket{G}$ is defined by the eigenvalue relation:

    \begin{equation}
        +1 \ket{G} = \left(\prod\limits_{j=1}^no_j\right) K_G^{(i)} \left(\prod\limits_{j=1}^no_j\right)^\dagger \ket{G}
    \end{equation}

    $o_i$ are called the vertex operators of $\ket{G}$ \cite{andersbriegel2005}
    \footnote{
    The notation in \cite{andersbriegel2005} is different. Instead of using $(V, E, O)$
    to represent any stabilizer $(V, E)$ is used to represent what is called a VOP-free
    graph state in this paper. Then the state $\ket{\bar{G}}$ is extended with local Clifford
    gates $c_1, ..., c_n$ to an arbitrary stabilizer state. The state is then denoted as
    $\ket{\bar{G}; (c_1, ..., c_n)} \equiv \ket{\bar{G}; \vec{c}}$. This paper prefers 
    the notation using $(V, E, O)$ as it both emphasizes the use of stabilizers and is closer
    to the representation used in the simulator.
    }. 
\end{definition}

Recalling the dynamics of stabilizer states the following relation follows
immediately:

\begin{equation}
    \ket{G} = \left(\prod\limits_{j=1}^no_j\right) \ket{\bar{G}}
\end{equation}

The great advantage of this representation of a stabilizer state is its space
requirement: Instead of storing $n^2$ Pauli matrices only some vertices (which
often are implicit), the edges and some vertex operators ($n$ matrices) have to
be stored. The following theorem will improve this even further: instead of $n$
matrices it is sufficient to store $n$ integers representing the vertex
operators:

\begin{theorem}
    $C_L$ has $24$ degrees of freedom disregarding a global phase \cite{andersbriegel2005}.
\end{theorem}
\begin{proof} It is clear that $\forall a \in C_L$ a is a group isomorphism $P
    \rightarrow P$: $apa^\dagger a p' a^\dagger = a pp'a^\dagger$.  Therefore
    $a$ will preserve the (anti-)commutator relations of $P$.  Further note
    that $Y = iXZ$, so one has to consider the anti-commutator relations of
    $X,Z$ only.

    As the transformations are unitary they preserve eigenvalues, so $X$ can be
    mapped to $\pm X, \pm Y, \pm Z$ which gives $6$ degrees of freedom.
    Furthermore the image of $Z$ has to anti-commute with the image of $X$ so
    $Z$ has four possible images under the transformation.  This gives another
$4$ degrees of freedom and a total of $24$.  \end{proof}

From now on $C_L = \langle H, S \rangle$ (disregarding a global phase) will be
used.  One can show (by construction) that $H, S$ generate a possible choice of
$C_L$, as do $\sqrt{-iX}, \sqrt{-iZ}$ which is required in one specific
operation on graph states \cite{andersbriegel2005}.

\begin{equation}
    S = \left(\begin{array}{cc} 1 & 0 \\ 0 & i \end{array}\right)
\end{equation}
\begin{equation}
    \sqrt{-iX} = \frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 & i \\ i & 1 \end{array}\right)
\end{equation}
\begin{equation}
    \sqrt{-iZ} = \exp(-i\frac{\pi}{4})\left(\begin{array}{cc} 1 & 0 \\ 0 & -i \end{array}\right)
\end{equation}


\subsection{Dynamics of Graph States}
\label{ref:dynamics_graph}

So far the graphical representation of stabilizer states is just another way to
store basically a stabilizer tableaux that might require less memory than the
tableaux used in CHP\cite{CHP}. The true power of this formalism is seen when
studying its dynamics. The simplest case is a local Clifford operator $c_j$
acting on a qbit $j$: The stabilizers are changed to $\langle c_j S^{(i)}
c_j^\dagger\rangle_i$. Using the definition of the graphical representation one
sees that just the vertex operators are changed and the new vertex operators
are given by

\begin{equation}
    \begin{aligned}
        o_i' &= o_i &\mbox{if } i \neq j\\
        o_i' &= c o_i c^\dagger &\mbox{if } i = j.\\
    \end{aligned}
\end{equation}

The action of a $CZ$ gate on the state $(V, E, O)$ is in most cases less
trivial.  Let $a \neq b$ be two qbits, now consider the action of $CZ_{a,b}$ on
$(V, E, O)$.  The cases given here follow the implementation of a $CZ$
application in \cite{pyqcs}, the respective paragraphs from
\cite{andersbriegel2005} are given in italic.  Most of the discussion follows
the one given in \cite{andersbriegel2005} closely.


\textbf{Case 1}(\textit{Case 1})\textbf{:}\\
Both $o_a$ and $o_b$ commute with $CZ_{a,b}$. This is the case for exactly four
vertex operators: $\mathcal{Z} = \left\{I, Z, S, S^\dagger\right\}$.  In this
case the CZ can be pulled past the vertex operators and just the edges are
changed to $E' = E \Delta \left\{\{a,b\}\right\}$.

\textbf{Case 2}(\textit{Sub-Sub-Case 2.2.1})\textbf{:}\\
The two qbits are isolated: From the definition of the graph state one can
derive that any isolated clique of the graph can be treated independently.
Therefore the two isolated qbits can be treated as an independent state and the
set of two qbit stabilizer states is finite. An upper bound to the number of
two qbit stabilizer states is given by $2\cdot24^2$: A factor of two for the
options with and without an edge between the qbits and $24$ Clifford operators
on each vertex.

All those states and the resulting state after a $CZ$ application can be
computed which leads to another interesting result that will be useful later:
If one vertex has the vertex operator $I$ the resulting state can be chosen
such that at least one of the vertex operators is $I$ again and in particular
the identity on the vertex can be preserved under the application of a $CZ$.

\textbf{Case 3}(\textit{Case 2, but one sub-case has been handled})\textbf{:}\\
At least one vertex operator does not commute with $CZ$ and at least one vertex
has non-operand (i.e. neighbours that are neither $a$ nor $b$) neighbours. In
this case one can try to clear the vertex operators which will succeed for at
least one qbit.

The transformation given in Lemma \ref{lemma:M_a} is used to "clear" the vertex
operators. Recalling that the transformation $M_j$ toggles the neighbourhood of
vertex $j$ gives substance to the following theorem:

\begin{theorem}
    A graph state $\ket{G}$ associated with $(V, E, O)$ is invariant when
    simultaneously toggling the neighbourhood of a non-isolated qbit $j$
    and right-multiplying $M_j^\dagger$ to the vertex operators in the sense
    that $\sqrt{-iX}^\dagger = \sqrt{iX}$ is right-multiplied to $o_j$ and 
    $\sqrt{iZ}^\dagger = \sqrt{-iZ}$ is right-multiplied to $o_l$ for all 
    neighbours $l$ of $j$ \cite{andersbriegel2005}.

    Without proof.
\end{theorem}

As stated in \ref{ref:g_states_vops} $C_L$ is also generated by $\sqrt{-iX}$
and $\sqrt{iZ}$.  This yields an algorithm to reduce the vertex operator of
a non-isolated qbit $j$ to the identity.  The combined operation of toggling
the neighbourhood of $j$ and right-multiplying $M_j^\dagger$ is called $L_j$
transformation, which transforms $(V, E, O)$ into a so-called local Clifford
equivalent graphical representation. The algorithm is given by the following
steps:

\begin{enumerate}
    \item{Check whether $n_a \setminus \{b\} \neq \{\}$. If this condition does not hold
            the vertex operator on $a$ cannot be cleared. }
    \item{Express the vertex operator $o_a$ as a product of $\sqrt{-iX}$ and $\sqrt{iZ}$.}
    \item{Move from right to left through the product:
        \begin{enumerate}
            \item{If the current matrix is $\sqrt{-iX}$ apply $L_a$.}
            \item{If the current matrix is $\sqrt{iZ}$ select a vertex
                $j \in n_a \setminus \{b\}$ (which is possible as it has been checked before)
                and apply $L_j$.}
        \end{enumerate}
        }
\end{enumerate}

This algorithm has the important properties that if the algorithm succeeds $o_a
= I$ and $o_b$ has picked up powers of $\sqrt{iZ}^\dagger$.  If $b$ has
non-operand neighbours after clearing the vertex operators on $a$, then the
vertex operators on $b$ can be cleared using the same algorithm which gives
$o_b = I$ and $o_a = (\sqrt{iZ}^\dagger)^l = S^l \in \mathcal{Z}$ for some $l
\in \{1, ..., 5\}$. Therefore Case 1 can now be applied.

If $o_a$ could not be cleared $o_b$ can be cleared using the same procedure and
after clearing $o_b$ one can retry to clear $o_a$. 

In any case at least one vertex operator has been cleared. If both vertex
operators have been cleared Case 1 will be applied. If there is just one
cleared vertex operator it is the vertex with non-operand neighbours. Using
this one can still apply a $CZ$: Without loss of generality assume that $a$ has
non-operand neighbours and $b$ does not. Now the state $\ket{G}$ has the form
\cite{andersbriegel2005}

\begin{equation}
    \begin{aligned}
        \ket{G} &= \left(\prod\limits_{o_i \in O} o_i\right) \left(\prod\limits_{\{i,j\} \in E} CZ_{i,j}\right) \ket{+}_n \\
                &= \left(\prod\limits_{o_i \in O \setminus \{o_b\}} o_i \right) \left(\prod\limits_{\{i,j\} \in E \setminus \{a,b\}} CZ_{i,j}\right) o_b (CZ_{a,b})^s \ket{+}_n \\
                &= \left(\prod\limits_{o_i \in O \setminus \{o_b\}} o_i \right) \left(\prod\limits_{\{i,j\} \in E \setminus \{a,b\}} CZ_{i,j}\right) \ket{+}_{n-2} \otimes \left(o_b (CZ_{a,b})^s \ket{+}_2\right) .\\
    \end{aligned}
\end{equation}

As $o_b$ commutes with all operators but $CZ_{a,b}$ and $s \in \{0, 1\}$
indicates whether there is an edge between $a$ and $b$.

\begin{equation}
    \begin{aligned}
        CZ_{a,b}\ket{G} &= CZ_{a,b}\left(\prod\limits_{o_i \in O \setminus \{o_b\}} o_i \right) \left(\prod\limits_{\{i,j\} \in E \setminus \{a,b\}} CZ_{i,j}\right) o_b (CZ_{a,b})^s \ket{+} \\
                        &= \left(\prod\limits_{o_i \in O \setminus \{o_b\}} o_i \right) \left(\prod\limits_{\{i,j\} \in E \setminus \{a,b\}} CZ_{i,j}\right) \ket{+}_{n-2} \otimes \left(CZ_{a,b} o_b (CZ_{a,b})^s \ket{+}_2\right) \\
    \end{aligned}
\end{equation}

This allows to re-use the method in Case 2 to apply the $CZ$ while keeping the
$o_a = I$.

As it has been shown how both $CZ$ and $C_L$  act on a graph state $\ket{G}$
and the resulting state is a graph state as well this proofs constructively
that the graphical representation of a stabilizer state is indeed able to
represent any stabilizer state.  If one wants to do computations using this
formalism it is however also necessary to perform measurements.

\subsection{Measurements on Graph States}
\label{ref:meas_graph}

This is adapted from \cite{andersbriegel2005}; measurement results and updating
the graph after a measurement is described in \cite{hein_eisert_briegel2008}.

Recalling \ref{ref:meas_stab} it is clear that one has to compute the
commutator of the observable $g_a = Z_a$ with the stabilizers to get the
probability amplitudes which is a quite expensive computation in theory. It is
possible to simplify the problem by pulling the observable behind the vertex
operators. For this consider the projector $P_{a,s} = \frac{I + (-1)^sZ_a}{2}$

\begin{equation}
    \begin{aligned}
        P_{a,s} \ket{\psi} &= P_{a,s} \left(\prod\limits_{o_i \in O} o_i \right) \ket{\bar{G}} \\
                        &= \left(\prod\limits_{o_i \in O \setminus \{o_a\}}o_i \right)P_a  o_a \ket{\bar{G}} \\
                        &= \left(\prod\limits_{o_i \in O \setminus \{o_a\}}o_i \right) o_a o_a^\dagger P_a o_a \ket{\bar{G}} \\
                        &= \left(\prod\limits_{o_i \in O} o_i \right) o_a^\dagger P_a o_a \ket{\bar{G}} \\
                        &= \left(\prod\limits_{o_i \in O} o_i \right) \tilde{P}_{a,s} \ket{\bar{G}} .\\
    \end{aligned}
\end{equation}

This transformed projector has the important property that it still is a Pauli
projector as $o_a$ is a Clifford operator 

\begin{equation}
    \begin{aligned}
        \tilde{P}_{a,s} &= o_a^\dagger P_a o_a \\
                    &= o_a^\dagger \frac{I + (-1)^sZ_a}{2} o_a \\
                    &= \frac{I + (-1)^s o_a^\dagger Z_a o_a}{2} \\
                    &= \frac{I + (-1)^s \tilde{g}_a}{2} .\\
    \end{aligned}
\end{equation}

Where $\tilde{g}_a \in \{\pm X_a, \pm Y_a, \pm Z_a\}$. Therefore, it is
enough to study the measurements of any Pauli operator on the vertex operator
free graph states. The commutators of the observable with the $K_G^{(i)}$ are
quite easy to compute. Note that Pauli matrices either commute or anticommute
and it is easier to list the operators that anticommute:

\begin{equation}
    \begin{aligned}
        A_{\pm X_a} &= n_a \\
        A_{\pm Y_a} &= n_a \cup \{a\} \\
        A_{\pm Z_a} &= \{a\}\\
    \end{aligned}
\end{equation}

This gives one immediate result: if a qbit $a$ is isolated and the operator
$\tilde{g}_a = X_a (-X_a)$ is measured the result $s=0(1)$ is obtained with
probability $1$ and $(V, E, O)$ is unchanged.  In any other case the results
$s=1$ and $s=0$ have probability $\frac{1}{2}$ and both graph and vertex
operators have to be updated. Further it is clear that measurements of
$-\tilde{g}_a$ and $\tilde{g}_a$ are related by just inverting the result $s$.

The calculations to obtain the transformation on graph and vertex operators are
lengthy and follow the scheme of Lemma \ref{lemma:M_a}. \cite[Section
IV]{hein_eisert_briegel2008} also contains the steps required to obtain the
following results

\begin{equation}
    \begin{aligned}
        U_{Z,s} &= \left(\prod\limits_{b \in n_a} Z_b^s\right) X_a^s H_a \\
        U_{Y,s} &= \prod\limits_{b \in n_a} \sqrt{(-1)^{1-s} iZ_b} \sqrt{(-1)^{1-s} iZ_a}.\\
    \end{aligned}
\end{equation}

These transformations split it two parts: the first is a result of Lemma
\ref{lemma:stab_measurement}.  The second part makes sure that the qbit $a$ is
diagonal in measured observable and has the correct eigenvalue.  When comparing
with Lemma \ref{lemma:stab_measurement} in both cases $Y,Z$ the anticommuting
stabilizer $K_G^{(a)}$ is chosen. The graph is changed according to

\begin{equation}
    \begin{aligned}
        E'_{Z} &= E \setminus \left\{\{i,a\} \middle| i \in V\right\}\\
        E'_{Y} &= E \Delta (n_a \otimes n_a) \setminus \left\{\{i,a\} \middle| i \in V\right\}.\\
    \end{aligned}
\end{equation}


For $g_a = X_a$ one has to choose a $b \in n_a$ and the transformations are

\begin{equation}
    \begin{aligned}
        U_{X,0} &= \sqrt{iY_b} \prod\limits_{c \in n_a \setminus n_b \setminus \{b\}} Z_c \\
        U_{X,1} &= \sqrt{-iY_b} \prod\limits_{c \in n_b \setminus n_a \setminus \{a\}} Z_c \\
    \end{aligned}
\end{equation}
\begin{equation}
    \begin{aligned}
        E'_{X} = E &\Delta (n_b \otimes n_a) \\
                & \Delta ((n_b \cap n_a) \otimes (n_b \cap n_a)) \\
                & \Delta (\{b\} \otimes (n_a \setminus \{b\})) \\
                & \setminus \left\{\{i,a\} \middle| i \in V\right\}.\\
    \end{aligned}
\end{equation}

The unitaries $U$ have to be right-multiplied to the vertex operators.
