Counting tournament score sequences

Abstract: The score sequence of a tournament is the sequence of the out-degrees of its vertices arranged in nondecreasing order. The problem of counting score sequences of a tournament with $n$ vertices is more than 100 years old (MacMahon 1920). In 2013 Hanna conjectured a surprising and elegant recursion for these numbers. We settle this conjecture in the affirmative by showing that it is a corollary to our main theorem, which is a factorization of the generating function for score sequences with a distinguished index. We also derive a closed formula and a quadratic time algorithm for counting score sequences.

\section{Introduction}\label{section-intro}

In 1953 Landau~\cite{Landau1953} used oriented complete graphs---also
called \emph{tournaments}---to model pecking orders.  If the vertices of
the complete graph represent players (rather than chickens), then the
initial vertex of a directed edge signifies the winner of a game between
the two end-point players. The number of wins of a player is equal to
the number of outgoing edges from that vertex. A \emph{score sequence} is
a sequence of these number of wins given in a nondecreasing order. For
instance, with 3 players there are two possible score sequences, namely
$(0, 1, 2)$ and $(1, 1, 1)$.  Note that non-isomorphic tournaments may
give rise to the same score sequence. With $5$ players there are, up to
isomorphism, 12 tournaments but only 9 score sequences. To be even more
specific, here are two non-isomorphic\footnote{The longest directed path
  between any pair of vertices in the left-hand graph is 3, while in the
  right-hand graph there is a directed path of length $4$ from $c$ to $b$.}
tournaments:
\[
\begin{tikzpicture}[rotate=90, scale=0.95]
  \GraphInit[vstyle=Classic]
  \tikzset{VertexStyle/.append style={inner sep=2.6pt,outer sep=0.3pt,minimum size=2pt,fill=white}}
  \tikzset{EdgeStyle/.append style={semithick}}
  \Vertices[Math,Lpos=90,unit=1.1]{circle}{a,b,c,d,e}
  \Edge[lw=0.1cm,style={post}](a)(c)
  \Edge[lw=0.1cm,style={post}](a)(d)
  \Edge[lw=0.1cm,style={post}](b)(a)
  \Edge[lw=0.1cm,style={post}](b)(c)
  \Edge[lw=0.1cm,style={post}](b)(d)
  \Edge[lw=0.1cm,style={post}](c)(d)
  \Edge[lw=0.1cm,style={post}](d)(e)
  \Edge[lw=0.1cm,style={post}](e)(a)
  \Edge[lw=0.1cm,style={post}](e)(b)
  \Edge[lw=0.1cm,style={post}](e)(c)
\end{tikzpicture}\qquad
\begin{tikzpicture}[rotate=90, scale=0.95]
  \GraphInit[vstyle=Classic]
  \tikzset{VertexStyle/.append style={inner sep=2.6pt,outer sep=0.3pt,minimum size=2pt,fill=white}}
  \tikzset{EdgeStyle/.append style={semithick}}
  \Vertices[Math,Lpos=90,unit=1.1]{circle}{a,b,c,d,e}
  \Edge[lw=0.1cm,style={post}](a)(b)
  \Edge[lw=0.1cm,style={post}](a)(c)
  \Edge[lw=0.1cm,style={post}](a)(d)
  \Edge[lw=0.1cm,style={post}](b)(c)
  \Edge[lw=0.1cm,style={post}](b)(d)
  \Edge[lw=0.1cm,style={post}](b)(e)
  \Edge[lw=0.1cm,style={post}](c)(d)
  \Edge[lw=0.1cm,style={post}](d)(e)
  \Edge[lw=0.1cm,style={post}](e)(a)
  \Edge[lw=0.1cm,style={post}](e)(c)
\end{tikzpicture}
\]
The score sequence associated with both is $(1,1,2,3,3)$. The following
characterization of score sequences is known as Landau's theorem.
\begin{theorem}[Landau~\cite{Landau1953}]\label{landaus-thm}
  A sequence of integers $s=(s_0,\ldots,s_{n-1})$ is a score sequence if
  and only if
  \begin{enumerate}
  \item[\textup{(1)}] $\refstepcounter{equation} \label{landaus-thm-i} 0 \leq s_0 \leq s_1 \leq \cdots \leq s_{n-1} \leq n-1 $,
  \item[\textup{(2)}] $\refstepcounter{equation} \label{landaus-thm-ii} s_0+\dots+s_{k-1} \geq {k \choose 2}$ for $1\leq k < n$, and
  \item[\textup{(3)}] $\refstepcounter{equation} \label{landaus-thm-iii} s_0+\dots+s_{n-1}={n \choose 2}$.
  \end{enumerate}
\end{theorem}

Let $S_n$ be the set of score sequences of length $n$. There is no known
closed formula for the cardinalities $|S_n|$ or their generating
function.

It should be noted that Landau was not the first person to study
score sequences, or attempt to count them. MacMahon~\cite{MacMahon1920}
used symmetric functions and hand calculations to determine $|S_n|$ for
$n\leq 9$ in 1920. Building on Landau's work, Narayana and
Bent~\cite{NarayanaBent1964}, in 1964, derived a multivariate recursive
formula for determining $|S_n|$. They used it to give a table for
$n\leq 36$. In 1968 Riordan~\cite{Riordan1968} gave a simpler and more
efficient recursion, but unfortunately it turned out to be incorrect~\cite{Riordan1969}.

Let $[a,b]$ denote the interval of integers $\{a, a+1,\dots,b\}$.  We
may view a score sequence $s\in S_n$ as an endofunction
$s:[0,n-1]\to [0,n-1]$.  We now introduce the notion of a \emph{pointed
  score sequence}. Define $S^{\pt}_n$ as the Cartesian product
$S^{\pt}_n=S_n\times [0,n-1]$. We call the members of $S^{\pt}_n$
\emph{pointed score sequences}; e.g.\ there are 6 pointed score
sequences in $S^{\pt}_3$:
\begin{align*}
  & ((0,1,2),0),\, ((0,1,2),1),\, ((0,1,2),2),\, \\
  & ((1,1,1),0),\, ((1,1,1),1),\, ((1,1,1),2).
\end{align*}
Let $(s,i)\in S^{\pt}_n$. Depending on the
context, the element $i$ will be interpreted as a position
(element in the domain) or a  value (element in the
codomain) of $s$. If $i$ is a value, then the cardinality
of the fiber $s^{-1}(i)$ is the number of times $i$ occurs in $s$; this
number may be zero. Let
\[S^{\pt}_n(t) = \sum_{(s,i)\in S^{\pt}_n} t^{|s^{-1}(i)|}
\]
be the polynomial recording the distribution of the statistic
$(s,i)\mapsto |s^{-1}(i)|$ on $S^{\pt}_n$. As an example,
$S^{\pt}_3(t) = 2+3t+t^3$. Let
\[
S^{\pt}(x,t) = \sum_{n\geq 1} S^{\pt}_n(t) x^n.
\]

To present the bijection that is the main result of this paper,
we will first introduce a particular type of multiset that is an
essential ingredient in our deconstruction of a pointed score sequence.
At first glance it is not obvious what the relevance of these multisets
to score sequences is.
The Erd\H{o}s-Ginzburg-Ziv Theorem~\cite{EGZ1961} is the following.

\begin{theorem}[Erd\H{o}s, Ginzburg, and Ziv~\cite{EGZ1961}]\label{EGZ-Theorem}
  Each set of $2n-1$ integers contains some subset of $n$ elements the
  sum of which is a multiple of $n$.
\end{theorem}

We define $\mathrm{EGZ}_n$ as the set of multisets
of size $n$ with elements in the cyclic group $\mathbb{Z}_n$ whose sum is
$\binom{n}{2}$ modulo $n$. This terminology is motivated by the simple
one-to-one correspondence between $\mathrm{EGZ}_n$ and the sets considered by
Erd\H{o}s, Ginzburg, and Ziv that appear in the proof of the following
lemma.

\begin{lemma}
  There is a one-to-one correspondence between $\mathrm{EGZ}_n$ and $n$-element
  subsets of $[1,2n-1]$ whose sum is a multiple of $n$.
\end{lemma}

\begin{proof}
  Let $A=\{a_1,\dots,a_n\}$ be a subset of $[1,2n-1]$ such that
  $a_1+\cdots+a_n$ is divisible by $n$.  Without loss of generality we can
  further assume that $a_1<a_2<\cdots <a_n$. Let $b_i=a_i-i$. We claim
  that $A\mapsto \{b_1,\ldots, b_n\}$ is a bijection onto $\mathrm{EGZ}_n$.
  Clearly, $i\leq a_i\leq n+i-1$ and hence $0\leq b_i\leq n-1$. In this manner we
  can consider each $b_i$ as an element of $\mathbb{Z}_n$. The sum
  $a_1+\cdots+a_n$ is divisible by $n$, by assumption, and hence
  \[b_1 + \dots + b_n
    \equiv a_1 + \dots + a_n - 1 - 2 - \dots - n
    \equiv - \binom{n + 1}{2} \pmod{n}.
  \]
  That this is congruent to $\binom{n}{2}$ modulo $n$ follows from
  $\binom{n}{2}+\binom{n + 1}{2}=n^2$.  Conversely, given a multiset
  $B=\{b_1,\dots,b_n\}$, with $b_1\leq\cdots\leq b_n$, in $\mathrm{EGZ}_n$ we
  define the set $A=\{a_1,\dots,a_n\}$ by $a_i=b_i+i$. One can verify
  that $A$ is a subset of $[1,2n-1]$ whose sum is divisible by $n$, and
  that $A\mapsto B$ is the inverse of the map above, but we omit the
  details.
\end{proof}

The sequence of cardinalities $\left(|\mathrm{EGZ}_n|\right)_{n\geq 1}$ is entry A145855
in the OEIS~\cite{OEIS}. As recorded in that OEIS entry, Jovovi\'c
conjectured and Alekseyev~\cite{Alekseyev2008} proved in 2008 that
\begin{equation}\label{EGZ-cardinality}
  |\mathrm{EGZ}_n| = \frac{1}{2n}\sum_{d | n}(-1)^{n-d}\varphi(n/d)\binom{2d}{d},
\end{equation}
where the sum runs over all positive divisors of $n$ and $\varphi$ is
Euler's totient function.  A generalization of this result was given by
Chern~\cite{Chern2019} in 2019.

The zeros in a multiset $M \in \mathrm{EGZ}_n$ play a prominent role in our
construction. We now introduce a generating function to record their
number.
For a multiset $M\in\mathrm{EGZ}_n$ let $|M|_i$ be the number of occurrences of $i$ in
$M$. Furthermore, let
\[\mathrm{EGZ}_n(t) = \sum_{M\in\mathrm{EGZ}_n} t^{|M|_0}
\]
be the polynomial recording the distribution of zeros in multisets
belonging to $\mathrm{EGZ}_n$. For instance, $\mathrm{EGZ}_3$ consists of the $4$
multisets $\{0,0,0\}$, $\{0,1,2\}$, $\{1,1,1\}$ and $\{2,2,2\}$, and
consequently $\mathrm{EGZ}_3(t)=2+t+t^3$ (looking at the distribution of $1$s or
$2$s in $\mathrm{EGZ}_3$ would result in the same polynomial).
Define the generating functions
\begin{equation*}
  \mathrm{EGZ}(x,t) = \sum_{n\geq 1}\mathrm{EGZ}_n(t) x^n \quad\text{and}\quad
  S(x) = \sum_{n\geq 0}|S_n| x^n.
\end{equation*}
Our main result (Theorem~\ref{main-result}) is a
factorization of the generating function for pointed score sequences:
\[
  S^{\pt}(x,t) = \mathrm{EGZ}(x,t)S(x).
\]
We often view a pair $(s,i)\inS^{\pt}_n$ as a score sequence with a
distinguished position; i.e.\ $i\in\mathrm{dom}(s)$. Taking the
alternative view that $i$ is an element of the codomain of $s$ we find
that $S^{\pt}(x,0)$ consists of terms stemming from pairs $(s,i)$ such that
$s^{-1}(i)$ is empty; i.e.\ $i$ is outside the image of $s$. Thus,
$S^{\pt}(x,1)-S^{\pt}(x,0)$ counts pairs $(s,i)$ for which $i$ is in the image
of $s$. Let
\begin{align*}
  S^{\vpt}_n
  &= \{(s,i)\inS^{\pt}_n: i\in\textrm{Im}(s)\} \\
  &= \{(s,i)\inS^{\pt}_n: \text{$i=s_j$ for some $j\in[n]$}\}
