1 Introduction

Deterministic and nondeterministic finite automata define the class of regular languages and have been systematically studied for over 60 years. At the same time, many important questions on finite automata and regular languages remain open [8, 10]. The last decades have seen much work on the descriptional complexity, or state complexity, of regular languages [4, 6, 7].

In this paper we consider a structural property of finite automata called cycle height. A nondeterministic finite automaton (NFA) is said to have finite cycle height if no two cycles overlap. A finite cycle height NFA A has cycle height \(\mathcal {K}\) if all computations of A visit no more than \(\mathcal {K}\) non-equivalent cycles.Footnote 1 The acyclic NFAs have cycle height zero and the nearly acyclic NFAs [9] have cycle height one.

Note that cycle height differs from the notion of cycle rank [5] which counts the degree of nesting of cycles in an NFA. Also Msiska and van Zijl [12] estimate the size blow-up of the subset construction by counting how many times a computation passes through a simple cycle. The notion is in some sense related to cycle height, but their point of view is different because the algorithm modifies the NFA by removing nested cycles.

A language L has polynomial density if the number of strings of length n in L is bounded by a polynomial in n. Szilard et al. [15] have shown that a language recognized by a deterministic finite automaton (DFA) A has polynomial density if all strings have a certain tiered property with respect to A. The tiered property is related to our notion of cycle height of NFAs, although in [15] the tiered words are defined only with respect to a DFA. As noted by Kutrib et al. [11], from [15] it follows that, for a polynomial density regular language L, the degree of the polynomial giving the density of L is computable. Using more advanced techniques, Gawrychowski et al. [3] have shown that for an m-state DFA A recognizing a polynomial density language the degree of the polynomial giving the density of the language can be computed in O(m) time, assuming the alphabet size is constant.

The contributions of this paper are as follows. In Sect. 3 we give a polynomial time algorithm to decide whether an NFA A has finite cycle height and, in the positive case, to compute the cycle height of A. We show that NFAs with finite cycle height recognize the polynomial density regular languages, but an NFA recognizing a polynomial density language need not have finite cycle height. Based on results from [15] it then follows that a DFA A has finite cycle height if and only if the language L(A) has polynomial density. Furthermore, if A has finite cycle height, the degree of the polynomial bounding the density of A is the cycle height of A minus one. This would give a polynomial time algorithm to compute the density of a language recognized by a DFA, however, the time complexity is worse than in the known algorithm from Gawrychowski et al. [3]. Finally in Sect. 4 we study upper and lower bounds for the depth path width [9] of NFAs with finite cycle height. The depth path width of an NFA A, roughly speaking, quantifies the overall path expansion in computations of A by counting the number of complete computations of A on all possible inputs of a given length.

2 Preliminaries

We assume the reader to be familiar with the basics of formal languages and finite automata [14]. The set of strings over a finite alphabet \(\varSigma \) is \(\varSigma ^*\), the set of strings of length \(m \ge 0\) is \(\varSigma ^m\) and \(\varepsilon \) is the empty string. The cardinality of a finite set F is denoted |F| and is the set of non-negative integers.

A nondeterministic finite automaton (NFA) is a tuple \(A = (Q, \varSigma , \delta , q_0, F)\) where Q is the finite set of states, \(\varSigma \) is the input alphabet, \(\delta : Q \times \varSigma \rightarrow 2^{Q}\) is the transition function, \(q_0 \in Q\) is the initial state and \(F \subseteq Q\) is the set of final states. The transition function \(\delta \) is in the usual way extended as a function \(Q \times \varSigma ^* \rightarrow 2^Q\) and the language recognized by A is \(L(A) = \{ w \in \varSigma ^* \mid \delta (q_0, w) \cap F \ne \emptyset \}\). If \(|\delta (q, b)| \le 1\) for all \(q \in Q\) and \(b \in \varSigma \), the automaton A is a deterministic finite automaton (DFA). It is well known that the NFAs and DFAs recognize the class of regular languages.

