1 Introduction

In this paper we consider two-person impartial games. In such a game positions are not repeated, the same moves are available for both players, they take turns alternately, and one who makes the last move is the winner. It is also assumed that there are only finitely many moves from each position, and every play terminates in a finite number of moves. We shall refer to these in the sequel simply as games. Let us add that such a game is in fact a family of games and it becomes a game in the every day sense only after the players agree on an initial position and the order they take turns. For an overview of such games see, e.g., Albert et al. (2007), Berlekamp et al. (2004), Conway (1976), Siegel (2013).

Sprague (1935), Sprague (1937) and Grundy (1939) considered the disjunctive compound (named also as disjunctive sum) of games, and developed an effective theory to handle such composite games. Smith (1966) considered additionally operations, called conjunctive and selective compounds. Some other game compositions were also considered in the literature, see e.g., Berge (1953), Milnor (1953).

In this paper we introduce hypergraph compounds generalizing disjunctive, conjunctive and selective compounds. Given n games \(\varGamma _1\), ..., \(\varGamma _n\) and a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\), where \([n]=\{1,2,\dots ,n\}\), the \({\mathcal {H}}\)-compound \(\varGamma _{\mathcal {H}}\) of these games is played as follows: a player on its turn chooses a hyperedge \(H\in {\mathcal {H}}\) and makes a move in every game \(\varGamma _i\), \(i\in H\). Note that \(\emptyset \not \in {\mathcal {H}}\) means that players are not allowed to pass. For instance, the hypergraph compounds with \({\mathcal {H}}=\{\{1\},\{2\},\dots ,\{n\}\}\), \({\mathcal {H}}=\{\{1,2,\dots ,n\}\}\), and \({\mathcal {H}}=2^{[n]}\setminus \{\emptyset \}\) can be seen to correspond to disjunctive, conjunctive and selective compounds, respectively. In the special case when all games \(\varGamma _i\), \(i\in [n]\), are single-pile NIM games, their hypergraph compound, denoted by \(NIM_{\mathcal {H}}\), was already considered in Boros et al. (2019a), Boros et al. (2019b) and called hypergraph-NIM. This family contains classical NIM (11) and several variants considered in Moore (1910), Jenkyns and Mayberry (1980), Boros et al. (2021), Boros et al. (2018).

Given a game \(\varGamma =(X,E)\), where X and E denote its sets of positions and moves, respectively, Sprague and Grundy introduced a nonnegative integer valued mapping \({\mathcal {G}}_\varGamma :X\rightarrow {\mathbb {Z}}_+\), which was later called the SG-function of \(\varGamma \). They showed that \({\mathcal {G}}_\varGamma \) not only helps to play \(\varGamma \), but also reduces disjunctive compound of games to NIM. For a position \(x\in X\) the value \({\mathcal {G}}_\varGamma (x)\) is called the SG-value of x.

Interestingly, such a functional relation may not exist for other compounds, see e.g. Beideman et al. (2020). However, for several cases it does exist. Assume that \(\varGamma _i=(X_i,E_i)\) are games and \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\) is a given hypergraph. Then, equations

$$\begin{aligned} {\mathcal {G}}_{\varGamma _{\mathcal {H}}}(x_1,\dots ,x_n) ~=~ {\mathcal {G}}_{NIM_{\mathcal {H}}} \left( {\mathcal {G}}_{\varGamma _1}(x_1),\dots ,{\mathcal {G}}_{\varGamma _n}(x_n)\right) ~~~\forall ~ x_i\in X_i,~ i\in [n] \end{aligned}$$
(1)

hold for all hypergraphs \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\) if \(\varGamma _i\), \(i\in [n]\) are all single-pileFootnote 1 NIM games, by the definition of \(NIM_{\mathcal {H}}\). By the Sprague-Grundy theory it also holds for all games \(\varGamma _i\), \(i\in [n]\) if \({\mathcal {H}}=\{\{1\},\dots ,\{n\}\}\), that is for disjunctive compounds. Obviously, the above equality always holds if \(n=1\), and hence in the sequel, we assume that \(n\ge 2\). In our paper we provide a more general characterization for the above equality to hold and study the related hypergraph structures.

Note that \({\mathcal {G}}_\varGamma (y)>{\mathcal {G}}_\varGamma (x)\) may hold for a move \(x\rightarrow y\), in general. A game \(\varGamma \) is called SG-decreasing if the SG value is strictly decreased by every move. A single-pile NIM is the simplest example of an SG-decreasing game.

Theorem 1

Equation (1) holds for an arbitrary hypergraph \({\mathcal {H}}\subseteq 2^{[n]} \setminus \{\emptyset \}\) and SG-decreasing games \(\varGamma _i\), \(i \in [n]\).

Given a game \(\varGamma \) and a position x of it, we denote by \(h_\varGamma (x)\) the length of the longest play starting at x and call it the height of x in the game. A game \(\varGamma \) is called h-unbounded if for any nonnegative integer \(k \in {\mathbb {Z}}_+\) there exists a position x in \(\varGamma \) such that \(h_\varGamma (x)=k\). Note that all hypergraph NIM games including classical NIM are h-unbounded.

Our next statement shows that Eq. (1) fails unless all games involved in the compound are SG-decreasing. Here a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\) is called spanning if \(\cup _{H \in {\mathcal {H}}}H=[n]\).

Theorem 2

Let \(\varGamma _i\), \(i \in [n]\), be h-unbounded games. Then Eq. (1) holds for an arbitrary hypergraph \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\) if and only if all games \(\varGamma _i\), \(i \in [n]\), are SG-decreasing. Otherwise, Eq. (1) fails for any hypergraph \({\mathcal {H}}\) whose (inclusion-wise) minimal hyperedges form a spanning hypergraph with no singleton.

We derive Theorem 2 from a characteristic property of conjunctive compounds shown in Sect. 3. The theorem shows that h-unbounded SG-decreasing games form the largest family of impartial games satisfying (1) for all compound operations. We note that \({\mathcal {H}}=\{[n]\}\) corresponding to the conjunctive compound satisfies the property of hypergraphs in the otherwise statement in Theorem 2.

Although playing an SG-decreasing game seems very simple, just like a single-pile NIM, nevertheless both recognizing SG-decreasing games and computing their SG-values are nontrivial computational problems, even in the subclass of hypergraph NIM games; see Sect. 5 for more details.

Interestingly, if we replace in Eq. (1) the SG function by the height function we always get equality.

Theorem 3

Given games \(\varGamma _1=(X_1,E_1), \dots , \varGamma _n=(X_n,E_n)\) and a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\), for all positions \(x_1\in X_1, \dots , x_n \in X_n\) we have the identity

$$\begin{aligned} h_{\varGamma _{\mathcal {H}}}(x_1,\dots ,x_n) ~=~ h_{NIM_{\mathcal {H}}} \left( h_{\varGamma _1}(x_1),\dots ,h_{\varGamma _n}(x_n)\right) . \end{aligned}$$
(2)

Note that a game \(\varGamma \) is SG-decreasing if and only if \({\mathcal {G}}_\varGamma = h_\varGamma \) (which will be shown in Lemma 4). Thus, the above two theorems immediately imply the following statement.

Corollary 1

If \(NIM_{\mathcal {H}}\) is SG-decreasing, then the \({\mathcal {H}}\)-compound of SG-decreasing games is SG-decreasing.

The above results motivate us to study SG-decreasing games and, in particular, SG-decreasing hypergraph NIM games. We call a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) SG-decreasing if \(NIM_{\mathcal {H}}\) is an SG-decreasing game.

Given a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) and a subset \(S\subseteq [n]\), denote by \({\mathcal {H}}_S\) the subhypergraph \({\mathcal {H}}_S ~=~ \{H\in {\mathcal {H}}\mid H\subseteq S\}\) of \({\mathcal {H}}\) induced by S.

We call a hypergraph \({\mathcal {H}}\) totally transversal if every induced subhypergraph is either empty or contains a hyperedge that intersects all others, i.e.

