\section{The surgery theorem applied to grid diagrams}
\label {sec:Surgery}

Our main goal here is to present the statement of
Theorem~\ref{thm:Surgery} below, which expresses the Heegaard Floer
homology $\HFm$ of an integral surgery on a link in terms of a grid
diagram for the link (or, more precisely, in terms of holomorphic
polygon counts on a symmetric product of the grid). We also state
similar results for the cobordism maps on $\HFm$ induced by two-handle
additions (Theorem~\ref{thm:Cobordisms}), for the other completed
versions of Heegaard Floer homology (Theorem~\ref{thm:AllVersions}),
and for the mixed invariants of four-manifolds
(Proposition~\ref{prop:mixed}).

The proofs of all the results from this section are given in \cite{LinkSurg}.

\subsection {Hyperboxes of chain complexes}
\label {sec:hyper}
We start by summarizing some homological algebra from \cite[Section 3]{LinkSurg}.

When $f$ is a function, we denote its $n\th$ iterate by $ f^{\circ n}$, i.e., $f^{\circ 0} = id, \ f^{\circ 1} = f, \ f^{\circ (n+1)} = f^{\circ n} \circ f$.

For ${\mathbf {d}} = (d_1, \dots, d_n) \in (\Z_{\ge 0})^n$ a collection of nonnegative integers, we set
$$  \mathbb{E}({\mathbf {d}}) =  \{ \eps = (\eps_1, \dots, \eps_n) \ | \  \eps_i \in \{0,1, \dots, d_i\}, \ i=1, \dots, n \}. $$

In particular, $ \mathbb{E}_n =  \mathbb{E}(1, \dots, 1) = \{0,1\}^n$ is the set of vertices of the $n$-dimensional unit hypercube.

For $\eps = (\eps_1, \dots, \eps_n)\in \mathbb{E}({\mathbf {d}})$, set
$$ \| \eps \| = \eps_1 + \dots + \eps_n.$$

We can view the elements of $\mathbb{E}({\mathbf {d}})$ as vectors in $\R^n$. There is a partial ordering on $\mathbb{E}({\mathbf {d}})$, given by $\eps' \leq \eps \iff \forall i, \ \eps'_i \leq \eps_i$. We write $\eps' < \eps$ if $\eps' \leq \eps$ and $\eps' \neq \eps$. We say that two multi-indices $\eps, \eps'$ with $\eps \leq \eps'$ are {\em neighbors} if $\eps' - \eps \in \mathbb{E}_n$, i.e., none of their coordinates differ by more than one.