Unless otherwise mentioned, we always assume that an NFA or a DFA does not have useless states, that is, states that cannot be used in an accepting computation. Note that we can avoid a DFA having a “useless” dead state because we allow DFAs to have undefined transitions.

The density of a language L is a function defined as \(\varrho _L(n) = |L \cap \varSigma ^n|\). A language L is said to have polynomial density if there exists an integer \(d \ge 0\) such that \(\varrho _L(n) \in O(n^d)\). Density is sometimes instead defined as the ratio \(|L \cap \varSigma ^n|\)/\(|\varSigma ^n|\), with our notion of density instead being referred to as population [15].

2.1 Cycle Height and Depth Path Width

First we recall some definitions related to computations and cycles of an NFA. In the following \(A = (Q, \varSigma , \delta , q_0, F)\) is always an NFA.

A (state) path of the NFA A with underlying string \(w = b_1 b_2 \cdots b_k\), \(b_i \in \varSigma \), \(i = 1, \ldots , k\), \(k \ge 0\), is a sequence of states \((p_0, p_1, \ldots , p_k)\), where \(p_{j} \in \delta (p_{j-1}, b_{j})\), \( j = 1, \ldots k \). A path beginning in the start state \(q_0\), is a computation of A on the underlying string w. A computation that ends in an accepting state of F is an accepting computation. A computation \((q_0, p_1, \ldots , p_\ell )\) is a complete computation on a string \(b_1 b_2 \cdots b_k\) if \(\ell = k\). The set of all computations of A on the string w is denoted \(\mathrm{comp}_A(w)\).

A path \((p_0, p_1, \ldots , p_k)\), \(k \ge 1\), with underlying string \(b_1 b_2 \cdots b_k\) is a cycle if \(p_0 = p_k\). A cycle with one transition from a state to itself is called a self-loop.

Cycles that are obtained from each other by a cyclical shift are said to be equivalent: For \(0< i < k\), the above cycle (with \(p_0 = p_k\)) is equivalent to the cycle \((p_i, \ldots , p_k, p_1, \ldots p_{i-1}, p_i)\) having underlying string \(b_{i+1} \cdots b_k b_1 \cdots b_i\). In the following, unless otherwise mentioned, by a cycle we always mean an equivalence class of cycles and, thus, by two distinct cycles we mean two non-equivalent cycles.

We say that an NFA A has finite cycle height if for any distinct cycles \(C_1\) and \(C_2\) of A, either \(C_1\) is unreachable from \(C_2\) or \(C_2\) is unreachable from \(C_1\). It is easy to see that an NFA has finite cycle height if and only if no two different cycles overlap. Additionally, this condition implies a strict ordering on the cycles, since the reachability between two distinct cycles holds in at most in one direction.

A finite cycle height NFA A has cycle height if no computation of A can contain states belonging to \(\mathcal {K} + 1\) different cycles. Intuitively, this means that no computation can “pass through” \(\mathcal {K} + 1\) different cycles. Note that since A has finite cycle height and a strict ordering on its cycles, a computation can “pass through” a cycle at most once. We say that A has strict cycle height \(\mathcal {K}\) if it has cycle height \(\mathcal {K}\) but not cycle height \(\mathcal {K}-1\). Note that if A has cycle height \(\mathcal {K}\), then there exists a unique \(0 \le \mathcal {K'} \le \mathcal {K}\) such that A has strict cycle height \(\mathcal {K'}\).

An acyclic NFA has cycle height zero and a nearly acyclic NFA [9] has cycle height one (by its definition). Since a finite cycle height NFA cannot have overlapping cycles, the Lemma below is immediate. An n-state NFA with cycle height n is given in Fig. 2.

Lemma 1

The finite cycle height of an n-state NFA is at most n. For each and \(\mathcal {K} \le n\) there exists an n-state NFA with strict cycle height \(\mathcal {K}\).

To conclude this section we recall the notion of depth path width, which counts the number of complete computations of given length. The depth path width [9] of A on strings of length is