$$\begin{aligned} \forall S\subseteq [n] ~\text { with }~ {\mathcal {H}}_S\ne \emptyset ~~\exists H\in {\mathcal {H}}_S ~\text { such that }~ \forall H'\in {\mathcal {H}}_S ~:~ H\cap H'\ne \emptyset . \end{aligned}$$
(3)

We call \({\mathcal {H}}\) intersecting if any two hyperedges of it intersect i.e.,

$$\begin{aligned} \forall H,H'\in {\mathcal {H}}~:~ H\cap H'\ne \emptyset . \end{aligned}$$
(4)

Note that lines of a projective plane (or more generally, hyperplanes of projective geometries) are examples for intersecting hypergraphs.

Theorem 4

Condition (3) is necessary, while (4) is sufficient for a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\) to be SG-decreasing.

As examples, let us consider hypergraph NIM games with \({\mathcal {H}}=\{H\subseteq [n]\mid |H|=k\}\), where \(1\le k <n\), called exact NIM in Boros et al. (2018). These hypergraphs satisfy Condition (4) and thus are SG-decreasing, if \(k>n/2\).

We can reformulate Theorem 4 as follows: intersecting hypergraphs are SG-decreasing and SG-decreasing ones are totally transversal. Note that both containments are strict.

The dimension of a hypergraph \({\mathcal {H}}\), denoted by \(\dim ({\mathcal {H}})\), is defined as the size of the largest hyperedge in \({\mathcal {H}}\). In fact, totally transversal hypergraphs of dimension 4 may be not SG-decreasing; see an example in Sect. 4. Furthermore, there are many SG-decreasing hypergraphs that are not intersecting.

Let us call a position of a game terminal if there is no move from it. Total transversality can be characterized in the following way.

Theorem 5

A hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) is totally transversal if and only if the SG-value in \(NIM_{\mathcal {H}}\) is zero only in terminal positions.

Our next (and perhaps most difficult to prove) result is that total transversality is sufficient for dimension at most 3.

Theorem 6

A hypergraph \({\mathcal {H}}\) of dimension at most 3 is SG-decreasing if and only if it is totally transversal.

Obviously, Condition (4) can be checked in polynomial time in the size of the hypergraph. We prove the same for Condition (3) for hypergraphs of bounded dimension. In addition we show that computing the height (as well as the SG) function values for \(NIM_{\mathcal {H}}\) is an NP-complete problem, even for hypergraphs of dimension 3, while it is polynomial for hypergraphs of dimension 2.

The rest of the paper is organized as follows. In Sect. 2 we provide precise definitions and prove several basic properties of height and SG-functions. In Sect. 3 we prove Theorems 1, 2, and 3. In Sect. 4 we prove Theorems 45, and provide a sketch of the proof of 6. In Sect. 5 we consider the computational complexity of recognizing total transversality and computing height and SG values. Finally, in the Appendix we include the full technical proof of Theorem 6.

2 Definitions, notation, and basic properties

It is well-known that in every game \(\varGamma = (X, E)\) there exists a subset \({\mathcal {P}}\subseteq X\) of its positions satisfying (and uniquely defined by) two properties: (a) from every position \(x\in X{\setminus } {\mathcal {P}}\) there is a move to the set \({\mathcal {P}}\); (b) every move from a position \(x\in {\mathcal {P}}\) moves to \(X\setminus {\mathcal {P}}\). Such positions are called \({\mathcal {P}}\)-positions of \(\varGamma \) (Berlekamp et al. 2004; Siegel 2013). \({\mathcal {P}}\)-positions help to play the game, since choosing a move to \({\mathcal {P}}\) from \(X\setminus {\mathcal {P}}\) guarantees winning.

To play the disjunctive compound of two games, it is not sufficient to know \({\mathcal {P}}\)-positions of the compounding games. Sprague-Grundy (Sprague 1935, 1937; Grundy 1939) introduced a mapping \({\mathcal {G}}_\varGamma :X\rightarrow {\mathbb {Z}}_+\) associated to game \(\varGamma \), called the SG-function of \(\varGamma \), that generalizes the concept of \({\mathcal {P}}\)-positions:

$$\begin{aligned} {\mathcal {G}}_\varGamma (x) ~=~ \min \bigl \{{\mathbb {Z}}_+\setminus \{{\mathcal {G}}_\varGamma (y)\mid (x\rightarrow y)\in E\}\bigr \}. \end{aligned}$$
(5)

We call \({\mathcal {G}}_\varGamma (x)\) the SG-value of position \(x\in X\). It is known that \(x\in {\mathcal {P}}\) if and only if \({\mathcal {G}}_\varGamma (x)=0\). Furthermore, the SG-function of a compound game is the NIM-sum (11) of the SG-functions of the compounding games, by the cited results of Sprague and Grundy.

Lemma 1

Given a game \(\varGamma =(X,E)\) and a mapping \(f:X\rightarrow {\mathbb {Z}}_+\), we have \(f={\mathcal {G}}_\varGamma \) if and only if

  1. (i)

    for any move \(x\rightarrow y\) we have \(f(x)\ne f(y)\), and

  2. (ii)

    for any \(x\in X\) and nonnegative integer \(v<f(x)\) there exists a move \(x\rightarrow y\) such that \(f(y)=v\).

Proof

By its definition, the SG-function \({\mathcal {G}}_\varGamma \) satisfies (i) and (ii). The other direction can be shown by induction. For a terminal position \(x\in X\) there are no moves from x and thus by (ii) we must have \(f(x)=0={\mathcal {G}}_\varGamma (x)\). Let us observe next that properties (i) and (ii) imply

$$\begin{aligned} f(x) ~=~ \min \left\{ {\mathbb {Z}}_+\setminus \{f(y)\mid (x\rightarrow y)\in E\}\right\} \end{aligned}$$

for all \(x\in X\). Thus, if for an \(x \in X\) we assume that equality \(f(y)={\mathcal {G}}_\varGamma (y)\) holds for all moves \(x \rightarrow y\), then \(f(x)={\mathcal {G}}_\varGamma (x)\) follows. \(\square \)

Somewhat similarly the height functions can be uniquely characterized as follows.

Lemma 2

Given a game \(\varGamma =(X,E)\) and a mapping \(f:X\rightarrow {\mathbb {Z}}_+\), we have \(f=h_\varGamma \) if and only if the following three properties hold.

  1. (a)

    Every move decreases the value of f.

  2. (b)

    If f is positive in a position then there exists a move from this position that decreases f by exactly one.

  3. (c)

    In each terminal position f takes value zero.

Proof

Note that games are regarded as acyclic directed graphs and, hence, the statement follows by basic graph-theoretic arguments. \(\square \)

The next lemma compares both functions.

Lemma 3

Given a game \(\varGamma =(X,E)\) and a position \(x\in X\)

  1. (i)

    for every move \(x\rightarrow y\) we have \({\mathcal {G}}_\varGamma (x)\ne {\mathcal {G}}_\varGamma (y)\) and \(h_\varGamma (x)>h_\varGamma (y)\);

  2. (ii)

    for every position \(x\in X\) and integer \(0\le v<{\mathcal {G}}_\varGamma (x)\) there exists a move \(x\rightarrow y\) such that \({\mathcal {G}}_\varGamma (y)=v;\)

  3. (iii)

    for every position \(x\in X\) there exists a move \(x\rightarrow y\) such that \(h_\varGamma (y)=h_\varGamma (x)-1;\)

  4. (iv)

    for every position \(x\in X\) we have \({\mathcal {G}}_\varGamma (x)\le h_\varGamma (x)\).

Proof

Properties (i) and (ii) follow directly by the definitions of the height and SG-functions. Property (iii) follows by the definition of a longest path. For (iv) note that for every position \(x\in X\) there exists a move \(x\rightarrow y\) by (ii) such that \({\mathcal {G}}_\varGamma (y)={\mathcal {G}}_\varGamma (x)-1\). By repeating such moves one can create a path of length \({\mathcal {G}}_\varGamma (x)\) starting from x, and it cannot be longer than the longest path from the same position. \(\square \)

