arXiv:2610.06717cs.FLOct 2026

Manuscript Offprint

arXiv:2610.06717

Subsequence Analysis Problems for Binary Parikh Matrices

Szilárd Zsolt Fazekas, Xinhao Huang, Robert Mercaş

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Szilárd Zsolt Fazekas

Akita University ∗^{*}

szilard.fazekas@ie.akita-u.ac.jp

Xinhao Huang

Akita University

d8523004@s.akita-u.ac.jp

Robert Mercas

Loughborough University

R.G.Mercas@lboro.ac.uk

The universality index corresponding to a word is the largest integer kk such that every word of length kk over the given alphabet occurs in it as a subsequence. Relative to languages this notion can be investigated with respect to both existential and universal quantifiers, with the former corresponding to the existence of a word in the language with universality index at least kk, while the latter considers the index across all words that the language contains.

In this work we study the existential (∃-universality) and universal (∀-universality) subsequence universality (as introduced in [Adamson et al., ISAAC 2023]) for binary languages consisting of all words with a fixed number of letters a, letters b, and subsequences ab. We prove that both ∃- and ∀-universality admit exact arithmetic characterizations for these languages.

Extending the above notions, we end the paper by initiating the analysis of the probability of a fixed word occurring as subsequence of the words in such a language. To this end, we prove that, for every fixed pattern word w and an error tolerance, given as input the subsequence counts describing a language, the ratio of words in the language having the pattern w as a subsequence admits an additive approximation scheme that is polynomial-time in the binary encoding of the input counts.

1 Introduction

A word u is a subsequence of a word w if u can be obtained from w by deleting letters without changing the order of the remaining letters. This relation is central in combinatorics on words and formal language theory, not least because of the classical theorem of Higman, which states that finite words over a finite alphabet are well-quasi-ordered by the subsequence relation [11], and a closely related theorem of Haines [9] that states that the downward closure of every language is regular. These results have made subsequences a natural tool in the study of languages, well-quasi-orders, and verification problems: even when a language itself is complicated, the set of all subsequences occurring in its words admits a finite automata-theoretic representation. This observation has been used repeatedly in algorithmic formal language theory and in the analysis of infinite-state systems, where downward closures and subword orderings provide regular over-approximations and decidability tools [24, 25, 14].

Beyond the existence of finite representations for downward closures, one may ask more refined algorithmic questions about the subsequences occurring in words or in languages. For a single word, this includes subsequence matching (decidable in linear time), testing whether two words have the same subsequences of at most a given length, i.e., testing Simon's congruence [22, 13, 8], identifying absent subsequences [15], and studying universality with respect to subsequences. A word w over an alphabet Σ\Sigma is called k-subsequence universal, or simply k-universal, if every word in Σk\Sigma^k, i.e., every word over Σ\Sigma of length k, occurs in w as a subsequence. Equivalently, the set of subsequences of w contains the full k-spectrum Σk\Sigma^k. This notion and several variants have been investigated for individual words and compressed words, e.g., see the work on scattered factor universality [2, 1] and the references therein.

∗^{*}This work was supported by JSPS KAKENHI Grant Number JP26K14700.

M. Hospodár et al. (Eds.): 17th International Conference on Automata and Formal Languages (AFL 2026) EPTCS 451, 2026, pp. 140–154, doi:10.4204/EPTCS.451.10

© Fazekas, Huang, Mercas This work is licensed under the Creative Commons Attribution License.

Recently, the same family of questions has been studied for formal languages rather than individual words. In this setting, the input language is typically represented succinctly, e.g., by an automaton or a grammar, and one asks whether a given pattern occurs as a subsequence in some word of the language, in all words of the language, or whether the language contains a word that is k-universal. These existential and universal variants have been considered for language classes from the Chomsky hierarchy, including regular, context-free, and context-sensitive languages [1, 6]. In particular, the transition from individual words to languages naturally introduces two questions: an existential one, asking whether some word in the language has the desired subsequence property, and a universal problem, asking whether all words in the language have it.