$$\mathrm{DPW}(A,\ell ) = \sum \limits _{w \in \varSigma ^\ell } |\mathrm{comp}_A(w)|.$$

The depth path width of the NFA A is defined as .

In Sect. 4 we will use the following Lemma.

Lemma 2

Let A be an NFA and .

  1. (i)

    If \(A'\) is an NFA obtained from A by changing the alphabet symbol labeling one transition, then \(\mathrm{DPW}(A', \ell ) = \mathrm{DPW}(A, \ell )\).

  2. (ii)

    If \(A''\) is an NFA obtained from A by adding one new transition, then

    $$\mathrm{DPW}(A'', \ell ) \ge \mathrm{DPW}(A, \ell ).$$

3 Polynomial Time Algorithm for Cycle Height

We present an algorithm which determines whether or not an NFA A has finite cycle height, and if so, returns the strict cycle height of A.

The idea of Algorithm 1 is as follows: For an NFA A, we first split A into its strongly connected components (SCCs). We then ensure that A does not have any nested cycles, which would prevent finite cycle height. This is done by checking that each SCC is either an acyclic singleton (consisting of only one state and no transitions) or a simple cycle (where consecutive states are connected by a unique transition).

After this, the algorithm creates an acyclic graph \(G=(V,E)\), \(V= \{ v_0, \ldots , v_{k-1} \}\), where each vertex represents one of A’s strongly connected components. Each edge \((v_i,v_j)\) represents a connection in A between the two SCCs \(s_i\) and \(s_j\), for \(0 \le i < j \le k-1\). The weights of these edges represent the type of SCC to which the edge leads. That is, if \((v_i,v_j)\) is a 0-weight edge in E, then \(s_j\) is (and \(v_j\) represents) an acyclic singleton. If \((v_i,v_j)\) is a 1-weight edge in E, then \(s_j\) is (and \(v_j\) represents) a simple cycle SCC.

The algorithm then determines the minimum distance from \(v_0\) (the vertex representing the SCC containing \(q_0\)) to all other \(v_j\). Since each 1-weight edge leads to a vertex representing a cyclical SCC, the maximum-cost path starting from \(v_0\) will lead through the most vertices representing cyclical SCCs. In fact, the length of the maximum-cost path in G starting from \(v_0\) is the integer \(\mathcal {K}\), such that A has strict cycle height \(\mathcal {K}\).

In the algorithm, for states \(q_a\) and \(q_b\) of A, the distance from \(q_a\) to \(q_b\) is the length of the shortest string that takes \(q_a\) to \(q_b\). If \(q_b\) is not reachable from \(q_a\) the distance is \(\infty \).

    

figure a

Complexity analysis of Algorithm 1: The input is an NFA \((Q, \varSigma , \delta , q_0, F)\) with m states. Creating the distance matrix takes \(\varTheta (m^3)\) time and \(\varTheta (m^2)\) space using the Floyd-Warshall reachability algorithm [2]. Creating the set of strongly connected components can be done in \(\varTheta (m + |\delta |)\) time using Tarjan’s SCC algorithm [16]. Checking for the existence of an SCC which is not a simple cycle is naturally bounded by the number of states and transitions in A. Clearly then, the “if” part on line 4 is not as computationally hard as the “else” part on line 6. For the else part, the two for all statements multiply the inner statements’ complexity by \(O({m \atopwithdelims ()2})\), as they enumerate all ordered pairs and there are maximally m SCCs. Since we know that there is a strict ordering on the cycles, we do not need to compare all pairs of SCCs, as \(q_i\) is never reachable from \(q_j\) when \(i < j\).

Determining the reachability between SCCs is done in constant time with the help of the distance matrix M. We create the shortest-path tree D for G using the modified Dijkstra’s algorithm given in [13], which takes \(O(|E| + |V| \cdot log C)\) time, where C is the largest edge value. An upper bound for the runtime of the algorithm is

$$\begin{aligned} \varTheta (m^3 + m + |\delta | + {m \atopwithdelims ()2} + |E| + |V| \cdot \log C) \end{aligned}$$