Note that \({\mathcal {G}}_\varGamma (x)< {\mathcal {G}}_\varGamma (y)\) is possible for a move \(x\rightarrow y\). Recall that \(\varGamma \) is called SG-decreasing if \({\mathcal {G}}_\varGamma (x) > {\mathcal {G}}_\varGamma (y)\) for every move \(x\rightarrow y\) in the game. The following statement provides characterizations of SG-decreasing games that will be instrumental in our proofs.

Lemma 4

Given a game \(\varGamma =(X,E)\) the following three statements are equivalent:

  1. (i)

    \(\varGamma \) is SG-decreasing;

  2. (ii)

    \({\mathcal {G}}_\varGamma =h_\varGamma \);

  3. (iii)

    for every position \(x\in X\) and integer \(0\le v<h_\varGamma (x)\) there exists a move \(x\rightarrow y\) in \(\varGamma \) such that \(h_\varGamma (y)=v\).

Proof

To see (i)\(\implies \)(ii) let us assume that \({\mathcal {G}}_\varGamma \ne h_\varGamma \) and consider a position \(x\in X\) for which \({\mathcal {G}}_\varGamma (x)\ne h_\varGamma (x)\). By (iv) of Lemma 3 we get \({\mathcal {G}}_\varGamma (x)< h_\varGamma (x)\). Let \(t=h_\varGamma (x)\) and consider the positions \(x_0=x\), \(x_1\),..., \(x_t\) along a longest path starting from x, that is, \(x_i\rightarrow x_{i+1}\) is a move in \(\varGamma \) and \(h_\varGamma (x_{i+1})=h_\varGamma (x_i)-1\) for all \(i=0,\dots ,t-1\). Since by (i) of Lemma 3 we have \({\mathcal {G}}_\varGamma (x_{i+1})\ne {\mathcal {G}}_\varGamma (x_i)\) and since \(t>{\mathcal {G}}_\varGamma (x_0)\) there must exists an index \(0\le i<t\) such that \({\mathcal {G}}_\varGamma (x_{i+1})>{\mathcal {G}}_\varGamma (x_i)\), completing the proof of our claim.

Assuming (ii) we get for every move \(x\rightarrow y\) that \({\mathcal {G}}_\varGamma (x)=h_\varGamma (x)>h_\varGamma (y)={\mathcal {G}}_\varGamma (y)\) by (i) of Lemma 3, implying (i).

(ii)\(\implies \)(iii) follows by the definition of the SG-function.

Finally (iii)\(\implies \)(ii) follows by Lemma 1. \(\square \)

It is easily seen that both functions h and \({\mathcal {G}}\) can be computed in time linear in the size of \(\varGamma \), whenever \(\varGamma \) is given explicitly, as an acyclic directed graph.

It is also not difficult to see that the height functions of hypergraph-NIM games satisfy monotonicity.

Lemma 5

For a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\), and for all positions \(x,y\in {\mathbb {Z}}_+^{[n]}\) such that \(x \le y\) we have \(h_{{\mathcal {H}}}(x) \le h_{{\mathcal {H}}}(y) \le h_{\mathcal {H}}(x)+\sum _{i \in [n]}(y_i-x_i)\). \(\square \)

For a hyperedge \(H\in {\mathcal {H}}\), and a position \(x\in {\mathbb {Z}}_+^{[n]}\), we call a move \(x\rightarrow x'\) in \(NIM_{\mathcal {H}}\) an H-move if \(\{i\in [n]\mid x_i'<x_i\}=H\). For a subset \(H\subseteq [n]\) we denote by \(\chi (H)\) its characteristic vector. For positions x with \(x \ge \chi (H)\), we shall consider two special H-moves from x:

Slow H-move::

\(x\rightarrow x^{s(H)}\) defined by \(x^{s(H)}_i=x_i-1\) for \(i\in H\), and \(x^{s(H)}_i=x_i\) for \(i\not \in H\), that is by decreasing the value of every coordinate in H by exactly one.

Fast H-move::

\(x\rightarrow x^{f(H)}\) defined by \(x^{f(H)}_i=0\) for \(i\in H\), and \(x^{f(H)}_i=x_i\) for \(i\not \in H\), that is, by decreasing the value of every coordinate in H to zero.

For a position \(x\in {\mathbb {Z}}_{+}^{[n]}\) we denote by \({{\,\mathrm{{ supp}}\,}}(x)=\{i\mid x_i>0\}\) the set of its support, and by \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\) the subhypergraph of \({\mathcal {H}}\) induced by \({{\,\mathrm{{ supp}}\,}}(x)\).

Then the following property holds for the height function \(h_{\mathcal {H}}\).

Lemma 6

For a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\), let \(x\in {\mathbb {Z}}_+^{[n]}\) be a position such that \(h_{{\mathcal {H}}}(x)>0\). Then for any hyperedge \(H\in {\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\) we have

$$\begin{aligned} h_{{\mathcal {H}}}(x) ~>~ h_{{\mathcal {H}}}(x^{s(H)})~\ge ~ \max \{h_{{\mathcal {H}}}(x^{f(H)}), \ h_{{\mathcal {H}}}(x)-|H| \}. \end{aligned}$$

Proof

It follows from Lemmas 2 and 5. \(\square \)

Lemma 7

Let \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) be a hypergraph. For a hyperedge \(H\in {\mathcal {H}}\), let \(x\in {\mathbb {Z}}_+^{[n]}\) be a position such that \(x\ge \chi (H)\). Then for every integer v with \(h_{{\mathcal {H}}}(x^{f(H)})\le v\le h_{{\mathcal {H}}}(x^{s(H)})\) we have an H-move \(x\rightarrow x'\) such that \(h_{{\mathcal {H}}}(x')=v\).

Proof

We decrease the i-th component of \(x^{s(H)}\), \(i\in H\), in an arbitrary order, subtracting one in each step, until we get \(x^{f(H)}\). Every time the height decreases by at most one by Lemma 5. Since \(x^{s(H)}_i<x_i\) for all \(i\in H\), all the positions encountered in the above process can be reached from x by a single H-move. \(\square \)

The next claim follows directly from the definitions, and will be frequently used in our proofs.

Lemma 8

Let \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) be a hypergraph and \(x\in {\mathbb {Z}}_+^{[n]}\) be a position such that \(h_{\mathcal {H}}(x)>0\). Then we have \(h_{\mathcal {H}}(x^{f(H)})=0\) for a hyperedge \(H\in {\mathcal {H}}\) if and only if H intersects all hyperedges of \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\). \(\square \)

3 Hypergraph compounds of games

In this section we formally define hypergraph-compound of games, and prove Theorems 12, and 3.

Given games \(\varGamma _i=(X_i,E_i)\), \(i \in [n]=\{1,\dots ,n\}\), and a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\), we define the \({\mathcal {H}}\)-compound \(\varGamma _{\mathcal {H}}=(X,E)\) of these games by setting