In this paper we study these subsequence analysis problems for a different, arithmetically defined class of finite languages. We work over the binary alphabet {a,b}\{a,b\}. For nonnegative integers A,B,CA,B,C, let LA,B,CL_{A,B,C} be the language of all binary words with the numbers of letters aa, letters bb, and scattered subwords abab equal AA, BB and CC, respectively. Equivalently, this is the equivalence class determined by a binary Parikh matrix [18, 16], and also by the binary 2-deck [12, 21], since over a binary alphabet the count of length-one subsequences and that of abab, characterizing the former, determines the whole count of length-2 subsequences, which describes the latter. The language is nonempty if and only if 0≤C≤AB0 \leq C \leq AB, and throughout the paper the entries A,B,CA,B,C are part of the input, encoded in binary.

Our first goal is to determine the existential and universal subsequence universality indices of LA,B,CL_{A,B,C}. For a language LL, we say that LL is kk- ∃\exists-universal if some word w∈Lw \in L is kk-universal, and we write

t∃(L)=max⁡{k∣somew∈Lisk−universal}.t_{\exists}(L)=\max\{k\mid some w\in L is k-universal\}.

We say that a nonempty language LL is kk-∀-universal if every word w∈Lw \in L is kk-universal, and we write

t∀(L)=max⁡{k∣everyw∈Lisk−universal}.t_{\forall}(L)=\max\{k\mid every w\in L is k-universal\}.

The notions, introduced in [1], capture the two natural quantifier choices over the language: the largest k such that a k-universal representative exists, and the largest k such that all representatives are k-universal.

We prove that, for binary 2-deck classes, both indices are computable in polynomial time in the bitlength of A, B, C. In the existential case, we prove that t∃(LA,B,C)t_{\exists}(L_{A,B,C}) is the minimum among A, B and a simple formula depending on the three input multiplicities. On the universal side, we show that no nonempty language LA,B,CL_{A,B,C} is 4-universal; thus only the patterns of lengths one, two, and three need to be considered. A complete avoidance analysis for the eight binary patterns of length three then yields a characterization of t∀(LA,B,C)t_{\forall}(L_{A,B,C}).

Finally, we consider a probabilistic refinement of the existential and universal subsequence questions. For a fixed binary pattern w and a nonempty language LA,B,CL_{A,B,C}, define pw(A,B,C)p_w(A,B,C) to be the probability that a uniformly chosen word from LA,B,CL_{A,B,C} contains w as a subsequence. The endpoint conditions pw(A,B,C)>0p_w(A,B,C) > 0 and pw(A,B,C)=1p_w(A,B,C) = 1 are exactly the existential and universal subsequence problems for the fixed pattern abab. The probability pw(A,B,C)p_w(A,B,C) therefore interpolates between the two quantifier extremes: instead of asking whether at least one representative contains w, or whether all representatives contain w, it asks for the density of representatives containing w.

Exact computation of this probability is not expected to be easy in general, since the universal subsequence problem, that is, testing pw(A,B,C)=1p_w(A,B,C) = 1, is as hard as factoring integers already for the fixed pattern ww. Nevertheless, for every fixed word pattern ww and fixed error tolerance ε>0\varepsilon > 0, we give an additive approximation algorithm for pw(A,B,C)p_w(A,B,C) running in time polynomial in the bitlength of A,B,CA,B,C. The proof uses the correspondence between binary Parikh matrix/2-deck classes and partitions inside an A×BA \times B rectangle: each word in LA,B,CL_{A,B,C} corresponds to a partition of area CC, in the form of Young diagrams

Subsequence Analysis Problems for Binary Parikh Matrices

(for more details, see Richomme’s discussion of this connection [19]). We combine this partition model with a polynomial bound on the number of w-avoiding representatives, a lower bound for Gaussian binomial coefficients when the input counts are not bounded by a constant, and exact counting procedures when one of A, B, C, AB - C is bounded. This yields a constant-error approximation scheme for fixed word patterns, complementing the exact arithmetic characterizations of the ∃\exists- and ∀\forall-universality indices.

We structure our paper as follows. The next section contains preliminaries for our work. Sections 3 and 4 are dedicated to the investigation of the k-universal existence and universality, while the last section introduces the concept of probability with respect to membership of subsequences and gives an approximation scheme for it.

References (24)