Start with a category with tensor products and a good theory of duals (technically a spherical tensor category \cite{MR1686423}, or slightly more generally a spherical $2$-category\footnote{Recall that a monoidal category is just a $2$-category with one object. Subfactor planar algebras are $2$-categories with two objects but still have a good spherical theory of duals for morphisms. In general one could consider any $2$-category with a good theory of duals. Watch out that our terminology differs from \cite{MR1686421}. There the phrase `spherical $2$-category' refers to a \emph{monoidal} $2$-category which we think would better be called a spherical monoidal $2$-category or a spherical $3$-category.}), such as the category of representations of a quantum group, or the
category of bimodules coming from a subfactor.  Fix your favorite object in this tensor category. Then the $\operatorname{Hom}$-spaces between arbitrary tensor products of the chosen object and its dual fit together into a structure called a planar algebra (a notion due to Jones \cite{math.QA/9909027}) or the roughly equivalent structure called a spider (a notion due to Kuperberg \cite{MR1403861}). 
 Encountering such an object should tempt you to participate in:

\begin{kuperberg}
Give a presentation by generators and relations for every interesting planar algebra.
Generally it's easy to guess some generators, and not too hard to
determine that certain relations hold. You should then aim to prove that
the combinatorial planar algebra given by these generators and relations
agrees with your original planar algebra.
Ideally, you also understand other properties of the original category (for example positivity, being spherical, or
being braided)
in terms of the presentation.
\end{kuperberg}

The difficulty with this approach is often in proving
combinatorially that your relations are self-consistent,
without appealing to the original planar algebra.
Going further, you could try to find
 explicit `diagrammatic' bases for all the original $\operatorname{Hom}$
spaces, as well as the combinatorial details of $6-j$ symbols or
`recombination' rules.

This program has been fulfilled completely for the $A_n$ subfactors (equivalently, for the representation theory of $U_q(\mathfrak{sl}_2)$ at a root of unity),
for all the subfactors coming from Hopf algebras \cite{MR2079886, MR2146224, MR1971553, MR2346882},
and for the representation categories of the rank $2$ quantum groups
\cite{MR1403861, MR2360947}. Some progress has been made on the representation categories of $U_q(\mathfrak{sl}_n)$ for $n \geq 4$ \cite{MR1659228, dongseok-thesis, scott-thesis}.
Other examples of planar algebras which have been described or constructed by generators and relations include  the BMW and Hecke algebras \cite{math.QA/9909027, MR1733737}, the Haagerup subfactor \cite{0902.1294}, and the Bisch-Haagerup subfactors \cite{MR1386923, 0807.4134}.

In this paper we apply the Kuperberg program to the subfactor planar
algebras corresponding to $D_{2n}$. The $D_{2n}$ subfactors are one of
the two infinite families (the other being $A_n$) of subfactors of index
less than $4$.  Also with index less than $4$ there are two sporadic
examples, the $E_6$ and $E_8$ subfactors.  See \cite{MR999799, MR996454,
MR1145672, MR1936496} for the story of this classification.

The reader familiar with quantum groups should be warned that although $D_{2n}$ is related to the Dynkin diagram $D_{2n}$, it is not in any way related to the quantum group $U_q(\mathfrak{so}_{4n})$.  To get from $U_q(\mathfrak{so}_{4n})$ to the $D_{2n}$ diagram you look at its roots. To get from the $D_{2n}$ subfactor to the $D_{2n}$ diagram you look at its fusion graph. The fusion graph of a quantum group is closely related to its fundamental alcove, not to its roots.  Nonetheless the $D_{2n}$ subfactor is related to quantum groups!  First, It is a quantum subgroup of $U_q(\mathfrak{sl}_2)$ in the sense of \cite{MR1936496}.  To make matters even more confusing, the $D_{2n}$ subfactor is related via level-rank duality to the quantum group $U_q(\mathfrak{so}_{2n-2})$; see \cite{d2n-links} for details.

The $D_{2n}$ subfactors were first constructed in
\cite{MR1308617}, using an automorphism of the subfactor $A_{4n-3}$.
(This `orbifold method' was studied further in
\cite{MR1379298,MR1309549}.) Since then, several papers have offered
alternative constructions; via planar algebras, in \cite{MR1929335}, and as
a module category over an algebra object in $A_{4n-3}$, in
\cite{MR1936496}. In this paper we'll show an explicit description of the
associated $D_{2n}$ planar algebra, and via the results of
\cite{math.QA/9909027,MR1334479} or of \cite{0807.4146} this gives an
indirect construction of the subfactor itself. 
%It's not our intent that
%you should think of this as the purpose of the paper; see the discussion
%following the Main Theorem below.
%\eep{this makes me think the discussion following the main theorem is going to describe the main purpose of the paper.  Instead, it simply describes how to do a thing that's not the main purpose of the paper.} 

Our goal in this paper is to understand as much as possible about the the $D_{2n}$ planar algebra on the level of planar algebras -- that is, without appealing to subfactors, or any structure beyond the combinatorics of diagrams.  
 We also hope
that our treatment of the planar algebra for $D_{2n}$ by generators and
relations nicely illustrates the goals of the Kuperberg program,
although more complicated examples will require different methods.

Our main object of study is a planar algebra $\pa$ defined by generators and relations.

\begin{defn}\label{def:pa}
Fix $q=\exp(\frac{\pi i}{4n-2})$.
Let $\pa$ be the planar algebra generated by a single ``box" $S$ with $4n-4$ strands, modulo the following relations.
\begin{enumerate}

\item\label{delta} A closed circle is equal to $[2]_q = (q+q^{-1}) = 2 \cos(\frac{\pi}{4n-2})$ times the empty diagram.

\item\label{rotateS} Rotation relation:
\inputtikz{rotateS}

\item\label{capS} Capping relation:
\inputtikz{capS}

\item\label{twoS} Two $S$ relation:
\inputtikz{twoS}

\end{enumerate}
\end{defn}

This paper uses direct calculations on diagrams  to establish the following theorem:

\begin{mainthm}
\label{thm:main}%
$\pa$ is the $D_{2n}$ subfactor planar algebra; that is,
\begin{enumerate}
\item the space of closed diagrams is $1$-dimensional,
\item $\pa$ is spherical,
\item the principal graph of $\pa$ is the Dynkin diagram $D_{2n}$, and
\item $\pa$ is unitary, that is, it has a star structure for which $S^*=S$, and the associated inner product is positive definite.
\end{enumerate}
\end{mainthm}

Many of the terms appearing in this statement will be given definitions later, although a reader already acquainted with the theory of subfactors should not
find anything unfamiliar.\footnote{Although perhaps they should watch out --- we'll define the principal graph of a planar algebra by a slightly
different route than usual, failing to mention either the basic construction \cite{MR1473221}, or bimodules over a von Neumann algebra \cite{MR1424954}!}

In this paper our approach is to start with the generators and relations for $\pa$ and to prove the Main Theorem from scratch.  The first part of the Main Theorem in fact comes in two subparts; first
that the relations given in
Definition \ref{def:pa} are consistent (that is, $\pa_0 \neq 0$),
 and second 
 that every closed diagram can be evaluated as a multiple of the empty
diagram using the relations.
 These
statements appear as Corollary
\ref{cor:evaluation} and as Theorem \ref{thm:consistency}. Corollary \ref{cor:spherical} proves that $\pa$ is
spherical.

Our main tool in showing all of this is a `braiding up to sign' on the
entire planar algebra $D_{2n}$; the details are in Theorem
\ref{thm:passacrossS}. It is well-known that the even part of $D_{2n}$ is
braided (for example \cite{MR1936496}), but we extend that braiding to
the whole planar algebra with the caveat that if you pull $S$ \emph{over} a
strand it becomes $-S$. In a second paper \cite{d2n-links}, we will give
results about the knot and link invariants which can be constructed using
this planar algebra. From these, we can derive a number of new identities
between classical knot polynomials.

In Section \ref{sec:category}, we will describe the structure of the tensor category of projections, essentially rephrasing the concepts of fusion algebras in planar algebra language.  Some easy diagrammatic calculations then establish the third part of the main theorem.   Section \ref{sec:basis} exhibits an orthogonal basis for the planar algebra, and the final part of the main theorem becomes an easy consequence.
%\noop
{Finally, Appendix \ref{appendix} describes a family of related planar algebras, and sketches the corresponding results.}

In addition to our direct approach, one could also prove the main theorem in the following indirect way.  First take one of the known constructions of the subfactor $D_{2n}$.  By \cite{math.QA/9909027} the standard invariant of $D_{2n}$ gives a planar algebra. Using the techniques in \cite{MR1929335} and \cite{quadratic}, find the generator and some of the relations for this planar algebra.  At this point you'll have reconstructed our list of generators and relations for $\pa$.  However, even at this point you will only know that the $D_{2n}$ planar algebra is a quotient of $\pa$.  To prove that $D_{2n} = \pa$ you would still need many of the techniques from this paper.  In particular, using all the above results only allows you to skip Section 3.3 and parts of Section 4.2 (since positive definiteness would follow from non-degeneracy of the inner product and positivity for $D_{2n}$).

We'd like to thank Stephen Bigelow, Vaughan Jones, and Kevin Walker for interesting conversations.
During our work on this paper, Scott Morrison was at Microsoft Station Q, Emily Peters was supported in part by NSF Grant DMS0401734 and Noah Snyder was supported in part by RTG grant DMS-0354321.

We've fixed some errors pointed out by careful readers in earlier versions of this paper. Kevin Walker pointed out an error in the statement (but, happily, not the proof!) of Theorem \ref{easyconsequences}. Shohei Matsunaga pointed out an error in Equation \eqref{eq:wjwk-large}.
Kazuyo Sakamaki pointed out an error in the coefficients appearing in
Definition \ref{defn:algorithm} and Theorem
\ref{thm:algorithm-well-defined}.