We define an {\em $n$-dimensional hyperbox of chain complexes} $\mathcal{H}
= \bigl( (C^{\eps})_{\eps \in \mathbb{E}({\mathbf {d}})}, ({D}^{\eps})_{\eps \in \mathbb{E}_n}
\bigr)$ of size ${\mathbf {d}} \in (\Z_{\ge 0})^n$ to consist of a collection of
$\Z$-graded vector spaces
$$ (C^{\eps})_{\eps \in \mathbb{E}({\mathbf {d}})}, \ \  C^{\eps} = \bigoplus_{* \in \Z} C^{\eps}_*,$$
together with a collection of linear maps
$$ {D}^{\eps}  : C_*^{\eps^0} \to C_{*+\| \eps \|-1 }^{\eps^0 + \eps},$$
defined for all $\eps^0 \in \mathbb{E}({\mathbf {d}})$ and $\eps \in \mathbb{E}_n $ such that $\eps^0 + \eps \in \mathbb{E}({\mathbf {d}})$ (i.e., the multi-indices of the domain and the target are neighbors). The maps ${D}^\eps$ are required to satisfy the relations
\begin {equation}
\label {eq:d2}
 \sum_{\eps' \leq \eps}  {D}^{\eps - \eps'} \circ {D}^{\eps'}   = 0,
 \end {equation}
for all $\eps \in \mathbb{E}_n$.  If ${\mathbf {d}} = (1, \dots, 1)$, we say that $\mathcal{H}$ is a {\em hypercube of chain complexes}.

Note that ${D}^{\eps}$ in principle also depends on $\eps^0$, but we omit that from notation for simplicity. Further, if we consider the total complex
$$ C_* =  \bigoplus_{\eps \in \mathbb{E}({\mathbf {d}})} C^{\eps}_{* + \|\eps\|}, $$
we can think of $ {D}^{\eps}$ as a map from $C_*$ to itself, by extending it to be zero when is not defined. Observe that ${D} = \sum {D}^{\eps}: C_* \to C_{*-1}$ is a chain map.

Let $\mathcal{H}= \bigl( (C^{\eps})_{\eps \in \mathbb{E}({\mathbf {d}})}, ({D}^{\eps})_{\eps \in \mathbb{E}_n} \bigr)$ be an $n$-dimensional hyperbox of chain complexes. Let us imagine the hyperbox $[0, d_1] \times \dots \times [0, d_n]$ to be split into $d_1d_2 \cdots d_n$ unit hypercubes. At each vertex $\eps$ we see a chain complex $(C^{\eps}, D^{(0,\dots, 0)})$. Associated to each edge of one of the unit hypercubes is a chain map. Along the two-dimensional faces we have chain homotopies between the two possible ways of composing the edge maps, and along higher-dimensional faces we have higher homotopies.

There is a natural way of turning the hyperbox $\mathcal{H}$ into an $n$-dimensional hypercube $\hat \mathcal{H} = (\hat C^{\eps}, \hat {D}^{\eps})_{\eps \in \mathbb{E}_n}$, which we called the {\em compressed hypercube} of $\mathcal{H}$. The compressed hypercube has the property that along its $i\th$ edge we see the composition of all the $d_i$ edge maps on the $i\th$ axis of the hyperbox.

In particular, if $n=1$, then $\mathcal{H}$ is a string of chain complexes and chain maps:
$$ C^{(0)} \xrightarrow{{D}^{(1)}} C^{(1)}  \xrightarrow{{D}^{(1)}}  \cdots  \xrightarrow{{D}^{(1)}} C^{(d)}, $$
and the compressed hypercube $\hat \mathcal{H}$ is
$$  C^{(0)}  \xrightarrow{\left({D}^{(1)}\right)^{\circ d}} C^{(d)}.$$

For general $n$ and ${\mathbf {d}} = (d_1, \dots, d_n)$, the compressed hypercube $\hat \mathcal{H}$ has at its vertices the same complexes as those at the vertices of the original hyperbox $\mathcal{H}$:
$$ \hat C^{(\eps_1, \dots, \eps_n)} = C^{(\eps_1d_1, \dots, \eps_n d_n)}, \ \eps = (\eps_1, \dots, \eps_n) \in \mathbb{E}_n.$$

If along the $i\th$ coordinate axis in $\mathcal{H}$ we have the edge maps $f_i={D}^{(0, \dots, 0, 1, 0, \dots, 0)}$, then along the respective axis in $\hat \mathcal{H}$ we see $f_i^{\circ d_i}$. Given a two-dimensional face of $\mathcal{H}$ with edge maps $f_i$ and $f_j$ and chain homotopies $f_{\{i, j\}}$ between $f_i \circ f_j$ and $f_j \circ f_i$, to the respective compressed face in $\hat \mathcal{H}$ we assign the map
$$\sum_{k_i=1}^{d_i} \sum_{k_j=1}^{d_j} f_i^{\circ(k_i-1)} \circ f_j^{\circ (k_j-1)} \circ f_{\{i,j\}} \circ f_j^{\circ (d_j - k_j)} \circ f_i^{\circ (d_i - k_i)},$$
which is  a chain homotopy between $f_i^{\circ d_i} \circ f_j^{\circ d_j}$ and $f_j^{\circ d_j} \circ f_i^{\circ d_i}$. The formulas for what we assign to the higher-dimensional faces in $\hat \mathcal{H}$ are more complicated, but they always involve sums of compositions of maps in $\mathcal{H}$.

Let  $\leftexp{0}{\mathcal{H}}$ and $\leftexp{1}{\mathcal{H}}$ be two hyperboxes
of chain complexes, of the same size ${\mathbf {d}} \in (\Z_{\ge 0})^n$. A {\em
  chain map} $F : \leftexp{0}{\mathcal{H}} \to \leftexp{1}{\mathcal{H}}$  is
defined to be a collection of linear maps
$$F_{\eps^0}^\eps: \leftexp{0}{C}^{\eps^0}_* \to \leftexp{1}{C}^{\eps^0 + \eps} _{*+ \| \eps \|},$$
satisfying
$$\sum_{\eps' \leq \eps} \bigl( {D}^{\eps - \eps'}_{\eps^0 + \eps'} \circ F^{\eps'}_{\eps^0}  +   F^{\eps - \eps'}_{\eps^0 + \eps'} \circ {D}^{\eps'}_{\eps^0} \bigr)  = 0,$$
for all $\eps^0 \in \mathbb{E}({\mathbf {d}}), \eps \in \mathbb{E}_n$ such that $\eps^0 + \eps \in \mathbb{E}({\mathbf {d}})$. In particular, $F$ gives an ordinary chain map between the total complexes $\leftexp{0}{C}$ and $\leftexp{1}{C}$.

Starting with from here, we can define chain homotopies and chain homotopy equivalences between hyperboxes by analogy with the usual notions between chain complexes.

The construction of $\hat \mathcal{H}$ from $\mathcal{H}$ is natural in the following sense. Given a chain map $F : \leftexp{0}{\mathcal{H}} \to \leftexp{1}{\mathcal{H}}$, there is an induced chain map $\hat F : {}^{0}{\hat \mathcal{H}} \to {}^{1}{\hat \mathcal{H}}$ between the respective compressed hypercubes. Moreover, if $F$ is a chain homotopy equivalence, then so is $\hat F$.

\subsection {Chain complexes from grid diagrams}
\label {subsec:ags}
Consider an oriented, $\ell$-component link $\orL \subset S^3$. We denote the components of $\orL$ by
$\{ L_i\}^{\ell}_{i=1}$. Let
$$ \mathbb{H}(L)_i = \frac{{\operatorname{lk}}(L_i, L - L_i)}{2} + \Z \subset \Q, \ \ \mathbb{H}(L) = \bigoplus_{i=1}^\ell \mathbb{H}(L)_i,$$
where ${\operatorname{lk}}$ denotes linking number. Further, let
$$ \bH(L)_i = \mathbb{H}(L)_i \cup \{-\infty, + \infty\}, \ \ \bH(L) = \bigoplus_{i=1}^{\ell} \bH(L)_i.$$

Let $G$ be a toroidal grid diagram representing the link $\orL$ and having at least one free marking, as in \cite[Section 12.1]{LinkSurg}. Precisely, $G$
consists of a torus ${\mathcal{T}}$, viewed as a square in the plane with the
opposite sides identified, and split into $n$ annuli (called rows) by
$n$ horizontal circles $\alpha_1, \dots, \alpha_n$, and into $n$ other
annuli (called columns) by $n$ vertical circles $\beta_1, \dots,
\beta_n$. Further, we are given some markings on the torus, of two
types: $X$ and $O$, such that:
\begin {itemize}
\item each row and each column contains exactly one $O$ marking;
\item each row and each column contains at most one $X$ marking;
 \item if the row of an $O$ marking contains no $X$ markings, then the column of that $O$ marking  contains no $X$ markings either. An $O$ marking of this kind is called a {\em free marking}. We assume that the number $q$ of free markings is at least $1$.
  \end {itemize}

 Observe that $G$ contains exactly $n$ $O$ markings and exactly $n-q$ $X$ markings. A marking that is not free is called {\em linked}. The number $n$ is called  the {\em grid number} or the {\em size} of $G$.

  We draw horizontal
arcs between the linked markings in the same row (oriented to go from the $O$
to the $X$), and vertical arcs between the linked markings in the same column
(oriented to go from the $X$ to the $O$). Letting the vertical arcs be
overpasses whenever they intersect the horizontal arcs, we obtain a
planar diagram for a link in $S^3$, which we ask to be the given link $\orL$.

We let ${\mathbf{S}} = {\mathbf{S}}(G)$ be the set of matchings between the horizontal and vertical circles in $G$.  Any $\mathbf x \in {\mathbf{S}}$ admits a Maslov grading $M(\mathbf x) \in \Z$ and an Alexander multi-grading
$$A_i(\mathbf x) \in \mathbb{H}(L)_i, \ i \in \{1, \dots, \ell \}.$$
(For the precise formulas for $M$ and $A_i$, see \cite{MOST}, where they were written in the context of grid diagrams without free markings. However, the same formulas also apply to the present setting.)

For $\mathbf x, \mathbf y \in {\mathbf{S}}$, we let $\EmptyRect(\mathbf x, \mathbf y)$ be the space of empty
rectangles between $\mathbf x$ and $\mathbf y$, as in \cite{MOST}.  Specifically, a
{\em rectangle} from $\mathbf x$ to $\mathbf y$ is an embedded rectangle $r$ in the
torus, whose lower left and upper right corners are coordinates of
$\mathbf x$, and whose lower right and upper left corners are coordinates of
$\mathbf y$; and moreover, if all other coordinates of $\mathbf x$ coincide with all
other coordinates of $\mathbf y$. We say that the rectangle is {\em empty} if
its interior contains none of the coordinates of $\mathbf x$ (or $\mathbf y$).

For $r \in
\EmptyRect(\mathbf x, \mathbf y)$, we denote by $O_j(r)$ and $X_j (r) \in \{0,1\}$
the number of times $O_j$ (resp.\ $X_j$) appears in the interior of
$r$. We can arrange so that the free markings are labeled $O_{n-q+1}, \dots, O_n$. For simplicity, we write
\begin {equation}
\label {eq:Fi}
F_i(r) = O_{n-q+i}(r), \ i=1, \dots, q.
\end {equation}

 Let $\mathbb O_i$ and $\Xs_i$ be the set of $O$'s (resp.\ $X$'s)
belonging to the $i\th$ component of the link. We fix orderings of the
elements of $\mathbb O_i$ and $\Xs_i$, for all $i$.
The $i^{th}$ coordinate of the Alexander multi-grading is characterized
uniquely up to an overall additive constant by the property that
$$ A_i(\mathbf x) - A_i(\mathbf y) = \sum_{j \in \Xs_i} X_j(r) - \sum_{j \in \mathbb O_i} O_j(r),$$
where here $r$ is any rectangle from $\mathbf x$ to $\mathbf y$.

For $i \in \{1, \dots, \ell \}$ and $s \in  \bH(L)_i$, we set
$$ E^i_s(r) = \begin {cases}
\sum_{j \in \mathbb O_i} O_j(r) & \text{ if } \Filt_i(\mathbf x) \leq s, \Filt_i(\mathbf y) \leq s \\
(s-\Filt_i(\mathbf x)) + \sum_{j \in \Xs_i} X_j(r) & \text{ if } \Filt_i(\mathbf x) \leq s, \Filt_i(\mathbf y) \geq s \\
\sum_{j \in \Xs_i} X_j(r) & \text{ if } \Filt_i(\mathbf x) \geq s, \Filt_i(\mathbf y) \geq s \\
(\Filt_i(\mathbf x) - s) + \sum_{j \in \mathbb O_i} O_j(r) & \text{ if } \Filt_i(\mathbf x) \geq s, \Filt_i(\mathbf y) \leq s.
\end {cases} $$

Alternatively, we can write
\begin {align}
\label {eix}
E^i_s(r) &=  \max(s-A_i(\mathbf x), 0) - \max(s-A_i(\mathbf y), 0)+ \sum_{j \in \Xs_i} X_j(r) \\
\label {eio}
&= \max(A_i(\mathbf x) -s, 0) - \max(A_i(\mathbf y) -s,0) + \sum_{j \in \mathbb O_i} O_j(r).
\end {align}

In particular, $E^i_{-\infty}(r) = \sum_{j \in \Xs_i} X_j(r)$ and
$E^i_{+\infty}(r) = \sum_{j \in \mathbb O_i} O_j(r)$.

Given $\mathbf s = (s_1, \dots, s_\ell) \in \bH(L)$, we define an associated
{\em generalized Floer chain complex} $\mathfrak A^-(G, \mathbf s) = \mathfrak A^- (G, s_1, \dots, s_\ell)$ as
follows. $\mathfrak A^- (G, \mathbf s)$ is the free module over $\mathcal R = \mathbb F[[U_1,
\dots, U_{\ell+q}]]$ generated by ${\mathbf{S}}$, endowed with the differential:
$$
 \partial \mathbf x = \sum_{\mathbf y \in {\mathbf{S}}}\,\, \sum_{r\in \EmptyRect(\mathbf x, \mathbf y)} U_1^{E^1_{s_1}(r)} \cdots  U_\ell^{E^\ell_{s_\ell}(r)} \cdot U_{\ell+1}^{F_1(r)} \cdots U_{\ell+q}^{F_q(r)} \mathbf y.
$$

Note that we can view $\mathfrak A^-(G, \mathbf s)$ as a suitably modified Floer
chain complex in $\mathrm{Sym}^n({\mathcal{T}})$, equipped with Lagrangian tori $\Ta =
\alpha_1 \times \dots \times \alpha_n$, the product of horizontal
circles, and $\Tb = \beta_1 \times \dots \times \beta_n$, the product
of vertical circles. The notation $\mathbf s$ indicates the way we count
powers of $U$'s. Empty rectangles are the same as holomorphic strips
of index one in $\mathrm{Sym}^n({\mathcal{T}})$, compare \cite{MOS}.

The $\mathfrak A^- (G, \mathbf s)$ can be equipped with a ${\mathbb{Z}}$-grading $\mu_\mathbf s$
such that the differential ${\partial}$ decreases $\mu_\mathbf s$ by one. Indeed,
when none of the values $s_i$ is $-\infty$, we can set the grading on
generators to be
\begin {equation}
\label {eq:ms}
 \mu_\mathbf s(\mathbf x) = M(\mathbf x) - 2\sum_{i=1}^\ell \max(A_i(\mathbf x)-s_i, 0),
 \end {equation}
and let each $U_i$ decrease grading by $2$. When some of the values $s_i$ are $-\infty$, we replace the corresponding expressions $ \max(A_i(\mathbf x)-s_i, 0)$ by $A_i(\mathbf x)$ in the Equation~\eqref{eq:ms}.

\begin {remark}
When $L=K$ is a knot, the complex $\mathfrak A^-(G, s)$ is a multi-basepoint version of the
subcomplex $A_s^- = C\{\max(i, j-s) \leq 0\}$ of the knot Floer
complex $\CFK^{\infty}(Y, K)$, in the notation of \cite{Knots}. A similar complex
$A_s^+ = C\{\max(i, j-s) \geq 0\}$ appeared in the integer surgery formula in \cite{IntSurg}, stated there in terms of $\mathit{HF}^+$ rather than $\HFm$.
\end {remark}

\subsection {Summary of the construction}
\label {sec:summary}
For the benefit of the reader, before moving further we include here a
short summary of Sections~\ref{sec:DestabSeveral}--\ref{sec:surgery}
below. The aim of these sections is to be able to state the Surgery
Theorem~\ref{thm:Surgery}, which expresses $\HFm$ of an integral
surgery on a link $\orL \subset S^3$ (with framing $\Lambda$) as the
homology of a certain chain complex ${\mathcal{C}}^-(G, \Lambda)$ associated to a
grid diagram $G$ for~$\orL$ (with at least one free marking). Given a sublink $M \subseteq L$, we let
$G^{L-M}$ be the grid diagram for $L-M$ obtained from $G$ by deleting
all the rows and columns that support components of $M$. Roughly, the
complex ${\mathcal{C}}^-(G, \Lambda)$ is built as an $\ell$-dimensional hypercube
of complexes. Each vertex corresponds to a sublink $ M \subseteq L$,
and the chain complex at that vertex is the direct product of
generalized Floer complexes $\mathfrak A^-(G^{L-M}, \mathbf s)$, over all possible
values $\mathbf s$; the reader is encouraged to peek ahead at the
expression~\eqref{eq:cgl}.

The differential on ${\mathcal{C}}^-(G, \Lambda)$ is a sum of some maps denoted
$\Phi^{\orM}_\mathbf s$, which are associated to oriented sublinks $\orM$:
given a sublink $M$, we need to consider all its possible
orientations, not just the one induced from the orientation of
$\orL$. When $M$ has only one component, the maps $\Phi^{\orM}_\mathbf s$ are
chain maps going from a generalized Floer complex of $G^{L'}$ (for
$L'$ containing $M$) to one of $G^{L'-M}$. When $M$ has two
components, $\Phi^{\orM}_\mathbf s$ are chain homotopies between different
ways of composing the respective chain maps removing one component at
a time; for more components of
$M$ we get higher homotopies, etc. They fit together in a hypercube of
chain complexes, as in Section~\ref{sec:hyper}.

Each map $\Phi^{\orM}_\mathbf s$ will be a composition of three kinds of maps, see Equation~\eqref{eq:phims} below: an inclusion map $ {\mathcal{I}}^{\orM}_\mathbf s$, a ``destabilization map'' $ \hat{D}_{p^{\orM}(\mathbf s)}^{\orM}$, and an isomorphism $ \Psi_{p^{\orM}(\mathbf s)}^{\orM}$. (Here, $p^{\orM}(\mathbf s)$ refers to a natural projection from the set $\mathbb{H}(L)$ to itself, see Section~\ref{sec:inclusions}.) The inclusion maps $ {\mathcal{I}}^{\orM}_\mathbf s$ are defined in Section~\ref{sec:inclusions}, and go between different generalized Floer complexes for the same grid (but different values of $\mathbf s$). The destabilization maps $\hat {D}_{\mathbf s}^{\orM}$ are defined in Section~\ref{sec:desublink}, and go from a generalized Floer complex for a grid $G^{L'}$ to one associated to another diagram, which is obtained from the grid by handlesliding some beta curves over others. Finally, the isomorphisms $\Psi_\mathbf s^{\orM}$ relate these latter complexes to generalized Floer complexes for the smaller grid $G^{L'-M}$; these isomorphisms are defined in Section~\ref{subsec:ks}.

The main difficulty lies in correctly defining the destabilization maps. When the link $M$ has one component, they are constructed by composing some simpler maps ${D}^{Z}_\mathbf s$. A map ${D}^Z_\mathbf s$ corresponds to a single handleslide, done so that the new beta curve encircles a marking $Z \in M$. The type ($X$ or~$O$) of the marking $Z$ is determined by the chosen orientation $\orM$ for $M$.
More generally, we define destabilization maps corresponding to a whole set ${\mathcal{Z}}$ of markings in Section~\ref{sec:DestabSeveral} below. When ${\mathcal{Z}}$ has two markings, the respective maps ${D}^{\mathcal{Z}}_\mathbf s$ are chain homotopies; in general, the maps ${D}^{\mathcal{Z}}_\mathbf s$ fit into a hypercube of chain complexes. To construct the destabilization maps for a sublink (which we do in Section~\ref{sec:desublink}), we build a hyperbox out of  maps of the form ${D}^{\mathcal{Z}}_\mathbf s$, and apply the compression procedure from Section~\ref{sec:hyper}.

\subsection {Destabilization at a set of markings}
\label {sec:DestabSeveral}

Let $Z$ be one of the linked markings (of type $X$ or $O$) on the grid diagram
$G$. We define a subset $J(Z) \subset \bH(L)$ as follows. If $Z \in
\mathbb O_i$ for some component $L_i$, set
$$ J(Z) = \{(s_1, \dots, s_\ell) \in \bH(L) \ | \ s_i = +\infty \}.$$
If $Z \in \Xs_i$, set
$$ J(Z) = \{(s_1, \dots, s_\ell) \in \bH(L) \ | \ s_i = -\infty \}.$$

For $\mathbf s \in J(Z)$, note that when we compute powers of $U$ in the chain complex
$\mathfrak A^-(G, \mathbf s)$, the other markings in the same column or
row as $Z$ do not play any role.

Next, consider a set of linked markings ${\mathcal{Z}}= \{Z_1, \dots, Z_k \}$. We say that ${\mathcal{Z}}$ is {\em consistent} if, for any $i$, at most one of the sets ${\mathcal{Z}} \cap \mathbb O_i$ and ${\mathcal{Z}} \cap \Xs_i$ is nonempty. If ${\mathcal{Z}}$ is consistent, we set
$$ J({\mathcal{Z}}) = \bigcap_{i=1}^k J(Z_i).$$

If ${\mathcal{Z}}$ is a consistent set of linked markings, we define a new set of curves $\mathbb\beta^{\mathcal{Z}} = \{\beta_j^{{\mathcal{Z}}}\mid  j=1, \dots, n\}$ on
the torus ${\mathcal{T}}$, as follows. Let $j_i$ be the index corresponding to the vertical
circle $\beta_{j_i}$ just to the left of a marking $Z_i \in {\mathcal{Z}}$. We let
$\beta_{j_i}^{{\mathcal{Z}}}$ be a circle encircling $Z_i$ and intersecting
$\beta_{j_i}$, as well as the $\alpha$ curve just below $Z_i$, in two
points each; in other words, $\beta_{j_i}^{{\mathcal{Z}}}$ is obtained from
$\beta_j$ by handlesliding it over the vertical curve just to the
right of $Z_i$. For those $j$ that are not $j_i$ for any $Z_i \in {\mathcal{Z}}$, we
let $\beta_j^{{\mathcal{Z}}}$ be a curve that is isotopic to $\beta_j$,
intersects $\beta_j$ in two points, and does not intersect any of the
other beta curves. See Figure~\ref{fig:betaZ}. (The hypothesis about the existence of at least one free marking is important here, because it ensures that $\mathbb\beta^{\mathcal{Z}}$ contains at least one vertical beta curve.)

\begin{figure}
\begin{center}
\input{betaz.pstex_t}
\end{center}
\caption {{\bf A new collection of curves.} We show here a part of a grid diagram, with the horizontal segments lying on  curves in $\mathbb\alpha$ and the straight vertical segments lying on curves in $\mathbb\beta$. The dashed curves (including the two circles) represent curves in $\mathbb\beta^{\mathcal{Z}}$, where ${\mathcal{Z}}$ consists of the two markings $Z_1$ and $Z_2$. The maximal degree intersection point $\Theta^{\emptyset, {\mathcal{Z}}}$ is represented by the black dots.}
\label{fig:betaZ}
\end{figure}

For any consistent collection ${\mathcal{Z}}$, we denote
$$\mathbb{T}_{\beta}^{{\mathcal{Z}}} = \beta_1^{\mathcal{Z}} \times \dots \times \beta_n^{\mathcal{Z}} \subset \mathrm{Sym}^n({\mathcal{T}}).$$

The fact that $\mathbf s \in J({\mathcal{Z}})$ implies that there is a well-defined
Floer chain complex $\mathfrak A^-(\Ta, \Tb^{\mathcal{Z}}, \mathbf s)$, where the
differentials take powers of the $U_i$'s according to $\mathbf s$,
generalizing the constructions $\mathfrak A^-(G,\mathbf s)$ in a natural
manner. More precisely, $\mathfrak A^-(\Ta,\Tb^{{\mathcal{Z}}},\mathbf s)$ is generated
over $\mathcal R$ by $\Ta\cap\Tb^{{\mathcal{Z}}}$, with differential given by
$$
 \partial \mathbf x = \sum_{\mathbf y \in \Ta\cap\Tb^{{\mathcal{Z}}}} \sum_{\{\phi\in \pi_2(\mathbf x, \mathbf y) | \Mas(\phi)=1\}} U_1^{E^1_{s_1}(\phi)} \cdots  U_\ell^{E^\ell_{s_\ell}(\phi)} \cdot U_{\ell+1}^{F_1(\phi)} \cdots U_{\ell+q}^{F_q(\phi)} \mathbf y,
$$
where $\pi_2(\mathbf x, \mathbf y)$ is the set of homology classes of Whitney disks from $\mathbf x$ to $\mathbf y$, compare \cite{HolDisk}, and the functions $E^i_s$ and $F_i$ are as defined in Equations \eqref{eq:Fi}, ~\eqref{eix} or~\eqref{eio}, except we apply them to the domain of $\phi$ (a two-chain on the torus), rather than to a rectangle.

When we have two collections of linked markings ${\mathcal{Z}}, {\mathcal{Z}}'$ such that ${\mathcal{Z}}
\cup {\mathcal{Z}}'$ is consistent, we require that $\beta_i^{\mathcal{Z}}$ and
$\beta_i^{{\mathcal{Z}}'}$ intersect in exactly two points. As such, there is
always a maximal degree intersection point $\Theta^{{\mathcal{Z}}, {\mathcal{Z}}'} \in
\mathbb{T}_{\beta}^{{\mathcal{Z}}} \cap \mathbb{T}_{\beta}^{{\mathcal{Z}}'}$.

For each consistent collection of linked markings ${\mathcal{Z}}= \{Z_1, \dots, Z_m \}$, and each $\mathbf s \in J({\mathcal{Z}})$, we define an $m$-dimensional hypercube of chain complexes
$$\mathcal{H}^{\mathcal{Z}}_\mathbf s = \bigl( C^{{\mathcal{Z}}, \eps}_{\mathbf s}, {D}^{{\mathcal{Z}}, \eps}_\mathbf s \bigr)_{\eps \in \mathbb{E}_m}$$ as follows. For $\eps \in \mathbb{E}_m = \{0,1\}^m$, we let
$${\mathcal{Z}}^\eps = \{Z_i \in {\mathcal{Z}} \mid \eps_i = 1\}$$
and set
$$ C^{{\mathcal{Z}}, \eps}_{\mathbf s, *} = \mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}^\eps}, \mathbf s).$$

For simplicity, we denote $\Theta^{{\mathcal{Z}}^\eps, {\mathcal{Z}}^{\eps'}}$ by $\Theta^{\mathcal{Z}}_{\eps, \eps'}$. We write $\eps \prec \eps'$ whenever $\eps, \eps' \in \mathbb{E}_m$ are immediate successors, i.e., $\eps < \eps'$ and $\|\eps' - \eps\|=1$. For a string of immediate successors $\eps= \eps^0 \prec \eps^1 \prec \cdots \prec \eps^k = \eps'$, we let
 \begin {equation}
 \label {eq:order}
 {D}^{{\mathcal{Z}}, \eps^0 \prec \eps^1 \prec \cdots \prec \eps^k }_\mathbf s : C^{{\mathcal{Z}}, \eps}_* \to C^{{\mathcal{Z}}, \eps'}_{* + k-1},
 \end {equation}
\begin {multline*}
  {D}^{{\mathcal{Z}}, \eps^0 \prec \eps^1 \prec \cdots \prec \eps^k }_\mathbf s (\mathbf x) = \\
   \sum_{\mathbf y \in \Ta \cap \Tb^{{\mathcal{Z}}^{\eps^k}}} \sum_{\{\phi \in \pi_2(\mathbf x, \Theta^{{\mathcal{Z}}}_{\eps^0, \eps^1}, \dots,  \Theta^{{\mathcal{Z}}}_{\eps^{k-1}, \eps^k}, \mathbf y)| \mu(\phi) =1-k\}} \bigl(\# \mathcal {M}(\phi)\bigr) \cdot U_1^{E^1_{s_1}(\phi)} \cdots  U_\ell^{E^\ell_{s_\ell}(\phi)} \cdot U_{\ell+1}^{F_1(r)} \cdots U_{\ell+q}^{F_q(r)} \mathbf y
\end {multline*}
be the map defined by counting isolated pseudo-holomorphic polygons in the symmetric product $\mathrm{Sym}^n({\mathcal{T}})$. Here,
$$\pi_2(\mathbf x, \Theta^{{\mathcal{Z}}}_{\eps^0, \eps^1}, \dots,  \Theta^{{\mathcal{Z}}}_{\eps^{k-1}, \eps^k}, \mathbf y)$$ denotes the set of  homotopy classes of polygons with edges on $\Ta, \Tb^{{\mathcal{Z}}^{\eps^0}}, \dots, \Tb^{{\mathcal{Z}}^{\eps^k}}$, in this cyclic order, and with the specified vertices. The number $\mu(\phi) \in {\mathbb{Z}}$ is the Maslov index, and $\mathcal {M}(\phi)$ is the moduli space of holomorphic polygons in the class
$\phi$. The Maslov index has to be $1-k$ for the expected dimension of
the moduli space of polygons to be zero. This is because the moduli space of conformal structures on
a disk with $k+2$ marked points has dimension
$(k+2)-3=k-1$.
Note that this definition of $\mu$ is different from the one in
\cite[Section 4.2]{BrDCov}, where it denoted expected dimension.

In the special case $k=0$, we need to divide $\mathcal {M}(\phi)$ by the action of ${\mathbb{R}}$ by translations; the resulting ${D}^{{\mathcal{Z}}, \eps^0}$ is the usual differential ${\partial}$.

Define
\begin {equation}
\label {eq:dezede}
 {D}^{{\mathcal{Z}}, \eps}_\mathbf s : C^{{\mathcal{Z}}, \eps^0}_* \to C^{{\mathcal{Z}}, \eps^0+\eps}_{* + k-1}, \ \ \  {D}^{{\mathcal{Z}}, \eps}_\mathbf s = \sum_{\eps^0 \prec \eps^1 \prec \cdots \prec \eps^k = \eps^0 + \eps}
{D}^{{\mathcal{Z}}, \eps^0 \prec \eps^1 \prec \cdots \prec \eps^k }_\mathbf s .
\end {equation}

The following is a particular case of \cite[Lemma 6.12]{LinkSurg}; compare also \cite[Lemma 9.7]{HolDisk} and \cite[Lemma 4.3]{BrDCov}:

\begin {lemma}
\label {lemma:d2}
For any consistent collection ${\mathcal{Z}}= \{Z_1, \dots, Z_m \}$ and $\mathbf s \in J({\mathcal{Z}})$, the resulting $\mathcal{H}^{\mathcal{Z}}_\mathbf s= (C^{{\mathcal{Z}}, \eps}_\mathbf s, {D}^{{\mathcal{Z}}, \eps}_\mathbf s)_{\mathbf s \in \mathbb{E}_m}$ is a hypercube of chain complexes.
\end {lemma}

\begin {remark}
\label {rem:note}
For future reference, it is helpful to introduce a different notation for the maps  \eqref{eq:order} and \eqref{eq:dezede}. First, let us look at \eqref{eq:order} in the case $k=m, \ \eps^0 = (0, \dots, 0)$ and $\eps^m = (1, \dots, 1)$. A string of immediate successors $\eps^0 \prec \cdots \prec \eps^m$ is the same as a  re-ordering $(Z_{\sigma(1)}, \dots, Z_{\sigma(m)})$ of ${\mathcal{Z}}=\{Z_1, \dots, Z_m\}$, according to the permutation $\sigma$ in the symmetric group $S_m$ such that
$$ {\mathcal{Z}}^{\eps^i} = {\mathcal{Z}}^{\eps^{i-1}} \cup \{Z_{\sigma(i)}\}.$$
We then write:
$$ {D}^{(Z_{\sigma(1)}, \dots, Z_{\sigma(m)})}_\mathbf s = {D}^{{\mathcal{Z}}, \eps^0 \prec \eps^1 \prec \cdots \prec \eps^k }_\mathbf s.$$
 In particular, we let ${D}^{({\mathcal{Z}})} _\mathbf s= {D}^{(Z_1,\dots, Z_m)}_\mathbf s$ be the
 map corresponding to the identity permutation. Further, we write ${D}^{{\mathcal{Z}}}_\mathbf s$ for the longest map ${D}^{{\mathcal{Z}}, (1, \dots, 1)}_\mathbf s$ in
 the hypercube $\mathcal{H}^{\mathcal{Z}}_\mathbf s$, that is,
\begin {equation}
\label {eq:dezeds}
 {D}^{\mathcal{Z}}_\mathbf s = \sum_{\sigma \in S_m} {D}^{(Z_{\sigma(1)}, \dots, Z_{\sigma(m)})}_\mathbf s.
 \end {equation}
Observe that ${D}^{\mathcal{Z}}_\mathbf s$, unlike ${D}^{({\mathcal{Z}})}_\mathbf s$, is independent of the ordering of ${\mathcal{Z}}$. Observe also that an arbitrary map ${D}^{{\mathcal{Z}}, \eps}_\mathbf s$ from $\mathcal{H}^{\mathcal{Z}}_\mathbf s$ is the same as the longest map ${D}^{{\mathcal{Z}}^\eps}_\mathbf s$ in a sub-hypercube of $\mathcal{H}^{\mathcal{Z}}_\mathbf s$. In this notation, the result of Lemma~\ref{lemma:d2} can be written as:
$$ \sum_{{\mathcal{Z}}' \subseteq {\mathcal{Z}}} {D}^{{\mathcal{Z}} \setminus {\mathcal{Z}}'}_\mathbf s \circ {D}^{{\mathcal{Z}}}_\mathbf s = 0.$$

See Figure~\ref{fig:destabs} for a picture of the hypercube corresponding to destabilization at a set ${\mathcal{Z}} = \{Z_1, Z_2\}$ of two linked markings.

\begin{figure}
\begin{center}
\input{destabs.pstex_t}
\end{center}
\caption {{\bf Destabilization maps for two linked markings.} The straight lines represent chain maps corresponding to destabilization at one marking, and the curved map is a chain homotopy between the two compositions. Each chain map ${D}_\mathbf s^{(Z_i)}$ could also have been written as ${D}_\mathbf s^{\{Z_i\}}$.}
\label{fig:destabs}
\end{figure}

\end {remark}

\subsection {Sublinks and inclusion maps}
\label {sec:inclusions}
Suppose that $M\subseteq L$ is a sublink. We
choose an orientation on $M$ (possibly different from the one induced
from $\orL$), and denote the corresponding oriented link by $\orM$. We
let $I_+(\orL, \orM)$ (resp.\ $I_-(\orL, \orM)$) to be the set of
indices $i$ such that the component $L_i$ is in $M$ and its
orientation induced from $\orL$ is the same as (resp.\ opposite to) the
one induced from $\orM$.

For $i \in \{1, \dots, \ell\}$, we define a map $p_i^{\orM} : \bH(L)_i
\to \bH(L)_i $ by
$$ p_i^{\orM}(s) =
\begin{cases}
+\infty & \text{ if } i \in I_+(\orL, \orM), \\
-\infty & \text{ if } i \in I_-(\orL, \orM), \\
s & \text{ otherwise.}
\end {cases}$$

Then, for $\mathbf s = (s_1, \dots, s_\ell) \in \bH(L)$, we set
 $$p^{\orM} (\mathbf s)= \bigl(p_1^{\orM}(s_1), \dots, p_\ell^{\orM}(s_\ell)\bigr).$$
and define an inclusion map
$$ {\mathcal{I}}^{\orM}_\mathbf s : \mathfrak A^-(G, \mathbf s) \to \mathfrak A^- (G, p^{\orM}(\mathbf s))$$
by
\begin {equation}
\label {eq:Proj}
{\mathcal{I}}^{\orM}_\mathbf s \mathbf x =  \prod_{i \in I_+(\orL, \orM)} U_i^{\max(A_i(\mathbf x) - s_i, 0)} \cdot \prod_{i \in I_-(\orL, \orM)} U_i^{\max(s_i - A_i(\mathbf x), 0)} \cdot \mathbf x.
\end {equation}
provided the exponents are finite, that is, $s_i \neq -\infty$ for all $i \in I_+(\orL, \orM)$, and $s_i \neq +\infty$ for all $i \in I_-(\orL, \orM)$.   These conditions will always be satisfied when we consider inclusion maps in this paper.

Equations~\eqref{eix} and \eqref{eio} imply that ${\mathcal{I}}^{\orM}_\mathbf s$ is a chain map.

Let $N$ be the complement of the sublink $M$ in $L$.  We define a reduction map
\begin {equation}
\label {eq:psic}
 \psi^{\orM} : \bH(L) \longrightarrow \bH(N)
 \end {equation}
as follows. The map $\psi^{\orM}$ depends only on the summands $\bH(L)_i$ of $\bH(L)$ corresponding to $L_i \subseteq N$. Each of these $L_i$'s appears in $N$ with a (possibly different) index $j_i$, so there is a corresponding summand $\bH(N)_{j_i}$ of $\bH(N)$.
We then set
$$ \psi^{\orM}_i : \bH(L)_i \to \bH(N)_{j_i}, \ \ s_i \mapsto s_i - \frac{{\operatorname{lk}}(L_i, \orM)}{2},$$
where $L_i$ is considered with the orientation induced from $L$, while $\orM$ is with its own orientation. We then define $\psi^{\orM}$ to be the direct sum of the maps $\psi^{\orM}$, pre-composed with projection  to the relevant factors. Note that $\psi^{\orM} = \psi^{\orM} \circ p^{\orM}$.

\subsection {Destabilized complexes}
\label {subsec:ks}

Let ${\mathcal{Z}} = \{Z_1, \dots, Z_m\}$ be a consistent set of linked markings, and pick $\mathbf s \in J({\mathcal{Z}})$. In Section~\ref{sec:DestabSeveral} we introduced a Floer complex
$\mathfrak A^-(\Ta, \Tb^{\mathcal{Z}}, \mathbf s)$ based on counting holomorphic
curves. Our next goal is to describe this complex combinatorially.

Let $L({\mathcal{Z}}) \subseteq L$ be the sublink consisting of those components $L_i$ such that at least one of the markings on $L_i$ is in ${\mathcal{Z}}$. We orient $L({\mathcal{Z}})$ as $\orL({\mathcal{Z}})$, such that a component $L_i$ is given the orientation coming from $\orL$ when ${\mathcal{Z}} \cap \mathbb O_i \neq \emptyset$, and is given the opposite orientation when  ${\mathcal{Z}} \cap \Xs_i \neq \emptyset$. Moreover, we let $L(({\mathcal{Z}})) \subseteq L$ be the sublink consisting of the components $L_i$ such that either all $X$ or all $O$ markings on $L_i$ are in ${\mathcal{Z}}$.

Consider the grid diagram $G^{{\mathcal{Z}}}$ obtained from $G$ by
deleting the markings in $\Xs_i$ when ${\mathcal{Z}} \cap \mathbb O_i \neq
\emptyset$, deleting the markings in $\mathbb O_i$ when ${\mathcal{Z}} \cap \Xs_i
\neq \emptyset$, and finally deleting the
rows and columns containing the markings in ${\mathcal{Z}}$.
The former free $O$ markings in $G$ remain as free
markings in $G^{{\mathcal{Z}}}$. However, in $G^{\mathcal{Z}}$ there may be some
additional free markings, coming from linked $O$ or $X$ markings in
$G$ that were not in ${\mathcal{Z}}$, but were on the same link component as a
marking in ${\mathcal{Z}}$. To be consistent with our previous conventions, we
relabel all the newly free $X$ markings as $O$'s.

Thus, $G^{{\mathcal{Z}}}$ becomes a grid diagram (with free markings) for the link $L - L({\mathcal{Z}})$, with the orientation induced from $\orL$. We define complexes $\mathfrak A^-(G^{\mathcal{Z}}, \mathbf s)$ for $\mathbf s \in J({\mathcal{Z}})$ as in Section~\ref{subsec:ags}, but rather than assigning a separate $U$ variable to each newly free marking, we keep track of these markings using the same $U$ variables they had in $G$. This way we lose the variables $U_i$ for $L_i \subseteq L(({\mathcal{Z}}))$, so the complex $\mathfrak A^-(G^{\mathcal{Z}}, \mathbf s)$ is naturally defined over the free power series ring in the variables $U_i$ for $i=1, \dots, \ell$ with $L_i \not\subseteq L(({\mathcal{Z}}))$, as well as $U_{\ell+1}, \dots, U_{\ell+q}$. Note that holomorphic disks of index one in the symmetric product of $G^{\mathcal{Z}}$ are in one-to-one correspondence with rectangles on $G^{\mathcal{Z}}$.

For $Z \in {\mathcal{Z}}$, let $j(Z) \in \{1, \dots, \ell\}$ be such that
$L_{j(Z)}$ is the component of $L$ containing $Z$, and let $j(Z)'$
correspond to the component $L_{j(Z)'}$ containing the markings in the
row exactly under the row through $Z$. We define a complex
$$ \mathcal K({\mathcal{Z}}) =  \bigotimes_{Z \in {\mathcal{Z}}} \Bigl( \mathcal R \xrightarrow{U_{j(Z)} - U_{j(Z)'} } \mathcal R \Bigr).$$

Using the argument in \cite[Proposition 12.2]{LinkSurg}, for a suitable choice of almost complex structure on the symmetric product $\mathrm{Sym}^n ({\mathcal{T}})$, we have an isomorphism
\begin {equation}
\label {eq:psiz}
 \Psi^{\mathcal{Z}}_\mathbf s : \mathfrak A^-(\Ta, \Tb^{\mathcal{Z}}, \mathbf s) \to  \mathfrak A^-(G^{\mathcal{Z}}, \psi^{\orL({\mathcal{Z}})}(\mathbf s))[[\{U_i\}_{ L_i \subseteq L(({\mathcal{Z}})) } ]] \otimes_{\mathcal R} \mathcal K({\mathcal{Z}}).
\end {equation}
Here, the map $ \psi^{\orL({\mathcal{Z}})} : \bH(L) \longrightarrow \bH(L-L({\mathcal{Z}}))$ is as in Equation~\eqref{eq:psic}.

To get an understanding of Equation~\eqref{eq:psiz}, note that there
is a clear one-to-one correspondence between the generators of each
side. The differentials correspond likewise: on the left hand side,
apart from rectangles, we also have for example annuli as the one shown in
Figure~\ref{fig:annuli}, which give rise to the factors in the complex
$\mathcal K({\mathcal{Z}})$.

For a generic almost complex structure on the symmetric product, we still have a map $\Psi^{\mathcal{Z}}_\mathbf s$, but this is a chain homotopy equivalence rather than an isomorphism.

\begin{figure}
\begin{center}
\input{annuli.pstex_t}
\end{center}
\caption {{\bf The complex $\mathcal K({\mathcal{Z}})$.}  The figure shows
  part of a grid diagram with some arcs on the $\alpha$ and
  $\beta^{{\mathcal{Z}}}$ curves drawn. There are two intersection
  points (marked as bullets) between the alpha curve below the marking
  $Z_1 \in {\mathcal{Z}}$, and the corresponding beta curve. There are two differentials
  going from the left to the right generator: a bigon containing $Z_1$
  and an annulus containing $Z_2$, both drawn shaded in the
  diagram. This produces one of the factors in the definition of the
  complex $\mathcal K({\mathcal{Z}})$.  }
\label{fig:annuli}
\end{figure}

A particular instance of the discussion above appears when we have a sublink $M \subseteq L$, with some orientation $\orM$. We then set
 $${\mathcal{Z}}(\orM) = \bigcup_{i \in I_+(\orL, \orM)} \mathbb O_i \cup \bigcup_{i \in I_-(\orL, \orM)} \Xs_i. $$

Note that $\orL({\mathcal{Z}}(\orM)) = \orM$. In this setting, the destabilized grid diagram $G^{L - M}=G^{{\mathcal{Z}}(\orM)}$ is obtained from $G$ by
eliminating all rows and columns on which $M$ is supported. It represents the link $L - M$.

For simplicity, we denote
$$\mathcal K(\orM) = \mathcal K({\mathcal{Z}}(\orM)), \ \ J(\orM) = J({\mathcal{Z}}(\orM)),$$
and, for $\mathbf s \in J(\orM)$,
\begin {equation}
\label {eq:psim}
\Psi^{\orM}_\mathbf s = \Psi^{{\mathcal{Z}}(\orM)}_\mathbf s: \mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}(\orM)}, \mathbf s) \to \mathfrak A^-(G^{L-M}, \psi^{\orM}(\mathbf s))[[\{U_i \}_{L_i \subseteq M }]] \otimes_{\mathcal R} \mathcal K(\orM).
\end {equation}

\subsection {Destabilization of a sublink}
\label {sec:desublink}

Let $M \subseteq L$ be a sublink, endowed with an arbitrary orientation $\orM$. For any $\mathbf s \in J(\orM) = J({\mathcal{Z}}(\orM))$, we construct a hyperbox of chain complexes $\mathcal{H}^{\orL, \orM}_{ \mathbf s}$, as follows. Order the components of $M$ according to their ordering as components of $L$:
$$ M = L_{i_1} \cup \dots \cup L_{i_{m}}, \ \ i_1 < \dots < i_{m}.$$
For $j=1, \dots, m$, let us denote $M_j = L_{i_j}$ for simplicity, and equip $M_j$ with the orientation $\orM_j$ induced from $\orM$. Then ${\mathcal{Z}}(\orM_j)$ is either $\mathbb O_{i_j}$ or $\Xs_{i_j}$. In either case, we have an ordering of its elements, so we can write
$$ {\mathcal{Z}}(\orM_j) = \{Z^{\orM_j}_1, \dots, Z^{\orM_j}_{d_j} \},$$
where $d_j$ is the cardinality of ${\mathcal{Z}}(\orM_j)$.

The hyperbox $\mathcal{H}^{\orL, \orM}_\mathbf s$  is $m$-dimensional, of size ${\mathbf {d}}^M = (d_1, \dots, d_m)$. For each multi-index $\eps = (\eps_1, \dots, \eps_m) \in \mathbb{E}({\mathbf {d}}^M)$, we let ${\mathcal{Z}}(\orM)^\eps \subseteq {\mathcal{Z}}(\orM)$ be the collection of markings
$$ {\mathcal{Z}}(\orM)^{\eps} = \bigcup_{j=1}^m \{Z^{\orM_j}_1, \dots, Z^{\orM_j}_{\eps_j} \}.  $$

We then let
$$\mathbb\beta^{\eps} = \mathbb\beta^{{\mathcal{Z}}(\orM)^\eps}$$
be the collection of beta curves destabilized at the points of ${\mathcal{Z}}(\orM)^\eps$. For each $\eps$, consider the Heegaard diagram $\mathcal{H}^{\orL, \orM}_{\eps} = ({\mathcal{T}}, \mathbb\alpha, \mathbb\beta^\eps)$, with the $z$ basepoints  being the markings in $\Xs_i$ for $L_i \not\subseteq M$, and the $w$ basepoints being the markings in ${\mathcal{Z}}(\orM)$, together with those in $\mathbb O_i$ for $L_i \not\subseteq M$. This diagram represents the link $\orL - M$.

At each vertex $\eps \in \mathbb{E}({\mathbf {d}}^M)$ we place the Floer complex
$$C_\mathbf s^{\orL, \orM, \eps} = \mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}(\orM)^\eps}, \mathbf s),$$
and along the faces we have linear maps
$${D}^{\orL, \orM, \eps'}_\mathbf s = {D}_\mathbf s^{{\mathcal{Z}}(\orM)^\eps, \eps'}, \ \eps'\in \mathbb{E}_m \subseteq \mathbb{E}({\mathbf {d}}^M),$$
where $ {D}_\mathbf s^{{\mathcal{Z}}(\orM)^\eps, \eps'}$ are as in~\eqref{eq:dezede} above.

We compress the hyperbox of Floer complexes associated to $\mathcal{H}^{\orL, \orM}_{\mathbf s}$, cf.\ Section~\ref{sec:hyper}, and define
\begin {equation}
\label {eq:dezed}
\hat {D}^{\orM}_\mathbf s : \mathfrak A^-(G, \mathbf s)\to
\mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}(\orM)}, \mathbf s).
\end {equation}
to be the longest diagonal map in the compressed hypercube $\hat \mathcal{H}^{\orL, \orM}_{\mathbf s}$.

