Abstract 1 Introduction 2 Preliminaries 3 Combinatorial Properties of Affine Prefix Sets 4 Appending a Palindrome to an Affine Prefix Set References

Small Space Encoding and Recognition of 𝒌-Palindromic Prefixes

Gabriel Bathie ORCID DIENS, École normale supérieure de Paris, PSL Research University, France
LaBRI, Université de Bordeaux, France
Jonas Ellert ORCID DIENS, École normale supérieure de Paris, PSL Research University, France Tatiana Starikovskaya ORCID DIENS, École normale supérieure de Paris, PSL Research University, France
Abstract

Palindromes are non-empty strings that read the same forward and backward. We study the problem of recognizing so-called k-palindromic strings, which can be represented as the concatenation of exactly k palindromes. [Rubinchik and Shur, MFCS 2020] showed that the problem is solvable in linear space and time. We present a read-only algorithm that recognizes all k-palindromic prefixes of a string T of length n in 𝒪(n6k2logkn) time and 𝒪(6k2logkn) space. As a corollary, we also obtain a read-only algorithm for computing the palindromic length of T, i.e., the smallest k such that T is k-palindromic, in 𝒪(n6k2logk/2n) time and 𝒪(6k2logk/2n) space.

Keywords and phrases:
palindromic length, read-only algorithms, palindromes
Copyright and License:
[Uncaptioned image] © Gabriel Bathie, Jonas Ellert, and Tatiana Starikovskaya; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Streaming, sublinear and near linear time algorithms
Related Version:
Full Version: https://doi.org/10.48550/arXiv.2410.03309 [5]
Funding:
Gabriel Bathie, Jonas Ellert, and Tatiana Starikovskaya: Partially funded by grant ANR-20-CE48-0001 from the French National Research Agency.
Editors:
Ho-Lin Chen, Wing-Kai Hon, and Meng-Tsung Tsai

1 Introduction

A palindrome is a non-empty string that equals its reversed copy, i.e., a string that reads the same both forward and backward. Throughout, we denote the language of palindromes by PAL. Natural variants of PAL include the language of even-length palindromes PALev and the language of palindromes of length greater than one PAL>1. Recognising PALev (often referred to as “palstar”), PAL>1, and PALk={P1P2Pk:PiPAL,1ik} is a classical problem of formal language theory, introduced by Knuth, Morris, and Pratt [27].111 is a Kleene star. In this problem, one is given an input string and must decide whether it is in the language.

Languages PALev, PAL>1, and PALk are context-free, and Valiant’s parser from 1975 recognizes them in 𝒪(nω) time, where n is the length of the input and ω is the matrix multiplication exponent. Only in 2018, Abboud, Backurs, and Vassilevska Williams showed that Valiant’s parser is optimal if the current clique algorithms are optimal [1], meaning that for general context-free languages, there is little hope of achieving a faster recognition algorithm. The origins of the study of derivatives of the PAL languages are in fact in line with the result of [1]: At one time, it was popularly believed that PALev cannot be recognised in linear time, and it was considered as a candidate for a “hard” context-free language (see [27, Section 6]). However, [27] refuted this hypothesis by showing an 𝒪(n)-time recognition algorithm for PALev. Manacher [32] found another way to recognize PALev in linear time, and Galil [16] derived a real-time recognition algorithm (see also Slisenko [35]). Later, Galil and Seiferas [17] showed a linear-time recognition algorithm for PAL>1.

Recognition of PALk appeared to be a much more intricate problem. Galil and Seiferas [17] succeeded to design linear-time recognition algorithms for the cases k=1,2,3,4, but the general question remained open for almost 40 years. Only in 2015, Kosolobov, Rubinchik, and Shur [29] showed an 𝒪(nk)-time recognition algorithm for PALk for all k+, which was finally improved to optimal 𝒪(n) time by Rubinchik and Shur in 2020 [34]. A related question is that of computing the palindromic length of a string T, which is defined to be the smallest integer k such that TPALk. The first 𝒪(nlogn)-time algorithms for computing the palindromic length were presented in [12, 25, 33]. Finally, Borozdin et al. [10] showed an optimal 𝒪(n)-time algorithm for this problem.

Our contributions.

In this work, we turn our attention to the space complexity of recognising PALk and computing the palindromic length. We start by presenting a characterization of prefixes of a given string that belong to PALk. For k=1, we refer to these prefixes as prefix-palindromes, and otherwise as k-palindromic prefixes. A crucial component of the linear time algorithm by Borozdin et al. [10] is the following property: the prefix-palindromes of a length-n string can be expressed as 𝒪(logn) sets of form {XQa:a{1,,u}}, where u is an integer. In order to encode k-palindromic prefixes, we introduce a notion of affine prefix sets of order k. Intuitively, such a set consists of prefixes of the form XQ1a1Q2a2Qkak with i[1,k]:ai{1,,ui}, where ui are integers. That is, rather than a single repeating substring Q, we allow multiple different substrings Qi of different lengths. An affine prefix set of order k can then be encoded in 𝒪(k) space. By carefully analyzing the rich structure of periodic substrings induced by k-palindromic prefixes, we show that they can be expressed by a small number of affine prefix sets.

Theorem 1.1.

Let 0<ϵ<1 be constant, T[1..n] a string, and k+. The set of prefixes of T that belong to PALk is the union of 𝒪(6k2/(2ϵ)logkn) affine prefix sets of order k.

The remainder of the paper focuses on the main ideas behind Theorem 1.1. In the full version [5], apart from explaining all details, we show a lower bound for the size of the representation (Theorem 1.2), and provide read-only algorithms for computing affine prefix sets and palindromic length (Theorems 1.3 and 1.4). The lower bound shows that our representation is within a logn factor of being asymptotically optimal for constant k. It is obtained by constructing a large family of strings uniquely identifiable by their palindromic prefixes.

Theorem 1.2.

Let T[1..n] be a string and let k+. Encoding the lengths of the prefixes of T that belong to PALi, for each i[1,k], requires Ω(kk(log3n)k) bits of space.

The read-only algorithms directly implement the techniques used to show Theorem 1.1.

Theorem 1.3.

Let 0<ϵ<1 be constant. Given a string T[1..n] and k+, there is a read-only algorithm that returns a compressed representation of all prefixes of T that belong to PALi, for each i[1,k], in 𝒪(n6k2/(2ϵ)logkn) time and 𝒪(6k2/(2ϵ)logkn) space.

Theorem 1.4.

Given a string T[1..n], there is a read-only algorithm that computes the palindromic length k of T in 𝒪(n6k2logk/2n) time and 𝒪(6k2logk/2n) space.