Since 0 and 1 are the only edge values used, the constant C is ignored and the runtime simplifies to \(\varTheta (\max (m^3, |\delta |))\).

Using Algorithm 1, we obtain the following two results. Note that Theorem 1 assumes that the input NFA has finite cycle height. This property can be decided using Theorem 2.

Theorem 1

If A is an NFA with m states, transition function \(\delta \) and finite cycle height, then we can compute in time \(O(\max (m^3,|\delta |))\) and space \(O(\max (m^2,|\delta |))\) the strict cycle height of A.

If we consider the alphabet to be fixed, as is often done, the time bound of Theorem 1 simplifies to \(O(m^3)\).

Second, if we modify the algorithm so that the distance matrix M is never calculated, and the else part on line 6 just returns 1 (instead of lines 10 through 25), then we can decide whether an NFA has finite cycle height just using Tarjan’s SCC algorithm, checking that each SCC is a simple cycle or an acyclic singleton.

Theorem 2

If A is an NFA with m states and a transition function \(\delta \), we can decide in time \(O(m + |\delta |)\) whether or not A has finite cycle height.

3.1 Relationship with Polynomial Density Languages

The cycle height of an NFA A can be related to language classes recognized by A. It is known that nearly acyclic NFAs, or NFAs of cycle height one, recognize exactly the constant density languages [9]. We recall the following characterization of polynomial density regular languages from [15].

Proposition 1

([15]). A regular language is of polynomial density (of degree at most k) if and only if it can be represented as a finite union of regular expressions of the form \(x \cdot y^*_1 z_1 \ldots y^*_t z_t\), with each \(t \le k+1\) and \(x,y_1,z_1, \ldots , y_t, z_t \in \varSigma ^*\).

Using the above characterization we can verify that the languages recognized by finite cycle height NFAs have polynomial density. Note that Szilard et al. [15] define a notion of a t-tiered string, and this notion is closely related to our notion of cycle height.Footnote 2 If all strings are t-tiered with respect to an automaton A then the language of A has a representation as in Proposition 1. Using this observation we can extend Proposition 1 for NFAs of given cycle height.

Proposition 2

If A is an NFA with cycle height \(\mathcal {K}\), then

$$L(A)=\bigcup \limits _{i=1}^{r} x_i \cdot [y_{i,1}^* z_{i,1} \cdot \ldots \cdot y_{i,{t_i}}^* z_{i,{t_i}}],$$

for \(x_i, y_{i,j}, z_{i,j} \in \varSigma ^*\), and some integers j, \(t_i\) and r, such that \(t_i \le \mathcal {K}\) for all i.

As a corollary, we get an explicit upper bound for the density of a language recognized by an NFA of cycle height \(\mathcal {K}\).

Corollary 1

If A is an NFA with cycle height \(\mathcal {K}\), then \(\varrho _{L(A)}(n) \in O(n^{\mathcal {K}-1})\).

The reverse is not true: an NFA recognizing a polynomial density language need not have finite cycle height. As a counterexample, we give the NFA in Fig. 1, which does not have finite cycle height, but whose language, \(L=a^*\), has constant density.

Fig. 1.
figure 1

NFA with language \(a^*\)

For a DFA A that has strict cycle height \(\mathcal {K}\), we can use results of [15] to strengthen Corollary 1 such that it gives the precise density of L(A).

Lemma 3

Let A be a DFA with strict cycle height \(\mathcal {K}\). Then the density of L(A) is in \(\varOmega (n^{\mathcal {K} - 1})\).

Proof

Since A has strict cycle height \(\mathcal {K}\), there exists a string w such that the accepting computation of A on w visits \(\mathcal {K}\) different cycles. (Here we rely on the assumption that A has no useless states, which implies that any computation can be extended to an accepting computation.) This means that w is \(\mathcal {K}\)-tiered with respect to A (as defined in [15]) and the claim follows from Lemma 1 of [15].    \(\square \)

From Lemma 3 and Corollary 1 we see that the cycle height of a DFA exactly characterizes the density of the recognized language. Note that cycle height zero DFAs recognize finite languages.