\end{align*}
and let $S^{\vpt}(x)=S^{\pt}(x,1)-S^{\pt}(x,0)$ be the corresponding generating
function. For instance, $S^{\vpt}_3$ consists of the 4 elements
$((0,1,2),0)$, $((0,1,2),1)$, $((0,1,2),2)$, and $((1,1,1),1)$.  We will
show (in Corollary~\ref{catalan-conundrum}) that
\[
  S^{\vpt}(x) = xC(x)S(x),
\]
where $C(x)=(1-\sqrt{1-4x})/(2x)$ is the generating function for the
Catalan numbers $C_n=\binom{2n}{n}/(1+n)$. This striking occurrence of
the Catalan numbers was in fact the original inspiration for our work.
It was in the summer of 2019 that we experimented with score sequences
and conjectured the identity. Despite ample attempts we were for the
longest time unable to prove it.

These results allow us to present the following recursion
(Corollary~\ref{recursion}):
\[
  |S_n| = \frac{1}{n}\sum_{k=1}^{n}|S_{n-k}||\mathrm{EGZ}_k|.
\]
In other words, the logarithmic derivative of the generating function
$S(x)$ is $\mathrm{EGZ}(x,1)/x$, a fact conjectured by Paul D.\ Hanna as recorded
in the OEIS entry A000571 in 2013. This leads to the closed formula (Corollary~\ref{closed1})
\[
  |S_n| = \frac{1}{n!}\sum_{\pi\in \mathrm{Sym}(n)}\prod_{\ell\in C(\pi)}|\mathrm{EGZ}_{\ell}|,
\]
where $C(\pi)$ is a partition encoding the cycle type of $\pi$.
Alternatively,
\[
  |S_n| =
  \sum_{1\cdot m_1+2\cdot m_2+\cdots+ n\cdot m_n \,=\,  n}
  \frac{|\mathrm{EGZ}_{1}|^{m_1} |\mathrm{EGZ}_{2}|^{m_2} \cdots |\mathrm{EGZ}_{n}|^{m_n}}
       {1^{m_1}m_1!\, 2^{m_2}m_2!\,\cdots\, n^{m_n}m_n!},
\]
which is Corollary~\ref{closed2}.

\section{The main theorem and its bijection}\label{section-main-thm}

Let the generating functions $S^{\pt}(x,t)$, $\mathrm{EGZ}(x,t)$ and $S(x)$
be defined as in Section~\ref{section-intro}.

\begin{theorem}\label{main-result} We have
  \[S^{\pt}(x,t) = \mathrm{EGZ}(x,t)S(x).
  \]
\end{theorem}

We shall give a combinatorial proof of Theorem~\ref{main-result} using a
bijection
\[
  \Phi: S^{\pt}_n \to \bigcup_{k=1}^n \mathrm{EGZ}_k\times S_{n-k}
\]
that maps a pointed score sequence to a pair consisting of a multiset
and a score sequence.  A property of this bijection is that, for
$(M,v)=\Phi(s,i)$, the number of occurrences of $i$ in $s$ is equal to
the multiplicity of zero in $M$. Before defining $\Phi$ we need to
introduce several necessary concepts.

A nonempty directed graph is said to be \emph{strongly connected} if there is a
directed path between each pair of vertices of the graph. Note that we do not
consider the empty graph to be strongly connected. A \emph{strong
score sequence} is one which stems from a strongly connected
tournament. Equivalently (see Harary and
Moser~\cite[Theorem~9]{HararyMoser1966}), $s = (s_0,\dots,s_{n-1})$, with $n\geq 1$, is a
strong score sequence if the inequality \eqref{landaus-thm-ii} of
Theorem~\ref{landaus-thm} is always strict; that is,
$s_0+\dots+s_{k-1}>{k \choose 2}$ for $1\leq k < n$.  Let us define the
\emph{direct sum} of two score sequences $u\in S_k$ and $v\in S_{\ell}$
by $u\oplus v = uv'$, where $v'$ is obtained from $v$ by adding $k$ to
each of its letters and juxtaposition indicates concatenation.  For
instance, $(0)\oplus (0)\oplus (1,1,1)=(0,1,3,3,3)$.  If $U$ and $V$ are
tournaments having score sequences $u$ and $v$, one may view the direct
sum $u\oplus v$ as the score sequence of the tournament where arrows are
placed between the vertices of $U$ and $V$ such that they all point
towards $U$:
\begin{center}
  \includegraphics[height=2.3em]{directsum}
\end{center}
This may easily be seen to be
independent of the choice of tournaments.

\begin{lemma}\label{direct-sum-lemma}
  Let $s\in S_n$. If $s_0+\cdots +s_{k-1} = \binom{k}{2}$ for some
  $k<n$, then $u=(s_0,\dots,s_{k-1})$ and $v=(s_k-k, \dots, s_{n-1}-k)$
  are both score sequences, and $s=u\oplus v$.
\end{lemma}

\begin{proof}
  That $u$ is a score sequence is clear from Landau's theorem. By
  definition we have $s=u\oplus v$, so it only remains to show that $v$
  is a score sequence and we will use Landau's theorem to do so, proving
  each of the three parts separately:
  \begin{enumerate}
    \item[\eqref{landaus-thm-i}] Since $s_0+\cdots+s_{k-1} =
      \binom{k}{2}$ and $s_0+\cdots +s_{k} \geq \binom{k+1}{2}$ we have
      $s_k\geq \binom{k+1}{2} - \binom{k}{2} = k$ and hence
      $v_0=s_k-k\geq 0$. Since $s$ is weakly increasing it is clear that
      $v$ is weakly increasing as well. Moreover, the length of $v$ is
      $n-k$ and $v_{n-k-1}=s_{n-1}-k \leq n-1-k$.
    \item[\eqref{landaus-thm-ii}] For $1 \leq j < n-k$ we have
      \begin{align*}
        v_0 + v_1 + \cdots + v_{j-1}
        &= s_k + s_{k+1} + \cdots s_{k+j-1} - jk \\
        &= s_0 + \cdots + s_{k+j-1} - (s_0 + \cdots + s_{k-1}) - jk \\
        &\geq \binom{k+j}{2}-\binom{k}{2}-jk = \binom{j}{2}.
      \end{align*}
    \item[\eqref{landaus-thm-iii}] Similarly,
      $v_0 + v_1 + \cdots + v_{n-k-1} = \binom{n}{2}-\binom{k}{2}-(n-k)k
      = \binom{n-k}{2}$.
  \end{enumerate}
  This concludes the proof.
\end{proof}

A direct consequence of Lemma~\ref{direct-sum-lemma}, above, is that every score sequence
$s$ can be uniquely written as a direct sum
$s=t_1\oplus t_2\oplus\cdots\oplus t_k$ of nonempty strong score sequences;
in this context, the $t_i$ will be called the \emph{strong summands} of
$s$. In terms of underlying tournaments we have the picture:
\[
  \includegraphics[height=3.4em]{unique_fact}
\]

We are now almost in a position to define the promised map $\Phi$, but
first a couple of definitions. Assume that we are given a score sequence
$s=(s_0,s_1,\dots,s_{n-1})\in S_n$.
\begin{itemize}
\item For any integer $j$, let $s+j$ denote the sequence
  obtained by adding $j$ to each element of $s$, reducing modulo $n$,
  and sorting the outcome in nondecreasing order.  Note that $s+j$ need
  not be a score sequence even though $s$ is. E.g.\ $s=(1,1,1)$ is a
  score sequence, but $s+1=(2,2,2)$ is not. On the other hand, if
  $s=(0,1,2)$ then $s+1=s$ is a score sequence. A characterization of
  when $s+j$ is a score sequence will be given in Lemma~\ref{prelude}.

\item Let $\mu(s+j)$ denote the multiset $\{s_0+j,s_1+j,\dots,s_{n-1}+j\}$ with
  elements in the cyclic group $\mathbb{Z}_n$.
\end{itemize}

Given a pointed score sequence $(s,i)\in S^{\pt}_n$, write
$s = t_1\oplus t_2\oplus\cdots\oplus t_k$ and
let $j$ be the smallest index such that $i < |t_1\oplus\cdots\oplus t_j|$.
Another way to define $j$ is as the smallest prefix $t_1\oplus \cdots \oplus t_j$
of strong summands of $s$ that begins $s_0,s_1,\ldots,s_{i}$.
Define the two score sequences $u$ and $v$ by
\[
  u = t_1\oplus\cdots\oplus t_j \quad\text{and}\quad
  v = t_{j+1}\oplus\cdots\oplus t_k.
\]
Finally, we let
\begin{equation*}
  \Phi(s, i) = \bigl(\mu(u-i), v\bigr).
\end{equation*}
As an example, consider the score sequence
$s = (0, 2, 2, 3, 3, 5, 7, 7, 7)$; its decomposition into strong
summands is $s = (0)\oplus (1,1,2,2)\oplus (0)\oplus (1,1,1)$. With
$i=3$ we get $u=(0)\oplus (1,1,2,2) = (0,2,2,3,3)$,
$v=(0)\oplus (1,1,1)=(0,2,2,2)$, $u-3 = (0,0,2,4,4)$ and so
$\Phi(s, 3)= \bigl(\{0,0,2,4,4\}, (0,2,2,2)\bigr)$.

\section{Proof of the main result}

Our aim is to prove Theorem~\ref{main-result}, but first we need to
establish a number of lemmas. Let $T_n$ be the set of strong score
sequences of length $n$.

\begin{lemma}\label{lemmasix}
  For any strong score sequence $s\in T_n$, the $n$ multisets
  \[\mu(s+j) = \{s_0 + j, s_1 + j, \dots, s_{n-1} + j\},\quad\text{for $j\in [0,n-1]$},
  \]
  are all distinct.
\end{lemma}

\begin{proof}
  Assume $j\in [0,n-1]$ is such that $\mu(s+j)$ and
  $\mu(s)$ are equal as multisets over $\mathbb{Z}_n$. Note that there is no
  loss of generality here: assuming that $\mu(s+j_1)=\mu(s+j_2)$
  is equivalent to assuming that $\mu(s+j)=\mu(s)$ with $j=j_2 - j_1$.
  Let
  us write the values $s_0 + j, \dots, s_{n-1} + j$ in nondecreasing order
  after reducing modulo $n$. Since $s_0 \leq \cdots \leq s_{n-1}$ the
  result must be a cyclic shift of the original order, say, $s_k +
  j,\dots,s_{n-1}+j, s_0+j, \dots, s_{k-1}+j$ for some index $k$. As
  each $s_i$ is less than $n$ and $j<n$ we find that those elements must
  equal
  \begin{equation}\label{sorted-list}
    s_k + j-n,\,\dots,\,s_{n-1}+j-n,\, s_0+j,\, \dots,\, s_{k-1}+j.
  \end{equation}
  Since we are assuming that $\mu(s+j)$ and $\mu(s)$
  are equal as multisets over $\mathbb{Z}_n$, the sum
  of the elements listed in \eqref{sorted-list} must equal the
  sum of the elements $s_0+s_1+\cdots+s_{n-1}=\binom{n}{2}$.  This
  implies $nj-(n-k)n=0$, which gives $j=n-k$.  Thus, the sequence
  \eqref{sorted-list} becomes
  \[s_k-k,\,\dots,\,s_{n-1}-k,\, s_0+n-k,\, \dots,\, s_{k-1}+n-k.
  \]
  By assumption we have $s_0=s_k-k$, $s_1=s_{k+1}-k$, and so on;
  thus
  \begin{align*}
    s_0 + \cdots + s_{n-k-1}
    &= s_k-k + \cdots + s_{n-1}-k \\
    &= \binom{n}{2} - (s_0 + \cdots + s_{k-1}) - (n-k)k \\
    &= \binom{k}{2} + \binom{n-k}{2} - (s_0 + \cdots + s_{k-1}).
  \end{align*}
  Suppose $k\geq 1$. Since our score sequence $s$ is strong we have $s_0
  + \cdots + s_{k-1} > \binom{k}{2}$, but then $s_0 + \cdots + s_{n-k-1}
  < \binom{n-k}{2}$ contradicting that $s$ is a score sequence. The only
  remaining possibility is that $k=0$ and $j=0$, which concludes the
  proof.
\end{proof}