$$\begin{aligned} X = \prod _{i\in [n]} X_i \ \text { and } \\ E ~=~ \left\{ (x,x')\in X\times X ~ \left| ~\exists ~ H\in {\mathcal {H}}\text { such that } \begin{array}{ll} (x_i,x_i')\in E_i & \forall i\in H \\ x_i=x_i' & \forall i\not \in H \end{array} \right. \right\} . \end{aligned}$$

Since the compound game \(NIM_{\mathcal {H}}\) plays a special role in our statements, we introduce a simplified notation for the rest of the paper. Namely, we denote by \({\mathcal {G}}_{\mathcal {H}}\) the SG function, by \(h_{\mathcal {H}}\) the height function, and by \({\mathcal {P}}_{\mathcal {H}}\) the set of P-positions of \(NIM_{\mathcal {H}}.\)

Proof of Theorem 1

Consider the \({\mathcal {H}}\)-compound \(\varGamma _{\mathcal {H}}=(X,E)\) as defined above. To prove the theorem, we show first the “if" part of the statement, that is that the function defined by the right hand side of Equation (1) satisfies (i) and (ii) in Lemma 1 if all games \(\varGamma _i, \; i \in [n],\) are SG-decreasing.

For (i), consider a position \(x=(x_1,\dots ,x_n)\in X\) and denote by \(g(x)=({\mathcal {G}}_{\varGamma _i}(x_i)\mid i\in [n])\in {\mathbb {Z}}_+^{[n]}\) the vector of SG values in n given games. Since \(g(x) \in {\mathbb {Z}}_+^{[n]}\), it is a position of \(NIM_{\mathcal {H}}\). Let us define a function \(f: X\rightarrow {\mathbb {Z}}_+\) by

$$\begin{aligned} f(x)={\mathcal {G}}_{\mathcal {H}}(g(x))={\mathcal {G}}_{NIM_{\mathcal {H}}}(g(x)). \end{aligned}$$

Consider first a move \((x,x')\in E\), where \((x_i,x_i')\in E_i\) for \(i\in H\) for some hyperedge \(H\in {\mathcal {H}}\). By the definition of E we must have \(x_i'=x_i\) for all \(i\not \in H\). Denote by \(g(x')\in {\mathbb {Z}}_+^{[n]}\) the corresponding vector of SG values. Note that \(g(x')_i<g(x)_i\) for \(i\in H\), since \(\varGamma _i\) is an SG-decreasing game for all \(i\in [n]\), and \(g(x')_i=g(x)_i\) for all \(i\not \in H\) since \(x'_i=x_i\) for these indices. Consequently, \(g(x)\rightarrow g(x')\) is a move in \(NIM_{\mathcal {H}}\) and therefore \(f(x)={\mathcal {G}}_{\mathcal {H}}(g(x))\ne {\mathcal {G}}_{\mathcal {H}}(g(x'))=f(x')\). This proves (i) in Lemma 1.

For (ii) in Lemma 1, let us next consider an integer \(0\le v < f(x)\). We are going to show that there exists a move \(x\rightarrow x'\) in \(\varGamma _{\mathcal {H}}\) such that \(f(x')=v\). Let us consider again the corresponding integer vector \(g=g(x)\in {\mathbb {Z}}_+^{[n]}\), for which we have \(f(x)={\mathcal {G}}_{\mathcal {H}}(g)\). By the definition of the SG function of \(NIM_{\mathcal {H}}\), there exists a move \(g\rightarrow g'\) such that \({\mathcal {G}}_{\mathcal {H}}(g')=v\). Let \(H\in {\mathcal {H}}\) be the hyperedge used in this move, i.e., \(g'_i<g_i\) for \(i\in H\) and \(g'_i=g_i\) for \(i\not \in H\). Then for each \(i\in H\), we must have moves \(x_i\rightarrow x_i'\) in \(\varGamma _i\) such that \({\mathcal {G}}_{\varGamma _i}(x_i')=g_i'\) for all \(i\in H\). By setting \(x_i' = x_i\) for \(i \not \in H\), we get a move \(x \rightarrow x'=(x_1', \dots ,x_n')\) in the \({\mathcal {H}}\)-compound such that \(f(x')=v\). This proves (ii) in Lemma 1. \(\square \)

Our proof of Theorem 2 is based on a general criterion showing when Eq. (1) holds for conjunctive compounds (Theorem 7) which may be of independent interest.

We first note that the conjunctive compound of single-pile NIM games, \(NIM^\wedge = NIM_{\mathcal {H}}\) with \({\mathcal {H}}=\{[n]\}\), satisfies the equality:

$$\begin{aligned} {\mathcal {G}}_{NIM^\wedge }(x)=\min _{i \in [n]}x_i ~~~\forall ~ x=(x_1,\dots , x_n) \in {\mathbb {Z}}_+^{[n]}, \end{aligned}$$
(6)

which we will use in our proof.

For a game \(\varGamma =(X,E)\) and a position \(x \in X\), let \(\varGamma [x]=(X[x],E[x])\) denote the subgame of \(\varGamma \) obtained by restricting the positions reachable from x by a sequence of moves. We call \(\varGamma [x]\) a truncated game. Note that any game with a fixed initial position is a truncated game. Note also that both the SG-function and the height function values at a position x depend only the positions reachable from x, and thus we have for every \(y\in X[x]\) the equality \({\mathcal {G}}_{\varGamma }(y)={\mathcal {G}}_{\varGamma [x]}(y)\) and \(h_{\varGamma }(y)=h_{\varGamma [x]}(y)\). Furthermore, we have \(h_\varGamma (y)\le h_\varGamma (x)\) for all \(y\in X[x]\) with strict inequality for \(y\ne x\) by (i) of Lemma 3.

To a game \(\varGamma =(X,E)\) let us associate the parameter

$$\begin{aligned} \kappa (\varGamma )= \min \{{\mathcal {G}}_{\varGamma }(x) \mid x \in X, ~ {\mathcal {G}}_{\varGamma }(x)\ne h_{\varGamma }(x) \} \end{aligned}$$

where by convention we have \(\kappa (\varGamma )=+\infty \) if \(\varGamma \) is SG-decreasing. The following technical lemma will be instrumental to our proofs.

Lemma 9

Any position x of \(\varGamma =(X,E)\) with \(h_{\varGamma }(x)\le \kappa (\varGamma )+1\) satisfies \({\mathcal {G}}_{\varGamma }(x)= h_{\varGamma }(x).\)

Proof

Assume that this is not the case. Then we have a position \(x\in X\) such that

$$\begin{aligned} {\mathcal {G}}_{\varGamma }(x) < h_{\varGamma }(x)\le \kappa (\varGamma )+1. \end{aligned}$$

Since we have \(\kappa (\varGamma )\le {\mathcal {G}}_{\varGamma }(x)\) by the definition of \(\kappa (\varGamma )\) we must have \(\kappa (\varGamma )\le {\mathcal {G}}_{\varGamma }(x) < h_{\varGamma }(x)\le \kappa (\varGamma )+1\), implying \(\kappa (\varGamma )={\mathcal {G}}_{\varGamma }(x)=h_\varGamma (x)-1\). By (iii) of Lemma 3, there exists a move \(x\rightarrow y\) such that \(h_\varGamma (y)=h_\varGamma (x)-1\). Then we have \({\mathcal {G}}_{\varGamma }(y)\le h_\varGamma (y)=h_\varGamma (x)-1\). Furthermore, it follows from (i) of Lemma 3 that \({\mathcal {G}}_{\varGamma }(y)\ne {\mathcal {G}}_{\varGamma }(x)=h_\varGamma (x)-1\). Consequently we have \({\mathcal {G}}_{\varGamma }(y)< h_\varGamma (y)=\kappa (\varGamma )\). This contradicts the definition of \(\kappa (\varGamma )\), which completes the proof. \(\square \)

The following statement can be viewed as a criterion showing when Equation (1) holds for the conjunctive compound. It will be used to prove Theorem 2.

Theorem 7

Let n be a positive integer with \(n \ge 2\). For \(i \in [n]\), let \(\varGamma _i=(X_i,E_i)\) be games. Then Equation (1) holds for their conjunctive compound if and only if

$$\begin{aligned} \min _{i\in [n]} \sup _{x_i \in X_i}h_{\varGamma _i} (x_i) ~\le ~ \min _{i\in [n]} \kappa (\varGamma _i). \end{aligned}$$
(7)

Proof

For the if direction, let us assume that (7) holds. For a position \(x=(x_1,\dots ,x_n)\) with \(x_i\in X_i\), \(i\in [n]\), let us denote the right hand side of (1) by

$$\begin{aligned} f(x) ~=~ \min _{i\in [n]} {\mathcal {G}}_{\varGamma _i}(x_i). \end{aligned}$$
(8)