For example, when $M = L_i$ is a single component, the map $\hat {D}^{\orM}_\mathbf s$ is a composition of the triangle maps corresponding to handleslides over the basepoints in ${\mathcal{Z}}(\orM)$, in the given order.
When $M$ has several components, it is a composition of more complicated polygon maps, corresponding to chain homotopies (of higher order) between compositions of the handleslide maps.

Note that for each $\mathbf s \in \mathbb{H}(L)$, we have $p^{\orM}(\mathbf s) \in
J({\mathcal{Z}}(\orM))$ by definition. Therefore, by composing the maps
\eqref{eq:Proj}, \eqref{eq:dezed} and \eqref{eq:psim} (the latter two
taken with respect to $p^{\orM}(\mathbf s)$ rather than $\mathbf s$), we obtain a
map
\begin {equation}
  \begin{aligned}
\Phi_\mathbf s^{\orM} &: \mathfrak A^- (G, \mathbf s) \longrightarrow \mathfrak A^-(G^{L-M}, \psi^{\orM}(\mathbf s))[[\{U_i \}_{L_i \subseteq M }]] \otimes_{\mathcal R} \mathcal K(\orM),\\
\Phi_\mathbf s^{\orM} &= \Psi_{p^{\orM}(\mathbf s)}^{\orM} \circ \hat{D}_{p^{\orM}(\mathbf s)}^{\orM} \circ {\mathcal{I}}^{\orM}_\mathbf s ,
  \end{aligned}
\label {eq:phims}\end {equation}
defined for any $\mathbf s \in  \bH(L)$.

For simplicity, let us denote
\begin {equation}
\label {eq:dems}
  {D}^{\orM}_\mathbf s = \Psi_{\mathbf s}^{\orM} \circ \hat{D}_{\mathbf s}^{\orM} :
  \mathfrak A^-(G, \mathbf s) \to \mathfrak A^-(G^{L-M}, \psi^{\orM}(\mathbf s))[[\{U_i \}_{L_i \subseteq M }]] \otimes_{\mathcal R} \mathcal K(\orM).
 \end {equation}

The following is a variant of \cite[Proposition 7.4]{LinkSurg}, discussed in the proof of \cite[Proposition 12.6]{LinkSurg}:
\begin {lemma}
\label {lemma:comm}
Let $M_1 , M_2 \subseteq L$ be two disjoint sublinks, with orientations $\orM_1$ and $\orM_2$. For any $\mathbf s \in J(\orM_1)$, we have:
\begin {equation}
\label {eq:comm}
 {\mathcal{I}}^{\orM_2}_{\psi^{\orM_1}(\mathbf s)} \circ {D}^{\orM_1}_\mathbf s = {D}^{\orM_1}_{p^{\orM_2}(\mathbf s)} \circ {\mathcal{I}}^{\orM_2}_\mathbf s.
 \end {equation}
\end {lemma}

For any $\orM$ and $\mathbf s \in \bH(L)$, by applying Lemma~\ref{lemma:comm} and the properties of compression from Section~\ref{sec:hyper}, we get:
\begin {equation}
\label {eq:PhiPhi}
 \sum_{\orM_1 \amalg \orM_2 = \orM} \Phi^{\orM_2}_{\psi^{\orM_1} (\mathbf s)} \circ \Phi^{\orM_1}_{\mathbf s} = 0,
 \end {equation}
where $\orM_1$ and $\orM_2$ are considered with the orientations induced from $\orM$. See \cite[Proposition 12.6]{LinkSurg}.

\subsection {The surgery theorem}
\label {sec:surgery}

Let us fix a framing $\Lambda$ for the link $\orL$. For a component
$L_i$ of $L$, we let $\Lambda_i$ be its induced framing, thought of as
an element in $H_1(Y-L)$. This last group can be identified with
${\mathbb{Z}}^\ell$ using the basis of oriented meridians for the
components. Under this identification, for $i \neq j$, the $j\th$
component of the vector $\Lambda_i$ is the linking number between
$L_i$ and $L_j$. The $i\th$ component of $\Lambda_i$ is its
homological framing coefficient of $L_i$ as a knot.

Given a sublink $N \subseteq L$, we let $\Omega(N)$ be the set of all possible orientations on $N$. For $\orN \in \Omega(N)$, we let
$$ \Lambda_{\orL, \orN} = \sum_{i \in I_-(\orL, \orN)} \Lambda_i \in {\mathbb{Z}}^\ell.$$
We consider the $\mathcal R$-module
\begin {equation}
\label {eq:cgl}
 {\mathcal{C}}^-(G, \Lambda) = \bigoplus_{M \subseteq L}\,\, \prod_{\mathbf s \in \mathbb{H}(L)} \Bigl( \mathfrak A^-(G^{L - M}, \psi^{M}(\mathbf s))[[\{ U_i\}_{ L_i \subseteq M}]] \Bigr)  \otimes_\mathcal R \mathcal K(M),
 \end {equation}
where $\psi^{M}$ simply means $\psi^{\orM}$ with $\orM$ being the orientation induced from the one on $\orL$.

We equip ${\mathcal{C}}^-(G, \Lambda)$ with a boundary operator ${\mathcal{D}}^-$ as follows.

For $\mathbf s \in \mathbb{H}(L)$ and $\mathbf x \in \bigl( \mathfrak A^-(G^{L - M}, \psi^{M}(\mathbf s))[[\{ U_i\}_{ L_i
  \subseteq M}]] \bigr) \otimes_\mathcal R \mathcal K(M)$, we set
 \begin {align*}
{\mathcal{D}}^-(\mathbf s, \mathbf x) &= \sum_{\vphantom{\orN}N \subseteq L - M}\,\, \sum_{\orN \in \Omega(N)} (\mathbf s + \Lambda_{\orL, \orN}, \Phi^{\orN}_\mathbf s(\mathbf x)) \\
&\in  \bigoplus_{\vphantom{\orN}N \subseteq L - M} \,\,\bigoplus_{\orN \in \Omega(N)} \Bigl( \mathbf s+ \Lambda_{\orL, \orN}, \bigl( \mathfrak A^-(G^{L-M-N}, \psi^{M \cup \orN} (\mathbf s)) [[\{ U_i\}_{ L_i \subseteq M \cup N}]]\bigr)  \otimes_\mathcal R \mathcal K(M \cup N) \Bigr) \\
 &\subset {\mathcal{C}}^-(G, \Lambda).
\end {align*}

According to Equation~\eqref{eq:PhiPhi}, ${\mathcal{C}}^-(G, \Lambda)$ is a
chain complex.

Let $H(L, \Lambda) \subseteq {\mathbb{Z}}^\ell$ be the lattice generated by $\Lambda_i, i=1, \dots, \ell$. The complex  ${\mathcal{C}}^-(G, \Lambda)$ splits into a direct product of complexes ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$, according to equivalence classes ${\mathfrak{u}} \in \mathbb{H}(L)/H(L, \Lambda)$. (Note that $H(L, \Lambda)$ is not a subspace of $\mathbb{H}(L)$, but it still acts on $\mathbb{H}(L)$ naturally by addition.) Further, the space of equivalence classes $\mathbb{H}(L)/H(L, \Lambda)$ can be canonically identified with the space of ${\operatorname{Spin^c}}$ structures on the three-manifold $S^3_\Lambda(L)$ obtained from $S^3$ by surgery along the framed link $(L, \Lambda)$.

Given a ${\operatorname{Spin^c}}$ structure ${\mathfrak{u}}$ on $Y_\Lambda(L)$, we set
$$ {\mathfrak{d}}({\mathfrak{u}}) = \gcd_{\xi \in H_2(Y_\Lambda(L); {\mathbb{Z}})} \langle c_1({\mathfrak{u}}), \xi\rangle,$$
where $c_1({\mathfrak{u}})$ is the first Chern class of the ${\operatorname{Spin^c}}$ structure. Thinking of ${\mathfrak{u}}$ as an equivalence class in $\mathbb{H}(L)$, we can find a function $\nu: {\mathfrak{u}} \to {\mathbb{Z}}/({\mathfrak{d}}({\mathfrak{u}}){\mathbb{Z}})$ with the property that
$$ \nu(\mathbf s + \Lambda_i) \equiv \nu(\mathbf s) + 2s_i,$$
for any $i=1, \dots, \ell$ and $\mathbf s = (s_1, \dots, s_\ell) \in {\mathfrak{u}}$. The function $\nu$ is unique up to the addition of a constant. For $\mathbf s \in \mathbb{H}(L)$ and $\mathbf x \in \bigl( \mathfrak A^-(G^{L - M}, \psi^{M}(\mathbf s))[[\{ U_i\}_{ L_i
  \subseteq M}]] \bigr) \otimes_\mathcal R \mathcal K(M)$, let
  $$ \mu(\mathbf s, \mathbf x) = \mu^M_\mathbf s(\mathbf x) +\nu(\mathbf s) - |M|,$$
where $\mu^M_\mathbf s = \mu_{\psi^M(\mathbf s)}$ is as in Equation~\eqref{eq:ms}, and $|M|$ denotes the number of components of $M$.
Then $\mu$ gives a relative ${\mathbb{Z}}/({\mathfrak{d}}({\mathfrak{u}}){\mathbb{Z}})$-grading on the complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$. The differential
${\mathcal{D}}^-$ decreases $\mu$ by one modulo ${\mathfrak{d}}({\mathfrak{u}})$.

The following is \cite[Theorem 12.7]{LinkSurg}:
\begin {theorem}
\label {thm:Surgery}
Fix a grid diagram $G$ with $q\geq 1$ free markings, such that $G$ represents an oriented, $\ell$-component link $\orL$ in $S^3$. Fix also a framing $\Lambda$ of $L$. Then, for every ${\mathfrak{u}} \in {\operatorname{Spin^c}}(S^3_\Lambda(L))$, we have an isomorphism of relatively graded $\mathbb F[[U]]$-modules:
\begin {equation}
\label {eq:surgery}
 H_*({\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}), {\mathcal{D}}^-) \cong  \HFm_{*}(S^3_\Lambda(L), {\mathfrak{u}}) \otimes_\mathbb F H_*(T^{n-q-\ell}),
 \end {equation}
where $n$ is the grid number of $G$. \end {theorem}

Observe that the left hand side of Equation~\eqref{eq:surgery} is a priori a module over $\mathcal R = {\mathbb{F}}[[U_1, \dots, U_{\ell+q}]]$. Part of the claim of Theorem~\ref{thm:Surgery} is that all the $U_i$'s act the same way, so that we have a $\mathbb F[[U]]$-module.

\subsection {Maps induced by surgery} \label {sec:Maps} Let $L' \subseteq L$ be a sublink, with the orientation $\orL'$ induced from~$\orL$.