In particular, for k=𝒪(loglogn), the algorithm uses nlog𝒪(k)n time and log𝒪(k)n space, and for k=o(logn), it uses n1+o(1) time and sublinear no(1) space. In the regime of small palindromic length, this is an improvement over all previously-known algorithms [10, 34], which require Ω(n) space. It remains an intriguing open problem to achieve both linear time and sublinear space. On the other hand, Theorem 1.2 does not imply a lower bound for the algorithms of Theorems 1.3 and 1.4 because they have access to the input. This said, proving an Ω(logf(k)n) space lower bound for such algorithms appears out of reach with current techniques. The only lower bound method for read-only string processing the authors are aware of relies on deterministic branching programs [9], and shows that any sublinear-space algorithm for longest common substring requires slightly superlinear time [28].

Related work.

The problem of computing palindromes in small space has received significant attention: the longest palindromic substring [8, 24], and all approximate prefix-palindromes [3, 6] have been studied. More broadly, small-space recognition of formal languages has been explored for regular [19, 20, 21, 22, 11], Dyck [26, 30, 31], visibly pushdown [2, 14, 18, 7], context-free [23], and 𝖣𝖫𝖨𝖭/𝖫𝖫(k) languages [4].

2 Preliminaries

Series, strings, and substrings.

For i,j, we write [i,j]=[i,j+1)=(i1,j]=(i1,j+1) to denote {hihj}. A series a1,b1,c1,a2,b2,c2,,at,bt,ct is denoted by (ai,bi,ci)i=1t. The empty series is denoted by ε. We use the dot-product to denote the concatenation of two series, e.g., for t3 one can represent (ai,bi,ci)i=1t=(ai,bi,ci)i=1t3(ai,bi,ci)i=t2t. We may omit the subscript and superscript for series of length one, e.g., (a1,b1,c1)=(ai,bi,ci)i=11.

A string T of length |T|=n is a sequence of n symbols from a set Σ, which we call the alphabet. The input string is also called the text. We denote the set of all length-n strings by Σn, and we set Σn=m=0nΣm as well as Σ=n=0Σn. The empty string is denoted by ε. For i,j[1,n], the i-th symbol in T is denoted by T[i]. The substring T[i..j]=T[i..j+1)=T(i1..j]=T(i1..j+1) is the empty string ε if j<i, and the string T[i]T[i+1]T[j] otherwise. We may call a substring T[i..j] a fragment of T to emphasize that we mean the specific occurrence of T[i..j] that starts at a position i. For example, in the string T=abcabc, the substrings T[1. .3] and T[4. .6] are identical, but T[1. .3] and T[4. .6] are distinct fragments. A string S is a prefix of T if there is i[1,n] such that S=T[1..i], in which case we may simply write T[..i]. Similarly, S is a suffix of T if there is i[1,n] such that S=T[i..n], in which case we may simply write T[i..]. We extend this notion to the empty suffix T[n+1..n]=T[n+1..] and the empty prefix T[1. .0]=T[. .0]. A substring (hence also a suffix or prefix) of T is proper if it is shorter than T. When introducing a string S, we may simply say that S[1..m] is a string rather than saying that S is a string of length m. The concatenation of two strings S[1..m] and T[1..n] is the string S[1]S[2]S[m]T[1]T[2]T[n], denoted by either ST or simply ST. For non-negative integer a, we write Ta to denote the length-(an) string obtained by concatenating a copies of T. We extend this idea to non-negative rational exponents α, for which we write Tα to denote TαT[1..(αnmodn)]. We only use this notation if αn.

Palindromes and periodicities.

For a string T[1..n], we write rev(T) to denote its reverse, i.e., rev(T)=T[n]T[n1]T[1]. We then say that T is a palindrome if and only if T is non-empty and T=rev(T). The set of all palindromes is denoted by PAL. For a positive integer k, the set PALk contains all the strings that can be written as the concatenation of exactly k palindromes. We refer to such strings as k-palindromic. If k=1, and a string is a one-palindromic prefix of another string, we also refer to it as prefix-palindrome.

We define the forward cyclic rotation 𝗋𝗈𝗍(T)=T[2..n]T[1]. More generally, a cyclic rotation 𝗋𝗈𝗍s(T) with shift s is obtained by iterating 𝗋𝗈𝗍 (if s is positive) or the inverse operation 𝗋𝗈𝗍1 (if s is negative) exactly |s| times. A non-empty string T[1..n] is primitive if it is distinct from its non-trivial rotations, i.e., if T=𝗋𝗈𝗍s(T) holds only when n divides s. If a string X can be represented as Ya for some primitive string Y and integer a, then Y is called the primitive root of X.

A string T[1..n] has period p+ if i[1,np]:T[i]=T[i+p], or equivalently if T[1..np]=T(p..n]. The string T[1..np]=T(p..n] is a border of T. If T has period pn/2, then we say that T is p-periodic. If T has period pn, then it can be written as T=Pn/pP[1..nmodp], where P=T[1..p]. We may alternatively use a rational exponent and write T=Pn/p. Below, we provide some simple auxiliary lemmas regarding periodic strings and palindromes (with proofs in the full version).

Fact 2.1 (Periodicity Lemma [13]).

If p and q are distinct periods of a string of length at least p+qgcd(p,q), then gcd(p,q) is a period of the string.

Corollary 2.2 (Folklore).

For a primitive string Q, the minimal period of Q2 is |Q|.

Lemma 2.3.

Assume that a palindrome P has a q-periodic prefix of length m3q/2. If |P|2mq, then P is q-periodic.

Model of computation.

We assume the word-RAM model of computation [15], using words of size Θ(logn) when processing an input string of length n. The presented algorithms are deterministic and read-only, i.e., they cannot write to the memory occupied by the input. Space complexities are stated in number of words, ignoring the space occupied by the input.

3 Combinatorial Properties of Affine Prefix Sets

In this section, we study the combinatorial structure of k-palindromic prefixes of T. We start with the definition of affine sets, which we will use as a scaffolding for our analysis.

Definition 3.1 (Affine sets).

A set of strings 𝒜 is affine if there exist t0, a string X, primitive strings Q1,,Qt, and positive integers 1,,t and u1,,ut such that

i[1,t]:iui and 𝒜={XQ1a1Qtatr[1,t]:ar[r,ur]}.

The tuple X,(Qi,i,ui)i=1t is a representation of 𝒜, and t is the order of the representation. The order of 𝒜 is the minimal order achieved by any of its representations. We call {Qi} the components of a representation, and i (resp., ui) the exponent lower (resp., upper) bounds.

A representation generates (the strings of) the corresponding affine string set. If X,(Qi,i,ui)i=1t generates 𝒜 and X,(Qi,i,ui)i=1t generates , then their concatenation is defined as X,(Qi,i,ui)i=1t(Y,a,a)(Qi,i,ui)i=1t, where Y is a primitive string and a is a positive integer such that Ya=X (i.e., Y is the primitive root of X). The concatenation generates 𝒜={AB:A𝒜B}. (If X=ε, then the concatenation is X,(Qi,i,ui)i=1t(Qi,i,ui)i=1t.)