Consider the following example concerning the strong summands of a score
sequence $s+j$. Let $s = (1, 1, 2, 2, 4, 6, 7, 7, 7, 8)$
and $j = 5$. We add $5$ to each element of $s$ to get the list of numbers $6$, $6$,
$7$, $7$, $9$, $11$, $12$, $12$, $12$, $13$, which when reduced modulo
$|s|=10$ reads $6$, $6$, $7$, $7$, $9$, $1$, $2$, $2$, $2$, $3$; finally
we sort this list to arrive at $s+5=(1, 2, 2, 2, 3, 6, 6, 7, 7, 9)$.
Note that $s$ and $s+5$ share the same strong summands only arranged
differently:
\begin{align*}
  s &= (1, 1, 2, 2)\oplus (0)\oplus (1, 2, 2, 2, 3);\\
  s+5 &= (1, 2, 2, 2, 3)\oplus (1, 1, 2, 2)\oplus (0).
\end{align*}
As is detailed in the following lemma, this is not a
coincidence. See also Fig.~\ref{f:flip} where we show how this may be
interpreted in terms of tournaments.
\begin{figure}[ht]
  \centering
  \includegraphics[height=4.8em]{flip_arrows}
  \caption{If $s=u\oplus v$, one may view $s+|v|$ as the score sequence
    of a tournament obtained by flipping the direction of all arrows
    pointing out of $V$ towards $U$. Here, $S,U,V$ are tournaments with
    score sequences $s,u,v$ respectively.} \label{f:flip}
\end{figure}

\begin{lemma}\label{prelude}
  Let $s$ be any nonempty score sequence of length $n$ and let
  $j\in [1,n-1]$.  Then $s+j$ is a score sequence if and only if there
  are score sequences $u$ and $v$ with $|v| = j$, such that
  $s = u\oplus v$. In that case, $s + j = v \oplus u$.
\end{lemma}
\begin{proof}
  Let $s = (s_0,s_1,\ldots,s_{n-1})$. Define the sequences
  \begin{align*}
    u &= (s_0,s_1,\ldots,s_{n-j-1}); \\
    v &= (s_{n-j} + j - n, s_{n-j+1} + j - n, \ldots, s_{n-1} + j -n)
  \end{align*}
  of length $n-j$ and $j$, respectively. Assume that $u$ and $v$ are
  score sequences. Clearly, $s = u \oplus v$. Since the length of $v$ is
  $j$ we find that
  \begin{align*}
    v\oplus u = (s_{n-j} + j - n, \ldots, s_{n-1} + j
    -n,s_0+j,s_1+j,\ldots,s_{n-j-1}+j).
  \end{align*}
  If we consider the elements of this sequence
  modulo $n$ we may add $n$ to the first $j$ of them. If we then
  sort the elements in nondecreasing order we obtain the sequence
  $(s_0+j,\ldots,s_{n-1}+j)$. Thus, $s+j = v\oplus u$,
  which is a score sequence. For the other direction, assume that $s+j$
  is a score sequence.  Then by definition of $s+j$ there is an $\ell
  \in [0,n-1]$ such that $s+j$ is
  \begin{equation*}
     (s_\ell + j-n,s_{\ell+1}+j-n,\ldots,s_{n-1}+j-n,s_0+j,s_1+j,\ldots,s_{\ell-1}+j).
  \end{equation*}
  Since $s+j$ is a score sequence of length $n$, we find by item~\eqref{landaus-thm-iii} in
  Landau's theorem that
  \begin{align*}
    \binom{n}{2}
    &= \sum_{i=\ell}^{n-1}(s_i+j-n)+\sum_{i=0}^{\ell-1}(s_i+j) \\
    &= \sum_{i=0}^{n-1} s_i + (n-\ell)(j-n) + \ell j
    \,= \binom{n}{2} + n(\ell - n + j).
  \end{align*}
  Thus, $\ell = n-j$. Now consider the sum of the first $j$ terms
  in $s+j$; let us call this sum $K$. By Landau's theorem we have
  \begin{align*}
    \binom{j}{2} \leq K
    &= \sum_{i=n-j}^{n-1} (s_i+j-n)\\
    &= \sum_{i=n-j}^{n-1} s_i + j(j-n) \\
    &= \binom{n}{2} - \sum_{i=0}^{n-j-1}s_i + j(j-n) \\
    & \leq \binom{n}{2} - \binom{n-j}{2}+ j(j-n) \,=\, \binom{j}{2}.
  \end{align*}
  In particular, the two inequalities above are in fact equalities and
  $K = \binom{j}{2}$.  From Lemma \ref{direct-sum-lemma} we deduce that
  $u$ and $v$ as previously defined are score sequences and that
  $s+j = v\oplus u$. As before, it is clear that $s = u\oplus v$.
\end{proof}

The previous lemma may be equivalently stated as follows:

\begin{lemma}\label{lemmaeight}
  Let $s=t_1\oplus t_2\oplus\cdots\oplus t_k$ be any nonempty score
  sequence decomposed into its strong summands, and let $j\in [1,n-1]$.
  Then $s+j$ is a score sequence if and only if there is an $\ell$ such
  that
  $$j = |t_\ell| + |t_{\ell+1}| + \cdots + |t_k|
  $$
  in which case
  $s+j = t_\ell \oplus t_{\ell+1} \oplus \cdots \oplus t_k \oplus t_1 \oplus \cdots \oplus t_{\ell-1}$.
\end{lemma}

Our next lemma will be essential for proving that the mapping $f$ defined in
Lemma~\ref{last-strong-component}, below, is surjective.

\begin{lemma}\label{surjectivity-helper}
  For all multisets $M\in\mathrm{EGZ}_n$ there is a score sequence $s\in S_n$
  and a constant $j\in[0,n-1]$ such that $\mu(s+j)=M$.
\end{lemma}

\begin{proof}
  Let $M\in\mathrm{EGZ}_n$. By definition of $\mathrm{EGZ}_n$, the sum of the members of
  $M$ is $\binom{n}{2}$ modulo $n$.  We start by showing that for some
  integer $j$ the members of the multiset $M + j = \{x+j: x\in M\}$ will
  have sum exactly $\binom{n}{2}$ (without reducing the sum modulo
  $n$). Suppose that the sum of the members of $M$ is greater than
  $\binom{n}{2}$. We will show that we can always choose a $j$ such that
  $M + j$ has a smaller sum. For $k\in[0, n - 1]$, let $y_k$ be the
  number of element $x\in M$ such that $x\leq k$.  Suppose that
  $y_k > k$ for all $k$.  Then $y_0 \geq 1$ and there is at least one
  zero in $M$.  Similarly, $y_1 \geq 2$ so in addition to that zero
  there is a value equal to at most one.  Continuing like this we bound
  our values from above by $0, 1, \dots, n - 1$.  The sum of these
  values is, however, at most $\binom{n}{2}$. Since we assumed that the
  sum is greater than $\binom{n}{2}$ we conclude that the assertion that
  $y_k > k$, for all $k$, is false. For the remainder of the argument,
  let $k$ be the smallest index such that $y_k \leq k$.

  If $k=0$, then there are no zeroes in $M$, so subtracting one from all
  the elements in $M$ simply causes the sum to drop by $n$ since no
  modulo reductions occur. Thus, we can assume $k > 0$.  Then
  $k - 1 < y_{k - 1} \leq y_k \leq k$ and hence $y_k=k$.  We now
  subtract $k + 1$ from all the elements in $M$. Exactly $y_k$ of these
  values will be below zero.  So we decrease the sum by $n(k + 1)$ but
  reducing modulo $n$ adds $kn$ to the sum.  The combined effect is to
  decrease the sum by $n$.  In this way we can always decrease the sum
  down to $\binom{n}{2}$. The proof that the sum be can be increased in
  the same way is nearly identical.

  Let $M=\{x_1,\ldots,x_n\} \in \mathrm{EGZ}_n$ with $x_1 \leq \dots \leq x_n$.
  In light of the last two paragraphs, we can assume that
  $x_1+\cdots+x_n=\binom{n}{2}$.  The sequence $(x_1,\ldots,x_n)$
  satisfies items $\eqref{landaus-thm-i}$ and $\eqref{landaus-thm-iii}$
  of Landau's theorem. To prove that $(x_1,\ldots,x_n)$ is a score
  sequence it remains to prove item $\eqref{landaus-thm-ii}$,
  namely that $x_1 + \dots + x_k \geq \binom{k}{2}$ for $k\in [1,n-1]$.
  Suppose that
  $x_1 + \dots + x_k < \binom{k}{2}$ for some $k$ in $[1,n-1]$.  For
  now, let $k$ be the largest such $k$. Since $k$ is maximal we have
  $x_1 + \dots + x_{k+1} \geq \binom{k+1}{2}$, which gives us
  $x_{k+1} \geq \binom{k+1}{2} - x_1 - \dots - x_k > \binom{k+1}{2} -
  \binom{k}{2} = k$.  If $x_k \geq k$ then we can decrement $k$
  until this no longer holds true; note that
  $x_1 + \dots + x_{k-1} < \binom{k - 1}{2}$ will continue to hold while
  $x_k \geq k$ and $x_1 + \dots + x_k < \binom{k}{2}$.  We eventually arrive
  at a $k$ such that $x_1 + \dots + x_k < \binom{k}{2}$, $x_k < k$ and
  $x_{k+1} \geq k$.
  The values $x_1, \dots, x_k$ are thus precisely the
  values among $x_1, \dots, x_n$ that are smaller than $k$.
  Define $y_i$ as before and let $w_i = y_i - i - 1$.
  The number of values equal to $r$ among $x_1, \dots, x_k$ is
  $y_r - y_{r-1}$ as long as $r < k$, and so
  \[
    x_1 + \dots + x_k
    = 0\cdot y_0 + 1\cdot (y_1-y_0) + \dots + (k-1)(y_{k-1} - y_{k-2}).
  \]
  This implies
  $(k-1)y_{k-1} - y_{k-2} - \dots - y_0 = x_1 + \dots + x_k <
  \binom{k}{2}$, but we know that $y_{k-1} = k$, so we must have
  $k^2 - \binom{k}{2} < y_{k-1} + \dots + y_0$.  Rewriting in terms of
  $w_k$ we get
  $\binom{k + 1}{2} < w_0 + \dots + w_{k-1} + 1 + 2 + \dots + k$, which
  is equivalent to $w_0 + \dots + w_{k-1} > 0$.  Thus, if we can choose
  a shift (i.e.\ choose a constant to add to the elements of $M$) such
  that the prefix sums of the $w_i$ are non-positive, then the original
  set must be a score sequence.

  Consider the values $k$ such that $w_k = 0$ or, equivalently, $y_k =
  k + 1$.  If we subtract $k + 1$ from every value in our multiset, then exactly
  $k + 1$ of them will become negative.  Thus, our sum decreases by $n(k
  + 1)$ but the modulo reduction adds $n(k + 1)$ back to the sum, so it
  remains unchanged.  Let us consider what this does to our sequences
  $(y_i)$ and $(w_i)$.  Denote the new sequences after the subtraction by
  $(y_i')$ and $(w_i')$.  Consider the value of $y_i'$. It counts the number
  of values from $0$ to $i$ after the subtraction, which are values from $k +
  1$ to $k + 1 + i$ modulo $n$ before the subtraction.
  We consider two cases.

  (a) If $k + 1 + i < n$, then $y_i' = y_{k+1+i} - y_k$.
  Since $y_k = k + 1$ this gives us in terms of $w_i$ that $w_i' + i + 1
  = w_{k+i+1} + k + i + 1 + 1 - k - 1$, which simplifies to $w_i' =
  w_{k+i+1}$.

  (b) If $k + 1 + i \geq n$, then
  $y_i' = y_{n - 1} - y_k + y_{k + 1 + i - n}$. We already know that $y_k = k + 1$ and
  $y_{n - 1} = n$.  In terms of the $w_i$ we have
  $w_i' + i + 1 = n - k - 1 + w_{k+1+i-n}+k+1+i-n+1$, which reduces to $w_i' = w_{k+1+i-n}$.

  Hence, in both cases we have $w_i' = w_{k+i+1}$
  when indices are considered modulo $n$.  We can thus cyclically
  permute the sequence $(w_i)$ as long as the final value continues to
  be $0$ and still have it correspond to a shift of our original multiset
  $M$ such that the shift has sum $\binom{n}{2}$.

  By the same argument as above (when $k=n$) we have
  \[
    x_1 + \dots + x_n = (n - 1)y_{n - 1} - y_{n - 1} - y_{n - 2} - \dots - y_0.
  \]
  Furthermore, $y_{n-1} = n$ and $x_1 + \dots + x_n = \binom{n}{2}$. Thus,
  $y_0 + \dots + y_{n-1} = \binom{n}{2}$, which gives us
  $w_0 + \dots + w_{n-1} = 0$.  Hence, we can consider the sequence of sums
  of values between the
  zeroes that appear in $(w_i)$. This new sequence $(g_i)$ also has sum
  zero and we can cyclically permute the sequence $(w_i)$ in the way we
  want if and only if we can permute the sequence $(g_i)$ to satisfy the same
  desired property.  This is because either all values between two
  zeroes in $(w_i)$ are of the same sign, or the positive values all
  come after the negative ones.  The reason for this is that one cannot
  go from positive values to negative without intercepting zero since we
  decrease by at most one at a time. A sequence of integers with sum zero
  can be cyclically permuted to produce a sequence with non-positive prefix
  sums according to Raney's lemma~\cite{Concrete}. This allows us to
  conclude that the prefix sums, as discussed above, are non-positive
  and so the original set must be a score sequence, which completes our proof.