Denote by $W=W_{\Lambda}(L', L)$ the  cobordism from $S^3_{\Lambda|_{L'}}(L')$ to $S^3_{\Lambda}(L)$ given by surgery on $L - L'$, framed with the restriction of $\Lambda$.  Let  $H(L, \Lambda|_{L'}) \subseteq {\mathbb{Z}}^\ell$ be the sublattice generated by the framings $\Lambda_i$, for $L_i \subseteq L'$. There is an identification:
$${\operatorname{Spin^c}} ( W_{\Lambda}(L', L)) \cong \mathbb{H}(L)/H(L, \Lambda|_{L'})$$
under which the natural projection
$$\pi^{L, L'} : \bigl( \mathbb{H}(L)/H(L, \Lambda|_{L'})\bigr) \longrightarrow \bigl(\mathbb{H}(L)/H(L, \Lambda)\bigr)$$
corresponds to restricting the ${\operatorname{Spin^c}}$ structures to $S^3_{\Lambda}(L)$, while the map
$$ \psi^{L-L'}: \bigl(\mathbb{H}(L)/H(L, \Lambda|_{L'})\bigr) \to \bigl(\mathbb{H}(L')/H(L', \Lambda|_{L'})\bigr) $$
corresponds to restricting them to $S^3_{\Lambda|_{L'}}(L')$.

Observe that, for every equivalence class $\mathbf t \in \mathbb{H}(L)/H(L, \Lambda|_{L'})$,
$$ {\mathcal{C}}^-(G, \Lambda)^{L', \mathbf t} =
  \bigoplus_{L - L' \subseteq M \subseteq L}\,\prod_{\{\mathbf s \in \mathbb{H}(L)|[\mathbf s] = \mathbf t\}} \Bigl( \mathfrak A^-(G^{L - M}, \psi^{M}(\mathbf s))[[\{ U_i\}_{ L_i \subseteq M}]] \Bigr)  \otimes_\mathcal R \mathcal K(M)$$
is a subcomplex of ${\mathcal{C}}^-(G, \Lambda, \pi^{L, L'}(\mathbf t)) \subseteq {\mathcal{C}}^-(G, \Lambda)$.
This subcomplex is chain homotopy equivalent to
 $${\mathcal{C}}^-(G^{L'}, \Lambda|_{L'},  \psi^{L-L'}(\mathbf t)) \otimes H_*(T^{(n-n')-(\ell-\ell')}),$$ where
\begin{multline*}
{\mathcal{C}}^-(G^{L'}, \Lambda|_{L'},  \psi^{L-L'}(\mathbf t)) =\\
\bigoplus_{M' \subseteq L'} \prod_{\{\mathbf s' \in \mathbb{H}(L')| [\mathbf s'] = \psi^{L-L'}(\mathbf t)\}}  \Bigl( \mathfrak A^-(G^{L' - M'}, \psi^{M'}(\mathbf s'))[[\{ U_i\}_{ L_i \subseteq M'}]] \Bigr)  \otimes_{\mathcal R'} \mathcal K(M')
\end{multline*}
and $\mathcal R'$ is the power series ring in the $U_i$ variables from $L'$. The chain homotopy equivalence is induced by taking $M$ to $M' = M - (L-L')$, $\mathbf s$ to $\mathbf s'=\psi^{\orL - \orL'}(\mathbf s)$, and getting rid of the $U_i$ variables from $L - L'$ via relations coming from $\mathcal K(L-L')$.

Theorem~\ref{thm:Surgery} implies that the homology of ${\mathcal{C}}^-(G, \Lambda)^{L', \mathbf t}$ is isomorphic to
$$ \HFm_{*}(S^3_{\Lambda'}(L'), \mathbf t|_{S^3_{\Lambda|_{L'}}(L')}) \otimes H_*(T^{n-q-\ell}).$$

In \cite{HolDiskFour}, Ozsv\'ath and Szab\'o associated a map $F^-_{W,\mathbf s}$ to any cobordism $W$ between connected three-manifolds, and ${\operatorname{Spin^c}}$ structure $\mathbf t$ on that cobordism. In the case when the cobordism $W$ consists only of two-handles (i.e., is given by integral surgery on a link), the following theorem gives a way of understanding the map $F^-_{W, \mathbf t}$ in terms of grid diagrams:

\begin {theorem}
\label {thm:Cobordisms}
Let $\orL \subset S^3$ be an $\ell$-component link, $L' \subseteq L$ a sublink,  $G$ a grid diagram for $\orL$ of grid number $n$ and having $q \geq 1$ free markings, and $\Lambda$ a framing of $L$. Set $W=W_{\Lambda}(L', L)$. Then, for any $\mathbf t \in {\operatorname{Spin^c}} ( W) \cong \mathbb{H}(L)/H(L, \Lambda|_{L'})$, the following diagram commutes:
$$\begin {CD}
H_*({\mathcal{C}}^-(G, \Lambda)^{L', \mathbf t}) @>{\phantom{F^-_{W, \mathbf t} \otimes {\operatorname{Id}}}}>> H_*({\mathcal{C}}^-(G, \Lambda, \pi^{L, L'}(\mathbf t))) \\
@V{\cong}VV @VV{\cong}V \\
\HFm_{*}(S^3_{\Lambda'}(L'), \mathbf t|_{S^3_{\Lambda|_{L'}}(L')}) \otimes H_*(T^{n-q-\ell}) @>{F^-_{W, \mathbf t} \otimes {\operatorname{Id}}}>> \HFm_{*}(S^3_{\Lambda}(L), \mathbf t|_{S^3_{\Lambda|_{L}}(L)}) \otimes H_*(T^{n-q-\ell}).
\end {CD}$$
Here, the top horizontal map is induced from the inclusion of chain complexes, while the two vertical isomorphisms are the ones from Theorem~\ref{thm:Surgery}.
\end {theorem}
Theorem~\ref{thm:Cobordisms} is basically \cite[Theorem 11.1]{LinkSurg}, but stated here in the particular setting of grid diagrams. See \cite[Remark 12.8]{LinkSurg}.

\subsection {Other versions} The chain complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$ was constructed so that the version of Heegaard Floer homology appearing in Theorem~\ref{thm:Surgery} is $\HFm$. We now explain how one can construct similar chain complexes $\hat {\mathcal{C}}(G, \Lambda, {\mathfrak{u}}), {\mathcal{C}}^+(G, \Lambda, {\mathfrak{u}})$ and ${\mathcal{C}}^{\infty}(G, \Lambda, {\mathfrak{u}})$, corresponding to the theories $\widehat{\mathit{HF}},  \mathit{HF}^+$ and $\HFinf$.

The chain complex $\hat {\mathcal{C}}(G, \Lambda, {\mathfrak{u}})$ is simply obtained from ${\mathcal{C}}^-(G, \Lambda)$ by setting one of the variables $U_i$ equal to zero. Its homology computes $\widehat{\mathit{HF}}(S^3_{\Lambda}(L), {\mathfrak{u}}) \otimes H^*(T^{n-q-\ell})$.

The chain complex ${\mathcal{C}}^\infty(G, \Lambda, {\mathfrak{u}})$ is obtained from
${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$ by inverting all the $U_i$ variables. It is a
vector space over the field of semi-infinite Laurent polynomials
$$\mathcal R^{\infty} = \mathbb F[[U_1, \dots, U_{\ell+q}; U_1^{-1},\dots, U_{\ell+q}^{-1}]. $$
In other words, $\mathcal R^{\infty}$ consists of those power series in
$U_i$'s that are sums of monomials with degrees bounded from below.

Note that $C^-(G, \Lambda, {\mathfrak{u}})$ is a subcomplex of ${\mathcal{C}}^\infty(G,
\Lambda, {\mathfrak{u}})$. We denote the quotient complex by ${\mathcal{C}}^+(G,
\Lambda, {\mathfrak{u}})$. Theorems~\ref{thm:Surgery} and \ref{thm:Cobordisms}
admit the following extension:

\begin {theorem}
\label {thm:AllVersions}
Fix a grid diagram $G$ (of grid number $n$, and with $q \geq 1$ free markings) for an oriented, $\ell$-component link $\orL$
in $S^3$, and fix a framing $\Lambda$ of $L$. Choose also an ordering
of the components of $\orL$, as well as of the $O$ and $X$ markings on
the grid $G$. Set $V = H_*(T^{n-q-\ell})$. Then, for every ${\mathfrak{u}} \in {\operatorname{Spin^c}}(S^3_\Lambda(L)) \cong \mathbb{H}(L)/H(L, \Lambda)$, there are vertical isomorphisms and horizontal long exact sequences making the following diagram commute:
$$\begin {CD}
\cdots \to  H_*({\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})) @>>> H_*({\mathcal{C}}^{\infty}(G, \Lambda, {\mathfrak{u}}))  @>>> H_*({\mathcal{C}}^+(G, \Lambda, {\mathfrak{u}})) \to \cdots\\
@VV{\cong}V  @VV{\cong}V @VV{\cong}V \\
\cdots \to \HFm_{*}(S^3_\Lambda(L), {\mathfrak{u}}) \otimes V @>>>  \HFinf_{*}(S^3_\Lambda(L), {\mathfrak{u}}) \otimes V @>>>  \mathit{HF}^+_{*}(S^3_\Lambda(L), {\mathfrak{u}}) \otimes V \to \cdots
 \end {CD}$$

Furthermore, the maps in these diagrams behave naturally with respect to cobordisms, in the sense that there are commutative diagrams analogous to those in Theorem~\ref{thm:Cobordisms}, involving the cobordism maps $F^-_{W, {\mathfrak{t}}}, F^{\infty}_{W, {\mathfrak{t}}}, F^+_{W, {\mathfrak{t}}}$.
\end {theorem}
Compare \cite[Theorem 11.2]{LinkSurg}.

\subsection {Mixed invariants of closed four-manifolds}

We recall the definition of the closed four-manifold invariant from \cite{HolDiskFour}. Let $X$ be a closed, oriented four-manifold with $b_2^+(X) \geq 2$. By puncturing $X$ in two points we obtain a cobordism $W$ from $S^3$ to $S^3$. We can cut $W$ along a three-manifold $N$ so as to obtain two cobordisms $W_1, W_2$ with $b_2^+(W_i) > 0$; further, the manifold $N$  can be chosen such that $\delta H^1(N; \Z) \subset H^2(W; \Z)$ is trivial. (If this is the case, $N$ is called an {\em admissible cut}.) Let ${\mathfrak{t}}$ be a ${\operatorname{Spin^c}}$ structure on $X$ and ${\mathfrak{t}}_1, {\mathfrak{t}}_2$ its restrictions to $W_1, W_2$. In this situation, the cobordism maps
$$ F^-_{W_1, {\mathfrak{t}}_1} : \HFm(S^3) \to \HFm(N, {\mathfrak{t}}|_N)$$
and
$$ F^+_{W_2, {\mathfrak{t}}_2}: \mathit{HF}^+(N, {\mathfrak{t}}|_N) \to \mathit{HF}^+(S^3)$$
factor through $\mathit{HF}_{\operatorname{red}}(N, {\mathfrak{t}}|_N)$, where
$$ \mathit{HF}_{\operatorname{red}} = {\operatorname{Coker}}(\HFinf \to \mathit{HF}^+) \cong {\operatorname{Ker}} (\HFm \to \HFinf).$$
By composing the maps to and from $\mathit{HF}_{\operatorname{red}}$ we
obtain the mixed map
$$ F^{\operatorname{mix}}_{W, {\mathfrak{t}}}: \HFm(S^3) \to \mathit{HF}^+(S^3),$$
which changes degree by the quantity
$$ d({\mathfrak{t}}) = \frac{c_1({\mathfrak{t}})^2 - 2\chi(X) - 3\sigma(X)}{4}.$$

Let $\Theta_-$ be the maximal degree generator in $\HFm(S^3)$.  Clearly the map $ F^{\operatorname{mix}}_{W, {\mathfrak{t}}}$ can be nonzero only when $d({\mathfrak{t}})$ is even and nonnegative. If this is the case, the value
\begin {equation}
\label {eq:mixedOS}
\Phi_{X, {\mathfrak{t}}} = U^{d({\mathfrak{t}})/2} \cdot F^{\operatorname{mix}}_{W, {\mathfrak{t}}}(\Theta_-) \in \mathit{HF}^+_{0}(S^3) \cong {\mathbb{F}}
\end {equation}
is an invariant of the four-manifold $X$ and the ${\operatorname{Spin^c}}$ structure
${\mathfrak{t}}$. It is conjecturally the same as the Seiberg-Witten invariant of
$(X, {\mathfrak{t}})$.

\begin {definition}
\label {def:lp}
Let  $X$ be a closed, oriented four-manifold with $b_2^+(X) \geq 2$. A {\em
cut link presentation  for $X$} consists of a link $L \subset S^3$, a decomposition of $L$ as a disjoint union
$$ L = L_1 \amalg L_2 \amalg L_3,$$
and a framing $\Lambda$ for $L$ (with restrictions $\Lambda_i$ to $L_i, i=1, \dots, 4$)
with the following properties:
\begin {itemize}
\item $S^3_{\Lambda_1}(L_1)$ is a connected sum of $m$ copies of $S^1
  \times S^2$, for some $m \geq 0$. We denote by $W_1$ the cobordism
  from $S^3$ to $\#^m (S^1 \times S^2)$ given by $m$ one-handle
  attachments.
\item $S^3_{\Lambda_1 \cup \Lambda_2 \cup \Lambda_3} (L_1 \cup L_2
  \cup L_3)$ is a connected sum of $m'$ copies of $S^1 \times S^2$,
  for some $m' \geq 0$. We denote by $W_4$ the cobordism from $\#^{m'}
  (S^1 \times S^2)$ to $S^3$ given by $m'$ three-handle attachments.
\item If we denote by $W_2$ resp.\ $W_3$ the cobordisms from $S^3_{\Lambda_1}(L_1)$ to $S^3_{\Lambda_1\cup \Lambda_2}(L_1 \cup L_2)$, resp.\ from $S^3_{\Lambda_1\cup \Lambda_2}(L_1 \cup L_2)$ to $S^3_{\Lambda_1 \cup \Lambda_2 \cup \Lambda_3} (L_1 \cup L_2 \cup L_3)$, given by surgery on $L_2$ resp.\ $L_3$ (i.e., consisting of two-handle additions), then
$$ W = W_1 \cup W_2 \cup W_3 \cup W_4$$
is the cobordism from $S^3$ to $S^3$ obtained from $X$ by deleting two
copies of $B^4$.
\item The manifold $N=S^3_{\Lambda_1\cup \Lambda_2}(L_1 \cup L_2)$ is an admissible cut for $W$, i.e., $b_2^+(W_1 \cup W_2) > 0, b_2^+(W_3 \cup W_4) > 0$, and $\delta H^1(N) =0$ in $H^2(W)$.
\end {itemize}
\end {definition}

It is proved in \cite[Lemma 8.7]{LinkSurg} that any closed, oriented four-manifold $X$ with $b_2^+(X) \geq 2$ admits a cut link presentation.

\begin {definition}
Let  $X$ be a closed, oriented four-manifold with $b_2^+(X) \geq 2$. A {\em grid presentation} $\Gamma$ for $X$ consists of a cut link presentation $(L = L_1 \cup L_2 \cup L_3, \Lambda)$ for $X$, together with a grid presentation for $L$.
\end {definition}

The four-manifold invariant $\Phi_{X, {\mathfrak{t}}}$ can be expressed in terms of a grid presentation $\Gamma$ for $X$ as follows. By combining the maps $F^-_{W_2, {\mathfrak{t}}|_{W_2}}$ and $F^+_{W_3, {\mathfrak{t}}|_{W_3}}$ using their factorization through $\mathit{HF}_{\operatorname{red}}$, we obtain a mixed map
$$ F^{{\operatorname{mix}}}_{W_2 \cup W_3, {\mathfrak{t}}|_{W_2 \cup W_3}} : \HFm(\#^m (S^1 \times S^2)) \to \mathit{HF}^+(\#^{m'} (S^1 \times S^2)).$$

 Using Theorem~\ref{thm:AllVersions}, we can express the maps $F^-_{W_2, {\mathfrak{t}}|_{W_2}}$ and $F^+_{W_3, {\mathfrak{t}}|_{W_3}}$ (or, more precisely, their tensor product with the identity on $V= H_*(T^{n-\ell})$) in terms of counts of holomorphic polygons on a symmetric product of the grid. Combining these polygon counts, we get a mixed map
$$ F^{{\operatorname{mix}}}_{\Gamma, {\mathfrak{t}}}: H_*({\mathcal{C}}^-(G, \Lambda)^{L_1, {\mathfrak{t}}|_{W_2 \cup W_3}}) \to H_*({\mathcal{C}}^+(G, \Lambda)^{L_1 \cup L_2 \cup L_3, {\mathfrak{t}}|_{\#^{m'} (S^1 \times S^2)}}).$$
 We conclude that $F^{{\operatorname{mix}}}_{\Gamma, {\mathfrak{t}}}$ is the same as
$ F^{{\operatorname{mix}}}_{W_2 \cup W_3, {\mathfrak{t}}|_{W_2 \cup W_3}} \otimes {\operatorname{Id}}_V$,
up to compositions with isomorphisms on both the domain and the target. Note, however, that at this point we do not know how to identify elements in the domains (or targets) of the two maps in a canonical way. For example, we know that there is an isomorphism
\begin {equation}
\label {eq:isoV}
H_*({\mathcal{C}}^-(G, \Lambda)^{L_1, {\mathfrak{t}}|_{W_2 \cup W_3}}) \cong \HFm(\#^m (S^1 \times S^2)) \otimes V,
\end {equation}
but it is difficult to say exactly what the isomorphism is. Nevertheless, both $ \HFm(\#^m (S^1 \times S^2))$ and $V$ have unique maximal degree elements $\Theta_{\max}^m$ and $\Theta_V$, respectively. We can identify what $\Theta_{\max}^m \otimes \Theta_V$ corresponds to on the left hand side of ~\eqref{eq:isoV} by simply computing degrees. Let us denote the respective element by
$$\Theta_{\max}^\Gamma \in H_*({\mathcal{C}}^-(G, \Lambda)^{L_1, {\mathfrak{t}}|_{W_2 \cup W_3 }}). $$

The following proposition says that one can decide whether $\Phi_{X, {\mathfrak{t}}} \in {\mathbb{F}}$ is zero or one from  information coming from a grid presentation $\Gamma$:

\begin {proposition}
\label {prop:mixed}
Let $X$ be a closed, oriented four-manifold $X$ with $b_2^+(X) \geq 2$, with a ${\operatorname{Spin^c}}$ structure ${\mathfrak{t}}$ with $d({\mathfrak{t}}) \geq 0$ even. Let $\Gamma$ be a grid presentation for $X$. Then $\Phi_{X, {\mathfrak{t}}} = 1$ if and only if  $ U^{d({\mathfrak{t}})/2}\cdot F^{{\operatorname{mix}}}_{\Gamma, {\mathfrak{t}}} (\Theta_{\max}^\Gamma)$ is nonzero.
\end {proposition}
Compare \cite[Theorem 11.7]{LinkSurg}.

 \subsection{The link surgeries spectral sequence}
 \label {sec:spectral}
 We recall the construction from \cite[Section 4]{BrDCov}. Let $M =
 M_1 \cup \dots \cup M_\ell$ be a framed $\ell$-component link in a
 3-manifold $Y$. For each $\eps = (\eps_1, \dots, \eps_\ell) \in
 \mathbb{E}_\ell = \{0,1\}^\ell$, we let $Y(\eps)$ be the $3$-manifold
 obtained from $Y$ by doing $\eps_i$-framed surgery on $M_i$ for $i=1,
 \dots, \ell$.

When $\eps'$ is an immediate successor to $\eps$ (that is, when $\eps < \eps'$ and $\|\eps' - \eps\| = 1$), the two-handle addition from $Y(\eps)$ to $Y(\eps')$ induces a map on Heegaard Floer homology
$$ F^-_{\eps < \eps'} : \HFm(Y(\eps)) \longrightarrow \HFm (Y(\eps')). $$

The following is the link surgery spectral sequence (Theorem 4.1 in \cite{BrDCov}, but phrased here in terms of $\HFm$ rather than $\widehat{\mathit{HF}}$ or $\mathit{HF}^+$):

\begin {theorem}[Ozsv\'ath-Szab\'o]
\label {thm:OSspectral}
There is a spectral sequence whose $E^1$ term is $\bigoplus_{\eps \in
  \mathbb{E}_\ell} \HFm(Y(\eps))$, whose $d_1$ differential is obtained by
adding the maps $F^-_{\eps < \eps'}$ (for $\eps'$ an immediate
successor of $\eps$), and which converges to
$E^{\infty} \cong \HFm(Y)$.
\end {theorem}

\begin{remark}
  A special case of Theorem~\ref{thm:OSspectral} gives a spectral
  sequence relating the Khovanov homology of a link and the Heegaard
  Floer homology of its branched double cover.  See
  \cite[Theorem~1.1]{BrDCov}.
\end{remark}

The spectral sequence in Theorem~\ref{thm:OSspectral} can be
understood in terms of grid diagrams as follows.

We represent $Y(0,\dots, 0)$ itself as surgery on a framed link $(L', \Lambda')$ inside $S^3$. Let $L'_1, \dots, L'_{\ell'}$ be the components of $L'$. There is another framed link $(L=L_1 \cup \dots \cup L_\ell, \Lambda)$ in $S^3$, disjoint from $L'$, such that surgery on each component $L_i$ (with the given framing) corresponds exactly to the 2-handle addition from $Y(0, \dots, 0)$ to $Y(0, \dots, 0, 1, 0, \dots, 0)$, where the $1$ is in position $i$. For $\eps \in \mathbb{E}_\ell$, we denote by $L^\eps$ the sublink of $L$ consisting of those components $L_i$ such that $\eps_i = 1$.

Let $G$ be a toroidal grid diagram representing the link $L' \cup L
\subset S^3$. As mentioned in Section~\ref{sec:Maps}, inside the
surgery complex ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda)$ (which is an
$(\ell'+\ell)$-dimensional hypercube of chain complexes) we have
various subcomplexes which compute the Heegaard Floer homology of
surgery on the sublinks on $L' \cup L$. We will restrict our attention
to those sublinks that contain $L'$, and use the respective
subcomplexes to construct a new, $\ell$-dimensional hypercube of chain
complexes ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$ as follows.

At a vertex $\eps \in \mathbb{E}_\ell$ we put the complex
$$ {\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)^\eps = {\mathcal{C}}^-(G^{L' \cup L^\eps}, \Lambda' \cup \Lambda|_{L^\eps}) \otimes H_*(T^{(n-n_\eps)-(\ell-\| \eps \|)}),$$
where $n_\eps$ is the size of the grid diagram $G^{L' \cup L^\eps}$.

Consider now an edge from $\eps$ to $\eps' = \eps +\tau_i$ in the hypercube $\mathbb{E}_\ell$. The corresponding complex ${\mathcal{C}}^-(G^{L' \cup L^\eps}, \Lambda' \cup \Lambda|_{L^\eps})$ decomposes as a direct product over all ${\operatorname{Spin^c}}$ structures $\mathbf s$ on $Y(\eps) = S^3(L' \cup L^\eps, \Lambda' \cup \Lambda|_{L^\eps})$. As explained in Section~\ref{sec:Maps}, each factor ${\mathcal{C}}^-(G^{L' \cup L^\eps}, \Lambda' \cup \Lambda|_{L^\eps}, \mathbf s)$ (tensored with the appropriate homology of a torus) admits an inclusion into ${\mathcal{C}}^-(G^{L' \cup L^{\eps'}}, \Lambda' \cup \Lambda|_{L^{\eps'}})$ as a subcomplex. In fact, there are several such inclusion maps, one for each ${\operatorname{Spin^c}}$ structure $\mathbf t$ on the 2-handle cobordism from $Y(\eps)$ to $Y(\eps')$ such that $\mathbf t$ restricts to $\mathbf s$ on $Y(\eps)$. Adding up all the inclusion maps on each factor, one obtains a combined map
$$G^-_{\eps < \eps'} : {\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)^\eps  \longrightarrow {\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)^{\eps'}.$$

We take $G^-_{\eps < \eps'}$ to be the edge map in the hypercube of chain complexes ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$. Since the edge maps are just sums of inclusions of subcomplexes, they commute on the nose along each face of the hypercube. Therefore, in the hypercube ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$ we can take the diagonal maps to be zero, along all faces of dimension at least two.

This completes the construction of ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$. As an $\ell$-dimensional hypercube of chain complexes, its total complex admits a filtration by $-\|\eps\|$, which induces a spectral sequence; we refer to the filtration by $-\|\eps\|$ as the {\em depth filtration} on
${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$.

The following is \cite[Theorem 11.9]{LinkSurg}, adapted here to the setting of grid diagrams:

\begin {theorem}
\label{thm:SpectralSequence}
Fix a grid diagram $G$ with $q \geq 1$ free markings, such that $G$ represents an oriented link $\orL' \cup \orL$ in $S^3$. Fix also framings $\Lambda$ for $L$ and $\Lambda'$ for $L'$.  Suppose $G$ has grid number $n$, and that $L$ has $\ell$ components $L_1, \dots, L_\ell$. Let $Y(0,\dots,0) = S^3_{\Lambda'}(L')$, and let $Y(\eps)$ be obtained from $Y(0,\dots,0)$ by surgery on the components $L_i \subseteq L$ with $\eps_i = 1$ (for any $\eps \in \mathbb{E}_\ell$). Then, there is an isomorphism between the link surgeries spectral sequence from Theorem~\ref{thm:OSspectral}, tensored with $V = H_*(T^{n-q-\ell})$, and the spectral sequence associated to the depth filtration on ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$.
\end{theorem}

\section {Enhanced domains of holomorphic polygons}
\label {sec:enhanced}

\subsection {Domains and shadows}
\label {sec:shadows}

In the construction of the complex ${\mathcal{C}}^-(G, \Lambda)$ in Section~\ref{sec:surgery},
the only non-combinatorial ingredients were the holomorphic polygon counts in the definition of the maps ${D}^{\mathcal{Z}}_\mathbf s$. (We use here the notation from Remark~\ref{rem:note}.) According to Equation~\eqref{eq:dezeds},
the maps ${D}^{\mathcal{Z}}_\mathbf s$ are in turn summations of maps of the form ${D}^{({\mathcal{Z}})}_\mathbf s$, where $({\mathcal{Z}})$ denotes an ordering of a consistent collection of markings ${\mathcal{Z}}$.

Let $({\mathcal{Z}}) = (Z_1, \dots, Z_k)$. The maps
$$ {D}^{({\mathcal{Z}})}_\mathbf s : \mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}^{0}},\mathbf s) \to
\mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}^0 \cup {\mathcal{Z}}},\mathbf s),$$
correspond to destabilization (in the given order) at a set of markings ${\mathcal{Z}}$, starting
with a diagram $G$ already destabilized at a base set of markings
${\mathcal{Z}}^{0}$. Our goal is to get as close as possible to a combinatorial description of these
maps. In light of the isomorphisms~\eqref{eq:psiz}, we can assume
without loss of generality that ${\mathcal{Z}}_0 = \emptyset$. The difficulty lies in understanding the counts of pseudo-holomorphic polygons $\# \mathcal {M}(\phi)$, where
$$  \phi \in \pi_2(\mathbf x, \Theta^{\emptyset, \{Z_1\}}, \Theta^{\{Z_1\}, \{Z_1, Z_2\}}, \dots, \Theta^{\{Z_1, \dots, Z_{k-1}\}, \{Z_1, \dots, Z_{k}\} } , \mathbf y)$$
is a homotopy class of $(2+k)$-gons with edges on $$\Ta, \Tb, \Tb^{\{Z_1\}}, \Tb^{\{Z_1, Z_2\}}, \dots, \Tb^{\{Z_1, \dots, Z_k\}},$$ in this cyclic order. The Maslov index $\mu(\phi)$ is required to be $1-k$.

As in \cite[Definition 2.13]{HolDisk}, every homotopy class $\phi$ has
an associated {\em domain} $D(\phi)$ on the surface ${\mathcal{T}}$. The domain
is a linear combination of regions, i.e., connected components of the
complement in ${\mathcal{T}}$ of all the curves $\alpha, \beta, \beta^{\{Z_1\}}, \beta^{\{Z_1, Z_2\}}, \dots, \beta^{\{Z_1, \dots, Z_k\}}$. If $\phi$ admits a
holomorphic representative, then $D(\phi)$ is a linear combination of
regions, all appearing with nonnegative coefficients.

Let us mark an asterisk in each square of the grid diagram $G$. When
we construct the new beta curves $\beta^{\{Z_1\}}, \beta^{\{Z_1, Z_2\}}, \dots, \beta^{\{Z_1, \dots, Z_k\}}$ (all obtained from the original $\beta$ curves by handleslides), we make sure that each beta curve
encircling a marking does not include an asterisk, and also that
whenever we isotope a beta curve to obtain a new beta curve
intersecting it in two points, these isotopies do not cross the
asterisks.  Then the regions on ${\mathcal{T}}$ fall naturally into two types:
{\em small} regions, which do not contain asterisks, and {\em large}
regions, which do. We define the {\em shadow} ${\mathit{Sh}}(R)$ of a large
region $R$ to be the square in $G$ containing the same asterisk as
$R$; and the shadow of a small region to be the empty set.

If
$$D = \sum a_i R_i$$
is a linear combination of regions, with $a_i \in {\mathbb{Z}}$, we define its
shadow to be
$$ {\mathit{Sh}}(D) = \sum a_i {\mathit{Sh}}(R_i).$$

The {\em shadow} ${\mathit{Sh}}(\phi)$ of a homotopy class $\phi$ is defined as ${\mathit{Sh}}(D(\phi))$. See Figure~\ref{fig:shadow}.

\begin{figure}
\begin{center}
\input{shadow.pstex_t}
\end{center}
\caption {{\bf The domain of a triangle and its shadow.}  On the left,
  we show the domain $D(\phi)$ of a homotopy class $\phi$ of triangles
  in $\mathrm{Sym}^n({\mathcal{T}})$. The alpha and beta curves are the horizontal and
  vertical straight lines, respectively, while the curved arcs
  (including the one encircling $Z$) are part of the $\beta^{\{Z\}}$
  curves. The black squares mark components of $\Theta^{\emptyset, \{Z\}} \in \Tb
  \cap \Tb^{\{Z\}}$. On the right, we show the shadow ${\mathit{Sh}}(\phi)$.}
\label{fig:shadow}
\end{figure}

We will study homotopy classes $\phi$ by looking at their shadows,
together with two additional pieces of data as follows.

First, each homotopy class $\phi$ corresponds to a $(2+k)$-gon where
one vertex is an intersection point $\mathbf y \in \Ta \cap \Tb^{{\mathcal{Z}}}$. In particular, $\mathbf y$ contains exactly one of the two
intersection points between the alpha curve just below the marking
$Z_i$ and the beta curve encircling $Z_i$, for $i=1, \dots, k$. Set
$\epsilon_i = 0$ if that point is the left one, and $\epsilon_j = 1$
if it is the right one.

Second, for $i=1, \dots, k$, let $\rho_i \in \Z$ be the multiplicity of the domain $D(\phi)$ at the marking $Z_i$.

Then, we define the {\em enhanced domain} $E(\phi)$ associated to
$\phi$ to be the triple $({\mathit{Sh}}(\phi), \epsilon(\phi), \rho(\phi))$
consisting of the shadow ${\mathit{Sh}}(\phi)$, the collection
$\epsilon(\phi)=(\epsilon_1, \dots, \epsilon_k)$ corresponding to
$\mathbf y$, and the set of multiplicities $\rho(\phi) = (\rho_1, \dots,
\rho_k)$.

\subsection {Grid diagrams marked for destabilization}
\label {sec:uleft}

We now turn to studying enhanced domains on their own. For simplicity,
we will assume that all the markings $Z_1, \dots, Z_k$ relevant for
our destabilization procedure are $O$'s.  (The set of allowable
domains will be described by the same procedure if some markings are $X$'s.)

Consider a toroidal grid diagram $G$ of grid number $n$. We ignore the
$X$'s, and consider the $n$ $O$'s with associated variables $U_1,
\dots, U_n$. Note that, unlike in Section~\ref{subsec:ags}, here we
use one variable for each $O$, rather than one for each link
component.

Some subset
$$ {\mathcal{Z}} = \{O_{i_1}, \dots, O_{i_k} \} $$
of the $O$'s, corresponding to indices $i_1, \dots, i_k
\in \{1, \dots, n\}$, is marked for destabilization. (These are the
markings $Z_1, \dots, Z_k$ from the previous subsection.) We will assume that $k < n$. (This is always the case in our setting, when we start with at lest one free basepoint.) The
corresponding points on the lower left of each $O_{i_j}$ are denoted
$p_j$ and called {\em destabilization points}.

Let $C^-(G)=\CFm(\Ta, \Tb)$ be the chain complex freely generated over
${\mathbb{F}}[[U_1, \dots, U_n]]$ by the $n!$ elements of ${\mathbf{S}}(G)$, namely the
$n$-tuples of intersection points on the grid. Its differential ${\partial}$
counts rectangles, while keeping track of the $U$'s:
 $$ {\partial}^- \mathbf x = \sum_{\mathbf y \in {\mathbf{S}}(G)} \sum_{r \in \EmptyRect(\mathbf x, \mathbf y)} U_1^{O_1(r)} \cdots U_n^{O_n(r)} \mathbf y.$$

Each generator $\mathbf x \in {\mathbf{S}}(G)$ has a well-defined homological grading $M(\mathbf x) \in {\mathbb{Z}}$. Note that $M(U_i \cdot \mathbf x) = M(\mathbf x) -2$.

Let $G^{\mathcal{Z}}$ be the destabilized diagram. There is a similar complex
$C^-(G^{\mathcal{Z}})$. We identify ${\mathbf{S}}(G^{\mathcal{Z}})$ with a subset of ${\mathbf{S}}(G)$ by adjoining
to an element of ${\mathbf{S}}(G^{\mathcal{Z}})$ the destabilization points.

The set of {\em enhanced generators} ${\mathbf{ES}}(G, {\mathcal{Z}})$ consists of pairs $(\mathbf y,
\epsilon)$, where $\mathbf y\in {\mathbf{S}}(G^{\mathcal{Z}})$ and $\epsilon = (\epsilon_1, \dots,
\epsilon_k)$ is a collection of markings ($\epsilon_j = 0$ or $1$) at each
destabilization point.  We will also denote these markings as $L$ for
a left marking ($\epsilon_j = 0$) or $R$ for a right marking
($\epsilon_j = 1$).
The homological grading of an
enhanced generator is
\[ M(\mathbf y, \epsilon) = M(\mathbf y) + \sum_{j=1}^k \epsilon_j. \]

We define an enhanced destabilized complex $\mathit{EC}^-(G, {\mathcal{Z}})$ whose generators are ${\mathbf{ES}}(G, {\mathcal{Z}})$. It is formed as the tensor product of $k$ mapping cones
\begin {equation}
\label {mapcone}
 C^-(G^{\mathcal{Z}}) \to C^-(G^{\mathcal{Z}})
\end {equation}
given by the map $U_{i_j} - U_{i'_j}$ from $L$ to $R$, where
$U_{i'_j}$ corresponds to the $O$ in the row directly below the
destabilization point $p_j$. For a suitable choice of almost-complex
structure on the symmetric product, there is a natural isomorphism
$$\mathit{EC}^-(G, {\mathcal{Z}}) \cong \CFm(\Ta, \Tb^{\{O_{i_1}, \dots, O_{i_k}\}}),$$
with the caveat that on the right hand side we count different $U$ variables than we did in Section~\ref{sec:DestabSeveral}.

It was shown in \cite[Section~3.2]{MOST} that in the case $k=1$ there is a quasi-isomorphism
\begin{equation}
  \label{eq:destab-chain-map}
  F: C^-(G) \to \mathit{EC}^-(G, {\mathcal{Z}})
\end{equation}
given by counting snail-like domains as in Figure~\ref{fig:ULeft}.

\begin{figure}
\begin{center}
\input{ULeft.pstex_t}
\end{center}
\caption {{\bf Domains for destabilization at one point.}
We label initial points by dark circles, and terminal points by empty circles.
The top row lists domains of type $L$ (i.e., ending in an enhanced generator with an $L$ marking), while the second row lists
some of type $R$. Darker shading corresponds to
higher local multiplicities.  The domains in each row (top or bottom) are part of an infinite series, corresponding to increasing complexities. The series in the first row also contains the trivial domain of
type~$L$, not shown here.}
\label{fig:ULeft}
\end{figure}

\begin{definition}
  \label{def:EnhancedDomain}
Given a domain $D$ on the $\alpha$-$\beta$ grid (that is, a linear combination of squares), we let $O_i(D)$ be the multiplicity of $D$ at $O_i$. We define an {\em enhanced domain} $(D, \epsilon, \rho)$ to consists of:

\begin {itemize}
\item A domain $D$ on the grid between points $\mathbf x \in {\mathbf{S}}(G)$ and $\mathbf y \in {\mathbf{S}}(G^{\mathcal{Z}})$ (in particular, the final configuration contains all destabilization points);

\item A set of markings $\epsilon = (\epsilon_1, \dots, \epsilon_k)$
  at each destabilization point (so that $(\mathbf y, \epsilon)$ is an
  enhanced generator); and

\item A set of integers $\rho=(\rho_1, \dots, \rho_k)$, one for each destabilization point.
\end {itemize}
\end{definition}

We call $\rho_j$ the {\em real multiplicity} at $O_{i_j}$. The number
$t_j = O_{i_j}(D)$ is called the {\em total multiplicity}, and the
quantity $f_j = t_j - \rho_j$ is called the {\em fake multiplicity} at
$O_{i_j}$. The reason for this
terminology is that, if $D$ is the shadow of a holomorphic
$(k+2)$-gon~$D'$, then the real multiplicity $\rho_j$ is the multiplicity
of $D'$ at $O_{i_j}$. On the other hand, the fake multiplicity (if
positive) is the multiplicity that appears in the shadow even though
it does not come from the polygon.  For example, in the domain pictured in Figure~\ref{fig:shadow}, the fake multiplicity at the $Z$ marking is one.

Consider the full collection of real multiplicities $(N_1, \dots,
N_n)$, where $N_{i_j} = \rho_j$ for $j \in \{1, \dots, k\}$, and $N_i
= O_i(D)$ when $O_i$ is not one of the $O$'s used for
destabilization. We say that the enhanced domain $(D, \epsilon, \rho)$
goes from the generator $\mathbf x$ to $U_1^{N_1} \cdots U_n^{N_n} \cdot
(\mathbf y, \epsilon)$. These are called the initial and final point of the
enhanced domain, respectively.

We define the \emph{index} of an enhanced domain to be
\begin{equation}
  \label{eq:enhanced-index}
\begin {aligned}
I(D, \epsilon, \rho) &= M(\mathbf x) - M(U_1^{N_1} \cdots U_n^{N_n} \cdot (\mathbf y, \epsilon)) \\
&= M(\mathbf x) - M(\mathbf y) - \sum_{j=1}^k \epsilon_j  + 2\sum_{j=1}^k N_i \\
&= M(\mathbf x) - M(U_1^{O_1(D)}\cdots U_n^{O_n(D)}\cdot \mathbf y) - \sum_{j=1}^k (\epsilon_j + 2 f_j) \\
&= I(D) -  \sum_{j=1}^k (\epsilon_j + 2 f_j).
\end {aligned}
\end{equation}
Here $I(D)$ is the ordinary Maslov index of $D$, given by Lipshitz's formula \cite[Corollary 4.3]{LipshitzCyl}:
\begin {equation}
\label {eq:lipshitz}
 I(D) = \sum_{x \in \mathbf x} n_x(D) + \sum_{y \in \mathbf y} n_y(D),
 \end {equation}
 where $n_p(D)$ denotes the average multiplicity of $D$ in the four
 quadrants around the point $p$. (Lipshitz's formula in the reference
 has an extra term, the Euler measure of $D$, but this is zero in our
 case because $D$ can be decomposed into rectangles.)

For example, consider the domains in Figure~\ref{fig:ULeft}. We turn
them into enhanced domains by adding the respective marking ($L$ or
$R$) as well as choosing the real multiplicity at the destabilization
point to be zero. Then all those domains have index zero, regardless
of how many (non-destabilized) $O$'s they contain and with what
multiplicities.

\begin {lemma}
  Suppose that $(D, \epsilon, \rho)$ is the enhanced domain associated
  to a homotopy class $\phi$ of $(k+2)$-gons as in
  Section~\ref{sec:uleft}. Then the Maslov indices match: $\mu(\phi) = I(D,
  \epsilon, \rho)$.
\end {lemma}

\begin {proof}
  Note that $I(D,\epsilon, \rho)$ is the difference in Maslov indices
  between $\mathbf x$ (in the original grid diagram) and $\tilde \mathbf y =
  U_1^{N_1} \cdots U_n^{N_n} \cdot (\mathbf y, \epsilon)$ (in the destabilized
  diagram), cf.\ Equation~\eqref{eq:enhanced-index}. Because
  $\mu(\phi)$ is additive with respect to pre- or post-composition
  with rectangles, we must have $\mu(\phi) = I(D, \epsilon, \rho)+C$,
  where $C$ is a constant that only depends on the grid. To compute
  $C$, consider the trivial enhanced domain with $D=0, \epsilon = (0,
  \dots, 0), \rho =(0, \dots, 0)$. This is associated to a class
  $\phi$ whose support is a disjoint union of $n$ polygons, all of
  whom are $(k+2)$-gons with three acute angles and $k-1$ obtuse
  angles. See Figure~\ref{fig:local} for an example of a quadrilateral
  of this type. It is easy to check that $\mu(\phi)=0$, which implies
  $C=0$.
\end {proof}

Given an enhanced domain $(D, \epsilon, \rho)$, we denote by $a_j,
b_j, c_j, d_j$ the multiplicities of $D$ in the four squares around
$p_j$, as in Figure~\ref{fig:abcd}. In particular, $b_j = t_j$ is the
total multiplicity there. Note that, if $p_j \not \in \mathbf x$, then
\begin{align}
\label {eq:abcd1}
 a_j + d_j &= b_j + c_j +1,\\
\shortintertext{while if $p_j \in \mathbf x$ then}
a_j + d_j &= b_j + c_j.\label {eq:abcd0}
\end{align}

\begin{figure}
\begin{center}
\input{abcd.pstex_t}
\end{center}
\caption {{\bf Local multiplicities around a destabilization point.}
The marked point in the middle is the destabilization point ($p_j$ for left destabilization and $q_j$ for right destabilization).
}
\label{fig:abcd}
\end{figure}

\begin{definition}
  \label{def:PositiveEnhancedDomain}
  We say that the enhanced domain $(D, \epsilon, \rho)$ is {\em
    positive} if $D$ has nonnegative multiplicities everywhere in the
  grid, and, furthermore, for every $j \in \{1, \dots, k \}$, we have
\begin {equation}
\label {ineq:abcd1}
\begin{aligned}
a_j &\geq f_j,&b_j &\geq f_j,\\
c_j &\geq f_j + \epsilon_j -1,\qquad &d_j &\geq f_j +
\epsilon_j.
\end{aligned}
\end {equation}
\end{definition}

Observe that the second of the above inequalities implies $b_j - f_j = \rho_j
\geq 0$. Thus, in a positive enhanced domain, all real multiplicities $\rho_j$ are nonnegative.

\begin {lemma}
  Suppose that $(D, \epsilon, \rho)$ is the enhanced domain associated
  to a homotopy class $\phi$ of $(k+2)$-gons as in
  Section~\ref{sec:uleft}, and that the homotopy class $\phi$ admits
  at least one holomorphic representative. Then $(D, \epsilon, \rho)$
  is positive, in the sense of Definition~\ref{def:PositiveEnhancedDomain}.
\end {lemma}

\begin {proof}
  If a homotopy class $\phi$ has at least one holomorphic
  representative it has positive multiplicities (for suitable choices
  of almost-complex structure on
  the symmetric product, see for example Lemma~3.2 of~\cite{HolDisk}).
  It follows now that $D$ has nonnegative multiplicities everywhere in
  the grid and that $\rho_j = b_j - f_j \geq 0$. It remains to check
  the three other relations.

  For concreteness, let us consider the case $k=2$, with $\epsilon_j =
  0$, cf.\ Figure~\ref{fig:local}. The two circles encircling the destabilization point in the
  middle are of the type $\beta^{\{Z_1\}}$ (the right one) and
  $\beta^{\{Z_1,Z_2\}}$ (the left one).

\begin{figure}
\begin{center}
\input{local.pstex_t}
\end{center}
\caption {{\bf Local multiplicities in detail.}  This is a more
  detailed version of Figure~\ref{fig:abcd}, in which we show two
  other types of beta curves: $\beta^{\{Z_1\}}$ and
  $\beta^{\{Z_1, Z_2\}}$. We mark the local multiplicity in each region. The shaded region is the domain of a quadrilateral of index zero.}
\label{fig:local}
\end{figure}

If we are given the domain of a holomorphic quadrilateral (for
instance, the shaded one in Figure~\ref{fig:local}), at most
of the intersection points the alternating sum of nearby multiplicities is
zero.  The only exceptions are the four bulleted points in the figure,
which correspond to the vertices of the quadrilateral, and where the
alternating sum of nearby multiplicities is $\pm 1$.
(At the central intersection between an alpha and an original beta curve, there may not be a vertex and the alternating sum of the multiplicities may be~$0$.)
If $u_j$, $v_j$, and $w_j$ are the multiplicities in the regions indicated in
Figure~\ref{fig:local}, by adding up
suitable such relations between local multiplicities, we obtain
\begin{alignat*}{3}
a_j-f_j      &= a_j + \rho_j - b_j    &&= u_j &&\!\geq 0\\
c_j -f_j + 1 &= c_j +\rho_j - b_j + 1 &&= v_j &&\!\geq 0\\
d_j -f_j     &= d_j + \rho_j - b_j    &&= w_j &&\!\geq 0,
\end{alignat*}
as desired. The proof in the $\epsilon_j = 1$ case, or for other values of $k$, is similar.
\end {proof}

Note that an enhanced domain $E=(D, \epsilon, \rho)$ is determined by
its initial point~$\mathbf x$ and final point $\tilde \mathbf y = U_1^{N_1} \cdots
U_n^{N_n} \cdot (\mathbf y, \epsilon)$ up to the addition to~$D$ of linear
combinations of {\em periodic domains} of the following form:
\begin {itemize}
\item A column minus the row containing the same $O_i$;
\item A column containing one of the $O_{i_j}$'s used for destabilization.
\end {itemize}

When we add a column of the latter type, the total
multiplicity $t_j$ (and hence also the fake multiplicity $f_j$)
increase by $1$. The real multiplicity $\rho_j$ does not change.

\begin{definition}
  \label{def:PositivePair}
We say that the pair $[\mathbf x, \tilde \mathbf y]$ is {\em positive} if there
exists a positive enhanced domain with $\mathbf x$ and $\tilde \mathbf y$ as its
initial and final points.
\end{definition}

\subsection {Positive domains of negative index}

Figure~\ref{fig:ULeft2} shows some examples of positive enhanced
domains of negative index, in a twice destabilized grid. We see that
the index can get as negative as we want, even if we fix the number of
destabilizations at two (but allow the size of the grid to change).

\begin{figure}
\begin{center}
\input{ULeft2.pstex_t}
\end{center}
\caption {{\bf Positive domains of negative index.} We destabilize at
  two $O$'s, marked by the two larger circles in the picture. The top
  row shows two positive domains of type $LL$, the first of index
  $-1$, the second of index $-2$. The second row shows three positive
  domains of type $RL$, of indices $-1, -2$ and $-3$,
  respectively. Darker shading corresponds to higher local
  multiplicities.  In each case, the real multiplicity $\rho_j$ is zero.}
\label{fig:ULeft2}
\end{figure}

However, this phenomenon is impossible for one destabilization:
\begin{proposition}
\label{prop:oneO}
Let $G$ be a toroidal grid diagram with only one $O$ marked for
destabilization. Then any positive enhanced domain has nonnegative
index. Furthermore, if the enhanced domain is positive and has index
zero, then it is of one of the types from the sequences in
Figure~\ref{fig:ULeft}.
\end{proposition}

\begin {proof}
  Let us first consider a positive enhanced domain $(D, \epsilon,
  \rho)$ going between the generators $\mathbf x$ and $\tilde \mathbf y = U_1^{N_1}
  \cdots U_n^{N_n} \cdot (\mathbf y, \epsilon)$. With the notations of
  Section~\ref{sec:uleft}, we have $k=1$, $\epsilon_1 \in \{0,1\}$
  (corresponding to the type of the domain, $L$ or $R$), $a_1$, $b_1 =
  t_1$, $c_1$, $d_1$ are the local multiplicities around the
  destabilization point, and $\rho_1$ and $f_1 = t_1 - \rho_1$ are the
  real and fake multiplicities there. Note that $t_1 \geq f_1$.

  Without loss of generality we can assume that every row or column
  contains at least one square where the multiplicity of $D$ is zero;
  otherwise we could subtract that row or column and obtain
  another positive domain, whose index is at least as large. Indeed, if the row or column does not contain the destabilization point $p_1$ on its boundary, then subtracting it decreases the index by $2$. If we subtract the row just to the left of $p_1$, or the column just below $p_1$, by simultaneously increasing $\rho_1$ by one we can preserve the positivity conditions and leave the index the same. If we subtract the row or column through the $O$ marked for destabilization, while leaving $\rho$ unchanged, the positivity and the index are again unaffected.

  We say that a row or a column is \emph{special} if $\mathbf x$ and $\mathbf y$ intersect
  it in different points. Let $m$ be the number of special rows; it is
  the same as the number of special columns. Note that, as we move
  fro a row (or column) curve, the multiplicity of the domain $D$ can
  only change by $\pm 1$, and it can do that only if the row (or
  column) is special. This is because of our assumption that we have
  zeros in every row and column.

  Let us look at the column containing the destabilized $O$. The
  domain has multiplicity $d_1$ in the spot right below  $O$, and
  it has multiplicity zero on some other spot on that column. We can
  move from $O$ to the multiplicity zero spot either by going up or
  down. As we go in either direction, we must encounter at least $d_1$
  special rows. This means that the total number of special rows is at
  least $2d_1$. Using the fourth inequality in~\eqref{ineq:abcd1}, we
  get
\begin {equation}
\label {eq:mt}
m \geq 2d_1 \geq 2(f_1+ \epsilon_1).
\end {equation}

The ordinary index of the domain $D$ is given by Equation~\eqref{eq:lipshitz}, involving the sums of the average local
multiplicities of $D$ at the points of $\mathbf x$ and $\mathbf y$. One such point is the destabilization point $p_1$ which
is part of $\mathbf y$. Using the relations in Equation~\eqref{ineq:abcd1}, we find that
the average vertex multiplicity there is
\begin {equation}
\label {eq:f14}
\frac{a_1+b_1 + c_1 + d_1}{4} \geq f_1 + \frac{2\epsilon_1 - 1}{4}.
\end {equation}

On the other hand, apart from the destabilization point, $\mathbf x$ and $\mathbf y$
together have either $2m-1$ (if $p_1 \not \in \mathbf x$) or $2m$ (if $p_1
\in \mathbf x$) corner vertices, where the average multiplicity has to be at
least $1/4$. Together with Equations~\eqref{eq:mt} and \eqref{eq:f14}, this
implies that
 \begin {equation}
\label {eq:idf}
I(D) \geq \frac{2m-1}{4} + f_1 + \frac{2\epsilon_1 - 1}{4}.
\end {equation}

Using the formula for the index of an enhanced domain, together with
Equations~\eqref{eq:mt} and  \eqref{eq:idf}, we obtain
\begin {equation}
\label {equation}
I(D, \epsilon, \rho) = I(D) - \epsilon_1 - 2f_1 \geq \frac{m}{2} - f_1 - \frac{\epsilon_1}{2} - \frac{1}{2} \geq \frac{\epsilon_1-1}{2}.
\end {equation}

Since the index is an integer, we must have $I(D, \epsilon, \rho) \geq
0$. Equality happens only when $D$ has average vertex multiplicity
$1/4$ at all its corners other than the destabilization point. An easy
analysis shows that the domain must be of the required shape.
\end {proof}

\subsection {Holomorphic triangles on grid diagrams}
\label {sec:triangles}

\begin{lemma}
\label{lemma:snail}
Fix a snail-like domain $D$ (as in Figure~\ref{fig:ULeft}) for
destabilization at one point.  Then the count of holomorphic triangles
in $\mathrm{Sym}^n({\mathcal{T}})$ with $D$ as their shadow is one mod $2$.
\end{lemma}

\begin {proof}
The trivial domain $D$ of type $L$ corresponds to a homotopy class $\phi$ whose support is a disjoint union of triangles with $90^\circ$ angles. Hence, the corresponding holomorphic count is one.

To establish the claim in general, note that the destabilization map
at one point (given by counting holomorphic triangles) is a chain map
(in fact, a quasi-isomorphism) from $C^-(G)$ to $\mathit{EC}^-(G, {\mathcal{Z}})$, compare
\eqref{eq:destab-chain-map}.  By Proposition~\ref{prop:oneO}, the only
counts involved in this map are the ones corresponding to snail-like
domains. If to each snail-like domain we assign the coefficient one
when counting it in the map, the result is the chain map
\eqref{eq:destab-chain-map}. By induction on complexity, along the
lines of \cite[Lemma 3.5]{MOST}, we do indeed need to assign one to
each snail-like domain in order for the result to be a chain map.
\end {proof}

Proposition~\ref{prop:oneO} and Lemma~\ref{lemma:snail} imply that one
can count combinatorially (mod $2$) all the index zero holomorphic
triangles in a grid diagram (with one point marked for
destabilization) with fixed shadow. Indeed, if the shadow is a
snail-like domain, then the count is one, and otherwise it is zero.

\section {Formal complex structures and surgery}
\label {sec:comps}

Let $\orL \subset S^3$ be a link with framing $\Lambda$, and let ${\mathfrak{u}}$ be a  ${\operatorname{Spin^c}}$ structure on the surgered manifold $S^3_{\Lambda}(L)$. Our goal in this section is
to explain a combinatorial procedure for calculating the ranks of the
groups $\HFm(S^3_{\Lambda}(L), {\mathfrak{u}})$. The procedure will be based on
Theorem~\ref{thm:Surgery}.  The algorithm is made more
complicated because Proposition~\ref{prop:oneO} and therefore
Lemma~\ref{lemma:snail} are false if there is more than one
destabilization point; we therefore have to make an appropriate choice
of domains to count, a choice we call a ``formal complex structure''.

\subsection {The complex of positive pairs}
\label{sec:complex}
Let $G$ be a grid diagram (of size $n$) marked for destabilization at a collection ${\mathcal{Z}}$ of some
$O$'s, with $| {\mathcal{Z}}|  = k< n$, as in Section~\ref{sec:uleft}. In that section we defined the
(quasi-isomorphic) complexes $C^-(G)$ and $\mathit{EC}^-(G, {\mathcal{Z}})$. Let us consider
the Hom complex
$$ \Hom_\mathcal R (C^-(G), \mathit{EC}^-(G, {\mathcal{Z}})),$$
where $\mathcal R={\mathbb{F}}[[U_1, \dots, U_n]]$. Since $C^-(G)$ is a free $\mathcal R$-module, we can naturally identify it with its dual using the basis given by ${\mathbf{S}}(G)$. Thus, if we view the $\Hom$ complex as an ${\mathbb{F}}$-vector space, its generators (in the sense of direct products) are pairs $[\mathbf x, \tilde \mathbf y]$, where $\tilde \mathbf y$ is an
enhanced generator possibly multiplied by some powers of $U$, i.e.,
$\tilde \mathbf y = U_1^{N_1} \cdots U_n^{N_n} \cdot (\mathbf y, \epsilon)$.

The homological degree of a generator in the Hom complex is $M(\tilde
\mathbf y) - M(\mathbf x)$. However, we would like to think of the generators
as being enhanced domains (up to the addition of periodic domains), so in
order to be consistent with the formula for the index of domains we
set
$$ I([\mathbf x, \tilde \mathbf y]) = M(\mathbf x) - M(\tilde \mathbf y)$$
and view the Hom complex as a cochain complex, with a differential $d$ that increases the grading. It has the structure of an $\mathcal R$-module, where multiplication by a variable $U_i$ increases the grading by two: $U_i [\mathbf x, \tilde \mathbf y] = [\mathbf x, U_i \tilde \mathbf y]$. Note that the $\Hom$ complex is bounded from below with respect to the Maslov grading.

There is a differential on the complex given by
$$ d [\mathbf x, \tilde \mathbf y] = [{\partial}^* \mathbf x, \tilde \mathbf y] + [\mathbf x, {\partial} \tilde \mathbf y].$$
Thus, taking the differential of a domain consists in summing over the ways of pre- and post-composing the domain with a rectangle.

If a pair $[\mathbf x, \tilde \mathbf y]$ is positive (as in
Definition~\ref{def:PositivePair}), then by definition it represents a
positive domain; adding a rectangle to it keeps it positive. Indeed,
note that if the rectangle crosses an $O$ used for destabilization,
then the real and total multiplicities increase by $1$, but the fake
multiplicity stays the same, so the inequalities \eqref{ineq:abcd1}
are still satisfied.

Therefore, the positive pairs $[\mathbf x, \tilde \mathbf y]$ generate a subcomplex
$\mathit{CP}^*(G, {\mathcal{Z}})$ of the Hom complex. For the moment, let us ignore its
structure as an $\mathcal R$-module, and simply consider it as a cochain
complex over ${\mathbb{F}}$. We denote its cohomology by $\mathit{HP}^*(G, {\mathcal{Z}})$.

We make the following:
\begin {conjecture}
\label {conj}
Let $G$ be a toroidal grid diagram of size $n$ with a collection ${\mathcal{Z}}$ of $O$'s marked for destabilization, such that $|{\mathcal{Z}}| < n$. Then $\mathit{HP}^{d}(G, {\mathcal{Z}}) = 0$ for $d < 0$.
\end {conjecture}

Proposition~\ref{prop:oneO} implies Conjecture~\ref{conj} in
the case when only one $O$ is marked for destabilization. Indeed, in
that case we have $\mathit{CP}^d(G, {\mathcal{Z}}) = 0$ for $d < 0$, so the homology is
also zero.

In the case of several destabilization points, we can prove only a
weaker form of the conjecture, namely Theorem~\ref{thm:sparse}
below. However, this will suffice for our application.

\begin {definition}
  Let $G$ be a toroidal grid diagram of size $n > 1$, with a collection ${\mathcal{Z}}$ of some $O$'s marked for
  destabilization. If none of the $O$'s marked for destabilization sit
  in adjacent rows or adjacent columns, we say that the pair $(G, {\mathcal{Z}})$ is {\em
    sparse}. (Note that if $(G, {\mathcal{Z}})$ is sparse, we must have $|{\mathcal{Z}}| \leq (n+1)/2 < n$.)
\end {definition}

Recall that in the Introduction we gave a similar definition, which applies to grid diagrams $G$ (with free markings) representing links in $S^3$. Precisely, we said that $G$ is {\em sparse} if none of the linked markings sit in adjacent rows or in adjacent columns. Observe that, if $G$ is sparse, then the pair $(G, {\mathcal{Z}})$ is sparse for any collection ${\mathcal{Z}}$ of linked markings.

\begin {theorem}
\label {thm:sparse}
If $(G, {\mathcal{Z}})$ is a sparse toroidal grid diagram with $k$ $O$'s marked for destabilization, then $\mathit{HP}^d(G, {\mathcal{Z}}) = 0$ for $d < \min \{0, 2-k\}$.
\end {theorem}

Once we show this, it will also follow that, for $(G, {\mathcal{Z}})$ sparse, the
homology of $\mathit{CP}^*(G, {\mathcal{Z}}) \otimes M$ is zero in degrees $<\min \{0,
2-k\}$, where $M$ is an $\mathcal R$-module (a quotient of $\mathcal R$) obtained by
setting some of the $U$ variables equal to each other.

The proof of Theorem~\ref{thm:sparse} will be given in Section~\ref{sec:sparse}.

\subsection {An extended complex of positive pairs}
\label {sec:ext}
Let us now return to the set-up of Section~\ref{sec:Surgery}, where $\orL$ is an oriented link with a grid presentation $G$ of grid number $n$, and with $q \geq 1$ free markings.

When ${\mathcal{Z}}$ is a consistent set of linked markings ($X$'s or $O$'s) on $G$, we set
$$ J_\infty({\mathcal{Z}}) = \{ \mathbf s=(s_1, \dots, s_\ell) \in J({\mathcal{Z}}) \mid s_i = \pm \infty \text{ for all } i \}.$$

Let ${\mathcal{Z}}_0$ and ${\mathcal{Z}}$ be two disjoint sets of linked markings on $G$ such that ${\mathcal{Z}}_0 \cup {\mathcal{Z}}$ is consistent. For $\mathbf s \in J_\infty({\mathcal{Z}}_0 \cup {\mathcal{Z}})$, we can define a cochain complex
$$ \mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s),$$
which is the subcomplex of
\begin {equation}
\label {eq:Hom}
 \Hom_{\mathcal R} \bigl(\mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}_0}, \mathbf s), \mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}_0 \cup {\mathcal{Z}}}, \mathbf s)\bigr )
 \end {equation}
spanned by positive pairs. Here positivity of pairs has the same
meaning as before: it is defined in terms of enhanced domains, by
looking at the grid diagram $G^{{\mathcal{Z}}_0}$ destabilized at the points of
${\mathcal{Z}}_0$.

\begin {lemma}
\label {lemma:jinf}
If ${\mathcal{Z}}_0 \amalg {\mathcal{Z}}$ is a consistent set of linked markings on a grid $G$ and $\mathbf s, \mathbf s' \in J_\infty({\mathcal{Z}}_0 \cup {\mathcal{Z}})$, then the complexes $\mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s)$ and $ \mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s')$ are canonically isomorphic.
\end {lemma}

\begin {proof}
It suffices to consider the case when $\mathbf s$ and $\mathbf s'$ differ in only one place, say $s_i \neq s_i'$ for a component $L_i \not \subseteq L({\mathcal{Z}}_0 \cup {\mathcal{Z}})$, where $L({\mathcal{Z}}_0 \cup {\mathcal{Z}})$ is as in Section~\ref{subsec:ks}. Suppose $s_i = - \infty$ while $s_i' = +\infty$. Then the desired isomorphism is
\begin {equation}
\label {eq:cbzed}
\mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s) \longrightarrow \mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s'), \  \ \ [\mathbf x, \tilde \mathbf y] \to U_i^{A_i(\mathbf x)- A_i(\mathbf y)} [\mathbf x, \tilde \mathbf y],
\end {equation}
where $\tilde \mathbf y = U_1^{N_1} \cdots U_\ell^{N_\ell} (\mathbf y,\epsilon)$ and
$A_i$ is the component of the Alexander grading corresponding to
$L_i$. To verify that this is a well-defined map, we proceed as follows. If $D$ is a positive domain representing the pair $[\mathbf x, \tilde
\mathbf y]$, note that
$$ A_i(\mathbf x) - A_i (\mathbf y) =   \sum_{j \in \Xs_i} X_i(D) -\sum_{j \in \mathbb O_i} O_i(D) $$
and $N_i = \sum_{j \in \mathbb O_i} O_i(D)$,
so $$A_i(\mathbf x) - A_i(\mathbf y) + N_i = \sum_{j\in\Xs_i} X_i(D) \geq 0.$$
This implies that $U_i^{A_i(\mathbf x)- A_i(\mathbf y)} [\mathbf x, \tilde \mathbf y]$
is an element of $\mathit{CP}^*(G;{\mathcal{Z}}_0,{\mathcal{Z}},\mathbf s')$, with the same domain $D$ as a positive representative.
One can then easily check that the map from Equation~\eqref{eq:cbzed} is a chain map.

The inverse of \eqref{eq:cbzed} is also a positivity-preserving chain map, this time given by multiplication with $ U_i^{A_i(\mathbf y)- A_i(\mathbf x)}$. Indeed, a similar argument applies: a positive domain $D$ representing a pair $[\mathbf x, \tilde \mathbf y] $ in $\mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s')$ has $N_i  = \sum_{j \in \Xs_i} X_i(D)$, and we get $A_i(\mathbf y) - A_i(\mathbf x) + N_i \geq 0$.
\end {proof}

In view of Lemma~\ref{lemma:jinf}, we can drop $\mathbf s$ from the notation and refer to $ \mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}, \mathbf s)$ simply as $ \mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}})$.

Let $G^{{\mathcal{Z}}_0, {\mathcal{Z}}}$ be the grid diagram $G^{{\mathcal{Z}}_0}$ with all $X$
markings on components $L_i \not \subseteq L({\mathcal{Z}}_0 \cup {\mathcal{Z}})$
deleted and the remaining $X$  markings relabeled as $O$.
Further, we mark for destabilization the markings in ${\mathcal{Z}}$. Then $(G^{{\mathcal{Z}}_0, {\mathcal{Z}}}, {\mathcal{Z}})$ is a grid diagram with only $O$'s, some of them marked for destabilization, as in Sections~\ref{sec:uleft} and \ref{sec:complex}. As such, it has a complex of positive pairs $\mathit{CP}^*(G^{{\mathcal{Z}}_0, {\mathcal{Z}}}, {\mathcal{Z}})$, cf.\ Section~\ref{sec:complex}.

 In light of the isomorphisms \eqref{eq:psiz}, we see that
\begin {equation}
\label {eq:gze}
\mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}) \cong \mathit{CP}^*(G^{{\mathcal{Z}}_0, {\mathcal{Z}}}, {\mathcal{Z}}) \otimes M,
\end {equation}
where $M$ is an $\mathcal R$-module obtained by setting some $U$ variables equal to each other.

Let ${\mathcal{Z}}_0, {\mathcal{Z}}, {\mathcal{Z}}'$ be disjoint sets of linked markings  on $G$, such that ${\mathcal{Z}}_0 \cup {\mathcal{Z}} \cup {\mathcal{Z}}'$ is consistent. There are natural composition maps
\begin {equation}
\label {eq:compose}
\circ : \mathit{CP}^i(G; {\mathcal{Z}}_0 \cup {\mathcal{Z}}, {\mathcal{Z}}') \otimes \mathit{CP}^j(G; {\mathcal{Z}}_0, {\mathcal{Z}}) \to \mathit{CP}^{i+j}(G; {\mathcal{Z}}_0, {\mathcal{Z}} \cup {\mathcal{Z}}'),
\end {equation}
obtained from the respective $\Hom$ complexes by restriction.

We define the {\em extended complex of positive pairs} associated to $G$ to be
$$ \mathit{CE}^*(G) = \bigoplus_{{\mathcal{Z}}_0, {\mathcal{Z}}} \mathit{CP}^*(G; {\mathcal{Z}}_0, {\mathcal{Z}}), $$
where the direct sum is over all collections ${\mathcal{Z}}_0, {\mathcal{Z}}$ such that ${\mathcal{Z}}_0 \cup {\mathcal{Z}}$ is consistent.

This breaks into a direct sum
$$ \mathit{CE}^*(G) = \bigoplus_{k = 0}^{n-q} \mathit{CE}^*(G; k),$$
according to the cardinality $k$ of ${\mathcal{Z}}$, i.e., the number of points
marked for destabilization.  Putting together the maps
\eqref{eq:compose}, we obtain global composition maps:
\begin {equation}
\label {eq:circ}
\circ : \mathit{CE}^i(G; k) \otimes \mathit{CE}^j(G; l) \to \mathit{CE}^{i+j}(G; k+l),
\end {equation}
where the compositions are set to be zero when not a priori
well-defined on the respective summands. These composition maps
satisfy a Leibniz rule for the differential.

The complex $\mathit{CE}^*(G)$ was mentioned in the Introduction. There we stated Conjecture~\ref{conj:extended}, which says that for any toroidal grid diagram $G$, we have
$$ \mathit{HE}^d(G) = 0 \text{ when } d <0.$$

Observe that Conjecture~\ref{conj:extended} would be a direct consequence of Conjecture~\ref{conj}, because of Equation~\eqref{eq:gze}.

We prove a weaker version of Conjecture~\ref{conj:extended}, which applies only to sparse grid diagrams (as defined in the Introduction).

\begin {theorem}
\label {thm:esparse}
Let $G$ be a sparse toroidal grid diagram representing a link $L$. Then $\mathit{HE}^d(G; k) = 0$ whenever $d < \min \{0, 2-k\}$.
\end {theorem}

\begin {proof} This follows from Theorem~\ref{thm:sparse}, using
  Equation~\eqref{eq:gze}. The key observation is that all
  destabilizations of a sparse diagram at linked markings are also sparse.
\end {proof}

\subsection{Formal complex structures}

Let $G$ be a grid presentation for the link $L$, such that $G$ has $q \geq 1$ free markings.
Our goal is to find an algorithm for computing $\HFm_{*}(S^3_\Lambda(L), {\mathfrak{u}})$, where $\Lambda$ is a framing of $L$ and  ${\mathfrak{u}}$ a  ${\operatorname{Spin^c}}$ structure on $S^3_{\Lambda}(L)$. We will first describe how to do so assuming that Conjecture~\ref{conj:extended} is true, and using Theorem~\ref{thm:Surgery}.

By Theorem~\ref{thm:Surgery}, we need to compute the homology of the
complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}) \subseteq {\mathcal{C}}^-(G, \Lambda)$, with its differential ${\mathcal{D}}^-$. In the definition
of ${\mathcal{D}}^-$ we use the maps $\Phi^{\orM}_\mathbf s$, which in turn are based on
destabilization maps $\hat {D}^{\orM}_\mathbf s$ of the kind constructed in
Section~\ref{sec:desublink}. In turn, the maps $\hat {D}^{\orM}_\mathbf s$, obtained by compression, are sums
of compositions of maps of the type ${D}^{\mathcal{Z}}_\mathbf s$ (for unordered sets of
markings ${\mathcal{Z}}$), as in Section~\ref{sec:DestabSeveral}.

Consider the maps
\begin {equation}
\label {eq:dezz}
{D}^{{\mathcal{Z}}}_\mathbf s:  \mathfrak A^-(\Ta , \Tb^{{\mathcal{Z}}_0}, \mathbf s) \to \mathfrak A^-(\Ta, \Tb^{{\mathcal{Z}}_0 \cup {\mathcal{Z}}}, \mathbf s),
\end {equation}
for $\mathbf s \in J({\mathcal{Z}}_0 \cup {\mathcal{Z}})$, compare Remark~\ref{rem:note}. Each such map is defined by
counting holomorphic $(k+2)$-gons of index $1-k$ in $\mathrm{Sym}^n({\mathcal{T}})$,
where $k$ is the cardinality of ${\mathcal{Z}}$. The holomorphic polygon counts that appear are the same regardless of the value $\mathbf s \in J({\mathcal{Z}}_0 \cup {\mathcal{Z}})$. Hence, if we fix ${\mathcal{Z}}_0$ and ${\mathcal{Z}}$, the map ${D}^{{\mathcal{Z}}}_\mathbf s$ for one value of $\mathbf s$ determines those for all other $\mathbf s$.

\begin {remark}
One instance of this principle can be seen at the level of the maps
${D}^{\orM}_\mathbf s$ defined in Equation~\eqref{eq:dems}. Fixing $\orM$,
the maps ${D}^{\orM}_\mathbf s$ are determined by the map for one value of
$\mathbf s \in J(\orM)$, using Equation~\eqref{eq:comm}. Indeed, in that
situation the respective inclusion maps ${\mathcal{I}}^{\orM}_\mathbf s$ are
invertible, essentially because they satisfy
Equation~\eqref{eq:comm}. Hence, taking $\orM_1 = \orM$ and $\orM_2 =
\orL-M$, we find that the map ${D}^{\orM}_\mathbf s$ is determined by
${D}^{\orM}_{p^{\orL-M}(\mathbf s)}$.
\end {remark}

Pick some $\mathbf s \in J_\infty({\mathcal{Z}}_0 \cup {\mathcal{Z}}) \subset J({\mathcal{Z}}_0 \cup {\mathcal{Z}})$. We will focus on the map \eqref{eq:dezz} for that value $\mathbf s$. We seek to understand the map ${D}^{\mathcal{Z}}_\mathbf s$ combinatorially.

In the case $k=0$, we know that holomorphic bigons are the same as empty rectangles on ${\mathcal{T}}$,
cf.~\cite{MOS}. For $k=1$, one can still count holomorphic triangles
explicitly, cf.\ Section~\ref{sec:triangles}.

Unfortunately, for $k \geq 2$, the count of holomorphic $(k+2)$-gons
seems to depend on the almost complex structure on $\mathrm{Sym}^n({\mathcal{T}})$. The
best we can hope for is not to calculate the maps ${D}^{{\mathcal{Z}}}$
explicitly, but to calculate them up to chain homotopy. In turn, this will
give an algorithm for computing the chain complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$ up
to chain homotopy equivalence, and this is enough for knowing its homology.

Recall that a complex structure $j$ on the torus ${\mathcal{T}}$ gives rise to a
complex structure $\mathrm{Sym}^n(j)$ on the symmetric product
$\mathrm{Sym}^n({\mathcal{T}})$. In \cite{HolDisk}, in order to define Floer homology
the authors used a certain class of perturbations of $\mathrm{Sym}^n(j)$,
which are (time dependent) almost complex structures on $\mathrm{Sym}^n({\mathcal{T}})$.
For each almost complex structure $J$ in this class, one can count
$J$-holomorphic polygons for various destabilization maps. In
particular, for any
$$ \mathbf x \in \Ta \cap \Tb^{{\mathcal{Z}}_0}, \ \ \ \mathbf y \in \Ta \cap \Tb^{{\mathcal{Z}}_0 \cup {\mathcal{Z}}}, \ \tilde \mathbf y = U_1^{i_1} \cdots U_{\ell+q}^{i_{\ell+q}} (\mathbf y,\epsilon)$$
there is a number
$$ n_J^{{\mathcal{Z}}_0, {\mathcal{Z}}}(\mathbf x, \tilde \mathbf y) \in {\mathbb{F}} $$
such that the destabilization map~\eqref{eq:dezz} is given by
$$ {D}^{{\mathcal{Z}}}_\mathbf s \mathbf x = \sum_{\mathbf y} n_J^{{\mathcal{Z}}_0, {\mathcal{Z}}}(\mathbf x, \tilde \mathbf y) \cdot \tilde \mathbf y. $$

In other words, $n_J^{{\mathcal{Z}}_0, {\mathcal{Z}}}(\mathbf x, \mathbf y)$ is the count of
$J$-holomorphic $(k+2)$-gons between $\mathbf x$ and $\tilde \mathbf y$, in all
possible homotopy classes $\phi$ with $\mu(\mathbf x, \mathbf y) =\mu(\phi) = 1-k$,
and coming from all possible orderings of the elements of
${\mathcal{Z}}$. (Recall that ${D}^{{\mathcal{Z}}}$ is a sum of maps of the form
${D}^{(Z_1,\dots , Z_k)}$, where $(Z_1,\dots , Z_k)$ is an ordering of
${\mathcal{Z}}$.)

Observe that, in order for $n_J^{{\mathcal{Z}}_0, {\mathcal{Z}}}(\mathbf x, \tilde \mathbf y)$ to be
nonzero, the pair $[\mathbf x, \tilde \mathbf y]$ has to be positive. Hence, the set
of values $n_J^{{\mathcal{Z}}_0, {\mathcal{Z}}}(\mathbf x, \tilde \mathbf y)$ produces well-defined
elements in the extended complex of positive pairs on $G$:
$$ c_k(J) = \sum n_J^{{\mathcal{Z}}_0, {\mathcal{Z}}}(\mathbf x, \tilde \mathbf y) \cdot  [\mathbf x, \tilde \mathbf y] \in \mathit{CP}^{1-k}(G; {\mathcal{Z}}_0, {\mathcal{Z}}) \subseteq \mathit{CE}^{1-k}(G; k), \ \ k \geq 1.$$

Lemma~\ref{lemma:d2} implies that the elements $c_k(J)$ satisfy the
following compatibility conditions, with respect to the composition
product~\eqref{eq:circ}:
$$ dc_k(J) = \sum_{i=1}^{k-1} c_i(J) \circ c_{k-i}(J).$$

In particular, $dc_1(J) = 0$. Note that $c_1(J)$ is given by the count of snail-like domains, and therefore is independent of $J$. We denote it by
$$c_1^{{\operatorname{sn}}} \in \mathit{CE}^0(G; 1).$$

\begin {definition}
\label{def:FormalComplexStructure}
A {\em formal complex structure} $\mathfrak{c}$ on the grid diagram $G$ (of grid number $n$, and with $q \geq 1$ free markings) consists of a family of elements
$$c_k \in  \mathit{CE}^{1-k}(G; k),\quad k = 1, \dots, n-q,$$
satisfying $c_1 = c_1^{{\operatorname{sn}}}$ and the compatibility conditions:
\begin {equation}
 \label {eq:compat}
 dc_k = \sum_{i=1}^{k-1} c_i \circ c_{k-i}.
 \end {equation}
\end {definition}

In particular, an (admissible) almost complex structure $J$ on $\mathrm{Sym}^n({\mathcal{T}})$ induces a formal complex structure $\mathfrak{c}(J)$ on $G$.

\begin {remark}
If we let $\mathfrak{c}=(c_1, c_2, \dots) \in \mathit{CE}^*(G)$, the relation~\eqref{eq:compat}
is summarized by the equation
\begin {equation}
\label {eq:master}
 d\mathfrak{c} = \mathfrak{c} \circ \mathfrak{c}.
 \end {equation}
\end {remark}

\begin {definition}
\label {def:homot}
  Two formal complex structures $\mathfrak{c} = (c_1, c_2, \dots),
  \mathfrak{c}'=(c_1', c_2', \dots)$ on a grid diagram $G$ (of grid number $n$, with $q \geq 1$ free markings) are called {\em
    homotopic} if there exists a sequence of elements
$$ h_k \in \mathit{CE}^{-k}(G; k),\quad k = 1, \dots, n-q $$
satisfying $h_1 = 0$ and
\begin {equation}
\label {eq:homs}
c_k - c_k' = dh_k + \sum_{i=1}^{k-1} \bigl( c'_i \circ h_{k-i} + h_i \circ c_{k-i} \bigr ).
\end {equation}
\end {definition}

Observe that, if $J$ and $J'$ are (admissible) almost complex
structures on $\mathrm{Sym}^n({\mathcal{T}})$, one can interpolate between them by a
family of almost complex structures. The resulting counts of
holomorphic $(2+k)$-gons of index $-k$ induce a homotopy between
$\mathfrak{c}(J)$ and $\mathfrak{c}(J')$.  There is therefore a canonical homotopy class
of formal complex structures that come from actual almost complex
structures.

\begin {lemma}
\label {lemma:1k}
Assume $\mathit{HE}^{1-k}(G; k) = 0$ for any $k = 2, \dots, n-q$. Then any two formal complex structures on $G$ are homotopic.
\end {lemma}

\begin {proof}
Let $\mathfrak{c} = (c_1, c_2, \dots), \mathfrak{c}'=(c_1', c_2', \dots)$ be two formal complex structures on $G$. We prove the existence of the elements $h_k$ by induction on $k$. When $k=1$, we have $c_1 = c_1' = c_1^{{\operatorname{sn}}}$ so we can take $h_1 =0$.

Assume we have constructed $h_i$ for $i < k$ satisfying~\eqref{eq:homs},
and we need $h_k$. Since by hypothesis the cohomology group $\mathit{CE}(G;
k)$ is zero in
degree $1-k$, it suffices to show that
\begin{equation}
  \label{eq:ck-cycle}
  c_k - c_k' - \sum_{i=1}^{k-1} \bigl( c'_i \circ h_{k-i} + h_i \circ c_{k-i} \bigr )
\end{equation}
is a cocycle. Indeed, we have
\begin {multline*}
d \Bigl( c_k - c_k' - \sum_{i=1}^{k-1} \bigl( c'_i \circ h_{k-i} + h_i
\circ c_{k-i} \bigr ) \Bigr ) \\
\begin{aligned}
&= \sum_{i=1}^{k-1} c_i \circ c_{k-i} - \sum_{i=1}^{k-1} c'_i \circ c'_{k-i} - \sum_{i=1}^{k-1} \bigl( dc'_i \circ h_{k-i} + c'_i \circ dh_{k-i} + dh_i \circ c_{k-i} + h_i \circ dc_{k-i} \bigr) \\
&=
\sum_{i=1}^{k-1} (c_i - c_i' - dh_i) \circ c_{k-i} + \sum_{i=1}^{k-1} c_i' \circ (c_{k-i} - c'_{k-i} -dh_{k-i}) - \sum_{i=1}^{k-1} dc'_i \circ h_{k-i} - \sum_{i=1}^{k-1} h_i \circ dc_{k-i} \\
&= \sum(c_{\alpha}'h_{\beta} c_{\gamma} + h_{\alpha}c_{\beta}
c_{\gamma}) +  \sum(c_{\alpha}'h_{\beta} c_{\gamma} +
c'_{\alpha}c'_{\beta} h_{\gamma}) - \sum  c'_{\alpha}c'_{\beta}
h_{\gamma} - \sum  h_{\alpha}c_{\beta} c_{\gamma}\\
&= 0.
\end{aligned}
\end {multline*}
In the second-to-last line the summations are over $\alpha, \beta, \gamma \geq
1$ with $\alpha + \beta + \gamma = k$, and we suppressed the
composition symbols for simplicity.
\end {proof}

\subsection {Combinatorial descriptions}
Consider a formal complex structure $\mathfrak{c}$ on a grid $G$ (of grid number $n$, with $q \geq 1$ free markings),  a framing
$\Lambda$ for $L$, and an equivalence class ${\mathfrak{u}}  \in \bigl(\mathbb{H}(L)/H(L, \Lambda)\bigr)$ $\cong {\operatorname{Spin^c}}(S^3_\Lambda(L))$. We seek to define a complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}, \mathfrak{c})$ analogous to the complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$ from Section~\ref{sec:surgery}, but defined using the elements $c_k$ instead
of the holomorphic polygon counts. (In particular, if $\mathfrak{c} = \mathfrak{c}(J)$
for an actual almost complex structure $J$, we want to recover the
complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}})$ from Section~\ref{sec:surgery}.)