Corollary 2

If A is a DFA with strict cycle height \(\mathcal {K} \ge 1\) then the density of L(A) is \(\varTheta (n^{\mathcal {K} - 1})\).

From Theorem 6 of [15] we know that if the density of a regular language L is non-polynomial, then \(\varrho _L(n) = 2^{\varOmega (n)}\). The gap between polynomial and exponential densities occurs because there do not exist any regular languages whose density functions contain non-integer exponents, e.g. \(\sqrt{n}\), or \(2^{\sqrt{n}}\). Together with Corollary 2 this gives:

Corollary 3

If the cycle height of a DFA A is not finite then the density of L(A) is \(2^{\varOmega (n)}\).

Corollary 2 and Theorem 1 would yield a polynomial time algorithm to compute the exact density of a regular language, however, the time complexity cannot compete with the algorithm of Gawrychowski et al. [3]. For an m-state DFA over a fixed alphabet, an algorithm based on our Theorem 1 to compute the degree of the polynomial giving the density of the language would require \(O(m^3)\) time. In comparison, for a DFA A over a fixed alphabet the algorithm given by Theorem 9 of Gawrychowski et al. [3] works in linear time and, even for an NFA A, the algorithm of Gawrychowski et al. [3] does the computation in time \(O(m^2)\), where m is the number of states of A.

4 Depth Path Width of Finite Cycle Height NFAs

First we consider bounds for the number of transitions of an NFA with finite cycle height. The definition of NFAs with strict cycle height m implies that an NFA of the form given in Fig. 2 has the minimal number of transitions among all NFAs of strict cycle height m.

Fig. 2.
figure 2

Unary NFA with strict cycle height m having a minimal number of transitions

For NFAs with strict cycle height \(\mathcal {K}\), the following Lemma gives bounds for the number of cycles and transitions as a function of the number of states.

Lemma 4

If \(A=(Q,\varSigma ,\delta ,q_0,F)\) is an NFA with cycle height \(\mathcal {K}\), then \(\mathcal {K} \le |Q|\), and \(|\delta | \le \mathcal {K} + |\varSigma |\cdot {{|Q|} \atopwithdelims ()2}\). If A has strict cycle height \(\mathcal {K}\), then we have also that \(2\cdot \mathcal {K} - 1 \le |\delta |\).

We examine the number of complete computations of a given length of a unary NFA A with strict cycle height \(\mathcal {K}\), that is, the depth path width of A.

Lemma 5

Let \(A_{\mathcal {K}}=(Q,\{a\},\delta ,q_0,F)\) be a unary NFA with strict cycle height \(\mathcal {K}\). Then \(\mathrm{DPW}(A_{\mathcal {K}}, \ell ) \ge \sum \limits _{i=0}^{\mathcal {K}-1} {{\ell }\atopwithdelims (){i}}\), .

Next we compute an upper bound for the depth path width of \(\mathcal {K}\)-state unary NFAs having strict cycle height \(\mathcal {K}\).

Fig. 3.
figure 3

An m-state unary NFA with strict cycle height m and maximal number of transitions

Lemma 6

Let \(A_{\mathcal {K}}\) be a \(\mathcal {K}\)-state unary NFA with strict cycle height \(\mathcal {K}\). Then for , \(\mathrm{DPW}(A_{\mathcal {K}},\ell ) \le {{\ell + \mathcal {K} - 1} \atopwithdelims (){\mathcal {K}-1}}\).

Proof

Since \(A_{\mathcal {K}}\) has strict cycle height \(\mathcal {K}\), each of the \(\mathcal {K}\) states must be part of a distinct cycle, that is, each state has a self-loop and no other transition can be part of a cycle. By Lemma 2 (ii) to get an upper bound for the depth path width, we can add to \(A_{\mathcal {K}}\) a maximal number of acyclic transition. That is, without loss of generality \(A_{\mathcal {K}}\) is as in Fig. 3 (with \(\mathcal {K} = m\)).

