---
title: Suffix-Prefix Deletion Model
url: https://www.emergentmind.com/topics/suffix-prefix-deletion-model
type: topic
---

# Suffix-Prefix Deletion Model

The suffix-prefix deletion model denotes a family of constructions in which a word is analyzed through the prefix and suffix material that remains after some portion is deleted or existentially quantified away. In formal language theory, the model is expressed by the language operators $\mathrm{Prefix}(L)$ and $\mathrm{Suffix}(L)$ and by related quotient operations on languages accepted by deterministic machine families. In string algorithms, it appears as the query object $T_{i,j}=T[0..i]\Vert T[j..n-1]$, with the task of reporting all occurrences of $T$ inside the retained prefix-suffix concatenation. Across both settings, the central issue is whether deletion preserves enough structure to admit deterministic recognition or optimal query answering [1607.00931; 2411.03784].

## 1. Scope and terminological usage

In the exposition derived from Eremondi, Ibarra, and McQuillan, deletion is treated as an operation on languages over an alphabet $\Sigma$, with emphasis on deterministic reversal-bounded multicounter machines, deterministic pushdown automata, and finite automata. In the string-algorithmic setting of $PrefSuf(i,j)$, deletion is a query on a fixed text $T$ that removes a middle interval and asks whether the original string reappears in the concatenation of the surviving prefix and suffix [1607.00931; 2411.03784].

This suggests a common abstraction: a retained prefix and a retained suffix are composed after deletion, and the problem is to characterize the resulting language or the resulting occurrence set. The two settings, however, differ in their basic objects and technical goals.

| Setting | Basic object | Retained form after deletion |
|---|---|---|
| Formal language theory | $L\subseteq \Sigma^*$ | $\mathrm{Prefix}(L)$ or $\mathrm{Suffix}(L)$ |
| String algorithms | $T=T[0..n-1]$ | $T_{i,j}=T[0..i]\Vert T[j..n-1]$ |

A recurrent misconception in the automata-theoretic setting is that deterministic families should generally fail to be closed under deletion operations. The cited results qualify that expectation: some deterministic multicounter families remain closed under prefix deletion and, in restricted forms, under suffix deletion, whereas stronger negative results appear once reversal or counter resources increase [1607.00931].

## 2. Language-theoretic formulation

Let $\Sigma$ be an alphabet and $L\subseteq \Sigma^*$ a language. The two basic deletion operators are
\[
\mathrm{Prefix}(L)=\{\,x\in \Sigma^*\mid \exists y\in \Sigma^* \text{ such that } xy\in L\,\},
\qquad
\mathrm{Suffix}(L)=\{\,y\in \Sigma^*\mid \exists x\in \Sigma^* \text{ such that } xy\in L\,\}.
\]
Equivalently,
\[
\mathrm{Prefix}(L)=\{\,x\mid \exists y\in\Sigma^*:\;x\,y\in L\},
\qquad
\mathrm{Suffix}(L)=\{\,y\mid \exists x\in\Sigma^*:\;x\,y\in L\}.
\]

The deterministic machine model used most prominently is the one-way deterministic $k$-counter $\ell$-reversal-bounded multicounter machine, denoted $\mathrm{DCM}(k,\ell)$. A $\mathrm{DCM}(k,\ell)$ is a tuple
\[
M=(k,Q,\Sigma,\delta,q_0,F),
\]
where
\[
\delta:Q\times(\Sigma\cup\{\triangleright\})\times\{0,1\}^k \to Q\times\{S,R\}\times\{-1,0,+1\}^k
\]
is a partial deterministic transition function, and each of the $k$ counters may switch, over the whole run, between increasing and decreasing at most $\ell$ times. Configurations are $(q,w,c_1,\dots,c_k)$ with $q\in Q$, $w\in\Sigma^*$ the unread suffix, and $c_i\in\mathbb{N}$. The exposition also recalls deterministic pushdown automata and deterministic finite automata as comparison classes [1607.00931].

Within this framework, deletion is naturally related to quotients. The summary identifies
\[
L\cdot\Sigma^*{}^{-1}=\mathrm{Suffix}(L),
\]
so suffix deletion is a special case of right quotient. The broader deletion program in the underlying paper also studies infix, outfix, and left and right quotient with languages from different families.

## 3. Closure mechanisms for deterministic multicounter machines

The strongest positive theorem in the language-theoretic exposition is that $\mathrm{DCM}(k,\ell)$ is closed under prefix deletion without increasing counters or reversal bounds. If $L\in \mathrm{DCM}(k,\ell)$ and $M$ is an accepting machine for $L$, then $\mathrm{Prefix}(L)$ is accepted by simulating $M$ on the input $x$ and accepting whenever $M$ would read its right end-marker. Formally,
\[
\mathrm{Prefix}(L)=L\bigl(M\;\text{with “accept on end-marker”}\bigr)\in \mathrm{DCM}(k,\ell).
\]
The construction is operationally simple because no witness suffix must be generated explicitly [1607.00931].