We are going to prove using Lemma 1 that f(x) is the SG-function of the conjunctive compound of the games \(\varGamma _i\), proving the equality in (1) under the condition (7).

To this end, we first claim that for any position \(x=(x_1, \dots x_n)\), there exists a component \(r \in [n]\) such that \(f(x)={\mathcal {G}}_{\varGamma _r}(x_r)=h_{\varGamma _r}(x_r)\). Assume that any component r with \(f(x)={\mathcal {G}}_{\varGamma _r}(x_r)\) satisfies \({\mathcal {G}}_{\varGamma _r}(x_r)< h_{\varGamma _r}(x_r)\) by Lemma 3 (iv). Then by (7), definition of \(\kappa \), and Lemma 3 (iv), there exists a component \(i \in [n]\) such that

$$\begin{aligned} {\mathcal {G}}_{\varGamma _i}(x_i) \le h_{\varGamma _i}(x_i) \le \min _{i\in [n]} \kappa (\varGamma _i)\le {\mathcal {G}}_{\varGamma _r}(x_r)\,(=f(x)). \end{aligned}$$

This together with (8) implies that \({\mathcal {G}}_{\varGamma _i}(x_i) = h_{\varGamma _i}(x_i) =f(x)\), which contradicts the assumption.

By the claim, let r be a component with \(f(x)={\mathcal {G}}_{\varGamma _r}(x_r)=h_{\varGamma _r}(x_r)\). Then any move \(x_r \rightarrow y_r\) in \(X_r\) satisfies \({\mathcal {G}}_{\varGamma _r}(y_r)\le h_{\varGamma _r}(y_r) < f(x)\) by Lemma 3 (i) and (iv). This together with (8) implies that any move \(x\rightarrow y\) in the compound game satisfies \(f(y)<f(x)\), which proves the property (i) in Lemma 1. To prove the property (ii) in Lemma 1, let us consider an arbitrary nonnegative integer \(v<f(x)\). By (ii) of Lemma 3, any component \(i\in [n]\) has a move \(x_i\rightarrow y_i\) such that \({\mathcal {G}}_{\varGamma _i}(y_i)=v\), since \({\mathcal {G}}_{\varGamma _i}(x_i)\ge f(x)\) by (8). Therefore, \(y=(y_1, \dots , y_n)\) satisfies \(f(y)=\min _{i\in [n]} {\mathcal {G}}_{\varGamma _i}(y_i) ~=~ v\), which proves (ii) in Lemma 1.

For the only-if direction, let us denote by \(h^*\) and \(\kappa ^*\) the minimum values on the left and right hand sides of inequality (7), and denote by \(q\in [n]\) a component such that \(\kappa ^*=\kappa (\varGamma _q)\). Let us assume that (7) does not hold, that is,

$$\begin{aligned} \sup _{x_i \in X_i}h_{\varGamma _i} (x_i)~\ge ~ h^* ~>~ \kappa ^*=\kappa (\varGamma _q)=\min _{\ell \in [n]} \kappa (\varGamma _\ell ) \end{aligned}$$
(9)

holds for all \(i\in [n]\). Let us choose a position \(x_q\in X_q\) such that \(\kappa ^*={\mathcal {G}}_{\varGamma _q}(x_q)<h_{\varGamma _q}(x_q)\). By the definition of \(\kappa \) such a position exists in game \(\varGamma _q\). For each other game \(\varGamma _i\), \(i\ne q\), we choose a position \(x_i\in X_i\) such that \(h_{\varGamma _i}(x_i)=\kappa ^*+1\). Since \(\kappa ^*+1\le h^*\le \sup _{z_i \in X_i}h_{\varGamma _i}(z_i)\), such a position exists by (iii) of Lemma 3. By Lemma 9, the truncated games \(\varGamma _i[x_i]\), \(i\ne q\) are all SG-decreasing, implying \({\mathcal {G}}_{\varGamma _i}(x_i)=\kappa ^*+1\) for all \(i\ne q\). Note that on the right hand side of (1) we have \(f(x)=\min _{\ell \in [n]} {\mathcal {G}}_{\varGamma _\ell }(x_\ell )~=~ \kappa ^*\) by (6). We prove a violation of the equality in (1) by exhibiting a move \(x\rightarrow y\) in the conjunctive compound for which we have \(f(y)=\kappa ^*\,(=f(x))\). Since by (i) of Lemma 3 the SG-value must change in a move, equality in (1) does not hold for at least one of x and y.

In the game \(\varGamma _q\), we choose a move \(x_q\rightarrow y_q\) such that \(h_{\varGamma _q}(y_q)=h_{\varGamma _q}(x_q)-1\ge \kappa ^*\) according to (iii) of Lemma 3. Note that \({\mathcal {G}}_{\varGamma _q}(y_q) < \kappa ^*\) would then contradict the definition of \(\kappa (\varGamma _q)\), and therefore we also have \({\mathcal {G}}_{\varGamma _q}(y_q) \ge \kappa ^*\). In each other game \(\varGamma _i\), \(i\ne q\), we choose a move \(x_i\rightarrow y_i\) such that \(h_{\varGamma _i}(y_i)=h_{\varGamma _i}(x_i)-1=\kappa ^*\), in accordance with (iii) of Lemma 3. Note that such an i exists by \(n \ge 2\). Since the truncated games \(\varGamma _i[x_i]\), \(i\ne q\) are all SG-decreasing, the equations \(f(y)=\kappa ^*=f(x)\) follow as claimed, completing the proof of the theorem. \(\square \)

Proof of Theorem 2

Since the if part is proven in Theorem 1, we here show the only-if part. Assume that game \(\varGamma _i\) is not SG-decreasing for at least one \(i \in [n]\). Define \(\kappa ^*=\min _{\ell \in [n]}\kappa (\varGamma _\ell )\), and let \(z_i\) be a position in \(X_i\) such that \({\mathcal {G}}_{\varGamma _i}(z_i)=\kappa ^*<h_{\varGamma _i}(z_i)\), Take a minimal hyperedge \(H \in {\mathcal {H}}\) be that contains i. For \(j \in H {\setminus } \{i\}\), we arbitrarily choose a position \(z_j\) that satisfies \(h_{\varGamma _j}(z_j)=\kappa ^*+1\). Note that such a position exists, since \(\varGamma _j\) is assumed to be h-unbounded. For \(j \in [n] {\setminus } H\), let \(z_j\) a position with \(h_{\varGamma _j}(z_j)=0\).

Let us now consider \({\mathcal {H}}\)-compound of the truncated games \(\varGamma _j[z_j]\), \(j \in [n]\). Since \(h_{\varGamma _j[z_j]}(z_j)=0\) for all \(j \in [n] \setminus H\), it can be regarded as the conjunctive compound of \(\varGamma _j[z_j]\), \(j \in H\). Our statement then follows by Theorem 7, since condition (7) does not hold for the truncated games \(\varGamma _j[z_j]\), \(j\in H\). \(\square \)

Finally, in this section we prove Theorem 3.

Proof of Theorem 3

Similarly to the proof of Theorem 1, we shall show that the function defined by the right hand side of Equation (2) satisfies the above properties (a), (b) and (c).

Consider a position \(x=(x_1,\dots ,x_n) \in X\) and denote by \(t(x)=(h_{\varGamma _i}(x_i)\mid i\in [n])\in {\mathbb {Z}}_+^{[n]}\) the vector of height values in these n games. Notice that t(x) is a position in the game \(NIM_{\mathcal {H}}\). Let us denote by

$$\begin{aligned} f(x)=h_{\mathcal {H}}(t(x)) \end{aligned}$$

the function defined by the right hand side of Eq. (2).