\end{proof}

Let $T(x)$ be the generating function for the number of strong score
sequences according to length. Note that any nonempty score sequence $s$
can be written $s=u\oplus t$, where $u$ is a score sequence and $t$ is
the last strong summand of $s$, and thus $S(x) = 1 + S(x)T(x)$, or,
equivalently, $S(x)=(1-T(x))^{-1}$.  Let
\[T^{\pt}_n = T_n \times [0,n-1]
\]
be the set of \emph{pointed strong score sequences} of length $n$, and let
\[
  T^{\pt}_n(t) = \sum_{(s,i)\in T^{\pt}_n} t^{|s^{-1}(i)|}\quad\text{and}\quad
  T^{\pt}(x,t) = \sum_{n\geq 1} T^{\pt}_n(t) x^n.
\]

\begin{lemma}\label{last-strong-component}
  Assume $n\geq 1$. Select those pointed score sequences $(s,i)$ in
  $S^{\pt}_n$ whose distinguished position is in the last strong summand,
  and denote the resulting set $L_n$. That is,
  \[L_n=\bigl\{(s,i)\inS^{\pt}_n: s=t_1\oplus \cdots \oplus t_k \mbox{ and } i\in [n-|t_k|,n-1]\bigr\}.
  \]
  Then the mapping $f:L_n\to \mathrm{EGZ}_n$ defined by
  \[ f(s,i) = \mu(s-i)
  \]
  is a bijection. Moreover, if $M = f(s,i)$, then
  $|M|_0 = |s^{-1}(i)|$.  In terms of generating functions we have
  \[ \mathrm{EGZ}(x,t) = S(x)T^{\pt}(x,t).
  \]
\end{lemma}

\begin{proof}

  We start by proving that $f$ is injective. To that end, assume that
  $(u,i)$ and $(v,j)$ in $L_n$ are such that $f(u,i) = f(v,j)$; that is,
  \[\mu(u-i) = \mu(v-j) = M,\quad  \text{where $M\in \mathrm{EGZ}_n$}.
  \]
  If $u=v$, then $i=j$ by Lemma~\ref{lemmasix}, so we may assume that
  $u$ and $v$ are different score sequences.  Without loss of generality
  we may further assume that $i\leq j$. Now, $\mu(u-i) = \mu(v-j)$ holds
  by assumption, and this multiset identity is true if and only if
  $\mu(u) = \mu(v+(j-i))$.  Thus, $u=v+m$ with $m=j-i$.  Assume that the
  decomposition of $v$ into its strong summands is
  $v = t_1 \oplus \cdots \oplus t_k$. By
  Lemma~\ref{lemmaeight}, the score sequences $u$ and $v$ contain the
  same strong summands up to a cyclic permutation.  To be more precise,
  there is an $\ell\geq 1$ such that
  \[
    m=|t_{\ell}|+\cdots+|t_k|\quad\text{and}\quad
    u = t_{\ell+1} \oplus \cdots\oplus t_k \oplus t_1 \oplus \cdots \oplus t_{\ell}.
  \]
  By definition of the set $L_n$ we have $i \in [n-|t_{\ell}|,n-1]$ and
  $j \in [n-|t_{k}|,n-1]$.  Therefore
  $m=j-i \leq n-1-(n-|t_{\ell}|) = |t_{\ell}|-1$.  This would however imply
  $|t_{\ell}|+\cdots+|t_k|< |t_{\ell}|$, which is impossible.
  Therefore no such $i$ and $j$ can exist and the mapping $f$ is
  injective.

  Next we prove surjectivity.  We want to prove that every $M\in\mathrm{EGZ}_n$
  is the image of some score sequence $s \in S_n$ with a distinguished
  element $i$ in its last strong summand, i.e.\ $(s,i)\in L_n$. By
  Lemma~\ref{surjectivity-helper} every $M \in \mathrm{EGZ}_n$ is the image of some such $(s, j)$
  where we place no restriction on $j$. If $j$ is smaller
  than the size of the last strong summand of $s$, then $f$
  maps the pointed score sequence $(s,n-j)$ to our multiset $M$.
  If $j$ is greater than the size of the last strong summand of $s$,
  then we can move the last summand to the front and decrease $j$ by
  the corresponding size by Lemma~\ref{lemmaeight}. In this way
  we will eventually end up in the first case. Thus, we end up with a
  score sequence that maps to our multiset $M$.

  We have shown that $f$ is a bijection. Assume that $(s,i) \in L_n$ and
  $M=f(s,i)$. By definition of $f$ it is clear that the number of zeros
  in $M$ corresponds to the number of $j$ for which $s_j=i$, and hence
  $|M|_0 = |s^{-1}(i)|$.  Every $(s,i) \in L_n$ can be uniquely
  identified with a pair $(s',(t,j))$, where $s=s' \oplus t$, $t$ is the
  last strong summand of $s$, and $j=i-|s'|$.  In other words, $s'$ is
  the score sequence $s$ with its last strong summand $t$ removed, and
  $j$ is the distinguished position relative to $t$ rather than
  $s$. Assuming $k=|s'|$, we have $s' \in S_k$ and
  $(t,j) \in T^{\pt}_{n-k}$ with $|t^{-1}(j)|=|M|_0$.  Consequently,
  $\mathrm{EGZ}(x,t) = S(x)T^{\pt}(x,t)$ as claimed.
\end{proof}

We are now finally in a position to prove our main result.

\begin{proof}[Proof of Theorem~\ref{main-result}]
  We will give a combinatorial proof of the power series identity
  $S^{\pt}(x,t) = \mathrm{EGZ}(x,t)S(x)$ by showing that the mapping
  \[
  \Phi: S^{\pt}_n \to \bigcup_{k=1}^n \mathrm{EGZ}_k\times S_{n-k}
  \]
  defined in Section~\ref{section-main-thm} is a bijection.  Recall that
  $\Phi(s,i)=(\mu(u-i),v)$ is defined by writing $s$ in terms of its
  strong summands, say $s=t_1\oplus t_2\oplus\cdots\oplus t_k$, and then
  splitting the score sequence $s=u \oplus v$, where
  $u=t_1\oplus\cdots\oplus t_j$ and $j$ is the smallest index such that
  $i < |t_1\oplus\cdots\oplus t_j|$, and $v$ is the remainder. Let $L_n$
  be the set defined in Lemma~\ref{last-strong-component}. Note that
  $(u,i)\in L_{|u|}$. In fact, it is easy to see that
  $(s,i)\mapsto \bigl((u,i), v\bigr)$ is a bijection from $S^{\pt}_n$ to
  $\cup_{k=1}^n L_k\times S_{n-k}$. Moreover, by
  Lemma~\ref{last-strong-component}, $(u,i)\mapsto\mu(u-i)$ is a
  bijection from $L_k$ to $\mathrm{EGZ}_k$, and hence $\Phi$ is a bijection as
  well. Finally, $(u,i)\mapsto\mu(u-i)$ has the property
  that $|\mu(u-i)|_0 = |u^{-1}(i)|$ and so $S^{\pt}(x,t) = \mathrm{EGZ}(x,t)S(x)$,
  as claimed.
\end{proof}

\begin{corollary}\label{catalan-conundrum}
  We have
  \[S^{\vpt}(x) = xC(x)S(x),
  \]
  where $C(x)$ is the generating function for the Catalan numbers.
\end{corollary}

\begin{proof}
  From Theorem~\ref{main-result} we get
  \[S^{\vpt}(x) = S^{\pt}(x,1)-S^{\pt}(x,0) = \bigl(\mathrm{EGZ}(x,1)-\mathrm{EGZ}(x,0)\bigr)S(x).
  \]
  It thus suffices to show that $\mathrm{EGZ}(x,1)-\mathrm{EGZ}(x,0)=xC(x)$. Note that
  the coefficient of $x^n$ in $\mathrm{EGZ}(x,1)-\mathrm{EGZ}(x,0)$ is the number of
  multisets of $\mathrm{EGZ}_n$ that contain at least one zero. On removing a
  single zero from such a multiset we are left with a multiset of size
  $n-1$ whose sum is $\binom{n}{2}$ modulo $n$. There are $C_{n-1}$ such
  multisets~\cite[ Exercise 6.19jjj]{EC2}.
\end{proof}

\section{The number of score sequences}

Since $S^{\pt}_n=S_n\times [0,n-1]$ there is a
simple relation $|S^{\pt}_n|=n|S_n|$ between the number of pointed
score sequences and the number of (plain) score sequences. The
generating function for $|S^{\pt}_n|$ is $S^{\pt}(x,1)$ and letting $t=1$ in
the main theorem we have $S^{\pt}(x,1)=\mathrm{EGZ}(x,1)S(x)$. From this and
Equation~\ref{EGZ-cardinality} in Section~\ref{section-intro} the
corollary below immediately follows.

\begin{corollary}\label{recursion}
  For $n\geq 1$,
  \begin{align*}
    |S_n|
    &= \frac{1}{n}\sum_{k=1}^{n}|S_{n-k}||\mathrm{EGZ}_k| \\
    &= \frac{1}{n}\sum_{k=1}^{n}|S_{n-k}|
      \frac{1}{2k}\sum_{d | k}(-1)^{k-d}\varphi(k/d)\binom{2d}{d}.
  \end{align*}
\end{corollary}

Using dynamic programming and the sieve of Eratosthenes this allows us
to calculate all values of $|S_k|$ for $k \leq n$ in $\mathcal{O}(n^2)$
time, assuming constant time integer operations. This is an improvement
on earlier results by Narayana and Bent~\cite{NarayanaBent1964}. Their
recursive formula can be implemented to find $|S_n|$ in $\mathcal{O}(n^3)$,
but no faster since their recursive function must always visit $\mathcal{O}(n^3)$
states to do so; to get all $|S_k|$ for $k \leq n$ takes $\mathcal{O}(n^4)$
due to lack of overlap in the states recursively visited for different $k$. \\

Since $S(x) = (1 - T(x))^{-1}$ this can be extended to $|T_k|$. We can
rewrite the equation as $T(x) = S(x) - (S(x) - 1)T(x)$, which gives
us the recursion
\[
  |T_n| = |S_n| - \sum_{i = 1}^{n - 1} |T_i| |S_{n-i}|.
\]
We first calculate the values $|S_k|$ and use this recursion
to calculate all the values $|T_k|$ for $k \leq n$ in $\mathcal{O}(n^2)$. This
is the same method as used by Stockmeyer~\cite{Stockmeyer2022}, just
calculating the underlying $|S_k|$ faster which brings the total time complexity
down from $\mathcal{O}(n^4)$ to $\mathcal{O}(n^2)$.

We shall derive a closed formula for $|S_n|$ from
Corollary~\ref{recursion}, but first we generalize the setting a little.
Considering a power series $A(x)=\sum_{n\geq 0}a_nx^n$. The coefficient
of $x^n$ in $x\frac{d}{dx}A(x)$ is $na_n$. For this reason
$x\frac{d}{dx}$ is sometimes called a pointing operator. The logarithmic
derivative of $A(x)$ is $A'(x)/A(x)$. In the same vein, let the
\emph{logarithmic pointing} of $A(x)$ be
\[xA'(x)/A(x) = x \frac{d}{dx}\bigl(\log A(x)\bigr).
\]

\begin{lemma}
  Let a power series $A(x)=\sum_{n\geq 0}a_nx^n$ with $a_0=1$ be
  given. Let $B(x)=\sum_{n\geq 1}b_nx^n$ be the logarithmic
  pointing of $A(x)$. Equivalently, the sequence of numbers
  $\{b_n\}_{n\geq 0}$ is implicitly given by $b_0=0$ and
  \[a_n = \frac{1}{n} \sum_{k=1}^{n}a_{n-k}b_k \qquad\text{for $n\geq 1$.}
  \]
  Then
  \begin{equation}\label{general-closed-formula}
    a_n = \frac{1}{n!}\sum_{\pi\in \mathrm{Sym}(n)}\prod_{\ell\in C(\pi)}b_{\ell},
  \end{equation}
  where $\mathrm{Sym}(n)$ the symmetric group of degree $n$ and
  $C(\pi)$ encodes the cycle type of $\pi$; i.e.\ there is an $\ell\in C(\pi)$
  for each $\ell$-cycle of $\pi$.
\end{lemma}
\begin{proof}
  For $n=0$ there is a single member of $\mathrm{Sym}(n)$, namely the empty
  permutation. It has no cycles and \eqref{general-closed-formula} says
  $a_0=1$ as expected. We proceed by induction. Assume that $n\geq 1$
  and consider the disjoint cycle structure of a permutation
  $\pi \in \mathrm{Sym}(n)$. Let $\alpha$ be the cycle of $\pi$ that $n$ belongs
  to, and let $k=|\alpha|$ be the length of that cycle. Then
  $\pi\alpha^{-1}$ fixes the elements of $\alpha$ and we can consider it
  a permutation of the remaining $n-k$ elements. Let $\pi'$ be the
  ``standardization'' of $\pi\alpha^{-1}$; i.e.\ we replace the smallest
  element of $\pi\alpha^{-1}$ with $1$, the next smallest with $2$,
  etc. This defines a mapping $\pi \mapsto \pi'$ from $\mathrm{Sym}(n)$ to
  $\mathrm{Sym}(n-k)$; e.g.\ if $\pi=(1\, 6\, 2)(3\, 5)(4\, 7)$, then
  $\alpha=(4\, 7)$, $\pi\alpha^{-1}=(1\, 6\, 2)(3\, 5)$, and
  $\pi'=(1\, 5\, 2)(3\, 4)$. How many permutations $\pi$ map to the same
  $\pi'$? As many as there are choices for the cycle $\alpha$, namely
  $\binom{n-1}{k-1}(k-1)!=(n-1)!/(n-k)!$; let us call this number
  $d$. Thus, $\pi \mapsto \pi'$ is a $d$-to-1 mapping, and in terms of equations:
  \begin{align*}
    \frac{1}{n!}\sum_{\pi\in \mathrm{Sym}(n)}\prod_{\ell\in C(\pi)}b_{\ell}
    &= \frac{1}{n!} \sum_{k = 1}^n \frac{(n-1)!}{(n-k)!} b_k \sum_{\pi' \in \mathrm{Sym}(n - k)} \prod_{\ell \in C(\pi')} b_\ell\\
    &= \frac{1}{n} \sum_{k = 1}^n \frac{1}{(n-k)!} b_k (n - k)! a_{n-k} \\
    &= \frac{1}{n} \sum_{k = 1}^n b_k a_{n-k} \\
    &= a_n,
  \end{align*}
  where in the second equality we used the induction hypothesis for $a_{n-k}$.