A more delicate positive result holds for suffix deletion in the one-counter case: if $L\in \mathrm{DCM}(1,\ell)$, then
\[
\mathrm{Suffix}(L)\in \mathrm{DCM}(1,\ell).
\]
The proof sketch proceeds by defining the right quotient $L\cdot \Sigma^*{}^{-1}=\mathrm{Suffix}(L)$ and building an intermediate NCM that verifies, after reading a candidate suffix $y$, that there exists some $x$ such that $xy\in L$. Because the original machine has only one counter, the relevant unary counter-value language is regular. The NCM test can therefore be replaced by a DFA and integrated into the one-counter machine [1607.00931].

The general right-quotient theorem is broader. If $L_1\in \mathrm{DCM}(k_1,\ell_1)$ and $L_2$ belongs to a reversal-bounded-counter-augmentable family, including NPCM or even context-free languages, then
\[
L_1\,L_2^{-1}\in \mathrm{DCM}(k_1+\Delta k,\ell_1+\Delta\ell)
\]
for effectively computable $\Delta k,\Delta\ell$. The proof constructs, for each state of the original machine, an auxiliary NPCM that checks whether a continuation in $L_2$ exists from that state and those counter values, converts each auxiliary machine to DCM by semilinearity, and then simulates accordingly [1607.00931].

These constructions give the model a precise operational schema. Prefix deletion is realized directly on the original deterministic acceptor; suffix deletion is realized through precomputation of which states and counter values admit some completing prefix or suffix.

## 4. Canonical examples and non-closure boundaries

A standard example is
\[
L=\{a^n b^n\mid n\ge 1\}\in \mathrm{DCM}(1,1).
\]
A one-counter machine for $L$ increments on each $a$ and decrements on each $b$, accepting iff the counter is $0$ at the end. For prefix deletion,
\[
\mathrm{Prefix}(L)=\{a^i b^j\mid i\ge j\},
\]
accepted by running the same machine on the input and accepting immediately upon end-of-input rather than checking that the counter returns to $0$. For suffix deletion,
\[
\mathrm{Suffix}(L)=\{b^j\mid j\ge 0\},
\]
and the right-quotient construction reduces the witness condition to the regular test $n\ge j$ [1607.00931].