Let us explain the construction of ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}},
\mathfrak{c})$. Recall that in Section~\ref{sec:surgery} the complex ${\mathcal{C}}^-(G,
\Lambda, {\mathfrak{u}})$ was built by combining hypercubes of the form
$\mathcal{H}^{{\mathcal{Z}}}_\mathbf s$, for various consistent sets of linked markings ${\mathcal{Z}}$ and
values $\mathbf s \in J({\mathcal{Z}})$. We can define analogous
hypercubes $\mathcal{H}^{\mathcal{Z}}_\mathbf s(\mathfrak{c})$, by counting $(k+2)$-gons according
to the coefficients of enhanced domains that appear in $\mathfrak{c}_k$.

Taking into account the naturality properties of compression discussed at the end of Section~\ref{sec:hyper}, the proof of the following lemma is straightforward:

\begin {lemma}
\label {lemma:xx}
A homotopy between formal complex structures $\mathfrak{c}, \mathfrak{c}'$ on $G$
induces a chain homotopy equivalence between the complexes ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}, \mathfrak{c})$
and ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}, \mathfrak{c}')$.
\end {lemma}

With this in mind, we are ready to prove the two theorems advertised in the Introduction.

\begin{proof}[Proof of Theorem~\ref{thm:Three}]
The algorithm to compute $\HFm$ of an integral surgery on a link $\orL$
goes as follows. First, choose a sparse grid diagram $G$ for $\orL$ (for example, by taking the sparse double of an ordinary grid diagram, as in Figure~\ref{fig:sparse}). Then, choose any formal complex structure on $G$, construct the complex
${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}, \mathfrak{c})$, and take its homology.

