text:
\section{Introduction}

    A continuous map $f\colon \mathbb{C}^n\to \mathbb{C}^N$ is (linearly)
    \emph{$k$-regular} if
    the images $f(x_1)$, \ldots ,$f(x_k)$ are linearly independent for any
    pairwise distinct points $x_1, \ldots ,x_k$. The problem of existence of
    such maps for given $k$, $n$, $N$ is researched classically in topology
    and important also in applications, for example to approximation theory,
    see~\cite{bjjm}.
    This problem decomposes into two distinctly differently flavoured halves:
    providing \emph{lower} and \emph{upper} bounds for the minimal $N = N(n,
    k)$ for which a $k$-regular map exists.
    The lower bounds are provided using algebro-topological
    methods~\cite{Ziegler, Ziegler2}, while the upper bounds were constructed
    in~\cite{bjjm}.

    A continuous map $f\colon \mathbb{C}^n\to \mathbb{C}\mathbb{P}^{N-1}$ is
    \emph{projectively $k$-regular} if the images $f(x_1)$, \ldots ,$f(x_k)$
    span a $(k-1)$-dimensional projective subspace for any
    pairwise distinct points $x_1, \ldots ,x_k$. This notion is essentially
    equivalent to linear $k$-regularity above, see~\cite[Lemma~2.3]{bjjm}.

    A natural generalization of a projectively $k$-regular map is to replace
    $\mathbb{C}\mathbb{P}^{N-1}$ by the Grassmannian $\Gr(\tau, N)$ of
    $\tau$-dimensional subspaces of $\mathbb{C}^N$. A continuous map $f\colon
    \mathbb{C}^n\to \Gr(\tau, N)$ is \emph{$k$-regular} if for every pairwise distinct
    points $x_1, \ldots ,x_k\in \mathbb{C}^n$ the subspaces $f(x_1), \ldots ,f(x_k)$
    jointly span a $(k\cdot \tau)$-dimensional subspace of $\mathbb{C}^N$,
    i.e., their basis vectors are jointly linearly independent. For $\tau = 1$
    this recovers the notion of a projectively $k$-regular map. Also in this
    context one can bound the minimal $N=N(\tau, n, k)$ for which a
    $k$-regular map exists.

    In this article we prove the following result.
     \begin{theorem}\label{ref:mainthm}
        Consider the function $N(\tau, k, n)$ defined by
        \begin{enumerate}
            \item If $k\leq 8$ and if $\tau\leq2$ and $k\leq 11$ then $N(\tau, k, n) = (n-1)(k-1) + \tau k$.
            \item Otherwise $N(\tau, k, n) = kn-1 + \tau k$.
        \end{enumerate}
        Then there exists a $k$-regular map $\mathbb{C}^n\to \Gr(\tau, N(\tau,
        k, n))$.
    \end{theorem}
    In the classical case $\tau = 1$ this extends the bounds from~\cite{bjjm}
    for $\tau = 10,11$.
    The method of construction, which follows~\cite{bjjm}, is the following.
    \begin{enumerate}
        \item By a direct construction, a $k$-regular algebraic map $f_0\colon \mathbb{C}^n\to
            \Gr(\tau, N_0)$ exists for $N_0\gg 0$.
        \item We seek a $W\subset \mathbb{C}^{N_0}$ such that the composed map
            $f_W\colon \mathbb{C}^n\to \Gr(\tau, N_0)\dashrightarrow \Gr(\tau, N_0 - \dim
            W)$ induced by $\mathbb{C}^{N_0}\twoheadrightarrow \mathbb{C}^{N_0}/W$ is still
            everywhere defined and $k$-regular. In fact, since
            $\mathbb{C}^n$ is homeomorphic to any open ball around the origin,
            it is enough for $f_W$ to be defined and $k$-regular around the
            origin.
        \item A subspace $W$ satisfies the requirements above if it does not
            intersect a certain \emph{bad locus}, given by spans of all
            $f_0(Z)$ for $Z\subset \mathbb{C}^n$ a zero-dimensional degree
            $k$ subscheme supported at the
            origin. The dimension of this bad locus is bounded from above by
            the dimension of the family of possible $Z$, which is
            $\Hilb_k(\mathbb{A}^n, 0)$, see below.
        \item We can reduce to $Z$ which are of type $\leq \tau$, which is a
            technical condition, but gives an important gain in dimension. It
            remains to bound the dimension of $\Hilb_k^{\tau}(\mathbb{A}^n,
            0)$.
    \end{enumerate}
    The final task remaining, to bound $\dim \Hilb_k^{\tau}(\mathbb{A}^n, 0)$,
    is completely disconnected from topology but very far from trivial.
    It occupies the major part of the current paper and we discuss it at length below.
    Let us only remark that the above Theorem~\ref{ref:mainthm} is close to
    optimal when employing the methods of~\cite{bjjm}, as follows from
    Theorem~\ref{ref:dimension:maintheorem} below. Hence radically new
    approaches are necessary to push the results on upperbounding $N(\tau, n,
    k)$ further.
    We also remark that the case $\tau = 1$ is qualitatively easier than the
    other ones, thanks to the fact that in this case one deals exclusively
    with Gorenstein algebras, see Section~\ref{sec:regularMaps} for details,
    and a mature theory of those algebras exists, thanks to their
    self-duality.

    The parameter space that governs the dimension of the bad locus above is a locus in the Hilbert scheme of points
    $\Hilb_k(\mathbb{A}^n)$. We work over an algebraically closed field
    $\mathbb{k}$ of characteristic zero.
    The Hilbert scheme is a quasi-projective variety, which
    as a set consists of points $[Z]$ corresponding to $Z \subset
    \mathbb{A}^n$ zero-dimensional and of degree $k$; the simplest example is
    $Z$ being a tuple of $k$ closed points of $\mathbb{A}^n$. Its topology is
    defined functorially, see for example \cite[\S4]{bjjm} for details.

    Let $\Hilb_k(\mathbb{A}^n, 0)\hookrightarrow \Hilb_k(\mathbb{A}^n)$ denote the
    closed locus consisting of $Z \subset \mathbb{A}^n$ such that $Z$ is
    supported only at the origin. This is the \emph{punctual} Hilbert scheme,
    see~\S\ref{sec:irreducibilitypreliminaries} for details. It is a
    projective, in particular proper, scheme. (A warning: some authors use
    the name ``punctual'' for the whole $\Hilb_k(\mathbb{A}^n)$.)

    Compared with $\Hilb_k(\mathbb{A}^n)$, almost nothing is known in general
    about the punctual Hilbert scheme $\Hilb_k(\mathbb{A}^n, 0)$.
    This scheme has a distinguished irreducible component, the
    \emph{curvilinear locus}
    which is the closure of the locus of \emph{curvilinear schemes}: schemes
    isomorphic to $\Spec(\mathbb{k}[\varepsilon]/\varepsilon^k)$,
    see~\cite{ia_deformations_of_CI}. This locus has
    dimension $(n-1)(k-1)$, thus $\dim_{\mathbb{k}} \Hilb_k(\mathbb{A}^n, 0) \geq
    (n-1)(k-1)$. We say that $(n-1)(k-1)$ is the \emph{expected dimension} of
    $\Hilb_k(\mathbb{A}^n,0)$ and  that a locus of $\Hilb_k(\mathbb{A}^n,0)$ is \textit{negligible} if
    its dimension is at most $(n-1)(k-1)$.
    Let $\Hilb_k^{\tau}(\mathbb{A}^n,
    0)\subset \Hilb_k(\mathbb{A}^n,0)$ denote the open locus that consists of
    $[Z = \Spec(A)]$, where the socle of $A$ is at most $\tau$-dimensional;
    for example $\tau=1$ corresponds to Gorenstein $Z$.
    Our first main result concerns $(n,k,\tau)$ for which the dimension of
    $\Hilb_k^{\tau}(\mathbb{A}^n, 0)$ is
    expected.

    \begin{theorem}\label{ref:dimension:maintheorem}
        \def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) --
        (.25,.15) -- cycle;}
        For every $k\leq 8$ and $n$ the scheme $\Hilb_k(\mathbb{A}^n,0)$ has expected dimension
        while for every $k\geq 9$ the dimension of $\Hilb_k^3(\mathbb{A}^{k-4}, 0)$ is higher than
        expected.
        For every $k\leq 11$ and $n$ the scheme $\Hilb_k^2(\mathbb{A}^n,0)$ has
        expected dimension, while for $k\geq 13$ the dimension of
        $\Hilb_{k}^2(\mathbb{A}^{\lfloor k/2\rfloor-1},0)$ is higher than expected.
        For every $k\leq 11$ and $n$ the scheme $\Hilb_k^1(\mathbb{A}^n,0)$ has
        expected dimension, while for $k\geq 14$ the dimension of
        $\Hilb_{k}^1(\mathbb{A}^{\lfloor k/2\rfloor-1},0)$ is higher than
        expected. This information can be summarized as follows, where
        \emph{no} means \emph{no if $n$ is big enough}.

        \begin{center}
            \begin{tabular}[<+position+>]{l c c c c c}
                & $k\leq 8$ & $9\leq k\leq 11$ & $k=12$ & $k=13$ & $k\geq 14$\\
                \toprule
                $\Hilb_k(\mathbb{A}^n, 0)$ & \checkmark & no & no & no & no \\
                $\Hilb^{\tau}_k(\mathbb{A}^n, 0)$, $\tau\geq 3$ & \checkmark & no & no & no & no \\
                $\Hilb^2_k(\mathbb{A}^n, 0)$ & \checkmark & \checkmark & ? & no & no \\
                $\Hilb^1_k(\mathbb{A}^n, 0)$ & \checkmark & \checkmark & ? & ? & no
            \end{tabular}\\\vspace{1mm}
            {Table. \small Does $\Hilb^{\tau}_k(\mathbb{A}^n, 0)$ have expected
        dimension?}
    \end{center}
    \end{theorem}
    Before the current work, the case $\tau = 1$ was investigated in~\cite[Theorem~A.16]{bjjm}
    where it was proven that $\dim\Hilb^1_k(\mathbb{A}^n, 0) = (k-1)(n-1)$ for $k\leq 9$.
    Apart from this, to the authors' knowledge, no results were known for
    general $n$.
    For $n\leq 2$ the curvilinear locus is the only component; the punctual
    Hilbert scheme is irreducible~\cite[Corollary~(1.2)]{Ellingsrud_Stromme__On_the_homology}.
    The argument is a beautiful application of topology, but it relies heavily
    on that $\Hilb_k(\mathbb{A}^2)$ is smooth and irreducible.
    In the current article, we extend this result to threefolds, for $k\leq 11$.
    \begin{theorem}\label{ref:irreducibility}
        For $k\leq 11$ the scheme $\Hilb_k(\mathbb{A}^3, 0)$ is equal to the curvilinear locus, so
        it is irreducible of dimension $2(k-1)$.
    \end{theorem}
    As known classically, the punctual Hilbert scheme does not depend on the
    global geometry~\cite[Proposition~2.2]{fogarty} so we immediately
    obtain the following generalization.
    \begin{theorem}\label{ref:irreducibilityGeneral}
        Let $x\in X$ be a smooth point on a threefold  $X$.
        Then for $k\leq 11$ the scheme $\Hilb_k(X, x)$ is irreducible of dimension $2(k-1)$.
    \end{theorem}

    It was known before that $\Hilb_k(\mathbb{A}^3)$ is irreducible for
    $k\leq 11$~\cite{DJNT, Henni, Sivic__Varieties_of_commuting_matrices}.
    However, this by no means implies irreducibility of $\Hilb_k(\mathbb{A}^3, 0)$.
    Indeed, the irreducibility of $\Hilb_k(\mathbb{A}^3)$ as in~\cite{DJNT} proceeds by proving
    that every scheme $Z\subset \mathbb{A}^3$ is a degeneration of
    $\Gamma\subset \mathbb{A}^3$ which is a union of $k$ points. Obviously,
    the scheme $\Hilb_k(\mathbb{A}^3, 0)$ contains no such $\Gamma$, so the
    picture is as in Figure~\ref{fig:Hilbdiffs}. None of the known
    general techniques used to prove irreducibility of Hilbert schemes adapts
    effectively to analysing irreducibility of $\Hilb_k(\mathbb{A}^3, 0)$ and
    here we develop new methods.

    \begin{figure}[h]
        \centering
        \includegraphics[width=6cm]{difference-between-Hilbs-pic}
        \caption{The schemes $\Hilb_k(\mathbb{A}^3)$ and
        $\Hilb_k(\mathbb{A}^3, 0)$, $k\leq 11$.}
        \label{fig:Hilbdiffs}
    \end{figure}

    \subsection{Proof ideas I: general and Bia{\l{}}ynicki-Birula{}
slicing}\label{ssec:proofIdeas}
    The major part of the proof of Theorem~\ref{ref:irreducibility} is to
    prove an appropriate part of Theorem~\ref{ref:dimension:maintheorem}: to show
    that the dimension of $\Hilb_k(\mathbb{A}^3, 0)$ is at most $2(k-1)$ and
    additionally that there is at most one irreducible component $Z$ of dimension
    $2(k-1)$. Since the dimension of $\Hilb_k(\mathbb{A}^3, 0)$
    at every point is \emph{at least} $2(k-1)$ by general nonsense, see
    Proposition~\ref{ref:componentsLowerBound:prop}, this implies that in fact
    $Z = \Hilb_k(\mathbb{A}^3, 0)$.

    However, bounding the dimension of $\Hilb_k(\mathbb{A}^3, 0)$ is hard.
    The points of $\Hilb_k(\mathbb{A}^3, 0)$ are
    quite impossible to classify for $k > 6$ and the number of cases is best described as
    swarming, see tables below. Moreover, in contrast with $\Hilb_k(\mathbb{A}^n)$, the scheme
    $\Hilb_k(\mathbb{A}^n, 0)$ is little investigated.
    Therefore, the only one readily available estimate is ``dimension at a
    point is at most the dimension of the tangent space''.
    But even this method has a serious caveat. Namely, it is
    known classically that for finite $Z \subset \mathbb{A}^n$ we
    have
    \[
        T_{[Z]}\Hilb_k(\mathbb{A}^n) = \Hom_{\mathbb{k}[x_1, \ldots , x_n]}(I, \mathbb{k}[x_1, \ldots ,x_n]/I),
    \]
    where $I = I(Z) \subset  H^0(\OO_{\mathbb{A}^n}) = \mathbb{k}[x_1,
    \ldots,x_n]$.
    However, for $[Z]\in \Hilb_k(\mathbb{A}^n, 0)$ no such nice
    description of the subspace $T_{[Z]} \Hilb(\mathbb{A}^n, 0)$ seems to exist,
    see~\cite{Bejleri_Stapleton} for the surface case. Given
    that $\Hilb_k(\mathbb{A}^3)$ is irreducible for $k\leq 11$, we have
    $\dim_{\mathbb{k}} \Hom(I, \mathbb{k}[x_1, \ldots ,x_n]/I) \geq 3k$ which is not a
    useful estimate.
    Even worse, the locus $\Hilb_k(\mathbb{A}^3, 0)$ is the most singular part of
    $\Hilb_k(\mathbb{A}^3)$; indeed every finite $Z\subset \mathbb{A}^3$ can
    be degenerated to a scheme supported only at the origin by taking the
    limit at zero of the dilation torus action on $\mathbb{A}^3$. This implies
    that the tangent spaces to the Hilbert scheme at points of
    $\Hilb_k(\mathbb{A}^3, 0)$ are frequently of dimension much higher than
    $3k$.

    To provide an upper bound on the dimension we introduce a technique which
    we baptise informally as
    \emph{Bia{\l{}}ynicki-Birula{} slicing}. It seems applicable much
    more generally, outside the realm of Hilbert schemes, whenever one has a
    singular moduli space with a torus action. We discuss it here for
    arbitrary $\mathbb{A}^n$, not just $n=3$.

    Fix a one-dimensional torus $\Gmult$ and its action on
    $\mathbb{A}^n$ by $t\cdot (x_1, \ldots ,x_n) = (tx_1, \ldots ,
    tx_n)$. Every point except the origin
    diverges with $t\to \infty$.
    We consider the Bia{\l{}}ynicki-Birula{}-decomposition $\Hilb_k^{+}(\mathbb{A}^n)$ of the Hilbert
    scheme, which subdivides this scheme grouping together points that have
    their limit of $\Gmult$ at
    infinity in the same connected component of the fixed points~\cite{Drinfeld,
    jelisiejew_sienkiewicz__BB}.
    The Bia{\l{}}ynicki-Birula{} decomposition comes with maps
    \begin{equation}\label{eq:maindiagram}
        \begin{tikzcd}
            \Hilb_k^{+}(\mathbb{A}^n)\ar[r, "\theta"]\ar[d, "\pi"] &
            \Hilb_k(\mathbb{A}^n)\\
            \Hilb_k^{\Gmult}(\mathbb{A}^n)
        \end{tikzcd}
    \end{equation}
    where $\theta$ is the forgetful map, while $\pi$ maps a subscheme to its
    limit at $t = \infty$. Since schemes supported
    outside the origin do not admit a limit at infinity,
     the image of $\theta$
    is, as a set, $\Hilb^+_k(\mathbb{A}^n, 0)$~\cite[Proposition~3.3]{Jelisiejew__Elementary}.
    The closed subscheme $\Hilb_k(\mathbb{A}^n,
    0)$ is $\Gmult$-stable, hence inherits a decomposition
    $\Hilb_k^{+}(\mathbb{A}^n, 0)$ and corresponding maps. This subscheme is
    projective~\S\ref{sec:irreducibilitypreliminaries}, so the forgetful map
    $\Hilb_k^{+}(\mathbb{A}^n, 0)\to \Hilb_k(\mathbb{A}^n, 0)$ is bijective on
    points and hence
    \[
        \dim \Hilb_k^{+}(\mathbb{A}^n, 0) = \dim \Hilb_k(\mathbb{A}^n, 0).
    \]
    The map $\pi$ restricted to $\Hilb_k(\mathbb{A}^n, 0)$ has an explicit
    description as the associated-graded-algebra map, see~\S\ref{ssec:ideas2}
    for details. In particular, all elements of a fiber of $\pi$ share the
    same Hilbert function.

    The Bia{\l{}}ynicki-Birula{}-decomposition has many connected components. First, the
    points of $\Hilb_k^{\Gmult}(\mathbb{A}^n)$ are just subschemes $Z
    \subset \mathbb{A}^n$ whose ideals are homogeneous with respect to the
    standard grading. Thus, this scheme has at least as many
    connected components as there are Hilbert functions $H$:
    \begin{small}
        \begin{center}
        \begin{tabular}{c c c c c c c c c c c c c c}
            $k$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ &
            $11$
            \\\toprule
            number of Hilbert functions $H$, for arbitrary $H(1)$: & $1$ & $1$ & $2$ & $3$ & $5$ &
            $8$ & $12$ & $18$ & $27$ & $40$ & $57$
        \end{tabular}
    \end{center}
    \end{small}
    Possible $H$ are classified by Macaulay~\cite[\S4]{BrunsHerzog}
    and their number grows exponentially in $n$.
    For any fixed Hilbert function $H$ with $\sum H = k$, consider the
    open-closed locus $\HilbFuncGr{H}{n} \subset
    \Hilb_k^{\Gmult}(\mathbb{A}^n)$ parameterizing points $[\Spec(A)]$ where
    $A$ has Hilbert function $H$. By~\cite[Theorem~3.2]{Mall} every
    $\HilbFuncGr{H}{n}$ is connected,
    hence $H\leftrightarrow \HilbFuncGr{H}{n}$ gives a bijection between Hilbert
    functions $H$ with $\sum H = k$ and components of
    $\Hilb_k^{\Gmult}(\mathbb{A}^n)$.
    Let $\HilbFunc{H}{n} \subset\Hilb_k^{+}(\mathbb{A}^n, 0)$ denote the locus
    parameterizing points $[\Spec(A)]$ where $A$ is a local algebra with
    Hilbert function $H$, this is the \emph{cell} corresponding to the Hilbert
    function $H$. By the description of $\pi$ as the associated-graded-algebra
    map, we have $\HilbFunc{H}{n} = \pi^{-1}(\HilbFuncGr{H}{n})$ and
    $\HilbFunc{H}{n}$ are the connected components of
    $\Hilb_k^{+}(\mathbb{A}^n, 0)$. Moreover, $(\HilbFunc{H}{n})^{\Gmult} =
    \HilbFuncGr{H}{n}$ as the notation suggests.
    In Figure~\ref{fig:BBdecomposition} we give a very schematic description
    of its Bia{\l{}}ynicki-Birula{} decomposition, compare Figure~\ref{fig:Hilbdiffs}.

    \begin{figure}[h]
        \centering
        \includegraphics[width=5cm]{BBdecomposition}
        \caption{Schematic description of Bia{\l{}}ynicki-Birula{} decomposition of the scheme $\Hilb^{+}_k(\mathbb{A}^n, 0)$.}
        \label{fig:BBdecomposition}
    \end{figure}

    For a $\Gmult$-fixed point
    $[Z]$ corresponding to a homogeneous ideal $I \subset R = \mathbb{k}[x_1, x_2,  \ldots
    ,x_n]$ we have
    \[
        T_{[Z]}\Hilb_k^{+}(\mathbb{A}^n, 0) =
        (T_{[Z]}\Hilb_k(\mathbb{A}^n))_{\geq 0}  \simeq  \Hom_R(I, R/I)_{\geq
        0},
 \]
    where $\Hom(I, R/I)_{\geq 0}$ consists of homomorphisms $\varphi\colon I\to
    R/I$ such that $\varphi(I_i) \subset (R/I)_{\geq i}$ for every $i\geq 0$,~i.e., the homomorphisms that do not lower the degree, see for example~\cite[(2.2), (2.4)]{Jelisiejew__Elementary}.
    This restriction of the
    tangent space to its nonnegative part is the first key improvement. Indeed when $n=3$, then $\dim_{\mathbb{k}}\Hom(I,
    R/I)_{\geq0} \leq 2(k-1)$ for almost all homogeneous ideals,
    see~Proposition~\ref{ref:smallExceptionalCells:prop} and the table below.
    To compute the dimension of the tangent spaces, we resort again to
    semicontinuity: choose a Borel subgroup $B \subset \GL_n$, then $B$
    commutes with $\Gmult$ hence acts
    on the components of the projective scheme
    $\Hilb^{\Gmult}_k(\mathbb{A}^n)$ and so by semicontinuity to bound the
    tangent space dimension
    (degree-wise) everywhere, it is enough to bound it for Borel-fixed points.
    Borel-fixed points correspond to monomial ideals, so there are finitely
    many of them for a fixed $k$. In fact they correspond to very special monomial
    ideals~\cite{StronglyStableIdeals}. We list the numbers below, to provide
    some context.
    \begin{small}
    \begin{center}
    \begin{tabular}{c c c c c c c c c c c c c}
            \hfill $n=3$ \hfill $k = $ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ &
            $11$
            \\\toprule
            number of monomial ideals (MacMahon function) & $1$ & $3$ & $6$ &
            $13$ & $24$ & $48$ & $86$ & $160$ & $282$ & $500$ & $859$\\
           number of Borel-fixed ideals & $1$ & $1$ & $2$ & $3$ & $4$ & $6$ &
            $9$ & $12$ & $17$ & $24$ & $32$\\
            number of Borel-fixed ideals with $\dim T_{\geq 0}\geq 2(k-1)$ & $1$ & $1$ & $1$ &
            $1$ & $1$ & $1$ & $1$ & $2$ & $2$ & $4$ & $6$
        \end{tabular}
    \end{center}