\end{proof}

Since the logarithmic pointing of $S(x)$ is $\mathrm{EGZ}(x,1)$ the lemma above
applies and we have a closed form for the numbers $|S_n|$:

\begin{corollary}\label{closed1}
  For $n\geq 1$,
  \[
    |S_n| = \frac{1}{n!}\sum_{\pi\in \mathrm{Sym}(n)}\prod_{\ell\in C(\pi)}|\mathrm{EGZ}_{\ell}|.
  \]
\end{corollary}

By collecting terms with equal cycle type we arrive at the following
alternative formula.

\begin{corollary}\label{closed2}
For $n\geq 1$,
\[
  |S_n| =
  \sum_{1\cdot m_1+2\cdot m_2+\cdots+ n\cdot m_n \,=\,  n}
  \frac{|\mathrm{EGZ}_{1}|^{m_1} |\mathrm{EGZ}_{2}|^{m_2} \cdots |\mathrm{EGZ}_{n}|^{m_n}}
       {1^{m_1}m_1!\, 2^{m_2}m_2!\,\cdots\, n^{m_n}m_n!}.
\]
\end{corollary}

\bibliographystyle{plain}

Counting tournament score sequences


Polynomials non-negative on strips and half-strips

Abstract: In 2008, M. Marshall settled a long-standing open problem by showing that if f(x,y) is a polynomial that is non-negative on the strip [0,1] x R, then there exist sums of squares s(x,y) and t(x,y) such that f(x,y) = s(x,y) + (x - x^2) t(x,y). In this paper, we generalize Marshall's result to various strips and half-strips in the plane. Our results give many new examples of non-compact semialgebraic sets in R^2 for which one can characterize all polynomials which are non-negative on the set. For example, we show that if U is a compact set in the real line and {g_1, ..., g_k} a specific set of generators for U as a semialgebraic set, then whenever f(x,y) is non-negative on U x R, there are sums of squares s_0, ..., s_k such that f = s_0 + s_1 g_1 + ... + s_k g_k.

\section{Introduction}

Throughout, we work in the real polynomial ring in two variables, which we
denote by $\mathbb R[x,y]$.  The set of sums of squares in $\mathbb R[x,y]$ is denoted
by $\sum \mathbb R[x,y]^2$.
Recently, M.~Marshall \cite{MM_strip} settled a long-standing open problem by
proving the following:

\begin{theorem} \label{mar} Suppose $f(x,y) \in \mathbb R[x,y]$ is non-negative
on the strip $[0,1] \times \mathbb R$.  Then there exist $\sigma(x,y), \tau(x,y)
\in \sum \mathbb R[x,y]^2$ such that $$f(x,y) = \sigma(x,y) + \tau(x,y) (x - x^2).$$
\end{theorem}

An expression $f = \sigma + \tau (x - x^2)$ is an immediate witness to the
positivity condition on $f$.  In general, one wants to characterize polynomials
$f$
which are positive, or non-negative,  on a semialgebraic set $K \subseteq \mathbb R^n$
in terms of sums of squares and the polynomials used to define $K$.
Representation theorems of this type have a long and illustrious history, going
back at least to Hilbert.  There has been much interest in these questions
in the last decade, in a large part because of applications outside of
real algebraic geometry, notably in problems of optimizing polynomial
functions on semialgebraic sets.
In this paper we look at some generalizations of Marshall's theorem.  Our results
give many new examples of non-compact semialgebraic sets in $\mathbb R^2$ for
which one can characterize all polynomials which are non-negative on the set.

Let $\mathbb R[X] $ denote
$\mathbb R[x_1, \dots , x_n]$, the real polynomial ring in $n$ variables,
and write $\sum \mathbb R[X]^2$ for the sums of squares in $\mathbb R[X]$.
Given a finite set $S = \{ s_1, \dots , s_k \} \subseteq \mathbb R[X]$
the {\it basic closed semialgebraic set in $\mathbb R^n$ generated by $S$}, denoted
$K_S$, is
$\{ a \in \mathbb R^n \mid s_i(a) \geq 0$ for $i = 1, \dots , k  \}$.
Note that the
strip $[0,1] \times \mathbb R$ is the basic closed semialgebraic set in $\mathbb R^2$
generated by $\{ x - x^2 \}$.

There are two
algebraic objects associated to the semialgebraic set $K_S$:  The {\it quadratic module generated by
$S$}, denoted $M_S$,  is the set of all elements of $\mathbb R[X]$ which can be written
$\sigma_0 + \sigma_1 s_1  + \dots + \sigma_k s_k$, where each $\sigma_i \in \sum \mathbb R[X]^2$.
The {\it preordering } generated by $S$, denoted $T_S$,  consists
of all elements of the form $\sum_{e \in \{0,1\}^k} \sigma_e s^e$, where
$s^e$ denotes $s_1^{e_1} \dots s_s^{e_s}$ for $e = (e_1, \dots , e_s)$, and
each $\sigma_e \in \sum \mathbb R[X]^2$.   In general, $M_S \subsetneqq T_S$, although
if $|S| = 1$, then clearly $T_S = M_S$. Also, $T_S = M_S$ iff $M_S$ is closed
under multiplication iff $s_i \cdot s_j \in M_S$ for all $i,j$.

We recall briefly what is known about the existence of representations in $T_S$ or $M_S$
for polynomials positive or non-negative on $K_S$.    If $K_S$ is compact, then Schm\"udgen's Theorem \cite{Schm} says
that every $f$ which is strictly positive
on $K_S$ is in $T_S$, regardless of the choice of generators $S$.  However, in general,
one cannot replace $f > 0$ on $K_S$ by $f \geq 0$  on $K_S$, or replace $T_S$ by
$M_S$.  If $K_S$ is not compact and $\dim(K_S) \geq 3$  then by \cite[Prop. 6.1]{S_99},
there always exist polynomials $f$ which are positive on $K_S$, but not in $T_S$, regardless
of the choice of generators $S$.   The same is true if $\dim(K_S) = 2$ and
$K_S$ contains an open cone, by \cite[Prop. 3.7]{PS} .
By \cite[Thm. 2.2]{KM_MP}, if  $K_S \subseteq \mathbb R$ and is not compact, then $T_S$ contains every $f$ which is
non-negative on $K_S$,  provided one chooses the right set of generators $S$.  If $K_S \subseteq \mathbb R$ and
is compact, then $M_S$  contains all polynomials non-negative on $K_S$, again provided
one chooses the right set of generators.
(We give an elementary proof of this in \S 2.)

We say that $M_S$ (respectively, $T_S$) is {\it saturated} if for every $f \in \mathbb R[X]$,
$f$ non-negative on $K_S$ implies $f \in M_S$ (respectively, in $T_S$).
Marshall's Theorem says that the
 the quadratic module in $\mathbb R^2$ generated by $x - x^2$   is saturated.
This was only the second example given of  a finitely generated saturated
preordering in the non-compact case (the first being
the preordering generated by $x, 1-x$ and $ 1 - xy$ given in  \cite[Rem. 3.14]{S}),
and settled a long-standing open problem.

Our aim in this paper is to give families of examples related to Marshall's
theorem.   In the next section, we generalize Marshall's result to the case
$U \times \mathbb R$, where $U$ is any compact set in $\mathbb R$, more precisely, we show
that if  $S \subseteq \mathbb R[x]$ is the ``obvious" set of generators for $U$, then the quadratic
module in $\mathbb R[x,y]$ generated by $S$ is saturated.   In \S 3, we look at some non-compact
subsets of
a strip $[a,b] \times R$ which are bounded as $y \rightarrow -\infty$; we refer to
such a set as a half-strip in $\mathbb R^2$.  We give a representation theorem for a half-strip
of the form $(U \times \mathbb R) \cap \{ y \geq q(x) \}$, where $U \subseteq \mathbb R$ is compact
and $q(x) \geq 0$ on $U$.  We give other examples of half-strips for which the
corresponding preordering is saturated, as well as a family of negative examples.

The authors are grateful to Bruce Reznick, and especially Murray Marshall, for helpful
discussions concerning the work in this paper.

\section{Polynomials non-negative on  strips in the plane}

In this section, we give representation theorems for non-compact basic closed  semialgebraic sets
which are contained in a subset of $\mathbb R^2$ of the form $[a,b] \times \mathbb R$ and are
unbounded as $y \rightarrow \pm \infty$.  We refer to such a set as a {\it strip} in the plane.
We start with a representation theorem for strips of
the form $U \times \mathbb R$, where $U \subseteq \mathbb R$ is compact.  More precisely, we show that
the quadratic module  corresponding to $U \times \mathbb R$ is saturated, as long as we choose the
right set of generators.   We end this section with a few remarks about the
more general case of $U \times W$, where $W \subseteq \mathbb R$ is a non-compact basic closed
semialgebraic set.

For the rest of this section, fix $U \subseteq \mathbb R$ compact, say $U = [a_1,b_1] \cup \dots \cup [a_k,b_k]$, where $a_1 \leq b_1 < a_2 \leq b_2 < \dots <a_k \leq b_k$.   Define $S \subseteq \mathbb R[x]$ by
$$S = \{x - a_1, (x - a_2)(x - b_1), \dots, (x - a_k)(x - b_{k-1}), b_k - x \}.$$  Then the basic closed
semialgebraic set generated by $S$ in $\mathbb R$ (respectively in $\mathbb R^2$) is $U$ (respectively $U \times \mathbb R$).  By analogy with the non-compact case
in $\mathbb R$ (see \cite{KM_MP}), we call $S$ the {\it natural choice of generators} for $U$.