It remains to compute the depth path width of \(A_{\mathcal {K}}\). As the base case, we observe that \(\mathrm{DPW}(A_1, \ell ) = {{\ell +1-1} \atopwithdelims ()0} = {\ell \atopwithdelims ()0} = 1\). Inductively, we assume that the claim holds for \(A_{\mathcal {K}}\) and now the inductive claim is that

$$\mathrm{DPW}(A_{\mathcal {K}+1}, \ell ) = {{\ell + \mathcal {K}} \atopwithdelims ()\mathcal {K}}$$

The value \(\mathrm{DPW}(A_{\mathcal {K}+1}, \ell )\) counts the number of computations of length \(\ell \) that are in \(A_{\mathcal {K}}\), as well as all of the computations with \(\ell -1\) transitions from \(A_{\mathcal {K}}\) and one final transition, \(\delta (q,a)=\mathcal {K}\), for some \(0 \le q \le \mathcal {K}-1\). More formally:

$$\begin{aligned} DPW(A_{\mathcal {K}+1}, \ell ) = DPW(A_{\mathcal {K}}, \ell ) + DPW(A_{\mathcal {K}+1}, \ell -1) \end{aligned}$$
(1)

Using our inductive assumption to replace the values in the right hand side of (1), we get:

$$DPW(A_{\mathcal {K}+1}, \ell ) = {{\ell + \mathcal {K} - 1} \atopwithdelims (){\mathcal {K}-1}} + {{\ell + \mathcal {K} - 1} \atopwithdelims ()\mathcal {K}} = {{\ell + \mathcal {K}} \atopwithdelims ()\mathcal {K}}$$

where the last equality uses Pascal’s triangle recursion rule [17].    \(\square \)

Lemma 6 gives an upper bound for the depth path width of a \(\mathcal {K}\)-state unary NFA with strict cycle height \(\mathcal {K}\). Next we consider the depth path width of unary NFAs with strict cycle height \(\mathcal {K}\) that have more than \(\mathcal {K}\) states.

Lemma 7

Let \(A_{\mathcal {K}}=(Q,\{a\},\delta ,q_0,F)\) be an \(\mathcal {K}\)-state NFA with strict cycle height \(\mathcal {K}\) (as in Lemma 6). Let \(B_{\mathcal {K}+nc}\) be \(A_\mathcal {K}\) with one additional state that is not involved in any cycle. Then \(DPW(B_{\mathcal {K}+nc}, \ell ) \le DPW(A_{\mathcal {K}+1}, \ell )\), .

Since NFAs with finite strict cycle height will have maximal depth path width when they have the same number of states and cycles, the result from Lemma 6 is an upper bound for all \(\mathcal {K}\)-state NFAs with strict cycle height \(\mathcal {K}\). Combining the results from these Lemmas, we observe the following corollary.

Corollary 4

If \(A_\mathcal {K}=(Q,\varSigma ,\delta ,q_0,F)\) is a \(\mathcal {K}\)-state unary NFA with strict cycle height \(\mathcal {K}\), then

$$ \sum \limits _{i=0}^{\mathcal {K}-1} {{\ell }\atopwithdelims (){i}} \le \mathrm{DPW}(A_{\mathcal {K}},\ell ) \le {{\ell + \mathcal {K} - 1} \atopwithdelims (){\mathcal {K}-1}} $$

The upper bound also holds for \(\mathcal {K}\)-state unary NFAs with cycle height \(\mathcal {K}\). The lower bound also holds for \(\mathcal {K}\)-state non-unary NFAs with strict cycle height \(\mathcal {K}\).

The results of Sect. 4 give upper and lower bounds for the number of complete computations of NFAs whose number of states matches exactly their strict cycle height.

If the number of states exceeds the number of cycles, there will naturally be fewer complete computations. In this case, however, the depth path width of these NFAs cannot be just a function of the number of cycles, and must necessarily involve the number of states.

Problem 1

What is the maximum number of complete computations for an m-state NFA with strict cycle height \(\mathcal {K}\), when \(m > \mathcal {K}\)?