For (a), consider a move \((x,x')\in E\), where \((x_i,x_i')\in E_i\) for \(i\in H\) for some hyperedge \(H\in {\mathcal {H}}\). By the definition of E we must have \(x_i'=x_i\) for all \(i\not \in H\). Denote by \(t'\in {\mathbb {Z}}_+^{[n]}\) the corresponding vector of height values, and note that \(t'_i<t_i(x)\) for \(i\in H\) since \(h_{\varGamma _i}\) satisfies property (a) for all \(i\in [n]\), and \(t_i'=t_i(x)\) for all \(i\not \in H\) since \(x_i=x_i'\) for these indices. Consequently, \(t\rightarrow t'=t(x')\) is a move in \(NIM_{\mathcal {H}}\), and therefore \(f(x)=h_{\mathcal {H}}(t(x))> h_{\mathcal {H}}(t(x'))=f(x')\), since \(h_{\mathcal {H}}\) satisfies property (a). This proves that f satisfies (a).

For (b), consider next an arbitrary position \(x\in X\) such that \(0 < f(x)=h_{\mathcal {H}}(t(x))\). Since \(h_{\mathcal {H}}\) satisfies property (b), there exists a move \(t(x)\rightarrow t'\) in \(NIM_{\mathcal {H}}\) such that \(h_{\mathcal {H}}(t')=h_{\mathcal {H}}(t(x))-1\). Then, by the definition of \(NIM_{\mathcal {H}}\) we have \(H=\{i\in [n]\mid t_i(x)>t_i'\}\in {\mathcal {H}}\). Since \(h_{\varGamma _i}\) satisfies property (b), there exists moves \(x_i\rightarrow x_i'\) such that \(h_{\varGamma _i}(x_i')=h_{\varGamma _i}(x_i)-1=t_i(x)-1\) for \(i\in H\). Define \(x_i'=x_i\) for \(i\not \in H\). Then we have \(h_{\mathcal {H}}(t(x))-1\ge h_{\mathcal {H}}(t(x'))\ge h_{\mathcal {H}}(t')\) by Lemmas 2 (b) and 5 for the height function \(h_{\mathcal {H}}\). Consequently we have \(f(x')=f(x)-1\), which proves (b).

Finally, to see property (c), let us consider a terminal position \(x\in X\) and its corresponding height vector t(x). By the definition of \(NIM_{\mathcal {H}}\) this is a terminal position if and only if \(\{i\in [n]\mid t_i(x)=0\}\) intersects all hyperedges of \({\mathcal {H}}\), in which case we must have \(f(x)=h_{\mathcal {H}}(t(x))=0\). \(\square \)

4 SG-decreasing hypergraphs

In this section we prove Theorems 45, and sketch the proof of Theorem 6.

Proof of Theorem 4

We show first that Condition (3) is necessary for a hypergraph to be SG-decreasing. By Lemma 4 for an SG-decreasing hypergraph we have \({\mathcal {G}}_{\mathcal {H}}=h_{\mathcal {H}}\), implying that for every position with a positive SG-value we have a move to a terminal position. Let us consider now an arbitrary subset \(S\subseteq [n]\) such that \({\mathcal {H}}_S\) is non-empty, and consider an arbitrary position \(x\in {\mathbb {Z}}_+^{[n]}\) for which \(\{i\mid x_i>0\}=S\). Since \({\mathcal {H}}_S\) is non-empty, we have \(h_{\mathcal {H}}(x)={\mathcal {G}}_{\mathcal {H}}(x)>0\). Thus there exists an H-move \(x\rightarrow y\) for some \(H\in {\mathcal {H}}_S\) such that \({\mathcal {G}}_{\mathcal {H}}(y)=h_{\mathcal {H}}(y)=0\). This implies that H intersects all other hyperedges of \({\mathcal {H}}_S\). Since this is true for all non-empty induced subhypergraphs, \({\mathcal {H}}\) must be totally transversal.

To see that Condition (4) is sufficient let us consider an arbitrary position \(x\in {\mathbb {Z}}_+^{[n]}\). If \(h_{{\mathcal {H}}}(x)=0\) then the claim holds by definition. Assume that \(h_{{\mathcal {H}}}(x)>0\) and consider a hyperedge \(H\in {\mathcal {H}}\) such that \(h_{{\mathcal {H}}}(x-\chi _H)=h_{{\mathcal {H}}}(x)-1\). Such a hyperedge exists, since \(h_{{\mathcal {H}}}(x) > 0\). Let us consider positions \(x^{s(H)}\) and \(x^{f(H)}\). By our choice of H, we have \(h_{{\mathcal {H}}}(x^{s(H)})=h_{{\mathcal {H}}}(x)-1\). Since the hypergraph is intersecting, we also have \(h_{{\mathcal {H}}}(x^{f(H)})=0\) by Lemma 8. Thus, by Lemma 7, for all values \(0\le v\le h_{{\mathcal {H}}}(x)-1\) there exists an H-move \(x\rightarrow x'\) such that \(h_{{\mathcal {H}}}(x')=v\). Since this holds for all positions, we get \({\mathcal {G}}_{{\mathcal {H}}}(x)=h_{{\mathcal {H}}}(x)\), by Lemma 4. This completes the proof of the theorem. \(\square \)

Let us associate to a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\) the set of positions \({\mathcal {Z}}_{\mathcal {H}}\subseteq {\mathbb {Z}}_+^{[n]}\) which have zero height:

$$\begin{aligned} {\mathcal {Z}}_{\mathcal {H}}~=~ \{x\in {\mathbb {Z}}_+^{[n]}\mid h_{\mathcal {H}}(x)=0\}. \end{aligned}$$

Obviously, we have

$$\begin{aligned} {\mathcal {Z}}_{\mathcal {H}}~\subseteq ~ {\mathcal {P}}_{\mathcal {H}}, \end{aligned}$$
(10)

since there is no move from x by the definition of the height function. We shall show next that in fact all P-positions of \(NIM_{\mathcal {H}}\) are in \({\mathcal {Z}}_{\mathcal {H}}\) if and only if \({\mathcal {H}}\) is totally transversal.

Lemma 10

For a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\), we have \({\mathcal {P}}_{\mathcal {H}}={\mathcal {Z}}_{\mathcal {H}}\) if and only if \({\mathcal {H}}\) is totally transversal.

Proof

Since \({\mathcal {Z}}_{{\mathcal {H}}}\subseteq {\mathcal {P}}_{{\mathcal {H}}}\) holds for any hypergraph \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\), we first assume the converse inclusion \({\mathcal {P}}_{{\mathcal {H}}}\subseteq {\mathcal {Z}}_{{\mathcal {H}}}\), and consider a subset \(S \subseteq [n]\) such that \({\mathcal {H}}_S\ne \emptyset \). Let us then choose a position \(x\in {\mathbb {Z}}_+^{[n]}\) such that \(supp(x)=S\). Since \({\mathcal {H}}_S\ne \emptyset \), we have \(h_{{\mathcal {H}}}(x)>0\) implying \({\mathcal {G}}_{{\mathcal {H}}}(x)>0\) by our assumption. Furthermore, by the definition of the SG function, we must have a hyperedge \(H'\in {\mathcal {H}}\) and an \(H'\)-move \(x\rightarrow x'\) such that \({\mathcal {G}}_{{\mathcal {H}}}(x')=0\). Again by our assumption, we have \(h_{{\mathcal {H}}}(x')=0\), which implies \(h_{{\mathcal {H}}}(x^{f(H')}) =0\) by Lemma 5. Hence this \(H'\subseteq {{\,\mathrm{{ supp}}\,}}(x)=S\) intersects all hyperedges of \({\mathcal {H}}_S\), which prove the total transversality.

For the other direction, assume that \({\mathcal {H}}\) is totally transversal, and consider a position \(x\in {\mathbb {Z}}_+^{[n]}\) with \(h_{{\mathcal {H}}}(x)>0\). Then we have \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\ne \emptyset \), By totally transversality of \({\mathcal {H}}\), we have a hyperedge \(H\in {\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\) that intersects all other hyperedges of this induced subhypergraph, i.e., \(h_{{\mathcal {H}}}(x^{f(H)})=0\) by Lemma 8. This implies \({\mathcal {G}}_{{\mathcal {H}}}(x^{f(H)})=0\) by (iv) of Lemma 3. Since \(x \rightarrow x^{f(H)}\) is an H-move, \({\mathcal {G}}_{{\mathcal {H}}}(x)\ne 0\) is implied by the definition of the SG function, which concludes that \({\mathcal {P}}_{{\mathcal {H}}}\subseteq {\mathcal {Z}}_{{\mathcal {H}}}\). This together with (10) proves the if-direction of the theorem. \(\square \)

Proof of Theorem 5

Follows by Lemma 10. \(\square \)

The following example demonstrates that total transversality alone is not enough, generally, to guarantee that a hypergraph is SG-decreasing.

Fig. 1
figure 1

A hypergraph \({\mathcal {H}}\) on the ground set \({\mathbb {Z}}_9=\{0, \dots , 8\}\), with hyperedges \(T_i=\{i,i+1,i+2\}\) and \(F_i=\{i,i+1,i+4,i+6\}\) for \(i\in {\mathbb {Z}}_9\), where additions are modulo 9, that is, \({\mathcal {H}}=\{T_i,~ F_i\mid i\in {\mathbb {Z}}_9\}\). The figure shows \(T_1\) and \(F_0\) in dotted and solid lines, respectively

Lemma 11

The hypergraph \({\mathcal {H}}\) in Fig. 1 is totally transversal, but not SG-decreasing.

Proof

To see this, let us set \(T_j\) and \(F_j\) for \(j\in {\mathbb {Z}}_9\) as in the caption of Fig. 1, where additions are modulo 9. Let us observe first that

$$\begin{aligned} T_j\cap F_i\ne \emptyset \text { and } F_j\cap F_i\ne \emptyset \text { for all } i,j\in {\mathbb {Z}}_9. \end{aligned}$$

An easy case-analysis shows that \({\mathcal {H}}\) is totally transversal.

On the other hand, for the position \(x=(1,\dots ,1)\in {\mathbb {Z}}_+^{[n]}\) we have \(h_{\mathcal {H}}(x)=3\), since \(T_0\), \(T_3\), and \(T_6\) provides consecutive moves from x to \((0,\dots , 0)\). Furthermore, \(h_{\mathcal {H}}(x-\chi (T_j))=2\) and \(h_{\mathcal {H}}(x-\chi (F_j))=0\) for all \(j\in {\mathbb {Z}}_9\). Thus, there exists no move \(x\rightarrow x'\) with \(h_{\mathcal {H}}(x')=1\), which by (iii) of Lemma 4 implies that \({\mathcal {H}}\) is not SG-decreasing. \(\square \)

