We use the theory of Hochschild homology and cyclic homology, see Loday [109] for the case of rings and Weibel [162, 163] for the case of schemes.[By Keller [92], the cyclic homologies defined in [163] coincide with the cyclic homologies defined in McCarthy [119] via the dg category of perfect complexes.]
By the Hochschild-Kostant-Rosenberg (HKR) theorem [77], we may identify the Hodge bundles, the filtrations, and the associated quotients in (<ref>) and (<ref>) with the periodic cyclic homology, the negative cyclic homology, and the Hochschild homology, respectively. Moreover, the Chern character in (<ref>) can be identified with the Dennis trace map.
Then the key to proving Proposition <ref> is Goodwillie's lift of the Dennis trace map to the negative cyclic homology [62].[In the language of [132], Chern characters lift to $p$-shifted closed $p$-forms [153, 154]. By [79], the Chern character of [154] matches with the classical Dennis trace.]

The proof was inspired by Pridham [137].

Note that the uniqueness of the section $\widetilde{\ch_p}(I\udot)$ follows immediately from the properties (2) and (3) in Proposition <ref> and Remark <ref>(2). Hence it suffices to consider the statement locally on the base $\cB$. Thus we may assume that $\cB$ is an affine scheme. Then (<ref>) is an isomorphism.

By the HKR theorem in <cit.>, we have natural isomorphisms

\begin{align}
\HN^i(\cX/\cB) &\cong \bigoplus_p F^pH_{DR}^{2p+i}(\cX/\cB),
& \HochP^i(\cX/\cB) &\cong \bigoplus_p H^{2p+i}_{DR}(\cX/\cB), \label{Eq:39} \\
\HochH^i(\cX/\cB) &\cong \bigoplus_p R^{p+i}f_*(\Omega^p_{\cX/\cB}),
& \HC^i(\cX/\cB) &\cong \bigoplus_p \frac{H^{2p+i}_{DR}(\cX/\cB)}{F^{p+1}H^{2p+i}_{DR}(\cX/\cB)}\nonumber
\end{align}

where $\HN$, $\HochP$, $\HochH$, and $\HC$ denote the negative cyclic homology, the periodic cyclic homology, the Hochschild homology, and the cyclic homology, respectively, with the cohomological convention. More specifically, the isomorphisms (<ref>) are induced by the left inverse ($\pi$ in <cit.> and $e$ in <cit.>) of the antisymmetrization map.

The relative Chern character $\ch_{\cX/\cB}(I\udot):=(\ch_p(I\udot))_p$ in (<ref>) comes from the absolute Chern character. More precisely, we have a commutative diagram