In what follows, we consider affine prefix sets, i.e., affine sets that contain only prefixes of the given input string T. We will show that a small number of affine prefix sets suffices to represent the k-palindromic prefixes of T. The case where k=1, i.e., the structure of prefix-palindromes, is well-understood: there are 𝒪(logn) groups of such palindromes, where each group can be expressed as an arithmetic progression and a corresponding periodic prefix of T (see [10, Lemma 5]). Below, we restate this result in the framework of affine prefix sets.

Lemma 3.2.

The prefix-palindromes of a string T[1..n] can be partitioned into 𝒪(logn) affine sets of order at most 1. Each set of order 1 has representation U(VU),(VU,1,u) for some UPAL{ε}, VPAL and integers 1 and u>1.

3.1 Reducing affine prefix sets

A single affine set may have multiple equivalent representations. For example, the affine set S={caba,cababa,cabababa} is represented by c,(ab,1,3) and (a,1,1), ca,(ba,1,3). Arguably, the latter representation is preferable, as it has a lower order and can thus be encoded more efficiently. Hence we propose a way of potentially decreasing the order of a representation by reducing it.

Definition 3.3 (Irreducible representation).

A representation X,(Qi,i,ui)i=1t of an affine string set is irreducible if and only if r[1,t]:1=r<ur and r[1,t):|Qr|>|Qr+1|.

(a) An affine prefix set 𝒜 of a string T with representation X,(Q1,,)(Q2,,)(Q3,,) (drawn above T). This representation is irreducible. The set 𝒜 contains all the prefixes of T that end at positions drawn in dotted lines. In this example, the set 𝒜 has the alternative representation X,(Q1,1,2)(Q,1,1)(Q2,2,4)(Q3,1,2). This representation is reducible because Q has the same exponent upper and lower bound, and because Q2 has an exponent lower bound larger than 1.
(b) An affine prefix set 𝒜 of a string T with representation X,(Q1,1,2)(Q2,1,3) (drawn in black). If this representation is strongly affine, then its expansion X,(Q1,1,7)(Q2,1,8) is also a representation of an affine prefix set of T (drawn in gray).
Figure 1: Affine prefix sets.

From now on, we say that Qr with r[1,t] is fixed if r=ur, and flexible otherwise. If there is some r[1,t) such that |Qr||Qr+1|, then we say that there is an inversion between Qr and Qr+1. Thus, a representation is irreducible if and only if all components are flexible and have unit lower bounds, and there are no inversions. As per this definition, ca,(ba,1,3) is the only irreducible representation of S from the previous example. (See also Figure 1(a).)

Properties of flexible components.

Now we show how to make an arbitrary representation irreducible, possibly decreasing (but never increasing) its order. The reduction exploits the structure of periodic substrings induced by flexible components.

Lemma 3.4.

Let X,(Qi,i,ui)i=1t be a representation of an affine prefix set, and consider any r[1,t) such that Qr is flexible. Then |Qr| is a period of every string QrarQr+1ar+1Qtat that satisfies ar0 and j(r,t]:aj[j,uj].

Proof.

Let P=Q11Q22Qrr and S=Qr+1ar+1Qr+2ar+2Qtat. By the definition of an affine prefix set, XPS is a prefix of the underlying string T. Since Qr is flexible, it holds r<ur, and thus XPQrS is also a prefix of T. If both XPS and XPQrS are prefixes of T, then S is a prefix of QrS. Hence QrS and S have periods |Qr|. Consequently, QrarS, for all ar0, also has period |Qr|.

If two adjacent components Qr and Qr+1 are flexible, then the lemma allows us to obtain the following lower bound on the length of Qr.

Lemma 3.5.

Let X,(Qi,i,ui)i=1t be a representation of an affine prefix set, and let r[1,t). If both Qr and Qr+1 are flexible, then either Qr=Qr+1 or

|Qr|>|Qr+1ur+11|+(j=r+2t|Qjuj|)+gcd(|Qr|,|Qr+1|).
Proof.

For flexible Qr and Qr+1, let qr=|Qr|, qr+1=|Qr+1|, and p=gcd(qr,qr+1). Let Qr+1=Qr+1ur+1Qr+2ur+2Qtut. By Lemma 3.4, both qr and qr+1 are periods of Qr+1, and qr is a period of QrQr+1. Since qr is a period of QrQr+1, it is also a period of QrQr+1. Hence Qr=Qr+1 if and only if qr=qr+1. For the sake of contradiction, assume that the lemma does not hold, i.e., qrqr+1 and qr|Qr+1|qr+1+p. We make two observations.

First, Qr+1 is of length |Qr+1|qr+qr+1p, and it has distinct periods qr and qr+1. The periodicity lemma (˜2.1) implies that p is a period of Qr+1, and thus also a period of its prefix Qr+1. If p<qr+1, then Qr+1=Qr+1[1..p]qr+1/p, which contradicts the primitivity of Qr+1. Second, Qr+1 is of length |Qr+1|qr+qr+1pqr. Since qr is a period of QrQr+1, we know that Qr is a prefix of Qr+1. Hence p is also a period of Qr. If p<qr, then Qr=Qr[1..p]qr/p, which contradicts the primitivity of Qr.

We have shown that gcd(qr,qr+1)max(qr,qr+1). This is only possible if gcd(qr,qr+1)=qr=qr+1, which contradicts the assumption that qrqr+1. Therefore, the lemma holds.

Lemma 3.6.

Let X,(Qi,i,ui)i=1t be an irreducible representation of an affine prefix set 𝒜 of a string of length n. Then it holds |𝒜|=i=1tui and tlog2n.

Proof.

Let E={(ai)i=1ti[1,t]:ai[1,ui]} of cardinality |E|=i=1tui be the set of exponent configurations admitted by the representation (where [1,ui]=[i,ui] because the representation is irreducible). Then 𝒜={XQ1a1Q2a2Qtat(ai)i=1tE}. In order to show |𝒜|=|E|, it suffices to show that no two elements in E generate the same string.

For the sake of contradiction, assume that there are distinct sequences (ai)i=1t,(bi)i=1tE that generate the same string S=XQ1a1Q2a2Qtat=XQ1b1Q2b2Qtbt. Let r[1,t] be the minimal index such that arbr, and assume w.l.o.g. that ar>br. Then S has the prefix XQ1a1Qr1ar1Qrbr=XQ1b1Qr1br1Qrbr, and we can factorize the corresponding suffix in two different ways as QrarbrQr+1ar+1Qtat=Qr+1br+1Qtbt. However, the two factorizations have different lengths |QrarbrQr+1ar+1Qtat|>|QrQr+1|>|Qr+1ur+1Qtut||Qr+1br+1Qtbt|, where the second inequality is due to Lemma 3.5. Because of this contradiction, there cannot be distinct sequences (ai)i=1t,(bi)i=1tE that define the same string.

Finally, it holds i[1,t]:ui2 for any irreducible representation, and thus |𝒜|=i=1tui2t. Since trivially |𝒜|n, it follows 2tn or equivalently tlog2n.

Transforming representations.

Now we use the properties of flexible components to transform an arbitrary representation into an irreducible one. We use the following operations.

Lemma 3.7.