\begin{lemma} \label{dim1} Suppose $U \subseteq \mathbb R$ is compact and $S \subseteq \mathbb R[x]$ is the natural choice
of generators.  Then in  $\mathbb R[x]$, $T_S = M_S$.  It follows immediately that the same is
true in $\mathbb R[x,y]$.
\end{lemma}

\begin{proof}  Let $U$ be as above  and, for ease of exposition, set
$s_i = (x - a_{i+1})(x - b_i)$ for $i = 1, \dots k-1$.
The identities
$$(x - a_1)(b_k - x) = \frac{1}{b_k - a_1} \left( (b_k - x)^2 (x - a_1) + (x - a_1)^2 (b_k - x) \right),$$
$$x - a_1 = \frac{1}{b_k - a_1} \left( (x-a_1)^2 + (x - a_1)(b_k - x)\right), \text{ and }$$
$$b_k - x = \frac{1}{b_k - a_1} \left( (b_k - x)^2 +  (x - a_1)(b_k - x)\right)$$
show that the quadratic module generated by $\{ (x - a_1)(b_k - x), s_1, \dots , s_{k-1} \}$ is the
same as $M_S$.  Thus
to prove $T_S = M_S$, it is enough to prove that $s_i s_j \in M_S$ for $1 \leq i < j \leq k-1$
and $(x - a_1)(b_k - x) s_i \in M_S$ for $1 \leq i \leq k-1$.

 Suppose $1 \leq i < j \leq k-1$, then it is easy to check that
$s_i + s_j \geq 0$ on $[a_1,b_k]$.  Let $m$ be the maximum of $s_i + s_j$ on $[a_1,b_k]$,
then $s_i s_j \geq \frac{1}{m} (s_i + s_j)(s_i s_j)$ on $[a_1,b_k]$ and so
$$f:= s_i s_j - \frac{1}{m} \left( s_j^2 s_i + s_i^2 s_j\right) \geq 0 \text{ on } [a_1,b_k].$$
It is well-known that the quadratic module generated by
$\{ x- a_1, b_k - x \}$ is saturated (see, e.g., \cite[Cor. 11]{PR1}) and  hence $f \in M_S$.
Then $s_i s_j = f + \frac{1}{m} ( s_j^2 s_i + s_i^2 s_j) \in M_S$.

Finally, for $1 \leq i \leq k-1$, it's easy to check that $(x - a_1)(b_k - x) + s_i \geq 0$ on $[a_1,b_k]$ and
an argument similar to the previous argument shows that $ (x - a_1)(b_k - x) s_i \in M_S$.
\end{proof}

Our goal in this section is to prove the following:

\begin{theorem} \label{striptheorem} Let $U$ and $S$ be as above and  $M$ the quadratic
module  in $\mathbb R[x,y]$ generated by
$S$.  Then $M$ is saturated.  In other words, if $f(x,y) \in \mathbb R[x,y]$ is non-negative on $U \times \mathbb R$, then $f \in M$.
\end{theorem}

We begin with a proof for the case where $f$ is a polynomial in $x$ only.

\begin{prop}  \label{dim1case} Suppose $U \subseteq \mathbb R$ is compact with $S$ the natural choice of generators.  Then the quadratic module in $\mathbb R[x]$ generated by $S$  is saturated.
\end{prop}

\begin{proof}  Let $T$ be the preordering in $\mathbb R[x]$ generated by $S$.   By Lemma \ref{dim1},
it is enough to prove that  $T$ is saturated.  We note that the proof of this is similar to the
proof of \cite[Thm. 2.2]{KM_MP}.

Suppose $f \in \mathbb R[x]$ and $f \geq 0$ on $U$, then
 we can factor $f$ in $\mathbb R[x]$ into psd quadratics and linear polynomials.  Since psd implies sos in $\mathbb R[x]$, it
is enough to prove the proposition for $f$ a product of linear polynomials.  We proceed by induction on $d = \deg f$.  The
$d = 0$ case is trivial.  So suppose $x - r$ is a factor of $f$ and write $f = (x - r) f_1$.  If $r \leq a_1$, then
$x - r \geq 0$ on $U$, hence $f_1 \geq 0$ on $U$ as well.  Then $f = [(x - a_1) + (a_1 - r)] f_1$ and we are done
since $(x-a_1) + (a_1 - r) \in T$, and $f \in T$ by induction.  The case of $r \geq b_k$ is similar.

Now suppose $a_i \leq r \leq b_{i+1}$ for some $i$.  Since $f$ changes sign at $r$, there must be another
root $s$ of $f$ with $a_i \leq s \leq b_{i+1}$.  Then $f = (x - r)(x - s) f_1$ with $f_1 \geq 0$ on $U$,
and, by \cite[Lemma 4]{BCJ}, $(x -r)(x - s)$ is in the preordering generated by $(x - b_i)(x - a_{i+1})$ and
hence in $T$.  Since $f_1 \in T$ by induction, we have $f \in T$ in this case as well.
\end{proof}

It follows immediately that Theorem \ref{striptheorem} is true
if $f$ is a polynomial in $x$ only.  So suppose we have $f \in \mathbb R[x,y]$ such that
$f \geq 0$ on $U \times \mathbb R$ and $\deg_y f \geq 1$.  Since $f$ is positive as $|y| \rightarrow \pm \infty$, it
follows that $f$ has even degree as a polynomial in $y$ and that the leading coefficient of
$f$ as a polynomial in $y$ is non-negative on $U$.

Next we show that it is enough to prove Theorem \ref{striptheorem} for the
case where the leading coefficient of $f$ (as a polynomial in $y$) is positive on $U$.   The proof
is a straightforward
generalization of the proof of \cite[Lemma 2.1]{MM_strip}.

\begin{lemma}\label{Lem4} It is enough to prove Theorem \ref{striptheorem}
for $f \in \mathbb R[x,y]$ such that the leading coefficient of $f$ as a
polynomial in $y$ is strictly positive on $U$.
\end{lemma}

\begin{proof}  Arguing exactly as in the proof of \cite[Lemma 2.1]{MM_strip},
we can reduce to showing that if
$h \in \mathbb R[x]$ with $h \geq 0 \text{ on } U$,  and $h$ is $\pm$ a product of
linear factors $x - r$ with $r \in U$,
then for any $f \in \mathbb R[x,y]$, $h f \in M$ implies $f \in M$.
The proof is by induction on $\deg h$.  If $\deg h = 0$, this is trivial, hence we assume $\deg h \geq 1$.

For ease of exposition,  let $s_0 = 1, s_1 = x - a_1, s_2 = (b_1 - x)(a_2 - x) , \dots , s_k = (b_{k-1} - x)(a_k - x),
s_{k+1} = b_k - x$.  Since $hf \in M$, we have
\begin{equation} \label{lem4.1}
hf  =  \sigma_0 s_0 + \sigma_1 s_1 + \dots + \sigma_{k+1} s_{k+1},
\end{equation}
where each $\sigma_i \in \sum \mathbb R[x,y]^2$.

Given $r \in U$ and suppose $x - r$ is  a factor of $h$.  There are several cases to consider.
\smallskip

\noindent
Case 1:  Suppose  $r$ is in the interior of $U$,
then since  $h$ does not change sign at $r$, it follows that
$(x - r)^2$ divides $h$.
Substituting $x = r$ into both sides of \eqref{lem4.1}, we have
$0 = \sum_{i=0}^{k+1} \sigma_i(r,y) s_i(r)$.
Since  each $s_i(r)$ is positive, it follows that
$\sigma_i(r,y) = 0$ for all $y \in \mathbb R$.  Thus $\sigma_i(r,y)$ is
identically zero, which implies that $x - r$ divides each
coefficient of $\sigma_i(x,y)$, and consequently $x - r$ divides $\sigma_i(x,y)$.
Since $\sigma_i(x,y)$ is a sum of squares, it follows that $(x - r)^2$
divides $\sigma_i(x,y)$.  Dividing both sides of \eqref{lem4.1} by $(x - r)^2$,
we are done by induction.

\medskip

\noindent
Case 2:  Suppose $s_1 = x - a_1$ or $s_{k+1} = x - b_k$ divides $h$.  We give the proof for $s_1$,
the proof for $s_{k+1}$ is the same.
If $ x - a_1$ divides $h$, substituting
$x = a_1$ into  \eqref{lem4.1}, we have
$0 = \sigma_0(a_1,y)  + \sum_{i=2}^{k+1} \sigma_i(a_1,y) s_i(a_1) $.
Since $s_i(a_1) > 0$ for $2 \leq i \leq k+1$, arguing
as in the first case, this implies that $(x - a_1)^2$ divides $\sigma_i(x,y)$ for
$i = 2, \dots , k+1$.   Let $\tau_i(x,y) = \sigma_i(x,y)/(x - a_1)^2 \in \sum \mathbb R[x,y]^2$.   Dividing both sides of \eqref{lem4.1} by $x - a_1$, we
obtain
\begin{equation} \label{eqn2}
\frac{h}{x - a_1} f =  \tau_0  (x - a_1)  + \sigma_1  +
\tau_2 (x - a_1) s_2 + \dots +\tau_{k+1} (x - a_1) s_{k+1}
\end{equation}
By Lemma \ref{dim1},  $M$ is closed under
multiplication, hence $(x - a_1) s_i \in M$ for each $i$.  It follows that
 the right-hand side of \eqref{eqn2} is in
$M$ and we are done by induction.

\medskip

\noindent
Case 3:  Suppose neither Case 1 nor Case 2 applies, then $h$ contains a factor $x - a_i$ for
$2 \leq i \leq k$, or $x - b_i$ for $1 \leq i \leq k - 1$.  We give the proof for $x - a_i$, the
proof for $x - b_i$ is the same.  Since $h \geq 0$ on $U$ and  does
not change sign at any interior point of $U$, it follows that $h$ contains a factor $(x - a_i)^2$
or  a factor $(x - a_i)(b_i - x) = s_i$.   In the first case, applying the argument of Case 2
twice, we see that  $(x - a_i)^2$ must divide every term on the right-hand side of \eqref{lem4.1} and we
are done by induction. In the second case, we argue as in Case 2 to conclude that $s_i$ divides
every term on the right-hand side of \eqref{lem4.1} and we are again done by induction.

\end{proof}

\begin{lemma}\label{Lem6} We may assume that $f$ has finitely many zeros on $U \times \mathbb R$.
\end{lemma}

\begin{proof} The proof is essentially the same as the proof of \cite[Lemma 2.2]{MM_strip}.
\end{proof}

\begin{lemma}\label{Lem7} Suppose $f = \sum_{i=0}^{2d} a_i(x) y^i$ is non-negative on $U \times \mathbb R$,
$f$ has only finitely many zeros in $U \times \mathbb R$,
and $a_{2d} > 0$ on $U$.  Then there exists $\epsilon(x) \in \mathbb R[x]$, with $\epsilon(x) \geq 0$ on $U$, such that $f(x,y) \geq \epsilon(x)(1 + y^2)^d$ holds on $U \times \mathbb R$, and for each $x \in U$, $\epsilon(x) = 0$ if and only if there exists $y \in \mathbb R$ such that $f(x,y) = 0$.
\end{lemma}

\begin{proof}By \cite[Lemma 4.2]{MM_strip} and its proof, for $i = 1, \dots, k$, there exists a polynomial $\epsilon_i(x) \in \mathbb R[x]$, with  $\epsilon_i(x) \geq 0 \text{ on } [a_i, b_i]$, such that $f(x,y) \geq \epsilon_i(x)(1 + y^2)^d$ holds on $[a_i, b_i] \times \mathbb R$, $\epsilon_i(x) = 0$ for $x \in [a_i, b_i]$ if and only if there exists $y \in \mathbb R$ such that $f(x,y) = 0$, and $\epsilon_i(x) \neq 0$ for $x \in \mathbb R \backslash [a_i, b_i]$.

Dividing each $\epsilon_i$ by the maximum of $\{ \epsilon_i(x) \mid x \in U \}$ and $1$, we may assume that each
$\epsilon_i(x) \leq 1$ on $U$.  Let $\epsilon(x) =  \left(\prod_{i=1}^k \epsilon_i(x)\right)^2$, then $\epsilon(x) \geq 0$ on $U$, and $$f(x,y) \geq \epsilon(x)(1 + y^2)^d$$ holds on $U \times \mathbb R$.  For each $x \in U$, the polynomial $\epsilon(x) = 0$ if and only if some $\epsilon_i(x) = 0$, hence $\epsilon(x) = 0$ if and only if there exists $y \in \mathbb R$ such that $f(x,y) = 0$.
\end{proof}