Let us explain why this algorithm is finite and gives the desired answer. Observe that
$\mathit{CE}^*(G)$ is finite in each degree, and the number $k$ of destabilization
points is bounded above by $n-q$, so the direct sum $\oplus_{k \geq 1} \mathit{CE}^{1-k}(G; k)$ is a finite set. Further, we know that a
formal complex structure exists, because it could be induced by some
almost complex structure $J$. Thus, we can find a formal complex structure $\mathfrak{c}$ on $G$ by a brute
force approach: go over all the (necessarily finite) sequences $ \mathfrak{c} = (c_1=c_1^{{\operatorname{sn}}}, c_2, c_3, \dots)  \in \oplus_{k \geq 1} \mathit{CE}^{1-k}(G; k)$, and pick the first one that satisfies Equation~\eqref{eq:master}. Then, by Theorem~\ref{thm:esparse} and Lemma~\ref{lemma:1k} we know that all
possible $\mathfrak{c}$'s are homotopic. Lemma~\ref{lemma:xx}, together
with Theorem~\ref{thm:Surgery}, tells us that the homology of ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}}, \mathfrak{c})$ is indeed the right answer (after dividing out the factor corresponding to the homology of a torus).

(We could alternately take a somewhat more efficient, step-by-step approach to finding $\mathfrak{c}$:
start with $c_1=c_1^{{\operatorname{sn}}}$ and inductively find each $c_k$ for $k
\ge 2$.  Since Formula~\eqref{eq:ck-cycle} represents a cycle, the
obstruction to extending a partial formal complex structure to the next step
vanishes.)