Let ρ=X,(Qi,i,ui)i=1t be a representation of an affine prefix set 𝒜.

  1. 1.

    If there is r[1,t) such that Qr is flexible and Qr+1 is fixed, then let y=|Qr+1r+1|mod|Qr|. 𝒜 has representation

    switchr(ρ)=X,(Qi,i,ui)i=1r1(Qr+1,r+1,ur+1)(𝗋𝗈𝗍y(Qr),r,ur)(Qi,i,ui)i=r+2t.

  2. 2.

    If there is r[1,t) such that both Qr and Qr+1 are flexible and |Qr||Qr+1|, then Qr=Qr+1 and 𝒜 has representation

    merger(ρ)=X,(Qi,i,ui)i=1r1(Qr,r+r+1,ur+ur+1)(Qi,i,ui)i=r+2t.

  3. 3.

    If there is r[1,t] such that r>1, then 𝒜 has representation

    splitr(ρ)=X,(Qi,i,ui)i=1r1(Qr,r1,r1)(Qr,1,urr+1)(Qi,i,ui)i=r+1t.

  4. 4.

    If Q1 is fixed, then 𝒜 has representation truncate(ρ)=XQ11,(Qi+1,i+1,ui+1)i=1t1.

Proof.

Statements (3) and (4) are trivial. For (2), if |Qr||Qr+1| and both Qr and Qr+1 are flexible, then Lemma 3.5 implies Qr=Qr+1. Hence the statement follows.

Finally, we show that statement (1) holds. Assume that Qr is flexible and Qr+1 is fixed. Then Lemma 3.4 implies that |Qr| is a period of QrQr+1r+1, and thus Qr+1r+1=QrxQr[1..y] with x=|Qr+1r+1|/|Qr| and y=|Qr+1r+1|mod|Qr|. (Either x or y might be zero, but this is irrelevant for the proof.) Let P=Qr[1..y] and S=Qr(y..|Qr|]. Any rotation of a primitive string is primitive, and hence 𝗋𝗈𝗍y(Qr)=SP is primitive. For any exponent a[r,ur], it holds QraQr+1r+1=(PS)a(PS)xP=(PS)xP(SP)a=Qr+1r+1(𝗋𝗈𝗍y(Qr))a. Hence the stated transformation does not change the represented affine prefix set.

The leftmost (i.e., lowest index) fixed component Qr of a representation can either be removed with truncate (if r=1), or it can be moved further to the left with switchr1 (if r>1). By repeatedly applying truncate and switch, we obtain the following lemma.

Lemma 3.8.

Let ρ=X,(Qi,i,ui)i=1t be a representation of an affine prefix set, and let F={j[1,t]j<uj}={j1,,j|F|} with j1<j2<<j|F| be the indices of the flexible components. Then the affine prefix set has a representation X^,(Q^ji,ji,uji)i=1|F| such that Q^ji is a rotation of Qji for every i[1,|F|]. Both X^ and all the Q^ji are functions of X, Q1,,Qt, and 1,,t, i.e., they are independent of u1,,ut.

After applying Lemma 3.8, we repeatedly apply merge to remove all inversions. Then, we apply split until all flexible components have exponent lower bound 1. This may result in new fixed components, which we remove with Lemma 3.8, resulting in the following lemma.

Lemma 3.9.

An affine prefix set represented by X,(Qi,i,ui)i=1t has an irreducible representation of order |L|t, where L={|Qr|r[1,t]:r<ur}.

3.2 Strongly affine representations

To analyze the intricate structure of repetitive fragments induced by affine prefix sets, it is helpful to assume that periodicity extends slightly beyond the region in question. To this end, we define a strongly affine representation of an affine prefix set of T, in which the exponent upper bound of each (flexible) component can be increased by five and still yield an affine prefix set of T. A supplementary drawing is provided in Figure 1(b).

Definition 3.10 (Strongly affine representations).

A representation ρ=X,(Qi,i,ui)i=1t of an affine prefix set of a string T is strongly affine if and only if its periodic expansion expand(ρ)=X,(Qi,i,ui)i=1t is also the representation of an affine prefix set of T, where ui, i[1,t], is defined as follows: ui=ui if ui=i and ui=ui+5 otherwise.

Definition 3.11 (Canonical representation).

A representation of an affine prefix set is canonical if and only if it is both strongly affine and irreducible.

It can be readily verified that, if ρ is strongly affine, then also truncate(ρ), splitr(ρ), merger(ρ), and switchr(ρ) are strongly affine (for any r, assuming that the respective operation is indeed applicable). We obtained Lemma 3.9 by applying a sequence of these operations, and hence we have the following immediate corollary.

Corollary 3.12.

An affine prefix set with strongly affine representation X,(Qi,i,ui)i=1t has a canonical representation of order |L|t, where L={|Qr|r[1,t]:r<ur}.

Whether a representation ρ of an affine prefix set 𝒜 of T is strongly affine does not only depend on ρ, it also depends on what T looks like beyond the end of the longest prefix represented by ρ. Therefore, one cannot hope to transform an arbitrary representation into an equivalent strongly affine representation. However, by “removing” the last five copies of each component and treating them separately, we show that we can cover an affine prefix set of order t with at most 6t canonical representations.

Lemma 3.13.

An affine prefix set of order t can be partitioned into at most 6t affine prefix sets, each of which has a canonical representation of order at most t.

Proof.

Let X,(Qi,i,ui)i=1t be a representation of an affine prefix set. We produce a set of representations R={X,(Qi,i,ui)i=1tr[1,t]:(r,ur)Br}, where r[1,t], we define Br={(u,u)u[max(r,ur4),ur]}{(r,max(r,ur5))}. It is easy to see that the affine sets generated by representations in R form a partition of the affine set generated by X,(Qi,i,ui)i=1t. By design, for any representation in R, and for any component Qr, we know that Qr is either fixed, or it has exponent lower bound r and exponent upper bound ur5. Hence the instances in R are strongly affine, and it follows from Corollary 3.12 that each of them has an equivalent canonical representation of order at most t. Finally, it holds i[1,t]:|Bi|6 and thus |R|=i=1t|Bi|6t.

By applying the technique from the proof above to the prefix-palindromes, i.e., to each of the representations of order 1 produced by Lemma 3.2, we obtain the following result.

Corollary 3.14.

The set of prefix-palindromes of a string T[1..n] can be partitioned into 𝒪(logn) affine sets of order at most 1. Each set of order 1 has canonical representation U(VU),(VU,1,u) for some UPAL{ε}, VPAL and integers 1 and u>1.

Corollary 3.15.

Let X,(Qi,i,ui)i=1t be a canonical representation of an affine prefix set. Then it holds r[1,t]:|Qr|>j=r+1t|Qjuj+4|.

Proof.

If ρ=X,(Qi,i,ui)i=1t is canonical, then clearly expand(ρ)=X,(Qi,i,ui+5)i=1t is irreducible. Thus, the statement follows from Lemma 3.5 applied to expand(ρ).