\end{small}
    There remains a small number of special cases for $n = 3$ which have to be resolved by hand.
    There also remain many more problematic cases for $n > 3$, see below. To tackle those
    we need to employ other tools, such as the theory of
    Macaulay's inverse systems and partial classification results. We discuss
    them below.
    \begin{small}
    \begin{center}
    \begin{tabular}{c c c c c c c c c c c c c}
            \hfill $n = k$ \hfill $k = $ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ &
            $11$
            \\\toprule
            number of Borel-fixed ideals & $1$ & $1$ & $2$ & $3$ & $5$ & $8$ &
            $13$ & $20$ & $32$ & $50$ & $77$\\
            number of Borel-fixed ideals with $\dim T_{\geq 0}\geq (n-1)(k-1)$ & $1$ & $1$ & $1$ &
            $1$ & $1$ & $1$ & $1$ & $4$ & $8$ & $16$ & $33$
        \end{tabular}
    \end{center}
    \end{small}

    \emph{Dimension estimates.} For a $\Gmult$-fixed $[Z]$ given by a
    homogeneous $I\subset
    R = \mathbb{k}[x_1, \ldots ,x_n]$ its tangent space
    \[
        T_{[Z]}:= \Hom_{\mathbb{k}[x_1 \ldots ,x_n]}(I, \mathbb{k}[x_1, \ldots ,x_n]/I)_{\geq 0}
    \]
    decomposes into the space $(T_{[Z]})_0$
    which is the tangent space to $\Hilb^{\Gmult}(\mathbb{A}^n)$
    and $(T_{[Z]})_{>0}$ which is the tangent space to the fiber over $Z$.
    Moreover, the fiber dimension of $\pi$ is upper-semicontinuous, because
    this map is a cone over a projective morphism, see~\cite[Proof of
    Theorem~3.1]{Szachniewicz} for details.
    Hence,
    we have the following estimates for the dimension of
    $\Hilb^+_k(\mathbb{A}^n, 0)$ near $[Z]$:
    \begin{enumerate}
        \item\emph{tangent space estimate} $\dim_{[Z]}
            \Hilb^+_k(\mathbb{A}^n, 0) \leq \dim_{\mathbb{k}} \Hom_{R}(I,
            R/I)_{\geq 0}$,
        \item\emph{base-and-tangent-to-fiber estimate} $\dim_{[Z]}
            \Hilb^+_k(\mathbb{A}^n, 0) \leq
            \dim_{[Z]}\Hilb^{\Gmult}(\mathbb{A}^n) + \dim_{\mathbb{k}} \Hom_{R}(I, R/I)_{>0}$,
        \item\emph{tangent-to-base-and-fiber estimate} $\dim_{[Z]}
            \Hilb^+_k(\mathbb{A}^n, 0) \leq
            \dim_{\mathbb{k}} \Hom_{R}(I, R/I)_0 + \dim_{[Z]}
            \pi^{-1}([Z])$,
        \item\emph{base-and-fiber estimate} $\dim_{[Z]}
            \Hilb^+_k(\mathbb{A}^n, 0) \leq
            \dim_{[Z]}\Hilb^{\Gmult}(\mathbb{A}^n) + \dim_{[Z]}
            \pi^{-1}([Z])$,
    \end{enumerate}

    In most of the remaining cases, these observations are sufficient.
    In few, we need to resort to the following observation, which we call \emph{local
    constancy}. If $[Z]$ is a smooth point of
    $\Hilb^+_k(\mathbb{A}^n, 0)$ then the map $\pi$ is smooth and so is
    $\Hilb_k^{\Gmult}(\mathbb{A}^n)$. In particular $\dim_{\mathbb{k}}\Hom_{R}(I,
    R/I)_{>0}$ and $\dim_{\mathbb{k}}\Hom_{R}(I, R/I)_0$ are constant in a
    neighbourhood of $[Z]$.
    This is used to rule out the cases where the tangent space has a surplus
    of exactly one with respect to the expected dimension: if
    the dimension of the cell is indeed higher than expected then the point has to be smooth and
    we can apply the above observation and find a witness of non-constancy.

    \subsection{Proof ideas II: explicit computations}\label{ssec:ideas2}
    Finally, there are much fewer but still quite a few cases where $\dim_{\mathbb{k}}\Hom_R(I, R/I)_{\geq 0}$ is
    higher than $(n-1)(k-1)+1$ and for these we need to peek deeper into the
    structure of the cells.
    Let $\HilbFunc{H}{n}\subset \Hilb_k(\AA^n,0)$ denote the locus of algebras
    with Hilbert function $H$, not necessarily graded and
    $\HilbFuncGr{H}{n}$ denote the subscheme of graded algebras; as explained
    above
    $\HilbFuncGr{H}{n} \subset \Hilb^{\Gmult}(\mathbb{A}^n)$ is a connected
    component.
    Then $\HilbFunc{H}{n}$ is equal to
    $\pi^{-1}(\HilbFuncGr{H}{n})$ and $\pi$ is the associated graded
    map~\cite{Jelisiejew__Elementary}. We can thus restrict and rephrase the
    Diagram~\ref{eq:maindiagram} more concretely
    on the level of closed points as
    \begin{equation}\label{eq:mainconcrete}
        \begin{tikzcd}
            \bigsqcup_{H: \sum H = k}\left\{ I \subset R \ |\ \rad(I) =
                (x_1, \ldots ,x_n), H_{R/I} = H \right\}
                \ar[r, hook, "\mathrm{bij}"]\ar[d, "\gr"] & \left\{ I\subset R\ |\
                \rad(I) =
                (x_1, \ldots ,x_n),\ \dim_{\mathbb{k}} R/I = k\right\}\\
                \bigsqcup_{H: \sum H = k}\left\{ I \subset R \ |\ I \mbox{
                graded, } H_{R/I} = H \right\}
        \end{tikzcd}
    \end{equation}
    where $R = \mathbb{k}[x_1, \ldots ,x_n]$.
    Using this description, we see that the fiber of $\pi$ over $\mathbb{k}[x_1,
    \ldots ,x_n]/I$ for a homogeneous ideal consists
    of all ideals having $I$ as the initial ideal, hence this fiber is possible to
    describe explicitly. It is not quite true that such description is
    straightforward,
    in fact it is not, especially since in many cases the fiber is very
    singular. To facilitate it we resort to a number of tricks and
    classification theorems too technical to describe here.
    We attempt to present only one, which can be called \emph{vertex removal}.

    The whole torus $\Gmult^n$ acts on $\HilbFunc{H}{n}$ and
    $\HilbFuncGr{H}{n}$ so we can fix another subtorus $\Gmult\subset\Gmult^n$
    and consider the induced decompositions. Typically, the stratum
    $\HilbFuncGr{H}{n}$ contains small substrata consisting of highly singular
    points. As example of such on Figure~\ref{fig:BBdecomposition} is the left
    vertex. The trick is to choose the weights of this other $\Gmult$ appropriately, so that near
    the vertex the action is divergent, as on the right part of
    Figure~\ref{fig:BBdecomposition}.
    Then the dimension of the non-vertex part can be bounded by using tangent
    spaces, while the dimension of the vertex part can be bounded directly,
    since this part becomes ``small'';  see
    Proposition~\ref{ref:14321final:prop} for an example of such an argument.

    \subsection*{Notation for the Hilbert schemes}
\begin{tabular}{c c}
    object & symbol\\
    \toprule
    The Hilbert scheme of $k$ points & $\Hilb_k(\mathbb{A}^n)$\\
    The punctual Hilbert scheme & $\Hilb_k(\mathbb{A}^n, 0)$\\
    The locus of algebras of type $\leq \tau$ & $\Hilb_k^{\tau}(\mathbb{A}^n, 0)$\\
    The locus with fixed Hilbert function $H$ & $\HilbFunc{H}{n} \hookrightarrow \Hilb_k(\mathbb{A}^n, 0)$\\
    The locus of Gorenstein algebras with fixed Hilbert function $H$ &
    $\HilbFuncGor{H}{n}$\\
    The locus of homogeneous elements & $\Hilb_k^{\Gmult}(\mathbb{A}^n)$\\
    The locus of homogeneous elements with fixed Hilbert function $H$ & $\Hilb_H^{\Gmult}(\mathbb{A}^n)$