The main negative result shows that additional reversals or counters destroy this favorable behavior. There exists $L\in \mathrm{DCM}(1,3)$, and hence in $\mathrm{DCM}(2,1)$, such that
\[
\mathrm{Suffix}(L)\not\in \mathrm{DCM}\cup 2\mathrm{DCM}(1).
\]
The construction uses a DCM encoding of a known non-semilinear language of the form
\[
L=\{\,\#I_1\#I_2\cdots\#I_{2m}\mid I_{j+1}\,\text{not-valid-successor-of }I_j\},
\]
or, in the detailed example,
\[
L=\{\,a\,\#I_1\#I_2\cdots\#I_{2m}\,b
\mid I_{j+1}\text{ is not a valid successor of }I_j\}.
\]
Its suffix language can recover a non-recursive set, so it is neither in DCM nor in $2\mathrm{DCM}(1)$ [1607.00931].

The non-closure boundary extends further. Infix and outfix are not closed for machines with at least two reversal-bounded counters or at least three reversals on one counter. Deterministic pushdown automata are not closed under suffix or prefix deletion from the outset. The resulting closure chart is sharply stratified: $\mathrm{DCM}(k,\ell)$ is closed under prefix deletion within itself; $\mathrm{DCM}(1,\ell)$ is closed under suffix deletion within itself; $\mathrm{DCM}(k,\ell)$ is closed under suffix deletion in DCM, possibly with more counters; but $\mathrm{DCM}(k,\ell)$ for $k\ge 2$ or $\ell\ge 3$ is not closed under suffix deletion in $\mathrm{DCM}(2,1)$ or $2\mathrm{DCM}(1)$ [1607.00931].

## 5. The string query model \(PrefSuf(i,j)\)

In the second usage, the suffix-prefix deletion model is a query problem on a fixed string
\[
T=T[0..n-1]
\]
over an integer alphabet
\[
\Sigma=[0,\sigma),\qquad \sigma=n^{O(1)}.
\]
For any $0\le i<j<n$, define the delete-middle string
\[
T_{i,j}=T[0..i]\Vert T[j..n-1].
\]
The associated quantity is
\[
Occ(i,j)=\bigl|\{\,k:0\le k\le |T_{i,j}|-n\text{ and }T_{i,j}[k..k+n-1]=T\}\bigr|.
\]
The summary notes that in many cases one only needs to consider $i\ge j$, because otherwise $|T_{i,j}|<n$ and there are trivially $0$ or $1$ occurrences of $T$ [2411.03784].

The key structural lemma states that all occurrences of $T$ in $T_{i,j}$ can be encoded in $O(1)$ space. Let $p=\mathrm{per}(T)$ be the smallest period of $T$, and fix $i,j\in [0,n)$ with $i\ge j$. Then $T$ has an occurrence strictly inside
\[
T'=T_{i,j}=T[0..i]\Vert T[j..n-1]
\]
if and only if:

1. $T$ is periodic with $p<i-j+1$, and  
2. $(i-j+1)\bmod p=0$.

In that case the set of all occurrences is exactly the arithmetic progression
\[
\{\,0,p,2p,\dots,(i-j+1)\},
\]
with total of $(i-j+1)/p+1$ positions. Otherwise there are at most two occurrences: a prefix match at $k=0$ iff
\[
\mathrm{LCS}(T[0..i],T[0..j-1])=j,
\]
and a suffix match at $k=|T'|-n=i-j+1$ iff
\[
\mathrm{LCP}(T[i+1..n-1],T[j..n-1])=n-(i+1)
\]
[2411.03784].

This characterization sharply limits the combinatorics of the deletion query. The only source of more than two occurrences is global periodicity of the original string with parameters aligned to the deleted interval.

## 6. Data-structural realization and graph application

The data structure for $PrefSuf(i,j)$ stores exactly two components: the period $p=\mathrm{per}(T)$ if $T$ is periodic, or a special $\bot$-marker if $T$ is aperiodic; and an $O(n/\log_\sigma n)$-word LCE data structure on $T$ supporting both $\mathrm{LCP}$ and $\mathrm{LCS}$ in $O(1)$. Preprocessing in the word-RAM with $w=\Omega(\log n)$ consists of computing $p$ via the optimal packed-string algorithm of Kociumaka et al., and building the Kempa–Kociumaka LCE-structure on $T$ and on $T^R$ to answer $\mathrm{LCP}$ and $\mathrm{LCS}$ in $O(1)$. The total space is $O(n/\log_\sigma n)$ words, which is optimal since just reading $T$ takes $O(n/\log_\sigma n)$ words [2411.03784].

The query algorithm is constant-time. If $j>i+1$, it returns $(Occ=0,\emptyset)$. If $j=i+1$, it returns $(Occ=1,\{0\})$, because $T_{i,j}$ has length $n$ only. Otherwise let $d=i-j+1$. If $p\neq \bot$, $p<d$, and $d\bmod p=0$, the answer is the arithmetic progression $\{k\cdot p:0\le k\le d/p\}$. In the remaining case, there are at most two occurrences, obtained by the two LCE tests above. All steps—integer arithmetic, two LCE queries, and possibly returning the pair of positions—take $O(1)$ time in the word-RAM [2411.03784].

The principal application given is pattern matching on node-labeled bipartite graphs. Let $G=(U,V,E)$, let each $u\in U$ have label $A_u$, each $v\in V$ have label $B_v$, and let $P$ be a pattern of length $m$. One reports every edge $(u,v)\in E$ for which there exists a decomposition
\[
P=s\Vert p
\]
where $s$ is a suffix of $A_u$ and $p$ is a prefix of $B_v$; these are exactly the occurrences of $P$ spanning the edge $(u,v)$. The method preprocesses $P$ in $O(m/\log_\sigma m)\subseteq O(m)$ time, runs KMP on $A_u$ versus $P$ to find the longest suffix of $A_u$ matching a prefix of $P$, runs KMP on $B_v^R$ versus $P^R$ to find the longest prefix of $B_v$ matching a suffix of $P$, and then invokes $PrefSuf(i,j)$ in $O(1)$ time per edge. The total time is $O(N_U+N_V+|E|)$ for graph scanning plus $O(m)$ preprocessing, yielding an optimal $O(N+|E|)$-time algorithm for bipartite and hence two-node pattern matching in node-labeled graphs [2411.03784].

The broader significance of the suffix-prefix deletion model is therefore domain-dependent. In automata theory, it measures how far deterministic acceptors retain closure under deletion, with precise thresholds in counter and reversal resources. In string algorithms, it yields a compact structural description of all occurrences surviving a middle deletion, enabling optimal preprocessing and $O(1)$ query time. The two lines of work are technically distinct, but both treat deletion not as arbitrary loss of information, but as a constrained operation whose residual prefix-suffix structure can still be characterized exactly.

Source: https://www.emergentmind.com/topics/suffix-prefix-deletion-model