Lemma 3.16.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set, and let h[0,5]. Then ε,(Qi,1,ui+h)i=2t is an irreducible representation of an affine prefix set of the string Q12, and, if h<5, also of the string Q1.

Proof.

Consider any h[0,5]. Due to the strong affinity, X,(Qi,1,ui+h)i=1t represents an affine prefix set. Let (ai)i=2t be a sequence of exponents with j[2,t]:aj[1,ui+h]. By Lemma 3.4, the string Q1Q2a2Q3a3Qtat has period |Q1|. Due to Lemma 3.5, it holds |Q2a2Q3a3Qtat|<|Q1Q2|<|Q12|. Hence we have shown that Q2a2Q3a3Qtat is a prefix of Q12, and ε,(Qi,1,ui+h)i=2t is a representation of an affine prefix set of Q12. Since X,(Qi,1,ui)i=1t is irreducible, it is easy to see that also ε,(Qi,1,ui+h)i=2t is irreducible.

If h<5, then Lemma 3.5 invoked with X,(Qi,1,ui+5)i=1t implies |Q2a2Q3a3Qtat|<|Q1|, and ε,(Qi,1,ui+h)i=2t indeed only generates strings of length less than |Q1|.

Corollary 3.17.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set. Then ε,(Qi,1,ui)i=2t is a canonical representation of an affine prefix set of the string Q12.

Proof.

By Lemma 3.16, ε,(Qi,1,ui+5)i=2t is an irreducible representation of an affine prefix set of Q12. Hence ε,(Qi,1,ui)i=2t is a canonical representation for Q12.

3.3 Reversing the structure of affine prefix sets

Figure 2: Lemma˜3.18 applied to an irreducible representation X,(Q1,1,2)(Q2,1,3)(Q3,1,2). The drawing shows the longest prefix S=Q12Q23Q32 generated by the representation. By the lemma, for any a1[0,2], a2[0,3] and a3[0,2], it holds S=Q12a1Q23a2Q32a3Q^3a3Q^2a2Q^1a1, where each Q^j is the length-|Qj| suffix of S. The drawing highlights the case where a1=a2=a3=1.

We first show that a periodic fragment of T induced by an affine prefix set can be covered by a combination of a forward and a “backward” affine prefix set (see Figure 2):

Lemma 3.18.

Let X,(Qi,1,ui)i=1t be an irreducible representation of an affine prefix set, let S=Q1u1Q2u2Qtut, and for j[1,t] let Q^j be the length-|Qj| suffix of S. For any sequence (ai)i=1t with j[1,t]:aj[0,uj], it holds

S=Q1u1a1Q2u2a2QtutatQ^tatQ^t1at1Q^1a1.
Proof.

If t=1, then S=Q1u1=Q^1u1=Q1u1a1Q^1a1. Inductively assume that the lemma holds for representations of order t1. Now we show that it holds for representations of order t. If X,(Qi,1,ui)i=1t is an irreducible representation of an affine prefix set, then clearly XQ1u1,(Qi,1,ui)i=2t is an irreducible representation of another affine prefix set. This representation is of order t1, and hence the inductive assumption implies

S=Q1u1Q2u2a2Q3u3a3QtutatQ^tatQ^t1at1Q^2a2.

If a1=0, then there is nothing left to do. Hence assume a1>0. Since X,(Qi,1,ui)i=1t is an irreducible representation, Lemma 3.4 implies that |Q1| and therefore also q=a1|Q1| is a period of S. Hence S has a border of length sq, where s=|S|, and it holds

S[1..sq]=S[1+q..s]=Q1u1a1Q2u2a2Q3u3a3QtutatQ^tatQ^t1at1Q^2a2.

Finally, as mentioned before, S[sq+1..s] of length q=a1|Q1| has period |Q1|. Hence S[sq+1..s]=(S[s|Q1|+1..s])a1=Q^1a1, which concludes the proof.

We now build on this characterization to convert irreducible representations of affine prefix sets of S into irreducible representations of affine prefix sets of rev(S).

Corollary 3.19.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set, let s=i=2t(ui+1)|Qi|, and for j[1,t] let Q^j be the length-|Qj| suffix of 𝗋𝗈𝗍s(Q1). Then ε,(rev(Q^i),1,ui)i=2t represents an affine prefix set of rev(𝗋𝗈𝗍s(Q1)).

Proof.

Consider any sequence (ai)i=2t of exponents admitted by the representation, i.e., j[2,t]:aj[1,uj]. By Lemma 3.16, ε,(Qi,1,ui+1)i=2t is an irreducible representation of an affine prefix set of Q1, which implies Q1[1..s]=Q2u2+1Q3u3+1Qtut+1. For this representation, Lemma 3.18 implies that Q^tatQ^t1at1Q^2a2 is a suffix of Q1[1..s]. Thus, its reversal rev(Q^tatQ^t1at1Q^2a2)=rev(Q^2a2)rev(Q^3a3)rev(Q^tat) is a prefix of rev(Q1[1..s]), which is a prefix of rev(𝗋𝗈𝗍s(Q1)).

4 Appending a Palindrome to an Affine Prefix Set

In this section, we show how to extend an affine prefix set 𝒜 with a palindrome. This amounts to computing the union of affine prefix sets where each new prefix is formed by concatenating a prefix from 𝒜 with a palindrome. We distinguish two cases, depending on whether the appended palindrome lies within a periodic fragment of T. In either case, we may temporarily overextend 𝒜, producing sets that are not affine prefix sets. We then restore validity by truncating the sets using the lemma below. For a set of strings 𝒜, denote 𝒜|m={S𝒜:|S|m}.

Lemma 4.1.

Let X,(Qi,i,ui)i=1t be a representation of an affine prefix set 𝒜. For m, we can express 𝒜=𝒜|m as a union of at most tt affine prefix sets 𝒜=j=1t𝒜j, each with a representation of order at most t.

Proof Sketch.

The proof is by induction. For the base case t=1, it is enough to reduce the upper bound on the exponent of Q1. For t>1, the proof proceeds by finding a minimal exponent a11 such that |XQ1a1Q2u2Qtut|>m. If a1>u1, then 𝒜=𝒜. Otherwise, we assume w.l.o.g. that 𝒜 is irreducible (see Lemma 3.9). It follows that we do not need to consider prefixes generated with an exponent larger than a1 for Q1. We partition the remaining prefixes into two sets, one of which can be further broken down using the inductive hypothesis, reducing the problem to problems of smaller sizes until the result follows.

4.1 Appending a long palindrome

Assume that the affine prefix set to be extended is given in a canonical representation X,(Qi,1,ui)i=1t. We first focus on appending long palindromes of length at least 2|Q1|, and then we show that the shorter palindromes can be handled recursively. Note that, for a canonical representation, T has a prefix XQ1u1+5. At the same time, the longest prefix in the affine set is of length less than XQ1u1+1 by Corollary 3.15. This leads us to a case distinction based on the center of the palindrome to be appended. If the center is before position |XQ1u1+3|, then we can show that the entire palindrome is within the |Q1|-periodic prefix of T[|X|+1..n]. Otherwise, the left half of the palindrome contains position |XQ1u1+2|, and we can use this position as an anchor point for the extension.