Note that although this description is combinatorial in nature, the complex ${\mathcal{C}}^-(G, \Lambda, {\mathfrak{u}},
\mathfrak{c})$ is still infinite dimensional, being an infinite direct product of modules over a ring of power series. However, we can replace it by a quasi-isomorphic, finite dimensional complex over ${\mathbb{F}}={\mathbb{Z}}/2{\mathbb{Z}}$ using the vertical and horizontal truncation procedures from \cite[Section 6]{LinkSurg}. Taking the homology of the truncated complex is clearly an algorithmic task.

One can calculate the other versions of Heegaard Floer homology ($\HFinf, \mathit{HF}^+$) in a similar way, using Theorem~\ref{thm:AllVersions}.
\end {proof}

\begin{proof}[Proof of Theorem~\ref{thm:Four}]
One can calculate the maps induced by two-handle additions using Theorems~\ref{thm:Cobordisms} and \ref{thm:AllVersions}. Furthermore, we can calculate the mixed invariants of closed four-manifolds using Proposition~\ref{prop:mixed}. In all cases, one proceeds by choosing an arbitrary formal complex structure $\mathfrak{c}$ on the grid diagram $G$, and computing the respective groups or maps using polygon counts prescribed by $\mathfrak{c}$.
\end {proof}

We also have the following:

\begin {theorem}
\label {thm:SpectralComb}
Fix a sparse grid diagram $G$ for an oriented link $\orL' \cup \orL$ in $S^3$. Fix also framings $\Lambda$ for $L$ and $\Lambda'$ for $L'$.  Suppose that $L$ has $\ell$ components $L_1, \dots, L_\ell$. Let $Y(0,\dots,0) = S^3_{\Lambda'}(L')$, and, for any $\eps \in \mathbb{E}_\ell$, let $Y(\eps)$ be obtained from $Y(0,\dots,0)$ by surgery on the components $L_i \subseteq L$ with $\eps_i = 1$. Then, all the pages of the link surgeries spectral sequence from Theorem~\ref{thm:OSspectral} (with $E^1 = \oplus_{\eps \in \mathbb{E}_\ell} \CFm(Y(\eps))$ and coefficients in ${\mathbb{F}} ={\mathbb{Z}}/2{\mathbb{Z}}$) are algorithmically computable.
\end {theorem}

\begin {proof}
Use the equivalent description of the spectral sequence given in Theorem~\ref{thm:SpectralSequence}. Choose a formal complex structure $\mathfrak{c}$ on the grid diagram $G$, and construct a complex  ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda, \mathfrak{c} \! \sslash \! L)$ analogous to ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda \! \sslash \! L)$, but using the polygon counts given by $\mathfrak{c}$. Then compute the spectral sequence associated to the depth filtration on ${\mathcal{C}}^-(G, \Lambda' \cup \Lambda, \mathfrak{c} \! \sslash \! L)$.
\end {proof}

\begin {remark}
Suppose a link $L$ has grid number $m$, that is, $m$ is the lowest number such that $G$ admits a grid presentation of that size. Our algorithms above are based on a sparse grid diagram for $L$, and such a diagram must have grid number at least $2m$. If Conjecture~\ref{conj:extended} were true, we would obtain more efficient algorithms, because we could start with a diagram of grid number only $m+1$ (by adding only one free marking to the minimal grid).
\end {remark}

\begin {remark}
Our present techniques do not give a combinatorial procedure for
finding the map $F^-_{W,\mathbf t}$ associated to an arbitrary cobordism map  (in a given degree)
or even its rank. However, suppose $W$ is a cobordism between
connected three-manifolds $Y_1$ and $Y_2$ such that the induced maps
$H_1(Y_1; {\mathbb{Z}})/{\operatorname{Tors}} \to H_1(W; {\mathbb{Z}})/{\operatorname{Tors}}$ and $H_1(Y_2; {\mathbb{Z}})/{\operatorname{Tors}}
\to H_1(W; {\mathbb{Z}})/{\operatorname{Tors}}$ are surjective. Then the ranks of $F^-_{W,
  {\mathfrak{t}}}$ in fixed degrees can be computed using the same arguments as
in \cite[Section 4]{LMW}. Indeed, they are determined by the ranks of
the map induced by the two-handle additions which are part of the
cobordism $W$.
\end {remark}

\section{Sparse grid diagrams}
\label {sec:sparse}

This section is devoted to the proof of Theorem~\ref{thm:sparse}. Let
$(G, {\mathcal{Z}})$ be a sparse toroidal grid diagram with some $O$'s marked for
destabilization, as in Section~\ref{sec:uleft}. We define a filtration
${\mathcal{F}}$ on $\mathit{CP}^*(G, {\mathcal{Z}})$ as follows. Let us mark one $X$ in each square of
the grid with the property that neither its row nor its column
contains an $O$ marked for destabilization.  (Note that these $X$'s
have nothing to do with the original set of $X$'s from the link.) See
Figure~\ref{fig:ys}, where the squares
marked by an $X$ are shown shaded.

Given a pair $[\mathbf x, \tilde \mathbf y]$, let $(D, \epsilon, \rho)$ be an
enhanced domain from $\mathbf x$ to $\tilde \mathbf y$. Let $X(D)$ be the number of
$X$'s inside $D$, counted with multiplicity. Define
\begin {equation}
\label {eq:fex}
{\mathcal{F}}([\mathbf x, \tilde \mathbf y]) = -X(D) - \sum_{j=1}^k \rho_{j}.
\end {equation}

It is easy to see that $X(D)$ does not change under addition of
periodic domains. Since the same is true for the real multiplicities
$\rho_{j}$, the value ${\mathcal{F}}([\mathbf x, \tilde \mathbf y])$  is well-defined. Furthermore, pre- or post-composing
with a rectangle can only decrease ${\mathcal{F}}$, so ${\mathcal{F}}$ is indeed a
filtration on $\mathit{CP}^*(G, {\mathcal{Z}})$.

To show that $\mathit{HP}^d(G, {\mathcal{Z}}) = 0 $ (for $d > 0$) it suffices to check that
the homology of the associated graded groups to ${\mathcal{F}}$ are zero. In the
associated graded complex ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$, the differential only involves
composing with rectangles $r$ such that $r$ is supported in a row or
column going through some $O_{i_j} \in {\mathcal{Z}}$ marked for destabilization, but
$r$ does not contain $O_{i_j}$. We cannot post-compose with such a
rectangle, because it would move the destabilization corners in $\mathbf y$,
and that is not allowed. Thus, the differential of ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$ only
involves pre-composing with rectangles as above.

For each positive pair ${\mathbf{p}} = [\mathbf x, \tilde \mathbf y]$, we let $C{\mathcal{F}}^*(G,{\mathcal{Z}}, {\mathbf{p}})$ be
the subcomplex of ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$ generated by ${\mathbf{p}}$ and those pairs related to
${\mathbf{p}}$ by a sequence of nonzero differentials in ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$. More precisely, for
each complex over ${\mathbb{F}}$ freely generated by a set $S$, we can
form an associated graph whose set of vertices is $S$ and
with an edge from $\mathbf x$ to $\mathbf y$ ($\mathbf x, \mathbf y\in S$) whenever the
coefficient of $\mathbf y$ in $d\mathbf x$ is one.  Then the graph of $C{\mathcal{F}}^*(G,{\mathcal{Z}},{\mathbf{p}})$
is the connected component containing~${\mathbf{p}}$ of the graph of ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$
(with respect to the standard basis).

\begin {definition}
  Let $(G, {\mathcal{Z}})$ be a toroidal grid diagram with ${\mathcal{Z}}= \{O_{i_j}| j=1, \dots, k\}$ marked for
  destabilization.  The four corners of the square
  containing $O_{i_j}$ are called \emph{inner corners} at $O_{i_j}$.
  An element $\mathbf x \in {\mathbf{S}}(G)$ is
  called {\em inner} if, for each $j=1, \dots, k$, at least one of the
  inner corners at $O_{i_j}$ is part of $\mathbf x$.
  The element $\mathbf x$ is called {\em outer} otherwise.
\end {definition}

\begin {lemma}
\label {lemma:inner}
Let $(G, {\mathcal{Z}})$ be a sparse toroidal grid diagram with some $O$'s marked for
destabilization, where $|{\mathcal{Z}}| = k \geq 2$. Let ${\mathbf{p}} = [\mathbf x, \tilde \mathbf y]$ be a
positive pair such that $\mathbf x$ is inner. Then the index $I({\mathbf{p}})$ is at
least $2-k$.
\end {lemma}

\begin {proof}
Let $(D, \epsilon, \rho)$ be a positive enhanced domain going between
$\mathbf x$ and $\tilde \mathbf y$. Then
$$ I({\mathbf{p}}) = I(D, \epsilon, \rho) = I(D) - \sum_{j=1}^k (\epsilon_j + 2f_j)$$
by Equation~(\ref{eq:enhanced-index}).

Just as in the proof of Proposition~\ref{prop:oneO}, without loss of
generality we can assume that every row or column contains at least
one square where the multiplicity of $D$ is zero; hence, as we move
to an adjacent row (or column), the multiplicity of the domain~$D$ can only
change by $0$ or $\pm 1$.

According to Equation~\eqref{eq:lipshitz}, the usual index $I(D)$ is given by the sum of
the average multiplicities of $D$ at the corners. For each $j =1,
\dots, k$, define $n_j$ to be the sum of the average
multiplicities at the corners situated on one of the following four
lines: the two vertical lines bordering the column of $O_{i_j}$ and
the two horizontal lines bordering the row of $O_{i_j}$; with the
caveat that, if such a corner $c$ (with average multiplicity $a$
around it) appears on one of the four lines for $O_{i_j}$ and also on
one of the four lines for $O_{i_l}$, $l \neq j$, then we let $c$
contribute $a/2$ to $n_j$ and $a/2$ to $n_l$. For an example, see
Figure~\ref{fig:inner}. Note that, since the diagram is sparse, the
average multiplicities at inner corners are only counted in one~$n_l$.

\begin{figure}
\begin{center}
\input{inner.pstex_t}
\end{center}
\caption {{\bf An example of a positive enhanced domain with $\mathbf x$ inner.} We
  have $k=2$ and the two $O$'s marked for destabilization ($O_{i_j},
  j=1,2$) are shown in the figure with the value of $j$ written
  inside. We view this as a domain of type $LL$, meaning that
  $\epsilon_1 = \epsilon_2 = 0$, and with the real multiplicities at the
  destabilization points equal to zero, so that $f_1 = f_2 = 1$.  The
  domain has index $0$, and the quantities $n_1$ and $n_2$ both equal
  $3\cdot (1/4) + (3/4) + (1/4 + 3/4)/2 = 2$. }
\label{fig:inner}
\end{figure}

We get
\begin {equation}
\label {eq:index1}
I({\mathbf{p}}) \geq \sum_{j=1}^k (n_j - \epsilon_j - 2f_j).
\end {equation}

We will prove that
\begin{equation}
  \label{eq:nj-bound}
  n_j \geq 2f_j + \epsilon_j/2.
\end{equation}
Indeed, the relations \eqref{ineq:abcd1} imply that the average multiplicity at the destabilization point $p_j$ for $O_{i_j}$ (which is part of $\mathbf y$) is
$$\frac{a_j+b_j + c_j + d_j}{4} \geq   f_j + \frac{2\epsilon_j-1}{4}. $$
Since $\mathbf x$ is inner, there is also one point of $\mathbf x$, call it $x$, in
a corner of the square containing $O_{i_j}$. There are four cases,
according to the position of $x$.  We first consider the case when the
marking at $O_{i_j}$ is $L$ (i.e., $\epsilon_j = 0$).

\begin{enumerate}
\item
If $x$ is the lower left corner (which is the same as the
destabilization point), we have $a_j + d_j = b_j +c_j \geq 2f_j$
there, so the average multiplicity at $x$ is at least $f_j$; since the
corner counts in both $\mathbf x$ and $\mathbf y$, we get $n_j \geq 2f_j$, as
desired.
\item If $x$ is the lower right corner, since $b_j, d_j \geq f_j$ and
  the multiplicity of $D$ can change by at most $\pm 1$ as we pass a
  column, we find that the average multiplicity at $x$ is at least
  $f_j - 1/4$. Together with the contribution from $p_j \in \mathbf y$, this
  adds up to $2f_j - 1/2$.  Suppose both the contributions from $p_j$
  and $x$ are exactly $f_j-1/4$. Then if $r$ is a square other than
  $O_j$ in the row through $O_j$, and $s$ is the square directly below
  it, the local multiplicity at $r$ is one greater than it is at
  $s$.  This contradicts the positivity assumption combined with the
  assumption that there is at least one square with multiplicity~$0$
  in the row containing $O_j$. Hence, the contribution from $x$ and $p_j$
  is at least $2f_j$, as desired.
\item
The case when $x$ is the upper left corner is similar to lower right,
with the roles of the the row and the column through $O_{i_j}$
swapped.
\item
Finally, if $x$ is the upper right corner, then the average
multiplicity there is at least $f_j - 3/4$. Together with the
contribution from $p_j \in \mathbf y$, we get a contribution of at least
$2f_j - 1$. There are
two remaining corners on the vertical lines through $p_j$ and $x$; we
call them $c_1 \in \mathbf x$ and $c_2 \in \mathbf y$, respectively. We claim that
the contributions of the average multiplicities of $c_1$ and $c_2$ to
$n_j$ sum up to at least $1/2$. Indeed, if at least one of these
average multiplicities is $\geq 3/4$, their sum is $\geq 1$, which
might be halved (because the contribution may be split with another $n_l$)
to get at least $1/2$. If both of the average multiplicities
are $1/4$ (i.e., both $c_1$ and $c_2$ are $90^\circ$ corners), they
must lie on the same horizontal line, and therefore their
contributions are not shared with any of the other $n_l$'s; so they
still add up to $1/2$. A similar argument gives an additional
contribution of at least $1/2$ from the two remaining corners on the
row through $O_{i_j}$. Adding it all up, we get $n_j \geq (2f_j - 1) +
1/2 + 1/2 = 2f_j$.
\end{enumerate}

This completes the proof of Equation~\eqref{eq:nj-bound} when $D$ is
of type~$L$ at $O_{i_j}$.  When $D$ is of type~$R$ there (i.e.,
$\epsilon_j = 1$),
the contribution of~$x$ to $n_j$
is at least $f_j - \frac{3}{4}$. Studying the four possible positions
of $x$, just as in the $L$ case, gives additional contributions to
$n_j$ of at least $1$, which proves Equation~\eqref{eq:nj-bound}. In fact,
the contributions are typically strictly greater than $1$; the only
situation in which we can have equality in~\eqref{eq:nj-bound} when
$D$ is of type~$R$ is when $x$ is
the upper right corner and the local multiplicities around $x$ and
$p_j$ are exactly as in Figure~\ref{fig:equality}.

\begin{figure}
\begin{center}
\input{equality.pstex_t}
\end{center}
\caption {{\bf Equality in Equation~\eqref{eq:nj-bound}.} On the left, we
  show the local multiplicities around $O_{i_j}$ in the case
  $\epsilon_j =1,n_j = 2f_j + 1/2$. (Note that the real multiplicity
  at $O_{i_j}$ is then zero.) On the right we picture a domain of this
  type, with $k=1$, $f_1 = 1$. There are two corners, marked by $\times$, whose contributions are not counted in $n_1$. As a consequence, the Inequality~\eqref{eq:index1} is strict.}
\label{fig:equality}
\end{figure}

Putting Equation~\eqref{eq:nj-bound} together with Inequality~\eqref{eq:index1},
we obtain
\begin {equation}
\label {eq:index2}
 I({\mathbf{p}}) \geq \sum_{j=1}^k (-\epsilon_j/2) \geq -k/2.
\end {equation}

Our goal was to show that $I({\mathbf{p}}) \geq 2-k$. This follows directly
from~\eqref{eq:index2} for $k \geq 4$; it also follows when $k = 3$,
by observing that $I({\mathbf{p}})$ is an integer.

The only remaining case is $k=2$, when we want to show $I({\mathbf{p}}) \geq 0$,
but Inequality~\eqref{eq:index2} only gives $I({\mathbf{p}}) \geq -1$. However, if $I({\mathbf{p}}) =
-1$ we would have equality in all inequalities that were used to
arrive at Inequality~\eqref{eq:index2}. In particular, both destabilizations are
of type $R$, the corresponding $x$'s are the upper right corners of
the respective squares, and the local multiplicities there are as in
Figure~\ref{fig:equality}. Observe that as we move down from the row
above $O_{i_j}$ to the row containing $O_{i_j}$, the local
multiplicity cannot decrease. The same is true as we move down from
the row containing $O_{i_j}$ to the one just below. On the other hand,
looking at the column of $O_{i_1}$, as we go down around the grid from
the square just below $O_{i_1}$ (where the multiplicity is $f_1+1$) to
the one just above $O_{i_1}$ (where the multiplicity is $f_j-1$), we
must encounter at least two horizontal circles where the multiplicity
decreases. By our observation above, neither of these circles can be
one of the two that bound the row through $O_{i_2}$. However, one or
two of them could be the circles of the two remaining corners on the
column through $O_{i_1}$. These corners only contribute to $n_1$, not
to $n_2$, and since we had equality when we counted their contribution
to be at least $1/2$, it must be the case that each of them is a
$90^{\circ}$ corner, with a contribution of $1/4$. This means that
they must lie on the same horizontal circle. Hence, there must be one
other horizontal circle along which local multiplicities of our
domain decrease as we cross it from above. On this circle
there are some additional corners, with a nontrivial contribution to
$I(D)$ unaccounted for; compare the right hand side of
Figure~\ref{fig:equality}. (Note however that in that figure, we consider
$k=1$, rather than $k=2$.) These vertices contribute extra to the
vertex multiplicity, which means that $I({\mathbf{p}}) > -1$.
\end {proof}

\begin {remark}
It may be possible to improve the inequality~\eqref{eq:index2} to
$I({\mathbf{p}}) \geq 0$ for every $k > 0$ along the same lines, by doing a more
careful analysis of the contributions to $I(D)$.
\end {remark}

\begin {lemma}
\label {lemma:outer}
Let $(G, {\mathcal{Z}})$ be a sparse toroidal grid diagram, and ${\mathbf{p}} = [\mathbf x, \tilde \mathbf y]$ a positive pair such that $\mathbf x$ is outer. Then the cohomology of $C{\mathcal{F}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$ is zero.
\end {lemma}

\begin {proof}
  First, observe that, since the differential of ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$ only involves
  pre-compositions, $\tilde \mathbf y$ is the same for all generators of
  $C{\mathcal{F}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$. Furthermore, since $\mathbf x$ is outer, all the other
  generators $[\mathbf x', \tilde \mathbf y]$ of $C{\mathcal{F}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$ are outer.

  Let $j$ be such that no corner of $O_{i_j}$ is in $\mathbf x$. Consider a
  new filtration ${\mathcal{G}}$ on $C{\mathcal{F}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$ given as follows. Let us mark
  one $Y$ in each square of the grid that lies in a column or row
  through an $O$ marked for destabilization, but does not lie in the
  column going though $O_{i_j}$ (where $j$ was chosen above), nor does
  it lie in the same square as one of the other $O_{i_l}$'s. Further,
  we mark $n-1$ copies of $Y$ in the square directly below the square of
  $O_{i_j}$. (Here $n$ is the size of the grid.) Finally, we mark one
  extra $Y$ in the square directly to the left of each $O_{i_l}$, $l \neq
  j$. See Figure~\ref{fig:ys} for an example. Observe that for every
  periodic domain equal to the row through some $O_{i_l}$ minus the
  column through $O_{i_l}$ (for some $l=1, \dots, k$, including $l=j$),
  the signed count of $Y$'s in that domain is zero.

Consider now the squares  in $G$ that do not lie in any row or column
that goes through an $O$ marked for destabilization. We denote them by
$s_{u,v}$, with $u, v \in \{1, \dots, n-k\}$, where the two indices
$u$ and $v$ keep track of the (renumbered) row and column,
respectively. Note that all these squares are already marked by an
$X$, used to define the filtration ${\mathcal{F}}$. We will additionally mark them
with several $Y$'s, where the exact number $\alpha_{i,j}$ of $Y$'s in
$s_{i,j}$ is to be specified soon.

\begin{figure}
\begin{center}
\input{ys.pstex_t}
\end{center}
\caption {{\bf The markings defining the filtrations.} We show here a
  grid diagram of grid number $6$, with two $O$'s marked for
  destabilization, namely $O_{i_1}=O_2$ and $O_{i_2}=O_5$. We draw small circles surrounding each of the two destabilization points. Each shaded
  square contains an $X$ and this defines the filtration ${\mathcal{F}}$. One could also imagine an $X$ marking in the upper right quadrant of each small destabilization disk, to account for the term $\rho_j$ in Equation~\eqref{eq:fex}.  Given an outer generator $\mathbf x$, we need to choose some $j \in \{1,2\}$ such that no corner $O_{i_j}$ is in $\mathbf x$. Suppose we chose $j=1$. We then define a second filtration ${\mathcal{G}}$ on the components
  of the associated graded of ${\mathcal{F}}$, using the $Y$ markings as shown, plus five (invisible) $Y$ markings in the lower left corner of each small destabilization disk. We first choose the $Y$ markings in the unshaded squares, then mark the shaded squares so that every periodic domain has a total of zero markings, counted with multiplicities.}
\label{fig:ys}
\end{figure}

Given one of the generators ${\mathbf{p}}' = [\mathbf x', \tilde \mathbf y]$ of $C{\mathcal{F}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$,
choose an enhanced domain $(D, \epsilon, \rho)$ from $\mathbf x'$ to $\mathbf y$, and let $Y(D)$ be the number of $Y$'s inside $D$ (counted with multiplicity). Set
\begin {equation}
\label {eq:gp}
 {\mathcal{G}}({\mathbf{p}}') = - Y(D)  - (n-1)\sum_{l=1}^k (c_l(D) - f_l(D) - \epsilon_l(D) +1).
\end {equation}
Here $c_l, f_l, \epsilon_l$ are as in Section~\ref{sec:uleft}. The
second term in the formula above is chosen so that adding to $D$ a
column through some $O_{i_l}$ does not change the value of ${\mathcal{G}}$; this
term can be interpreted as marking $n-1$ additional $Y$'s in the lower
left quadrant of the small destabilization disk around $O_{i_l}$.

We require that the quantity ${\mathcal{G}}$ is well-defined, i.e., it should not depend on $D$, but only on
the pair ${\mathbf{p}}'$. For this to be true, we need to ensure that the addition of a periodic domain to $D$ does not change ${\mathcal{G}}$. This can be arranged by a judicious choice of the quantities $\alpha_{u,v}$, for $u, v \in \{1, \dots, n-k\}$. Indeed, the only generators of the space of periodic domains that have not been already accounted for are those of the form: column minus row though some $O$ not marked for destabilization. Note that there is a permutation $\sigma$ of $\{1, \dots, n-k\}$ such that the unmarked $O$'s are in the squares $s_{u\sigma(u)}$. There are $n-k$ conditions that we need to impose on $\alpha_{u,v}$, namely
\begin {equation}
\label {eq:linear}
 \sum_{v=1}^{n-k} \alpha_{uv} - \sum_{v=1}^{n-k} \alpha_{v\sigma(u)} = t_u,
\end {equation}
for $u=1, \dots, n-k$. Here $t_u$ are determined by the number of $Y$'s that we already marked in the respective row and column (as specified above, in squares not marked by $X$), with an extra contribution in the case of the row just below some $O_{i_l}$ and the column just to the left of $O_{i_l}$, to account for the term $c_l(D) - f_l(D) - \epsilon_l(D) +1$ from Equation~\eqref{eq:gp}.

Note that $\sum_{u=1}^{n-k} t_u = 0$. We claim that there exists a solution
(in rational numbers) to the linear system described in
Equation~\eqref{eq:linear}. Indeed, the system is described by a $(n-k)$-by-$(n-k)^2$ matrix $A$, each of whose columns contains one $1$ entry, one $-1$ entry, and the rest just zeros. If a vector $(\beta_u)_{u=1, \dots, n-k}$ is in the kernel of the transpose $A^t$, it must have $\beta_u - \beta_v = 0$ for all $u, v$. In other words, ${\operatorname{Im}}(A)^\perp = {\operatorname{Ker}}(A^t)$ is the span of $(1, \dots, 1)$, so $(t_1, \dots, t_{n-k})$ must be in the image of $A$.

By multiplying all the values in a rational solution of \eqref{eq:linear} by a large integer (and also multiplying the number of $Y$'s initially placed in the rows and columns of
the destabilized $O$'s by the same integer), we can obtain a solution of \eqref{eq:linear} in integers.  By adding a sufficiently large constant to the $\alpha_{uv}$ (but not to the number of $Y$'s initially
placed), we can then obtain a solution in nonnegative integers, which we
take to be our definition of $\alpha_{uv}$.

We have now arranged so that ${\mathcal{G}}$ is an invariant of ${\mathbf{p}}'$. Moreover, pre-composing with a rectangle can only decrease ${\mathcal{G}}$, and it keeps ${\mathcal{G}}$ the same only when the rectangle (which
a priori has to be supported in one of the rows and columns through
some $O_{i_l}$) is actually supported in the column through $O_{i_j}$,
and does not contain the square right below $O_{i_l}$.

It follows that ${\mathcal{G}}$ is indeed a filtration on $C{\mathcal{F}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$. We
denote the connected components of the associated graded complex by $C{\mathcal{G}}^*(G,{\mathcal{Z}}, {\mathbf{p}}')$; it suffices to show that these have zero cohomology. Without
loss of generality, we will focus on $C{\mathcal{G}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$.

The complex $C{\mathcal{G}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$ can only contain pairs $[\mathbf x', \tilde
\mathbf y]$ such that $\mathbf x'$ differs from $\mathbf x$ by either pre- or
post-composition with a rectangle supported in the column through
$O_{i_j}$. The condition that this rectangle does not contain the
square right below $O_{i_l}$ is automatic, because $\mathbf x$ and $\mathbf x'$ are
outer.

We find that there can be at most two elements in $C{\mathcal{G}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$,
namely ${\mathbf{p}} = [\mathbf x, \tilde \mathbf y]$ and ${\mathbf{p}}' = [\mathbf x', \tilde \mathbf y]$, where
$\mathbf x'$ is obtained from $\mathbf x$ by switching the horizontal coordinates of
the components of $\mathbf x$ in the two vertical circles bordering the
column of $O_{i_j}$. Provided that ${\mathbf{p}}'$ is positive, the pairs ${\mathbf{p}}$
and ${\mathbf{p}}'$ are related by a differential, so the cohomology of
$C{\mathcal{G}}^*(G, {\mathcal{Z}}, {\mathbf{p}})$ would indeed be zero.

Therefore, the last thing to be checked is that ${\mathbf{p}}'$ is positive. We
know that ${\mathbf{p}}$ is positive, so we can choose a positive enhanced
domain $D$ representing ${\mathbf{p}}$. Recall that the destabilization point
near $O_{i_j}$ is denoted $p_j$ and is part of $\mathbf y$. Draw a vertical
segment $S$ going down the vertical circle from $p_j$ to a point of
$\mathbf x$. There are three cases:
\begin {enumerate}
\item There is no point of $\mathbf x'$ on the segment $S$. Then there exists
  a rectangle going from $\mathbf x'$ to $\mathbf x$, and ${\mathbf{p}}'$ appears in $d {\mathbf{p}}$ by
  pre-composition. Adding the rectangle to $D$ preserves positivity.
\item\label{case:del-rect} There is a point of $\mathbf x'$ on $S$, and the multiplicity of $D$
  just to the right of $S$ is nonnegative. Then there is a rectangle,
  just to the right of $S$, going from $\mathbf x$ to $\mathbf x'$. We get a
  positive representative for ${\mathbf{p}}'$ by subtracting this rectangle from
  $D$.
\item There is a point of $\mathbf x'$ on $S$, and the multiplicity of $D$ is
  zero somewhere just to the right of $S$. Note that as we cross the
  segment $S$ from left to right the drop in multiplicity is
  constant; since $D$ is positive, this drop must be
  nonnegative. In particular, $c_j \geq
  d_j$. Relation~\eqref{eq:abcd1} implies $a_j \geq b_j + 1$. Looking
  at the inequalities in~\eqref{ineq:abcd1}, we see that we can use
  two of them (the ones involving $b_j$ and $d_j$) to improve the
  other two:
  \begin {equation}
    \label {ineq:abcd2}
    a_j \geq b_j + 1 \geq f_j + 1, \qquad c_j \geq d_j \geq f_j + \epsilon_j.
  \end {equation}
  Let us add to $D$ the periodic domain given by the column through
  $O_{i_j}$. This increases $b_j, d_j$, and $f_j$ by $1$ while keeping
  $a_j$ and $c_j$ constant. Nevertheless, Inequality~\eqref{ineq:abcd2} shows
  that the inequalities~\eqref{ineq:abcd1} are still satisfied for
  the new domain $\tilde D$. Thus $\tilde D$ is positive, and its
  multiplicity just to the right of $S$ is everywhere nonnegative. We
  can then subtract a rectangle from $\tilde D$ to obtain a positive
  representative for ${\mathbf{p}}'$ as in case~\eqref{case:del-rect}.
\end {enumerate}

The three cases are pictured in Figure~\ref{fig:3cases}. \end {proof}

\begin{figure}
\begin{center}
\input{3cases.pstex_t}
\end{center}
\caption {{\bf The three cases in Lemma~\ref{lemma:outer}.} On the
  left of each picture we show a positive $L$ domain representing
  ${\mathbf{p}}=[\mathbf x, \tilde \mathbf y]$. These domains have index $0$, $2$ and $2$,
  respectively (assuming that all the real multiplicities are
  zero). On the right of each picture we show the corresponding
  positive domain representing ${\mathbf{p}}' = [\mathbf x', \tilde \mathbf y]$. These domains
  have all index $1$. The components of $\mathbf x$ are the black dots, the
  components of $\mathbf x'$ the gray dots, and those of $\mathbf y$ the white
  dots. The segment $S$ is drawn thicker.}
\label{fig:3cases}
\end{figure}

\begin {proof}[Proof of Theorem~\ref{thm:sparse}]
  The case when $k=0$ is trivial, and the case $k=1$ follows from
  Proposition~\ref{prop:oneO}. For $k \geq 2$, Lemma~\ref{lemma:inner}
  says that for any pair $[\mathbf x, \tilde \mathbf y]$ of index $< 2-k$, the generator $\mathbf x$ is
  outer. Lemma~\ref{lemma:outer} then shows that the homology of
  ${\operatorname{gr}_{\F}\CP^*(G, \zed) }$ is zero in the given range, which implies the same for
  $\mathit{HP}^*(G, {\mathcal{Z}})$.
\end {proof}

\bibliographystyle{custom}