In \cite[Lemma 4.4]{MM_strip}, it is shown that if $f \in \mathbb R[x,y]$ such that $f \geq 0$ on $[0, 1] \times \mathbb R$ and the leading coefficient of $f$ is positive on the interval $[0,1]$, then for each $r \in [0, 1]$ there is a representation of $f$ involving the generators of the quadratic module and functions of the
form  $\sum g_i^2$, where each $g_i$ is a  polynomial in $y$ with coefficients analytic functions of $x$ in some neighborhood of $r$.  In our case, we need the same result with $[0,1]$ replaced by $U$.
  This follows immediately from the \cite[Lemma 4.4]{MM_strip} unless $r = a_i$ for $2 \leq i \leq k$ or $r = b_i$ for $1 \leq i \leq k - 1$; for the latter cases we need one extra step.

\begin{lemma}\label{Lem8}Suppose $f \in \mathbb R[x,y]$ is non-negative on $U \times \mathbb R$, and the leading coefficient of $f$ as a polynomial in $y$ is strictly positive on $U$.  Then:

\begin{enumerate}
    \item For each $r$ in the interior of $U$,  there exist $g_1, g_2$ polynomials in $y$ with coefficients analytic functions of $x$ in some open neighborhood $V(r)$ of $r$, such that $f = g_1^2 + g_2^2$ on $V(r) \times \mathbb R$.
    \item There exist $g_l, h_l,$ with $l = 1, 2$, polynomials in $y$ with coefficients analytic functions of $x$ in some open neighborhood $V(a_1)$ of $a_1$ such that $f = \sum_{l=1}^2 g_l^2 + \sum_{l=1}^2 h_l^2 (x - a_1)$ on $V(a_1) \times \mathbb R$.
    \item For $i = 1, \dots, k - 1$, there exist $g_l, h_l,$ with $l = 1, 2$, polynomials in $y$ with coefficients analytic functions of $x$ in some open neighborhood $V(b_i)$ of $b_i$ such that $f = \sum_{l=1}^2 g_l^2 + \sum_{l=1}^2 h_l^2(b_i - x)(a_{i+1} - x)$ on $V(b_i) \times \mathbb R$.
   \item For $i = 1, \dots, k - 1$, there exist $g_l, h_l, l = 1, 2$, polynomials in $y$ with coefficients analytic functions of $x$ in some open neighborhood $V(a_{i+1})$ of $a_{i+1}$ such that $f = \sum_{l=1}^2 g_l^2 + \sum_{l=1}^2 h_l^2(b_i - x)(a_{i+1} - x)$ on $V(a_{i+1}) \times \mathbb R$.
     \item There exist $g_l, h_l$,with $l = 1, 2$, polynomials in $y$ with coefficients analytic functions of $x$ in some open neighborhood $V(b_k)$ of $b_k$, such that $f = \sum_{l=1}^2 g_l^2 + \sum_{l=1}^2 h_l^2 (b_k - x)$ on $V(b_k) \times \mathbb R$.
\end{enumerate}
\end{lemma}

\begin{proof} (1), (2) and (5) follow from \cite[Lemma 4.4]{MM_strip}, using a change of variables, if necessary.

For (3), if $x$ is sufficiently close to $b_i$, by \cite[Lemma 4.4]{MM_strip}, there exist $\varphi_l(x,y), \psi_l(x,y)$, $l = 1, 2$, polynomials in $y$ with coefficients analytic functions of $x$ in some open neighborhood $V(b_i)$ of $b_i$, such that $$f = \sum_{l=1}^2\varphi_l^2 + \sum_{l=1}^2 \psi_l^2 \thinspace (b_i - x).$$  We have
\begin{displaymath}
\begin{array}{lll}
f &=&\displaystyle \sum_{l=1}^2\varphi_l^2 + \sum_{l=1}^2 \frac{\psi_l^2}{(a_{i+1} - x)} \thinspace (b_i - x)(a_{i+1} - x)\\
      &=&\displaystyle \sum_{l=1}^2 \varphi_l^2 + \sum_{l=1}^2 \left(\frac{\psi_l}{\sqrt{a_{i+1} - x}}\right)^2 \thinspace (b_i - x)(a_{i+1} - x).\\
\end{array}
\end{displaymath}

As $\displaystyle \frac{1}{\sqrt{a_{i+1} - x}}$ is analytic for $x$ close to $b_i$, by taking $g_l = \varphi_l$ and \\ $h_l = \displaystyle \frac{\psi_l}{\sqrt{a_{i+1} - x}}$, we get the desired result.

A similar proof shows that (4) holds.
\end{proof}

We need the following version of the Weierstrass Approximation Theorem, which is an immediate generalization of \cite[Proposition 4.5]{MM_strip}

\begin{prop}\label{Prop9} Suppose $\phi, \psi: U \rightarrow \mathbb{R}$ are continuous functions, where $U \subseteq \mathbb R$ is compact, $\phi(x) \leq \psi(x)$ for all $x \in U$, and $\phi(x) < \psi(x)$ for all but finitely many $x \in U$.  If $\phi$ and $\psi$ are analytic at each point $a \in U$ where $\phi(a) = \psi(a)$ then there exists a polynomial $p(x) \in \mathbb{R}[x]$ such that $\phi(x) \leq p(x) \leq \psi(x)$ holds for all $x \in U$.
\end{prop}
\medskip

We are now ready to prove Theorem \ref{striptheorem}.  For ease of exposition,
denote the natural choice of generators $S$ for $U$ by
$\{s_1, \dots, s_{k+1}\}$, i.e., $$s_1 = x - a_1, s_2 = (b_1 - x)(a_2 - x),
\dots, s_{k+1} = b_k - x.$$
Let $f(x,y) = \displaystyle \sum_{j=0}^{2d} a_j(x)y^j,$ where $d \geq 1$,
$a_{2d}(x) > 0$ on $U$, and $f(x,y)$ has only finitely many zeros in
$U \times \mathbb R$.  By Lemma \ref{Lem7}, we have $\epsilon(x) \in \mathbb R[x]$ such
that $\epsilon(x) \geq 0$ on $U$, $f(x,y) \geq \epsilon(x)(1 + y^2)^d$, and $\epsilon(x) = 0$
iff $y \in U$ such that $f(x,y) = 0$.  Let $f_1(x,y) :=
f(x,y) - \epsilon(x)(1 + y^2)^d$, then $f_1 \geq 0$ on $U \times \mathbb R$.  Replacing
$\epsilon(x)$ by $\frac{\epsilon(x)}{N}, N > 1$, if necessary, we can assume
$f_1$ has degree $2d$ as a polynomial in $y$, and the leading coefficient of
$f_1$ is positive on $U$.

By Lemma \ref{Lem8}, for each $r \in U$, there exists an open neighborhood $V(r)$ of $r$ so that
\begin{equation}\label{eqn4}
f_1 =\displaystyle \sum_{j=1}^2 g_{0,j,r}(x,y)^2 + \sum_{j=1}^2 g_{1,j,r}(x,y)^2 \thinspace s_1 + \dots + \sum_{j=1}^2 g_{k+1,j,r}(x,y)^2 \thinspace s_{k+1}
\end{equation} on $V(r) \times \mathbb R$, where $g_{i,j,r}(x,y)$ are polynomials in $y$ of degree $\leq d$ with coefficients analytic functions of $x$ in $V(r)$, for $i = 0,..., k + 1$ and $j = 1, 2$.  If $r$ is in the interior of $U$, note that $g_{i,j,r} = 0$ for $i \neq 0$.  If $r = a_1$, then $g_{i,j,r} = 0$ for $i \neq 1$, etc.

The rest of the proof follows along the lines of the proof of Theorem \ref{mar}.
Since $U $ is compact, there are finitely many $V(r_1),\dots, V(r_p)$ which
cover $U$ and, since $\epsilon(x)$ has only finitely many roots in $U$,  we choose the open cover so that no $V(r_l)$ contains more
than one root of $\epsilon(x)$, and no root is in more than one $V(r_l)$.
Let $1 = \nu_1 +...+ \nu_p$  be a partition of unity corresponding to the
open cover of $U$, and note that by construction, if a root $u$ of
$\epsilon(x)$ is in $V(r_l)$, then $\nu_l(x) = 1$ for $x$ close to $u$.
Since $U $ is compact, there are finitely many $V(r_1),\dots, V(r_p)$ which cover $U$.

Define $\varphi_{i,j,l}$, polynomials in $y$ with coefficients functions
of $x$ as follows:  The coefficient of $y^q$ in $\varphi_{i,j,l}$ is
$\sqrt{\nu_l(x)}$ times the coefficient of $y^q$ in $g_{i,j,r_l}$.  Then
we have
\begin{equation}
f_1 = \displaystyle \sum_{l=1}^p \nu_l f_1 = \sum_{l=1}^p \left(\sum_{j=1}^2\varphi_{0,j,l}^2 + \sum_{j=1}^2\varphi_{1,j,l}^2 \thinspace s_1 + \dots + \sum_{j=1}^2\varphi_{k+1,j,l}^2 \thinspace s_{k+1}\right)
\end{equation} on $U \times \mathbb R$.

We approximate the coefficients of the $\varphi_{i,j,l}$'s by
polynomials, using Proposition \ref{Prop9}.  Fix $\varphi_{i,j,l}$ and a
coefficient $u(x)$.
Define $\phi, \psi: U \rightarrow \mathbb R$ by $\phi(x) =
u(x) - \displaystyle \frac25 \epsilon(x)$, and $\psi(x) = u(x) + \displaystyle
\frac25 \epsilon(x)$.  Then by our construction, $\phi(x)$ and $\psi(x)$
satisfy all of the conditions of Proposition \ref{Prop9}, and so
there exists $w \in \mathbb R[x]$ such that
\begin{equation}\label{eqn5}
u(x) - \displaystyle \frac{2}{5} \epsilon(x) \leq w(x) \leq u(x) + \frac{2}{5} \epsilon(x), \text{ for each } x \in U.\end{equation}

Now we use these $w(x)$'s to define, for each triple $i, j, l$, a polynomial $h_{i,j,l}$, where $\deg_y h_{i,j,l} = \deg_y \varphi_{i,j,l}$, and if $u(x)$ is the coefficient of $y$ in $\varphi$, and $w(x)$ is the coefficient of $y$ in $h$, then \eqref{eqn5} holds.  Finally, let

$$ h_l(x,y) := \sum_{j=1}^2 h_{0,j,l}(x,y)^2 + \sum_{j=1}^2 h_{1,j,l}(x,y)^2 \thinspace s_1 + \dots + \sum_{j=1}^2 h_{k+1,j,l}(x,y)^2 \thinspace s_{k+1}$$

We have polynomials $h_l$ and $\delta \in \mathbb R[x,y]$ such that
$$f_1 = \displaystyle \left(\sum_{l=1}^p h_l(x,y)\right) + \delta(x,y),$$  where $\delta(x,y) = \sum_{i=0}^{2d} c_i(x)y^i$ and  $|c_i(x)| \leq \frac{2}{5}
\epsilon(x)$ on $U$, for all $i$.

This yields $f(x,y) = f_1(x,y) + \epsilon(x)(1 + y^2)^d =
\sum_{l=1}^p h_l(x,y) + t_1(x,y) + t_2(x,y)$, where

$t_1(x,y) := \displaystyle \frac{2}{5}\epsilon(x)(2 + y + 3y^2 + y^3 +3y^4 + ... + y^{2d-1} + 2y^{2d}) + \sum_{i=0}^{2d} c_i(x)y^i$,\\
$t_2(x,y) := \displaystyle \epsilon(x)[(1 + y^2)^d - \frac{2}{5}(2 + y + 3y^2 + y^3 + 3y^4 + ... + y^{2d-1} + 2y^{2d})]$.\\

We have $ \sum_{l=1}^p h_l(x,y) \in T$  and we can prove that
$t_1, t_2 \in T$ exactly as in \cite{MM_strip}.
Therefore $f(x,y) \in T$.  This completes the proof of Theorem \ref{striptheorem}.

\medskip