4.1 Experimental Results

To acquire results for the maximum number of complete computations of NFAs with strict finite cycle height and a non-unary alphabet, we first need the following definition.

Definition 1

([18]). Pascal’s generalized triangle, denoted \(\mathcal {P}^N\), is an extension of Pascal’s triangle, defined as:

$$\mathcal {P}^N(0,0) = \mathcal {P}^N(x,0) = \mathcal {P}^N(0,y) = 1$$
$$\mathcal {P}^N(x,y) = \mathcal {P}^N(x-1,y) + \mathcal {P}^N(x,y-1) + (N \cdot \mathcal {P}^N(x-1,y-1)),$$

where \(\mathcal {P}^N(x,y)\) is the \(y^\mathrm{th}\) element in the \(x^\mathrm{th}\) row of the \(N^{th}\) generalized triangle, for \(x,y \ge 0\). It is obvious that \(\mathcal {P}^0\) reduces to the normal Pascal’s triangle.

Recalling the result from Lemma 6 for unary machines, we can see easily that:

$$ DPW(A_{\mathcal {K}}, \ell ) = \mathcal {P}^0(\mathcal {K}-1, \ell ) = {{\ell + \mathcal {K} - 1} \atopwithdelims (){\mathcal {K}-1}} $$

For NFAs with a binary alphabet we look to \(\mathcal {P}^1\), which corresponds to the Delannoy numbers [1], and has the following closed form:

$$ \mathcal {P}^1(x, y) = \sum \limits _{i=0}^{\min (x,y)} 2^i \cdot {x \atopwithdelims ()i} \cdot {y \atopwithdelims ()i} $$
Fig. 4.
figure 4

\(\mathcal {K}\)-state NFA with strict cycle height \(\mathcal {K}\) and \(|\varSigma |=s\)

By extrapolating upon the closed form for the Delannoy numbers, we established a candidate equation upper bounding the number of complete computations of NFAs of the form given in Fig. 4. Based on experimental testing of NFAs of this form (for \(1 \le \mathcal {K} \le 7\), \(1 \le |\varSigma | \le 8\), and \(1 \le \ell \le 10\)), we believe that the following conjecture captures the number of complete computations as the length of the computation increases.

The selection of characters used on the self-loops (in the case of Fig. 4, \(c_1\)) is arbitrary for the purposes of counting computations, and does not have to be the same for every state.

Conjecture 1

Let \(A_{\mathcal {K}}^{|\varSigma |}=(Q,\varSigma ,\delta ,q_0,F)\) be a \(\mathcal {K}\)-state NFA with strict cycle height \(\mathcal {K}\), as in Fig. 4. Then

$$\begin{aligned} DPW(A_{\mathcal {K}}^{|\varSigma |},\ell ) = \mathcal {P}^{|\varSigma |-1}(\mathcal {K}-1,\ell ) = \sum \limits _{i=0}^{\min (\mathcal {K}-1,\ell )} |\varSigma |^i \cdot {{\mathcal {K}-1} \atopwithdelims ()i} \cdot {\ell \atopwithdelims ()i} \end{aligned}$$
(2)

Furthermore, since (2) and the structure of NFAs of the form given in Fig. 4 scale down to the unary case, we believe that this is an upper bound on the number of complete computations of any \(\mathcal {K}\)-state NFA with strict cycle height \(\mathcal {K}\).

Conjecture 2

Let \(A^{|\varSigma |}_\mathcal {K} = (Q, \varSigma , \delta , q_0, F)\) be a \(\mathcal {K}\)-state NFA with strict cycle height \(\mathcal {K}\). Then

$$\begin{aligned} DPW(A^{|\varSigma |}_\mathcal {K}, \ell ) \le \sum \limits _{i=0}^{\min (\mathcal {K}-1,\ell )} |\varSigma |^i \cdot {{\mathcal {K}-1} \atopwithdelims ()i} \cdot {\ell \atopwithdelims ()i} \end{aligned}$$
(3)