4.1.1 Appending a long palindrome within a run of 𝑸𝟏

We now focus on the case where the long palindrome to be appended is entirely within the |Q1|-periodic prefix of T[|X|+1..n]. We proceed in two steps. First (in Theorem 4.2), we show how to append a palindrome under the assumption that the entire string has the form XQ1x for some integer x. Secondly (Corollary 4.3), we truncate the result of the first step so that it corresponds to XQ1α, where α is the largest value such that XQ1α is a prefix of T.

Theorem 4.2.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set 𝒜. Let s=i=2t(ui+1)|Qi|, and for j[1,t] let Q^j be the length-|Qj| suffix of 𝗋𝗈𝗍s(Q1). If 𝗋𝗈𝗍r(Q1)=rev(Q1) for some r[s,s+|Q1|), then

XQ1Q1[1..rs],(𝗋𝗈𝗍rs(Q1),1,x)(rev(Q^i),1,ui)i=2t (1)

represents an affine prefix set 𝒜 of XQ1x+3, for any positive integer x. Furthermore:

  1. 1.

    If Y𝒜, then there is a string Y𝒜 and a palindrome P such that Y=YP.

  2. 2.

    For Y𝒜 and PPAL, if |P|2|Q1| and YP is a prefix of XQ1x+1, then YP𝒜.

Proof Sketch.

The keystone of the proof is Corollary 3.19 which implies that a string Q=rev(Q^2)a2rev(Q^3)a3rev(Q^t)at, where j[2,t]:aj[1,uj], is a prefix of

rev(𝗋𝗈𝗍s(Q1))=𝗋𝗈𝗍s(rev(Q1))=𝗋𝗈𝗍s(𝗋𝗈𝗍r(Q1))=𝗋𝗈𝗍rs(Q1).

Using this fact, we first establish that a string XS generated by the canonical representation in Equation 1 is a prefix of XQ1x+3. Next, we show that S can be decomposed as SP, where XS𝒜 and P is a palindrome. It follows that P is a substring of a power of Q1, and the condition 𝗋𝗈𝗍r(Q1)=rev(Q1) ensures P is a palindrome. Finally, we conclude by considering any string S𝒜 and a sufficiently long palindrome P such that SP is a prefix of Q1x+1. Due to XS𝒜, there is some sequence j[1,t]:aj[1,uj] of exponents such that S=Q1u1a1+1Q2u2a2+1Qtutat+1. From this and the fact that P is a palindrome, we show that XSP fits the structure required for membership in 𝒜, completing the proof.

By combining Theorem 4.2 and Lemma 4.1, we obtain:

Corollary 4.3.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set 𝒜. Let α be the largest possibly fractional exponent such that XQ1α is a prefix of T, and define 𝒮={SP:SP is a prefix of XQ1α,S𝒜,PPAL,|P|2|Q1|}. There are tt affine prefix sets i, i[1,t], each of order t, such that for =i=1ti we have 𝒮 and for every Y, there is a string Y𝒜 and a palindrome P such that Y=YP.

4.1.2 Appending a long palindrome outside a run of 𝑸𝟏

Theorem 4.4.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set 𝒜 and s=i=2t(ui+1)|Qi|. For j[1,t], let Q^j be the length-|Qj| suffix of 𝗋𝗈𝗍s(Q1). For any string P, XQ1u1+2Prev(Q1)[1..|Q1|s],(rev(Q^i),1,ui)i=1t represents an affine prefix set 𝒜 of the string XQ1u1+2Prev(Q1u1+2), where 𝒜={SWPrev(W)S𝒜 and SW=XQ1u1+2}.

Proof Sketch.

Let q=|Q1|. We can split the output representation into a concatenation

XQ1u1+2Prev(Q1)[1..qs],(rev(Q^1),1,u1)ε,(rev(Q^i),1,ui)i=2t. (2)

We first apply Corollary 3.19 to deduce that Equation 2 represents an affine prefix set of the string XQ1u1+2Prev(Q1u1+2). Secondly, we show that every element in 𝒜 contributes exactly one element to 𝒜, and hence |𝒜|=|𝒜|. It thus suffices to show that any string generated by Equation 2 is in 𝒜. It then readily follows that Equation 2 generates exactly 𝒜. To do so, we consider any string S generated by Equation 2. Such a string must be of the form S=XQ1u1+2Prev(W), where rev(W)=rev(Q1)[1..qs]rev(Q^1)a1rev(Q^2)a2rev(Q^t)at for some exponents i[1,t]:ai[1,ui]. By our previous observations, rev(W) is a prefix of rev(Q1)u1+2, and thus there is a unique string S such that SW=XQ1u1+2 and S=SWPrev(W). It remains to be shown that S𝒜, which then implies S𝒜. For this purpose, we carefully analyze the length of S and show that a prefix of length |S| indeed belongs to 𝒜, concluding the proof.

For a fragment P=T[x..y] of T, denote its center (x+y)/2 by cen(P).

Corollary 4.5.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set 𝒜, and consider the set of strings 𝒜={SP:SP is a prefix of T,S𝒜,PPAL,cen(P)>|XQ1u1+3|}. There are t=𝒪(tlogn) affine prefix sets i, i[1,t], each of order t+1, such that both of the following properties hold for =i=1ti:

  1. 1.

    𝒜.

  2. 2.

    For every Y, there is a string Y𝒜 and a palindrome P such that Y=YP.

Proof Sketch.

Consider any SP𝒜, where SP is a prefix of T, S𝒜, PPAL, cen(P)>|XQ1u1+3|. Due to S𝒜, Corollary 3.15 implies |S|<|XQ1u1+1|. Let P=T[x..y], where x=1+|XQ1u1+2| and y=2cen(P)x. We claim that PPAL. Indeed, the starting position |S|+1 of P is less than the starting position x of P, and the centers of P and P coincide with cen(P)x=ycen(P). We call P the core palindrome of SP. Note that every core palindrome is a prefix of T[x..n] (which is independent of SP). Therefore, by Corollary 3.14, the set of core palindromes can be represented as the union of 𝒪(logn) affine prefix sets. Let 𝒞 be any of these sets. We now describe how to compute the part of 𝒜 that contains strings of the form SP=SWPrev(W), where S𝒜, PPAL, and the core palindrome of SP is some P𝒞. The procedure depends on the representation of 𝒞, which, by Corollary 3.14, is covered by one of the following cases. Let q=|Q1|.

Case 1:

𝒞 is given in strongly affine representation U(VU),(VU,1,u), where VU is primitive and |VU|>q. In this case, we consider one fixed core palindrome in 𝒞 and apply Theorem 4.4 and Lemma 4.1 to obtain an affine prefix set generated by it. We then show that the sets generated by other core palindromes have a similar representation, which allows to union them and to obtain the final affine prefix set.