Suppose $\tilde U \subseteq \mathbb R$ is a non-compact basic closed semialgebraic set.  An obvious question
to ask is what happens if we replace $U \times \mathbb R$ by $U \times \tilde U$?  First we note that by
\cite[Thm. 2]{PR1}, if $S \subseteq \mathbb R[x,y]$ such that  $K_S = U \times \mathbb R^+$, then $M_S$ cannot be
saturated, regardless of the choice of generators $S$.   Furthermore, if $S \subseteq \mathbb R[x]$ generates
$\tilde U$ as a semialgebraic set in $\mathbb R$, then $T_S$ is saturated iff $S$ contains the natural choice
of generators \cite[Thm. 2.2]{KM_MP}.  This means that the best theorem we could hope for
is the following:  Let $S_1 \subseteq \mathbb R[x]$ be the natural choice of generators for $U$ and $S_2 \subseteq \mathbb R[y]$
the natural choice of generators for $\tilde U$, then the preordering in $\mathbb R[x,y]$ generated by
$S_1 \cup S_2$ is saturated.  We have the following partial result, which is \cite[Cor. 11]{P}:

\begin{theorem}  Let $U$, $\tilde U$, $S_1$, and $S_2$ be as above  and $T$ the preordering
in $\mathbb R[x,y]$ generated by $S_1 \cup S_2$.  If
$f = \sum_{i=0}^d a_i(x) y^i \subseteq \mathbb R[x,y]$ such that $f > 0$ on $U \times \tilde U$ and
$a_d > 0$ on $U$, then $f \in T$.
\end{theorem}

\medskip
\noindent
{\bf Question}:  Is the above theorem true without one or both of the assumptions on $f$?

\section{Half-strips and further examples}

In this section we look at non-compact basic closed semialgebraic
subsets of a strip $[a,b] \times \mathbb R$   which are bounded as
$y \rightarrow -\infty$.  We
refer to such a set as a {\it half-strip} in $\mathbb R^2$.  We give a
representation theorem for the half-strip
$\{ (x,y) \in \mathbb R^2 \mid x \in U,  y \geq q(x) \}$,  where
$U \subseteq \mathbb R$ is compact and $q(x) \in \mathbb R[x]$ with $q(x) \geq 0$ on $U$.
This follows from
Theorem \ref{striptheorem} by an
elementary argument. We give a few other examples of saturated preorderings in
the half-strip case as well as a family of negative examples.  Finally, we use
Theorem \ref{striptheorem} to
give an example of a non-compact surface in $\mathbb R^3$ for which
the corresponding preordering is saturated.

\begin{remark} Suppose $U \subseteq \mathbb R$ is compact and $S$ the natural choice of
generators for $U$.  We saw in the previous section that in $\mathbb R[x]$,
the preordering generated by $S$ and the quadratic module generated by $S$ are the same
and hence the same is true in $\mathbb R[x,y]$.
However, in \cite[Thm. 2]{PR}, it is shown that if $S$ any set of generators
in $\mathbb R[x]$ for $[0,1]$, then the quadratic module generated by $S$ and $y$
is not saturated.   Hence in the half-strip case, our representation theorems
will hold only for  preorderings and not quadratic modules as in the strip case.
\end{remark}

\begin{theorem} \label{halfstrip} Given compact $U \subseteq \mathbb R$ with natural choice of
generators $\{ s_1, \dots , s_k \}$ and $q(x) \in \mathbb R[x]$ with $q(x) \geq 0$ on $U$, set
$S = \{s_1, \dots , s_k, y - q(x)\}$ and let $K$  be the half-strip $K_S$.  If $T$ is
the preordering in $\mathbb R[x,y]$ generated by $S$, then $T$ is saturated.
\end{theorem}

\begin{proof}  We first claim that it is enough to prove the theorem
for $q(x) = 0$, i.e., the case where the semialgebraic set is $U \times \mathbb R^+$
with generators $\{ s_1, \dots , s_k, y \}$.
Suppose that the preordering $W \subseteq \mathbb R[u,v]$ generated by $\{s_1(u), \dots , s_k(u), v \}$ is saturated
and we have $f(x,y)  = \sum_{i=0}^{k} a_i(x) y^i$ is non-negative on $K$.
 Define
$g$ in $\mathbb R[u,v]$ by $g(u,v) := \sum a_i(u)(q(u) + v)^j$.  Then $f(x,y)
\geq 0$ on $K$ implies $g(u,v) \geq 0$ on $U \times \mathbb R^+$.  Hence $g \in W$.
Substituting $u = x, v = y - q(x)$ in a representation of $g$ in $W$, we obtain
a representation of $f$ in $T$.

We are reduced to proving the theorem for $S = \{ s_1, \dots , s_k, y \}$.  If
$f(x,y) \geq 0$ on $U \times \mathbb R^+$, then $f(x,y^2) \geq 0$ on
$U \times \mathbb R$.   Then
by Theorem \ref{striptheorem}, we can write $f(x,y^2)$ as a sum of
terms of the form $(\sum_{i=1}^m h_i(x,y)^2 ) s_i$ (where we set $s_0 = 1$).

We have
$$\sum h_i(x,y)^2 = \frac{1}{2} \sum h_i(x,y)^2 + \frac{1}{2} \sum h_i(x,-y)^2.$$
Using the standard identity
$$ \frac12 \left(\sum_i a_iy^i\right)^2 +  \frac12 \left(\sum_i a_i(-y)^i\right)^2 =  \left(\sum_j a_{2j}y^{2j}\right)^2 + \left(\sum_j a_{2j+1} y^{2j}\right)^2 \cdot y^2$$
we have that $f(x,y^2)$ can be written as a sum of polynomials of the form
$$\left(\sum_{i=1}^l \sigma_i(x,y^2)^2 + \tau_i(x,y^2)^2 \cdot y^2\right) s_i.$$
Replacing $y^2$ by $y$ yields a representation of $f(x,y)$ in $T$.
\end{proof}

 Combining Theorem \ref{halfstrip} with a substitution technique from
 work of Scheiderer \cite{S}, we can obtain more examples of half-strips
 for which the corresponding preordering is saturated.

 \begin{example}  Let $S = \{x - x^2, xy - 1\}$ so that $K_S$ is the upper
half of $\mathbb R^+$
cut by $xy = 1$.   We claim that
$T_S$ is saturated.

\begin{figure}[ht]
\centering
\includegraphics[scale=0.6]{HalfStripXY.pdf}
\caption{$\mathbb R^+$  cut by $xy = 1$}\label{halfstripxy}
\end{figure}

 Suppose $f(x,y) \geq 0$ on $K_S$.  Pick an integer $n \geq 0$ large enough so that $x^{2n}f \in \mathbb R[x, xy]$.  Define $g$ in $\mathbb R[u,v]$ by $g(u,v) := u^{2n}f(u,\frac{v}{u})$, i.e., $g(x, xy) = x^{2n}f(x,y)$ .  As $f(x,y) \geq 0$ on $K_S$, $g(u,v) \geq 0$ on
 $[0,1] \times [1,\infty)$, hence by Theorem \ref{halfstrip} there exist sums of squares $\sigma_0, \sigma_1, \sigma_2, \sigma_3 \in
 \mathbb R[u,v]$ such that
$$g(u,v) = \sigma_0 + \sigma_1 (u - u^2) + \sigma_2 (v-1) + \sigma_3 (u - u^2)(v -1).$$
Then  $x^{2n} f(x,y) = $
\begin{equation} \label{sub}
 \sigma_0(x,xy) + \sigma_1(x,xy)(x - x^2) + \sigma_2(x,xy)(xy -1)+ \sigma_3(x,y)(x - x^2)(xy - 1).
\end{equation}

Define $s_m :=\displaystyle \frac{\sigma_m}{x^{2n}}, m = 0,\dots,3$. As $x^{2n}$ divides each of the sums on the right hand side of
(\ref{sub}), the $s_m$ are sos in $\mathbb R[x,y]$.  Thus $f$ can be written as $$f(x,y ) = s_0(x,y) + s_1(x,y)(xy - 1) + (s_2(x,y) + s_3(x,y)(xy - 1))(x- x^2)$$  Hence $f \in T_S$.
\end{example}

Next we give an example of $S \subseteq \mathbb R[x,y,z]$ such that $K_S$ is non-compact of dimension 2, and $T_S$ is saturated.

\begin{example} Suppose $S = \{1 - x^2, z - x^2, x^2 - z\}$ so that $ K_S $
$\{(x,y,z) \mid -1 \leq x \leq 1, z = x^2\}.$    We claim $T_S$ is saturated.

Given $f(x,y,z) \geq 0$ on $K_S$, write $f = \sum g_i(x,y) z^i = \sum g_i(x,y)(z^i - x^{2i}) + \sum g_i(x,y) x^{2i},$ where $g_i(x,y) \in \mathbb R[x,y]$.  Then $\sum g_i(x,y)(z^i - x^{2i})$ is in the ideal generated by $z - x^2$ and hence in $T_S$.
Let $g(x,y) = \sum g_i(x,y) x^{2i} = f(x,y,x^2)$.  Since $f(x,y,z) \geq 0$ on $K$, this implies that $g(x,y) \geq 0$ on $[-1, 1] \times \mathbb R$.  By Theorem \ref{mar}, we have $g(x,y) = \sigma(x,y) + \tau(x,y)(1 - x^2)$, where $\sigma, \tau \in \sum \mathbb R[x,y]^2$.  Thus $f \in T_S$.
\end{example}

We end with  a family of examples of half-strips for which no corresponding finitely generated
preordering is saturated.  This is a generalization of an example due to T.~Netzer, see
\cite[Lemma 7.4]{CKS}.

\begin{prop} Suppose $m \in \mathbb N$ is even and $q(x) \in \mathbb R[x]$ with
$\deg q$ odd and $q(x) \geq 0$ on $[0,1]$. Let
$K = \{ (x,y) \in \mathbb R^2 \mid
0 \leq x \leq 1,y^m \geq q(x), y \geq 0 \}$.  Then is no finite set of generators $S \subseteq \mathbb R[x,y]$
with $K_S = K$ such that $T_S$ is saturated.
\end{prop}

\begin{proof}
Suppose $S = \{ g_1,\dots, g_s \} \subseteq \mathbb R[x,y]$ is such that $K_S = K$ and
$T_S$ is saturated.  For $c \in [0,1]$, let $T_c$ be the preordering in $\mathbb R[x]$ generated by
$\{ g_1(c,y),\dots, g_s(c,y)\}$, then $T$ saturated implies that $T_c$ is saturated.  Since
$\{g_1(c,y) \geq 0,\dots,g_s(c,y) \geq 0\} = [q(c)^\frac{1}{m}, \infty)$, by Theorem 2.1 and 2.2 in \cite{KM_MP},
$y - q(c)^{\frac{1}{m}}$ must be among the $g_i(c,y)$ up to a constant factor.  Without lost of generality, we can assume $$g_1(c,y) = r(c)\left(y - q(c)^{\frac{1}{m}}\right),$$ for infinitely many $c \in [0,1]$ and some positive function $r$.  Let $d$ be the degree of $g_1(x,y)$ in $y$, and write $g_1(x,y) = \sum_{i=0}^d a_i(x) y^i$ with $a_i(x) \in \mathbb R[x]$.  Then $$g_1(c,y) =  r(c)\left(y - q(c)^{\frac{1}{m}}\right) = a_0(c) + a_1(c)y +\dots+ a_d(c)y^d$$  for infinitely many $c \in [0,1]$.  Comparing coefficients, this implies $a_0(c) = -r(c)q(c)^{\frac{1}{m}}$ and $a_1(c) = r(c)$ for infinitely many $c \in [0,1]$.  Hence, since $a_0$, $a_1$ are polynomials, $a_0(x)^m = a_1(x)^m q(x) \in \mathbb R[x]$.  But this is a contradiction, since the degree of the left-hand side is $m \cdot$ deg $a_0(x)$ while the degree of the right-hand side is $m \cdot$ deg $a_1(x) +$ deg $f(x)$, which implies that one is even and one is odd.

\end{proof}

\begin{example}  Suppose $S = \{ x - x^2, y^2 -x , y \}$, so that $K_S$ is the half-strip $[0,1] \times
\mathbb R^+$ cut by the parabola $y^2 = x$.  Then, by the previous proposition, no finitely generated
preordering corresponding to $K_S$ is saturated.
\end{example}

\begin{figure}[ht]
\centering
\includegraphics[scale=0.6]{HalfStripNeg.pdf}
\caption{Half-strip cut by $y^2 = x$}\label{halfstripxyneg}
\end{figure}

\bibliographystyle{amsplain}

Algebraic Geometry (math.AG); Commutative Algebra (math.AC)