On The Space Complexity of Partial Derivatives of Regular Expressions with Shuffle
Davide Ancona, Angelo Ferrando · 2025
Read On The Space Complexity of Partial Derivatives of Regular Expressions with Shuffle by Davide Ancona, Angelo Ferrando (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-17451.txt.
Introduction
Davide Ancona and Angelo Ferrando bound how big a part step of a pat form can grow when pats may mix in any rank, in a paper from 2025. Part steps build match rigs one state at a time, a rite used to watch live event streams. With the mix mark in, state counts can blow past use, so hands store one step at a time.
The count of all steps stays in line with the first form size, a known law. New here: the tall mark of one step grows by one at most, and its bulk grows as the square of the first size. Both laws hold with the mix mark on, a mild shock the team notes.
Catalog record
| CREATOR | Davide Ancona, Angelo Ferrando |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 99 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-17451
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
On The Space Complexity of Partial Derivatives of Regular Expressions with Shuffle Davide Ancona, Angelo Ferrando Abstract Partial derivatives of regular expressions, introduced by Antimirov, define an elegant algorithm for generating equivalent non-deterministic finite automata (NFA) with a limited number of states. Here we focus on runtime verification (RV) of simple properties expressible with regular expressions. In this case, words are finite traces of monitorable events forming the language’s alphabet, and the generated NFA may have an intractable number of states. This typically occurs when sub-traces of mutually independent events are allowed to interleave. To address this issue, regular expressions used for RV are extended with the shuffle operator to make specifications more compact and easier to read. Exploiting partial derivatives enables a rewriting-based approach to RV, where only one derivative is stored at each step, avoiding the construction of an intractably large automaton. This raises the question of the space complexity of the largest generated partial derivative. While the total number of generated partial derivatives is known to be linear in the size of the initial regular expression, no results can be found in the literature regarding the size of the largest partial derivative. We study this problem w. r. t. two metrics (height and size of regular expressions), and show that the former increases by at most one, while the latter is quadratic in the size of the regular expression. Surprisingly, these results also hold with shuffle. [orcid=0000-0002-6297-2011,[email protected]] *1 [orcid=0000-0002-8711-4670, [email protected] ] keywords partial derivatives ,regular expressions with shuffle ,rewriting-based runtime verification ,space complexity † † venue: Extended versions of the ICTCS 2025 paper with full proves † † address: University of Genova, Italy † † address: University of Modena and Reggio Emilia, Italy † † corresp: Corresponding author. 1 Introduction Derivatives of regular expressions were introduced by Brzozowski Brzozowski 1964 ; Owens et al. 2009 to provide a very compact operational semantics for them, and to derive an algorithm for generating equivalent deterministic finite automata (DFA). A first contribution of our work is to show that derivatives can be defined by means of a labeled transition system between regular expressions, where labels are the alphabet symbols. Given a fixed symbol, at each step there is always a unique transition, therefore the system defines a deterministic automaton where the initial state is an initial regular expression \mathit{e} , and all other states are regular expressions that are derivatives obtained from \mathit{e} . Such an automaton is provably equivalent to \mathit{e} , if the set of its final states is defined as the set of all the corresponding regular expressions which recognize the empty word. The main issue with this approach is that the number of syntactically different derivatives of \mathit{e} is generally unbounded, hence, to obtain an equivalent DFA, a finite quotient algebra of states modulo a suitable congruence has to be considered. Inspired by Brzozowski’s work, Antimirov Antimirov 1996 defined partial derivatives of regular expressions to define an algorithm that generates, from regular expressions, equivalent non-deterministic finite automata (NFA) with a limited number of states. The main breakthrough at the root of Antimirov’s work is that the number of syntactically distinct partial derivatives of \mathit{e} is provably linear in the size of \mathit{e} . Therefore, a construction analogous to that proposed by Brzozowski can be used with syntactic equality without considering any weaker notion of congruence. However, the corresponding automaton is, in general non-deterministic, because of the transition system defining partial derivatives: given a fixed symbol, at each step there can be zero or more transitions. While Antimirov’s work addresses the classical problem of word recognition in regular languages, here we focus on runtime verification (RV) Leucker and Schallhart 2009 of simple properties expressible with regular expressions. RV is a technique used to check the trace of events generated during a single execution of the System Under Scrutiny (SUS). This is done with monitors automatically generated from specifications that describe the correct behavior of the SUS (suitably instrumented to produce the trace to be analyzed). RV is complementary to both formal verification and testing: like formal methods, it is based on specification languages, although it is not exhaustive; like testing, it is scalable and suitable for real-world systems and complex properties. Differently from testing, RV can detect errors even in non-deterministic systems Havelund and Roşu 2004 ; Sharma et al. 2009 ; Ancona et al. 2017 ; Schiavio et al. 2019 , and therefore represents a valuable complement to testing approaches Besnard et al. 2023 . When properties to be verified can be defined with regular expressions, words are finite traces of monitorable events, which define the alphabet of the language, and the monitor is the finite automaton generated from the regular expression defining the correct traces. However, this approach may be unfeasible because of the intractable number of states of the generated automaton, even for NFAs. This typically happens when the properties to be verified consist of sub-traces of mutually independent events, which are allowed to interleave during the execution of the SUS. Consider, for instance, the challenge of verifying that files are properly opened and closed, in a system able to handle multiple files independently. In such cases, extending regular expressions with the shuffle operator Ancona et al. 2021 can significantly reduce the size of specifications and enhance clarity. Moreover, by using partial derivatives, it becomes possible to avoid generating automata with an intractable number of states, and adopt, instead, a rewriting-based approach Rosu and Havelund 2005 ; Ancona et al. 2021 to RV, where only a single partial derivative needs to be considered at each reduction step. This raises the question of the space complexity of the largest partial derivative that can be generated from an initial regular expression. Indeed, while the total number of generated partial derivatives is known to be linear in the size of the initial regular expression, no results can be found in the literature regarding the size of the largest partial derivative. In this paper, we investigate this problem with respect to two different metrics for regular expressions: their height and their total number of nodes when viewed as trees. In particular, we show that the height of the largest partial derivative can increase by at most one, while the number of nodes in the largest partial derivative is bounded by n^{2} , where n is the number of nodes of the initial regular expression. Surprisingly, these results still hold when regular expressions are extended with shuffle. To this aim, we propose a proof methodology based on the definition of a function that, given a regular expression, returns an upper bound of the increment w.r.t. a specific metric for all its partial derivatives. In this way, an invariant can be established on single rewriting steps and directly extended to multiple steps, to derive the expected space complexity results. This proof methodology allows us to keep the same proof structure for all main results, and reuse parts of the proofs. The paper is structured as follows: Section 2 introduces the basic notion of derivatives of regular expressions. Section 3 defines partial derivatives and proves the space complexity results w. r. t. the height and the size of expressions. Section 4