Note that the above hypergraph is of dimension 4. In Apendix we show that there is no such example among the hypergraphs of dimension at most 3, as claimed in Theorem 6. In fact, for hypergraphs of dimension at most 2, the equivalence can be shown easily, since totally transversality (i.e., Condition (3)) can be substantially simplified.

Lemma 12

  1. (i)

    A hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) of dimension 1 is totally transversal if and only if it consists of a single hyperedge, i.e., \({\mathcal {H}}=\{\{i\}\}\) for some \(i \in [n]\).

  2. (ii)

    A hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) of dimension 2 is totally transversal if and only if there is a hyperedge \(H\in {\mathcal {H}}\) such that \(H\cap H'\ne \emptyset \) for all \(H'\in {\mathcal {H}}\).

Proof

It follows from Condition (3). \(\square \)

Figure 2 shows the possible structures of such hypergraphs of dimension 2. On the left any hyperedge satisfies the condition in Lemma 12 (ii), while on the right it is a 2-element set described in black thin edge. Circles in both pictures indicate possible singletons (i.e., 1-element hyperedges).

Fig. 2
figure 2

Possible structures of totally transversal hypergraphs of dimension 2

Lemma 12 together with Fig. 2 implies the following lemma.

Lemma 13

A hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) of dimension at most 2 is SG-decreasing if and only if it is totally transversal. Furthermore, it can be checked in linear time in the size of \({\mathcal {H}}\) (i.e., \(\sum _{H \in {\mathcal {H}}} |H|)\).\(\square \)

By Theorem 4, total transversality is necessary for a hypergraph of any dimension to be SG-decreasing. Next, we prove that for hypergraphs of dimension 3, it is also sufficient.

Given a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) and a position \(x\in {\mathbb {Z}}_+^{[n]}\), let us call an integer vector \(m\in {\mathbb {Z}}_+^{\mathcal {H}}\) an x-packing if

$$\begin{aligned} \sum _{H\in {\mathcal {H}}} m_H \chi (H) ~\le ~ x ~~~\text {and}~~~ \sum _{H\in {\mathcal {H}}} m_H ~=~ h_{{\mathcal {H}}}(x). \end{aligned}$$
(11)

Let us denote by \(M(x)\subseteq {\mathbb {Z}}_+^{\mathcal {H}}\) the family of x-packings. Let us further define

$$\begin{aligned} {\mathcal {H}}^{x\text{- }{} { pack}} ~=~ \{ H\in {\mathcal {H}}\mid \exists m\in M(x) ~\text {s.t.}~ m_H>0\}, \end{aligned}$$
(12)

that is, \({\mathcal {H}}^{x\text{- }{} { pack}}\) is the subfamily of \({\mathcal {H}}\) of those hyperedges that participate with a positive multiplicity in some x-packing of \({\mathcal {H}}\). Let us recall that \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\) is the subhypergraph induced by the support of x, and define a subhypergraph of \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\) by

$$\begin{aligned} {\mathcal {H}}^{x\text{- }{} { all}} ~=~ \{H\in {\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\mid \forall H'\in {\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}: H\cap H'\ne \emptyset \}, \end{aligned}$$
(13)

which consists of those hyperedges that intersect all others in \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x)}\).

Lemma 14

Let \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) be a totally transversal hypergraph. For a position \(x\in {\mathbb {Z}}_+^{[n]}\) such that \(h_{{\mathcal {H}}}(x)>0\), both \({\mathcal {H}}^{x\text{- }{} { all}}\) and \({\mathcal {H}}^{x\text{- }{} { pack}}\) are nonempty. Furthermore, we have

  1. (i)

    \(h_{{\mathcal {H}}}(x^{s(H)}) ~=~ h_{{\mathcal {H}}}(x)-1\) for all \(H\in {\mathcal {H}}^{x\text{- }{} { pack}}\);

  2. (ii)

    \(h_{{\mathcal {H}}}(x^{f(H)}) ~=~ 0\) if and only if \(H\in {\mathcal {H}}^{x\text{- }{} { all}}\).

Proof

Let us first recall that \(h_{\mathcal {H}}(x)=k>0\) means that we can make k consecutive moves from x before arriving to a terminal position. All these moves can be assumed to be slow moves, furthermore they can be executed in any order.

Since \(H\in {\mathcal {H}}^{x\text{- }{} { pack}}\) implies by definition that there exists a sequence of k consecutive moves starting from x such that one of these moves is an H-move, by the above remark we can assume that this slow H-move is the first one. Thus we can still make \(k-1\) moves from \(x^{s(H)}\), proving that \(h_{{\mathcal {H}}}(x^{s(H)}) ~\ge ~ h_{{\mathcal {H}}}(x)-1\), from which (i) follows by Lemma 6.

To see (ii) observe that \(h_{{\mathcal {H}}}(x^{f(H)}) ~=~ 0\) implies \({\mathcal {H}}_{{{\,\mathrm{{ supp}}\,}}(x^{f(H)})}=\emptyset \), which can happen if and only if \(H\in {\mathcal {H}}^{x\text{- }{} { all}}\). \(\square \)

4.1 Plan of the proof of theorem 6

We assume that \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) is a totally transversal hypergraph of dimension 3 that is not SG-decreasing and derive a contradiction from these assumptions.