Case 2:

𝒞 is given in representation P,ε of order 0, i.e., it contains a single core palindrome P. We proceed exactly like in Case 1, but with a single palindrome.

Case 3:

𝒞 has strongly affine representation U(VU),(VU,1,u), where VU is primitive and |VU|=q. For i[1,u], let Pi=U(VU)+i. We show that, if 𝒜 contains some SP=SWPirev(W)=XQ1u1+2Pirev(W) with S𝒜, then the entire SP can be written as XQ1α for some α. Hence we can simply apply Corollary 4.3 and obtain that the affine prefix set generated by 𝒞 is the union of at most t affine prefix sets of order at most t.

Case 4:

𝒞 has strongly affine representation U(VU),(VU,1,u), where VU is primitive and |VU|<q. We show that this case is impossible due to primitivity of Q1.

We call the created affine prefix sets i. There are 𝒪(logn) core palindrome sets, each handled by a single case. Each case creates t representations of order t+1. Hence, there are 𝒪(tlogn) affine prefix sets i in total, each of order t+1 Furthermore, the four cases cover all possibilities, and hence 𝒜=i=1ti. The second property holds by construction of the sets i.

4.1.3 Appending all long palindromes and recursion

Lemma 4.6.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set 𝒜 and 𝒜={SPS𝒜,PPAL,|P|2|Q1|, and SP is a prefix of T}. There are t=𝒪(tlogn) affine prefix sets i, 1it, each of order t+1, such that 𝒜i=1ti and for each string Si=1ti, there is a string S𝒜 and PPAL such that S=SP.

Proof.

We consider the sets from Corollaries 4.3 and 4.5, defined by

𝒜1={SP:SP is a prefix of XQ1α,S𝒜,PPAL,|P|2|Q1|} and
𝒜2={SP:SP is a prefix of T,S𝒜,PPAL,cen(P)>|X|+(u1+3)|Q1|},

where α is the largest (possibly fractional) exponent such that XQ1α is a prefix of T. Due to Corollaries 4.3 and 4.5, we can express (a superset of) 𝒜1𝒜2 as the union of 𝒪(tlogn) affine prefix sets, each of order t+1, where every string in each of the prefix sets is the concatenation of a string from 𝒜 and a palindrome. It remains to be shown that 𝒜𝒜1𝒜2. For the sake of contradiction, assume that there is some string SP𝒜(𝒜1𝒜2), where S𝒜, PPAL and |P|2|Q1|. Due to SP𝒜1, SP is not a prefix of XQ1α and hence it must be longer than XQ1α. Let m=|XQ1α||S|. We show a lower bound on m. Since the given representation is strongly affine, it holds αu1+5. It is also irreducible, and hence Corollary 3.15 implies |S|<|XQ1u1+1|. Therefore, it holds m>4|Q1|. Note that P does not have period |Q1|, but its length-m prefix, which is a suffix of Q1α, does. Hence, by Lemma 2.3, it follows that P is of length over 2m|Q1|, and therefore

cen(P)|S|+|P|/2>|S|+m|Q1|/2=|XQ1α||Q1|/2>|XQ1u1+4|.

This implies SP𝒜2, which contradicts the initial assumption.

We have shown that appending palindromes of length at least 2|Q1| results in 𝒪(tlogn) affine prefix sets of order t+1. For appending shorter palindromes, we exploit properties of strongly affine prefix sets that allow us to apply the previously described approach recursively.

Lemma 4.7.

Let X,(Qi,1,ui)i=1t be a canonical representation of an affine prefix set 𝒜 and 𝒜={SP:SP is a prefix of T,S𝒜,PPAL} a set of strings. Then 𝒜 is a union of 𝒪((t+1)2logn) affine prefix sets, each of order t+1.

Theorem 1.1. [Restated, see original statement.]

Let 0<ϵ<1 be constant, T[1..n] a string, and k+. The set of prefixes of T that belong to PALk is the union of 𝒪(6k2/(2ϵ)logkn) affine prefix sets of order k.

Proof.

We start with the empty affine prefix set representing PAL0. We proceed in k levels k[0,k). The union of the affine prefix sets of level k is exactly the set of all k-palindromic prefixes of T. For each affine prefix set of the current level k, we first apply Lemmas 3.9 and 3.13 to obtain at most 6k canonical representations of order k. Then, for each of the representations, we append a palindrome using Lemma 4.7, resulting in at most c(k+1)2logn affine prefix sets of order at most k+1, which we move to level k+1. Here, c is a positive constant that depends on the precise complexity analysis of Lemma 4.7. Hence, after processing level k1, the total number of affine prefix sets is bounded by k=0k1(6kc(k+1)2logn)(k!)2ck6(k2/2)logkn. For all sufficiently large k (depending only on ϵ and c), the bound simplifies to 6k2/(2ϵ)logkn. (And for the remaining values of k, we have (k!)2ck6(k2/2)=𝒪(1).)

 Remark 4.8.

Lemmas 3.9 and 3.13 only work with the lengths of the components in the representations of affine prefix sets and the exponents bounds. Since all affine prefix sets are of small order, it is not difficult to see that these lemmas can be implemented efficiently. To implement Lemma 4.7, we make use of two procedures: The first one computes the longest prefix of a string of form XQα, where X,(Qi,1,ui)i=1t is a representation of one of the sets, and the second computes a representation of the set of prefix-palindromes of a string. In the read-only model, both procedures can be implemented in 𝒪(n) time and 𝒪(logn) space. Bounding the number of calls by the number of the generated affine prefix sets, we finally obtain Theorem 1.3. The algorithm of Theorem 1.3 can then be used to test if the palindromic length of T is at most k by checking whether T is a k-palindromic prefix, however, to achieve even better complexity, we run two copies of the algorithm, one from the left and the other from the right, and then combine their results to obtain Theorem 1.4.