\begin{equation}\label{Eq:38}
\xymatrix@C+1pc{
\O_{\cX} \ar[r]^-{\ch_{\cX}(I\udot)} \ar@{=}[d]  & \bigoplus_p \LL^p_{\cX}[p] \ar[d] \\
\O_{\cX} \ar[r]_-{\ch_{\cX/\cB}(I\udot)}& \bigoplus_p \Omega^p_{\cX/\cB}[p]
\end{equation}

in the derived category of $\cX$, where $\LL_{\cX}$ denotes Illusie's cotangent complex [85] of $\cX$, $\LL^p_{\cX}:= \bigwedge^p \LL_{\cX}:=\Sym^p(\LL_{\cX}[1]])[-p]$ denotes the derived wedge product of $\LL_{\cX}$, and $\ch_{\cX}(I\udot)$ denotes the absolute Chern character defined as the trace of the exponential of the absolute Atiyah class $\At_{\cX}(I\udot) : I\udot \to I\udot \otimes \LL_{\cX}[1]$ [85].

Under the HKR ismorphism, the Chern character $\ch_{\cX}(I\udot)$ can be identified with the Dennis trace $\ch^D(I\udot)$.
More precisely, we have a commutative diagram

\begin{equation}\label{Eq:31}
\xymatrix{
&\O_{\cX} \ar[ld]_{\ch^D(I\udot)} \ar[rd]^{\ch_{\cX}(I\udot)} & \\
L\tDelta^*\tDelta_*\O_{\cX} \ar[rr]_{\cong}\ar[d] & & \bigoplus_p \LL^p_{\cX}[p] \ar[d]\\
L\Delta^*\Delta_*\O_{\cX}  \ar[rr]_{\cong}^{\mathrm{HKR}} & & \bigoplus_p \Omega^p_{\cX/\cB}[p]
\end{equation}

in the derived category of $\cX$ where $\tDelta : \cX \to \cX\times\cX$ and $\Delta : \cX \to \cX\times_{\cB}\cX$ are the diagonal maps.
The horizontal isomorphisms are given by the exponentials of the universal Atiyah classes as in Buchweitz-Flenner <cit.> (see Markarian [114] and Căldăraru [33] for the smooth case).
The hypercohomology of the left column of (<ref>) computes the Hochschild homology,

\[\HH^i(\cX, L\tDelta^*\tDelta_*\O_{\cX}) \cong \HochH^i(\cX),\qquad
\HH^i(\cX, L\Delta^*\Delta_*\O_{\cX}) \cong \HochH^i(\cX/\cB)\]

by Yekutieli <cit.>.
The lower horizontal isomorphism in (<ref>)
is compatible with the corresponding isomorphism in (<ref>),
by the arguments in <cit.> since $\cX \to\cB$ is smooth.
The map $\ch^D(I\udot)$ in (<ref>) is the Euler map of $I\udot$ in the sense of <cit.>, which agrees with the Dennis trace map for the dg category $\mathrm{Perf}(\cX)$ [119], as desribed in <cit.>.

As explained in <cit.>, the Dennis trace map $\ch^D$ can be extended to the Goodwillie Chern character $\ch^G$ [62] via descent [164],

\begin{equation}\label{Eq:34}
\xymatrix{
& K^0(\cX) \ar[ld]_{\ch^D} \ar[d]^{\ch^G} \ar[rd] & \\
\HochH^0(\cX) & \ar[l] \HN^0(\cX) \ar[r] & \HochP^0(\cX). \\

Consider the canonical commutative diagram

\begin{equation}\label{Eq:35}
\xymatrix{
%\ch^D(I\udot) \ar@{}[d]|{\rotatebox[origin=c]{-90}{$\in$}} & \ch^G(I\udot) \ar@{|->}[l] \ar@{}[d]|{\rotatebox[origin=c]{-90}{$\in$}} \ar@{|->}[r] &  \ch^K(I\udot) \ar@{}[d]|{\rotatebox[origin=c]{-90}{$\in$}}\\
\HochH^0(\cX) \ar[d] & \HN^0(\cX) \ar[l] \ar[r] \ar[d] & \HochP^0(\cX) \ar[d] \\
\HochH^0(\cX/\cB) \ar[d]_{\cong}^{\mathrm{HKR}} & \HN^0(\cX/\cB) \ar@{->>}[l] \ar@{^{(}->}[r] \ar[d]_{\cong}^{\mathrm{HKR}}& \HochP^0(\cX/\cB) \ar[d]_{\cong}^{\mathrm{HKR}}\\
\bigoplus_p R^pf_* \Omega^p_{\cX/\cB} & \bigoplus_p F^p H^{2p}_{DR}(\cX/\cB) \ar@{->>}[l] \ar@{^{(}->}[r] & \bigoplus_p H^{2p}_{DR}(\cX/\cB).
\end{equation}

Denote by

\begin{equation}\label{Eq:40}
\widetilde{\ch_p}(I\udot) \in F^p H^{2p}_{DR}(\cX/\cB)
\end{equation}

the image of $\ch^G(I\udot) \in HN_0(\cX)$ under the vertical maps in (<ref>).
We now show that $\widetilde{\ch_p}(I\udot)$ in (<ref>) satisfies the three properties in Lemma <ref> separately.

* Clearly $\widetilde{\ch_p}(I\udot)$ maps to the Chern character $\ch_p(I\udot)$ in (<ref>). This follows from the commutative diagrams (<ref>), (<ref>), (<ref>), and (<ref>).

* We now claim that $\widetilde{\ch_p}(I\udot)$ is horizontal. Indeed, we may assume that $\cB=\Spec(A)$ for a local Artinian $\C$-algebra $A$ (Remark <ref>). Let $X:=\cX_0$ be the fibre over the $\C$-point $0 \in \cB$.
By the Feigin-Tsygan theorem <cit.> (see also <cit.>, <cit.>), we have a commutative square with bijective horizontal arrows

\begin{equation}\label{Eq:FT1}
\xymatrix{
\HochP^0(\cX) \ar[r]^-{\cong} \ar[d] & \bigoplus_p\HH^{2p}(\widehat{\cY},\hOmega_{\cY}^\bullet) \ar[d]\\
\HochP^0(\cX/\cB) \ar[r]^-{\cong} & \bigoplus_p\HH^{2p}(\cX,\Omega_{\cX/\cB}^\bullet)
\end{equation}

where $\bigoplus_p\HH^{2p}(\widehat{\cY},\hOmega_{\cY}^\bullet) $ is Hartshorne's algebraic de Rham cohomology [75] given by an embedding $\cX \hookrightarrow \cY$ into a smooth scheme $\cY$.
Here the lower isomorphism in (<ref>) coincides with the corresponding isomorphism in (<ref>) since they both are given by the same left inverse ($\mu$ in [55] and $e$ in [163]) of the antisymmetrization map.
By <cit.> (and <cit.>), we have a commutative diagram

\[\qquad\xymatrix@C-1pc{
\HH^{2p}(\hcY,\hOmega_{\cY}^\bullet) \ar[r]^-{\cong} \ar[d] & \HH^{2p}(\hcY^\an,\hOmega_{\cY^\an}^\bullet) \ar[d] & H^{2p}(\cX^\an,\C) \ar[l]_-{\cong} \ar[d] \ar@{=}[r] & H^{2p}(X^\an,\C) \ar[d] \\
\HH^{2p}(\cX,\Omega_{\cX/\cB}^\bullet) \ar[r]^-{\cong} & \HH^{2p}(\cX^\an,\Omega_{\cX^\an/\cB^\an}^\bullet) &  H^{2p}(\cX^\an,A) \ar[l]_-{\cong} \ar@{=}[r] & H^{2p}(X^\an,A)

where the last vertical map is induced by the canonical map of constant sheaves $\C \to A$ on $X^\an$.
Hence the image of the vertical map consists of the horizontal sections (see Remark <ref>), which proves the claim.
We finally claim that the restriction $\widetilde{\ch_p}(I\udot)$ to the fibre of a point $b \in \cB$ is the usual Chern character. Indeed, we may assume that $\cB=\Spec(\C)$ since Chern characters are compatible with base change. Then the claim follows from <cit.>.

This completes the proof.

§ VIRTUAL CYCLES

In this section, we construct reduced virtual cycles for the moduli spaces of $\PT_q$ pairs on Calabi-Yau 4-folds. We use Kiem-Li's cosection localization technique [94, 96] to reduce the Oh-Thomas virtual cycles [125] on the moduli spaces.
The semi-regularity map of Buchweitz-Flenner [30] will provide the necessary cosections.

Throughout this section, we fix a (smooth projective) Calabi-Yau 4-fold $X$ and a Calabi-Yau 4-form $\omega : \O_X \xrightarrow{\cong}\Omega^4_X$.

§.§ Non-reduced virtual cycles

In this preliminary subsection, we construct non-reduced virtual cycles for the moduli spaces of stable pairs.
We review Oh-Thomas's construction of virtual cycles in [125] for the reader's convenience. Instead of following [125] directly, we will use the setup introduced in [133].

Let $\curP:=\PTqvX$ be the moduli space of $\PT_q$ pairs $(F,s)$ on $X$ satisfying

\[\ch(F)= v = \left(0,0,\gamma,\beta, n-  \gamma \cdot \td_2(X)\right) \in H^*(X,\Q).\]

By Theorem <ref>, we have an open embedding

\[\curP \hookrightarrow \cPerf(X,v)_{\O_X}^{\spl}\]

into the moduli space of perfect complexes with fixed trivial determinant. Thus, by [125], we can construct an Oh-Thomas virtual cycle on $\curP$.

There exists a virtual cycle

\[\left[\curP\right]^\vir \in A_{\vd}\left(\curP\right)\]

of virtual dimension

\[\vd= n-\frac12 \gamma^2,\]

which depends[A different choice of orientation changes the signs of the virtual cycles on the connected components.] on the choice of an orientation (<ref>) below.

We call the virtual cycle $[\curP]^\vir$ in Theorem <ref> the non-reduced virtual cycle. We use this terminology since we will construct a canonical reduced virtual cycle $[\curP]^\red$ for any Calabi-Yau 4-fold $X$ and a surface class $\gamma$ in the next subsection (see Theorem <ref>).

There are three key ingredients for defining the Oh-Thomas virtual cycle (in the language of [133]):

* Symmetric obstruction theory.
The moduli space $\curP$ has a (3-term) symmetric obstruction theory

\begin{equation}\label{Eq:SOT}
\phi : \EE:=R\hom_{\pi}(\II\udot,\II\udot)_0[3] \xrightarrow{\At(\II\udot)}  \trunc\LL_{\curP},\quad \theta: \EE\dual[2] \xrightarrow{\SD} \EE
\end{equation}

induced by the Atiyah class $\At(\II\udot)$ of the universal complex $\II\udot$ and the relative Serre duality for the projection map $\pi: \curP \times X \to \curP$. Here $\phi$ and $\theta$ satisfy the following properties:

* $\phi:\EE\to\trunc\LL_{\curP}$ is an obstruction theory, [12] i.e., $h^0(\phi)$ is bijective and $h^{-1}(\phi)$ is surjective;

* $\EE$ is a symmetric complex (of tor-amplitude $[-2,0]$), i.e., $\theta$ is an isomorphism and $\theta=\theta\dual[2]$.

The symmetric obstruction theory (<ref>) is constructed by Huybrechts-Thomas [81].[Alternatively, we can also use the derived enhancement of $\cPerf(X)^\spl_{\O_X}$ in [151, 141].]

* Orientation.
There exists an orientation for the virtual cotangent complex $\EE$, i.e., an isomorphism of line bundles

\begin{equation}\label{Eq:orientation}
o : \O_{\curP} \xrightarrow{\cong} \det(\EE)
\end{equation}

such that $o^2=(-1)^{\frac{(2\vd)(2\vd-1)}{2}}\cdot\det(\theta):\det(\EE\dual) \to \det(\EE)$. The existence of an orientation was shown by Cao-Gross-Joyce [34].

* Isotropic condition. The intrinsic normal cone $\fC_{\curP}$ is isotropic in the virtual normal cone $\fC(\EE):=h^1/h^0(\EE\dual)$ with respect to the canonical quadratic function $\fq_\EE:\fC(\EE) \to \bbA^1$ (defined in Remark <ref> below), i.e., the restriction

\begin{equation*}\label{Eq:IsotropicCondition}
\fq_{\EE}|_{\fC_{\curP}} : \fC_{\curP} \hookrightarrow \fC(\EE) \xrightarrow{\fq_\EE} \bbA^1_{\curP}
\end{equation*}

vanishes. This isotropic condition can be shown by the Darboux theorem of Brav-Bussi-Joyce [27] for the $(-2)$-shifted symplectic derived enhancement [132, 141]. Indeed, by <cit.>, the arguments in <cit.> proves the isotropic condition.[One does not need the full proof of  <cit.>, but only the part involving MacPherson's graph construction <cit.>.]

We recall the definition of the canonical quadratic function $\fq_{\EE}$ from [133].

Given a symmetric complex $\EE$ on a quasi-projective scheme $\sX$, there is a canonical quadratic function

\[\fq_\EE:\fC(\EE) \to \bbA^1_{\sX}\]

induced by the symmetric form of $\EE$. Indeed, if $\EE=[B\to E \to B\dual]$ is a symmetric resolution, then $\fC(\EE)=[C(D)/B]$ for $D=\coker(B\to E)$, and the restriction $\fq_E|_{C(D)}:C(D) \hookrightarrow E \xrightarrow{\fq_E} \bbA^1$ of the quadratic function $\fq_E$ of $E$ is $B$-invariant. The quadratic function $\fq_\EE$ is defined via descent of $\fq_E|_{C(D)}$, which is independent of the choice of the symmetric resolution. See <cit.> for details.

Note that from the above data, we can form a commutative diagram

\begin{equation}\label{Eq12}
\xymatrix{& \fQ(\EE) \ar[r] \ar@{^{(}->}[d] & \curP \ar@{^{(}->}[d]^{0} \\
\fC_{\curP} \ar@{^{(}->}[r]<EMAIL_ADDRESS>& \fC(\EE) \ar[r]^{\fq_\EE} & \bbA^1_{\curP}}
\end{equation}

where $\fQ(\EE)$ is the quadratic cone stack associated to the symmetric complex $\EE$, defined as the zero locus of the quadratic function $\fq_\EE$ on $\fC(\EE)$.

We can construct the Oh-Thomas virtual cycle $[\curP]^\vir$ from the closed embedding  $\fC_{\curP} \hookrightarrow \fQ(\EE)$ in (<ref>).

We first construct a square root Gysin pullback

\[\sqrt{0^!_{\fQ(\EE)}} : A_*(\fQ(\EE)) \to A_*(\curP)\]

for the zero section $0_{\fQ(\EE)} : \curP \to \fQ(\EE)$. Note that we can find a symmetric resolution

\begin{equation}\label{Eq:SymRes}
\EE\cong \left[B\xrightarrow{d} E \cong E\dual\xrightarrow{d\dual} B\dual\right]
\end{equation}

for some special orthogonal bundle $E$ and a vector bundle $B$. Indeed, this can be shown by the proof of <cit.>, see also <cit.>.
Here an orientation of $\EE$ induces an orientation of $E$ via the canonical isomorphism

\[\det(\EE) \cong \det(B\dual)\otimes \det(E\dual)\dual\otimes \det(B) \cong \det(E)\]

of line bundles. By considering the stupid truncation

\[\left[ 0 \to  E\dual \xrightarrow{d\dual} B\dual \right] \to \left[B\xrightarrow{d} E \cong E\dual\xrightarrow{d\dual} B\dual\right],\]

we can form a fibre diagram

\begin{equation}\label{Eq11}
\xymatrix{
Q \ar@{^{(}->}[rr] \ar[d]^{r} & %C(D) \ar[d] \ar@{^{(}->}[r]
& E \ar[d] \\
\fQ(\EE) \ar@{^{(}->}[r] & \fC(\EE) \ar@{^{(}->}[r] & [E/B]
\end{equation}

for some cone $Q$. The horizontal maps in (<ref>) are closed embeddings and the vertical maps in (<ref>) are $B$-torsors. Then $Q$ is isotropic subcone of $E$ since

\[\fq_{E}|_Q = \fq_{\fC(\EE)}|_Q = 0\]

by <cit.>.
Consider a factorization

\[\xymatrix{
& E|_Q \ar[d]\\
\curP \ar@{^{(}->}[r]^-{0_Q} \ar[rd]_{0_{\fQ(\EE)}} & Q<EMAIL_ADDRESS>\ar[d]^r\\
& \fQ(\EE)

of the zero section $0_{\fQ(\EE)}$, where $\tau$ is the tautological section induced by the embedding $Q \hookrightarrow E$ in (<ref>). Note that the zero section $0_Q : \curP \hookrightarrow Q$ is the zero locus of the tautological section $\tau \in \Gamma(Q,E|_Q)$. We define the square root Gysin pullback as the composition

\begin{equation}\label{Eq:squarerootGysin}
\sqrt{0^!_{\fQ(\EE)}}:= \sqrt{e}(E|_Q,\tau) \circ r^*: A_* (\fQ(\EE)) \xrightarrow{} A_{*+b} (Q) \xrightarrow{} A_{*+b-\frac12e} (\curP)
\end{equation}

where $b:=\rk(B)$, $e:=\rk(E)$, $\vd=b -\frac12 e$, and $\sqrt{e}(E|_Q,\tau)$ denotes Oh-Thomas's localization <cit.> of Edidin-Graham's square root Euler class [51].[See also <cit.> for an alternative construction of the localized square root Euler class $\sqrt{e}(E|_C,\tau)$ using the blowup method.]
The arguments in <cit.> show that the square root Gysin pullback in (<ref>) is independent of the choice of the symmetric resolution (<ref>).

We then define the Oh-Thomas virtual cycle as

\begin{equation}\label{Eq:Def.NRVFC}
\left[\curP\right]^\vir := \sqrt{0^!_{\fQ(\EE)}}\left[\fC_{\curP}\right] \in A_\vd \left(\curP\right)
\end{equation}

$[\fC_{\curP}] \in A_0 (\fQ(\EE))$
is the fundamental class of the intrinsic normal cone with respect to the closed embedding $\fC_{\curP} \hookrightarrow \fQ(\EE)$ in (<ref>).

We can easily compute the virtual dimension via the Hirzebruch-Riemann-Roch formula <cit.>. Indeed, we have

\begin{align*}
2\cdot\vd &= \rank(R\Hom_X(I\udot,I\udot)_0[1])\\
&= -\int_X \ch(I\udot)\dual\ch(I\udot) \td(X) + \int_X \td(X)\\
&=-(-2n + 2 \td_2(X)\gamma +\td_4(X) - 2 \td_2(X)\gamma + \gamma^2) + \td_4(X) \\
& = 2n - \gamma^2.
\end{align*}

It completes the proof.

We provide a simple analogy between the above description (<ref>) of the Oh-Thomas virtual cycles [125] and the Behrend-Fantechi virtual cycles [12].

Fix an arbitrary (separated) Deligne-Mumford stack $\sX$.

Recall that a perfect obstruction theory $\psi:\KK \to \trunc \LL_{\sX}$ of tor-amplitude $[-1,0]$ is equivalent to a closed embedding of cone stacks[A morphism of cone stacks is always assumed to be $\bbA^1$-equivariant as in <cit.>.] $\fC_{\sX} \hookrightarrow \fC(\KK)$, for some vector bundle stack $\fC(\KK)$. In [103], Kresch constructed a Gysin pullback

\[0^!_{\fC(\KK)}:A_*(\fC(\KK)) \to A_*(\sX)\]

for any perfect complex $\KK$ of tor-amplitude $[-1,0]$. In [12, 103], the Behrend-Fantechi virtual cycle for a closed embedding $\fC_{\sX} \hookrightarrow \fC(\KK)$ was defined as

\[[\sX]^\vir_{BF} := 0^!_{\fC(\KK)}[\fC_\sX].\]

Analogously,	 a symmetric obstruction theory $\phi:\EE \to \trunc \LL_{\sX}$ of tor-amplitude $[-2,0$] satisfying the isotropic condition is equivalent to a closed embedding of cone stacks $\fC_{\sX} \hookrightarrow \fQ(\EE)$, for some quadratic cone stack $\fQ(\EE)$ associated to a symmetric complex $\EE$. Note that we can define the square root Gysin pullback

\[\sqrt{0^!_{\fQ(\EE)}} : A_*(\fQ(\EE)) \to A_*(\sX)\]

for any symmetric complex $\EE$ of tor-amplitude $[-2,0]$ and an orientation $\O_{\sX} \xrightarrow{\cong} \det(\EE)$ as in the proof of Theorem <ref>.[The proof of Theorem <ref> works when $\sX$ is a quasi-projective scheme. Using the Kimura sequence for Artin stacks [9], this can be generalized to the case when $\sX$ is a separated Deligne-Mumford stack, see <cit.>.] Thus the Oh-Thomas virtual cycle for a closed embedding $\fC_{\sX} \hookrightarrow \fQ(\EE)$ and an orientation can be defined as

\[[\sX]^\vir _{OT}:=\sqrt{0^!_{\fQ(\EE)}}[\fC_{\sX}].\]

§.§ Reduced virtual cycles

Recall that the standard curve counting invariants (GW/PT) on K3 surfaces vanish due to the following two reasons:

* There exists a surjective cosection [94];

* the codimension of the Noether-Lefschetz locus is positive [102, 118].

To obtain non-zero invariants, one should consider reduced virtual cycles.

An analogous phenomenon occurs when we want to count surfaces on Calabi-Yau 4-folds. Given a surface class $\gamma$, there are as many natural cosections as the codimension $\rho_\gamma$ of the Hodge locus. Thus in a generic situation, the non-reduced virtual cycle in Theorem <ref> vanishes and we want to construct a reduced virtual cycle. This can be achieved by the DT4 version of the cosection localization technique developed in [96]. In this subsection, we present the main results on the reduced virtual cycles and we provide the proofs in the subsequent subsections.

We first introduce an important bilinear form $\sfB_\gamma$ on $H^1(X,T_X)$ associated to each surface class $\gamma$ on $X$. We also fix some notation.

Let $\gamma \in H^2(X,\Omega^2_X)$ be a (2,2)-class on $X$.

* We define a symmetric bilinear form $\sfB_\gamma$ on $H^1(X,T_X)$ as

\begin{equation*}\label{Eq:Bgamma}
\mathsf{B}_\gamma : H^1(X,T_X) \otimes H^1(X,T_X) \to \C, \quad \xi_1 \otimes \xi_2 \mapsto \int_X \iota_{\xi_1}\iota_{\xi_2}\gamma \cup \omega
\end{equation*}

where $\iota_{\xi_1}$ and $\iota_{\xi_2}$ denote the contraction maps and $\omega$ is the (chosen) Calabi-Yau 4-form.[For $\xi_1\in H^i(X,T_X)$ and $\xi_2\in H^j(X,T_X)$, we have $\iota_{\xi_2}\iota_{\xi_1}=(-1)^{(1+i)(1+j)}\iota_{\xi_1}\iota_{\xi_2}$ (see for example <cit.>). ]

* We denote the rank of the bilinear form $\sfB_\gamma$ by

\[\rho_\gamma :=\rank(\sfB_\gamma).\]

* For the induced non-degenerate quadratic space of dimension $\rho_\gamma$, we write

\begin{equation*}\label{Eq:H1TXgamma}
\end{equation*}

The bilinear form $\sfB_\gamma$ is closely related to the Hodge theory of the (2,2)-class
$$\gamma\in H^2(X,\Omega^2_X) \subseteq H^4(X,\C).$$
Essentially, the rank $\rho_\gamma$ is equal to the codimension of the Hodge locus of $\gamma$ [19] (see footnote (<ref>)).

We now state our main result.

Let $X$ be a Calabi-Yau 4-fold, $v = (0,0,\gamma,\beta,n-\gamma\cdot\td_2(X)) \in H^*(X,\Q)$, and $q \in \{-1,0,1\}$.
Then there exists a canonical reduced virtual cycle

\[\left[\PTqvX\right]^\red \in A_{\rvd}\left(\PTqvX\right)\]

of reduced virtual dimension

\[\mathrm{rvd} = n- \frac12 \gamma^2 + \frac12 \rho_\gamma\]

depending on the choices of orientation of the symmetric complex $\EE$ and the quadratic space $H^1(X,T_X)_\gamma$. Moreover, $[\PTqvX]^\red$ is deformation invariant in the sense of Theorem <ref>.

The reduced virtual cycle $[\PTqvX]^\red$
has a relation to the notion of semi-regularity of perfect complexes $I\udot$ associated to pairs $[(F,s)] \in  \PTqvX$ (Definition <ref>(2)).

Let $X$ be a Calabi-Yau 4-fold, $v = (0,0,\gamma,\beta,n-\gamma\cdot\td_2(X)) \in H^*(X,\Q)$, and $q \in \{-1,0,1\}$.
For any $\PT_q$ pair $[(F,s)] \in \PTqvX$, the associated perfect complex $I\udot:=[\O_X \xrightarrow{s} F]$ is semi-regular if and only if
$\PTqvX$ is smooth of dimension $\rvd=n-\frac12\gamma^2+\frac12\rho_\gamma$ at  $[(F,s)]$.

By Theorem <ref>, if all point in $\PTqvX$ are semi-regular, then it is smooth and the reduced virtual cycle is equal to the fundamental cycle

\[\left[\PTqvX\right]^\red=\left[\PTqvX\right] \in A_\rvd\left(\PTqvX\right).\]

The role of $\rho_\gamma$ in the  surface counting theory is an interesting new feature compared to known enumerative geometry. Indeed $\rho_\gamma$ is not a topological datum of $\gamma\in H^4(X)$ but rather it is a Hodge theoretic datum of $\gamma\in H^{2,2}(X)$.
In particular rank of $\sfB_\gamma$ is not additive in $\gamma$ in general, but it is only sub-additive, i.e., $\rho_{\gamma_1+\gamma_2}\leq \rho_{\gamma_1}+\rho_{
\gamma_2}$. For example $\rho_\gamma$ remains the same when taking multiples of $\gamma$.

We now explain the main ideas in the proof of Theorem <ref>. We will consider three different, but interrelated, approaches to the reduced theory.

* Cosection localization. In subsection <ref>, we will prove Theorem <ref> using the cone reduction lemma of Kiem-Li [94]. The semi-regularity map of Buchweitz-Flenner [30] will provide the necessary cosections. This cosection localization method is the simplest way to construct the reduced virtual cycle.

* Algebraic twistor family. In subsection <ref>, we will construct a reduced obstruction theory using the algebraic twistor family introduced by the second-named author and Thomas [102].
The main idea is to consider an infinitesimal deformation of $X$ such that the Hodge locus of $\gamma$ is just the origin.
The algebraic twistor family method
alone does not provide a reduced virtual cycle without the cone reduction lemma due to the isotropic condition. See Remark <ref>.

* Reduction by $(-1)$-shifted $1$-forms. In Appendix <ref>, we will construct a reduced $(-2)$-shifted symplectic derived enhancement.
The crucial part is that the cosections arising from the semi-regularity map have natural extensions to $(-1)$-shifted closed $1$-forms.

§.§ Semi-regularity map

In this subsection, we revisit the semi-regularity map of Buchweitz-Flenner [30] and show that the key commutative triangle in [30] is symmetric for Calabi-Yau 4-folds.

We first recall the definition of the semi-regularity map.[Here we consider the fixed-determinant version of the semi-regularity map. For strict Calabi-Yau 4-folds, this is identical to the 2-semi-regularity map in [30]. Also we use a different sign convention compared to [30].]

Let $I\udot$ be a perfect complex on $X$.

* We define the semi-regularity map by

\begin{equation}\label{eq:sr}
\sr : \Ext^2_X(I\udot,I\udot)_0 \to H^3(X,\Omega_X^1), \quad e\mapsto \tr(\At(I\udot)\circ e),
\end{equation}

where $\At(I\udot) : I\udot \to I\udot \otimes \Omega^1_X[1]$ denotes the Atiyah class of $I\udot$.

* We say that $I\udot$ is semi-regular if $\sr$ is injective.

The semi-regularity map connects the obstruction to deforming a perfect complex $I\udot$ and its Chern character $\ch(I\udot)$ by the key commutative triangle in <cit.>. For Calabi-Yau 4-folds, this commutative triangle has a symmetric description.

Let $I\udot$ be a perfect complex on $X$ such that $\ch_1(I\udot)=0 \in H^1(X,\Omega^1_X)$ and $\ch_2(I\udot)=\gamma \in H^2(X,\Omega_X^2)$.
Then the obstruction map

\begin{equation}\label{eq:ob}
\sfob : H^1(X,T_X) \to \Ext^2_X(I\udot,I\udot)_0, \quad \xi \mapsto \iota_{\xi} \At(I\udot)
\end{equation}

fits into the commutative diagram

\begin{equation}\label{eq:triangle.obsrBgamma'} \xymatrix{ H^1(X,T_X) \ar[rr]^-{\sfob}<EMAIL_ADDRESS>\ar[rd]^-{\iota_{-}(\gamma)} && \Ext^2_{X}(I\udot,I\udot)_0<EMAIL_ADDRESS>\ar[ld]_-{\sr} \\ & H^3(X,\Omega_{X}^1) \ar[d]^{\mathsf{SD}}_{\cong} &\\ & H^1(X,T_{X})\dual & }\end{equation}

where the vertical isomorphism $\SD$
is induced by the Serre duality pairing

\[H^3(X,\Omega_X^1) \otimes H^1(X,T_X) \to \C, \quad \alpha \otimes \xi \mapsto \int_X \iota_{\xi}(\alpha) \cup \omega\]

and we identified $(\Ext^2_X(I\udot,I\udot)_0)\dual = \Ext^2_X(I\udot,I\udot)_0$ via the Yoneda pairing

\[\sfY: \Ext^2_X(I\udot,I\udot)_0 \otimes \Ext^2_X(I\udot,I\udot)_0 \to \C, \quad  u \otimes v \mapsto \int_X \tr(u \circ v) \cup \omega.\]

Note that the obstruction map $\sfob$ in (<ref>) is well-defined since

\[\tr \circ \sfob (\xi) = \iota_\xi \ch_1(I\udot)=0.\]

The commutativity of the three triangles in (<ref>) can be shown as follows:

* (top triangle) We have
$\sr \circ \sfob = \iota_{-}(\gamma)$
by <cit.>.

* (left triangle) For any $\xi_1,\xi_2 \in H^1(X,T_X)$, we have

\[\SD(\iota_{\xi_1}(\gamma))(\xi_2) = \int_X \iota_{\xi_2}\iota_{\xi_1}\gamma \cup \omega = \int_X \iota_{\xi_1}\iota_{\xi_2}\gamma \cup \omega = \sfB_\gamma(\xi_1,\xi_2).\]

* (right triangle) For any $\xi \in H^1(X,T_X)$ and $e \in \Ext^2_X(I\udot,I\udot)$, we have

\[\sfob\dual(e)(\xi) = \int_X \tr(\iota_\xi \At(I\udot) \circ e) \cup \omega = \int_X \iota_\xi \tr(\At(I\udot)\circ e) \cup \omega = \SD(\sr(e))(\xi).\]

This completes the proof.

The commutative triangle (<ref>) says that the map of vector spaces

\[\sfob=\sr\dual : \left(H^1(X,T_X),\sfB_\gamma\right) \longrightarrow \left(\Ext^2_X(I\udot,I\udot)_0, \sfY\right)\]

is compatible with the corresponding symmetric bilinear forms. Equivalently, we may write $\sfB_\gamma = \sfob^*(\sfY)$.

In the following subsections, we will develop the reduced theory with respect to a non-degenerate subspace $V\subseteq H^1(X,T_X)$. We provide a simple observation on such non-degenerate subspaces.

Let $I\udot$ be a perfect complex on $X$ with $\ch_1(I\udot)=0$ and $\ch_2(I\udot)=\gamma$.
Choose a non-degenerate subspace

\[V \subseteq H^1(X,T_X)\]

with respect to the bilinear form $\sfB_\gamma$.
Then the restriction

\[ (\sfob=\sr\dual)|_V : \left(V,\, \sfB_\gamma|_V\right) \hookrightarrow \left(\Ext^2_X(I\udot,I\udot)_0,\, \sfY \right)\]

is an injective map of non-degenerate quadratic spaces.

If $\sfob(v)=0$ for some $v \in V$, then we have

\[\sfB_\gamma(v,-) = \int_X \tr\big(\sfob(v) \circ \sfob(-)\big) = 0 \in H^1(X,T_X)\dual.
\]

Thus the non-degeneracy of $\sfB_\gamma|_V$ implies that $v=0$.

For reader's convenience, we review how the maps $\ob$ and $\sfB_\gamma$ in the commutative triangle (<ref>) determine the obstructions of deforming the perfect complex $I\udot$ and the Hodge class $\gamma \in H^2(X,\Omega^2_X)$, respectively.
For simplicity, we only consider the first-order deformations here.
We refer to <cit.> and <cit.> (cf. <cit.>) for the general case.

Consider a first-order deformation of $X$, i.e., a fibre diagram

\[\xymatrix{
X \ar@{^{(}->}[r] \ar[d] & \cX \ar[d]^f\\
\{o\} \ar@{^{(}->}[r] & \cA

where $f:\cX\to\cA$ is a smooth projective morphism and
$\cA$ is a square zero extension of $\Spec(\C)$.
Let $o \in \cA$ be the unique point.

$(1)$ Given a $(2,2)$-class $\gamma \in H^2(X,\Omega^2_X) \subseteq H^4(X,\C)$,
there exists a horizontal section $\tgamma \in F^2H^4_{DR}(\cX/\cA)$ such that $\tgamma_o=\gamma$ if and only if the composition

\begin{equation*}\label{Eq:64}
T_{o,\cA} \xrightarrow{KS_{\cX/\cA}} H^1(X,T_X) \xrightarrow{\sfB_{\gamma}} H^1(X,T_X)\dual
\end{equation*}

$(2)$ Given a perfect complex $I\udot$ on $\cX$ with $\ch_1(I\udot)=0$,
there exists a perfect complex $\widetilde{I}\udot$ on $\cX$ with $\det(\widetilde{I}\udot)\cong \O_{\cX}$ such that $\widetilde{I}\udot_o\cong I\udot$ if and only if the composition

\begin{equation}\label{Eq:65}
T_{o,\cA} \xrightarrow{KS_{\cX/\cA}} H^1(X,T_X) \xrightarrow{\sfob} \Ext^2_X(I\udot,I\udot)_0
\end{equation}

(1) follows directly from <cit.>.
We would like to deduce (2) from <cit.> (or <cit.>). Consider a diagram

\[\xymatrix@C+2pc{
& \LL_X \cong \LL_{\cX/\cA}|_{X}<EMAIL_ADDRESS>\ar[rd]^{\KS_{\cX/\cA}|_X} & \\
R\hom_{X}(I\udot,I\udot)[-1] \ar@{.>}[r]|-{\At_{X/\cA}(I\udot)} \ar@{.>}[ru]^-{\At_{X}(I\udot)} \ar@{.>}[rd]_-{\At_{X/\cX}(I\udot)} & \LL_{X/\cA} \ar[r]|-{\KS_{X/\cA}} \ar@{.>}@<.8ex>[u]^-{\mathrm{pr}_2}\ar<EMAIL_ADDRESS>& \LL_{\cA}|_{X}[1]\\
& \LL_{X/\cX} \cong \LL_{o/\cA}|_{X}<EMAIL_ADDRESS>\ar[ru]_{\KS_{o/\cA}|_X}

where the left two triangles commute with the dotted arrows and the right two triangles commute with the solid arrows. Moreover, the composition of the middle arrows is zero because $\At_{X/\cA}(I^\mdot)$ factors through $\At_{X}(I^\mdot)$.
Hence the total big square commutes (up to sign). Therefore, the map (<ref>) corresponds to the composition

\[I\udot \xrightarrow{\At_{X/\cX}(I\udot)} I\udot \otimes \LL_{X/\cX}[1] \to I\udot \otimes \I_{X/\cX}[2] = I\udot \otimes \I_{o/\cA}[2]\]

via adjunction.

§.§ Cosection localization

In this subsection, we construct the reduced virtual cycle and prove Theorem <ref> via the cosection localization technique of Kiem-Li [94], as in [96].
We also prove Theorem <ref> as a corollary.

Let $\curP:=\PTqvX$ be the moduli space of $\PT_q$ pairs on $X$ with fixed Chern character $v = (0,0,\gamma,\beta,n-\gamma\cdot\td_2(X)) \in H^*(X,\Q)$. Let $\phi:\EE\to\trunc\LL_{\curP}$ be the standard symmetric obstruction theory of $\curP$ in (<ref>).

We first observe that the semi-regularity maps provide cosections.

There exists a natural map

\[\SR : \EE\dual[1] \to H^1(X,T_X)\dual\otimes \O_{\curP}\]

satisfying the following properties:

$(1)$ The fibre of the map $\SR$ over  $[(F,s)] \in \curP$ is the composition[The first map is given by the canonical quasi-isomorphism $C^\mdot \cong \bigoplus_i h^i(C^\mdot)[-i]$ for any complex of vector spaces (<cit.>).]

\[\SR|_{(F,s)} : R\Hom_X(I\udot,I\udot)_0[2] \to \Ext^2_X(I\udot,I\udot)_0 \xrightarrow{\sr} H^1(X,T_X)\dual,\]

where $\sr$ is the semi-regularity map (Definition <ref>(1)) for the associated complex $I\udot := [\O_X \xrightarrow{s}F]$.

$(2)$ The square
of the map $\SR$ is

\[\SR^2 = \sfB_\gamma \otimes 1 : H^1(X,T_X)\otimes \O_{\curP} \to H^1(X,T_X)\dual \otimes \O_{\curP},\]

$\gamma \in H^2(X,\Omega^2_X)$.

Here we identified $H^3(X,\Omega^1_X) = H^1(X,T_X)\dual$ via Serre duality and the Calabi-Yau 4-form, as in Proposition <ref>.

Let $\II\udot$ denote the universal complex.
Consider the map

\[R\hom_\pi(\II\udot,\II\udot)_0[2] \xrightarrow{\At_{\curP\times X/\curP}(\II\udot)} R\hom_\pi(\II\udot,\II\udot\otimes \Omega^1_X)[3]\xrightarrow{\tr^3}  H^3(X,\Omega^1_X)\otimes \O_{\curP} ,\]

where the third trace map is defined as (see footnote <ref>)

\tr^3 : R\hom_\pi(\II\udot,\II\udot\otimes \Omega^1_X)[3] \stackrel{\tr}{\to} R\Gamma(X,\Omega_X^1) \otimes \O_{\curP}[3] \to H^3(X,\Omega^1_X) \otimes \O_{\curP}.

The map $\SR$ is then defined by composing the above with the isomorphism $H^3(X,\Omega^1_X) \cong H^1(X,T_X)^\vee$. The functoriality of the Atiyah classes ensures that the fibres of $\SR$ are the semi-regularity maps. This proves (1).

Next, we claim that
the square

\[\SR^2 : H^1(X,T_X) \otimes \O_{\curP} \xrightarrow{\SR\dual} \EE[-1] \cong \EE\dual[1] \xrightarrow{\SR} H^1(X,T_X)\dual \otimes \O_{\curP}\]

is given by contraction with the Chern character

\[\ch_2(\II\udot) := \frac{1}{2} \tr (\At^2(\II\udot)) \in   H^2(X,\Omega_X^2) \otimes \Gamma(\curP, \O_{\curP}).\]

Statement (2) then follows because Proposition <ref> implies that the Chern character $\ch_2(\II\udot)$ is a horizontal section, i.e.,

\[\ch_2(\II\udot) = \gamma \otimes 1.\]

In order to prove the claim, it suffices to take hypercohomology $\mathbb{H}^0(\curP,-)$ of the composition $\SR^2$ and show that this equals contraction with $\ch_2(\II\udot)$.
By <cit.>, the following triangle commutes

\[\xymatrix{
H^1(\curP \times X, T_{\curP \times X / \curP}) \ar[rr] \ar[rd]_{\iota_{\ch_2(\II\udot)}} && \Ext^2_{\curP \times X}(\II\udot,\II\udot)_0 \ar[ld] \\
& H^3(\curP \times X, \Omega^1_{\curP \times X / \curP}),&

where the top map is induced by $\SR\dual$ and the right map by $\SR$. Using the decomposition (see footnote <ref>)

H^m(\curP \times X, T_{\curP \times X / \curP}) = \bigoplus_{i+j=m} H^i(X,T_X) \otimes H^j(\curP,\O_{\curP})

and similarly for $\Omega^1_{\curP \times X / \curP}$, we obtain the commutative diagram

\[\xymatrix{
H^1(X,T_X) \otimes H^0(\curP,\O_{\curP}) \ar^{\mathbb{H}^0(\curP,\SR^\vee)}[rr] \ar[rd]_{\iota_{\ch_2(\II^\mdot)}} && \Ext^2_{\curP \times X}(\II\udot,\II\udot)_0 \ar^{\mathbb{H}^0(\curP,\SR)}[ld] \\
& H^3(X,\Omega^1_X) \otimes H^0(\curP,\O_{\curP})&

as desired.

The map $\SR$ in Proposition <ref> is the collection of all cosections associated to $(3,1)$-forms in <cit.>. More precisely, if we choose a $(3,1)$-form $\xi \in H^1(X,T_X) \cong H^1(X,\Omega^3_X)$, then the composition

\[\EE\dual[1] \xrightarrow{\SR} H^1(X,T_X)\dual \otimes \O_{\curP} \xrightarrow{\xi} \O_{\curP}\]

is exactly the cosection $\sigma^{\xi}$ associated to the $(3,1)$-form $\xi$ considered in [96].

We sometimes call the symmetric complex $\EE$ in the obstruction theory $\phi:\EE \to \trunc \LL_{\curP}$ the virtual cotangent complex. Following this perspective, we define the reduced virtual cotangent complex $\EE^\red_V$ as follows:

Choose a non-degenerate subspace $V\subseteq H^1(X,T_X)$ with respect to the bilinear form $\sfB_\gamma$.

* We denote by

\begin{equation*}\label{Eq:SRV}
\SR_V : \EE\dual[1] \xrightarrow{\SR} H^1(X,T_X)\dual\otimes \O_{\curP} \twoheadrightarrow V\dual \otimes \O_{\curP}
\end{equation*}

the composition.
Then the square

\[\SR^2_V =  \sfB_\gamma|_V \otimes 1 : V \otimes \O_{\curP} \xrightarrow{\SR_V\dual} \EE[-1] \cong \EE\dual[1] \xrightarrow{\SR_V} V\dual \otimes \O_{\curP}\]

is an isomorphism by Proposition <ref>(2).

* We define $\EE^\red_V:=\mathrm{cone}(\SR_V\dual[1])$. Since the natural map $\SR_V\dual[1]$ has a left inverse, we have a splitting

\begin{equation}\label{eq:EEredV}
\EE \cong \EE^\red_V \oplus \left(V\otimes \O_{\curP}[1]\right).
\end{equation}

Moreover, $(\EE^\red_V)\dual[2] \to \EE\dual[2] \xrightarrow{\theta} \EE \to \EE^\red_V$ induces a symmetric form on $\EE^\red_V$ and (<ref>) is a splitting of symmetric complexes.

* We denote by

\[\fQ(\EE_V^\red) \subseteq \fC(\EE_V^\red)\]

the quadratic cone stack induced by the above symmetric form.

The main result in this subsection is the following cone reduction property:

Given a non-degenerate subspace $V \subseteq H^1(X,T_X)$ with respect to $\sfB_\gamma$,
there exists a commutative diagram

\[\xymatrix{
& \fQ(\EE^\red_V) \ar@{^{(}->}[d] \ar@{^{(}->}[r] &\fC(\EE^\red_V)  \ar@{^{(}->}[d]\\
(\fC_{\curP})_\red \ar@{^{(}->}[r]<EMAIL_ADDRESS>& \fQ(\EE) \ar@{^{(}->}[r] & \fC(\EE)

for a unique dotted arrow and where the square is cartesian.
Here the closed embedding $(\fC_{\curP})_{\red} \hookrightarrow \fQ(\EE)$ is given by (<ref>).

We will form a commutative diagram

\begin{equation}\label{Eq2}
\xymatrix{
& \fQ(\EE^\red_V) \ar@{^{(}->}[r] \ar@{^{(}->}[d] &\fC(\EE^\red_V) \ar[r] \ar@{^{(}->}[d] & \curP \ar@{^{(}->}[d]^{0}
\\
(\fC_{\curP})_\red \ar@{^{(}->}[r]^{}<EMAIL_ADDRESS>& \fQ(\EE) \ar@{^{(}->}[r] \ar[d] &\fC(\EE) \ar[r]^-{\fl_{\SR_V}} \ar[d]^{\fq_\EE} & V|_{\curP}\dual\\
& \curP \ar@{^{(}->}[r]^0 & \bbA^1_{\curP}
\end{equation}

with cartesian squares, where $\fl_{\SR_V}:=\fC(\SR_V\dual[1])$ is the linear function induced by $\SR_V\dual : V\otimes \O_{\curP} \to \EE[-1]$ and $\fq_{\EE}$ is the quadratic function induced by $\theta : \O_{\curP} \to (\EE\otimes\EE)[-2]$.
Indeed, the lower square in (<ref>) is cartesian since the quadratic cone stack $\fQ(\EE)$ is defined as the zero locus of the quadratic function $\fq_\EE$. The upper right square in (<ref>) is cartesian since $\EE^\red_V$ is defined as the cone of $\SR_V\dual[1] : V\otimes \O_{\curP} [1] \to \EE$, see the proof of Lemma <ref>.
The middle upper square is cartesian since (<ref>) is a direct sum decomposition of symmetric complexes. Indeed, we have

\begin{equation}\label{Eq21}
\fq_{\EE} = \fq_{\EE^\red_V}\circ p_1 + \fq_V|_{\curP} \circ p_2 : \fC(\EE) = \fC(\EE^\red_V) \times_{\curP} V|_{\curP}\dual \to \bbA^1_{\curP}
\end{equation}

where $p_1$, $p_2$ are the projection maps and $\fq_V: V\times V \to \C$ denotes the quadratic function induced by $\sfB_\gamma|_V$. Then the formula (<ref>) implies that the triangle

\[\xymatrix{
\fC(\EE^\red_V) \ar[rd]^{\fq_{\EE^\red_V}} \ar@{^{(}->}[d] & \\
\fC(\EE) \ar[r]_{\fq_\EE} & \bbA^1_{\curP}

commutes. Hence the middle upper square in (<ref>) is also cartesian. Finally, by Kiem-Li's cone reduction lemma [94] in the form of Lemma <ref> below, we can find the dotted arrow that fits into the commutative diagram (<ref>).

We rephrase Kiem-Li's cone reduction lemma as follows. This lemma is required to complete the proof of Proposition <ref>.

Let $\phi:\EE \to \trunc\LL_{\sX}$ be an obstruction theory
for an arbitrary Deligne-Mumford stack $\sX$.
Let $\Sigma: \EE\dual[1] \to F$ be a map for a vector bundle $F$.
Then there exists a commutative diagram

\begin{equation}\label{Eq:CL.3}
\xymatrix{
& \fC(\EE_{\Sigma}) \ar[r] \ar@{^{(}->}[d] & \sX \ar@{^{(}->}[d]^{0_F}\\
(\fC_{\sX})_\red<EMAIL_ADDRESS>\ar@{^{(}->}[r] & \fC(\EE) \ar[r]^-{\fl_{\Sigma}} & F
\end{equation}

with a unique dotted arrow and where the square is cartesian.
Here the closed embedding $(\fC_{\sX})_{\red} \hookrightarrow \fC(\EE)$ is induced by the obstruction theory $\phi$,
the linear function $\fl_{\Sigma}:=\fC(\Sigma\dual[1]):\fC(\EE) \to F$ is induced by the map $\Sigma$, and
the perfect complex $\EE_{\Sigma}$ is the cone of the map $\Sigma\dual[1]:F\dual[1] \to \EE$.

Note that the statement is local on $\sX$.
Thus we may assume that $\sX$ is a quasi-projective scheme and $F=\O_{\sX}^{\oplus r}$ is a trivial vector bundle.
By the resolution property of $\sX$, we can find a chain complex of vector bundles that represents $\EE$,

\[\EE \cong [E^{-e} \xrightarrow{} \cdots \to E^{-2} \xrightarrow{d^{-1}} E^{-1} \xrightarrow{d^0} E^0]\]

and a morphism of chain complexes that represents $\Sigma$,

\[\xymatrix{
\EE\dual[1] \ar[d]^{\Sigma} \ar@{}[rd]|-{\cong} & E_0 \ar[r]^{}\ar[d] & E_1 \ar[r]^{}\ar[d]^{\widetilde{\Sigma}} & E_2 \ar[r] \ar[d]& \cdots \ar[d] \ar[r] & E_e \ar[d] \\
F  & 0 \ar[r] &F \ar[r] & 0 \ar[r] & \cdots \ar[r] & 0

where we denoted $E_i:=(E^{-i})\dual$.
Then we also have

\[\EE_{\Sigma} \cong [E^{-e} \xrightarrow{} \cdots \to E^{-2} \oplus F\dual \xrightarrow{(d^{-1},\tSigma\dual)} E^{-1} \xrightarrow{d^0} E^0].\]

Firstly, we will show that the square in (<ref>) is cartesian. Indeed, note that the cokernels

\[D:=\coker(d^{-1} : E^{-2} \to E^{-1}),\quad
D_{\tSigma}:=\coker((d^{-1},\tSigma\dual) : E^{-2}\oplus F\dual \to E^{-1})\]

fit into a right exact sequence of coherent sheaves

\[\xymatrix{F\dual \ar[r] & D \ar[r] & D_{\tSigma} \ar[r] & 0}.\]

By taking the associated abelian cones, we obtain a cartesian square

\[\xymatrix{
C(D_{\tSigma}) \ar[r] \ar@{^{(}->}[d] & \bbA^1_{\sX} \ar@{^{(}->}[d]^{0_F}\\
C(D) \ar[r]^-{\tSigma|_{C(D)}} & F.

Since $\fC(\EE) = [C(D)/E_0]$ and $\fC(\EE_{\Sigma}) = [C(D_{\tSigma})/E_0]$, we obtain the desired cartesian square via descent.

Secondly, we will find a dotted arrow that fits into the commutative diagram (<ref>). The uniqueness is obvious.
Consider the induced (2-term) perfect obstruction theory

\[\phi^\tau : \EE^\tau:= [E^{-1} \xrightarrow{d^0} E^0] \xrightarrow{t} \EE \xrightarrow{\phi} \trunc\LL_{\sX}\]

and an induced cosection $\Sigma^\tau$ that fits into the commutative diagram

\[\xymatrix{
\EE\dual[1] \ar[d]_-{t\dual[1]} \ar[r]^-{\Sigma} & F\\
(\EE^\tau)\dual[1]<EMAIL_ADDRESS>
Since $F$ is a trivial vector bundle, we may write

\[\Sigma^\tau=(\sigma_1,\cdots,\sigma_r) : (\EE^\tau)\dual[1] \to F \cong \O_{\sX}^{\oplus r}.\]

Then $\sigma_i : (\EE^\tau)\dual[1] \to \O_{\sX}$ are cosections for the perfect obstruction theory $\phi^\tau$. Hence by <cit.>, we have

\[(\fC_{\sX})_\red \subseteq \fC((\EE^\tau)_{\sigma_i})\]

as substacks of $\fC(\EE^{\tau})$, where $(\EE^\tau)_{\sigma_i}:=\cone(\sigma_i\dual[1])$.
Here $ \fC((\EE^\tau)_{\sigma_i})$ are set-theoretically the kernel cone stacks in [94].
Hence we have a commutative diagram

\[\xymatrix{
& \fC(\EE_\Sigma) \ar@{^{(}->}[r] \ar@{^{(}->}[d] & \bigcap_i\fC((\EE^\tau)_{\sigma_i}) \ar[r] \ar@{^{(}->}[d] & \sX \ar@{^{(}->}[d]^{0_F}\\
(\fC_{\sX})_\red \ar@{^{(}->}[r] \ar@{-->}[rru] <EMAIL_ADDRESS>\fC(\EE) \ar@{^{(}->}[r]^{\fC(t)}<EMAIL_ADDRESS>& \fC(\EE^\tau) \ar[r]^{\fl_{\Sigma^{\tau}}} & F

where the squares are cartesian by the result in the previous paragraph. Hence the dotted arrow in the above diagram gives us the desired dotted arrow in (<ref>).

Now Theorem <ref> is a direct corollary of Proposition <ref>.

We first construct a reduced virtual cycle with respect to a maximal non-degenerate subspace $V \subseteq H^1(X,T_X)$. Here maximal means that $\dim(V)=\rank(\sfB_\gamma)=\rho_\gamma$. Thus the composition

\begin{equation}\label{Eq3}
V \hookrightarrow H^1(X,T_X) \twoheadrightarrow H^1(X,T_X)_\gamma
\end{equation}

is an isomorphism.

As in the proof of Theorem <ref> (see also Remark <ref>), we can construct a square root Gysin pullback

\[\sqrt{0^!_{\fQ(\EE^\red_V)}} : A_*\left(\fQ(\EE^\red_V)\right) \to A_*\left(\curP\right)\]

for the symmetric complex $\EE^\red_V$.
Here the orientation of $\EE^\red_V$ is determined by the orientations of $\EE$ and $H^1(X,T_X)_\gamma$ via the canonical isomorphisms

\[\det(\EE) \cong \det(\EE^\red_V) \otimes \det(V) \cong \det(\EE^\red_V) \otimes \det(H^1(X,T_X)_\gamma)\]

of line bundles, induced by the decomposition (<ref>) and the isomorphism (<ref>).

By the cone reduction property in Proposition <ref>, we may consider the fundamental class of the intrinsic normal cone $\fC_{\curP}$ as a cycle class in $\fQ(\EE^\red_V)$,

\[[\fC_{\curP}] \in A_0\left(\fQ(\EE^\red_V)\right).\]

Indeed, this can be defined as the pushforward of the fundamental class $[\fC_{\curP}] \in A_*((\fC_{\curP})_\red) = A_*(\fC_{\curP})$ under the closed embedding $(\fC_{\curP})_\red \hookrightarrow \fQ(\EE^\red_V)$.

Analogous to the definition of the non-reduced virtual cycle in (<ref>), we define the reduced virtual cycle as

\begin{equation}\label{Eq6}
\left[\curP\right]^{\red}_V := \sqrt{0^!_{\fQ(\EE^\red_V)}} \left[\fC_{\curP}\right] \in A_{\mathrm{rvd}}\left(\curP\right).
\end{equation}

Then the reduced virtual dimension is

\[\rvd = \vd + \frac12\dim(V) = n- \frac12 \gamma^2 + \frac12 \rho_\gamma.\]

We now claim that the reduced virtual cycle $[\curP]^\red_V$ in (<ref>) is independent of the choice of a maximal non-degenerate subspace $V \subseteq H^1(X,T_X)$. Note that a choice of a maximal isotropic subspace $V$ of $H^1(X,T_X)$ is equivalent to a choice of a section of the surjection
$H^1(X,T_X) \twoheadrightarrow H^1(X,T_X)_\gamma.$
Thus, if we fix one splitting

\[H^1(X,T_X) =  H^1(X,T_X)_\gamma \oplus \ker(\sfB_\gamma),\]

then any other splitting corresponds to a map $H^1(X,T_X)_\gamma \to \ker(\sfB_\gamma).$ Therefore, any two splittings are connected via a family of splittings parametrized by $\bbA^1$. A deformation argument proves the claim.[Generally, we need to be careful when we apply the cone reduction in the relative setting. But in this case, the map $\curP \times \bbA^1 \to \bbA^1$ is flat, so we can detect the cone reduction property fibrewise.]

We view the cosection localization (Proposition <ref>) in this paper as an orthogonal version to the one in [96].
Indeed, there are two types of cosections $\Sigma : \EE\dual[1] \to F$ in DT4 theory:

* isotropic cosections, i.e., $\Sigma^2=0$,

* non-degenerate cosections, i.e., $\Sigma^2$ is an isomorphism.

In [96], cosection localization for the first case is studied, whereas we introduced the second case in this paper.

In the second case, if the orthogonal bundle $(F,\Sigma^2)$ is of even rank and has a maximal isotropic subbundle, then we can reduce to the first case. Then both approaches give the same reduced virtual cycle.

However, for surfaces on Calabi-Yau 4-folds, there are many examples (e.g. Example <ref>) that have an odd number of cosections. Therefore we indeed need cosection localization as in the second case for counting surfaces.

In general, the cone reduction property in Proposition <ref> does not assure the existence of a reduced obstruction theory, see <cit.>.
However, in our situation for $\PTqvX$, we will see in the next subsection that there indeed exists a reduced obstruction theory.

We now prove Theorem <ref>. The implication $(\Rightarrow)$ can be shown using the infinitesimal lifting criterion as in <cit.>. We provide an alternative proof, more in line with DT4 theory, using the cone reduction property (Proposition <ref>).

($\Rightarrow$) Let $[(F,s)] \in \curP$ be a $\PT_q$ pair for which the associated perfect complex $I\udot:=[\O_X \xrightarrow{s}F]$ is semi-regular.

Choose a maximal non-degenerate subspace $V \subseteq H^1(X,T_X)$ with respect to $\sfB_\gamma$. We first claim that the restriction of the obstruction map $\sfob$ in (<ref>) to $V$

\[\sfob|_V : V \hookrightarrow H^1(X,T_X) \twoheadrightarrow \Ext^2_X(I\udot,I\udot)_0\]

is an isomorphism. Indeed, by Corollary <ref>, the above map $\sfob|_V$ is injective. On the other hand, the semi-regularity of $I\udot$ implies that the obstruction map $\sfob=\sr\dual:H^1(X,T_X) \to \Ext^2_X(I\udot,I\udot)_0$ is surjective. Hence we have

\[\dim(V) = \rho_\gamma = \rank(\sfB_\gamma) = \rank(\sfob^*(\sfY))= \rank(\sfY)= \dim_{\C}\Ext^2_X(I\udot,I\udot)_0.\]

Therefore the above map $\sfob|_V$ is bijective. This proves the claim.

By the derived Darboux theorem <cit.>,
we can find a diagram

\[\xymatrix{
& E \ar[d]\\
U(t) \ar@{^{(}->}[r] & U<EMAIL_ADDRESS>
where $U$ is a smooth affine scheme, $E$ is an orthogonal bundle over $U$, $t \in \Gamma(U,E)$ is an isotropic section, and $U(t)$ is the zero locus of $t$ in $U$, with a Zariski open embedding $U(t) \hookrightarrow \curP$ whose image contains $[I\udot] \in \curP$. Also,
the standard symmetric obstruction theory $\phi:\EE \to \tau^{\geq -1} \LL_{\curP}$ in (<ref>) can be written as

\[\xymatrix{
\EE|_{U(t)} \ar[d]^{\phi} \ar@{}[rd]|-{=} & T_U|_{U(t)} \ar[r]^-{dt}\ar[d] & E|_{U(t)}\dual \ar[r]^-{dt} \ar[d]^t & \Omega_U|_{U(t)} \ar@{=}[d]\\
\trunc\LL_{\curP}|_{U(t)}  & 0 \ar[r] & \I/\I^2 \ar[r]^d & \Omega_U|_{U(t)}

where $\I=\I_{U(t)/U}$ is the ideal sheaf of $U(t) \subseteq U$.
by choosing a minimal Darboux chart (in the sense of <cit.>),
we can further assume that the fibre of the map $dt: T_U|_{U(t)} \to E|_{U(t)}\dual$ at $[I\udot] \in U(t)$ is zero.

Consider the map $\SR_V$ in Definition <ref>(1). Then we have a diagram

Ω_U|_U(t) [r] @–>[dr]     |_U(t) ^_V[d] [r]     [T_U|_U(t) →E|_U(t)^∨→0]

where the last term is the stupid truncation and the dotted arrow is the composition. Since $U(t)$ is affine, the dotted arrow is zero and we obtain a morphism of cochain complexes

\[\xymatrix{
\EE|_{U(t)} \ar[d]^{\SR_V} \ar@{}[rd]|-{=} & T_U|_{U(t)} \ar[r]^-{dt}\ar[d] & E|_{U(t)}\dual \ar[r]^-{dt} \ar[d]^{\widetilde{\SR_V}} & \Omega_U|_{U(t)} \ar[d]\\
V\dual \otimes \O_{U(t)}[1]  & 0 \ar[r] & V\dual \otimes \O_{U(t)} \ar[r] & 0

for some map $\widetilde{\SR_V}$.
By Proposition <ref>(1), and the fact that the fibre of $dt$ at $[(F,s)]$ is zero,
the fibre of the map $\widetilde{\SR_V}$ over $[(F,s)] \in \curP$ can be identified with the composition

\begin{equation}\label{Eq5}
\widetilde{\SR_V}|_{(F,s)} : \Ext^2(I\udot,I\udot)_0 \xrightarrow{\sr} H^1(X,T_X)\dual \twoheadrightarrow V\dual.
\end{equation}

Since $\sfob|_V$ is an isomorphism, Proposition <ref> implies that the map (<ref>) is an isomorphism. Therefore, by shrinking $U$ further, we may assume that the map $\widetilde{\SR_V}$ is an isomorphism.

Consider $U(t)$ as the zero section $U(t) \subset E|_{U(t)}$.
By the cone reduction property in Proposition <ref>,
we have

\[\left[\frac{(C_{U(t)/U})_\red}{T_{U}|_{U(t)}} \right] = \left(\fC_{U(t)}\right)_\red \subseteq \fC(\EE^\red_V) = \left[\frac{U(t)}{T_U|_{U(t)}}\right]\]

as substacks of $\fC(\EE)\subseteq [E|_{U(t)}/T_U|_{U(t)}]$ since $\ker(\widetilde{\SR_V})=0$.
Therefore, we have

\[(C_{U(t)/U})_\red = U(t).\]

Equivalently, the ideal
$\bigoplus_{n>0}\frac{\I^n}{\I^{n+1}} \subseteq \bigoplus_{n\geq 0}\frac{\I^n}{\I^{n+1}}$
is nilpotent. Hence, we have $\frac{\I^n}{\I^{n+1}} =0$
for some $n$, and Nakayama's lemma implies
$(1-i) \cdot \I^n =0 $
for some $i \in \I$. Since $U$ is integral and $U(t)$ is nonempty, we have $\I=0$ and thus $t=0$. Therefore, $U(t)=U$ is smooth of dimension

\[\dim(U) = \left(\dim(U) - \frac12 \rank(E)\right) + \frac12 \rank(E) = \vd + \frac12 \rho_\gamma = \rvd.\]

This completes the proof of ($\Rightarrow$) since $U(t)$ is an open neighborhood of $[I\udot] \in \curP$.

($\Leftarrow$) Assume that $\curP$ is smooth of dimension $\rvd$ at $[I\udot] \in \curP$. Choose a maximal non-degenerate subspace $V$ of $H^1(X,T_X)$ with respect to $\sfB_\gamma$. By Corollary <ref>, the restriction of the obstruction map to $V$

\[\sfob|_V : V \hookrightarrow H^1(X,T_X) \xrightarrow{\sfob} \Ext^2_X(I\udot,I\udot)_0\]

is injective. On the other hand, since $\curP$ is smooth at $[I\udot] \in \curP$, we have

\[\dim(V) = \rho_\gamma = 2\cdot(\rvd - \vd) = 2 \cdot\left(\mathrm{ext}^1 - (\mathrm{ext}^1 -  \frac12 \mathrm{ext}^2)\right)=\mathrm{ext}^2\]

where $\mathrm{ext}^1:=\dim_\C \Ext^1_X(I\udot,I\udot)_0$ and $\mathrm{ext}^2:=\dim_\C \Ext^2_X(I\udot,I\udot)_0$. Hence the above map $\sfob|_V$ is bijective. Then the obstruction map $\sfob$ is surjective, and its dual $\sr$ is injective (Proposition <ref>). Therefore $[I\udot] \in \curP$ is semi-regular.

§.§ Algebraic twistor family

In this subsection, we construct a reduced obstruction theory via the algebraic twistor family introduced by the second-named author and Thomas in [102].

We use the notation from the previous subsections. Let $\PTqvX$ be the moduli space of $\PT_q$ pairs $(F,s)$ on a Calabi-Yau 4-fold $X$ with fixed cohomological Chern character $\ch(F)=v=(0,0,\gamma,\beta,n-\gamma\cdot\td_2(X)) \in H^*(X,\Q)$.
The main result in this subsection is the following:

Given a non-degenerate subspace $V \subseteq H^1(X,T_X)$ with respect to $\sfB_\gamma$, the composition

\begin{equation}\label{eq:S5.redSOT}
\phi^\red_V : \EE^\red_V \to \EE \xrightarrow{\phi} \tau^{\geq -1} \LL_{\PTqvX}
\end{equation}

is also a symmetric obstruction theory, i.e., $h^0(\phi^\red_V)$ is bijective and $h^{-1}(\phi^\red_V)$ is surjective. Here the first map in (<ref>) is given by the decomposition (<ref>) and the second map is the standard symmetric obstruction theory in (<ref>).

The rest of this subsection is devoted to the proof of Proposition <ref>. By the deformation theory of algebraic varieties, any subspace $V\subseteq H^1(X,T_X)$ corresponds to a fibre diagram

\[\xymatrix{
X \ar@{^{(}->}[r] \ar[d] & \cX_V \ar[d]^{f_V} \\
\Spec(\C) \ar@{^{(}->}[r] & \cA_V

where $\cX_V \to \cA_V$ is a smooth projective morphism over the spectrum of the local Artinian $\C$-algebra $A_V:= \O_V / \mathfrak{m}^2 = \C \oplus V\dual$, where $\m \subset \O_V$ denotes the maximal ideal of functions vanishing at the origin. Here $\Omega^1_{\cA_V} = V\dual \otimes \O_{\cA_V}$ and the (restriction) of the (classical) Kodaira-Spencer map

\[\KS_{\cX_V/\cA_V}|_X : \Omega^1_X \to V\dual\otimes \O_X[1]\]

corresponds to the given inclusion $V \subseteq H^1(X,T_X)$ via adjunction.

\[\tv=v\otimes 1 \in H^*_{DR}(\cX_V/\cA_V) \cong H^*_{DR}(X)\otimes_\C A_V\]

be the unique horizontal lift of $v \in H^*_{DR}(X)$ (see subsection <ref> for the definitions of the de Rham cohomology and horizontal sections). Form a fibre diagram

\begin{equation}\label{eq:S5.4}
\xymatrix{
\PTqvX \ \ar@{^{(}->}[r] \ar[d] & {\curly P}^{(q)}_{\tv}(\cX_V/\cA_V)\ar[d] \\
\Spec(\C) \ar@{^{(}->}[r] & \cA_V
\end{equation}

where ${\curly P}^{(q)}_{\tv}(\cX_V/\cA_V)$ is the relative moduli space of $\PT_q$ pairs on the fibres of $\cX_V \to \cA_V$. The key observation is the following:

If $V\subseteq H^1(X,T_X)$ is a non-degenerate subspace, then the canonical inclusion map

\[\PTqvX \hookrightarrow {\curly P}^{(q)}_{\tv}(\cX_V/\cA_V)\]

is an isomorphism of schemes.

The proof is similar to <cit.> and <cit.>. We first claim that the Hodge locus of the horizontal section

\[\gamma \otimes 1 \in H^4_{DR}(\cX_V/\cA_V) \cong H^4_{DR}(X)\otimes A_V\]

is just the unique closed point in $\cA_V$. More precisely, the scheme-theoretical zero locus of the induced section

\[\overline{\gamma\otimes1} \in \frac{H^4_{DR}(\cX_V/\cA_V)}{F^2H^4_{DR}(\cX_V/\cA_V)}\]

is the closed point in $\cA_V$. Indeed, choose a subspace $W \subseteq V$ and let

\[\cA_W:=\Spec(\C\oplus W\dual) \subseteq \cA_V\]

be the corresponding subscheme. Assume that the section $\overline{\gamma\otimes1}$ vanishes on $\cA_W$, i.e.,

\[\overline{\gamma\otimes1}|_{\cA_W} =0 \in \frac{H^4_{DR}(\cX_W/\cA_W)}{F^2H^4_{DR}(\cX_W/\cA_W)}.\]

Equivalently, the unique horizontal lift of $\gamma$ over $\cA_W$ is a Hodge class. By <cit.> (cf. Lemma <ref>(1)), we deduce that the composition

\[\sfB_\gamma|_W : W \hookrightarrow H^1(X,T_X) \xrightarrow{\iota_{-}(\gamma)} H^3(X,\Omega^1_X) \cong H^1(X,T_X)\dual\]

is zero. Hence we have

\[ W \subseteq V \cap \ker(\sfB_\gamma) =0\]

by the non-degeneracy of $V$. This proves the claim.

We will now show that any morphism

\begin{equation}\label{eq:S5.3}
t : T \to {\curly P}^{(q)}_{\tv}(\cX_V/\cA_V)
\end{equation}

from an affine scheme $T$ factors through $\PTqvX$. Indeed, let

\[I\udot=[\O_{\cX_T} \xrightarrow{s} F]\]

be the family of $\PT_q$ pairs that corresponds to the map (<ref>), where

\[\xymatrix{
\cX_T \ar[r] \ar[d] & \cX_V \ar[d]\\
T \ar[r]^t & \cA_V

is the induced fibre diagram. By Proposition <ref>, we have

\[t^*(\gamma\otimes 1) = \widetilde{\ch_2(I\udot)} \in F^2H^4_{DR}(\cX_T/T) \]

where $\widetilde{\ch_2(I\udot)} \in F^2 H^4_{DR}(\cX_T/T)$ is the unique horizontal lift of the Chern character $\ch_2(I\udot):=\tfrac{1}{2} \tr(\At^2(I\udot)) \in H^2(\cX_T,\Omega_{\cX_T/T}^2)$. Thus we have

\[t^*(\overline{\gamma\otimes 1}) = 0 \in \frac{H^4_{DR}(\cX_T/T)}{F^2H^4_{DR}(\cX_T/T)}.\]

Hence the map $t:T \to \cA_V$ factors through the zero locus of $\overline{\gamma\otimes1}$, which is the unique closed point in $\cA_V$ by the result in the previous paragraph. Now the fibre diagram (<ref>) proves the desired property.

Finally, since the map $\PTqvX \hookrightarrow {\curly P}^{(q)}_{\tv}(\cX_V/\cA_V)$ is a closed embedding, the result in the previous paragraph proves that the map is an isomorphism.

By Proposition <ref>, the reduced obstruction theory of $\PTqvX$ can be obtained as the obstruction theory of ${\curly P}^{(q)}_{\tv}(\cX_V/\cA_V)$.

By Proposition <ref>, the fibre diagram (<ref>) can be expressed as

\[\xymatrix{
& \cA_V \ar[d]\\
\PTqvX \ar[r] \ar[ru] & \Spec(\C<EMAIL_ADDRESS>
where the two triangles commute. Hence we have a canonical direct sum decomposition of the cotangent complexes

\begin{equation}\label{eq:S5.5}
\xymatrix{
\LL_{\PTqvX}<EMAIL_ADDRESS>& \LL_{\PTqvX/\cA_V}<EMAIL_ADDRESS><EMAIL_ADDRESS>& \LL_{\cA_V}|_{\PTqvX}[1]<EMAIL_ADDRESS>\end{equation}

where the upper arrows and the lower arrows are the canonical distinguished triangles (cf. <cit.>).

\[\phi_{\cX_V/\cA_V} : \EE_{\cX_V/\cA_V} \to \trunc \LL_{\PTqvX/\cA_V}\]

be the standard relative obstruction theory for ${\curly P}_{\tv}^{(q)}(\cX_V/\cA_V) \to \cA_V$ where $\EE_{\cX_V/\cA_V} = \EE$ by Proposition <ref>.
We will consider the induced absolute obstruction theory. Indeed, form a morphism of distinguished triangles

\begin{equation}\label{eq:S5.6}
\xymatrix{
\EE^\red_V<EMAIL_ADDRESS>\ar[r] & \EE \ar[r]^-{\SR_V[1]} \ar[d]^{\phi_{\cX_V/\cA_V}} & V\dual\otimes \O_{\PTqvX}[1] \ar@{=}[d]\\
\trunc\LL_{\PTqvX} \ar[r] & \trunc \LL_{\PTqvX/\cA_V}  \ar[r]^-{\KS} & \Omega^1_{\cA_V}|_{\PTqvX}[1]
\end{equation}

for some dotted arrow $\phi^\red_V$, where the upper distinguished triangle is induced by (<ref>), the lower distinguished triangle is the truncation of (<ref>), and the right square commutes by Lemma <ref> below.
By the long exact sequence associated to (<ref>), we can deduce that the map $\phi^\red_V:\EE^\red_V \to \trunc \LL_{\PTqvX}$ is an obstruction theory, in the sense of [12].
Moreover since the lower distinguished triangle in (<ref>) splits, the obstruction theory $\phi^\red_V :\EE^\red_V \to \trunc \LL_{\PTqvX}$ is uniquely determined by the diagram (<ref>). Thus the map $\phi^\red_V$ in (<ref>) is equal to the composition (<ref>)
since the composition

\[\EE = \EE_{\cX_V/\cA_V}\xrightarrow{\phi_{\cX_V/\cA_V}} \tau^{\geq -1} \LL_{\PTqvX / \cA_V} \to \tau^{\geq -1} \LL_{\PTqvX}\]

is the original (non-reduced) obstruction theory for $\PTqvX$.

We need the following compatibility result between the Kodaira-Spencer maps to complete the proof of Proposition <ref>. Here we consider a more general version than needed for Proposition <ref>. This will be used later in the proof of deformation invariance in Theorem <ref>.

Let $f:\cX\to\cB$ be a smooth projective morphism of relative dimension $4$ over a quasi-projective scheme $\cB$. Let $\curP:=\PTqvXB$ be the relative moduli space of $\PT_q$ pairs on the fibres of $f:\cX\to\cB$. Let

\[\xymatrix{
\curP\times_{\cB}\cX \ar[d]^{\pi} \ar[r] & \cX \ar[d]^f \\
\curP:=\PTqvXB \ar[r] & \cB

be a fibre diagram. Then we have a commutative diagram

\begin{equation}\label{eq:S5.8}
\xymatrix{
\EE_{\cX/\cB}:=R\hom_{\pi}(\II\udot,\II\udot\otimes \omega_{\cX/\cB})_0[3] \ar[r]^-{\SR_{\cX/\cB}} \ar[d]^{\phi_{\cX/\cB}} & Rf_*(\Omega_{\cX/\cB}^1 \otimes \omega_{\cX/\cB})|_{\curP}[4] \ar[d]^{-\KS_{\cX/\cB}}\\
\LL_{\curP/\cB} \ar[r]^{\KS_{\curP/\cB}} & \LL_{\cB}|_{\curP}[1]
\end{equation}

where the relative obstruction theory $\phi_{\cX/\cB}$ and the relative cosection $\SR_{\cX/\cB}$ are given by the two components

\begin{align*}
&\At_{\curP\times_\cB \cX/\cX}(\II\udot) : \II\udot \xrightarrow{\At_{\curP\times_\cB \cX/\cB}(\II\udot)} \II\udot \otimes \LL_{\curP \times_{\cB} \cX/\cB}[1] \xrightarrow{\mathrm{pr}_1} \II\udot \otimes \LL_{\curP/\cB}[1]\\
&\At_{\curP\times_\cB \cX/\curP}(\II\udot) : \II\udot \xrightarrow{\At_{\curP\times_\cB \cX/\cB}(\II\udot)} \II\udot \otimes \LL_{\curP \times_{\cB} \cX/\cB}[1] \xrightarrow{\mathrm{pr}_2} \II\udot\otimes \Omega^1_{\cX/\cB}[1]
\end{align*}

of the Atiyah class $\At_{\curP\times_\cB \cX/\cB}(\II\udot)$ of the universal complex $\II\udot$.
For $\phi_{\cX/\cB}$, we use the adjunction $R \pi_*(-) \dashv L\pi^*(-) \otimes \omega_{\cX/\cB}[4]$.

The proof is similar that that of Lemma <ref>.
Consider the diagram

\begin{equation}\label{eq:S5.7}
\xymatrix@C+4pc{
& \LL_{\cX/\cB}|_{\curP\times_\cB \cX}<EMAIL_ADDRESS>\ar[rd]^{\KS_{\cX/\cB}} & \\
R\hom_{\curP\times_\cB \cX}(\II\udot,\II\udot)[-1] \ar[r]|-{\At_{\curP\times_\cB \cX/\cB}(\II\udot)}<EMAIL_ADDRESS>\cX/\curP}(\II\udot)}<EMAIL_ADDRESS>\cX/\cX}(\II\udot)} & \LL_{\curP\times_\cB \cX/\cB} \ar[r]|-{\KS_{\curP\times_\cB \cX/\cB}} \ar@{.>}@<.8ex>[u]^-{\mathrm{pr}_2}\ar<EMAIL_ADDRESS>& \LL_{\cB}|_{\curP\times_\cB \cX}[1]\\
& \LL_{\curP/\cB}|_{\curP\times_\cB \cX}<EMAIL_ADDRESS>\ar[ru]_{\KS_{\curP/\cB}}
\end{equation}

where the left two triangles commute with the dotted arrows, and the right two triangles commute with the solid arrows.
Since $\At_{\curP\times_\cB\cX/\cB}(\II\udot)$ factors through $\At_{\curP\times_\cB\cX}(\II\udot)$, the composition of the two horizontal arrows in (<ref>) vanishes

\[\KS_{\curP\times_\cB\cX/\cB} \circ \At_{\curP\times_\cB\cX/\cB}(\II\udot)=0.\]

We deduce that the big square in (<ref>) commutes (up to sign)

\begin{equation}\label{eq:S5.9}
\KS_{\cX/\cB} \circ \At_{\curP\times_\cB\cX/\curP}(\II\udot) = - \KS_{\curP/\cB}\circ \At_{\curP\times_{\cB}\cX/\cX}(\II\udot).
\end{equation}

The commutativity of (<ref>) follows from (<ref>) by adjunction.

The main limitation of the algebraic twistor family approach in this subsection is that the reduced obstruction theory is given as a composition, but not as a factorization,

\begin{equation}\label{Eq:4.22.1}
\xymatrix{
\EE^\red_V \ar[r] \ar[rd]_{\phi^\red_V}<EMAIL_ADDRESS>& \EE \ar[d]^{\phi} \ar[r]& \EE^\red_V \ar@{.>}[ld]^{?}\\
& \trunc \LL_{\PTqvX} .&
\end{equation}

In classical reduced theory, e.g. [102], this was sufficient to construct reduced Behrend-Fantechi virtual cycles [12].
However, in DT4 theory, this is not sufficient to construct reduced Oh-Thomas virtual cycles [125] since we need to know whether the reduced obstruction theory $\phi^\red_V$ satisfies the isotropic condition

\[\xymatrix{
& \fQ(\EE<EMAIL_ADDRESS>\ar@{^{(}->}[d] & \fQ(\EE^\red_V) \ar@{^{(}->}[d] \\
\fC_{\PTqvX} \ar@{^{(}->}[r] \ar@/_0.6cm/@{^{(}->}[rr]_{\text{algebraic twistor}}\ar@{.>}[rru]|>>>>>>>>>{?} \ar@{^{(}->}[ru]& \fC(\EE) \ar@{->>}[r] & \fC(\EE^\red_V).

Thus we additionally need the cone reduction property in the previous subsection (Proposition <ref>) to construct a reduced virtual cycle from $\phi^\red_V$.

To conclude, the cone reduction property in Proposition <ref> and the reduced obstruction theory in Proposition <ref> give us a commutative diagram

\begin{equation}\label{Eq:4}
\xymatrix@C+4pc{
(\fC_{\PTqvX})_\red \ar@{^{(}->}[d] \ar@{^{(}->}[r]^{\text{cone reduction}} & \fQ(\EE^\red_V) \ar@{^{(}->}[d] \\
\fC_{\PTqvX} \ar@{^{(}->}[r] \ar@{^{(}->}[r]_{\text{algebraic twistor}}  & \fC(\EE^\red_V).
\end{equation}

This proves Theorem <ref>.

In Appendix <ref>, we will construct a diagonal arrow $\fC_{\PTqvX} \hookrightarrow \fQ(\EE^\red_V)$ in commutative diagram (<ref>) using derived algebraic geometry, see Remark <ref>.

By Proposition <ref>, the standard derived enhancement on ${\curly P}^{(q)}_v(\cX_V/\cA_V)$ gives us the reduced derived enhancement on $\PTqvX$.
However, since the canonical map between the two derived enhancements is given as $R\PTqvX \hookrightarrow R\curP^{(q)}_v(\cX_V/\cA_V)$, it is not clear how to pullback the $(-2)$-shifted symplectic form of $R\PTqvX$ to the reduced derived enhancement.
In Appendix <ref>, we will construct a reduced derived enhancement with a map $(R\PTqvX)^\red \hookrightarrow R\PTqvX$ so that we can pullback the $(-2)$-shifted symplectic form.
Eventually, we find $(R\PTqvX)^\red \cong R\curP^{(q)}_v(\cX_V/\cA_V)$ since they have the same classical truncations and induced obstruction theories.

§.§ Reduced virtual dimension

In this subsection, we present various methods to compute the number $\rho_\gamma$ and the reduced virtual dimension.

Local complete intersection surfaces.
Let $X$ be a Calabi-Yau 4-fold. We take $i : S \hookrightarrow X$ a local complete intersection (lci) surface, $v = \ch(\O_S) = (0,0,\gamma,\beta,\chi(\O_S)-\gamma \cdot \td_2(X)) \in H^*(X)$. Our goal is to make the key diagram from Proposition <ref> more explicit and determine the reduced virtual dimension $\mathrm{rvd} = \chi(\O_S)-\tfrac{1}{2}\gamma^2+\tfrac{1}{2}\rho_\gamma$.
The normal sheaf $N_{S/X}$ is locally free because $S$ is lci. Since $X$ has trivial canonical bundle, we have

$$K_S\cong N_{S/X} \wedge N_{S/X}$$

and the Serre duality pairing gives
a non-degenerate symmetric bilinear pairing

\begin{equation*}\label{eqn:SD_S}
\mathsf{SD}_S : H^1(S,N_{S/X}) \cong H^1(S,N_{S/X})^\vee.
\end{equation*}

The space $H^1(S,N_{S/X})$ maps to the obstruction space of $I_{S/X}$. From the short exact sequence

\begin{equation}\label{idealses}
0\to I_{S/X}\to \O_X\to \O_S\to 0\,,
\end{equation}

we get an exact triangle

\[R\Hom_X(I_{S/X},\O_S)\to R\Hom_X(I_{S/X},I_{S/X})[1]\to R\Hom_X(I_{S/X},\O_X)[1]\,.\]

By taking cones of maps from $R\Gamma(X,\O_X)[1]$ to the second and the third factor, we get an exact triangle

\begin{equation}\label{eqn:4.6.1}
R\Hom_X(I_{S/X},\O_S)\to R\Hom_X(I_{S/X},I_{S/X})_0[1]\to R\Hom_X(\O_S,\O_X)[2]\,.
\end{equation}

Consider the map

\begin{equation}\label{eqn:4.6.2}
\theta_S: H^1(S,N_{S/X})\to\Ext^1_X(I_{S/X},\O_S)\to \Ext^2_X(I_{S/X},I_{S/X})_0\,,
\end{equation}

where the first map is defined by adjunction.

We give local descriptions of the obstruction map (<ref>) and the semi-regularity map (<ref>) for local complete intersection surfaces.
The map defined by

\begin{equation*}\label{eqn:res}
\sfob_{S/X} : H^1(X,T_X)\to H^1(S,T_X|_S)\to H^1(S,N_{S/X})
\end{equation*}

is the obstruction map for deforming $S\subset X$ along a deformation of $X$ <cit.>. Let $d_S: \O_S\to I_{S/X}[1]$ be the map induced by (<ref>). Let $\alpha:\Ext^1_X(I_{S/X},\O_S)\to H^3(X,\Omega_X^1)$ be the map defined by the trace of

\[I_{S/X}\to \O_S[1] \xrightarrow{\At(\O_S)} \O_S\otimes \Omega_X^1[2] \xrightarrow{d_S\otimes \id} I_{S/X}\otimes \Omega_X^1[3]\,.\]

The local semi-regularity map is defined by

\begin{equation}\label{eqn:Lsr}
\sr_{S/X}: H^1(S,N_{S/X})\to \Ext_X^1(I_{S/X},\O_S)\xrightarrow{\alpha}H^3(X,\Omega_X^1).
\end{equation}

The main result of this subsection consists of the following compatibilities.

Let $i : S\hookrightarrow X$ be a local complete intersection surface inside a Calabi-Yau 4-fold $X$.

$(1)$ The map (<ref>) is an isomorphism between two vector spaces with non-degenerate symmetric bilinear forms

\[\theta_S : \left(H^1(S,N_{S/X}),\SD_S\right)  \xrightarrow{\cong} \left(\Ext_X^2(I_{S/X}, I_{S/X})_0,\sfY\right).\]

$(2)$ The following diagram commutes

\begin{equation*}
\xymatrix<EMAIL_ADDRESS>H^1(X,T_X)\ar[rr]^{\sfob_{S/X}}\ar[ddrr]_{\sfob} & & H^1(S,N_{S/X})\ar[rr]^{\sr_{S/X}}\ar[dd]^{\theta_S}_{\cong} \ar @{} [dl]^{(2')} \ar @{} [dr]_{(2'')}  & & H^3(X,\Omega_X^1).\\
& & \Ext^2_X(I_{S/X},I_{S/X})_0\ar[uurr]_{\sr} &&
\end{equation*}

To simplify the notation, denote $I:=I_{S/X}$. We first prove that the map $\theta_S$ is an isomorphism. The compatibility of the two bilinear forms will be proved at the end. The exact triangle (<ref>) gives a long exact sequence

\begin{align}
\begin{split} \label{eqn:les1}
0 &\to \underbrace{\Ext^2_X(\O_S,\O_X)}_{\cong H^0(S,K_S)} \xrightarrow{\textup{(i)}} \Ext^1_X(I,\O_S) \xrightarrow{\textup{(ii)}} \Ext^2_X(I,I)_0 \\
&\to \underbrace{\Ext^3_X(\O_S,\O_X)}_{\cong H^1(S,K_S)} \xrightarrow{\textup{(iii)}} \Ext^2_X(I,\O_S) \xrightarrow{\textup{(iv)}} \Ext^3_X(I,I)_0 \\
&\to \Ext^4_X(\O_S,\O_X)\xrightarrow{\textup{(v)}} \Ext^3_X(I,\O_S)\to 0
\end{split}
\end{align}

since $\Hom_X(I,\O_S)\to \Ext^1_X(I,I)_0$ is an isomorphism (Theorem <ref>).
The map (v) is Serre dual to
\[\Ext^1_X(\O_S,I)\xrightarrow{\textup{(v')}} \Hom_X(\O_X,\O_S).\]
Applying $\ext\udot_X(\O_S,-)$ to (<ref>), we have

\[\hom_X(\O_S,I)=0, \quad \ext^1_X(\O_S,I)\cong \hom_X(\O_S,\O_S)\]

since $\hom_X(\O_S,\O_X)=\ext^1_X(\O_S,\O_X)=0$. Therefore
(v') can be identified with the map induced by the isomorphism $\hom_X(\O_S,\O_S)\cong \hom_X(\O_X,\O_S)$ and (iv) is surjective.

Consider the local-to-global spectral sequence

\[H^p(X,\ext^q_X(I,\O_S)) \Rightarrow \Ext^{p+q}_X(I,\O_S).\]

Since $S$ is lci, there are isomorphisms

\ext^q_X(I,\O_S) \cong \ext^{q+1}_X(\O_S,\O_S) \cong \bigwedge^{q+1} N_{S/X}, \quad \forall q\geq 0

by <cit.>.
Since $\ext^q_X(I,\O_S)=0$, for all $q\geq 2$, the local-to-global spectral sequence collapses to
the long exact sequence

\begin{align}
\begin{split}  \label{eqn:les2}
0 &\to H^1(S,N_{S/X}) \xrightarrow{} \Ext^1_X(I,\O_S) \xrightarrow{(a)} \underbrace{H^0(S,N_{S/X} \wedge N_{S/X})}_{H^0(S,K_S)} \\
& \to H^2(S,N_{S/X}) \xrightarrow{} \Ext^2_X(I,\O_S) \xrightarrow{(b)} \underbrace{H^1(S,N_{S/X} \wedge N_{S/X})}_{H^1(S,K_S)} \to 0.
\end{split}
\end{align}

Combined with (<ref>), we obtain morphisms

\begin{align*}
&H^0(S,K_S) \xrightarrow{\textup{(i)}} \Ext^1_X(I,\O_S) \xrightarrow{(a)} H^0(S,K_S), \\
&H^1(S,K_S) \xrightarrow{\textup{(iii)}} \Ext^2_X(I,\O_S) \xrightarrow{(b)} H^1(S,K_S).
\end{align*}

We show that the composition is an isomorphism. Since $\O_S$ is Cohen-Macaulay, we have $\ext^q_X(\O_S,\O_X)=0$, for $q=3,4$ (Lemma <ref>). Therefore we have $H^p(X,\ext^2_X(\O_S,\O_X))\cong \Ext^{p+2}_X(\O_S,\O_X)$ for all $p$. By functoriality of the local-to-global spectral sequence, the map $(a)\circ (i)$ is induced by

\[\xymatrix{
\Ext_X^2(\O_S,\O_X)\ar[r]^{\textup{(i)}} & \Ext^1_X(I,\O_S) \ar[d]^{(a)}\\
H^0(X,\ext^2_X(\O_S,\O_X))\ar[u]_{\cong}\ar[r]^{(\star)} & H^0(X,\ext^2_X(\O_S,\O_S))

where the map $(\star)$ is induced by applying $\ext\udot_X(\O_S,-)$ to (<ref>). By the fundamental local isomorphism, $(\star)$ is induced by

\[\ext_X^2(\O_S,\O_X)\cong K_S\otimes i^*\O_X\cong \ext^2_X(\O_S,\O_S)\,.\]

Hence the composition is an isomorphism. Similar arguments show that the second composition is also an isomorphism. Consequently, (<ref>) and (<ref>) split into two short exact sequences and hence the composition

\[
\begin{tikzcd}
\theta_S: H^1(S,N_{S/X})\ar[r,hook] & \Ext^1_X(I,\O_S)\ar[r,twoheadrightarrow, "\textup{(ii)}"] &\Ext^2_X(I,I)_0
\end{tikzcd}
\]

is an isomorphism.

The commutativity $(2'')$ follows from the compatibility of $\At(I)$ and $\At(\O_S)$ along $d_S$. To prove the commutativity $(2')$, we first show that the following diagram commutes

\begin{equation}\label{eqn:Os}
\begin{tikzcd}
& \Ext^2_X(\O_S,\O_S) \\
H^1(X,T_X) \ar[r,"\ob_{S/X}"]\ar[ur,"\sfob(\O_S)"] & H^1(S,N_{S/X}). \ar[u,"\theta_S'"]
\end{tikzcd}
\end{equation}

Here the map $\theta_S'$ is obtained similarly to (<ref>). Consider the composition

\[\theta_S'' : H^1(S, N_{S/X})\xrightarrow{\cong} \Ext^1_S(I/I^2,\O_S) \to \Ext^1_X(i_*I/I^2,i_*\O_S)\to \Ext^2_X(\O_S,\O_S)\,,\]

where the second map is the pushforward and the third map is induced by the exact sequence

\begin{equation}\label{eqn:I2}
0\to I/I^2\to \O_X/I^2\to \O_S\to 0\,.
\end{equation}

The map $\theta_S'$ can be identified with $\theta''_S$ by comparing (<ref>) and (<ref>).
Therefore the commutativity of (<ref>) follows from the commutative diagram

\[
\begin{tikzcd}[column sep=large]
\O_S \ar[r,"e_S"] \ar[d,equal] & I/I^2[1]\ar[d,"\delta"]\\
\O_S \ar[r,"\At(\O_S)"] & \O_S\otimes\Omega^1_X[1]\,,
\end{tikzcd}
\]

where $e_S$ is induced from (<ref>) and $\delta$ is defined by the conormal sequence. By the naturality of Atiyah classes, the following diagram commutes

\[
\begin{tikzcd}[column sep=large]
H^1(X,T_X)\ar[r,"\sfob"] \ar[d,"\sfob(\O_S)"] & \Ext^2_X(I,I)_0\ar[d,"d_S"]\\
\Ext^2_X(\O_S,\O_S)\ar[r,"d_S"] & \Ext^3_X(\O_S,I)\,.
\end{tikzcd}
\]

The right vertical map is injective because it is dual to (ii). Therefore if suffices to check $(2')$ after post-composing with $d_S$. Since (<ref>) commutes, this follows from  the following diagram

\begin{equation*}\label{eqn:Os2}
\begin{tikzcd}[column sep=large]
H^1(S,N_{S/X})\ar[r,"\theta_S"]\ar[d,"\theta_S'"] & \Ext^2_X(I,I)_0\ar[d,"d_S"]\\
\Ext^2_X(\O_S,\O_S) \ar[r,"d_S"] & \Ext^3_X(\O_S,I).
\end{tikzcd}
\end{equation*}

Finally we prove that the map $\theta_S$ preserves pairings. We first show that $\theta_S'$ preserves pairings. Let $i^!$ be the right adjoint of $i_*$. Then $\theta_S'$ decomposes as

\begin{align*}
\Ext^1_S(I/I^2,\O_S)\to \Ext^1_S(I/I^2,i^!i_*\O_S)\xrightarrow{\cong} \Ext^1_X(i_*I/I^2,i_*\O_S)\xrightarrow{e_S} \Ext^2_X(i_*\O_S,i_*\O_S)
\end{align*}

where the first map is the adjoint, the second map is Grothendieck duality, and the third map is induced by (<ref>). By the functoriality of Serre duality, we are reduced to checking commutativity of the diagram

\[\xymatrix{
\Ext^1_S(I/I^2,i^!i_*\O_S)\ar[r]^\cong\ar[d]^{\SD_S} &\Ext^1_X(i_*I/I^2,i_*\O_S)\ar[d]^{\SD_X}\\
\Ext^3_S(Li^*i_*\O_S,I/I^2)^\vee &\Ext^3_X(i_*\O_S,i_*I/I^2)^\vee\ar[l]_\cong

where the bottom isomorphism is induced by the adjunction $Li^*\dashv i_*$.
Since $S$ is lci, we have $i^!=\SD_S\circ Li^*\circ \SD_X^{-1}$.  Therefore the above diagram commutes and $\theta_S'$ preserves pairings.
The pullbacks of quadratic forms on $\Ext^2_X(I,I)_0$ and $\Ext^2_X(\O_S,\O_S)$ to $\Ext^1_X(I,\O_S)$ coincide because $\tr(d_S\circ u \circ d_S \circ u) = \tr(u\circ d_S\circ u \circ d_S)$ for $u\in \Ext^1_X(I,\O_S)$. Since $\theta_S,\theta_S'$ both factor through $\Ext^1_X(I,\O_S)$, the compatibility of quadratic forms under pullback along $\theta_S$ follows from compatibility under pullback along $\theta_S'$.

The map (<ref>) coincides with Bloch's semi-regularity map <cit.>. Furthermore, we have a map

\sr' = \tr(\At(\O_S) \circ -) : \Ext_X^2(\O_S,\O_S) \to H^3(X,\Omega_X^1).

By Proposition <ref>$(2'')$,
compatibility of Atiyah classes, and cyclicity of trace, the following diagram commutes

\[\begin{tikzcd}
\Ext^2_X(\O_S,\O_S)\ar[dr,"\sr'"] &\\
H^1(S,N_{S/X}) \ar[u,"\theta_S'"]\ar[r,"\sr_{S/X}"] & H^3(X,\Omega_X^1).
\end{tikzcd}\]

The following simple observation is useful for computing the reduced virtual dimension.

Let $J$ be a complex invertible symmetric $m \times m$ matrix. In general, a complex $m \times n$ matrix $A$ does not satisfy $\rk(A^TJA)=\rk(A)$. This equality holds if and only if $J$ is non-degenerate on $\im(A)$.

We now compute the reduced virtual dimension when $v=\ch(\O_S)$ for some lci surfaces.

Let $i : S\hookrightarrow X$ be a local complete intersection surface inside a Calabi-Yau 4-fold $X$. If $v=\ch(\O_S)$ then

\[\mathrm{rvd} = \frac{1}{2}\chi(N_{S/X}) + \frac{1}{2} \mathrm{rk}(\sfob_{S/X}^\vee \circ \SD_S \circ \sfob_{S/X}).\]

In particular when $\sfob_{S/X}$ is surjective, i.e. $S$ is semi-regular, we have

\mathrm{rvd} = h^0(S,N_{S/X}).

By the Hirzebruch-Riemann-Roch theorem we have

\chi(N_{S/X}) = \int_S \ch(N_{S/X}) \, \td(S) = 2 \chi(\O_S) -  \int_S c_2(N_{S/X}) = 2 \chi(\O_S) - [S]^2,

where we used $c_1(N_{S/X}) = c_1(\bigwedge^2 N_{S/X}) = c_1(K_S)$ and the self-intersection formula $i^* i_* [S] = c_2(N_{S/X})$. Thus the formula for the reduced virtual dimension follows from Proposition <ref>. In the semi-regular case, we have $\mathrm{rk}(\sfob_{S/X}^\vee \circ \SD_S \circ \sfob_{S/X}) = \mathrm{rk}(\sfob_{S/X}) = h^1(N_{S/X})$ (Remark <ref>). The result follows from the fact that $h^0(N_{S/X}) = h^2(N_{S/X})$ (see also Theorem <ref>).

Complete intersection Calabi-Yau 4-folds
The following result is inspired by Steenbrink [145].

Let $X\subset \PP^N$ be a complete intersection Calabi-Yau 4-fold defined by a regular section of $E_1=\oplus_{i=1}^{N-4} \O_{\PP^N}(e_i)$, $e_i\geq 2$. Suppose $S\subset X$ is a complete intersection surface of $\PP^N$ defined by a regular section of $E_2=\oplus_{j=1}^{N-2} \O_{\PP^N}(d_j)$, $d_j\geq 1$. Then the ideal sheaf $I_{S/X}$ is semi-regular.
Moreover if $v=\ch(\O_S)$, then

\[\rvd = \dim(\ker(H^0(E_2|_S)\to H^0(E_1|_S))\]

where the map is induced by the morphism $E_2|_S = N_{S/\PP^N} \to N_{X/\PP^N}|_S = E_1|_S$.

By the short exact sequence

\begin{equation} \label{ses:N}
0\to N_{S/X}\to N_{S/\PP^N}\to N_{X/\PP^N}|_S\to 0
\end{equation}

and Proposition  <ref>, it is enough to show that $\sfob_{S/X}$ is surjective.
We note that the following diagram commutes

\[\begin{tikzcd}
H^0(\PP^N,E_1)\ar[r]\ar[dr] &H^0(S,E_1|_S)\ar[r] &H^1(S,N_{S/X})\\
& H^0(X,E_1|_X)\ar[r]\ar[u] & H^1(X,T_X).\ar[u,"\sfob_{S/X}"']
\end{tikzcd}\]

Therefore it suffices to show that two top horizontal maps are surjective. Consider a Koszul resolution $\bigwedge^{\bullet+1}E_2^\vee\to I_{S/\PP^N}$ and the associated spectral sequence <cit.>

\[\Ext_{\PP^N}^p(E_1\otimes \bigwedge^{q+1}E_2^\vee,K_{\PP^N})\Rightarrow \Ext^{p+q}_{\PP^N}(E_1\otimes I_{S/\PP^N},K_{\PP^N})\,.\]

Since, on line bundles, $H^p(\PP^N,-)$ is nonzero only when $p=0$ or $N$, this spectral sequence degenerates and we have $0=\Ext^{N-1}_{\PP^N}(E_1\otimes I_{S/\PP^N},K_{\PP^N})\cong H^1(\PP^N,E_1\otimes I_{S/\PP^N})^\vee$. Therefore the first horizontal map is surjective. Similarly we have $H^2(\PP^N,E_2\otimes I_{S/\PP^N})= 0$.
Consequently $H^1(S,E_2|_S)=H^1(S,N_{S/\PP^N})=0$ and hence the second horizontal map is surjective.
Therefore $\sfob_{S/X} = (\sr_{S/X})^\vee$ is surjective and $I_{S/X}$ is semi-regular.

Corollary <ref> allows us to compute $\rvd$ and $\rho_\gamma$ for semi-regular cases.

Suppose $X:=X_{e_1, \ldots, e_{N-4}} \subset \PP^N$ is a complete intersection Calabi-Yau 4-fold.  The possible cases are $X_6$, $X_{2,5}$, $X_{3,4}$, $X_{2,2,4}$, $X_{2,3,3}$, $X_{2,2,2,3}$, $X_{2,2,2,2,2}$. Consider complete intersection surfaces $S \subset \PP^N$ of type $(d_1,\ldots, d_{N-2})$ such that $S \subset X$. By Corollary <ref> the ideal sheaf $I_{S/X}$ is semi-regular.

* Suppose for all $i$ we have

\begin{equation} \label{ineq:rigid}
- d_i + \sum_{j=1}^{N-2} d_j < N+1.
\end{equation}

Then we claim $S \subset X$ is rigid, i.e. $h^0(N_{S/X})=0$, so in particular $\rvd = 0$. This can be seen by showing that $H^0(S,N_{S/X})^\vee \cong H^2(S,N_{S/X}) = 0$ as follows. Using (<ref>) it suffices to show that $H^1(S,E_1|_S) = H^2(S,E_2|_S) = 0$. This follows by showing $H^2(\PP^N,E_1 \otimes I_{S/X}) = H^3(\PP^N,E_2 \otimes I_{S/X}) = 0$ by a Koszul calculation as in the proof of Corollary <ref>.
E.g. for $N=5$ all solutions to (<ref>) are (up to permutations)

\[(1,1,1), (1,1,2), (1,1,3), (1,2,2); (1,2,3), (2,2,2), (1,1,4); (2,2,3).\]

In cases 1–4, $S$ is del Pezzo. In cases 5–7, $S$ is K3. In case 8, $S$ is general type. Using the formula $\rvd = \chi(\O_S) - \tfrac{1}{2} \gamma^2 + \tfrac{1}{2} \rho_\gamma$, and determining $\chi(\O_S)$, $\gamma^2$ in terms of $d_1,d_2,d_3$, this produces the following values for $\rho_\gamma$ in the above cases

\[19, 32, 37, 54; 62, 92, 32; 106.\]

* Suppose $X=X_6$ is defined by a homogeneous polynomial $f \in R:=\C[x_0,...,x_5]$ of degree 6 and $S \subset X$ is defined by homogeneous polynomials $(s_1,s_2,s_3)$ of degrees $(d_1,d_2,d_3)$, then $f = s_1t_1+s_2t_2+s_3t_3$ for some $t_1,t_2,t_3$.
Using the Koszul resolution of $I_{S/\PP^5}$, as in proof of Corollary <ref>, it is easy to see that $H^1(\PP^5,I_{S/\PP^5}(n)) = 0$ for all $n$. If the ideal $(s_1,s_2,s_3) \subset R$ is saturated then $H^0(S,N_{S/X})$ is the kernel of the following map

\begin{align*}
H^0(E_2|_S) \cong \bigoplus_{i=1}^{3} \Big(R / (s_1,s_2,s_3) \Big)_{(d_i)} &\to H^0(E_1|_S) \cong \Big(R / (s_1,s_2,s_3) \Big)_{(6)} \\
(u_1,u_2,u_3) &\mapsto u_1t_1+u_2t_2+u_3t_3
\end{align*}

where $(-)_{(n)}$ denotes the degree $n$ part.
This can be implemented in Maccaulay2. E.g. for the Fermat sextic and certain $S$ of degrees $(1,3,3), (2,3,3),(3,3,3)$, we obtain $\rvd = h^0(N_{S/X}) = 1,1,3$ respectively. Using the formula $\rvd = \chi(\O_S) - \tfrac{1}{2} \gamma^2 + \tfrac{1}{2} \rho_\gamma$, we obtain that $\rho_\gamma$ is $71,122,141$ respectively.

The value of $\rho_\gamma$ can also be computed by Griffiths' residue calculus [64]. In the cases of the sextic 4-fold listed above, our values for $\rho_\gamma$ reproduce <cit.>.
Corollary <ref> gives an algebraic method for determining $\rho_\gamma$.

Holomorphic symplectic 4-folds When a Calabi-Yau 4-fold $X$ has a non-degenerate holomorphic 2-form, the rank $\rho_\gamma$ of $\sfB_\gamma$ is easy to determine.

The following computation is inspired by Voisin [159].

Suppose $X$ has a non-degenerate holomorphic 2-form $\sigma\in H^0(X,\Omega_X^2)$. Let $i:S\hookrightarrow X$ be a (possibly disconnected) smooth lagrangian surface, i.e., $i^*\sigma=0$. If $v=\ch(\O_S)$ then

\[\rvd = h^{1,0}(S) - \frac{1}{2} \dim \coker(i^*)\]

where $i^*: H^1(X,\Omega_X^1)\to H^1(S,\Omega_S^1)$.

We prove the case when $S$ is connected. The disconnected case then follows easily.
Since $S$ is a lagrangian, we have an isomorphism

\[\xymatrix{
0\ar[r] & N_{S/X}^*\ar[r]\ar[d]_\cong &\Omega^1_X|_S \ar[r]\ar[d]^\sigma_\cong & \Omega_S^1 \ar[r]\ar[d]_\cong & 0\\
0 \ar[r] &T_S \ar[r] &T_X|_S \ar[r] &N_{S/X} \ar[r] & 0.

Therefore $\sfob_{S/X}$ can be identified with $i^*$.
Under this identification, $\mathsf{SD}_S$ corresponds to the cup product. By the Hodge index theorem, the cup product is non-degenerate on the image of $i^*$. Therefore Remark <ref> and Corollary <ref> imply that the reduced virtual dimension equals

\begin{equation*}
\rvd =\frac{1}{2}\chi(\Omega^1_S) + \frac{1}{2} \mathrm{rk}(i^*). \qedhere
\end{equation*}

Suppose $X$ has a non-degenerate holomorphic 2-form. Consider a lagrangian plane $\PP^2 \cong S \subset X$ and let $v = \ch(\O_S)$. Since $i^*$ is non-trivial and $h^{1,1}(S) = 1$, $S$ is semi-regular. Moreover, $N_{S/X} \cong \Omega_{S}^1$ implies that $S$ is rigid and $\mathrm{rvd} = 0$. When $\curP_v^{(q)}(X)$ only contains lagrangian planes, $\deg ([\curP_v^{(q)}(X)]^{\red})$ is a (signed) count of lagrangian planes in $X$ in class $v$.

In [140] Schoen constructed minimal surfaces $S$ of general type related to the Hodge conjecture for abelian 4-folds. These surfaces satisfy $h^{1,0}(S)=4$, $h^{2,0}(S) = 5$, and $h^{1,1}(S) = 12$.
Let $S$ be a Schoen surface, then its Albanese variety $X=\mathrm{Alb}(S)$ is an abelian 4-fold. The Albanese map $i:S\to X$ is an embedding of $S$ as a lagrangian surface (for some non-degenerate $\sigma \in H^0(X,\Omega_X^2)$) [47], and the cohomology class $[S] \in H^{2,2}(X) \cap H^4(X,\Q)$ is not the product of divisor classes on $X$ [140]. Let $v=\ch(\O_S)$. From the constructions in [140], one can see that there exist semi-regular Schoen surfaces $S \subset X$. Then $i^*$ is surjective.
Therefore $\rvd=4$ and $\rho_{[S]}=12$.
We revisit this example in future work.

Combining Theorem <ref> and Corollary <ref>, we obtain a numerical criterion for a smooth lagrangian surface $i: S \hookrightarrow X$ to be non-semi-regular. Consider $i^*: H^{1,1}(X)\to H^{1,1}(S)$. Indeed if $\rk(i^*)$ is odd or $b_1(S) < \dim \coker(i^*)$, then $S$ is not semi-regular.

For example, let $\pi : X \to B$ be a hyperkähler 4-fold with lagrangian fibration over a smooth base.
The general fibre $S = F$ is a lagrangian abelian surface and the base $B$ is isomorphic to $\PP^2$ ([83, 82]). For $v=\ch(\O_F)$ and any $q\in\{-1,0,1\}$, we have a morphism

B \to \PTqvX, \quad P \mapsto \pi^* I_{P/B}.

This is a bijection on $\C$-points and using the fact that $R \pi_* \O_X \cong \O_B \oplus \Omega_B^1[-1] \oplus \Omega_B^2[-2]$ [115], one can also show that it is an isomorphism on tangent spaces at $\C$-points. Thus, since $B$ is smooth, the map is an isomorphism.
Let $\Delta \subset B \times B$ denote the diagonal and $\pi_B : X \times B \to B$ projection.
Using again $R \pi_* \O_X \cong \O_B \oplus \Omega_B^1[-1] \oplus \Omega_B^2[-2]$, we obtain the following obstruction bundle

\ext^2_{\pi_B}(\pi^* I_\Delta, \pi^* I_\Delta)_0 \cong T_B \otimes \Omega_B^1 \cong \mathcal{E}{\it{nd}}(T_B).

The natural pairing $T_B \otimes \Omega_B^1\to \O_B$ is the unique cosection (up to scaling). Since $i^*$ is non-zero, we deduce $\rk i^* = 1$. A direct computation of $\rk i^* = 1$ can be found in [142, 116]. We deduce $\rvd = \tfrac{1}{2}$ so $S$ is not semi-regular.

Let $C \subset \mathrm{K3}$ be a smooth curve of genus $g$ on a K3 surface. Then the Hilbert square $X = \mathrm{K3}^{[2]}$ is a hyperkähler 4-fold and the symmetric product $S = C^{[2]}$ is a smooth lagrangian surface. Since $S$ is cut out transversally by a tautological section of the vector bundle $\O(C)^{[2]}$, we have

\chi(\Omega^1_S) = \int_{S} \ch(\Omega^1_S) \cdot \td(S) = \int_X c_2(\O(C)^{[2]}) \ch(\Omega^1_X - \O(C)^{[2]\vee}) \, \frac{\td(X)}{\td(\O(C)^{[2]})}.

This tautological integral can be easily determined e.g. using [54]. The result is $-(C^2)^2/4 = -(g-1)^2$. Moreover, $\rk i^* = 1$ when $g=0$ and $\rk i^* = 2$ otherwise (<cit.>).
By Corollary <ref> we find

\mathrm{rvd} = -\frac{1}{2}(g-1)^2 + \left\{ \begin{array}{cc} \frac{1}{2} & \textrm{if} \ g=0  \\ 1 & \textrm{otherwise.} \end{array} \right.

This number is only non-zero for $g=0,1,2$, then $\mathrm{rvd} = 0,1,\tfrac{1}{2}$ respectively. In particular, for $g  \geq 2$ we deduce that $S$ is not semi-regular (Remark <ref>). For $g=0$, $S \cong \PP^2$ is a lagrangian plane.

When $X$ is a product of two $K3$ surfaces, we determine $\rho_\gamma$ for diagonal classes, see also Example <ref>.

Let $X$ be a product of two K3 surfaces $S_1$ and $S_2$. If $\gamma =\eta_1\cup\eta_2$ for some non-zero $\eta_1\in H^{1,1}(S_1)$ and $\eta_2\in H^{1,1}(S_2)$, then we have $\rho_\gamma=2$.

Let $\sigma_1\in H^{2,0}(S_1)$ and $\sigma_2\in H^{2,0}(S_2)$ be two nowhere vanishing holomorphic 2-forms. Take $\omega=\sigma_1\cup \sigma_2 \in H^0(X,\Omega_X^4)$. Consider the isomorphism
\[H^1(X,T_X) \cong H^1(S_1, T_{S_1}) \oplus H^1(S_2, T_{S_2}).\]

The symmetric bilinear form $\sfB_\gamma$ on $H^1(X,T_X)$ can be related to the two rank one maps

\[
\mathsf{A_\ell} : H^{1}(S_\ell,T_{S_\ell})\to\C,\, \quad \xi \mapsto \int_{S_\ell}  \eta_\ell \cup \iota_\xi(\sigma_\ell) = - \int_{S_\ell}  \iota_\xi(\eta_\ell) \cup  \sigma_\ell\,, \quad \ell=0,1\,.
\]

Namely, if $\xi_1 \in H^{1}(S_1,T_{S_1})$ and $\xi_2  \in H^{1}(S_2,T_{S_2})$, then

\begin{align*}
\sfB_\gamma(\xi_1,\xi_2) &= \int_X \iota_{\xi_1}\iota_{\xi_2} (\eta_1\cup\eta_2) \cup \sigma_1 \cup \sigma_2\\
&=\int_{S_1}\eta_1\cup\iota_{\xi_1}(\sigma_1)\cdot\int_{S_2}\eta_2\cup\iota_{\xi_2}(\sigma_2) \\
&= \mathsf{A_1}(\xi_1) \cdot \mathsf{A_2}(\xi_2)
\end{align*}

and for $\xi_1,\xi_2\in H^{1}(S_1,T_{S_1})$ or $\xi_1,\xi_2\in H^{1}(S_2,T_{S_2})$, we have $\sfB_\gamma(\xi_1,\xi_2) = 0$. Therefore the rank of $\sfB_\gamma$ is two.

Vanishing of $\rho_\gamma$.
Let $X$ be an arbitrary Calabi-Yau 4-fold and $\gamma \in H^{2,2}(X)$.
There are interesting cases for which $\rho_\gamma = 0$ and hence the non-reduced virtual cycle equals the reduced virtual cycle.

Assume that $H^2(X,\O_X)=0$. If $\gamma = \eta_1\cup\eta_2$ for some $(1,1)$-classes $\eta_1$ and $\eta_2$ on $X$, then we have $\rho_\gamma=0$.

For $\xi\in H^1(X,T_X)$, we have
$\iota_{\xi}(\eta_1\cup\eta_2) = \iota_{\xi}(\eta_1) \cup \eta_2 + \eta_1 \cup \iota_{\xi}(\eta_2) =0$
because $\iota_{\xi}(\eta_1), \iota_{\xi}(\eta_2) \in H^2(X,\O_X)$. Hence $\rho_\gamma=0$ by definition.

Let $Y\subset X$ be a smooth divisor with $H^2(Y,\O_Y)=0$. If $\gamma=[S]$ for some effective divisor $S\subset Y$ with $H^1(Y,\O_Y(S))=0$, then $\rho_\gamma=0$.

By Proposition <ref> it is enough to show that $\ob_{S/X}$ is zero. Consider the commutative diagram

\[\begin{tikzcd}
& H^1(T_Y) \ar[r,"\sfob_{S/Y}"]\ar[d,twoheadrightarrow] & H^1(N_{S/Y})\ar[d]\\
\sfob_{S/X}:H^1(T_X)\ar[r] & H^1(T_X|_Y) \ar[r] & H^1(N_{S/X})
\end{tikzcd}\]

where the left vertical map is surjective by the vanishing of $H^1(N_{Y/X}) \cong H^1(\O_Y(Y)) \cong H^1(K_Y)\cong H^2(\O_Y)^\vee$. By the vanishing of $H^1(Y,\O_Y(S))$, we have $H^1(N_{S/Y}) = 0$, therefore $\ob_{S/X}=0$.

For example, the hypotheses of the previous proposition are satisfied for $\PP^3 \cong Y \subset X$ and any effective divisor $S \subset Y$.

§ DEFORMATION INVARIANCE

In this section, we prove the deformation invariance of reduced virtual cycles.
As a corollary, we prove the variational Hodge conjecture for surface classes that carry non-zero reduced virtual cycles.

§.§ Deformation invariance

In this subsection, we prove that the reduced virtual cycles on the moduli spaces of $\PT_q$ pairs are deformation invariant along the Hodge loci.

We first fix some notation.
be a morphism of schemes satisfying the following conditions:

* $f:\cX\to \cB$ is a smooth projective morphism of relative dimension $4$ with connected fibres;

* $\cB$ is a smooth connected affine scheme;

* $\omega_{\cX/\cB}$ is trivial, i.e., there exists an isomorphism $w: \O_{\cX}\cong \omega_{\cX/\cB}$.

We denote by $\cX_b:=\cX\times_\cB \{b\}$ the fibre of $f:\cX\to\cB$ over a point $b \in \cB$.

Choose a horizontal section

\[\tv = (\tv_p)_{p\geq0} \in \bigoplus_{p \geq 0} F^pH^{2p}_{DR}(\cX/\cB) \]

in the sense Definition <ref>.
We may regard $\tv$ as a locally constant family of cohomology classes
$\tv_b \in H^*(\cX_b,\C)$ by Remark <ref>.

\[\tgamma \in \Gamma(\cB, R^2f_*\Omega^2_{\cX/\cB})\]

be the family of $(2,2)$-classes induced by $\tv_2 \in F^2H^4_{DR}(\cX/\cB)$, see (<ref>).

Consider a vector bundle

\[\cT:=R^1f_*(T_{\cX/\cB})\]

on $\cB$ with a canonical symmetric bilinear form

\[\sfB_{\tgamma} : \cT \otimes \cT \xrightarrow{\id\otimes\tgamma} \cT \otimes \cT \otimes R^2f_*(\Omega^2_{\cX/\cB}) \xrightarrow{} R^4f_*(\O_{\cX}) \xrightarrow{w} R^4f_*\Omega^4_{\cX/\cB} \cong \O_{\cB}.\]

If the function
$b\in \cB \mapsto \rho_{\tgamma_b} \in \Z$
is constant, then we can form an induced orthogonal bundle of rank $\rho:=\rho_{\tgamma_b}$ as

\[\cT_{\tgamma}:={\cT}/{\ker(\sfB_{\tgamma})}.\]

Let $\curP:=\PTqvXB$ be the moduli space of $\PT_q$ pairs on the fibres of $f:\cX \to\cB$, defined in Theorem <ref>. We can form a fibre diagram

\begin{equation}\label{Eq:62}
\xymatrix{
\curP_b \ar@{^{(}->}[r]^{j_b} \ar[d] & \curP \ar[d]^{p} \\
\{b\} \ar@{^{(}->}[r]^{i_b} & \cB
\end{equation}

where $\curP_b:=\PTqvXb$ is the moduli space of $\PT_q$ pairs on the fibre $\cX_b$.
By Theorem <ref>(2) and [81], we have a relative symmetric obstruction theory

\begin{equation}\label{Eq:RelSOT}
\phi : \EE \to \trunc\LL_{\curP/\cB}
\end{equation}

for $p:\curP \to \cB$. Moreover, the induced map

\[\phi_b : \EE_b:=L j_b^*\EE \xrightarrow{Lj_b^*\phi}  L j_b^*(\trunc \LL_{\curP/\cB}) \to \trunc \LL_{\curP_b}\]

is the standard symmetric obstruction theory for the fibre $\cX_b$ in (<ref>).

Now we can state our main theorem in this section.

Let $f:\cX\to\cB$ be a smooth projective morphism of relative dimension $4$ with connected fibres to a smooth connected affine scheme $\cB$ such that $\omega_{\cX/\cB} \cong \O_{\cX}$. Let $\tv\in \bigoplus_{p}F^p H^{2p}_{DR}(\cX/\cB)$ be a horizontal section and let $\tgamma \in \Gamma(\cB,R^2f_*\Omega^2_{\cX/\cB})$ be the section induced by $\tv_2$.
Assume that the function $b\in \cB \mapsto \rho_{\tgamma_b}\in \Z$ is constant.
For every orientation

\[o_{1}:\O_{\PTqvXB} \cong \det(\EE),\qquad o_{2}:\O_{\cB} \cong \det(\cT_{\tgamma}) \]

of the symmetric complex $\EE$ on $\PTqvXB$ and the orthogonal bundle $\cT_{\tgamma}$ on $\cB$, respectively, there exists a cycle class

\[\left[\PTqvXB\right]^\red \in A_{\rvd+\dim(\cB)}\left(\PTqvXB\right)\]

such that

\[\left[\PTqvXb\right]^\red = i_b^!\left[\PTqvXB\right]^\red \in A_{\rvd}\left(\PTqvXb\right)\]

for all $b \in \cB$. Here $i_b^!: A_*(\PTqvXB) \to A_*(\PTqvXb)$ denotes the refined Gysin pullback [57] with respect to the fibre diagram (<ref>) and $[\PTqvXb]^\red$ denotes the reduced virtual cycle in Theorem <ref> with respect to the orientations induced by $o_1$ and $o_2$.

We briefly explain how we prove Theorem <ref>.
We use the cosection localization technique of Kiem-Li [94] as in subsection <ref>.
Most of the arguments are just straightforward generalizations of the proof of Theorem <ref> to the relative setting.
However there is one key difference. Kiem-Li's cone reduction lemma (cf. Lemma <ref>) fails in the relative setting.
Thus as in [96], we need to modify the relative obstruction theory/cosection for $\curP \to \cB$ to an absolution obstruction theory/cosection for $\curP$. In general, we need an additional condition on the cosection to do this.
In our case, this additional condition can be deduced from the fact that the Hodge locus of $\tgamma \in H^4_{DR}(\cX/\cB)$ in $\cB$ is equal to $\cB$ itself.

Form a fibre diagram

\[\xymatrix{
\curP \times_{\cB} \cX \ar[r]^-{q} \ar[d]^-{\pi} & \cX \ar[d]^-{f} \\
\curP \ar[r]^-{p} & \cB

where $\pi$ and $q$ denote the projection maps. Let $\II\udot$ denote the universal complex on $\curP\times_B \cX$.

We have a relative version of the cosections in Proposition <ref>,

\[\SR : \EE\dual[1]=R\hom_\pi(\II\udot,\II\udot)_0[2] \longrightarrow \cT|\dual_{\curP}.\]

Indeed, consider the composition

\begin{equation}\label{Eq:63}
R\hom_\pi(\II\udot,\II\udot)_0[2] \xrightarrow{\At_{\curP\times_{\cB} \cX/\curP}(\II\udot)} R\hom_\pi(\II\udot,\II\udot\otimes \Omega^1_{\cX/\cB})[3]\xrightarrow{\tr^3}  (R^3f_* \Omega^1_{\cX/\cB})|_{\curP}
\end{equation}

where the third trace map is defined as

\[\tr^3 : R\hom_\pi(\II\udot,\II\udot\otimes \Omega^1_{\cX/\cB})[3] \stackrel{\tr}{\to} (Rf_*\Omega^1_{\cX/\cB}[3])|_{\curP} \to (R^3f_*\Omega^1_{\cX/\cB})|_{\curP}.\]

Here the last arrow uses Deligne's decomposition theorem <cit.>,

\[R f_* \Omega^i_{\cX/\cB} \cong \bigoplus_j R^jf_* \Omega^i_{\cX/\cB}[-j],\]

which replaces footnote <ref> in the relative setting.
The map $\SR$ is then defined by composing the above map (<ref>) with the Serre duality isomorphism $R^3f_*\Omega^1_{\cX/\cB} \cong (R^1f_*T_{\cX/\cB})\dual = \cT\dual$.

Note that we can form a relative version of the commutative triangle (<ref>) in Proposition <ref>, i.e., we have a commutative triangle

\begin{equation}\label{Eq13}
\xymatrix{
\cT|_{\curP} \ar[rr]^{\SR\dual} \ar[rd]_{\sfB_{\tgamma}|_{\curP}}&& \EE[-1] \ar[ld]^{\SR} \\
& \cT|_{\curP}\dual &
\end{equation}

where we identified $\EE[-1] \cong \EE\dual[1]$ via the symmetric form of $\EE$.
Here we used that

\[\ch_2(\II\udot) = p^*(\tgamma) \in \Gamma(\curP, R^2\pi_*(\Omega^2_{\curP\times_{\cB} \cX/\curP})) \cong \Gamma(\curP, p^* (R^2f_* (\Omega^2_{\cX/\cB}))) \]

since both sections extend to horizontal sections $\widetilde{\ch_2}(\II\udot)$ and $p^*(\tv_2)$ of the vector bundle $F^2\cH^4_{DR}(\curP\times_\cB \cX/\curP)$ by Lemma <ref> (see our convention (<ref>)). Then the commutativity of (<ref>) follows from <cit.> as in the proof of Proposition <ref>.

Since $\cB$ is affine, we can find a subbundle $\cV \subseteq \cT$ such that the composition

\begin{equation}\label{Eq17}
\xymatrix{
\cV \ar@{^{(}->}[r]<EMAIL_ADDRESS>& \cT \ar@{->>}[r]  & \cT_{\tgamma}}
\end{equation}

is an isomorphism. Then the restriction

\[\sfB_{\tgamma}|_{\cV} : \cV \otimes \cV \to \O_{\cB}\]

is non-degenerate. Thus we may regard $\cV$ as an orthogonal bundle over $\cB$. Moreover, the orientation of $\cV$ is determined by the orientation $o_2$ of $\cT_{\tgamma}$ via the isomorphism $\cV \cong \cT_{\tgamma}$ in (<ref>).
We may view $\cV \subseteq \cT$ as a family of maximal non-degenerate subspaces of $H^1(\cX_b,T_{\cX_b})$.

As in Definition <ref>, the composition $\SR_{\cV}:\EE\dual[1] \xrightarrow{\SR} \cT|_{\curP} \dual \to \cV|_{\curP} \dual$ induces a direct sum decomposition of symmetric complexes

\[ \EE = \EE^\red_{\cV} \oplus \cV|_{\curP}[1].\]

More precisely, we let $\EE^\red_{\cV} := \cone(\SR\dual_{\cV}[1])$ and consider the symmetric form induced by the symmetric form of $\EE$.

Note that the relative symmetric obstruction theory $\phi:\EE \to \trunc\LL_{\curP/\cB}$ in (<ref>) satisfies the isotropic condition. More precisely, we have

\[\fC_{\curP/\cB} \subseteq \fQ(\EE)\]

as substacks of $\fC(\EE)$.
Indeed, this follows from the relative version of the Darboux theorem [27, 24] for the relative $(-2)$-shifted symplectic form for $p:\curP \to \cB$ in [132] since $\tgamma \in F^2H_{DR}^4(\cX/\cB)$. See [134] and Remark <ref> below.

We claim that the relative cone reduction property holds for $p:\curP \to \cB$. More precisely, we claim that we can form a commutative diagram

\begin{equation}\label{Eq16}
\xymatrix@C+1pc{
& \fQ(\EE^\red_{\cV}) \ar@{^{(}->}[d] \ar@{^{(}->}[r] & \fC(\EE^\red_{\cV}) \ar[r] \ar@{^{(}->}[d] & \curP \ar@{^{(}->}[d]^0 \\
(\fC_{\curP/\cB})_\red \ar@{^{(}->}[r]<EMAIL_ADDRESS>\fQ(\EE) \ar@{^{(}->}[r] & \fC(\EE) \ar[r]^{\fC(\SR_{\cV}\dual[1])} & \cV|_{\curP}^\vee
\end{equation}

for some dotted arrow, where the embedding $(\fC_{\curP/\cB})_{\red} \hookrightarrow \fQ(\EE)$ is given by the obstruction theory $\phi$ as in the previous paragraph.

We first modify the relative obstruction theory $\phi:\EE \to \trunc \LL_{\curP/\cB}$ into an absolute one. Indeed, we can form a morphism

\begin{equation}\label{Eq:51}
\xymatrix@C+1pc{
\EE^\abs \ar[r]^m<EMAIL_ADDRESS>\EE \ar[r] \ar[d]^{\phi} & \Omega^1_{\cB}|_{\curP}[1] \ar@{=}[d] \\
\trunc \LL_{\curP} \ar[r] & \trunc  \LL_{\curP/\cB} \ar[r]^-{\KS_{\curP/\cB}} & \Omega^1_{\cB}|_{\curP}[1]
\end{equation}

of distinguished triangles on $\curP$, where the lower triangle is exact since $\cB$ is smooth.
The associated long exact sequence assures that $\phi^\abs :\EE^\abs \to \trunc\LL_\curP$ is an obstruction theory. Moreover, by considering the associated abelian cone stacks, we have a cartesian diagram

\begin{equation}\label{Eq14}
\xymatrix@C+2pc{
\fC_{\curP/\cB} \ar@{->>}[d] \ar@{^{(}->}[r]  & \fC(\EE) \ar@{->>}[d]^{\fC(m)} \\
\fC_{\curP} \ar@{^{(}->}[r]  & \fC(\EE^\abs)
\end{equation}

where the horizontal arrows are closed embeddings given by the obstruction theories $\phi$, $\phi^\abs$, and the vertical arrows are $T_{\cB}$-torsors.

We then modify the relative cosection $\SR : \EE\dual[1] \to \cT|_{\curP}\dual$ into an absolute one. We will find a map $\SR^\abs:(\EE^\abs)\dual[1] \to \cT|_{\curP}\dual$ that fits into the commutative diagram

\begin{equation}\label{Eq19}
\xymatrix{
\EE\dual[1]  \ar[r]^-{\SR} \ar[d]_{m\dual[1]} & \cT|_{\curP}\dual \\
(\EE^\abs)\dual[1]<EMAIL_ADDRESS>.&
\end{equation}

We need to show that the composition

\begin{equation}\label{Eq:50}
\cT|_{\curP} \xrightarrow{\SR\dual} \EE[-1]\xrightarrow{\phi[-1]} \trunc \LL_{\curP/\cB}[-1] \xrightarrow{\KS_{\curP/\cB}} \Omega^1_{\cB}|_{\curP}
\end{equation}

The vanishing of (<ref>) is the key part of the proof of Theorem <ref>.
By the commutative triangle (<ref>) and the compatibility result in Lemma <ref>, we have a commutative diagram

\[\xymatrix@C+1pc{
\cT|_{\curP} \ar[r]^{\SR\dual} \ar[rd]_{\sfB_{\tgamma}|_{\curP}}& \EE[-1] \ar[d]^{\SR} \ar[r]^-{\phi[-1]} &  \trunc\LL_{\curP/\cB}[-1] \ar[d]^{-\KS_{\curP/\cB}} \\
&  \cT|_{\curP}\dual \ar[r]^{\KS_{\cX/\cB}|_{\curP}} & \Omega^1_{\cB}|_{\curP}

where $\KS_{\cX/\cB}$ denotes the Kodaira-Spencer map. Thus it suffices to show that the composition

\[\cT \xrightarrow{\sfB_{\tgamma}} \cT\dual \xrightarrow{\KS_{\cX/\cB}} \Omega^1_{\cB}\]

vanishes. Since $\cB$ is smooth, it suffices to show that the composition

\begin{equation}\label{Eq18}
T_{\cB,b} \xrightarrow{\KS_{\cX/\cB,b}} H^1(\cX_b,T_{\cX_b}) \xrightarrow{\sfB_{\tgamma_b}} H^1(\cX_b,T_{\cX_b})\dual
\end{equation}

vanishes for all $b \in \cB$.
By <cit.> (see also Lemma <ref>(1)), the composition (<ref>) indeed vanishes since the horizontal section $\tv_2$ is contained in $F^2 H^4_{DR}(\cX/\cB)$.

Now we can apply Kiem-Li's cone reduction lemma [94] for the absolute versions of the obstruction theory $\phi^{\abs}$ in (<ref>) and cosection $\SR^{\abs}$ in (<ref>).
Indeed, by Lemma <ref>, we have a commutative diagram

\begin{equation}\label{Eq15}
\xymatrix{
& \fC((\EE^\abs)^\red_{\cV}) \ar@{^{(}->}[d] \ar[rr] && \curP \ar@{^{(}->}[d]^0\\
(\fC_{\curP})_\red \ar@{^{(}->}[r]<EMAIL_ADDRESS>& \fC(\EE^\abs) \ar[r]^-{\fl_{\SR^{\abs}}} &  \cT|_{\curP}\dual \ar@{->>}[r] & \cV|_{\curP}\dual
\end{equation}

for some dotted arrow, where $\fl_{\SR^\abs}:=\fC((\SR^\abs)\dual[1])$ and

\[(\EE^\abs)^\red_{\cV}:=\cone(\cV|_{\curP}[1] \to \cT|_{\curP}[1]
\xrightarrow{(\SR^\abs)\dual[1]} \EE^\abs).\]

The existence of the dotted arrow in (<ref>) tells us that the lower horizontal composition in (<ref>) is zero.
Since the diagrams (<ref>) and (<ref>) are commutative,
the lower horizontal composition in (<ref>) is also zero, which gives us the desired dotted arrow in (<ref>).

We define the relative reduced virtual cycle as

\[[\curP]^\red := \sqrt{0^!_{\fQ(\EE^\red_{\cV})}}[\fC_{\curP/\cB}] \in A_*(\curP),\]

where the square root Gysin pullback $\sqrt{0^!_{\fQ(\EE^\red_{\cV})}}$ is defined as in the proof of Theorem <ref>.
By Vistoli's rational equivalence <cit.>,[In [157], it is stated for unramified maps between DM stacks, but the result holds for arbitrary DM type morphism between Artin stacks. This can be deduced from the proof of <cit.> (cf. <cit.>).]
we have

\[i_b^![\fC_{\curP/\cB}] = [\fC_{\curP_b}] \in A_* (\fC_{\curP/\cB}|_{\curP_b})\]

where we denote $\curP_b :=\PTqvXb$.
Since Oh-Thomas's localized square root Euler classes [125] are bivariant classes by <cit.>, the square root Gysin pullback $\sqrt{0^!_{\fQ(\EE^\red_{\cV})}}$ commutes with the ordinary Gysin pullback $i^!_b$.
Therefore, we have

\[i_b^![\curP]^\red = [\curP_b]^\red,\]

which completes the proof.

The relative version of the Darboux theorem [27, 24] works only under an additional assumption.
If $\XX$ is a derived scheme over a scheme $\cB$ with a $(-2)$-shifted symplectic form $\theta \in \HN^{-4}(\XX/\cB)(2) \cong \cA^{2,\cl}(\XX/\cB;-2)$, we have a global Darboux chart only if $\theta$ maps to zero under the canonical map

\begin{equation}\label{Eq:HNtoHP}
\HN^{-4}(\XX/\cB)(2) \to \HochP^{-4}(\XX/\cB)(2)
\end{equation}

to the periodic cyclic homology.

There is a simple example where there is no Darboux chart for a $(-2)$-shifted symplectic derived scheme. Consider the origin in the affine plane

\[\XX:=\Spec(\C[t_1,t_2]/(t_1,t_2)) \subseteq \cB:=\Spec(\C[t_1,t_2]) \cong \bbA^2.\]

Using the quasi-free resolution $(\C[t_1,t_2][y_1,y_2], dy_i=t_i) \xrightarrow{qis} \C[t_1,t_2]/(t_1,t_2)$, we can find a $(-2)$-symplectic form

\[\theta:=d_{DR}y_1 \wedge d_{DR}y_2 \in \HN^{-4}(\XX/\cB)(2).\]

The isotropic condition fails in this case since $\fC_{\XX/\cB}=\fC(\LL_{\XX/\cB})=\bbA^2$ for the induced symmetric obstruction theory $\LL_{\XX/\cB}\xrightarrow{\id}\LL_{\XX/\cB}$.
This implies that there is no Darboux chart.
Moreover, we have $\theta \mapsto t_1t_2\neq0 \in \HochP^{-4}(\XX/\cB)(2) \cong \C[[t_1,t_2]]$ under the canonical map (<ref>).

However, we still have the desired isotropic condition in the situation of Theorem <ref>.
This will be shown in [134], and we briefly summarize the results here.
Let $f:\cX\to\cB$ be a smooth projective morphism of relative dimension $4$ with $\omega : \O_{\cX} \xrightarrow{\cong} \Omega^4_{\cX/\cB}$.
Let $\cM$ be any moduli space of perfect complexes on the fibres of $f: \cX\to\cB$.
The isotropic condition can be detected infinitesimally so we may assume that $\cB=\Spec(A)$ for a local Artinian $\C$-algebra $A$.
Let $\gamma=\ch_2(E) \in H^4(\cX_0,\C)$ for any $[E] \in \cM$ and let $\tgamma \in H^4_{DR}(\cX/\cB)$ be the horizontal lift.
Then the $(-2)$-symplectic form on the derived enhancement of $\cM$ [132, 151] maps to zero under the map (<ref>) if and only if

\begin{equation}\label{Eq:No(0,4)terms}
\tgamma \in F^1H^4_{DR}(\cX/\cB)=\HH^4(\cX,\Omega^{\geq1}_{\cX/\cB}) \subseteq H^4_{DR}(\cX/\cB)=\HH^4(\cX,\Omega^\bullet_{\cX/\cB}).
\end{equation}

In the situation of Theorem <ref>, the condition (<ref>) is satisfied since we already assumed $\tgamma \in F^2H^4_{DR}(\cX/\cB)$.

Heuristically, the result in [134] tells us that the relative isotropic condition is satisfied along the locus in the base where the deformations of $\ch_2(E)$ do not have a $(0,4)$-Hodge piece.
This condition is compatible with the gauge-theoretical point of view since the holomorphic bundles are the solutions of

\[\int_{\cX_0}\alpha(E)\cup \omega=0\]

where $\alpha(E)=2\ch_2(E)$, see <cit.>.
We thank Richard Thomas for the explanation of the gauge-theory perspective and the expectation that (<ref>) is the necessary additional condition to obtain the deformation invariance.

Consequently, we have the deformation invariance of numerical invariants.

In the situation of Theorem <ref>,
the function

\[b\in \cB \mapsto \int_{[\PTqvXb]^\red}{j_b^*(\star)} \in \Q\]

is constant for any insertion $\star \in A^{\rvd}(\curP^{(q)}_{\tv}(\cX/\cB))$.

There are two technical assumptions in Theorem <ref>:

A1) The function $b \in \cB \mapsto \rho_{\tgamma_b} \in \Z$ is constant.

A2) The symmetric complex $\EE$ on $\PTqvXB$ and the orthogonal bundle $\cT_{\tgamma}$ on $\cB$ are orientable.

We first discuss the assumption A1 on $\rho_{\tgamma_b}$.

The assumption A1 is generically satisfied.
Indeed, the function $b \in \cB \mapsto \rho_{\tgamma_b} \in \Z$ is a lower semi-continuous function.
Hence if we let $\rho_{\max}$ be the maximal value, then

\[\cB^{\circ} := \{b\in\cB :\rho_{\tgamma_b}=\rho_{\max}\} \]

is an open dense subscheme of $\cB$.
Consequently, we can form an orthogonal bundle of rank $\rho_{\max}$ on $\cB^\circ$ as

\[\cT_{\tgamma}:=(\cT|_{\cB^{\circ}})/\ker(\sfB_{\tgamma}).\]

On the other hand, for the special cases when assumption A1 is not satisfied,
we have a vanishing result by Proposition <ref> below.

Let $f:\cX\to\cB$ be a smooth projective morphism of relative dimension $4$ with connected fibres to a smooth connected affine scheme $\cB$ such that $\omega_{\cX/\cB} \cong \O_{\cX}$. Let $\tv\in \bigoplus_{p}F^p H^{2p}_{DR}(\cX/\cB)$ be a horizontal section and let $\tgamma \in \Gamma(\cB,R^2f_*\Omega^2_{\cX/\cB})$ be the section induced by $\tv_2$.
Let $\cB^{\circ} := \{b\in\cB :\rho_{\tgamma_b}=\rho_{\max}\}$ as in Remark <ref>.
If $b\in\cB$ is a point such that $b \not\in \cB^\circ$, then we have

\[\left[\PTqvXb\right]^\red = 0 \in A_*\left(\PTqvXb\right)\]

for any orientation.

Before we prove Proposition <ref>, we discuss the assumption A2 on orientations.
The following simple observation shows that the orientability of the orthogonal bundle $\cT_{\tgamma}$ is a minor issue.

There exists a canonical 2-fold étale cover $u:\widetilde{\cB} \to \cB^{\circ}$ such that $\cT_{\tgamma}|_{\widetilde{\cB}}$ is orientable.
Indeed, we can form a fibre diagram

\[\xymatrix{
\widetilde{\cB} \ar[r] \ar[d] & \Spec(\C) \ar[d] \\
\cB^{\circ} \ar[r]^{\det(\cT_{\tgamma})} & B\mu_2

where the horizontal map $\cB^{\circ} \to B\mu_2$ corresponds to the pair of the line bundle $\det(\cT_{\tgamma})$ and the isomorphism $\O_{\cB^{\circ}} \cong \det(\cT_{\tgamma})^{\otimes2}$ induced by $\sfB_{\tgamma}$.
Then we have a canonical bijection

\[\{\text{orientations of $\cT_{\tgamma}$}\} \cong \{\text{sections of $\widetilde{\cB} \to \cB^{\circ}$}\}.\]

Consequently, there exists a canonical orientation of the pullback $\cT_{\tgamma}|_{\widetilde{\cB}}$.

On the other hand, the orientability of the symmetric complex $\EE$ is more subtle.
The orientability result of Cao-Gross-Joyce [34] for the fibres does not imply the orientability for the relative case.
We suggest two strategies:

* Use the canonical orientation on the canonical 2-fold étale cover of the moduli space $\curP$ as in Remark <ref>.

* Find an orientation after a base change by a finite étale cover $\cB' \to \cB$.

Strategy a) is sufficient for applications to the variational Hodge conjecture in the next subsection.
However, if we want to obtain the deformation invariance of numerical invariants (Corollary <ref>),
strategy a) is not enough and we need strategy b). We expect that the following conjecture holds.

Let $f:\cX\to\cB$ be a smooth projective morphism with connected fibres of relative dimension $4$ to a smooth connected affine scheme $\cB$ such that $\omega_{\cX/\cB} \cong \O_{\cX}$. Let $\tv\in \bigoplus_{p}F^p H^{2p}_{DR}(\cX/\cB)$ be a horizontal section.

$(1)$ Then there exists a finite étale cover $u:\cB'  \to \cB$ such that $\EE|_{{\curly P}^{(q)}_{\tv'}(\cX'/\cB')}$ is orientable, where $\cX'=\cX\times_\cB \cB'$ and $\tv'=u^*(\tv)$.

$(2)$ Moreover, we can further assume that the degree of the étale cover $u:\cB'\to \cB$ in (1) divides

\[|K_{\top}^0(\cX_b^\an)_{\mathrm{tor}}|!\]

where $K_{\top}^0(\cX_b^\an)_{\mathrm{tor}} \subseteq K^0_{\mathrm{top}}(\cX_b^\an)$ is the torsion subgroup of the complex topological $K$-theory of $\cX_b^\an$, which is finite.

We will provide evidence for Conjecture <ref> in Appendix <ref>.
Indeed, we will prove that the topological analog of Conjecture <ref> is true (see Corollary <ref>).

Assuming Conjecture <ref>, $\EE$ is orientable in the following cases:

* $\cB^\an$ is simply-connected.

* $H^*(\cX_b^\an,\Z)$ has no torsion elements for some $b \in \cB$, e.g., all complete intersection Calabi-Yau $4$-folds in smooth projective toric varieties.

In case (2), we have $K^0_{\mathrm{top}}(\cX^\an_b)_\mathrm{tor}=0$ by <cit.>.

We now prove Proposition <ref>.

We may assume that

\[\cB^{\circ} = \cB - \{b\}.\]

Indeed, we can find a smooth connected affine curve $C$ with a map $g:C \to \cB$ such that $g^{-1}(\cB^{\circ}) = C-\{c\}$ for some point $c\in C$. Replace $\cB$ by $C$.

We claim that there exists a non-degenerate subbundle

\[\cV \subseteq \cT\]

of rank $\rho_{\tgamma_b}$,
after replacing $\cB$ by some open neighborhood of $b \in \cB$.
Indeed, choose a maximal non-degenerate subspace $V \subseteq H^1(\cX_b,T_{\cX_b})$. Then we can extend this to a map
$\cV:=V \otimes \O_{\cB} \to \cT$
of vector bundles.

Since its dual $\cT\dual \to \cV\dual$ is surjective over $b \in \cB$, by shrinking $\cB$, we may assume that $\cV$ is a subbundle of $\cT$.
Since $\sfB_{\tgamma}|_{\cV}$ is non-degenerate over $b \in\cB$, by shrinking $\cB$, we may assume that $\sfB_{\tgamma}|_{\cV}$ is non-degenerate on $\cB$.

Let $\tcurP \to \curP$ be the canonical 2-fold étale cover induced by the line bundle $\det(\EE)\otimes \det(\cV)\dual$ and the symmetric forms of $\EE$ and $\cV$ (as in Remark <ref>). Form a fibre diagram

\[\xymatrix{
\tcurP_{b} \ar@{^{(}->}[r]^j \ar[d] & \tcurP \ar[d]^{} & \tcurP^\circ \ar@{_{(}->}[l]_k \ar[d] \\
\curP_{b} \ar@{^{(}->}[r] \ar[d] \ar<EMAIL_ADDRESS>\curP \ar[d]^p & \curP^\circ \ar[d]^{} \ar@{_{(}->}[l] \\
\{b\} \ar@{^{(}->}[r]^{i_b} & \cB & \cB^{\circ}. \ar@{_{(}->}[l]

Since the symmetric complex $\EE_b$ on the fibre $\curP_b$ is orientable by [34] and the vector space $\cV_b$ is always orientable, we have

\[\tcurP_b = \curP_b \sqcup \curP_b.\]

Let $t_b : \curP_b \hookrightarrow \tcurP_b$ denote the inclusion to the first component.

Although the rank of $\mathsf{B}_{\widetilde{\gamma}}$ jumps at $b$,
the rank of $\mathsf{B}_{\widetilde{\gamma}}|_{\cV}$ does not jump,
so the argument in Theorem <ref> can indeed be used.
Hence there exists a cycle class

\[[\tcurP]^\red_{\cV} \in A_*(\tcurP)\]

such that

\begin{equation}\label{Eq:61}
i_{b}^! [\tcurP]^\red_{\cV} = \left( [\curP_{b}]^\red, -[\curP_{b}]^\red \right) \in A_*(\tcurP_{b}) = A_*(\curP_{b})\oplus A_*(\curP_{b}).
\end{equation}

Indeed, we have a decomposition of symmetric complexes

\[\EE\cong\EE^\red_{\cV} \oplus (\cV|_{\curP}[1])\]

for some symmetric complex $\EE^\red_{\cV}$ and the relative cone reduction property

\[(\fC_{\curP/\cB})_\red \subseteq \fQ(\EE^\red_{\cV}).\]

We can define the desired cycle class as

\[[\tcurP]^\red_{\cV}:=\sqrt{0^!_{\fQ\left(\EE^\red_\cV|_{\tcurP}\right)}}\left[\fC_{\tcurP/\cB}\right] \in A_*(\tcurP)\]

since the pullback $\EE^\red_\cV|_{\tcurP}$ is orientable by the definition of $\tcurP$.

Since there are additional cosections on $\curP^\circ$, we claim that

\begin{equation}\label{Eq:V1}
k^*[\tcurP]^\red_{\cV} = 0 \in A_*(\tcurP^\circ).
\end{equation}

the orthogonal bundle $\cT_{\tgamma}$ is well-defined on $\cB^{\circ}$, and the composition

\[\cV|_{\cB^{\circ}} \hookrightarrow \cT|_{\cB^{\circ}} \twoheadrightarrow \cT_{\tgamma}\]

is injective on the fibres. Thus by considering a section of the surjection

\[\frac{\cT|_{\cB^{\circ}}}{\cV|_{\cB^{\circ}}} \twoheadrightarrow \frac{\cT_{\tgamma}}{\cV|_{\cB^{\circ}}}\]

we can find a non-degenerate subbundle $\cW$ of $\cT|_{\cB^{\circ}}$ properly containing $\cV|_{\cB^{\circ}}$,

\[\cV|_{\cB^{\circ}} \subsetneq \cW \subseteq \cT|_{\cB^{\circ}}.\]

Then we have $\cW = \cV|_{\cB^{\circ}} \oplus \cU$ for the orthogonal complement $\cU$ of $\cV|_{\cB^\circ}$ in $\cW$. Moreover, we have a decomposition of symmetric complexes

\[\EE|_{\curP^{\circ}} = \EE^\red_{\cW} \oplus (\cW|_{\curP^{\circ}}[1]) = \EE^{\red}_{\cW} \oplus (\cV|_{\curP^{\circ}}[1]) \oplus (\cU|_{\curP^{\circ}}[1])\]

for some symmetric complex $\EE^\red_{\cW}$. Hence we have

\[(\EE^{\red}_{\cV})|_{\curP^{\circ}} \cong \EE^{\red}_{\cW} \oplus (\cU|_{\curP^{\circ}}[1]).\]

By shrinking $\cB$ further, we find a section $w \in \Gamma(\cB^\circ, \cU)$ such that $w^2$ is nowhere vanishing.
Consequently, we can find a cosection

\[\sigma : \EE^\red_{\cV}|_{\curP^{\circ}}[1] \to \O_{\curP^{\circ}}\]

such that $\sigma^2$ is nowhere vanishing. Lemma <ref> below proves the claim.

By the localization sequence

\[\xymatrix{
A_*(\tcurP_b) \ar[r]^{j_*} & A_*(\tcurP) \ar[r]^{k^*} & A_*(\tcurP^{\circ}) \ar[r] & 0,

and the vanishing (<ref>), we have

\[[\tcurP]^\red_{\cV} = j_*(\alpha)\]

for some $\alpha \in A_*(\tcurP_b)$. By the self-intersection formula, we have

\[i^!_b[\tcurP]^\red_{\cV} = i_b^!\circ j_*(\alpha) = e(N_{b/\cB})\cdot\alpha = 0.\]

Then the formula (<ref>) proves the desired vanishing result.

We need the following lemma to complete the proof of Proposition <ref>.

Let $\EE$ be any symmetric complex on a quasi-projective scheme $\sX$. Let $\sigma :\EE\dual[1] \to \O_{\sX}$ be a cosection such that $\sigma^2\in \Gamma(\sX,\O_{\sX})$ is nowhere vanishing. Consider a fibre diagram

\[\xymatrix{
\fQ(\EE_{\sigma}) \ar[r] \ar@{^{(}->}[d]^{l} &  \sX \ar@{^{(}->}[d]^0\\
\fQ(\EE) \ar[r]^-{\fl_{\sigma}} & \bbA^1_{\sX}

where $\EE_{\sigma}:=\cone(\sigma\dual[1] : \O_{\sX} \to \EE)$.
Then the composition

\[\sqrt{0^!_{\fQ(\EE)}}\circ l_* :  A_*(\fQ(\EE_\sigma)) \xrightarrow{l_*} A_*(\fQ(\EE)) \xrightarrow{\sqrt{0^!_{\fQ(\EE)}}} A_*(\sX)\]

We omit the proof. See <cit.>.

§.§ Variational Hodge conjecture

As an application of the deformation invariance in the previous subsection, we prove that the variational Hodge conjecture holds for surface classes with non-zero reduced virtual cycles.

Fix a smooth projective variety $X$ over $\C$.

Let $\gamma \in H^{2p}(X,\C)$ be a cohomology class on $X$.

* We say that $\gamma$ is a Hodge class if

\[\gamma \in Hdg^p(X):=H^{2p}(X,\Q) \cap H^p(X,\Omega^p_X) \subset H^{2p}(X,\C).\]

* We say that $\gamma$ is an algebraic cohomology class if $\gamma$ contained in the image of the cycle class map,

\[\gamma \in \im(\cl : A^p(X)_\Q \to Hdg^p(X)).\]

The Hodge conjecture predicts that every Hodge class on $X$ is algebraic.
Grothendieck's variational Hodge conjecture <cit.> (cf. [19]) predicts that a deformation of an algebraic cohomology class as a Hodge class is algebraic.

Thus we make the following definition:

Let $X$ be a smooth projective variety and $\gamma\in H^{2p}(X,\C)$ an algebraic cohomology class.
We say that the variational Hodge conjecture holds for the pair $(X,\gamma)$ if the following condition is satisfied:
for any smooth projective morphism $f: \cX \to \cB$ to a smooth connected scheme $\cB$
and any horizontal section $\tv_p \in \Gamma(\cB,F^p\cH^{2p}_{DR}(\cX/\cB))$
such that $\cX_0 \cong X$ and $(\tv_p)_0=\gamma$ for some $0 \in \cB$, the cohomology classes $(\tv_p)_b \in H^{2p}_{DR}(\cX_b)$ are algebraic for all $b \in \cB$.

In some of the literature, the variational Hodge conjecture is stated for any horizontal section of the Hodge bundle $\cH_{DR}^{2p}(\cX/\cB)$, instead of the filtration $F^p\cH_{DR}^{2p}(\cX/\cB)$. Deligne's global invariant cycle theorem <cit.> assures that the two versions are equivalent (see also <cit.>).

We now state the main theorem of this subsection.

Let $X$ be a Calabi-Yau 4-fold and let $\gamma \in H^2(X,\Omega^2_X)$.

\[[\PTqvX]^\red \neq 0 \in A_{\rvd}(\PTqvX)\]

for some $v \in H^*(X,\C)$ with $v_2=\gamma$ and $q \in \{-1,0,1\}$, then the variational Hodge conjecture holds for $(X,\gamma)$.

For Calabi-Yau 4-folds, we would like to regard Theorem <ref> as a virtual generalization of the results of Bloch and Buchweitz-Flenner [19, 30] since the semi-regular case is heuristically the ideal case (see Theorem <ref>). In particular, for Calabi-Yau 4-folds, we recover the result of Buchweitz-Flenner as an immediate corollary.

Let $X$ be a Calabi-Yau 4-fold and let $\gamma\in H^2(X,\Omega^2_X)$. If there exists a $\PT_q$ pair $(F,s)$ on $X$ such that $\ch_2(F)=\gamma$, for some $q \in \{-1,0,1\}$, and the associated complex $I\udot:=[\O_X \xrightarrow{s}F]$ is semi-regular,
then the variational Hodge conjecture holds for $(X,\gamma)$.

By Theorem <ref>, there exists a non-empty smooth open subset $U \subseteq \PTqvX$ such that
$[\PTqvX]^\red|_U = \pm [U] \in A_*(U).$
Hence $[\PTqvX]^\red\neq0$ and Theorem <ref> completes the proof.

We now prove our main theorem in this subsection.

Let $f:\cX\to\cB$ be a smooth projective morphism to a smooth connected scheme $\cB$ and $\tgamma$ be a horizontal section of $F^2\cH_{DR}^{4}(\cX/\cB)$.
Assume that $\cX_0 \cong X$ and $\tgamma_0=\gamma$ for some point $0\in \cB$.

Heuristically, Theorem <ref> follows from the deformation invariance in Theorem <ref>. However, to obtain a rigorous proof, we need to overcome the following technical issues:

* existence of a horizontal lift $\widetilde{\beta} \in \Gamma(\cB,F^3\cH_{DR}^6(\cX/\cB))$ of $\beta=v_3$;

* $f:\cX\to\cB$ may not be relatively Calabi-Yau (i.e., $\omega_{\cX/\cB}\cong \O_{\cX}$);

* the function $b\in \cB \mapsto \rho_{\tgamma_b}$ may not be constant;

* orientability of the orthogonal bundle $\cT_{\tgamma}$ on $\cB$;

* orientability of the virtual cotangent complex $\EE$ of $\PTqvXB \to \cB$;

* the reduced virtual cycles $[\PTqvXb]^\red$ live in the Chow groups of different schemes for each $b\in\cB$.

We first resolve issue (1). Denote by $P_v(t)$ the Hilbert polynomial determined by $v$ with respect to some polarization on $X$. We will consider a small variation on the moduli space $\PTqvXB$, namely

\[\curP:= \curP^{(q)}_{\widetilde{\gamma}, P_v}(\cX/\cB) =
\left\{(F,s,b) : \begin{matrix}
\text{$(F,s)$ is a $\PT_q$ pair on the fibre $\cX_b$ of $b \in \cB$}\\ \text{ such that $\ch_2(F)=\tgamma_b$ and $P_F(t) = P_v(t)$}
\end{matrix}\right\}.\]

The basic properties of $\PTqvXB$ in Theorem <ref> also holds for $\curP$. More precisely, the projection map

\[p : \curP \to \cB\]

is projective and the canonical map

\[\curP \hookrightarrow \cPerf(\cX/\cB)_{\O_{\cX}}^\spl\]

is an open embedding. Consequently, we have a symmetric obstruction theory

\[\phi:\EE \to \trunc \LL_{\curP/\cB}\]

for $p:\curP\to\cB$ that satisfies the isotropic condition. To prove Theorem <ref>, it suffices to show that the projection map $p:\curP \to \cB$ is surjective. Since $p:\curP \to \cB$ is projective, it suffices to show that the image of $p:\curP\to\cB$ contains a non-empty open subset of $\cB$.

Secondly, we resolve the issue (2). We claim that there exists a nonempty open neighborhood $\cB'$ of $0\in\cB$ such that

\[\omega_{\cX\times_{\cB}\cB'/\cB'}\cong \O_{\cB'}.\]

Indeed, by <cit.>, the pushforward $f_*(\omega_{\cX/\cB})$ is a vector bundle that commutes with base change. Since the fibre $\cX_0$ is Calabi-Yau, $f_*(\omega_{\cX/\cB})$ is a line bundle. Consider the canonical map of line bundles

\[f^*f_*(\omega_{\cX/\cB}) \to \omega_{\cX/\cB}\]

given by adjunction. Since it is an isomorphism over $0 \in \cB$, it is an isomorphism over an open subscheme of $\cX$ containing the fibre $\cX_0$. Since $f:\cX\to\cB$ is projective, by shrinking $\cB$, we may assume that the map $f^*f_*(\omega_{\cX/\cB}) \to \omega_{\cX/\cB}$ is an isomorphism. Moreover, by shrinking $\cB$ again, we may assume that $f_*(\omega_{\cX/\cB}) \cong \O_{\cB}$, and thus $\omega_{\cX/\cB} \cong f^*f_*(\omega_{\cX/\cB}) \cong \O_{\cX}$. It proves the claim.

Next, the vanishing result in Proposition <ref> resolves issue (3). Indeed, since $[\curP^{(q)}_{v_0}(\cX_0)]^\red\neq 0$ by assumption, we have $0 \in \cB^{\circ}$. Replace $\cB$ by $\cB^{\circ}$. Then we may assume that the function $b\in \cB \mapsto \rho_{\tgamma_b}$ is constant.

Issue (4) is resolved by simply replacing $\cB$ by a 2-fold étale cover $\cB' \to \cB$ such that $\cT_{\tgamma}|_{\cB'}$ is orientable (Remark <ref>).

We resolve issue (5) via an infinitesimal trick.
(Alternatively, we can also use a $2$-fold étale cover of $\cP$ as in the proof of Proposition <ref>.)
Assume that $p:\curP \to \cB$ is not surjective. Since the image is closed, there exists a 1-dimensional integral closed subscheme $C \subseteq \cB$ such that $0 \in C$ and $C \not\subseteq \im(p:\curP \to \cB)$.
By replacing $\cB$ by the normalization $\widetilde{C} \to C$ of $C$, we may assume that $\cB$ is a smooth quasi-projective curve, and the (set-theoretical) image $\im(p:\curP \to \cB)$ consists of finitely many points.
By shrinking $\cB$ further, we may assume that the image contains a single point $0 \in \cB$.
Then we have $(\curP)_\red = (\curP_0)_\red$ and hence $\EE$ is orientable by Lemma <ref> below.

Finally, we explain how to avoid issue (6). We follow the situation in the previous paragraph so that $\cB$ is a smooth curve and the set-theoretical image of $p:\curP \to \cB$ contains a single point $0 \in \cB$.
Form a fibre diagram

\[\xymatrix{
\curP_0 \ar@{^{(}->}[r]^{j} \ar[d] & \curP \ar[d]^p\\
\{0\} \ar@{^{(}->}[r]^{i_0} & \cB .

Since $\curP_0 \hookrightarrow \curP$ is a nilpotent thickening and the Chow groups are invariant under nilpotent thickenings, we may write

\[[\curP]^\red = j_*(\alpha)\]

for some $\alpha \in A_*(\curP_0)$. By Theorem <ref> and the self-intersection formula, we have

\[[\curP_0]^\red  = i_0^! [\tcurP]^\red = i_0^! j_*(\alpha) = e(N_{0/\cB})\cap\alpha = 0\]

since the normal bundle $N_{0/\cB}$ is a trivial line bundle. This contradicts the assumption $[\curP_v^{(q)}(X)]^{\red} \neq 0$, and hence we conclude that $p:\curP \to \cB$ is surjective.

We need the Lemma <ref> to complete the proof of Theorem <ref>.

Let $\sX \hookrightarrow \sX'$ be a nilpotent embedding of quasi-projective schemes. Let $E$ be an orthogonal bundle on $\sX'$. If $E|_{\sX}$ is orientable, then $E$ is orientable.

Consider the canonical short exact sequence of algebraic groups

\[\xymatrix{1 \ar[r] & SO(n) \ar[r] & O(n) \ar[r]^{\det} & \mu_2 \ar[r] & 1}\]

where $n$ is the rank of $E$.
Note that the orthogonal bundle $E$ defines a function $\sX' \xrightarrow{E} BO(n)$ to the classifying stack $BO(n):=[\Spec(\C)/O(n)]$ of $O(n)$. Consider the fibre diagram

\[\xymatrix{
U|_{\sX} \ar[r] \ar[d] & U \ar[r] \ar[d]& BSO(n) \ar[r] \ar[d] & \Spec(\C) \ar[d]\\
\sX \ar[r] & \sX' \ar[r]^-{E} & BO(n) \ar[r]^{\det} & B\mu_2.

Since $E|_{\sX}$ is orientable, the principal $\mu_2$-bundle $U|_{\sX} \to \sX$ is trivial. Hence $U|_{\sX} = U_1 \bigsqcup U_2$ for some open subschemes such that the compositions $U_1,U_2 \hookrightarrow U|_{\sX} \to \sX$ are isomorphism. Since $U$ and $U|_{\sX}$ have the same Zariski topology, we can decompose $U = \widetilde{U_1}\bigsqcup \widetilde{U_2}$ by disjoint open subschemes $\widetilde{U_1}, \widetilde{U_2}$ extending $U_1,U_2$. Then $\widetilde{U_1}, \widetilde{U_2} \to  \sX'$ are both finite étale bijective maps. Hence they are both isomorphisms. This means that the $\mu_2$-bundle $U \to \sX'$ has a section. Hence $E$ is orientable.

The following example illustrates Theorem <ref> in some non-semi-regular cases.

Let $X=S_1\times S_2$ be a product of two K3 surfaces. Let $\beta_1\in H^{1,1}(S_1)$, $\beta_2\in H^{1,1}(S_2)$ be two irreducible effective curve classes with $\beta_1^2=2h-2$, $h\geq 2$ and $\beta_2^2=0$.
Let $v:=\ch(\O_{C_1\times C_2})$ for any $C_1\in |\O_{S_1}(\beta_1)|$ and $C_2\in |\O_{S_2}(\beta_2)|$.
Then we have an isomorphism

\begin{equation}\label{eq:k3k31}
\phi : |\O_{S_1}(\beta_1)|\times \PP^1\to \curP^{(1)}_v(X)\,.
\end{equation}

Under this isomorphism we have

\[[\curP^{(1)}_v(X)]^\red = h^0(\O_{S_1}(\beta_1))\cdot[\pt \times\PP^1]\]

for some orientation.

We briefly illustrate the argument. The proof will appear in one of the sequels to this paper.
By the choice of $\beta_2$, there exists an elliptic fibration $p:S_2\to\PP^1$ such that $\beta_2$ is the class of a fibre.  By Proposition <ref> the reduced virtual dimension of $\curP^{(1)}_v(X)$ is one.
Let $\II\udot=[\O_{|\O_{S_1}(\beta_1)|\times S_1}\twoheadrightarrow \O_{\mathcal{C}}]$ be the universal pair on $|\O_{S_1}(\beta_1)|\times S_1$. Consider the fibre diagram

\[\xymatrix{
& S_1 \times S_2 \ar@{^{(}->}[r]^-{j} \ar[d] \ar[ld]_{\mathrm{pr}} & S_1\times \PP^1 \times S_2 \ar[d]^{\id\times\id\times p} \\
S_1 & S_1\times\PP^1 \ar@{^{(}->}[r]^-{\id\times\Delta} & S_1\times\PP^1\times\PP^1

where $\Delta:\PP^1\to\PP^1\times\PP^1$ is the diagonal. Then the universal pair $j_*\textup{pr}^*\II\udot$ on $|\O_{S_1}(\beta_1)|\times\PP^1 \times X$ induces the morphism (<ref>). Using <cit.>, we can show that $\phi$ is an isomorphism and the reduced obstruction theory of $\curP^{(1)}_v(X)$ reduces to a 2-term obstruction theory on $|\O_{S_1}(\beta_1)|\times\PP^1$.

By Theorem <ref>, the points of $\curP^{(1)}_v(X)$ are not semi-regular. Since the reduced virtual cycle of $\curP^{(1)}_v(X)$ is non-zero, Theorem <ref> applies to the class $\gamma = \beta_1\cup \beta_2$.

The original version of the variational Hodge conjecture by Grothendieck [69] is stated for all geometric points, while Definition <ref> only considers $\C$-points. In the situation of Theorem <ref>, since we have shown that the map $p: \curP^{(q)}_{\tgamma,P_v}(\cX/\cB) \to \cB$ is surjective on $\C$-points, it is also surjective for all geometric points. Hence we also deduce the original form of the variational Hodge conjecture.

In the situation of Theorem <ref>, we further speculate that  $[\PTqvX]^\red\neq0$ implies smoothness of the Hodge locus of $\gamma$ in the moduli space of Calabi-Yau $4$-folds near $X$.[For simplicity for Calabi-Yau $4$-folds with $h^{0,1}=h^{0,2}=h^{0,3}=0$, there exists a moduli space of Calabi-Yau $4$-folds as a smooth separated Deligne-Mumford stack with quasi-projective coarse moduli space by Viehweg [156] (see also Kollár <cit.>) and the Bogomolov-Tian-Todorov theorem [20, 149, 150].]
We note that not much is known about singularities of the Hodge locus.
At least when the scheme-theoretical Hodge locus is reduced near $X$ and $[\PTqvX]^\red\neq0$, then Proposition <ref> proves smoothness near $X$ since the dimension of the tangent space is constant near $X$.
We hope to pursue this direction in a future work.

§ REDUCTIONS VIA -SHIFTED 1-FORMS

In this section, we construct a reduced $(-2)$-shifted symplectic derived enhancement on $\PTqvX$.
In particular, this construction shows that the reduced obstruction theory constructed from the algebraic twistor family in section <ref> satisfies the isotropic condition.

In subsection <ref>, we present general reduction procedures by cosections that come from $(-1)$-shifted closed/exact $1$-forms.
In subsection <ref>, we show that the cosections on $\PTqvX$ induced by the semi-regularity map can be enhanced to $(-1)$-shifted closed $1$-forms.

We use the following conventions/notations in this section:

* We use the language of $\infty$-categories in the sense of Lurie [110, 111].

* We write $\Map_{\mathcal{C}}(-,-)$ for the mapping space of an $\infty$-category $\mathcal{C}$.

We consider the following $\infty$-categories:

* Let $\cdga$ be the $\infty$-category of commutative differential graded $\C$-algebras and let $\cdga^{\leq0} \subseteq \cdga$ be the full subcategory of non-positively graded objects.

* Let $\dSt$ be the $\infty$-category of derived stacks, i.e., $\infty$-sheaves on $\cdga^{\leq0}$ with respect to the étale topology.

* Let $\epsilon\textrm{-}\dg^\gr$ (resp. $\dg^\gr$) be the symmetric monoidal stable $\infty$-category of graded mixed complexes (resp. graded complexes), see [132].