First we observe by Lemma 4 the existence of a position \(x\in {\mathbb {Z}}_+^{[n]}\) and an integer value \(v\in {\mathbb {Z}}_+\) such that \(h_{\mathcal {H}}(x)>v>0\) and there is no move \(x\rightarrow y\) with \(h_{\mathcal {H}}(y)=v\). This allows us to show that \(h_{\mathcal {H}}(x)=3\), \(v=1\) and obtain a partition \({\mathcal {H}}={\mathcal {H}}_1\cup {\mathcal {H}}_2\) such that \(h_{\mathcal {H}}(x^{s(H)})=0\) for all \(H\in {\mathcal {H}}_1\) and \(h_{\mathcal {H}}(x^{f(H)})=2\) for all \(H\in {\mathcal {H}}_2\). We also prove that the subhypergraphs \({\mathcal {H}}_1\) and \({\mathcal {H}}_2\) have a special structure, as summarized in Lemma 24.

Next we prove that \({\mathcal {H}}_1\) contains three hyperedges such any two intersects in exactly one point, and derive from this a partition of \({\mathcal {H}}_2\) into three non-empty subhypergraphs.

Finally we show that \({\mathcal {H}}\) must contain a special substructure that in fact is impossible to realize.

The full proof is quite long and technical, and therefore we included it in the Appendix of this paper.

5 Computational issues

In this section we consider the computational complexity of recognizing total transversality and computing height ad SG-values.

Let us call a hyperedge of a hypergraph \({\mathcal {H}}\) intersecting if it intersects all other hyperedges of \({\mathcal {H}}\). Recall that \({\mathcal {H}}\) is called totally transversal if every non-empty induced subhypergraphs of it contains an intersecting hyperedge. Let us call \({\mathcal {H}}\) minimal transversal-free if it does not contain an intersecting hyperedge, but every non-empty proper induced subhypergraph of it does.

Lemma 15

(Bogdanov 2017) If \({\mathcal {F}}\subseteq 2^U\) is a minimal transversal-free hypergraph of dimension at most k, then

$$\begin{aligned} |U| ~\le ~ k\left( {\begin{array}{c}2k\\ k\end{array}}\right) . \end{aligned}$$

Proof

Our assumptions imply that for every \(i\in U\) we have a hyperedge \(F_i\in {\mathcal {F}}_{U{\setminus } \{i\}}\) such that \(F_i\cap F'\ne \emptyset \) for all \(F'\in {\mathcal {F}}_{U\setminus \{i\}}\). Let us denote by \({\mathcal {F}}'=\{F_i\mid i\in U\}\) the family of these hyperedges. Since \({\mathcal {F}}\) does not have an intersecting hyperedge, for every \(F \in {\mathcal {F}}'\) there exists a hyperedge \(B(F)\in {\mathcal {F}}\) disjoint from F. Let us choose a minimal subhypergraph \({\mathcal {B}}\subseteq {\mathcal {F}}\) such that

$$\begin{aligned} \forall F\in {\mathcal {F}}' ~~\exists B\in {\mathcal {B}}: ~~F\cap B=\emptyset . \end{aligned}$$
(14)

Let us note first that such a \({\mathcal {B}}\) must form a cover of U, that is, \(U= \bigcup _{B\in {\mathcal {B}}}B\). This is because for all \(F_i \in {\mathcal {F}}'\) there exists a \(B \in {\mathcal {B}}\) such that \(F_i \cap B = \emptyset \) and, consequently, \(i \in B\). Let us observe next that for all \(B \in {\mathcal {B}}\) there exists at least one \(A(B) \in {\mathcal {F}}'\) such that \(A(B) \cap B = \emptyset \) and \(A(B)\cap B'\ne \emptyset \) for all \(B' \in {\mathcal {B}}{\setminus } \{B\}\). This is because we choose \({\mathcal {B}}\) to be a minimal family with respect to (14). Let us now define \({\mathcal {A}}=\{A(B)\in {\mathcal {F}}'\mid B\in {\mathcal {B}}\}\). The pair \({\mathcal {A}}\), \({\mathcal {B}}\) of hypergraphs now satisfies the conditions of the classical Bollobás’ Lemma (Bollobás 1965), page 448, implying that

$$\begin{aligned} |{\mathcal {A}}|=|{\mathcal {B}}|\le \left( {\begin{array}{c}2k\\ k\end{array}}\right) . \end{aligned}$$

Since \(\dim ({\mathcal {B}})\le k\) and it covers U, our claim follows. \(\square \)

Theorem 8

Given a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\) and a constant k, it can be tested in \(poly(n,|{\mathcal {H}}|)\) time if \({\mathcal {H}}\) is totally transversal or not, if \(dim({\mathcal {H}})\le k\).

Proof

If Condition (3) does not hold for \({\mathcal {H}}\) then there is a minimal subset \(U\subseteq [n]\) such that \({\mathcal {H}}_U\ne \emptyset \) and \({\mathcal {H}}_U\) is minimal transversal-free. Then, by Lemma 15, we have \(|U|\le k \left( {\begin{array}{c}2k\\ k\end{array}}\right) \). Since k is a fixed constant, we will need to check only polynomially many induced subhypergraphs and that can be accomplished in polynomial time. \(\square \)

We consider next the complexity of computing the height function of a hypergraph NIM game.

Theorem 9

Given a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) and a position \(x \in {\mathbb {Z}}_+^{[n]}\), computing \(h_{\mathcal {H}}(x)\) is

  1. (i)

    NP-hard for intersecting hypergraphs, already for dimension 4;

  2. (ii)

    NP-hard for hypergraphs of dimension at most 3;

  3. (iii)

    polynomial for hypergraphs of dimension at most 2 (that is, for graphs).

  4. (iv)

    polynomial for fixed n.

Proof

Let us consider an arbitrary hypergraph \({\mathcal {H}}\subseteq 2^{[n]}{\setminus } \{\emptyset \}\). Its matching number \(\mu ({\mathcal {H}})\) is the maximum number of pairwise disjoint hyperedges of \({\mathcal {H}}\) and is known to be NP-hard to compute already for the hypergraphs of dimension 3 (Karp 1972).

Let us consider \(w \not \in [n]\) and define \({\mathcal {H}}^*=\{H \cup \{w\} \mid H\in {\mathcal {H}}\}\). Also consider position \(x \in {\mathbb {Z}}_+^{[n]\cup \{w\}}\) defined by \(x_i=1\) for \(i \in [n]\) and \(x_w = |{\mathcal {H}}|\). Then \({\mathcal {H}}^*\) is an intersecting hypergraph and we have \(h_{{\mathcal {H}}^*}(x)=\mu ({\mathcal {H}})\). This equality still holds when \({\mathcal {H}}\) is of dimension 3 and \(x_i=1\) for all \(i \in [n]\).

Yet, if \({\mathcal {H}}\) is of dimension at most 2, then \(h_{\mathcal {H}}(b)\) for a position \(b\in {\mathbb {Z}}_+^{[n]}\) is the so called b-matching number of the underlying graph and is known to be computable in polynomial time (Edmonds 1965; Tutte 1954).

For a position x, computing \(h_{\mathcal {H}}(x)\) is an integer programming problem, which is polynomial when the number of variables is a fixed constant (Lenstra 1983). \(\square \)

Corollary 2

Given a hypergraph \({\mathcal {H}}\subseteq 2^{[n]}\setminus \{\emptyset \}\) and a position \(x\in {\mathbb {Z}}_+^{[n]}\), computing \({\mathcal {G}}_{\mathcal {H}}(x)\) is NP-hard, even for intersecting hypergraphs.

Proof

Since intersecting hypergraphs satisfy Condition (3), Theorem 6 implies \(h_{\mathcal {H}}={\mathcal {G}}_{\mathcal {H}}\). Thus, the claim follows, by Theorem  9 (i). \(\square \)

Let us finally remark that the complexity of computing the height of a position for hypergraphs of dimension 3 is open under Condition (3).