References

  • [1] Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. If the current clique algorithms are optimal, so is Valiant’s parser. SIAM J. Comput., 47(6):2527–2555, 2018. doi:10.1137/16M1061771.
  • [2] Rajeev Alur and P. Madhusudan. Visibly pushdown languages. In STOC, pages 202–211, 2004. doi:10.1145/1007352.1007390.
  • [3] Amihood Amir and Benny Porat. Approximate on-line palindrome recognition, and applications. In CPM, pages 21–29, 2014. doi:10.1007/978-3-319-07566-2_3.
  • [4] Ajesh Babu, Nutan Limaye, Jaikumar Radhakrishnan, and Girish Varma. Streaming algorithms for language recognition problems. Theor. Comput. Sci., 494:13–23, 2013. doi:10.1016/J.TCS.2012.12.028.
  • [5] Gabriel Bathie, Jonas Ellert, and Tatiana Starikovskaya. Small space encoding and recognition of k-palindromic prefixes. CoRR, abs/2410.03309, 2024. doi:10.48550/arXiv.2410.03309.
  • [6] Gabriel Bathie, Tomasz Kociumaka, and Tatiana Starikovskaya. Small-space algorithms for the online language distance problem for palindromes and squares. In ISAAC, pages 10:1–10:17, 2023. doi:10.4230/LIPICS.ISAAC.2023.10.
  • [7] Gabriel Bathie and Tatiana Starikovskaya. Property testing of regular languages with applications to streaming property testing of visibly pushdown languages. In ICALP, pages 119:1–119:17, 2021. doi:10.4230/LIPICS.ICALP.2021.119.
  • [8] Petra Berenbrink, Funda Ergün, Frederik Mallmann-Trenn, and Erfan Sadeqi Azer. Palindrome recognition in the streaming model. In STACS, pages 149–161, 2014. doi:10.4230/LIPICS.STACS.2014.149.
  • [9] Allan Borodin and Stephen A. Cook. A time-space tradeoff for sorting on a general sequential model of computation. In STOC, pages 294–301, 1980. doi:10.1145/800141.804677.
  • [10] Kirill Borozdin, Dmitry Kosolobov, Mikhail Rubinchik, and Arseny M. Shur. Palindromic length in linear time. In CPM, pages 23:1–23:12, 2017. doi:10.4230/LIPIcs.CPM.2017.23.
  • [11] Bartlomiej Dudek, Pawel Gawrychowski, Garance Gourdel, and Tatiana Starikovskaya. Streaming regular expression membership and pattern matching. In SODA, pages 670–694, 2022. doi:10.1137/1.9781611977073.30.
  • [12] Gabriele Fici, Travis Gagie, Juha Kärkkäinen, and Dominik Kempa. A subquadratic algorithm for minimum palindromic factorization. J. Discrete Algorithms, 28:41–48, 2014. doi:10.1016/J.JDA.2014.08.001.
  • [13] Nathan Fine and Herbert Wilf. Uniqueness theorems for periodic functions. Proceedings of the American Mathematical Society, 16(1):109–114, 1965. doi:10.2307/2034009.
  • [14] Nathanaël François, Frédéric Magniez, Michel de Rougemont, and Olivier Serre. Streaming property testing of visibly pushdown languages. In ESA, pages 43:1–43:17, 2016. doi:10.4230/LIPICS.ESA.2016.43.
  • [15] Michael L. Fredman and Dan E. Willard. BLASTING through the information theoretic barrier with FUSION TREES. In STOC, pages 1–7, 1990. doi:10.1145/100216.100217.
  • [16] Zvi Galil. On converting on-line algorithms into real-time and on real-time algorithms for string-matching and palindrome recognition. SIGACT News, 7(4):26–30, 1975. doi:10.1145/990502.990505.
  • [17] Zvi Galil and Joel I. Seiferas. A linear-time on-line recognition algorithm for "palstar". J. ACM, 25(1):102–111, 1978. doi:10.1145/322047.322056.
  • [18] Moses Ganardi. Visibly pushdown languages over sliding windows. In STACS, pages 29:1–29:17, 2019. doi:10.4230/LIPICS.STACS.2019.29.
  • [19] Moses Ganardi, Danny Hucke, Daniel König, Markus Lohrey, and Konstantinos Mamouras. Automata theory on sliding windows. In STACS, pages 31:1–31:14, 2018. doi:10.4230/LIPICS.STACS.2018.31.
  • [20] Moses Ganardi, Danny Hucke, and Markus Lohrey. Querying regular languages over sliding windows. In FSTTCS, pages 18:1–18:14, 2016. doi:10.4230/LIPICS.FSTTCS.2016.18.
  • [21] Moses Ganardi, Danny Hucke, and Markus Lohrey. Randomized sliding window algorithms for regular languages. In ICALP, pages 127:1–127:13, 2018. doi:10.4230/LIPICS.ICALP.2018.127.
  • [22] Moses Ganardi, Danny Hucke, Markus Lohrey, and Tatiana Starikovskaya. Sliding window property testing for regular languages. In ISAAC, pages 6:1–6:13, 2019. doi:10.4230/LIPICS.ISAAC.2019.6.
  • [23] Moses Ganardi, Artur Jez, and Markus Lohrey. Sliding windows over context-free languages. In MFCS, pages 15:1–15:15, 2018. doi:10.4230/LIPICS.MFCS.2018.15.
  • [24] Pawel Gawrychowski, Oleg Merkurev, Arseny M. Shur, and Przemyslaw Uznanski. Tight tradeoffs for real-time approximation of longest palindromes in streams. Algorithmica, 81(9):3630–3654, 2019. doi:10.1007/S00453-019-00591-8.
  • [25] Tomohiro I, Shiho Sugimoto, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Computing palindromic factorizations and palindromic covers on-line. In CPM, pages 150–161, 2014. doi:10.1007/978-3-319-07566-2_16.
  • [26] Rahul Jain and Ashwin Nayak. The space complexity of recognizing well-parenthesized expressions in the streaming model: The index function revisited. IEEE Trans. Inf. Theory, 60(10):6646–6668, 2014. doi:10.1109/TIT.2014.2339859.
  • [27] Donald E. Knuth, James H. Morris Jr., and Vaughan R. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6(2):323–350, 1977. doi:10.1137/0206024.
  • [28] Tomasz Kociumaka, Tatiana Starikovskaya, and Hjalte Wedel Vildhøj. Sublinear space algorithms for the longest common substring problem. In ESA, pages 605–617, 2014. doi:10.1007/978-3-662-44777-2_50.
  • [29] Dmitry Kosolobov, Mikhail Rubinchik, and Arseny M. Shur. Palk is linear recognizable online. In SOFSEM, pages 289–301, 2015. doi:10.1007/978-3-662-46078-8_24.
  • [30] Andreas Krebs, Nutan Limaye, and Srikanth Srinivasan. Streaming algorithms for recognizing nearly well-parenthesized expressions. In MFCS, pages 412–423, 2011. doi:10.1007/978-3-642-22993-0_38.
  • [31] Frédéric Magniez, Claire Mathieu, and Ashwin Nayak. Recognizing well-parenthesized expressions in the streaming model. SIAM J. Comput., 43(6):1880–1905, 2014. doi:10.1137/130926122.
  • [32] Glenn K. Manacher. A new linear-time “on-line” algorithm for finding the smallest initial palindrome of a string. J. ACM, 22(3):346–351, 1975. doi:10.1145/321892.321896.
  • [33] Mikhail Rubinchik and Arseny M. Shur. EERTREE: an efficient data structure for processing palindromes in strings. Eur. J. Comb., 68:249–265, 2018. doi:10.1016/J.EJC.2017.07.021.
  • [34] Mikhail Rubinchik and Arseny M. Shur. Palindromic k-factorization in pure linear time. In MFCS, pages 81:1–81:14, 2020. doi:10.4230/LIPICS.MFCS.2020.81.
  • [35] Anatol O. Slisenko. A simplified proof of the real-time recognizability of palindromes on Turing machines. J. Sov. Math., 15:68–77, 1981. doi:10.1007/BF01404109.