\end{tabular}
\goodbreak

    \section*{Acknowledgements}

    The authors would like to thank Jaros{\l{}}aw Buczy{\'n}ski and Tadeusz
    Januszkiewicz for sharing their idea about extending the notion of
    regularity to Grassmannians and for the permission to pursue this idea
    here. The first author is supported by Polish NCN grant
    2020/39/D/ST1/00132.

\section{Preliminaries}
In this section, we collect some basic facts and notations regarding the
Hilbert function, the Macaulay inverse system, and the tangent space to the
Hilbert scheme of points, used throughout this article. We work over an
algebraically closed field $\mathbb{k}$ of characteristic zero. We set
$\gr(r,n):=\dim \Gr(r,n)=r(n-r)$ for the dimension of the Grassmannian
$\Gr(r,n)$. Recall that we work over an algebraically closed field
    $\mathbb{k}$ of characteristic zero.
    All computations below and in the introduction are available as an
    \emph{Macaulay2} ancillary file for the arXiv version of this paper.

\subsection{Socle and Hilbert function}
Let $R=\mathbb{k}[[x_1, \ldots ,x_n]]$ be the power series ring in $n$ variables and the maximal ideal $\mm=(x_1, \ldots,x_n)$. Let $A=R/I$ be a local Artin ring for an $\mm$-primary ideal $I\subset R$,
with the unique maximal ideal $\mathfrak{n}=\mm/I$ and residue field $\mathbb{k}$.
Recall that an \emph{$\mm$-primary ideal} is just an ideal $I$ such that
$I\supset \mm^r$ for some $r$. Since for every $r$ we have
canonically
\begin{equation}\label{eq:ringchange}
    \frac{\mathbb{k}[[x_1, \ldots ,x_n]]}{\mm^r}  \simeq
    \frac{\mathbb{k}[x_1,  \ldots , x_n]}{(x_1, \ldots,x_n)^r}
\end{equation}
we could view $A$ as a quotient of $\mathbb{k}[x_1, \ldots ,x_n]$ by an ideal $I$
satisfying $I\supset (x_1, \ldots ,x_n)^r$ for some $r$.

\textit{The socle} $\Soc(A)$ of $A$, is defined as the annihilator of the maximal ideal in $A$.
The socle is a $\mathbb{k}$-vector space. \textit{The socle dimension} of $A$ is
defined by $\tau(A):=\dim_{\mathbb{k}}\Soc(A)$. The ring $A$ is called
\emph{Gorenstein} if
$\tau(A)=1$, see for example~\cite[Chapter~21]{EisView}. We denote by
$\HilbFuncGor{H}{n}\subset \HilbFunc{H}{n}$ the locus of Gorenstein algebras
with Hilbert function $H$. This is an open locus.
The \emph{associated graded ring of $A$} denoted $\gr(A)$ is the vector space
$\bigoplus_{i\geq
0}\mathfrak{n}^i/\mathfrak{n}^{i+1}$ with natural multiplication. When $A
\simeq
\mathbb{k}[x_1, \ldots ,x_n]/I$, where $I\supset (x_1, \ldots ,x_n)^r$, then $\gr(A)
\simeq \mathbb{k}[x_1, \ldots ,x_n]/\mathrm{in}(I)$, where $\mathrm{in}(I)$ is the
ideal
generated by lowest degree forms of elements of $I$. Unfortunately, we have
$\tau(\gr A) \geq \tau(A)$ and strict inequality holds in general.

\begin{definition}
The Hilbert function $H:\mathbb{N}\rightarrow \mathbb{N}$ of a local ring $A$
with maximal ideal $\mathfrak{n}$ is defined by $H(i):=\dim_{\mathbb{k}}
\mathfrak{n}^i/\mathfrak{n}^{i+1}$. It is the Hilbert function of its
associated graded ring.
\end{definition}

Let $s$ denote the largest integer such that $\mathfrak{n}^s\neq 0$, the
so-called \textit{socle degree} of $A$. The Hilbert function of $A$ can be
then represented by a vector $ H=(1,H(1),\ldots, H(s))$ or a series
$\sum_{i=0}^s H(i)T^i$. Moreover, since $\mathfrak{n}^{s}\subset \Soc(A)$, we
get $H(s)\leq \tau(A)$.

\subsection{Macaulay's Inverse Systems}
Let $S=\mathbb{k}[y_1,\ldots,y_n]$ be the polynomial ring with $n$ variables
(, though we will never use its ring structure). The
ring $R$ acts on $S$ by the contraction map $\circ:R\times S \rightarrow S$
defined as follows:
\[
    x^\alpha\circ y^\beta:=\begin{cases}
        y^{\beta-\alpha} & \beta\geq  \alpha\\
        0 & \mbox{otherwise}
    \end{cases}
\]
where $\alpha=(\alpha_1,\ldots,\alpha_n)$ and $\beta=(\beta_1,\ldots,\beta_n)$
are vectors in $\mathbb{N}^n$, and $\beta\geq \alpha$ if  $\beta_i\geq
\alpha_i$ for all $1\leq i\leq n$. With this action, $S$ can be viewed as an
$R$-module. In fact, the contraction map is up to scalars equivalent to the
action of $R$ on $S$ as partial derivation, see for
example~\cite[Proposition~2.8]{Jel_classifying}.
\begin{definition}
Let $I\subset R$ be an $\mm$-primary ideal of $R$. The
Macaulay \emph{inverse system of $I$} is
\[
    I^{\perp}=\lbrace g\in S: \ \ I\circ g=0\rbrace.
\]
This is an $R$-submodule of $S$. Its generators are called
\emph{dual generators} of $I$.
Given a subset $E \subset
S$, the annihilator of $E$ is the ideal
\[
    \Ann_R(E)=\lbrace f\in R: \ \ f\circ E=\{0\} \rbrace,
\]
which is called the \emph{apolar ideal} of $E$.
\end{definition}
Note that $\Ann_R(E) = \Ann_R(M)$, where $M = R\cdot E$ is the $R$-submodule
of $S$ generated by $E$. If $I$ is a homogeneous ideal, then
$I^{\perp}$ is spanned by homogeneous polynomials, and if $E$ is spanned by
homogeneous elements, then $\Ann_R(E)$ is homogeneous. Also if $I\supset
\mm^r$ then $I^{\perp} \subset S_{<r}$.
We will often abbreviate $\Ann_R(-)$ to $\Ann(-)$. The above constructions are
justified by the following theorem.

\begin{theorem}[Macaulay's duality]
    For every $\mm$-primary ideal $I$ of $R$ and finitely generated
    $R$-submodule $M\subset S$ we have $\Ann_R(I^{\perp}) = I$ and
    $(\Ann_R(M))^{\perp} = M$. In this way, the operations $\perp$ and $\Ann_R(-)$ give
    an order-reversing bijection between finitely generated $R$-submodules of
    $S$ and $\mm$-primary ideals of $R$. Moreover, the $R$-module
    $I^\perp$ is minimally generated by $\tau(R/I)$ elements. In particular,
    the local Artin ring $A=R/I$ is Gorenstein of socle degree $s$ if and only
    if $I^\perp$ is a principal $R$-module generated by a polynomial of degree $s$.
\end{theorem}

\begin{proposition}[parameterizing by polynomials vs by the Hilbert
    scheme]\label{ref:polynomialsAndGorensteinAlgebras:prop}
    For a Hilbert function $H$ with $k = \sum H$ consider the set $\mathcal{L}_H$ of all polynomials $f$ such
    that $R/\Ann(f)$ has Hilbert function $H$; this is a locally closed
    subset of $S_{<k}$. Then there is a smooth surjective map
    $\mathcal{L}_H\to \HilbFuncGor{H}{n}$ whose fibers are
    $k$-dimensional. In particular, we have
    \[
        \dim \HilbFuncGor{H}{n} = \dim \mathcal{L}_H - k
    \]
\end{proposition}
\begin{proof}
    Endow $\mathcal{L}_H$ with its locally-closed reduced subscheme structure.
    By~\cite[Proposition~2.12]{jelisiejew_VSP} there is a finite flat family
    over $\mathcal{L}_H$ and it induces a morphism $\mathcal{L}_H\to
    \HilbFuncGor{H}{n}$.
    By~\cite[Proposition~2.10]{jelisiejew_VSP} this map satisfies
    infinitesimal lifting property, hence is smooth. The fiber over $Z\subset
    \mathbb{A}^n$ consists of all possible $f$ with $\Ann(f) = I(Z)$.
    By, for example, the discussion at the beginning
    of~\cite[\S2.3]{Jel_classifying}, for one given such $f_0$ other possible
    $f$ are uniquely parameterized as $f=r\circ f_0$, where $r\in
    R=\mathbb{k}[[x_1, \ldots ,x_n]]$ is a unit. Since $r$ can chosen modulo
    $\Ann(f_0)$ and, so chosen, is unique, the fiber
    admits a bijective-on-points map from the unit group of $R/\Ann(f_0)$.
    This unit group is $k$-dimensional, hence so is the fiber.
\end{proof}

\subsection{Tangent space to the Hilbert scheme and its computation}
In this section, we briefly explain how to compute the tangent space to the
Hilbert scheme of points. In this section it is much more convenient to
consider quotients of $\mathbb{k}[x_1, \ldots ,x_n]$ instead of $\mathbb{k}[[x_1, \ldots
,x_n]]$, which we do by a slight abuse of notation, see discussion
around~\eqref{eq:ringchange}.

It is classically known that the tangent space at a point $Z\subset \AA^n$ of
the Hilbert scheme $\Hilb_k(\AA^n)$, given by the ideal $I\subset R =
\mathbb{k}[x_1, \ldots ,x_n]$ is
isomorphic to $\Hom_R(I, R/I)$, see~\cite{Stromme_Hilbert}.
When $I$ is a homogeneous ideal, the tangent space has a structure of a graded
$R$-module $\Hom_R(I,R/I)=\bigoplus_{d\in \mathbb{Z}}\Hom_R(I,R/I)_d$,
with $\Hom_R(I,R/I)_d$
    consisting of all homomorphisms $\varphi\colon I\to R/I$ of $R$-modules such that $\varphi(I_i) \subset
    (R/I)_{i+d}$ for all $i$. We set
    \[
        \Hom_R(I,R/I)_{>0} := \bigoplus_{i>0} \Hom_R(I,R/I)_i
    \]
    and call this the positive part of tangent space. As described
    in~\S\ref{ssec:proofIdeas}, the local dimension of the
    $\Hilb_k^+(\AA^n,0)$ at a $\Gmult$- fixed point $Z$ is governed by the
    non-negative part of the tangent space. Similarly we define $\Hom_R(I,
    R/I)_{\geq 0}$.

    For $I$ a monomial ideal, we use the representation of the generators of
    the ideal, and the syzygy relations among them to compute the dimension of
    each graded piece of $\Hom(I, R/I)$. More precisely, let
    $I=(m_1,\ldots,m_q)$ be a monomial ideal. By basics of computational
    commutative algebra, see~\cite[Proposition~II.5]{cox:ideals}, the first syzygy module of $I$ is (often not minimally) generated by the following $q \choose 2$ vectors
    $$ \sigma_{ij}:=\frac{\lcm(m_i,m_j)}{m_i}e_i-\frac{\lcm(m_i,m_j)}{m_j}e_j,\qquad 1\leq i<j\leq q, $$
    where $e_i$ is the $i$-standard vector of the free module $F$ mapping to $m_i$ under the first map $F\longrightarrow I$ of a free resolution of $I$, and $\lcm(m_i,m_j)$ denotes the least common multiple of the two monomials $m_i,m_j$.
    This way, the tangent space computation becomes combinatorial, and reduces to a standard syzygy computation of a monomial ideal, simply obtained by the pairwise least common multiple of the generators. We demonstrate this computation in the following example.
    \begin{example}
      Let $I=(x_1^3, x_2^2, x_1x_3, x_1x_2, x_3^4)\subset R=\mathbb{k}[x_1,x_2,x_3]$ with the Hilbert
      function $H=(1,3,3,2,1)$ and inverse system $I^{\perp}$ generated by
      $y_2y_3^3$
      and $y_1^2$, so that $(R/I)_3$ is spanned by the images of $x_2x_3^2$
      and $x_3^3$, while $(R/I)_4$ by $x_2x_3^3$.
      In this case, the six syzygy relations $\sigma_{13},\sigma_{14},
      \sigma_{24}, \sigma_{25}, \sigma_{34}, \sigma_{35} $ generate the syzygy
      module of $I$ minimally, while $\sigma_{12},\sigma_{15},\sigma_{23},
      \sigma_{45}$ are redundant and can be given as polynomial combinations
      of the first six. Now, let $\phi:I\longrightarrow R/I$ be a homomorphism
      of positive degree $d>0$. We note that since $H(5)=0$, for any such a
      homomorphism $\phi(x_3^4)=0$, and we only need to consider the image of
      $\phi$ on the first four generators. If $d\geq 3$, then $\phi=0$. If
      $d=2$, then $x_1^3$ is mapped to zero and the quadric generators
      $x_2^2,x_1x_3,x_1x_2$ are mapped to $ax_2x_3^3, bx_2x_3^3, cx_2x_3^3$ for arbitrary
      $a,b,c\in \mathbb{k}$. This implies that $\dim  \Hom(I,R/I)_2=3$. If $d=1$, then we have
      \begin{align*}
        \phi(x_1^3)&=\lambda x_2x_3^3,\qquad \qquad \phi(x_2^2)=a_1x_2x_3^2+a_2x_3^3\\
 \phi(x_1x_3)&=b_1x_2x_3^2+b_2x_3^3,\quad \phi(x_1x_2)=c_1x_2x_3^2+c_2x_3^3.
      \end{align*}
      Then, from the syzygy $\sigma_{34}$ we have $x_2\phi(x_1x_3)=x_3\phi(x_1x_2)$ which
      implies $c_1=b_2$. Similarly, from $\sigma_{24}$, we have
      $x_1\phi(x_2^2)=x_2\phi(x_1x_2)$ which imposes $c_2=0$. The remaining
      coefficients $\lambda,a_1,a_2,b_1,b_2$ can be chosen arbitrary, which proves that $\dim \Hom(I,R/I)_1=5$. Hence, we obtained that the positive part of the Hilbert series of the tangent space to $\Hilb_{10}(\AA^3)$ at the point $I$, is given by $5T+3T^2$, and $\dim \Hom(I,R/I)_{>0}=8$.
    \end{example}
    Although such computations can be done by hand, we usually use the
    computer algebra system \textit{Macaulay2} to compute the tangent space
    quickly in explicit cases, most of them related to monomial ideals. See
    Proposition~\ref{ref:tangentSpacesToCells:prop} for a
    further example of such computations.

\section{Irreducibility of punctual Hilbert schemes on threefolds}\label{Irreducibility}

\subsection{Preliminaries}\label{sec:irreducibilitypreliminaries}

Let $\Sym_k(\mathbb{A}^n) = (\mathbb{A}^n)^k \goodquotient \mathbb{S}_k$ be the $k$-fold symmetric product of
$\mathbb{A}^n$. The Hilbert-Chow morphism $\rho_k\colon
\Hilb_k(\mathbb{A}^n)\to \Sym_k(\mathbb{A}^n)$ sends a finite scheme
$Z\subset \mathbb{A}^n$ to its support counted with multiplicities. It
extends to a morphism $\bar{\rho}_k\colon \Hilb_k(\mathbb{P}^n)\to
\Sym_k(\mathbb{P}^n)$ and we have a cartesian diagram
\[
    \begin{tikzcd}
        \Hilb_k(\mathbb{A}^n)\ar[r, "\rho_k"]\ar[d, hook, "open"] &
        \Sym_k(\mathbb{A}^n)\ar[d, hook, "open"]\\
        \Hilb_k(\mathbb{P}^n) \ar[r, "\bar{\rho}_k"] & \Sym_k(\mathbb{P}^n)
    \end{tikzcd}
\]
The \emph{punctual Hilbert scheme} is defined as $\Hilb_k(\mathbb{A}^n, 0) :=
\rho_k^{-1}(d[0]) = \bar{\rho}_k^{-1}(d[0])$, where $0\in \mathbb{A}^n$ is the
origin. In plain words, it consists of subschemes supported only at the
origin. Its description by $\bar{\rho}_k$ implies that this scheme is
projective.
The Hilbert scheme has a distinguished irreducible component:
 the \emph{smoothable component} $\HilbSmk(\mathbb{A}^n)$,
which parameterizes schemes that are limits of reduced schemes.
We obtain the corresponding locus
\[
    \HilbSmk(\mathbb{A}^n, 0) := \Hilb_k(\mathbb{A}^n, 0)\cap
    \HilbSmk(\mathbb{A}^n)
\]
which is in general only a union of irreducible components of
$\Hilb_k(\mathbb{A}^n, 0)$. As discussed in the introduction, we will
establish its dimension in special cases. We begin with some lower bounds.

\begin{proposition}[weak purity of the total branch
    locus]\label{ref:purity:prop}
    Let $f\colon X\to S$ be a finite flat degree $d$ morphism of schemes locally of
    finite type over $\mathbb{k}$. Assume $f$ is generically \'etale. Consider the locus
    \[
        \mathcal{Z} := \left\{ s\in S\ |\ \mbox{ the geometric fiber } f^{-1}(s)\mbox{ has only one point} \right\}
    \]
    This is a closed subset of $S$ and for every $z\in \mathcal{Z}$ we have
    $\dim_{z} \mathcal{Z} \geq \dim_z S - (d-1)$.
\end{proposition}
\begin{proof}
    \def\pp{\mathfrak{p}}%
    Closedness of $\mathcal{Z}$ is well-known, for example~\cite[\href{https://stacks.math.columbia.edu/tag/0BUI}{Tag 0BUI}]{stacks_project}.
    The statement on the dimension is local around $z$, so we may replace $S$ be a component
    through $z$ which has dimension $\dim_z Z$. Next, we reduce to the
    situation when $f\colon X\to S$ has $d$ sections $s_1, \ldots ,s_d$ such
    that $X = \bigcup s_i(S)$.
    Assume we have already $k$ sections $s_1, \ldots ,s_k$, where $k$ is
    possibly zero.
    Suppose $X \neq \bigcup s_i(S)$, take any irreducible component $S'$ of $X$ other than
    $s_1(S)$, \ldots ,$s_k(S)$ and view it with reduced
    scheme structure. Consider the
    base change
    \[
        \begin{tikzcd}
            X' := X\times_S S' \ar[r]\ar[d, "f'"] & X\ar[d,
            "f"]\\
            S' \ar[r] & S
        \end{tikzcd}
    \]
    The map $f'$ is finite flat degree $d$ by base change. Since $f$ is flat,
    it is torsion free, so every component of $X$ dominates $S$. Moreover $f$
    is closed as a finite map. Thus $S'\to S$ is onto and so $f'$ is
    generically \'etale.
    This map has $k+1$ sections: $k$ sections $s_i \times \id$ and an
    additional section $i\times \id$ that comes from $i\colon S'\to X$. The
    intersections of every two of these sections with a fiber over a general
    point of $S'$ are disjoint, hence indeed we obtained $k+1$ disjoint
    sections (this in particular shows that one could not obtain $d+1$
    sections, so the procedure ends exactly for $k=d$).
    By replacing $S$ as above, we assume $f\colon X\to S$ is such that $X =
    \bigcup_{i=1}^d X_i$, where $f|_{X_i}\colon X_i\to S$ are isomorphisms.
    We finally replace $S$ by its normalization (which is a finite surjective
    map since $S$ was a finite type variety) and shrink it so that $S =
    \Spec(A)$ is affine and $X = \Spec(B)$ where $B$ is a free $A$-algebra.

    We observe now that $X$ is connected in codimension one, which by
    definition means that $X\setminus Z$ is connected for every closed $Z$ of dimension
    $\dim Z \leq \dim S - 2$. Indeed, suppose not, then there exist nontrivial
    idempotents in $H^0(X\setminus Z, \OO_{X})$. Since $A$ is normal, we have
    $A = \bigcap\left\{ A_{\pp}\ |\ \pp\in \Spec(A), \dim(A/\pp) =
    \dim(A) - 1\right\}$. Since $B$ is a free $A$-module, we have
    \[
        B = \bigcap\left\{ B_{\pp}\ |\ \pp\in \Spec(A), \dim(B/\pp) =
    \dim(A) - 1\right\},
    \]
    where $B_{\pp} = (A\setminus \pp)^{-1}B$.
    Therefore, the idempotents above uniquely extend to global sections
    $H^0(X, \OO_X)$ which are idempotents themselves; so $X$ is disconnected.
    But this is absurd, since the unique preimage of $z$ lies in every
    irreducible component $X_i$. This concludes the proof that $X\setminus Z$
    is connected.

    The locus where $f\colon X\to S$ is not \'etale is, locally near $z$,
    given by a single
    equation~\cite[\href{https://stacks.math.columbia.edu/tag/0BVH}{Tag~0BVH}]{stacks_project}. This locus coincides with the locus of $s\in
    S$ such that in $f^{-1}(s)$ two of the components $X_1$, \ldots , $X_d$
    coincide. Consider the graph with vertices $X_i$ and an edge joining $X_i$
    and $X_j$ iff $\dim(X_i\cap X_j) = d-1$. If this graph is disconnected,
    then $X$ is not connected in codimension one. Hence this graph is
    connected and we may choose a spanning tree $e_1 = (X_{i_1}, X_{j_1}),
    \ldots , e_{d-1} = (X_{i_{d-1}}, X_{j_{d-1}})$. The image $S_{i}$ of $X_{i_1} \cap
    X_{i_2}$ is a codimension one subvariety of $S$ that contains $z$, so
    the intersection $S_1 \cap S_2 \cap  \ldots \cap S_{d-1}$ is near $z$ a
    subscheme of codimension at most $d-1$, see for example~\cite[Chapter 10,
    10.2, 10.5, 10.6]{EisView}. For every point $z'$ of this
    intersection consider the fiber $F = f^{-1}(z')$. By assumption, the
    intersection $F\cap X_{i_k}\cap X_{j_k}$ is nonempty for every $k$. But
    $F\cap X_{i_k} = F\cap s_i(S)$ is (as a scheme!) a point, and similarly for $F\cap
    X_{j_k}$. This shows that $F\cap X_{i_k} = F\cap X_{j_k}$ for every $k$.
    Since we iterate over a spanning tree of a graph with vertices $X_1$,
    \ldots , $X_d$, we deduce that topologically $|F|\cap |X| = |F| \cap
    \bigcup_{i} |X_i| = \bigcup_{i} |F|\cap |X_i|$ is a point. Therefore,
    $z'\in \mathcal{Z}$ and so $S_1 \cap S_2 \cap  \ldots \cap S_{d-1}\subset
    \mathcal{Z}$ which concludes the proof.
\end{proof}

As a Corollary, we get the following result, whose latter part was proven
classically by different methods in~\cite[Theorem~3.5]{Gaffney}.
\begin{proposition}\label{ref:componentsLowerBound:prop}
    The codimension of $\Hilb_k(\mathbb{A}^n, 0)\subset \Hilb_k(\mathbb{A}^n)$
    at every its point is at most $n+k-1$. In particular, the dimension of
    $\HilbSmk(\mathbb{A}^n, 0)$ at every its point is at least $(n-1)(k-1)$.
\end{proposition}
\begin{proof}
    By Proposition~\ref{ref:purity:prop} applied to the universal family of
    $\Hilb_k(\mathbb{A}^n)$ we get that the locus $\mathcal{Z} \subset
    \Hilb_k(\mathbb{A}^n)$ parameterizing schemes supported at a single point
    has codimension at most $k-1$. This locus is naturally fibered over
    $\mathbb{A}^n$ by sending the scheme to its support (more formally, this
    map comes from restricting the Hilbert-Chow map). The locus
    $\Hilb_k(\mathbb{A}^n, 0)$ is a fiber of $\mathcal{Z}$, hence has
    codimension at most $k-1+n$.
    The second part of the statement follows because at every point of the smoothable
    component the dimension of the Hilbert scheme is at least $nk$, so the
    dimension of the punctual locus is at least $nk-(n+k-1) = (n-1)(k-1)$.
\end{proof}

Iarrobino~\cite[p.310]{iarrobino_10years} asked whether the lower bound
$(n-1)(k-1)$ from Proposition~\ref{ref:componentsLowerBound:prop} holds for
every component of $\Hilb_k(\mathbb{A}^n, 0)$. Recently, Satriano and
Staal~\cite{Satriano_Staal}
gave a negative answer already for $n=4$.

\subsection{Dimension counts for up to $11$ points on $\mathbb{A}^3$}

In this subsection we prove irreducibility of $\Hilb_k(\mathbb{A}^3, 0)$ for
$k\leq11$. As explained in the introduction, having
Proposition~\ref{ref:componentsLowerBound:prop}, the main difficulty is in
proving that all cells but one have dimension smaller than expected. We do it
by bounding the dimension of their tangent spaces.
\begin{proposition}\label{ref:tangentSpacesToCells:prop}
    Consider Borel-fixed ideals $I \subset \mathbb{k}[x_1, x_2, x_3]$ such that
    $\dim_{\mathbb{k}} \mathbb{k}[x_1, x_2, x_3]/I \leq 11$. Then
    \[
        D(I) := \dim_{\mathbb{k}} \left(T_{[I]} \Hilb_k(\mathbb{A}^3)\right)_{\geq 0} - 2(k-1)
    \]
    is negative for all of them with the exception of the following ideals:
    \begin{enumerate}[label=(\roman*)]
        \item  $I = (x_1, x_2, x_3^k)\mbox{ where } D(I) = 0$,
        \item\label{ex:1331} $I =
            (x_2^2,x_1x_2,x_1^2,x_2x_3^2,x_1x_3^2,x_3^4)\mbox{ where } D(I) =
            0$ and $H_{R/I} = (1,3,3,1)$,
        \item\label{ex:13311} $I = (x_2^2,x_1x_2,x_1^2,x_2x_3^2,x_1x_3^2,x_3^5)\mbox{ where } D(I) =
            0$ and $H_{R/I} = (1,3,3,1,1)$,
        \item\label{ex:13321a} $I = (x_1x_3,x_1x_2,x_1^2,x_2^2x_3,x_2^3,x_2x_3^3,x_3^5)\mbox{ where }
            D(I) = 0$ and $H_{R/I} = (1,3,3,2,1)$,
        \item\label{ex:133111} $I = (x_2^2,x_1x_2,x_1^2,x_2x_3^2,x_1x_3^2,x_3^6) \mbox{ where } D(I) =
            0$ and $H_{R/I} = (1,3,3,1,1,1)$,
        \item\label{ex:13321b} $I = (x_2^2,x_1x_2,x_1^2,x_1x_3^2,x_2x_3^3,x_3^5) \mbox{ where } D(I)
            = 2$ and $H_{R/I} = (1,3,3,2,1)$,
        \item\label{ex:133211a} $I = (x_1x_3,x_1x_2,x_1^2,x_2^2x_3,x_2^3,x_2x_3^3,x_3^6) \mbox{ where }
            D(I) = 0$ and $H_{R/I} = (1,3,3,2,1,1)$,
        \item\label{ex:1331111} $I = (x_2^2,x_1x_2,x_1^2,x_2x_3^2,x_1x_3^2,x_3^7) \mbox{ where } D(I) =
            0$ and $H_{R/I} = (1,3,3,1,1,1,1)$,
        \item\label{ex:133211b} $I = (x_2^2,x_1x_2,x_1^2,x_1x_3^2,x_2x_3^3,x_3^6) \mbox{ where } D(I) =
            2$ and $H_{R/I} = (1,3,3,2,1,1)$,
        \item\label{ex:13331} $I = (x_2^2,x_1x_2,x_1^2,x_2x_3^3,x_1x_3^3,x_3^5) \mbox{ where } D(I) =
            0$ and $H_{R/I} = (1,3,3,3,1)$,
        \item\label{ex:13421} $I = (x_1x_2,x_1^2,x_1x_3^2,x_2^2x_3,x_2^3,x_2x_3^3,x_3^5)\mbox{ where
            } D(I) = 1$ and $H_{R/I} = (1,3,4,2,1)$.
    \end{enumerate}
\end{proposition}
\begin{proof}
    Direct \emph{Macaulay2} check using the package
    \emph{StronglyStableIdeals}~\cite{StronglyStableIdeals}.
\end{proof}

Before we deal with bounding the dimensions of respective cells, we need to
consider separately two ``sporadic'' cases from the above ones, where $D(I)$ is too positive
to deal with it smoothly.

\begin{proposition}\label{ref:1m321:prop}
Let $H=(1,n,3,2,1)$. The Hilbert scheme $\HilbFuncGr{H}{n}$ set-theoretically
consists of the following loci:
\begin{enumerate}[label=(\arabic*)]
    \item\label{it:1m321easy} ideals orthogonal to $\ell_1^4, \ell_2^3,q$, where
        $\ell_1,\ell_2$ are two independent linear forms, and $q$ is a quadric
        independent from $\ell_1^2,\ell_2^2$. A locus parameterized by an open
        subset of $\Gr(1,n) \times \Gr(1,n) \times \Gr(1,\binom{n+1}{2} - 2)$, whence of
        dimension $2n+\binom{n+1}{2}-5$.
    \item\label{it:1m321easy2} ideals orthogonal to $Q$ and $q$, where $Q\in Sym^4(V)$ for a
        two-dimensional linear subspace $V\subset S_1$ is such that $Q$ has
        two-dimensional space of second-order partial derivatives and a
        quadric $q$ is independent from the second order partial derivatives of
        $Q$. This is an open subset of a divisor in $\Gr(2, n) \times
        \mathbb{P}(\Sym^4 \mathbb{k}^2) \times \Gr(1, \binom{n+1}{2} - 2)$, whence of dimension
        $2n+\binom{n+1}{2}-4$.
    \item\label{it:1m321last} ideals orthogonal to a general quartic in $\Sym^4(V)$ for a
        two-dimensional linear subspace $V\subset S_1$ (and all the linear
        forms in $S_1$). This gives a locus of dimension $2n$.
    \item\label{it:1m321subtle} ideals orthogonal to a perfect quartic $\ell^4$ and a non-perfect cubic
        $c$, whose first order partial derivatives together with $\ell^2$
        span a $3$-dimensional subspace. This gives a locus of dimension
        at most $3n-2$.
\end{enumerate}
\end{proposition}
\begin{proof}
 Let $I$ be the homogeneous ideal of an algebra with the given Hilbert
 function.  Since $I^\perp$ is generated (non-minimally) by a quartic, two
 cubics and three quadrics as an $R$-module, the
 possibilities~\ref{it:1m321easy}-\ref{it:1m321last} and the corresponding
 dimension counts are obvious. We only prove the bound on the dimension of the
 last locus.
 Let $\ell^4$ be a perfect quartic and let $c$ be a cubic
 whose partial derivatives together with $\ell^2$ generate a $3$-dimensional
 vector space.
 If $c$ does not depend essentially on three variables, then the
 upper bound $n-1 + \gr(2, n) + 3 = 3n-2$ follows immediately, so we suppose
 it does. Let $c\in \mathbb{k}[W]$, for $W\subset S_1$
 three-dimensional.
 We also assume that $c$ does not contain the monomial $\ell^3$.
 The choice of $c$ is then determined by a choice of a linear form $\alpha$
 such that $\alpha \circ c = \ell^2$ and a choice of an element in $\Sym^3V$,
 where $V$ is the two-dimensional space of linear forms in $W$ annihilated by $\alpha$.
 At most, we obtain a $\gr(3, n) + \dim \Gr(1, W) + \dim W^{\vee} + \dim
 \mathbb{k}[V]_3 = 3n$ dimensional choice. This parameterization is not one-to-one,
 as adding $\ell^3$ to $c$ and/or multiplying it by a nonzero scalar does not
 change the system. Therefore, the final estimate is $3n-2$, as claimed.
 \end{proof}
\begin{remark}\label{ref:1m3211:rem}
By the very same argument as in Proposition~\ref{ref:1m321:prop}, for
$H=(1,n,3,2,1,1, \ldots , 1)$, with at least two trailing ``1'', the Hilbert scheme $\HilbFuncGr{H}{n}$ consists of two loci, parameterizing ideals analogous to the ideals
in~\ref{it:1m321easy} and~\ref{it:1m321subtle},
and with same dimension estimates, respectively.
\end{remark}

\begin{proposition}\label{ref:13421:prop}
Let $H=(1,3,4,2,1)$. The Hilbert scheme $\HilbFuncGr{H}{3}$ consists of the following loci:
\begin{enumerate}[label=(\arabic*)]
\item ideals dually generated by $\ell_1^4,\ell_2^3$ for a two independent $\ell_1,\ell_2\in S_1$, and two quadrics $q_1,q_2$ independent from $\ell_1^2,\ell_2^2$. This is a locus of dimension $8$.
\item ideals orthogonal to a non-perfect quartic $Q$ in $\Sym^4(V)$ for a
        two-dimensional linear subspace $V\subset S_1$, that has two-dimensional space of partial derivatives and two
        quadrics $q_1,q_2$ independent from the second order partial derivatives of
        $Q$. A locus parameterized by an locally-closed subset of $\Gr(2, 3) \times
        \mathbb{P}(\Sym^4 \mathbb{k}^2) \times \Gr(2, 4)$, whence of dimension at most
        $(2 + 4 + 4) -1 = 9$.
\item ideals dually generated by a perfect quartic $\ell^4$ and a general
    cubic (taken modulo the $\ell^3$ term) giving a locus of dimension $10$.
\item ideals dually generated by a general quartic in $Sym^4(V)$ for a two dimensional linear subspace $V\subset S_1$, and quadric independent from the $3$-dimensional second order partial derivatives of $c$. This is a locus of dimension $8$.
\item \label{it:13421subt} ideals dually generated by a perfect
quartic $\ell^4$, and a non-perfect cubic $c\in Sym^3(S_1)$, and a quadric $q$
independent from partial derivatives of $c$ and $\ell^2$. This gives a
locus of bounded dimension $9$.
\end{enumerate}
\end{proposition}
\begin{proof}
We only note that the bound $9$ in \ref{it:13421subt}
follows from the bound $7$ in part \ref{it:1m321subtle} from Proposition \ref{ref:1m321:prop} added up with $2$ the choice of a quadric $q$.
\end{proof}

\begin{proposition}\label{ref:smallExceptionalCells:prop}
    The Bia{\l{}}ynicki-Birula{} cell of $(x_1, x_2, x_3^k)$ is $2(k-1)$-dimensional, while
    the cells for all other exceptional ideals from
    Proposition~\ref{ref:tangentSpacesToCells:prop} have dimension strictly less
    than $2(\deg(I) - 1)$. Moreover, the point $(x_1, x_2, x_3^k)$ is a smooth
    point of its Bia{\l{}}ynicki-Birula{} cell.
\end{proposition}
\begin{proof}
    Consider first the curvilinear ideal $I = (x_1, x_2, x_3^k)$. We directly see that the dimension
    of its tangent space is $2(k-1)$. Moreover, for every $f_1, f_2\in
    (tk[t])_{\leq k-1}$ the ideal $(x_1 - f_1(x_3), x_2 - f_2(x_3), x_3^k)$
    lies in the Bia{\l{}}ynicki-Birula{} cell of $I$. Hence this cell has dimension at least
    $2(k-1)$. Together with the tangent space dimension, this implies that
    $[I]$ is a smooth point of its $2(k-1)$-dimensional Bia{\l{}}ynicki-Birula{} cell. (This
    is a well-known fact.)

    Consider now the remaining ideals $I$. First pick any of them with
    $D(I) = 0$. Suppose that its cell is $2(k-1)$-dimensional. Then $D(I) = 0$
    implies that $[I]$ is a smooth point of its cell.
    Suppose $I'$ is a homogeneous ideal and suppose there is a torus action on
    $\AA^3$ such that in the induced action on $\Hilb_k(\mathbb{A}^3)$
    the point $[I']$ converges to $[I]$. The
    curve $[I_t]$ degenerating $[I']$ to $[I]$ lies in the $\Gmult$-fixed locus and
    in particular in the Bia{\l{}}ynicki-Birula{} cell $\mathcal{C}$ of $I'$. Since $[I]$ is a smooth point
    of $\mathcal{C}$, the smooth locus of $\mathcal{C}$ intersects the curve
    $[I_t]$ non-trivially, so is an open, $\Gmult$-stable subset of $[I_t]$
    containing its unique fixed point; thus the smooth locus contains
    $\mathcal{C}$ and in particular $[I']$ is a smooth point of this cell,
    hence in particular
    \[
        \left(T_{[I']} \Hilb_k(\mathbb{A}^3)\right)_{\geq 0} = 2(k-1).
    \]
    By semicontinuity of each graded piece of the tangent space, we even
    obtain
    \[
        \left(T_{[I]} \Hilb_k(\mathbb{A}^3)\right)_{i} =\left(T_{[I']}
        \Hilb_k(\mathbb{A}^3)\right)_{i} \quad \mbox{for all}\quad i\geq 0.
    \]
    It is enough to exhibit an ideal $I'$ violating this last condition. Below
    we give a list of those, in each case pointing out the differing
    degree.
    In all cases we fix a $\Gmult$-action $t\cdot (y_1, y_2, y_3) =
    (t^{a_1}y_1, t^{a_2}y_2, t^{a_3}y_3)$ with $a_1 \gg a_2 \gg
    a_3$ and consider the limit at $t\to 0$, so the initial form of a
    homogeneous polynomial is its
    lex-largest monomial in $S$.
    \begin{itemize}
        \item[\ref{ex:1331}, \ref{ex:13311}, \ref{ex:133111},
            \ref{ex:1331111}] consider the apolar ideal of $y_1^2+y_1y_3, y_2y_3,
            y_3^{3+i}$, degree $i$ for $i=0,1,2,3$, respectively.
        \item[\ref{ex:13321a}, \ref{ex:133211a}] consider the apolar ideal of $y_1^2+y_2^2,
            y_2y_3^2, y_3^{4+i}$, degree $0$ for $i=0,1$, respectively.
        \item[\ref{ex:13331}] consider the apolar ideal of $y_1y_3^2 +
            y_2^2y_3, y_2y_3^2, y_3^4$, degree $1$.
    \end{itemize}
        In the case~\ref{ex:13321b}, by Proposition~\ref{ref:1m321:prop} we see
        that the $\Gmult$-fixed locus near this point has dimension at most $8$,
        while the degree zero part of the tangent space at $[I]$ has dimension
        $10$. By the base-and-tangent-to-fiber estimate, the cell
        of $[I]$ has dimension at most $2\cdot (10-1) + D(I) - 2 = 2\cdot (10-1)$. Suppose
        that the cell has dimension exactly $2\cdot (10-1)$.
        Then the dimension of the fiber of $\pi$ at $[I]$ coincides with $\dim_{\mathbb{k}}
        \left(T_{[I]}\Hilb_{10}(\mathbb{A}^3)\right)_{\geq 1} = 10$, so this
        fiber is smooth of dimension $10$.
        The locus of points  in $\Hilb^{\Gmult}_{10}(\mathbb{A}^3)$ for which the fibers of $\pi$ are smooth is open, so
        also the fibers of nearby points in $\Hilb^{\Gmult}_{10}(\mathbb{A}^3)$ are smooth of dimension $10$ and so the
        \emph{strictly positive} degree parts of the tangent spaces are
        constant.
        However the ideal $I'$ apolar to $y_1^2 + y_1y_3, y_2y_3^2, y_3^4$ has
        tangent space dimension differing in degree $1$, which gives a
        contradiction. The very same argument works in the
        case~\ref{ex:133211b} with Remark~\ref{ref:1m3211:rem}, the ideal $I'$ apolar to $y_1^2 + y_1y_3, y_2y_3^2,
        y_3^5$ and degree $2$.

        In the case~\ref{ex:13421} the degree zero part of the tangent space
        is $12$-dimensional, while the
        possible homogeneous inverse
        systems are at most $10$-dimensional by
        Proposition~\ref{ref:13421:prop}, so by the base-and-tangent-to-fiber
        estimate the cell has dimension at
        most $2(k-1) - 1$. This concludes the last case and the whole proof.
    \end{proof}

\begin{proof}[Proof of Theorem~\ref{ref:irreducibility}]
   By~\cite{DJNT} we have $\Hilb_k(\mathbb{A}^n) = \HilbSmk(\mathbb{A}^n)$.
    Suppose $\HilbSmk(\mathbb{A}^n, 0)$ is reducible. By
    Proposition~\ref{ref:componentsLowerBound:prop} each of its
    components has dimension at least $2(k-1)$. These components are
    projective, so each of them has a Bia{\l{}}ynicki-Birula{} cell of dimension at least
    $2(k-1)$.
    Consider a $\Gmult$-fixed point $[I]$ of such a cell. The ideal $I$ is
    graded and its
    the nonnegative part of the tangent space has dimension at
    least $2(k-1)$.
    The generic initial ideal $I_0$ of $I$ is Borel-fixed. By semicontinuity, both
    its cell and the
    nonnegative part of its tangent space have dimension at least $2(k-1)$.
    But by
    Propositions~\ref{ref:tangentSpacesToCells:prop},~\ref{ref:smallExceptionalCells:prop}
    there is a single such point, corresponding to $I_0 = (x_1, x_2, x_3^k)$.

    The nonnegative part of the tangent space at $(x_1, x_2, x_3^k)$ has dimension
    \emph{exactly} $2(k-1)$.
    By semicontinuity again, the nonnegative part of the tangent space at $I$
    has dimension exactly $2(k-1)$. The deformation to the generic initial
    ideal is a curve inside the $\Gmult$-fixed locus, hence $I$ lies on the
    cell of $I_0$. But then since its tangent space has nonnegative part
    $2(k-1)$-dimensional, the point $[I]$ is a smooth point of
    $\Hilb_k^{+}(\mathbb{A}^n)$ so it lies in a single cell. The degeneration
    to $I_0 = (x_1, x_2, x_3^k)$ shows that $[I]$ lies in the curvilinear
    locus which is thus the unique cell containing $[I]$. Since $[I]$ was
    chosen in an arbitrary cell of dimension at least $2(k-1)$, this shows
    that there is a unique such component: the curvilinear
    locus.
    This concludes the proof.
\end{proof}

\section{Construction of regular maps to Grassmannian}\label{sec:regularMaps}

In this section we derive some existence statements for regular maps.
They generalize the upper bounds from~\cite{bjjm} and are proven using a
similar method, although the key is Proposition~\ref{ref:main:prop}, which
generalizes~\cite[Lemma~2.3]{bubu2010} (that actually refers
to~\cite{bgl2010}), has to proven in a bit subtler
way.

In this section $\mathbb{k} = \mathbb{C}$ and we consider $\mathbb{C}^n$ mostly as a
topological space with Euclidean topology.

\subsection{Reduction-to-small-socle lemma}\label{sec:reduce}

    \noindent Let $V$ be a $\mathbb{C}$-vector space and $\Gr(\tau{}, V)$ be the Grassmannian of its
    $\tau{}$-dimensional subspaces. Let
    \[
        \begin{tikzcd}
            U\arrow[r, hook, "cl"] & \Gr(\tau{}, V) \times V\arrow[d]\\
            & \Gr(\tau{}, V)
        \end{tikzcd}
    \]
    be the universal subbundle, which is a rank $\tau{}$ vector bundle over $\Gr(\tau{},
    V)$. For a finite scheme $Z$ with a morphism $Z \to \Gr(\tau{}, V)$ let
    $U_Z\hookrightarrow Z \times V$ be the pullback of
    this bundle to $Z$ and let $\spann{Z}$ be the linear space spanned in $V$
    by $\pr_2(U_Z)$, where $\pr_2\colon \Gr(\tau{}, V) \times V\to V$ is the projection.
    We stress that $\spann{Z}$ depends not only on $Z$ but also on the morphism $Z\to \Gr(\tau{}, V)$.

    \begin{example}\label{ex:reducedScheme}
        The motivation for the symbol $\spann{Z}$ is the case when $Z$ is a tuple
        of $k$ points. Then the map $Z\to \Gr(\tau, V)$ corresponds to choosing
        $k$ subspaces $W_1, \ldots ,W_k \subset V$ and so $\spann{Z} = W_1 +
         \ldots + W_k$. In particular, for $\tau = 1$ and for $Z \hookrightarrow \Gr(1,
         V) = \mathbb{P}(V)$ we get the usual notion of projective span of
         $Z$.
    \end{example}

    \begin{definition}\label{def:algebraicKregular}
        Let $X$ be an algebraic variety.
        A morphism $f\colon X\to \Gr(\tau, V)$ is
        \emph{$k$-regular} if
        for every tuple of $k$ distinct points $x_1, \ldots ,x_k\in
        X$ the linear space $\spann{f(x_1), \ldots ,f(x_k)}$ is
        $\tau k$-dimensional. A morphism $f\colon X\to \Gr(\tau,
        V)$ is \emph{strongly $k$-regular} if for every finite smoothable subscheme $Z\subset
        X$ of degree $k$ the linear space $\spann{Z}$ is $\tau
        k$-dimensional.
    \end{definition}
    In light of Example~\ref{ex:reducedScheme}, strongly regular maps are
    regular.\\

    For a finite irreducible scheme $Z$, let $c(Z) = \dim \Soc(H^0(Z, \OO_Z)) -
    1 = \tau(H^0(Z, \OO_Z)) - 1$. For example, $c(Z) = 0$ if and only if $Z$ is Gorenstein,
    see~\cite[Chapter~21]{EisView}.
    The following is the key result that will allow us to reduce from
    $\Hilb_k(\mathbb{A}^n, 0)$ to its sublocus $\Hilb_k^{\tau}(\mathbb{A}^n,
    0)$. It is a generalization
    of~\cite[Lemma~3.5 (iii)$\implies$(i)]{bgl2010}, which dealt with the case
    $\tau=1$.
    \begin{proposition}\label{ref:main:prop}
        Let $Z$ be a finite irreducible scheme with $c(Z) \geq \tau{}$. Then $\spann{Z} =
        \bigcup_{Z' \subsetneq Z} \spann{Z'}$. Consequently, the space
        $\spann{Z}$ is equal to
        $\bigcup\left\{ \spann{Z'} \ |\ Z' \subset Z, c(Z')<\tau \right\}$.
    \end{proposition}

    For the proof, we need the following auxiliary lemma.
    \begin{lemma}\label{ref:functionals:lem}
        Let $Z$ be a finite irreducible scheme with $c(Z) \geq \tau{}$.
        Let $\EE$ be a rank $\tau{}$ locally free sheaf on $Z$ and
        let $E = H^0(Z, \EE)$. Finally let $\varphi\colon E\to \mathbb{k}$ be a $\mathbb{k}$-linear map.
        Then there exists a proper subscheme $Z' \subsetneq Z$ and a
        linear map $E_{Z'} = H^0(Z', \EE|_{Z'}) \to \mathbb{k}$ such that $\varphi$
        factors as
        \[
            H^0(Z, \EE)\twoheadrightarrow H^0(Z', \EE|_{Z'}) \to \mathbb{k},
        \]
        where the first map comes from restricting $\EE$ to $Z'$.
    \end{lemma}
    \begin{proof}
        The sheaf $\EE$ is actually free, so we assume $\EE = \OO_Z^{\oplus
        \tau{}}$ and consequently $E = H^0(Z, \OO_Z)^{\oplus \tau{}}$. Let $i_k\colon
        H^0(Z, \OO_Z)\to E$ be the injection of the $k$-th factor. The space
        \[
            \bigcap_{k=1}^\tau{} \ker(\varphi \circ i_k)
        \]
        is a corank $\leq \tau{}$ subspace. By assumption
        $\dim_{\mathbb{k}}\Soc(H^0(Z, \OO_Z)) \geq \tau{}+1$, to this subspace intersects
        the socle nontrivially. Let $r$ be a non-zero
        element of this intersection. The subscheme $Z' = V(r)$ is the
        required one.
    \end{proof}

    \begin{proof}[Proof of Proposition~\ref{ref:main:prop}]
        \def\II{\mathcal{I}}%
        Let $0\to U\to \OO_{\Gr(\tau{}, V)}\otimes V \to Q\to 0$ be the universal
        sequence of locally free sheaves on $\Gr(\tau{}, V)$, where $U$ has rank
        $\tau{}$. Dualizing and taking symmetric powers we obtain the sequence
        \[
            0\to \mathcal{K}\to \OO_{\Gr(\tau{}, V)} \otimes \Sym(V^*)\to
            \Sym(U^*)\to 0
        \]
        where $\mathcal{K} = (Q^*)$ is the ideal sheaf generated by degree one
        elements and with $\mathcal{K}_1 = Q^*$; it is exactly the ideal sheaf of $U \hookrightarrow \Gr(\tau{},
        V)\times V$. Restricting this sequence to $Z$ we obtain the sequence
        \[
            0\to \mathcal{K}_Z\to \OO_{Z} \otimes \Sym(V^*)\to
            \Sym(\EE)\to 0
        \]
        where $\EE = U^*|_{Z}$ and so $\mathcal{K}_Z$ is the ideal sheaf of
        $U_Z \hookrightarrow Z \times V$.
        The ideal of $\pr_2(U_{Z})$ is $\mathcal{K}_Z \cap \Sym(V^*)$, where
        $\Sym(V^*)\hookrightarrow \OO_Z \otimes_{\mathbb{k}} \Sym(V^*)$ is the usual inclusion.
        Note that this ideal is homogeneous.
        Finally, the linear span of $\pr_2(U_{Z})$ is given by taking only the
        linear part of this ideal. So we discard the nonlinear parts of the
        above sequence and take global sections to obtain
        \[
            \begin{tikzcd}
                V^* \arrow[d]\arrow[rd, "\varphi"]\\
                H^0(Z, \OO_Z) \otimes_{\mathbb{k}} V^*\arrow[r, two heads] & H^0(Z, \EE)
            \end{tikzcd}
        \]
        A $\mathbb{k}$-point $x\in V$ lies in $\spann{\pr_2(U_{Z})}$ if and only if
        $\mm_{x}$ contains $\ker \varphi$. For such a point we complete the
        above diagram to
        \[
            \begin{tikzcd}
                V^* \arrow[d]\arrow[r, "ev_{x}"] & \mathbb{k}\\
                H^0(Z, \OO_Z) \otimes_{\mathbb{k}} V^*\arrow[r, two heads] & H^0(Z, \EE)\arrow[u,
                "\varphi_x"]
            \end{tikzcd}
        \]
        where $\varphi_x$ is a map making the diagram commutative.
        By Lemma~\ref{ref:functionals:lem}, there is a proper closed subscheme $Z'
        \subset Z$ such that the above diagram completes to a commutative
        diagram
        \[
            \begin{tikzcd}
                V^* \arrow[d]\arrow[r, "ev_{x}"] & \mathbb{k}\\
                H^0(Z', \OO_{Z'}) \otimes_{\mathbb{k}} V^*\arrow[r, two heads] &
                H^0(Z', \EE|_{Z'})\arrow[u,
                "linear"]\\
                H^0(Z, \OO_Z) \otimes_{\mathbb{k}} V^*\arrow[r, two heads]\arrow[u,
                two heads] & H^0(Z,
                \EE)\arrow[uu,
                "\varphi_x"', bend right=80]\arrow[u, two heads]
            \end{tikzcd}
        \]
        Reversing the above argument, we get that $x$ lies in the linear span
        of $\pr_2(U_{Z'})$ as claimed.
    \end{proof}

    \begin{example}
        Let $Z = \Spec(\mathbb{k}[x_1,x_2,x_3]/(x_1, x_2, x_3)^2)$, so that $c(Z) = 2$. Let $V = \mathbb{k}^8 =
        \bigoplus_{i=1}^4 \mathbb{k} e_i\oplus \bigoplus_{i=1}^4 \mathbb{k} f_i$.
        Consider a morphism $Z\to \Gr(2, V)$ where $Z_{\mathrm{red}}$ corresponds to
        the subspace $\spann{e_1, f_1}$. We will work in $V' = V/\spann{e_1,
        f_1}$.
        Write $U_Z$ informally as
        $\spann{e_2x_1 + e_3 x_2 + e_4 x_3, f_2x_1 + f_3x_2 + f_4x_3}$. Take
        $p$ inside this space, then $p =
        \sum_{i=1}^3
        \alpha_ie_{i+1} + \beta_i f_{i+1}$ for some $(\alpha_1, \alpha_2,
        \alpha_3),
        (\beta_1, \beta_2, \beta_3)\in \mathbb{k}^3$. Let $(\lambda_1, \lambda_2, \lambda_3)\in \mathbb{k}^3$ be a nonzero vector
        perpendicular to $(\alpha_1, \alpha_2, \alpha_3)$ and $(\beta_1,
        \beta_2, \beta_3)$. Then $p$ lies in the $\spann{\pr_2(U_{Z'})}$ where
        $Z' = V(\lambda_1 x_1 + \lambda_2 x_2 + \lambda_3
        x_3)\subset Z$.
    \end{example}

\subsection{Existence of regular maps and its connections with Hilbert scheme}

    Let $f\colon X\to \mathbb{P}^{N-1} = \mathbb{P}(\mathbb{C}^N)$ be a
    morphism of varieties. Let
    $\mathbb{C}^{\tau N} = \bigoplus_{i=1}^{\tau}\mathbb{C}^N e_i$ and
    define the morphism $f^{\tau}\colon X\to \Gr(\tau,
    \mathbb{C}^{\tau N})$ by
    \[
        f^{\tau}(x) = \spann{\widehat{f(x)}e_1, \widehat{f(x)}e_2, \ldots ,
            \widehat{f(x)}e_\tau},
    \]
    where $\widehat{f(x)}\in \mathbb{C}^N$ is any element of the line $f(x)\in
    \mathbb{P}(\mathbb{C}^N)$. More formally, the morphism $f^{\tau}$ is defined as
    follows. Over $\mathbb{P}^{N-1}$ we have the universal line (sub)bundle
    $U\hookrightarrow \mathbb{P}^{N-1} \times \mathbb{C}^{N}$
    whose fiber over a point of $\mathbb{P}^{N-1}$ is the corresponding line
    in $\mathbb{C}^N$. In fact, this is a special case of the universal
    subbundle for a Grassmannian, as in the previous section. Pulling back $U$
    via $f$ we get a subbundle $U_f\hookrightarrow X \times
    \mathbb{C}^N$. The direct sum $U_f e_1 \oplus  \ldots \oplus U_f
    e_{\tau}\hookrightarrow \bigoplus_{i=1}^{\tau} \mathbb{C}^Ne_i$ is a bundle over
    $X$ that is a rank $\tau$ subbundle of $\mathbb{C}^{\tau
    N}$ so gives a morphism
    $X\to \Gr(\tau, \mathbb{C}^{\tau N})$.

    When we view $\mathbb{P}^{N-1}$ as $\Gr(1, \mathbb{C}^N)$ the
    Definition~\ref{def:algebraicKregular} gives us notions of $k$-regularity
    for $f$. Explicitly, $f$ is $k$-regular if for every $k$ distinct points of
    $X$, their images under $f$ span a $(k-1)$-dimensional
    projective subspace and $f$ is strongly $k$-regular if
    for every smoothable finite subscheme $Z\subset X$ of degree $k$, its
    image $f(Z)$ spans a $(k-1)$-dimensional projective subspace.

    \begin{lemma}\label{ref:kregularTotau:lem}
        If $f$ is $k$-regular then $f^{\tau}$
        is $k$-regular.
        If $f$ is strongly $k$-regular then $f^{\tau}$ is strongly
        $k$-regular.
    \end{lemma}
    \begin{proof}
        Take a finite smoothable subscheme $Z\subset X$ of degree
        $k$. Then $W := \spann{f(Z)}\subset \mathbb{C}^{N}$ is a
        $k$-dimensional linear
        space. The space $\spann{f^{\tau}(Z)}$ is a vector space containing the
        subspaces $W e_i$ for
        all $i$, hence it contains the $(\tau k)$-dimensional vector space
        $\bigoplus_{i=1}^{\tau} W e_i$, which proves that $f^{\tau}$ is
        strongly $k$-regular. For the proof of regularity one may restrict to
        $Z$ a tuple of points and repeat the argument (one may also do a much
        more elementary argument).
    \end{proof}
    \begin{corollary}
        For every $\tau, n, k$ there exists an $N$ and a strongly $k$-regular
        morphism
        $\mathbb{P}^{n}\to \Gr(\tau, \mathbb{C}^N)$.
    \end{corollary}
    \begin{proof}
        Follows from Lemma~\ref{ref:kregularTotau:lem} and the existence of
        strongly $k$-regular morphisms from $\mathbb{P}^{n}$ to
        $\mathbb{P}^{N-1}$, see~\cite[Lemma~5.10]{bjjm}.
    \end{proof}

    Fix a point $p\in \mathbb{P}^n$.
    A strongly $k$-regular morphism $f^{\tau}\colon \mathbb{P}^n\to \Gr(\tau, \mathbb{C}^N)$ induces maps
    \begin{align*}
        F\colon \Hilb_k^{\mathrm{sm}}(\mathbb{P}^n)&\to \Gr(k\tau, \mathbb{C}^N),\\
        F_0\colon \Hilb_k^{\mathrm{sm}}(\mathbb{P}^n, p)&\to \Gr(k\tau, \mathbb{C}^N).
    \end{align*}
    that send $Z$ to $\spann{f^{\tau}(Z)}$. In particular we can pullback the
    universal subbundle via $F_0$ and projectivise it to obtain
    \[
        \begin{tikzcd}
            \mathbb{P}(U)\arrow[r, hook, "cl"] & \Hilb_k^{\mathrm{sm}}(\mathbb{P}^n, p) \times
            \mathbb{P}^{N-1}\arrow[d]\\
            & \Hilb_k^{\mathrm{sm}}(\mathbb{P}^n, p)
        \end{tikzcd}
    \]
    The \emph{areole} is the image of $\mathbb{P}(U)$ in
    $\mathbb{P}^{N-1}$. As a set it is the union of $\mathbb{P}(\langle Z\rangle)$
    for $Z$ ranging over all degree $k$ local and smoothable subschemes $Z\subset \mathbb{P}^n$ supported at the point $p$. We denote the
    areole by $\mathfrak{a}_k = \mathfrak{a}_k(f^{\tau})$. By construction, we
    have $\dim \mathfrak{a}_k \leq \dim \mathbb{P}(U) = \tau k-1+\dim
    \Hilb_k^{\mathrm{sm}}(\mathbb{P}^n, p)$.
    \begin{proposition}[Reduction of $N$]\label{ref:reductionOfN:prop}
        There exists a
        $k$-regular continuous map $\mathbb{C}^n\to \Gr(\tau,
        \mathbb{C}^{M+1})$ for $M =
        \dim \mathfrak{a}_k$.
    \end{proposition}
    It should be stressed that the obtained $k$-regular map is usually
    not algebraic.
    \begin{proof}
        This is a straightforward generalization of~\cite[Theorem~5.7]{bjjm};
        we sketch the argument below.
        A general subspace $W \subset \mathbb{C}^{N}$ of dimension
        $N-M-1$ satisfies $\mathbb{P}(W) \cap \mathfrak{a}_k = \emptyset$,
        since the dimensions of these two varieties sum up to $N-M-2+M = N - 2
        < N-1$. Consider the projection $\pi\colon \mathbb{C}^{N}\twoheadrightarrow
        \mathbb{C}^N/W$; the latter space is isomorphic to
        $\mathbb{C}^{M+1}$. This projection induces a rational map $\pi\colon \Gr(\tau,
        \mathbb{C}^N)\dashrightarrow \Gr(\tau, \mathbb{C}^N/W)$. Since
        $\mathbb{P}(W)$ is disjoint from the areole, in particular it is
        disjoint from the image of $f^{\tau}$, so the composed map
        $f^{\tau}_W = \pi\circ f^{\tau}\colon \mathbb{P}^n\to \Gr(\tau, \mathbb{C}^{N}/W)$ is
        a well-defined morphism. Suppose that for every Euclidean open ball
        $B_{\varepsilon}$ of radius $\varepsilon$
        around $p$ the map $f^{\tau}_W|_{B_\varepsilon}\colon B_{\varepsilon}\to \Gr(\tau,
        \mathbb{C}^{N}/W)$ is not $k$-regular.
        For every $\varepsilon$ choose a $k$-tuple of points $x_1(\varepsilon), \ldots
        ,x_k(\varepsilon)\in B_{\varepsilon}$ such that $x_1(\varepsilon),
        \ldots ,x_k(\varepsilon)$ witness the non-regularity, so the
        corresponding subspaces do not span a $k\tau$-dimensional space in
        $\mathbb{C}^N/W$.
        Taking a countable sequence $(\varepsilon_n)$ converging to zero, we
        obtain a map $\mathbb{N}\to \Hilb_k(\mathbb{P}^n)$ that sends
        $\varepsilon_n$ to $\{x_1(\varepsilon_n), \ldots ,
        x_k(\varepsilon_n)\}$. Since the points $x_i(\varepsilon_n)$ converge
        to $p$ with $n\to \infty$, the Zariski closure of the image of
        $\mathbb{N}\to \Hilb_k(\mathbb{P}^n)$
        contains a point $[Z]$ corresponding to a subscheme $Z\subset
        \mathbb{P}^n$ supported only at $p$. By semicontinuity, the span
        $\spann{f^{\tau}_W(Z)} \subset \mathbb{C}^N/W$ is also of dimension less that
        $k\tau$, hence $\spann{f^{\tau}(Z)}$ intersects $W$ in a nonzero
        subspace, which is a
        contradiction with the choice of $W$.
        The obtained contradiction shows that for some $\varepsilon$ the
        continuous map
        $f^{\tau}_W|_{B_{\varepsilon}}$ is $k$-regular. Composing with a
        homeomorphism $B_{\varepsilon} \simeq \mathbb{C}^{n}$ we obtain the
        required map.
    \end{proof}
    The following gives a key improvement on the upper bounds for the
    dimension of $\mathfrak{a}_k$.
    \begin{corollary}\label{ref:bound:cor}
        For every $\tau, n, k$ there exists a $k$-regular map $\mathbb{C}^n\to
        \Gr(\tau, \mathbb{C}^{N+1})$ for $N\leq \max \lbrace \tau i-1+\dim
        \Hilb^{\tau}_i(\mathbb{P}^n,p):\ 1\leq i\leq k\rbrace$.
    \end{corollary}

    \begin{proof}
 Using Proposition~\ref{ref:main:prop}, we have
 \[
     \mathfrak{a}_k= \overline{\bigcup_{Z\ \in \	\Hilb_k^{\mathrm{sm}}(\mathbb{P}^n,p)}\mathbb{P}(\langle
 Z\rangle)}\subset \bigcup_{1\leq i\leq k}\ \overline{\bigcup_{Z'\in\Hilb_{i}^{\tau}(\mathbb{P}^n,p)}\mathbb{P}(\langle Z'\rangle)}
 \]
 and so
$N=\dim \mathfrak{a}_k \leq \max \lbrace \tau i-1+\dim
\Hilb^{\tau}_i(\mathbb{P}^n,p):\ 1\leq i\leq k\rbrace$. Now apply
Proposition~\ref{ref:reductionOfN:prop}.
    \end{proof}
\section{Dimension bound on $\Hilb_k^2(\AA^n,0)$}
In this section we aim to prove the upper bound $(n-1)(k-1)$ on the dimension
of  $\Hilb^{2}_k(\AA^n,0)$ for $k\leq 11$. Considering the stratification of
$\Hilb_k(\AA^n,0)$ by Hilbert function as described in \ref{eq:mainconcrete},
we prove this bound on the dimension of $\HilbFunc{H}{n}\cap
\Hilb_k^{2}(\AA^n,0)$ for the possible Hilbert functions with $k=\sum H\leq 11$ and $H(s)\leq 2$, classified in three groups as in the following subsections.

\subsection{Hilbert functions with $H(3) = 1$}

First we consider the Hilbert functions with $H(3) = 1$. Such a
function has the form $(1, H(1), H(2), 1, 1,  \ldots , 1)$ and so any minimal dual
generating set has, without loss of generality, one ``large degree'' element
$f$ and other elements of degree at most two; informally speaking such an
algebra is close to the Gorenstein algebra given by the dual generator $f$.
The Hilbert function of the apolar algebra of $f$ is $(1, a, b, 1, 1,  \ldots
, 1)$ and it follows from general theory of Iarrobino's symmetric
decomposition (e.g.~\cite[Remark~(2), p.~1532]{cjn}) that $a\geq b$. We will
also assume $a = n$, as this is the only case of interest for us.

\begin{proposition}\label{ref:locusOfGorensteins:prop}
    Let $\HilbFuncGor{H}{n}$ be the locus of Gorenstein algebras with Hilbert
    function $H = (1,
    n, b, 1, 1, \ldots ,1)$. Let $s$ the largest number such that
    $H(s)\neq 0$.
    Then the dimension of $\HilbFuncGor{H}{n}$ is
    \[
        (n-1)(s-3)+(n-b)b+\binom{b+2}{3}-1+\binom{n+2}{2} - (1+n+b).
    \]
\end{proposition}
\begin{proof}
    \def\mmr{\mm_R}%
    \def\StandardForms{\mathrm{StrdForms}}%
    Every such Gorenstein algebra is given by an ideal $I = \Ann(f)$ for a
    single polynomial $f\in S$.
    By~\cite[Thm 5.3AB]{ia94} (see also \cite[Proposition~3.3]{cjn}) there exists a \emph{standard form of} $f$. This is a form
    $g\in S$ of the shape
    \begin{equation}\label{eq:standardForms}
        g = y_1^{s} + a_{s-1}y_1^{s-1} +  \ldots + a_{4}y_1^{4} + c + q,
    \end{equation}
    where $c\in \mathbb{k}[y_1, \ldots ,y_b]_3$ and $q\in \mathbb{k}[y_1, \ldots ,y_n]_{\leq
    2} = S_{\leq 2}$ such that there exists an automorphism $\varphi\colon
    R\to R$ satisfying $\varphi^{\vee}(g) = f$,
    see~\cite[\S2.2]{Jel_classifying} for the details. This last
    condition can be rephrased as $I = \varphi(\Ann(g))$. Conversely, for a general $g$ as
    above and any $\varphi$, we get a form $\varphi^{\vee}(g)$ which is a dual
    generator of a Gorenstein algebra with the correct Hilbert function.
    It remains to count possible $g$ and
    $\varphi$.
    By the explicit form of $\varphi^{\vee}$ as in~\cite[\S2.2, Equation~(5)]{Jel_classifying} it is enough to
    consider $\varphi\in \Aut(R/\mmr^{s+1})$.
    Let $\StandardForms \subset S_{\leq s}$ be the affine space of $g$ in the
    form~\eqref{eq:standardForms}.
    The parameter space for
    $f$ is the image of the map
    \[
        P\colon \Aut(R/\mmr^{s+1}) \times \StandardForms \to S_{\leq t}
    \]
    that sends $(\varphi, g)$ to $\varphi^{\vee}(g)$. Since $\mathbb{k}$ has
    characteristic zero, the tangent map $dP$ is surjective onto
    $T_{\varphi^{\vee}(g)} \im P$ for general
    $(\varphi, g)$ and its image has dimension equal to $\dim \im P$.
    Since $P$ is equivariant with respect to $\Aut(R/\mmr^{s+1})$, we can take
    $\varphi = \id$.
    By~\cite[Proposition~2.18]{Jel_classifying} this image is given by
    \begin{align*}
        &\sum_{i=1}^n y_i (\mmr\circ g) + \spann{y_1^s,  \ldots , y_1^4} + \mathbb{k}[y_1, \ldots ,y_b]_3 + \mathbb{k}[y_1,
        \ldots ,y_n]_{\leq 2} \\&= \spann{y_1^i\ell\ |\ \ell\in S_1, 3\leq i\leq
        s-1} + S_1y_1^2 + \sum_{i=1}^n y_i\cdot \spann{x_j\circ g\ |\ j=2,3, \ldots ,n} + \mathbb{k}[y_1, \ldots ,y_b]_3 + \mathbb{k}[y_1,\ldots ,y_n]_{\leq 2}.
    \end{align*}
    This space has dimension $n(s-3)+(n-b)+(n-b)(b-1)+\binom{b+2}{3}+\binom{n+2}{2}$.
    Using Proposition~\ref{ref:polynomialsAndGorensteinAlgebras:prop} we
    deduce that
    \begin{align*}
        \dim \HilbFuncGor{H}{n} &=
        n(s-3)+(n-b)b+\binom{b+2}{3}+\binom{n+2}{2} - (1+n+b+s-2)\\
        &=(n-1)(s-3)+(n-b)b+\binom{b+2}{3}-1+\binom{n+2}{2} - (1+n+b).\qedhere
    \end{align*}

\end{proof}

\begin{remark}
    Using the ideas from~\cite[\S2]{Jel_classifying} it is not hard to
    actually describe the locus of possible $f$. For example, in the case
    $(1,3,2,1,1)$ we have $f = \ell_1^4 + \alpha\ell_1^2\ell_3 + F_3(\ell_1,
    \ell_2) + F_{\leq 2}(\ell_1, \ell_2, \ell_3)$, where $\alpha\in \mathbb{k}$ and
    $F_i$ is homogeneous of degree $i$ and $\ell_i$ are linear forms. The above parameterization gives
    $3+1+(1+4)+10 = 19$ parameters and hence we obtain an $11$-dimensional
    family by Proposition~\ref{ref:polynomialsAndGorensteinAlgebras:prop}, in concordance with
    Proposition~\ref{ref:locusOfGorensteins:prop}. This more explicit argument
    works also in positive characteristic. We will not use it.
\end{remark}

\begin{corollary}\label{ref:H3eq1bound:cor}
    Let $\HilbFuncTau{H}{n}{2}$ be the locus of algebras with Hilbert function $H = (1, n,
    b, 1, 1,  \ldots , 1)$ admitting an inverse system with at most two
    dual generators.
    Then the dimension of $\HilbFuncTau{H}{n}{2}$ is at most the maximum of
    \[
        \dim \HilbFuncGor{H-T^2}{n} + \binom{n+1}{2} - b -
        1\qquad\mbox{and}\qquad \dim \HilbFuncGor{H}{n},
    \]
    where $H-T^2$ means a Hilbert function that differs from $H$ only at
    position $2$ and is one less at that position.
\end{corollary}
\begin{proof}
    The inverse system of an element of $\HilbFuncTau{H}{n}{2}$ may have a minimal
    generator in degree two or not. This subdivides $\HilbFuncTau{H}{n}{2}$ into loci,
    whose dimensions are as in the statement.
\end{proof}
\begin{corollary}\label{ref:H3eq1negligible:cor}
    For every Hilbert function $H = (1, a, b, 1, 1, \ldots , 1)$ with $\sum H
    \leq 12$, the bound from Corollary~\ref{ref:H3eq1bound:cor} is less that
    or equal to $(\sum H-1)(a-1)$, hence the corresponding locus is
    negligible.
\end{corollary}
\begin{proof}
    By Invariance of Codimension~\cite[Proposition~A.4]{bjjm} we may take $a =
    n$. Increasing $s$ by one
    increases both the bound and the expected dimension by $n-1$, so it does
    not change negligibility, so we may take $s=3$.
    By an argument analogous to \cite[Remark~(2), p.~1532]{cjn} we have $b\leq
    a+1 = n+1$. Then the statement becomes a direct
    check of all possible cases using
    Proposition~\ref{ref:locusOfGorensteins:prop}.
\end{proof}
\begin{remark}
    The bound $12$ in Corollary~\ref{ref:H3eq1negligible:cor} is sharp: the
    inequality from this corollary is false already for
    $H = (1,5,6,1)$, as we will compute more elementarily in Section~\ref{sec:counterexamples}.
\end{remark}

\subsection{Hilbert functions with $H(2)\leq 2$}

In this case we prove that the tangent space estimate is enough to bound the
fiber of $\pi$ and with know enough about $\HilbFuncGr{H}{n}$ to bound
$\HilbFunc{H}{n}$.
    \begin{theorem}\label{ref:H2:thm}
        Let $H$ be a Hilbert function with $k = \sum H$.
        Suppose $H(2)\leq 2$. Then $\dim \HilbFunc{H}{n} < (k-1)(n-1)$.
    \end{theorem}
    \begin{proof}
        When $H(2) = 1$, then in fact $H(i) \leq 1$ for all $i\geq 2$,
        see~\cite[Remark~2.7]{cjn}, and the
        bound follows directly from the estimate in
        Proposition~\ref{ref:locusOfGorensteins:prop}.
        The case $H(2) = 2$ follows from
        Corollary~\ref{ref:H2eq2main:cor}.
    \end{proof}
    This theorem allows us to greatly reduce the number of cases that appear.
    It is also a partial strengthening of the Brian{\c{c}}on-Iarrobino result that
    implies a similar claim for $H(1)\leq 2$. Note that we have no assumptions
    on $k$ here, the bound is general.

    To prove the theorem we apply several steps. Using invariance of
    codimension, we reduce to considering algebras with $H(1) =n$. We also
    assume $H(2) = 2$, then $H(i)\leq 2$ for all $i\geq 2$,
    see~\cite[Remark~2.7]{cjn}.
    The first step is to show that there are only a few isomorphism classes of
    \emph{graded} algebras with the required Hilbert function. The next step
    is to bound the strictly positive part of the tangent space at each such
    algebra, to control the fibers of the map $\pi$ sending an algebra to its
    associated graded.
    We will now analyse the tangent space to the Hilbert scheme
    at the points of our stratum. First we find the Borel-fixed ones.

        \begin{lemma}\label{ref:canonicalFormForH2eq2:lem}
            Suppose $I\subset \mathbb{k}[x_1, \ldots ,x_n]/I$ is a Borel-fixed
            ideal whose quotient algebra $A$ is zero-dimensional with $H(2) = 2$. Let $s$ be the socle degree of $A$ and
            let $t\leq s$  be the largest degree where $H(t) = 2$.
            Then the inverse system of $I$ is generated by the following
            elements: $S_1$, $y_n^{s}$, $y_{n-1}y_n^{t-1}$.
        \end{lemma}
        \begin{proof}
            The ideal $I$ is Borel-fixed, hence monomial. Since $H_{A}(2) =
            2$, the only possibility for $I_2$ is to contain all monomials
            except $x_n^2$ and $x_{n-1}x_n$. Then the
            inverse system $I^{\perp}$ satisfies $I^{\perp}_2 = \spann{y_{n}^2,
                y_{n-1}y_n}$. This
                shows that $I^{\perp}_{\geq 2} \subset \mathbb{k}[y_{n-1}, y_n]$ and we
                reduce to the case $n=2$, so that $y_{n-1} = y_1$, $y_n
                =y_2$, and $I_2 = \mathbb{k} x_{1}^2$.
            Since $x_1^2\in I$, we have $I^{\perp}_{\geq 2} \subset \spann{y_2^{a},
            y_1y_2^{b}\ |\ a,b\geq 0}$, so $I^{\perp}$ is generated by $S_1$
            and $y_2^a$ and $y_1y_2^b$ for some $a,b\geq 0$.
            Moreover, in all degrees where $I^{\perp}$ is non-zero, it is
            Borel-fixed, hence contains the largest monomial which is $y_2^a$.
            Therefore, we conclude that $a = s$. It follows from the Hilbert
            function that $b = t-1$.
        \end{proof}
        \begin{lemma}\label{ref:tangentForH2eq2:lem}
            Let $A = R/I$ be a graded algebra whose inverse system is given by
            $S_1$ together with $y_1^s$ and $y_1^{t-1}y_2$ for some $1\leq t\leq s$.
            Then the non-negative part of $T_A = \Hom_R(I,R/I)$ has Hilbert series
            \[
                T^{s-t-1} + \left( \binom{n+1}{2}-2 -(n-1)
                \right)(T^{t-2}+T^{s-2}) + (n-1)\sum_{i=2}^s H_A(i)T^{i-2},
            \]
            where $T^{\alpha}$ is interpreted as zero for $\alpha < 0$.
        \end{lemma}
        \begin{proof}
            The ideal $I$ is generated by $x_2^2$, $x_1x_i$, $x_2x_i$,
            $x_ix_j$ for $i,j\geq 3$ and $x_1^tx_2, x_1^{s+1}$. For $a\geq 2$
            the space $(R/I)_2$ has a basis $\{x_1^a, x_1^{a-1}x_2\}$.
            Consider a homomorphism $\varphi\colon I\to R/I$ of degree $d=a-2\geq
            0$. The generator $x_1^{s+1}$ is send to zero by degree reasons.
            The generator $x_1^{t}x_2$ is sent to some power of $x_1$, so
            contributes $1$ in degrees $0, 1,  \ldots , s-t-1$.

            Write $\varphi(x_ix_j) = \lambda_{ij}x_1^{a} +
            \mu_{ij}x_1^{a-1}x_2$ for any $x_ix_j\in I$ with $i \leq j$.
            For $a = s$ the element $\lambda_{ij}$ can be chosen arbitrarily
            and for $a = t$ then element $\mu_{ij}$ can be chosen arbitrarily,
            as these two coefficient stand next to socle elements. Below
            we assume that those two specific coefficients are zero. Likewise,
            if $a > s$ or $a > t$ we use the convention that $\lambda_{ij}$ or $\mu_{ij}$
            respectively are zero.

            If $i,j \geq 3$ then the syzygies $x_1(x_ix_j) = x_i(x_1x_j)$ and
            $x_2(x_ix_j) = x_i(x_2x_j)$ force $x_1\varphi(x_ix_j) = 0 =
            x_2\varphi(x_ix_j)$, so  $\lambda_{ij} = \mu_{ij} =0$.
            It remains to consider $i=1$ and $i=2$. Assume $j\geq 3$. The
            syzygy $x_1(x_2x_j) = x_2(x_1x_j)$ implies that
            \[
                (\lambda_{1j}-\mu_{2j})x_1^{a}x_2 + \lambda_{2j}x_1^{a+1} = 0.
            \]
            If $a-1 \geq t$, then $\mu_{2j} = 0$ by the convention from above.
            Otherwise $x_1^ax_2\neq0$ and so $\mu_{2j} = \lambda_{1j}$.
            If $a \geq s$, then $\lambda_{2j} = 0$ by convention, while for $a
            < s$ we get $\lambda_{2j} = 0$ because $x_{1}^{a+1}\neq 0$.
            It follows that $\varphi(x_2x_i)$ is uniquely determined by
            $\varphi(x_1x_i)$.

            The syzygy $(x_1^tx_2)x_2 = (x_1^t)x_2^2$ shows that the
            coefficient of $x_1^b$ in $\varphi(x_2^2)$ is uniquely determined
            by $\varphi(x_1^tx_2)$ for $b+t \leq
            s$ which gives an additional constraint for homomorphisms in
            degrees $0, 1,  \ldots ,
            s-t-2$.
            Summing up, the homomorphism $\varphi$ is uniquely determined by
            choosing
            \begin{enumerate}
                \item two arbitrarily coefficients (next to socle
                    elements) for every quadric generator expect $x_2^2$ and
                    $x_1x_i$ for $i\geq 3$. This gives $\left(
                    \binom{n+1}{2}-2 - (n-1) \right)(T^{t-2}+T^{s-2})$,
                \item an arbitrary image of $x_1^tx_2$ which, counting in the
                    restrictions for $\varphi(x_2^2)$, gives $T^{s-t-1}$,
                \item arbitrary images of $x_2^2$ and $x_1x_i$ for $i\geq 3$
                    which gives $(n-1)\sum_{i=3}^s H_A(i)T^{i-2}$.\qedhere
            \end{enumerate}
        \end{proof}
        \begin{corollary}\label{ref:H2eq2main:cor}
            For $H(2) = 2$ the stratum $\HilbFunc{H}{n}$ has dimension
            at most
            \[
                (k-1)(n-1) - 1.
            \]
        \end{corollary}
        \begin{proof}
            By the tangent space estimate and semicontinuity it is enough to
            bound the non-negative part of the tangent space at Borel-fixed points. By
            Lemma~\ref{ref:canonicalFormForH2eq2:lem} there is only one such
            point
            and the bound on its tangent space is given
            in Lemma~\ref{ref:tangentForH2eq2:lem}:
            \begin{multline*}
                \dim \HilbFunc{H}{n} \leq 1 +
                2\left( \binom{n+1}{2}-2-(n-1) \right) +(n-1)\sum_{i=2}^s
                H_A(i) =\\
                1 + (n+1)n-2(n+1)+(n-1)(k-1-n) = (n-1)(k-1) -
                1.\qedhere
            \end{multline*}
        \end{proof}
        \begin{remark}
            Of course, having the description of Borel-fixed points as in
            Lemma~\ref{ref:canonicalFormForH2eq2:lem} we could machine-check
            the tangent spaces for $k\leq 11$. However the argument in
            Corollary~\ref{ref:H2eq2main:cor} is both more clean and more
            general: it works for any $k$.
        \end{remark}

\subsection{The remaining Hilbert functions}\label{Bound}
In this subsection, we treat the special cases which are not covered
previously. Recall the map $\pi$ in \ref{eq:mainconcrete} that sends each local
algebra to its associated graded algebra. The following is an easy but
useful result.

\begin{proposition}[{\cite[Proposition~4.3]{ccvv}}]\label{ref:fibers:prop}
Let $H=(1,n,a,b)$ and $t={n+1\choose 2}-a$. Then every fiber of $\pi$ is irreducible of dimension $tb$.
\end{proposition}
\begin{proof}[Sketch of proof]
    There are $t$ quadric generators of any graded quotient
    $A$ of $\mathbb{k}[x_1, \ldots ,x_n]$ with Hilbert function $H$ and they can be
    send to arbitrary elements of $A_3$ to obtain an element of the fiber: the
    conditions coming from syzygies are vacuous as $H(4) = 0$.
\end{proof}

\begin{proposition}\label{ref:1m32new:prop}
    Let $H=(1,n,3,2)$. The locus of algebras with $\tau \leq2$ and Hilbert function $H$ is
    negligible.
\end{proposition}

\begin{proof}
    We are to prove that the dimension of the locus is at most $(n+5)(n-1)$.
    By Proposition~\ref{ref:fibers:prop}, the fibers
    of~$\pi$ have dimension $n(n+1) - 6$.
    For an algebra $A$ as in the statement, its inverse system is generated by two
    polynomials of degree three $f_1, f_2$. Therefore, the leading terms of all degree
    two elements of this systems are partials of the leading terms of $f_1$,
    $f_2$. Therefore, the inverse system of $\pi(A)$ will have no minimal quadric generators.
    It is
    enough to prove that the locus of graded algebras
    with Hilbert function $H$ and with no minimal quadric generators in the
    inverse system has dimension at most $(n+5)(n-1) - (n(n+1)-6) =
    3n+1$. To do this we will decompose it into locally closed subloci, according to the
    properties of the dual generators.

    Consider first the inverse systems which contain a cubic
            $F$ essentially in three variables. The Hilbert function of the
            apolar algebra of $F$ is $(1,3,3,1)$ and the inverse systems are
            parameterized by choosing a $3$-dimensional subspace $V$ of linear
            forms, choosing $F\in \mathbb{P}(\Sym^3 V)$, and choosing a codimension one subspace
            in the space of minimal cubic generators of $\Ann(F)$. For
            example by Boij-So\"ederberg theory, it is known that there are at
            most two minimal cubic generators of $\Ann(F)$. Therefore, the
            above parameterization gives an upper bound of $\gr(3, n) + 9 + 1
            = 3n+1$. This concludes this case.

    Consider now the inverse systems where every cubic depends essentially on
    at most two variables.
    Here, consider first the inverse systems which
    contain a perfect cube $\ell^3$. Such an inverse systems contains, as minimal
    generators, the cube $\ell^3$ and a cubic $F$ which depends essentially on
    two variables.

    This locus is parameterized by choosing a linear form $\ell$, a space $V$ of linear forms for $F$ and
    next choosing $F\in \mathbb{P}(\Sym^3V)$. This gives $\gr(1,n)+\gr(2,
    n) + 3 < 3n+1$.

    Finally, consider the inverse systems where every cubic depends
    essentially on exactly two variables. Assuming that the cubics depend on
    independent variables gives rise to an inverse system with $H(2)=4$. Thus, the
    spaces of partials for cubics must intersect. Therefore, we can parameterize
    the whole locus by choosing a $3$-dimensional subspace of linear forms,
    choosing two its $2$-dimensional subspaces $V_1$, $V_2$ and choosing
    $F_i\in \mathbb{P}(\Sym^3V_i)$ for $i=1,2$. This gives a parameterization by
    $\gr(3, n) + 2 + 2 + 3 + 3 = 3n+1$ parameters.
\end{proof}
\begin{remark}
    The locus of algebras with Hilbert function $H = (1,n,3,2)$ without
    restrictions on $\tau$ is \emph{not}
    negligible: choosing two perfect cubes, an arbitrary quadric and using
    Proposition~\ref{ref:fibers:prop} gives a locus of dimension
    $2(n-1)+\binom{n+1}{2} - 2 + n(n+1) -6$. Hence, keeping track of $\tau$ is
    essential.
\end{remark}

\begin{proposition}\label{ref:1442:prop}
Let $H=(1,4,4,2)$. The locus of algebras of socle dimension $2$ and
Hilbert function $H$ is negligible.
\end{proposition}
\begin{proof}
    In general terms, the proof is similar to the one of
    Proposition~\ref{ref:1m32new:prop}.
    We only consider the graded algebras and our aim is to show that their
    locus has dimension at most $10\cdot 3 - 6\cdot 2 = 18$.

    First, consider the inverse systems which contain a cubic $F$ essentially
    depending on $4$ variables, so that the corresponding ideal has Hilbert
    function $(1,4,4,1)$.
    By~\cite[Proposition~4.6]{casnati_notari_irreducibility_Gorenstein_degree_10}
    the ideal $\Ann(F)$ has at most three-dimensional space of cubic minimal
    generators. Moreover, if $\Ann(F)$ has \emph{any} cubic minimal
    generator, then $F$ is a limit of direct sums, by~\cite[Theorem 1.7]{bbkt}
    or by~\cite[Lemma~4.5]{casnati_notari_irreducibility_Gorenstein_degree_10}
    together with the form given in equation~\cite[(1)]{bbkt}. Such direct
    sums are parameterized by $\Gr(1, 4) \times \Gr(3, 4) \times
    \mathbb{P}(\Sym^3\mathbb{k}^1)\times
    \mathbb{P}(\Sym^3\mathbb{k}^3)$ which gives in total $15$ parameters
    (choosing a decomposition $\mathbb{k}^2 \oplus \mathbb{k}^2$ yields
    similar count). Together with the choice of a codimension one space of
    cubic minimal generators, this gives at most $17$ parameters. This
    concludes the subcase.
    From now on we assume that every cubic in the inverse system
    essentially depends on at most $3$ variables.

    Consider now the inverse systems in which some cubic depends on at most two
    variables. They are parameterized in a straightforward manner by $\gr(3,4)
    + \gr(2,4) + \dim\mathbb{P}(S^3\mathbb{k}^3) +
    \dim\mathbb{P}(S^3\mathbb{k}^2) = 19$
    parameters. Moreover, a general such pair of cubics gives rise to an
    inverse
    system with Hilbert function $(1,4,5,2)$. Hence the cubics giving rise to
    $(1,4,4,2)$ are parameterized by a proper closed (perhaps reducible)
    subvariety which thus has dimension at most $18$, which concludes this
    case.

    Finally, consider the inverse systems in which every cubic depends
    essentially on exactly three variables.
    Consider such a system $F_1$, $F_2$ and assume $x_1\circ F_1 = 0$, $x_2
    \circ F_2 = 0$. Since $H(2) = 4$, the a priori $6$-dimensional space
    $x_2\circ F_1$, $x_3\circ F_1$, $x_4\circ F_1$, $x_1\circ F_2$, $x_3\circ
    F_2$, $x_4\circ F_2$ has dimension four. Therefore, there are two
    independent relations
    \[
        \ell_{1, 1} \circ F_1 = \ell_{2,1}\circ F_2 \qquad \mbox{ and }\qquad
        \ell_{1,2} \circ F_1 = \ell_{2, 2}\circ F_2.
    \]
    Without loss of generality, we may assume that $\ell_{i, *}$ does not
    contain $x_i$ for $i=1,2$.
    Note that $\ell_{1,*}$ are linearly independent, since otherwise some
    combination of $\ell_{2,*}$ annihilates $F_2$, which is impossible since
    $F_2$ depends essentially on three variables and $\ell_{2,*}$ do not
    contain $x_2$.
    We observe that for $i=1,2$ we have
    \[
        \ell_{1,i}\circ (x_2 \circ F_1) = x_2 \circ (\ell_{1,i}\circ F_1) =
        x_2\circ (\ell_{2,i}\circ F_2) = \ell_{2,i}\circ (x_2 \circ F_2) = 0.
    \]
    We deduce that the quadric $x_2\circ F_1\in \mathbb{k}[y_2, y_3, y_4]$ is
    annihilated by a two-dimensional space $\ell_{1,*}\subset \mathbb{k}[x_2, x_3,
    x_4]_1$ and thus $x_2 \circ F_1$ is \emph{a perfect square}. Therefore, our
    locus is parameterized by choosing two three-dimensional spaces of linear
    forms $V_1$, $V_2$ and choosing $F_i\in \mathbb{P}(\Sym^3V_i)$ such
    that $x_{3-i}\circ F_i$ is a perfect square, where $x_i = V_i^{\perp}$. The
    choices of $V_i$ and $F_i$ a priori give $2\cdot(3+9)$ parameters but
    \emph{$x_{3-i}\circ F_i$ is a perfect square} is a codimension three
    condition on $F_i$, so in fact we get $2\cdot (3+9-3) = 18$ parameters.
    This concludes the whole proof.
\end{proof}
\begin{remark}
    It seems surprisingly hard to properly describe the locus from
    Proposition~\ref{ref:1442:prop}. Devising any general tool to do this
    would be interesting.
\end{remark}

\begin{proposition}\label{ref:14321final:prop}
Let $H=(1,4,3,2,1)$. Then, $\dim \Hilb_{H}^2(\mathbb{A}^4,0)\leq (4-1)(11-1)$.
\end{proposition}

\begin{proof}
    The locus of homogeneous part of $\Hilb_{H}^2(\mathbb{A}^4,0)$ decomposes
    into four subloci as in Proposition~\ref{ref:1m321:prop}. We consider them
    case by case, but not in order. For each locus we either bound the
    dimension of each fiber of $\pi$ directly or perform a degeneration argument to
    reduce to bounding the dimensions of special fibers and then compute the
    tangent space to the fiber.

    Case~\ref{ref:1m321:prop}\ref{it:1m321last}. Here the parameterization is straightforward. The
    associated graded system is generated by a quatric $F$ in two variables,
    say $F\in \mathbb{k}[y_1, y_2]$, and linear forms. The inverse system of the fiber
    are generated by by degree four polynomial $f = F + f_3 + f_2$ and linear
    forms. The part $f_2$ can be arbitrarily chosen modulo the partials of
    $F$, which gives a $7$-dimensional choice. The cubic part $f_3$ has to
    satisfy $x_3 \circ f_3$, $x_4\circ f_3$ being partials of $F$, hence $x_3
    \circ f_3, x_4\circ f_3\in \mathbb{k}[y_1,y_2]$ so that $f_3\in \spann{y_1, y_2,
    y_3, y_4}\mathbb{k}[y_1, y_2]_2$ lies in a $10$-dimensional space of choices.
    Together, we see that the fiber is at most $17$-dimensional, so the whole
    locus --- using the result of Proposition~\ref{ref:1m321:prop} --- has dimension at most $17 + 8$.

    Case~\ref{ref:1m321:prop}\ref{it:1m321subtle}. Here, the associated graded system is generated
    by $\ell_1^4$ and $c\in \mathbb{k}[\ell_1, \ell_2, \ell_3]$. Taking the limit at
    zero
    with respect to a $\Gmult$-action with weights of $\ell_2$, $\ell_3$
    equal and smaller than the weight of $\ell_1$, reduces our system to the
    case $c\in \mathbb{k}[\ell_2, \ell_3]$. Then by classification of cubics in two
    variables, we have $c= \ell_2^3 + \ell_3^3$ or $c = \ell_2^2\ell_3$, up to
    coordinate change. We verify that it both cases the tangent to the fiber
    has dimension $18$, hence same holds for every fiber by semicontinuity,
    thus  --- using the result of Proposition~\ref{ref:1m321:prop} --- the
    whole locus has dimension at most $18+10$.

    By
    Proposition~\ref{ref:1m321:prop} there remain three possible types of
    such homogeneous inverse systems: $\ell_1^4 + \ell_2^4$, $q$ or $\ell_1^3\ell_2$, $q$ or $\ell_1^4$,
    $\ell_2^3$, $q$ and the dimension of their locus is $14$. For each inverse
    system, since we know that $q\not\in \mathbb{k}[\ell_1, \ell_2]$, we may choose
    $\ell_3$ such that the monomial $\ell_3^2$ appears in $q$. Taking a limit
    of a $\Gmult$-action with weights of $\ell_1$, $\ell_2$, $\ell_4$ equal
    and greater
    than the weight of $\ell_3$, reduces our system to the case $Q =
    \ell_3^2$.
    For such a $q$, a direct tangent space check shows that
    for $I$ annihilating such an inverse system we have $\dim
    \Hom_R(I, R/I)_{>0}$ equal to $14, 14, 18$ respectively. Since $14 + 14 < 30$,
    we concentrate on the last case. Summing up, from now on we only consider
    inverse systems whose associated graded has the form $\ell_1^4$,
    $\ell_2^3$, $q$. By Proposition~\ref{ref:1m321:prop} the homogeneous such
    systems form a $13$-dimensional family. Again, since every such system degenerates to $\ell_1^4$,
    $\ell_2^3$, $\ell_3^2$, it is enough to prove the dimension estimate for
    that system.

    We subdivide this case into two. First, we fix a basis $y_i$ with $y_1
    =\ell_1$ and $y_2 = \ell_2$. We call a quadric $q$ \emph{special} if $q(0,
    0, x_3, x_4)$ has rank one. Special quadrics form a divisor, hence the
    graded inverse systems with $q$ special are at most $13-1 = 12$
    dimensional and the corresponding nongraded systems are at most
    $12 + 18 = 30$ dimensional by the tangent estimate above. Thus below we
    may and do consider only non-special quadrics.
    For such a quadric $q$ take a $\Gmult$-action with weights of $y_1$, $y_2$
    equal, weights of $y_3$ and $y_4$ also equal and smaller that the
    weights of $y_1$. The induced degeneration maps the inverse system $y_1^4$,
    $y_2^3$, $q$ to $y_1^4$, $y_2^3$, $y_3y_4$.
    The positive part of the tangent space at $y_1^4$, $y_2^3$, $y_3y_4$ is
    $17$. Hence using the base and tangent-to-fiber estimate we obtain $17 + 13 = 30$.
\end{proof}
\begin{remark}
    In the above proof one can check that the dimension of the cell of
    $y_1^4$, $y_2^3$, $y_3^2$, $y_4$ is exactly $30$, so the punctual Hilbert
    scheme is reducible.
\end{remark}

    \begin{proof}[Proof of Theorem~\ref{ref:dimension:maintheorem}]

        Recall that the expected dimension of $\Hilb_k(\mathbb{A}^n, 0)$
        is $(k-1)(n-1)$ and a locus $Z$ in this Hilbert scheme is negligible
        if $\dim Z\leq (k-1)(n-1)$.
        Suppose that $H$ is such that the locus of
        algebras with Hilbert function $H$ is not negligible.
        By invariance of codimension we reduce to $H(1) = n$~\cite[Proposition~A.4]{bjjm}.
        By irreducibility of $\Hilb_k(\mathbb{A}^2, 0)$ as
        in~\cite[Corollary~(1.2)]{Ellingsrud_Stromme__On_the_homology} we have $H(1)\geq 3$. By Theorem~\ref{ref:H2:thm}
        we have $H(2)\geq 3$.

        Suppose now $k\leq 8$. By
        Theorem~\ref{ref:irreducibility}, we have $H(1)\geq 4$.
        As $k\leq 8$ this implies that $H = (1, 4, 3)$ and we conclude it is
        negligible by a direct computation of dimension of this locus, which
        is $\gr(3, 10) =
        21$, see~\cite[Proposition~3.3]{ccvv} for details.
        So for $k\leq 8$ and
        any $n$ the dimension of the Hilbert scheme is the expected one.
        Another direct computation shows that $(1, n, 3)$ for $n\geq 5$ has
        dimension higher than excepted, see Example~\ref{ex:taugeq3} below. This concludes the part $\tau\geq 3$.

        We assume $\tau\leq 2$ and $k$ arbitrary.
        We first discard several classes of Hilbert functions. If $H(3) = 0$
        then $H(2) \leq 2$ since $\tau \leq 2$, a contradiction with the above.
        If $H(3) = 1$ then Corollary~\ref{ref:H3eq1negligible:cor} shows that
        $H$ is negligible.
        If $H = (1, n, 3, 2)$ for some $n$, then
        Proposition~\ref{ref:1m32new:prop}
        concludes.

        Suppose now $k \leq 11$. Using Theorem~\ref{ref:irreducibility} we get
        $H(1)\geq 4$. Summing up, we have $H(1)\geq 4$, $H(2)\geq 3$ and
        $H(3)\geq 2$. This immediately concludes the case $k = 9$. For $k =
        10$ this leaves, a priori, the single possible case $H = (1,4,3,2)$
        but also that case was considered above.

        Suppose $k=11$. Due to the constraints above, we have to consider only
        the cases $H = (1,5,3,2)$, $H = (1, 4, 4, 2)$, $H = (1,4,3,3)$, $H =
        (1,4,3,2,1)$. The case $(1,5,3,2)$ was considered above.
        The case $(1,4,4,2)$ was considered in
        Proposition~\ref{ref:1442:prop}. The case $(1,4,3,3)$ is
        impossible to obtain with $\tau\leq 2$.
        The case $(1,4,3,2,1)$ is considered in Proposition~\ref{ref:14321final:prop}.
        This concludes the case $k=11$ and the whole proof of the bound. The
        violations of the bound for higher $k$ follow from
        Examples~\ref{ex:tauone}-\ref{ex:tautwo}.
    \end{proof}
    \begin{remark}
        It is natural to speculate about the cases $\tau = 1$, $k=12,13$ and
        $\tau = 2$, $k=12$. We believe that in these cases the scheme
        $\Hilb_k^{\tau}(\mathbb{A}^n, 0)$ has expected dimension, however the
        number of cases to consider would increase the length of the paper too
        greatly and ruin the relative cleanness of the current proof.
    \end{remark}
    \begin{proof}[Proof of Theorem~\ref{ref:mainthm}]
        The punctual Hilbert schemes $\Hilb_k(\mathbb{P}^n, p)$ and
        $\Hilb_k(\mathbb{A}^n, 0)$ have the same dimension~\cite[Proposition~2.2]{fogarty} Since
        $\dim\Hilb_k^{\mathrm{sm}}(\mathbb{A}^n) = kn$,
        we have $\dim \Hilb_{k}^{\mathrm{sm}}(\mathbb{A}^n, 0)
        \leq kn-1$. Moreover, if $k\leq 8$ or $\tau \leq 2$ and $k\leq 11$,
        then it follows from Theorem~\ref{ref:dimension:maintheorem} that
       $\dim \Hilb_k^{\tau}(\mathbb{A}^n, 0) = (k-1)(n-1)$.
        Therefore the
        estimates for the theorem follow from
        Proposition~\ref{ref:reductionOfN:prop} in the general case and from
        Corollary~\ref{ref:bound:cor} in the special cases $k\leq 8$ or
        $\tau\leq 2$, $k\leq
        11$.
    \end{proof}

    \subsection{Counterexamples}\label{sec:counterexamples}

    \begin{example}[$\tau \geq 3$]\label{ex:taugeq3}
        The locus of algebras with Hilbert function $H = (1,n,3)$ in $\mathbb{A}^n$ is
        parametrized by $\Gr\left(3, \binom{n+1}{2}\right)$ whence it has
        dimension $3\cdot \left( \binom{n+1}{2} - 3 \right)$, whereas the
        expected dimension is $(n-1)\cdot (n+3)$. The difference is
        \[
            \binom{n-1}{2} - 6
        \]
        which is positive for $n \geq 5$; so for $k = n+4 \geq 9$. Finally, to
        get examples for $n > k-4$ use Invariance of
        Codimension~\cite[Proposition~A.4]{bjjm}.
    \end{example}

    \begin{example}[$\tau = 1$]\label{ex:tauone}
        Consider the Hilbert functions $(1,n,n,1)$ and $(1,n,n,1,1)$.
        By Proposition~\ref{ref:locusOfGorensteins:prop} the dimensions of the
        corresponding loci minus the expected dimension $(n-1)(k-1)$ is in
        both cases
        \[
            \binom{n+2}{3} - 1 + \binom{n+2}{2} - n\cdot (2n-1) = \frac{1}{6}\,n^{3}-n^{2}+\frac{5}{6}\,n
        \]
        which is strictly positive for every $n\geq 6$ hence for $k\geq 14$.
    \end{example}

    \begin{example}[$\tau = 2$]\label{ex:tautwo}
        Take an inverse system for two general polynomials in $5$ variables: one
        of degree $3$ and one of degree $2$. Then the Hilbert function is
        $(1,5,6,1)$ and the optimal bound is $4\cdot 12 = 48$. But a routine
        calculation shows that the space of homogeneous such choices is
        $\binom{7}{3}-1+(10-1) = 43$ dimensional and so the whole space is
        $52$-dimensional, violating the bound.
        (This example could be generalized to $(1,n,n+1,1)$)
    \end{example}

    {\small

redpajama_set_name: RedPajamaArXiv