Department of Software Science, Tallinn University of Technology, [email protected]://orcid.org/0000-0002-1967-4297
School of Computer Science, Reykjavik University, Iceland and Department of Software Science, Tallinn University of [email protected]://orcid.org/0000-0002-1297-0579
\CopyrightHendrik Maarand and Tarmo Uustalu\ccsdescTheory of computation Regular languages
\ccsdescTheory of computation Concurrency
This is an extended version of the conference paper [14].
\supplement\fundingHendrik Maarand: supported by the ERDF funded Estonian national CoE project EXCITE (2014-2020.4.01.15-0018). Both authors: supported by the Estonian Ministry of Education and Research institutional grant no. IUT33-13.
Acknowledgements.
We thank Pierre-Louis Curien, Jacques Sakarovitch, Simon Doherty, Georg Struth and Ralf Hinze for inspiring discussions, and our anonymous reviewers for the exceptionally thorough and constructive feedback they gave us.\hideLIPIcs\EventEditorsWan Fokkink and Rob van Glabbeek
\EventNoEds2
\EventLongTitle30th International Conference on Concurrency Theory (CONCUR 2019)
\EventShortTitleCONCUR 2019
\EventAcronymCONCUR
\EventYear2019
\EventDateAugust 27–30, 2019
\EventLocationAmsterdam, the Netherlands
\EventLogo
\SeriesVolume140
\ArticleNo36
Reordering Derivatives of Trace Closures of Regular Languages (Full Version)
Hendrik Maarand
Tarmo Uustalu
Abstract
We provide syntactic derivative-like operations, defined by
recursion on regular expressions, in the styles of both Brzozowski
and Antimirov, for trace closures of regular languages. Just as the
Brzozowski and Antimirov derivative operations for regular
languages, these syntactic reordering derivative operations yield
deterministic and nondeterministic automata respectively. But trace
closures of regular languages are in general not regular, hence
these automata cannot generally be finite. Still, as we show, for
star-connected expressions, the Antimirov and Brzozowski automata,
suitably quotiented, are finite. We also define a refined version of
the Antimirov reordering derivative operation where
parts-of-derivatives (states of the automaton) are nonempty lists of
regular expressions rather than single regular expressions. We
define the uniform scattering rank of a language and show that, for
a regexp whose language has finite uniform scattering rank, the
truncation of the (generally infinite) refined Antimirov automaton,
obtained by removing long states, is finite without any quotienting,
but still accepts the trace closure. We also show that
star-connected languages have finite uniform scattering rank.
keywords:
Mazurkiewicz traces, trace closure, regular languages, finite automata,
language derivatives, scattering rank, star-connected expressions
category:
\relatedversion
1 Introduction
Traces were introduced to concurrency theory by Mazurkiewicz
[15, 16] as an alternative to words. A
word can be seen as a linear order that is labelled with letters of
the alphabet. Intuitively, the main idea of traces is that the linear
order, corresponding to sequentiality, is replaced with a partial
order. Sets of words (or word languages) can be used to describe the
behaviour of concurrent systems. Similarly, sets of traces (or trace
languages) can also be used for this purpose. The difference is that
descriptions in terms of traces do not distinguish between different
linear extensions (words) of the same partial order (trace)—they are
considered equivalent. Different linear extensions of the same partial
order can be seen as different observations of the same behaviour.
Given a word language L and a letter a, the derivative of L
along a is the language consisting of all the words v such that
av belongs to L. An essential difference between words and traces
is that a nonempty word (a linear order) has its first letter as the
unique minimal element, but a nonempty trace (a partial order) may
have several minimal elements. A trace from a trace language can be
derived along any of its minimal letters. Clearly, a minimal letter of
a trace need not be the first letter of a word representing this
trace.
It is well-known that the derivative of a regular word language along
a letter is again regular. Brzozowski [7] showed that
a regexp for it can be computed from a regexp for the given language,
and Antimirov [3] then further optimized this result.
We show that these syntactic derivative operations generalize to trace
closures (i.e., closures under equivalence) of regular word languages
in the form of syntactic reordering derivative operations.
The syntactic derivative operations for regular word languages provide
ways to construct automata from a regexp. The Brzozowski derivative
operation is a function on regexps while the Antimirov derivative
operation is a relation. Accordingly, they yield deterministic and
nondeterministic automata. The set of Brzozowski derivatives of a
regexp (modulo appropriate equations) and the set of Antimirov
parts-of-derivatives are finite, hence so are the resulting
automata. Our generalizations to trace closures of regular languages
similarly give deterministic and nondeterministic automata, but these
cannot be finite in general. Still, as we show, for a star-connected
expression, the Antimirov and Brzozowski automata, suitably
quotiented, are finite. We also develop a finer version of the
Antimirov reordering derivative, where parts-of-derivatives are
nonempty lists of regexps rather than single regexps, and we show that
the set of expressions that can appear in these lists for a given
initial regexp is finite. We introduce a new notion of uniform
scattering rank of a language (a variant of Hashiguchi’s scattering
rank [9]) and show that, for a regexp whose language
has finite uniform rank, a truncation of the refined reordering
Antimirov automaton accepts its trace closure despite the removed
states, and is finite, without any quotienting.
This is an extension of the conference paper [14] with
proofs of the most important propositions and background material on
classical language derivatives and trace closures of regular
languages.
2 Preliminaries on Word Languages
An alphabet Σ is a finite set (of letters). A
word over Σ is a finite sequence of letters. The set
Σ∗ of all words over Σ is the free monoid on Σ
with the empty word ε as the unit and concatenation of words
(denoted by ⋅ that can be omitted) as the multiplication. By
πX(u) we mean the projection of a word u to a subalphabet
X⊆Σ, i.e., πX(u) discards from u all letters
which are not in X. We write ∣u∣ for the length of a word u
and also ∣X∣ for the size of a subalphabet X. By ∣u∣a we
mean ∣πa(u)∣, i.e., the number of occurrences of a in u.
By Σ(u) we denote the set of letters that appear in u.
A (word) language is a subset of Σ∗. The empty word and
concatenation of words lift to word languages via
1=df{ε} and
L⋅L′=df{uv∣u∈L∧v∈L′}.
2.1 Regular Languages
The set RE of regular expressions (in short, regexps)
over Σ is given by the grammar
E,F::=a∣0∣E+F∣1∣EF∣E∗ where a
ranges over Σ.
The word-language semantics of regular expressions is given by
a function [[_]]:RE→PΣ∗ defined recursively by
[TABLE]
A word language L is said to be regular (or rational)
if L=[[E]] for some regexp E.
Kleene algebras are defined by an equational theory.
It was shown by Kozen [13] that the set
{[[E]]∣E∈RE} of all regular languages together with
the language operations ∅, ∪, 1, ⋅,
(_)∗ is the free Kleene algebra on Σ. An important
property for us is that E≐F iff [[E]]=[[F]] where
≐ refers to valid equations in the Kleene algebra theory.
Kleene’s theorem [11] says that a word language is rational
iff it is recognizable, i.e., accepted by a finite
deterministic automaton (acceptance by a finite nondeterministic
automaton is an equivalent condition because of
determinizability [20]).
2.2 Derivatives of a Language
A word language L is said to be nullable L↓, if
ε∈L. The derivative (or left
quotient)111We use the word ‘derivative’ both for languages
and expressions, reserving the word ‘quotient’ for quotients of sets
by equivalence relations. of L along a word u is defined by
DuL=df{v∣uv∈L}.
For any L, we have DεL=L as well as
DuvL=Dv(DuL) for any u,v∈Σ∗, i.e., the
operation D:PΣ∗×Σ∗→PΣ∗ is a right
action of Σ∗ on PΣ∗.
We also have
L={ε∣L↓}∪⋃{{a}⋅DaL∣a∈Σ},
and for any u∈Σ∗, we have u∈L iff (DuL)↓.
Derivatives of regular languages are regular. A remarkable fact is
that they can be computed syntactically, on the level of regular
expressions. There are two constructions for this, due to Brzozowski
[7] and Antimirov [3]. We review
these in the next two subsections.
The Brzozowski and Antimirov derivative operations yield deterministic
resp. nondeterministic automata accepting the language of a regular
expression E. The Antimirov automaton is finite. The Brzozowski
automaton becomes finite when quotiented by associativity,
commutativity and idempotence for +. Identified up to the Kleene
algebra theory, the states of the Brzozowski automaton correspond to
the derivatives of the language [[E]]. Regular languages can be
characterized as languages with finitely many derivatives.
2.3 Brzozowski Derivative
Nullability and derivative are semantic notions, defined about
languages. However, Brzozowski [7] noticed that for
regular languages, one can compute nullability and the derivatives
syntactically, on the level of regular expressions.
Definition 2.1**.**
The syntactic nullability and the
Brzozowski derivative of a regexp are given by functions
↓:RE→B, D:RE×Σ→RE and
D:RE×Σ∗→RE defined recursively by
[TABLE]
Proposition 2.2**.**
For any E,
-
[[E]]↓=E↓;
2. 2.
for any a∈Σ, Da[[E]]=[[DaE]];
3. 3.
for any u∈Σ∗, Du[[E]]=[[DuE]].
Corollary 2.3**.**
For any E,
-
[[E]]={ε∣E↓}∪⋃{{a}⋅[[DaE]]∣a∈Σ};
2. 2.
for any a∈Σ, v∈Σ∗, av∈[[E]] iff v∈[[DaE]];
3. 3.
for any u,v∈Σ∗, uv∈[[E]] iff v∈[[DuE]];
4. 4.
for any u∈Σ∗, u∈[[E]] iff (DuE)↓.
The Brzozowski derivative operation gives a method for turning a
regular expression into a deterministic automaton. For a regexp E,
the set of states is QE={DuE∣u∈Σ∗}, the
initial state is q0E=E, the final states are
FE={E′∈QE∣E′↓} and the transition function
δE is defined by D restricted to QE.
This automaton is generally not finite, but its quotient by a suitable
syntactically defined equivalence relation on the state set is finite,
as we will see in the next subsection.
2.4 Antimirov Derivative
Antimirov [3] optimized Brzozowski’s construction
essentially constructing a nondeterministic finite automaton (NFA)
instead of a DFA, with a smaller number of states and, crucially,
without having to identify states up to equations.
Antimirov’s syntactic derivative operation is a multivalued function,
in other words, a relation. Antimirov spoke of “partial derivatives”
or “linear factors”, we prefer to use the term
“parts-of-derivatives”.
Definition 2.4**.**
The Antimirov parts-of-derivatives of a regular
expression along a letter or a word are given the relations
→⊆RE×Σ×RE and
→∗⊆RE×Σ∗×RE defined
inductively by
[TABLE]
The Antimirov parts-of-derivatives compute the semantic derivative
collectively.222If we took languages to be multisets of words
(i.e., introduced the notion of a word occurring in a language some
number of times ) and adopted the obvious multisets-of-words semantics of
regular expressions, the Antimirov parts-of-derivatives would
compute regular expressions for a partition of the semantic
derivative. In the sets-of-words semantics, however, overlaps are possible, so
we do not get a partition.
Proposition 2.5**.**
For any E,
-
for any a∈Σ, Da[[E]]=⋃{[[E′]]∣E→(a,E′)};
2. 2.
for any u∈Σ∗,
Du[[E]]=⋃{[[E′]]∣E→∗(u,E′)}.
Corollary 2.6**.**
For any E,
-
av∈[[E]]={u∣∃E′.E→(a,E′)∧v∈[[E′]]}.
2. 2.
uv∈[[E]]={u∣∃E′.E→∗(u,E′)∧v∈[[E′]]}.
3. 3.
u∈[[E]]={u∣∃E′.E→∗(u,E′)∧E′↓}.
The parts-of-derivatives of a regexp E induce a nondeterministic
automaton. The state set is
QE=df{E′∣∃u∈Σ∗.E→∗(u,E′)}.
The set of initial states is IE=df{E}. The set of final
states is FE=df{E′∈QE∣E′↓}. Finally, the
transition relation is defined by
E′→E(a,E′′)=dfE′→(a,E′′) for E′,E′′∈QE.
The state set QE is shown finite by proving it to be a subset of
another set that is straightforwardly seen to be finite.
Definition 2.7**.**
For any E, we define a set E→∗ of regexps
recursively by
[TABLE]
Proposition 2.8**.**
For any E,
-
E→∗* is finite, in fact, of cardinality linear in the
size of E;*
2. 2.
QE⊆E→∗.
Proof 2.9**.**
Both parts by induction on E.
Corollary 2.10**.**
For any E, the Antimirov automaton is finite.
We note that the Antimirov automaton, constructed as above, while
canonical, is generally not trim: every state is reachable, but not
every state is generally coreachable (i.e., not every state needs to
have a path to some final state). A state E′ is not coreachable if
and only if [[E′]]=∅. This is the case precisely when
E′ equals [math] in the theory of idempotence of + and the left and
right zero laws of [math] wrt. ⋅. The Antimirov automaton is
trimmed by removing the states that are not coreachable.
Now we can also show that a suitable quotient of the Brzozowski
automaton is finite.
For this we prove a syntactic version of
Proposition 2.5 relating the Brzozowski
derivative and the Antimirov parts-of-derivatives.
Proposition 2.11**.**
For any E,
-
for any a∈Σ, DaE≐∑{E′∣E→(a,E′)};
2. 2.
for any u∈Σ∗,
DuE≐∑{E′∣E→∗(u,E′)}.
(using the semilattice equations for 0,+, that [math] is left zero, and
distributivity of ⋅ over + from the right).
Corollary 2.12**.**
For any E, the Brzozowski automaton, suitably quotiented, is
finite.
Proof 2.13**.**
Just notice that the powerset of a finite set is finite too.
This quotient does not give the minimal deterministic automaton (given
by semantic derivatives of [[E]]). The minimal deterministic
automaton is obtained from the Brzozowski automaton by quotienting it
by the full Kleene algebra theory.
3 Trace Closures of Regular Languages
3.1 Trace Closure of a Word Language
An independence alphabet is an alphabet Σ together with
an irreflexive and symmetric relation
I⊆Σ×Σ called the independence
relation. The complement D of I, which is reflexive and symmetric,
is called dependence.
We extend independence to words by saying that two words u and v
are independent, uIv, if aIb for all a,b
such that a∈Σ(u) and b∈Σ(v).
Let ∼I⊆Σ∗×Σ∗ be the least
congruence relation on the free monoid Σ∗ such that aIb
implies ab∼Iba for all a,b∈Σ. If uIv, then
uv∼Ivu.
A (Mazurkiewicz) trace is an equivalence class of words wrt. ∼I. The equivalence class of a word w is denoted by [w]I.
A word a1…an where ai∈Σ yields a directed
node-labelled acyclic graph as follows. Take the vertex set to be
V=df{1,…,n} and label vertex i with ai. Take the
edge set to be E=df{(i,j)∣i<j∧aiDaj}. This
graph (V,E) for a word w is called the dependence graph of
w and is denoted by ⟨w⟩D. If w∼Iz, then the
dependence graphs of w and z are isomorphic, i.e., traces can be
identified with dependence graphs up to isomorphism.
The set Σ∗/∼I of all traces is the free partially
commutative monoid on (Σ,I). If I=∅, then
Σ∗/∼I≅Σ∗, the set of words, i.e., we
recover the free monoid. If I={(a,b)∣a=b}, then
Σ∗/∼I≅Mf(Σ), the set of finite multisets
over Σ, i.e., the free commutative monoid.
A trace language is a subset of Σ∗/∼I. Trace
languages are in bijection with word languages that are (trace)
closed in the sense that, if z∈L and w∼Iz, then also
w∈L. If T is a trace language, then its flattening
L=df⋃T is a closed word language. On the other hand, the
trace language corresponding to a closed word language L is
T=df{t∈Σ∗/∼I∣∃z∈t.z∈L}={t∈Σ∗/∼I∣∀z∈t.z∈L}.
Given a general (not necessarily closed) word language L, we define its
(trace) closure [L]I as the least closed word language that
contains L. Clearly
[L]I={w∈Σ∗∣∃z∈L.w∼Iz}
and also
[L]I=⋃{t∈Σ∗/∼I∣∃z∈t.z∈L}.
For any L, we have [[L]I]I=[L]I, so [_]I is a closure
operator. Note also that L is closed iff [L]I=L.
As seen in Section 2.2, the derivative
of a word language is the set of all suffixes for a prefix. We now
look at what the prefixes and suffixes of a word as a representative
of a trace should be. For a word vuv′ such that vIu, we can
consider u to be its prefix, up to reordering, and vv′ to be the
suffix. This is because an equivalent word uvv′ strictly has u as
a prefix and vv′ as the suffix. Similarly, we may also want to
consider u′ to be a prefix of vuv′ when u′∼Iu since
u′vv′∼Iuvv′∼Ivuv′. Note that if a is such a prefix of
z, then, by irreflexivity of I, this a is the first a of
z. In general, when u is a prefix of z, then the letter
occurrences in u uniquely map to letter occurrences in z. We
scale these ideas to allow u to be scattered in z as
z=v0u1v1…unvn in either the sense that
u=u1…un or u∼Iu1…un. We also define
degree-bounded versions of scattering that become relevant in
Section 5.
Definition 3.1**.**
*For all u1,…,un∈Σ+,v0∈Σ∗,v1…,vn−1∈Σ+,vn∈Σ∗,z∈Σ∗,
u1,…,un⊲z⊳v0,…,vn=dfz=v0u1v1…unvn∧∀i.∀j<i.vjIui.*
Definition 3.2**.**
For all u,v,z∈Σ∗,
-
u⊲z⊳v=df∃n∈N,u1,…,un,v0,…,vn.u=u1…un∧v=v0…vn∧u1,…,un⊲z⊳v0,…,vn;
2. 2.
u∼⊲z⊳v=df∃u′.u∼Iu′∧u′⊲z⊳v;
3. 3.
u∼⊲z⊳∼v=df∃u′,v′.u∼Iu′∧u′⊲z⊳v′∧v′∼Iv.
In all three cases, we talk about u being a prefix and v being a
suffix of z, up to reordering, or uv being scattered in
z with degree n.
Lemma 3.3**.**
For any u,v,z∈Σ∗,
-
u⊲z⊳v⟺∃!n∈N,u1,…,un,v0,…,vn.u=u1…un∧v=v0…vn∧u1,…,un⊲z⊳v0,…,vn;
2. 2.
u∼⊲z⊳v⟺∃!u′.u∼Iu′∧u′⊲z⊳v;
3. 3.
u∼⊲z⊳∼v⟺∃!u′,v′.u∼Iu′∧u′⊲z⊳v′∧v′∼Iv.
Definition 3.4**.**
For all u,v,z∈Σ∗ and N∈N,
-
u⊲Nz⊳v=df∃n≤N,u1,…,un,v0,…,vn.u1,…,un⊲z⊳v0,…,vn;
2. 2.
(and u∼⊲Nz⊳v and u∼⊲Nz⊳∼v are defined analogously).
Example 3.5**.**
Let Σ=df{a,b,c} and aIb and aIc. Take
z=dfaabcba. We have ab⊲z⊳acba since
a,b⊲z⊳ε,a,cba. We can visualize this by
underlining the subwords of u=dfab in
z=εaabcba. This scattering is valid
because εIa, εIb and aIb: recall that
Def. 3.1 requires all underlined subwords ui to be
independent with all non-underlined subwords vi to their left in
z. Similarly we have aa,a⊲z⊳ε,bcb,ε because
z=εaabcbaε, εIaa,
εIa and bcbIa. Note that neither
aabcbaε nor aabcbaε
satisfies the conditions about independence and thus there is no v
such that ba⊲z⊳v. We do have ba∼⊲z⊳acba
though, since ba∼Iab and a,b⊲z⊳ε,a,cba.
Proposition 3.6**.**
For all u,v,z∈Σ∗,uv∼Iz⟺u∼⊲z⊳∼v.
3.2 Trace-Closing Semantics of Regular Expressions
We now define a nonstandard word-language semantics of regexps that
directly interprets E as the trace closure [[[E]]]I of its
standard regular word-language denotation of [[E]].
We have [{a}]I={a}, [∅]I=∅,
[L∪L′]I=[L]I∪[L′]I and [1]I=1. But for
general I, we do not have [L⋅L′]I=[L]I⋅[L′]I.
For example, for Σ=df{a,b} and aIb, we
have [{a}]I={a}, [{b}]I={b} whereas
[{ab}]I={ab,ba}={ab}=[{a}]I⋅[{b}]I.
Hence we need a different concatenation operation.
Definition 3.7**.**
-
The I-reordering concatenation of words
⋅I:Σ∗×Σ∗→PΣ∗ is defined by
[TABLE]
2. 2.
The lifting of I-reordering concatenation to languages is defined by
[TABLE]
Note that {b∣auIb} acts as a test: it is either ∅
or {b}.
Example 3.8**.**
Let Σ=df{a,b} and aIb. Then
a⋅Ib={ab,ba}, aa⋅Ib={aab,aba,baa},
a⋅Ibb={abb,bab,bba} and
ab⋅Iba={abba}. The last example shows that although
I-reordering concatenation is defined quite similarly to shuffle,
it is different.
Proposition 3.9**.**
For any u,v,z∈Σ∗,
z∈u⋅Iv⟺u⊲z⊳v.
Proposition 3.10**.**
For any languages L and L′, [L⋅L′]I=[L]I⋅I[L′]I.
Evidently, if I=∅, then reordering concatenation is just
ordinary concatenation: u⋅∅v={uv}.
For I=Σ×Σ, which
is forbidden in independence alphabets, as I is required to be
irreflexive, it is shuffle: u⋅Σ×Σv=u⊔⊔v.
For general I, it has properties similar
to concatenation. In particular, we have
[TABLE]
but also other equations of the concurrent Kleene algebra theory
introduced in [10].
We are ready to introduce the closing semantics of regular
expressions.
Definition 3.11**.**
The trace-closing semantics
[[_]]I:RE→PΣ∗ of regular expressions is defined
recursively by
[TABLE]
Compared to the standard semantics of regular expressions, the
difference is in the handling of the EF case (and consequently also
the E∗ case) due to the cross-commutation that happens in
concatenation of traces and must be accounted for by ⋅I.
With I=∅, we fall back to the standard interpretation of
regular expressions: [[E]]∅=[[E]]. For I a general
independence relation, we obtain the desired property that the
semantics delivers the trace closure of the language of the regexp.
Proposition 3.12**.**
For any E, [[E]]I is trace closed; moreover,
[[E]]I=[[[E]]]I.
3.3 Properties of Trace Closures of Regular Languages
Trace closures of regular languages are theoretically interesting due to
their intricate properties and have therefore been studied in a number
of works, e.g.,
[4, 18, 2, 21, 9, 12]. For
a thorough survey, see Ochmański’s handbook
chapter [19].
The most important property for us is that the trace closure of a regular language is
not necessarily regular.
Proposition 3.13**.**
There exists a regular language L such that [L]I is not regular.
Proof 3.14**.**
Consider Σ=df{a,b}, aIb.
Let L=df[[(ab)∗]]. The language
[L]I={u∣∣u∣a=∣u∣b} is not regular.
The class of trace closures of regular languages over an independence
alphabet behaves quite differently from the class of regular languages
over an alphabet. Here are some results demonstrating this.
Theorem 3.15** **(Bertoni et al. [5], Aalbersberg and Welzl [2],
Sakarovitch [21]).
(cf. [19, Thm. 6.2.5]) The class of trace closures of
regular languages over (Σ,I) is closed under complement iff
I is quasi-transitive (i.e., its reflexive closure is transitive).
Theorem 3.16** **(Bertoni et al. [4], Aalbersberg and
Welzl [2] (“if” part); Aalbersberg and Hoogeboom
[1]).
(cf. [19, Thm. 6.2.5]) The problem of whether the
trace closures of two regular languages over (Σ,I) are equal
is decidable iff I is quasi-transitive.
Theorem 3.17** (Sakarovitch [22]).**
(cf. [19, Thm. 6.2.7]) The problem of whether the
trace closure of the language of a regexp over (Σ,I) is
regular is decidable iff I is quasi-transitive.
A closed language is regular iff the corresponding trace language is
accepted by a finite asynchronous (a.k.a. Zielonka)
automaton [24, 25]. In Section 4.4, we
will see further characterizations of regular closed languages based
on star-connected expressions.
3.4 Rational and Recognizable Languages of Monoids
Trace languages are a special case of languages of monoids.
A subset T of a monoid M is called an M-language.
An M-language T is called rational if T=[[E]]M for
some regular expression E over M. Here
[[_]]M:RE(M)→PM interprets any element m of M as
{m}, the 0,+ constructors of regular expressions by ∅
and ∪, the 1,⋅ constructors as mandated by the monoid
structure, and (_)∗ as the appropriate least fixpoint.
An M-language T is called recognizable if there is a
deterministic finite M-automaton accepting T. An deterministic
M-automaton is given by a state set Q, an initial state
q0∈Q, a set of final states F⊆Q, and a right action
δ of M on Q. An element m∈M is accepted by the
automaton if δmq0∈F.
Kleene’s celebrated theorem says that, for languages of free monoids
on finite sets (i.e., word languages over finite alphabets),
rationality and recognizability are equivalent conditions (and we can
thus just speak about regularity). For a general monoid, however, the
two notions are different.
Theorem 3.18** (Kleene [11]).**
Let M be the free monoid
Σ∗ on a finite set Σ. An M-language T is rational
iff T is recognizable.
Theorem 3.19** (McKnight [17]).**
Let M be finitely
generated. If an M-language T is recognizable, then T is
rational.
Given a monoid M and a congruence ≡ on M, the set
M/≡ is a monoid too. We view M/≡-languages as sets of
equivalence classes wrt. ≡.
Proposition 3.20**.**
Given a monoid M and a congruence ≡ on it.
-
The M/≡-language [[E]]M/≡ of a regular
expression E is expressible via its M-language [[E]]M by
[[E]]M/≡={t∈M/≡∣∃u∈t.u∈[[E]]M}.
2. 2.
A M/≡-language T is recognizable iff its flattening
⋃T into an M-language is recognizable.
For the monoid Σ∗/∼I of traces, which is the free
partially commutative monoid, the classes of rational and recognizable
languages are different, the class of rational languages is a proper
subclass of that of recognizable languages. In view of
Proposition 3.20, a trace language T is rational iff
T={t∈Σ∗/∼I∣∃u∈t.u∈L} or, equivalently,
⋃T=[L]I for some regular word language L (in the
alternative terminology of Aalbersberg and Welzl [2],
such a trace language T is called existentially regular), and
recognizable iff ⋃T=L for some regular word language L
(such a trace language is called consistently regular).
The question of when a rational trace language is recognizable is
nontrivial. We have just seen that, reformulated in terms of word
languages, it becomes: given a regular language L, when is its trace
closure [L]I regular?
4 Reordering Derivatives
We are now ready to generalize the Brzozowski and Antimirov
constructions for trace closures of regular languages. To this end, we
switch to what we call reordering derivatives.
4.1 Reordering Derivative of a Language
Let (Σ,I) be a fixed independence alphabet. We generalize the
concepts of (semantic) nullability and derivative of a
language to concepts of reorderable part and reordering
derivative.
Definition 4.1**.**
We define the
I-reorderable part of a language L wrt. a word u by
RuIL=df{v∈L∣vIu} and the
I-reordering derivative along u by
DuIL=df{v∣∃z∈L.u∼⊲z⊳v}.
By Prop. 3.9, we can equivalently say that
DuIL={v∣∃z∈L.z∈[u]I⋅Iv}. For
a single-letter word a, we get
DaIL={vlvr∣vlavr∈L∧vlIa}={v∣∃z∈L.z∈a⋅Iv}.
That is, we require some reordering of u (resp. a) to be a
prefix, up to reordering, of some word z in L with v as the
corresponding strict suffix. (In other words, for the sake of
precision and emphasis, we allow reordering of letters within u and
across u and v, but not within v.)
Example 4.2**.**
Let Σ=df{a,b,c} and aIb. Take
L=df{ε,a,b,ca,aa,bbb,babca,abbaba}. We have
RaIL=RaaIL={ε,b,bbb},
DaIL={ε,a,bbca,bbaba} and DaaIL={ε,bbba}.
In the special case I=∅, we have
Rε∅L=L, Ru∅L={ε∣L↓}
for any u=ε, and Du∅L=DuL.
In the general case, the reorderable part and reordering
derivative enjoy the following properties.
Lemma 4.3**.**
For every L, L′, for any u∈Σ∗, if
L⊆L′, then RuIL⊆RuIL′ and
DuIL⊆DuIL′.
Lemma 4.4**.**
For every L,
-
RεIL=L*; for every u,v∈Σ∗,
RvI(RuIL)=RuvIL;
*
2. 2.
for every u,u′∈Σ∗, RΣ(u)IL=RΣ(u′)IL.
We extend RI to subsets of Σ: by RXIL, we mean
RuIL where u is any enumeration of X.
Lemma 4.5**.**
For every L,
-
DεIL=L*; for any u,v∈Σ∗, DvI(DuIL)=DuvIL;
*
2. 2.
for any u,u′∈Σ∗ such that u∼Iu′, we have DuIL=Du′IL.
Proposition 4.6**.**
For every L,
-
*for any u∈Σ∗, Du([L]I)=[DuIL]I; *
if L is closed (i.e., [L]I=L), then, for any
u∈Σ∗, DuIL is closed and DuL=DuIL;
2. 2.
for any u,v∈Σ∗, uv∈[L]I iff v∈[DuIL]I;
3. 3.
for any u∈Σ∗, u∈[L]I iff (DuIL)↓;
4. 4.
[L]I={ε∣L↓}∪⋃a∈Σ{a}⋅[DaIL]I.
Example 4.7**.**
Let Σ=df{a,b} and aIb. Take L to be the regular
language [[(ab)∗]]. We have already noted that the language
[L]I={u∣∣u∣a=∣u∣b} is not regular. For any
n∈N, DbnIL={an}⋅L=[[an(ab)∗]] whereas
Dbn([L]I)={an}⋅I[L]I={u∣∣u∣a=∣u∣b+n}.
We can see that [L]I has infinitely many derivatives, none of which are regular, and
L has infinitely many reordering derivatives, all regular.
4.2 Brzozowski Reordering Derivative
The reorderable parts and reordering derivatives of regular languages
turn out to be regular. We now show that they can be computed
syntactically, generalizing the classical syntactic nullability and
Brzozowski derivative operations [7].
Definition 4.8**.**
The I-reorderable part and the
Brzozowski I-reordering derivative of a regexp are given by
functions RI,DI:RE×Σ→RE and
RI,DI:RE×Σ∗→RE defined recursively by
[TABLE]
The regexp RuE is nothing but E with all occurrences of letters
dependent with u replaced with [math]. The definition of D is more
interesting. Compared to the classical Brzozowski derivative, the
nullability condition E↓ in the EF case has been replaced with
concatenation with the reorderable part RaIE, and the E∗ case
has also been adjusted.
The functions R and D on regexps compute their
semantic counterparts on the corresponding regular languages.
Proposition 4.9**.**
For any E,
-
for any a∈Σ, RaI[[E]]=[[RaIE]] and DaI[[E]]=[[DaIE]];
2. 2.
for any u∈Σ∗, RuI[[E]]=[[RuIE]] and DuI[[E]]=[[DuIE]].
Proposition 4.10**.**
For any E,
-
for any a∈Σ, v∈Σ∗, av∈[[E]]I⟺v∈[[DaIE]]I;
2. 2.
for any u,v∈Σ∗, uv∈[[E]]I⟺v∈[[DuIE]]I;
3. 3.
for any u∈Σ∗, u∈[[E]]I⟺(DuIE)↓.
Example 4.11**.**
Let Σ=df{a,b}, aIb and E=dfaa+ab+b.
[TABLE]
As with the classical Brzozowski derivative, we can use the reordering
Brzozowski derivative to construct deterministic automata. For a
regexp E, take QE=df{DuIE∣u∈Σ∗},
q0E=dfE, FE=df{E′∈QE∣E′↓},
δaEE′=dfDaIE′ for E′∈QE. By
Prop. 4.10, this automaton accepts the closure
[[E]]I. But even quotiented by the full Kleene algebra theory,
the quotient of QE is not necessarily finite, i.e., we may be able
to construct infinitely many different languages by taking reordering
derivatives. For the regexp from Example 4.7,
we have DbnI((ab)∗)≐an(ab)∗, so it has infinitely many
Brzozowski reordering derivatives even up to the Kleene algebra
theory. This is only to be expected, as the closure [[(ab)∗]]I
is not regular and cannot possibly have an accepting finite automaton.
4.3 Antimirov Reordering Derivative
Like the classical Brzozowski derivative that was optimized by
Antimirov [3],
the Brzozowski reordering derivative construction can be optimized by
switching from functions on regexps to multivalued functions or
relations.
Definition 4.12**.**
The Antimirov I-reordering parts-of-derivatives
of a regexp along a letter and a word are relations
→I⊆RE×Σ×RE and
→I∗⊆RE×Σ∗×RE defined
inductively by
[TABLE]
Here RI is defined as before. Similarly to the Brzozowski reordering
derivative from the previous subsection, the condition E↓
in the second EF rule has has been replaced with concatenation with
RaIE, and the E∗ rule has been adjusted.
Collectively, the Antimirov reordering parts-of-derivatives of a
regexp E compute the semantic reordering derivative of the
language [[E]].
Proposition 4.13**.**
For any E,
-
for any a∈Σ,
DaI[[E]]=⋃{[[E′]]∣E→I(a,E′)};
2. 2.
*for any u∈Σ∗,
DuI[[E]]=⋃{[[E′]]∣E→I∗(u,E′)}. *
Proposition 4.14**.**
For any E,
-
for any a∈Σ, v∈Σ∗,
av∈[[E]]I⟺∃E′.E→I(a,E′)∧v∈[[E′]]I;
2. 2.
for any u,v∈Σ∗,
uv∈[[E]]I⟺∃E′.E→I∗(u,E′)∧v∈[[E′]]I;
3. 3.
for any u∈Σ∗,
u∈[[E]]I⟺∃E′.E→I∗(u,E′)∧E′↓.
Example 4.15**.**
Let us revisit Example 4.11.
The Antimirov reordering parts-of-derivatives of E along b are
a1 and 1:
[TABLE]
The Antimirov reordering parts-of-derivatives of E∗ along b are
therefore Eb∗(a1)E∗ and Eb∗1E∗ where
Eb=dfRbIE=aa+a0+0. Recall that, for the Brzozowski
reordering derivative, we computed
DbIE=(0a+a0)+(0b+a1)+1 and
DbIE∗=Eb∗((0a+a0)+(0b+a1)+1)E∗.
Like the classical Antimirov construction, the Antimirov reordering
parts-of-derivatives of a regexp E give a nondeterministic automaton
by
QE=df{E′∣∃u∈Σ∗.E→I∗(u,E′)},
IE=df{E}, FE=df{E′∈QE∣E′↓},
E′→E(a,E′′)=dfE′→I(a,E′′) for E′,E′′∈QE.
This automaton accepts [[E]]I by Prop. 4.14,
but is generally infinite, also if quotiented by the full Kleene
algebra theory.
Revisiting Example 4.7 again, (ab)∗ must
have infinitely many Antimirov reordering parts-of-derivatives modulo
the Kleene algebra theory since [[(ab)∗]]I is not regular and
cannot have a finite accepting nondeterministic
automaton. Specifically, it has
(a0)∗((a1)…((a0)∗((a1)(ab)∗))…)≐an(ab)∗
as its single reordering part-of-derivative along bn.
However, if quotienting the Antimirov automaton for E by some sound
theory (a theory weaker than the Kleene algebra theory) makes it
finite, then the Brzozowski automaton can also be quotiented to become
finite.
Proposition 4.16**.**
For any E,
-
for any a∈Σ,
DaIE≐∑{E′∣E→I(a,E′)};
2. 2.
for any u∈Σ∗,
DuIE≐∑{E′∣E→I∗(u,E′)}
(using the semilattice equations for 0,+, that [math] is zero, and
distributivity of ⋅ over +).
Corollary 4.17**.**
If some quotient of the Antimirov automaton for E (accepting
[[E]]I) is finite, then also some quotient of the Brzozowski
automaton is finite.
4.4 Star-Connected Expressions
Star-connected expressions are important as they characterize regular
closed languages. A corollary of that is a further characterization of
such languages in terms of a “concurrent” semantics of regexps that
interprets Kleene star nonstandardly as “concurrent star”.
Definition 4.18**.**
A word w∈Σ∗ is connected if its dependence graph
⟨w⟩D is connected. A language
L⊆Σ∗ is connected if every word w∈L is
connected.
Definition 4.19**.**
-
Star-connected expressions* are a subset of the set of all regexps defined inductively by:
[math], 1 and a∈Σ are star-connected. If E and F are
star-connected, then so are E+F and EF. If E is
star-connected and [[E]] is connected, then E∗ is
star-connected.*
2. 2.
A language L is said to be star-connected if L=[[E]] for some star-connected regexp.
Ochmański [18] proved that a closed language is
regular iff it is the closure of a star-connected language. This
means that, for any regexp E, the language [[E]]I is regular
iff there exists a star-connected expression E′ such that
[[E]]I=[[E′]]I. It is important to realize that generally
E=E′ and also [[E]]=[[E′]]. Ochmański’s proof was
as follows.
For a linear order ≤ on Σ, a word z is a
lexicographic normal form if
∀w∈[z]I.z≤lexw where
≤lex is the lexicographic order on Σ∗ induced
by ≤. We write LexI for the set of all lexicographic normal
forms.
Lemma 4.20**.**
(cf. [19, Props. 6.3.4,
6.3.10])
-
LexI* is regular.*
2. 2.
For any regular expression E, if [[E]]⊆LexI, then
E is star-connected.
Theorem 4.21** (Ochmański [18]).**
(cf. [19, Thm. 6.3.13]) For any closed
language L, the following are equivalent:
-
L* is regular;*
2. 2.
L∩LexI* is regular;*
3. 3.
L* is star-connected.*
Proof 4.22**.**
(1) ⇒ (2) is a consequence of Lemma 4.20(1)
as the intersection of regular languages is regular. (2) ⟹ (3)
follows from Lemma 4.20(2). For (3) ⟹ (1),
Ochmański employed Hachiguchi’s notion of rank of a language and
Hachiguchi’s lemma, which we will study in Def. 5.1 and
Prop. 5.2 below, and proved that, if L is closed
and connected, then L∗ has rank.
The nonstandard concurrent-star trace-language semantics of
regular expressions
[[_]]con:RE(Σ)→PΣ∗ is like
[[_]] except that the star constructor is interpreted
nonstandardly as the concurrent star operation. Informally, the
concurrent star of a language iterates not the given language but the
language of connected components of its words.
The concurrent star of a connected language coincides with its Kleene
star. The idea of this nonstandard semantics is to make
non-star-connected regular expressions harmless, so as to obtain the
following replacement for Kleene’s theorem.
Theorem 4.23** (Ochmański [18]).**
(cf. [19, Thm. 6.3.16]) A closed langugage L is regular iff
L=[[[E]]con]I for some regexp E.
4.5 Automaton Finiteness for Star-Connected Expressions
We now show that the set of Antimirov reordering parts-of-derivatives
of a star-connected expression is finite modulo suitable equations.
Lemma 4.24**.**
If a language L is connected, then for any u∈Σ+,
RuI(DuIL)⊆1.
Proof 4.25**.**
Because L is connected, if w∈DuIL, then aDb for some
a∈u and b∈w. For such w to also be in
RuI(DuIL), we also need that wIu. This is only possible
if w=ε.
Lemma 4.26**.**
For any E, if [[E]]⊆1, then either E≐0 or
E≐1 (using the equations involving [math] and 1 only (e.g.,
0+1≐1 and 0∗≐1 etc.) and
that [math] is zero).
Lemma 4.27**.**
For any E, E′
and u∈Σ+, if [[E]] is connected and
E→I∗(u,E′), then RuIE′≐0 or
RuIE′≐1 (using the equations involving [math] and 1 only
and that [math] is zero).
Proof 4.28**.**
From E→I∗(u,E′) by Proposition 4.13,
[[E′]]⊆DuI[[E]]. Hence by
Lemma 4.24, we get
[[RuIE′]]=RuI[[E′]]⊆RuI(DuI[[E]])⊆1.
By Lemma 4.26, RuIE′≐0 or
RuIE′≐1.
Lemma 4.29**.**
For any E, E′ and u∈Σ∗, if E∗→I∗(u,E′), then
there exist n∈N, E1,…,En,
∅⊂X0,…,Xn−1⊆Σ and
u1,…,un∈Σ+ such that
[TABLE]
where Xi−1⊇Xi∪Σ(ui) and
E→I∗(ui,Ei) for all i (using only associativity of
⋅).
Lemma 4.30**.**
For any E, E′ and u∈Σ∗, if [[E]] is connected,
E∗→I∗(u,E′) and, for the development of E′ from the
previous lemma, we have Xi−1=Xi for some i, then
RXiIEi≐0 or RXiIEi≐1 (using the equations involving [math] and 1 only,
that [math] is zero).
Proof 4.31**.**
We have Σ(ui)⊆Xi−1=Xi. From
E→I∗(ui,Ei), by Lemma 4.27
either RuiIEi≐0 or RuiIEi≐1. Therefore also
RXiIEi≐0 or RXiIEi≐1.
Lemma 4.32**.**
For any E,
E′ and u∈Σ∗, if [[E]] is connected and
E∗→I∗(u,E′), then there exist n≤∣Σ∣,
E1,…,En and ∅⊂X0,…,Xn−1⊆Σ such that
[TABLE]
and Xi−1⊃Xi for all i
(using, in addition to the equations mentioned in the lemmata above,
unitality of 1 and the equation F∗⋅F∗≐F∗).
Proof 4.33**.**
From Lemmata 4.29, 4.30 noting
that at most ∣Σ∣−1 of the inclusions
Xi−1⊇Xi can be proper.
Definition 4.34**.**
We define functions
(_)→+,(_)→∗:RE→PRE by
[TABLE]
Proposition 4.35**.**
For any E,
E′ and u∈Σ∗, if E→I∗(u,E′), then there
exists E′′ such that E′≐E′′ and E′′∈E→∗ (using
only the equations mentioned in the above lemmata).
Proposition 4.36**.**
If E is
star-connected, then a suitable sound quotient of the state set
{E′∣∃u∈Σ∗. E→I∗(u,E′)} of the
Antimirov automaton for E (accepting [[E]]I) is
finite.
Proof 4.37**.**
By Lemma 4.32, for a star-connected
expression E, we only need to consider n≤∣Σ∣ in the
definition of (E∗)→+ for
Proposition 4.35 to hold. This
restriction makes the set E→∗ finite.
5 Uniform Scattering Rank of a Language
We proceed to defining the notion of uniform scattering rank of a
language and show that star-connected expressions define languages
with uniform scattering rank.
5.1 Scattering Rank vs. Uniform Scattering Rank
The notion of scattering rank of a language (a.k.a. distribution rank, k-block
testability) was introduced by Hashiguchi [9].
Definition 5.1**.**
*A language L has (I-scattering) rank at most N if
∀u,v.uv∈[L]I⟹∃z∈L.u∼⊲Nz⊳∼v.*
We say that L has rank if it has rank at most N for some
N∈N. If it does, then, for the least such N, we say that
L has rank N.
The only languages with rank 0 are ∅ and 1. If a nontrivial language
L is closed, it has rank 1: for any uv∈[L]I, we have also
have uv∈L and u⊲uv⊳ε,v.
Having rank is a sufficient condition for regularity of the
trace closure of a regular language. But it is not a necessary
condition.
Proposition 5.2** (Hashiguchi [9]).**
(cf. [19, Prop. 6.3.2]) If a
regular language L has rank, then [L]I is regular.
Proposition 5.3**.**
There exist regular languages L such that [L]I
is regular but L is without a rank.
Proof 5.4**.**
Consider Σ=df{a,b}, aIb. The regular language
L=df[[(ab)∗(a∗+b∗)]] is without a rank, since, for any
n, we have (ab)n∈L and anbn∈[L]I while the smallest
N such that an∼⊲N(ab)n⊳∼bn is n. Nonetheless,
[L]I=Σ∗=[[(a+b)∗]] is regular.
We wanted to show that a truncation of the refined Antimirov automaton
(which we define in Section 6) is
finite for regexps whose language has rank. But it turns out, as we
shall see, that rank does not quite work for this. For this reason,
we introduce a stronger notion that we call uniform scattering rank.
Definition 5.5**.**
*A language L has uniform (I-scattering) rank at most N if
∀w∈[L]I. ∃z∈L. ∀u,v.w=uv⟹u∼⊲Nz⊳∼v.*
The difference between the two definitions is that, in the uniform
case, the choice of z depends only on w whereas, in the
non-uniform case, it depends on the particular split of w as w=uv,
i.e., for every such split of w we may choose a different z.
Lemma 5.6**.**
If L has uniform rank at most N, then L has
rank at most N.
The converse of the above lemma does not hold—there are languages
with uniform rank greater than rank. Furthermore, there are languages
that have rank but no uniform rank.
Proposition 5.7**.**
Let Σ=df{a,b,c}, aIb and
E=dfa∗b∗c(ab)∗(a∗+b∗)+(ab)∗(a∗+b∗)ca∗b∗.
-
The language [[E]] has rank 2.
2. 2.
The language [[E]] has no uniform rank.
Proof 5.8**.**
Note that c behaves like a separator—although a and b are
independent, neither a nor b commutes with c.
It can be seen that words in [[E]]I are of the form wlcwr where
wl and wr consist of some number of a’s and b’s, i.e.,
[[E]]I=[[(a+b)∗c(a+b)∗]].
-
Let uv∈[[E]]I. We have to find u1,u2 and
v0,v1,v2 so that u1u2∼Iu, v0v1v2∼Iv,
v0Iu1, v0v1Iu2 and v0u1v1u2v2∈[[E]].
There are two cases to consider: either c is in the suffix v
or it is in the prefix u.
Case c∈v: We have that u consists of only a’s and
b’s. Let x,y∈Σ∗ be such that v=xcy. Set
u1=dfπa(u), u2=dfπb(u), v0=dfε and
v1=dfπa(x). Let k=df∣y∣a, l=df∣y∣b and
m=dfmin(k,l). Set
v2=dfπb(x)c(ab)mak−mbl−m. We have that
u1u2=πa(u)πb(u)∼Iu. Since
πa(x)πb(x)∼Ix and
(ab)mak−mbl−m∼Iy, we also have
v0v1v2=επa(x)πb(x)c(ab)mak−mbl−m∼Ixcy=v.
Also, εIπa(u) and επa(x)Iπb(u). Finally,
v0u1v1u2v2=επa(u)πa(x)πb(u)πb(x)c(ab)mak−mbl−m∈[[a∗b∗c(ab)∗(a∗+b∗)]].
Case c∈u: Similar to the previous case. Let x and y be
such that u=xcy. Let k=df∣x∣a, l=df∣x∣b and
m=dfmin(k,l). Set
u1=df(ab)mak−mbl−mcπa(y), u2=dfπb(y),
v0=dfε, v1=dfπa(v) and v2=dfπb(v). In this
case we have
v0u1v1u2v2∈[[(ab)∗(a∗+b∗)ca∗b∗]].
2. 2.
Assume that [[E]] has uniform rank at most N. Take
w=dfaN+1bN+1caN+1bN+1∈[[E]]I. By our
assumption, there is z∈[[E]] such that, for all u and
v, if w=uv, then u∼⊲Nz⊳∼v.
Take u=dfaN+1 and v=dfbN+1caN+1bN+1. Thus,
for some n≤N, z=v0u1v1…unvn and
u=aN+1∼Iu1…un. Since we have N+1
letters a to divide into n≤N words, at
least one ui must consist of more than one a and thus z must
contain two consecutive a’s that are before c.
Take u′=dfaN+1bN+1caN+1 and v′=dfbN+1.
Again, for some n≤N, z=v0′u1′v1′…un′vn′ and
v′=bN+1∼Iv0′…vn′. Note that c must be in
one of the ui′’s and thus for all j<i it must be that
vj′=ε. Hence v0′=ε and we have N+1 letters b
to divide into n≤N words and thus at least one vi′
consists of more than one b. This means that z must contain
two consecutive b’s that are after c.
The only words in [[E]] equivalent to w are
aN+1bN+1c(ab)N+1 and
(ab)N+1caN+1bN+1. Neither of these has at least
two consecutive a’s before c as well as at least two
consecutive b’s after c, so neither qualifies as
z. Contradiction.
5.2 Star-Connected Languages Have Uniform Rank
Klunder et al. [12] established that star-connectedness
is a sufficient condition for a regular language to have rank,
although not a necessary one.
Proposition 5.9** **(Klunder et
al. [12]).
Any
star-connected language has rank.
Proof 5.10**.**
The language {a} has rank 1. The languages ∅ and
1 have rank [math]. If two languages L1 and L2 have ranks at
most N1 resp. N2, then L1∪L2 has rank at most
max(N1,N2) and L1⋅L2 has rank at most N1+N2.
If a general language L has rank at most N, then L∗ need not
have rank. For example, for Σ=df{a,b}, aIb, the
language {ab} has rank 1, but {ab}∗ is without rank. But if
L is also connected, then L∗ turns out to have rank at most
(N+1)⋅∣Σ∣. The claim follows by induction on the given
star-connected expression.
Proposition 5.11**.**
There exist
regular languages with rank (and also with uniform rank)
that are not star-connected.
Proof 5.12**.**
Consider Σ=df{a,b}, aIb. The language
L=df[[(aa+ab+ba+bb)∗]] has rank 1, in fact even uniform
rank 1, because it is closed. The regular expression
(aa+ab+ba+bb)∗ is clearly not star-connected, since the language
[[aa+ab+ba+bb]] contains disconnected words ab and ba. But a
more involved pumping argument also shows that L is not
star-connected, i.e., that there is no star-connected expression E
such that L=[[E]].
We will now show that star-connected languages also have uniform rank,
by refining Klunder et al.’s proof of
Proposition 5.9, especially the case
of the Kleene star.
Let us analyze the case L∗ where L is a connected language. When
w∈[L∗]I, then there exists z∈L such that w∼Iz.
This further means that there exist n∈N and
z1,…,zn∈L such that z=z1…zn where we can
require that all zi are nonempty. Since L is connected, each
zi is also connected. If w=uv, then there exist
u1,…,un and v1,…,vn such that
u∼Iu1…un, v∼Iv1…vn and, for every
i, zi∼Iuivi and, for every j<i, vjIui. In other
words, ui is the part of zi that belongs to u and vi is the
part that belongs to v. In particular, if ui=ε (or
zi∼Ivi), then all letters of zi belong to the suffix v,
and similarly if vi=ε (or zi∼Iui), then all letters
of zi belong to the prefix u. An important observation for us is
that not more than ∣Σ∣ of the zi can be two-colored in the
sense that both ui=ε and vi=ε.
Lemma 5.13**.**
Let w,u,v,z1,…,zn be words such that w=uv,
w∼Iz1…zn and each zi is nonempty and connected. Let
u1,…,un,v1,…,vn be words such that
u∼Iu1…un, v∼Iv1…vn, for all i,
zi∼Iuivi, and, for all j<i,
vjIui.
For at most ∣Σ∣ of the words zi, it can be that both ui=ε
and vi=ε.
Proof 5.14**.**
If, for some i, we have that ui=ε and vi=ε,
then, since zi∼Iuivi is connected, there must exist
letters a and b such that a∈ui, b∈vi and aDb.
Since viIui+1…un, we have
a∈ui+1…un.
This means that, if there are k words zi such that
ui=ε and vi=ε, then these words together must
contain at least k distinct letters.
Should it happen for some i that zi and zi+1 are
completely from the prefix u (in the sense that
vi=vi+1=ε, i.e., zi∼Iui and
zi+1∼Iui+1), then zi and zi+1 belong to the same
block of u in the scattering u∼⊲z⊳∼v, which can
potentially help keeping the uniform rank of L∗ low. The same holds
for zi and zi+1 that are completely from the suffix v: they
belong to the same block of v. Having words zi that are
completely from u interspersed with other types of words zi (for
example, having all odd-numbered zi completely from u and all
even-numbered are completely from v), in contrast, is not
helpful. It could thus be useful to be able to choose z, n and
z1…,zn in such a way that as many as possible of the zi
that are completely from u are adjacent in z for all splits of w
of as w=uv.
For example, take Σ=df{a,b}, aIb and
L=dfΣ=[[a+b]]. For w=dfambm∈[L∗]I, we
could build z=ambm∈L∗ from n=df2m, zi=dfa for
1≤i≤m and zi=dfb for m+1≤i≤2m. Another
option is to construct z=(ab)m from n=df2m,
z2i−1=dfa and z2i=dfb for 1≤i≤m. In the
first case, the letters from u stay together in z for all prefixes
u of w (as w=z). In the second case, they can be interleaved
with the letters from v (in the most extreme case u=dfam and
v=dfbm, the words u and v get scattered into m resp. m+1 blocks in z). Note that, when zi∼Ivi and
zi+1∼Iui+1, then ziIzi+1. The next lemma says
that, for given z, n, z1,…,zn, the sequence of words
z1,…,zn can be permuted into z1′,…,zn′ with
z1…zn∼Iz1′…zn′ so that, if zi′ is
completely from u, then zi−1′ is not completely from v. As
zi∈L for all i, it is of course the case that
z′=dfz1′…zn′∈L∗, so z′ is as good a witness of
w∈[L∗]I as z.
Lemma 5.15**.**
Let
w,u,v,z1,…,zn be words such that w=uv,
w∼Iz1…zn, and each zi is nonempty and
connected.
There exists a permutation σ′=z1′,…,zn′ of
σ=dfz1,…,zn with the following properties:
-
z1…zn∼Iz1′…zn′;
2. 2.
for
any u′,v′ such that u=u′v′, and for any
u1,…,un,v1,…vn such that
u′∼Iu1…un, v′v∼Iv1…vn, for all i,
zi′∼Iuivi, and, for all j<i, vjIui, we have: if
vi=ε, then
ui−1=ε unless i=1.
Proof 5.16**.**
By induction on u.
Case ε: The identical permutation σ′=dfσ
has property 1 trivially. It also enjoys property 2 since
ε=u′v′ implies u′=v′=ε, and, for all i, we have
zi∼Iuivi, zi=ε, ui=ε and hence
vi=ε.
Case ua: By induction hypothesis, we have a permutation
σ′=z1′,…,zn′ of σ which has property 1
and and also has property 2 for all prefixes u′ of w up to
u. Now consider the case where u′=dfua and
v′=dfε. This particular a is in one of the
zi′, say zm′. The only difference with the
case u′=dfu and v′=dfa is that this a is now in the
u′ part of zm′ and no longer in the v′v part. Let
us also note that every nonempty ui has remained
nonempty.
If vm=ε, then the empty vi
are exactly the same as in the case u′=dfu. Hence σ′
has property 2 also for the prefix u′=dfua.
If vm=ε, but m=1 or
um−1=ε, then σ′ has property 2
also for the prefix u′=dfua.
*In the critical case vm=ε, m=1 and
um−1=ε, we construct a new permutation
σ′′=dfz1′′,…,zn′′ from σ′ by moving the
words zm′,…,zl′ (where l is the largest such that
vm…vl=ε) in front of of zk′,…,zm−1′
(where k is the smallest such that
uk…um−1=ε). Moving all these words rather
than just zm alone ensures that the new permutation σ′′
has property 2 also for all prefixes u′ up to u′=u and not
just only for the prefix u′=ua. The new permutation
σ′′ also has property 1: indeed, we have
z1…zn∼Iz1′…zn′∼Iz1′′…zn′′
as
zk′…zm−1′∼Ivk…vm−1\leavevmode I\leavevmode um…ul∼Izm′…zl′.
*
Proposition 5.17**.**
If E is star-connected, then the language [[E]] has uniform rank.
Proof 5.18**.**
By induction on E. We only look at the case E∗.
Case E∗: From the assumption we have that E is
star-connected and [[E]] is connected. By induction hypothesis
[[E]] has uniform rank at most N for some N∈N. We show that [[E∗]]
has uniform rank at most (∣Σ∣+1)N.
Let w∈[[E∗]]I. Then there exist unique n and
w1,…,wn such that
w∈w1⋅I…⋅Iwn, wi∈[[E]]I, and we
can also require that wi=ε. By [[E]] having
uniform rank at most N, for every i, there exists a nonempty
word zi∈[[E]] such that, for any split of wi as uivi,
we have ui∼⊲Nzi⊳∼vi. By connectedness of [[E]],
all zi are connected.
We take z∘=dfz1∘…zn∘ where
σ∘=dfz1∘,…,zn∘ is the permutation of
σ=z1,…,zn obtained by Lemma 5.15
for u=dfw and v=dfε, i.e., for the specific split of
w as wε. By Lemma 5.15(1), we have
w∼Iw1…wn∼Iz1…zn∼Iz1∘…zn∘=z∘.
We let w1∘,…,wn∘ be the corresponding permutation
of w1,…,wn, so we also have
w∼Iw0∘…wn∘ and wi∘∼Izi∘ for
all i.
We will now show that, for any split of w as w=uv, we have
u∼⊲(∣Σ∣+1)Nz∘⊳∼v.
Let w=uv be any split of w. There exist unique
u1,…,un,v1,…vn such u∼Iu1…un,
v∼Iv1…vn, for all i, wi∘=uivi, and for
all j<i, vjIui. They give us
u1…un⊲z∘⊳v1…vn and thus
u∼⊲z∘⊳∼v. By Lemma 5.15(2) for
u′=dfu, v′=dfε, we have that vi=ε
implies ui−1=ε unless i=1. By
Lemma 5.13, there can be at most ∣Σ∣
words zi∘ such that both ui=ε and vi=ε.
Each of these two-colored zi∘ contributes at most N to the
degree of u∼⊲z∘⊳∼v, so altogether they contribute at
most ∣Σ∣N.
Between any two-colored zi∘ and also before the first and
after the last one of them, there are some zi∘ completely from
u followed by some zi∘ completely from v. Each such
sequence contributes at most 1 to the degree of
u∼⊲z∘⊳∼v. If there are less than ∣Σ∣ two-colored
words, these sequences thus contribute altogether at most ∣Σ∣
to the degree. If there are exactly ∣Σ∣ two-colored words
zi∘, then the zi∘ after the last of them are all
completely from v, so their sequence belongs to the last v-block
generated by the last two-colored zi∘ and thus contributes 0. Again
altogether these sequences contribute at most ∣Σ∣.
*Altogether the degree of u⊲z∘⊳v is thus at most
(∣Σ∣+1)N. *
6 Antimirov Reordering Derivative and Uniform Rank
We have seen that the reordering language derivative DuIL allows
u to be scattered in a word z∈L as
u1,…,un⊲z⊳v0,…,vn where
u∼Iu1…un. We will now consider a version of the
Antimirov reordering derivative operation that delivers lists of
regexps for the possible v0,…,vn rather than just single
regexps for their concatenations v0…vn.
6.1 Refined Antimirov Reordering Derivative
The refined reordering parts-of-derivative of a regexp E along a
letter a are pairs of regexps El,Er. For any word
w=av∈[[E]]I, there must be an equivalent word
z=vlavr∈[[E]]. Instead of describing the words vlvr
obtainable by removing a minimal occurrence of a in a word
z∈[[E]], the refined parts-of-derivative describe the subwords
vl,vr that were to the left and right of this a in z: it must
be the case that vl∈[[El]] and vr∈[[Er]] for one of
the pairs El,Er. For a longer word u, the refined reordering
derivative operation gives lists of regexps E0,…,En fixing
what the lists of subwords v0,…,vn can be in words
z=v0u1v1…unvn∈[[E]] equivalent to a given word
w=uv∈[[E]]I.
Definition 6.1**.**
The (unbounded and bounded) refined Antimirov I-reordering
parts-of-derivatives of a regexp along a letter and a word are given
by relations
→I⊆RE×Σ×RE×RE,
⇒I⊆RE+×Σ×RE+,
→I∗⊆RE×Σ∗×RE+,
⇒NI⊆RE+≤N+1×Σ×RE+≤N+1, and
→NI∗⊆RE×Σ∗×RE+≤N+1
defined inductively by
[TABLE]
[TABLE]
[TABLE]
By RE+≤N+1 we mean nonempty lists of regexps of length at
most N+1. The relations ⇒I and →I∗ are defined
exactly as ⇒NI and →NI∗ but with the condition
∣Γ,Δ∣<N of the first rule of ⇒NI
dropped. The operation RaI is extended to lists of regexps in the
obvious way.
We have several rules for deriving a list of regexps along a. If E is split into El,Er and neither of them is nullable, then,
in the N-bounded case, we require that the given list is shorter
than N+1 since the new list will be longer by 1. If one of
El,Er is nullable, not the first resp. last in the list and we
choose to drop it, then the new list will be of the same length. If
both are nullable, not the first resp. last and we opt to drop both,
then the new list will be shorter by 1. They must be droppable under
these conditions to handle the situation when a word z has been
split as v0u1v1…ukvkuk+1…unvn and vk is
further being split as vlavr while vl or vr is empty. If
k=0 and vl is empty, we must join uk and a into
uka. If k=n and vr is empty, we must join a and
uk+1 into auk+1. If k is neither [math] nor n and both
vl and vr are empty, we must join all three of uk, a and
uk+1 into ukauk+1. The length of the new list of regexps
is always at least 2.
Proposition 6.2**.**
For any E,
-
for any a∈Σ,vl,vr∈Σ∗,
[TABLE]
2. 2.
for any u∈Σ∗,n∈N,v0∈Σ∗,v1,…,vn−1∈Σ+,vn∈Σ∗,
[TABLE]
Proof 6.3**.**
-
⟹: By induction on E.
Case a′ where a′=a: vlavr∈[[a′]]={a′}
is impossible.
Case a: Suppose vlavr∈[[a]]={a}. Then
vl=vr=ε. We have a→I(a;1,1) and
ε∈[[1]] as required.
Case [math]: vlavr∈[[0]]=∅
is impossible.
Case E1+E2: Suppose
vlavr∈[[E1+E2]]=[[E1]]∪[[E2]] and
vlIa. Then vlavr∈[[Ei]] for one of two possible
i. By IH for Ei,a,vl,vr, there are El, Er such that
Ei→I(a;El,Er), vl∈[[El]], vr∈[[Er]]
and we also obtain E1+E2→I(a;El,Er).
Case 1: vlavr∈[[1]]=1
is impossible.
Case EF: Suppose
vlavr∈[[EF]]=[[E]]⋅[[F]] and vlIa.
Then vlavr=xy for some x∈[[E]] and y∈[[F]].
Either (i) there exists v′ such that x=vlav′ and
vr=v′y or (ii) there exists v′ such that y=v′avr and
vl=xv′.
If (i), then, by IH for E,a,vl,v′, there are El,Er such
that E→I(a;El,Er), vl∈[[El]],
v′∈[[Er]]. We then also have EF→I(a;El,ErF)
and vr=v′y∈[[ErF]].
If (ii), then xIa and v′Ia, so x∈[[RaIE]] and, by
IH for F,a,v′,vr, there are Fl,Fr such that
F→I(a;Fl,Fr), v′∈[[Fl]], vr∈[[Fr]].
We then also have EF→I(a;(RaIE)Fl,Fr) and
vl=xv′∈[[(RaIE)Fl]].
Case E∗: Suppose vlavr∈[[E∗]] and vlIa.
Then vl=xvl′, vr=vr′y for some x,y∈[[E∗]] and
vl′,vr′ such that vl′avr′∈[[E]]. We have xIa,
vl′Ia. Hence x∈[[RaIE∗]] and, by IH for
E,a,vl′,vr′, we get that there are El, Er such that
E→I(a;El,Er) and vl′∈[[El]],
vr′∈[[Er]]. We also obtain
vl=xvl′∈[[(RaIE∗)El]] and
vr=vr′y∈[[ErE∗]].
⟸: By induction on the derivation of E→I(a;El,Er).
Case a→I(a;1,1) as an axiom: Suppose
vl,vr∈[[1]]=1. Then vl=vr=ε and
we have εaε=a∈[[a]] as required.
Case E1+E2→I(a;El,Er) inferred from
Ei→I(a;El,Er) where i is 1 or 2: Suppose
vl∈[[El]], vr∈[[Er]]. We can then apply IH to
the subderivation, vl,vr and obtain that vlIa and vlavr∈[[Ei]], which gives us
also that
vlavr∈[[E1]]∪[[E2]]=[[E1+E2]].
Case EF→I(a;El,ErF) inferred from
E→I(a;El,Er): Suppose vl∈[[El]],
vr∈[[ErF]]=[[Er]]⋅[[F]]. Then vr=xy
for some x∈[[Er]] and y∈[[F]]. We can then apply IH
to the subderivation, vl,x and obtain that vlIa and
vlax∈[[E]]. As vr=xy, we obtain
vlavr=(vlax)y∈[[E]]⋅[[F]]=[[EF]].
Case EF→I(a,(RaE)Fl,Fr) inferred from
F→I(a;Fl,Fr): Suppose
vl∈\linebreak[[(RaE)Fl]]=Ra[[E]]⋅[[Fl]],
vr∈[[Fr]]. Then vl=xy for some x∈Ra[[E]]
and y∈[[Fl]], which also gives us xIa and
x∈[[E]]. We can then apply IH to the subderivation, y,vr
and obtain that yIa and yavr∈[[F]]. As vl=xy, we
get vlIa and
vlavr=x(yavr)∈[[E]]⋅[[F]]=[[EF]].
Case E∗→I(a;(RaE∗)El,ErE∗) inferred from
E→I(a;El,Er): Suppose
vl∈[[(RaE∗)El]]=Ra[[E∗]]⋅[[El]],
vr∈[[ErE∗]]=[[Er]]⋅[[E∗]]. Then
vl=xy for some x∈Ra[[E∗]] and y∈[[El]],
which also gives us xIa and x∈[[E∗]], and vr=zw
for some z∈[[Er]] and w∈[[E∗]]. We can then apply
IH to the subderivation, y,z and obtain that yIa and
yaz∈[[E]]. As vl=xy and vr=zw, we get that
vlIa and
vlavr=x(yaz)w∈[[E∗]]⋅[[E]]⋅[[E∗]]⊆[[E∗]].
2. 2.
⟹: For any E by induction on u.
Case ε: Suppose ε∼Iu1…un and
z=v0u1v1…unvn∈[[E]]. Then necessarily n=0, which
means that we actually have v0∈[[E]]. We also have
E→I∗(ε;E) as required.
Case ua: Suppose ua∼Iu1…un and
∀i.∀j<i.vjIui and
z=v0u1v1…unvn∈[[E]]. It must be that n>0 and
there must exist k and ul,ur∈Σ∗ such that
uk=ulaur, vjIa for all j<k, aIur,
aIui for all i>k and
u∼Iu1…uk−1uluruk+1…un.
If ul=ur=ε, then, as vk−1avkIui for all i>k,
we are entitled to apply IH to u, n−1,
v0,v1,…,vk−2,vk−1avk,vk+1,…,vn, z,
u1,…,uk−1,uk+1,…,un. We get
E0,…,Ek−2, E′, Ek+1, …En* such that
E→I∗(u;E0,…,Ek−2,E′,Ek+1,…,En) and
vj∈[[Ej]] for all j<k−1, vk−1avk∈[[E′]],
vj∈[[Ej]] for all j>k. As vk−1Ia, we can apply
- to E′, a, vk−1, vk and get Ek−1,Ek such that E′→I(a;Ek−1,Ek), vk−1∈[[Ek−1]] and
vk∈[[Ek]]. This allows us to infer E→I∗(ua;RaIE0,…,RaIEk−2,Ek−1,Ek,Ek+1,…,En).
As vjIa also for all j<k−1, we in fact also have
vj∈[[RaIEj]] for all j<k−1.*
*If ul=ε, ur=ε, we note that avkIui for all
i>k and apply IH to u, n,
v0, v1,…,vk−1, avk,vk+1,…,vn, z,
u1,…,uk−1,ul,uk+1,…,un. We get E0,…,Ek−1, E′, Ek+1,…En such that
E→I∗(u;E0,…,Ek−1,E′,Ek+1,…,En) and
vj∈[[Ej]] for all j<k, avk∈[[E′]],
vj∈[[Ej]] for all j>k. As εIa, we can apply
- to E′, a, ε, vk and get E′′,Ek such that
E′→I(a;E′′,Ek), ε∈[[E′′]], vk∈[[Ek]]. As ε∈[[E′′]] tells us that E′′↓,
we can infer
E→I∗(ua;RaIE0,…,RaIEk−1,Ek,Ek+1,…,En).
As vjIa also for all j<k, we in fact also have
vj∈[[RaIEj]] for all j<k.*
The cases ul=ε, ur=ε and ul=ε,
ur=ε are handled similarly to the previous case.
⟸: By induction on the derivation of
E→I∗(u;E0,…,En).
Case E→I∗(ε;E) as an axiom: Suppose that
v0∈[[E]]. We have ε∼ε as well as
z=v0∈[[E]] directly.
Case
E→I∗(ua;RaIE0,…,RaIEk−1,El,Er,Ek+1,…,En)
inferred from subderivations E→I∗(u;E0,…,En) and
Ek→I(a;El,Er): Suppose that v0∈[[RaIE0]],
…, vk−1∈[[RaIEk−1]], vl∈[[El]],
vr∈[[Er]], vk+1∈[[Ek+1]], …,
vn∈[[En]], which gives us v0Ia,
…, vk−1Ia, v0∈[[E0]], …,
vk−1∈[[Ek−1]]. Applying (1.⟸) to
Ek, a, vl, vr, we learn that vlIa and
vlavr∈[[Ek]]. Applying IH to the subderivation,
v0,…,vk−1, vlavr, vk+1,…,vn, we obtain
z,u1,…,un∈Σ+ such that
u∼Iu1…un,
∀i.∀j<i. vjIui,
∀i>k.vlavrIui and
z=v0u1v1…vk−1uk(vlavr)uk+1vk+1…unvn∈[[E]].
Clearly ua∼Iu1…ukauk+1…un and
z=v0u1v1…vk−1ukvlavruk+1vk+1…unvn∈[[E]].
Case
E→I∗(ua;RaIE0,…,RaIEk−1,Er,Ek+1,…,En)
inferred from subderivations E→I∗(u;E0,…,En) and
Ek→I(a;El,Er) and El↓ whereby k=0:
Suppose that v0∈[[RaIE0]],
…, vk−1∈[[RaIEk−1]],
vr∈[[Er]], vk+1∈[[Ek+1]], …,
vn∈[[En]], which gives us v0Ia,
…, vk−1Ia, v0∈[[E0]], …,
vk−1∈[[Ek−1]]. Applying (1.⟸) to
E, a, ε, vr, we learn that
avr∈[[Ek]]. Applying IH to the subderivation,
v0,…,vk−1, avr, vk+1,…,vn,
we obtain z,u1,…,un∈Σ+ such
that u∼Iu1…un,
∀i.∀j<i. vjIui, ∀i>k.avrIui and
z=v0u1v1…vk−1uk(avr)uk+1vk+1…unvn∈[[E]]. Now clearly
ua∼Iu1…(uka)uk+1…un and
z=v0u1v1…vk−1(uka)vruk+1vk+1…unvn∈[[E]].
The two remaining cases are treated similarly to the previous case.
Proposition 6.4**.**
For any E,
-
for any a∈Σ,v∈Σ∗, the following are equivalent:
- (a)
av∈[[E]]I;
2. (b)
∃vl,vr∈Σ∗.v∼Ivlvr∧vlIa∧vlavr∈[[E]];
3. (c)
∃vl,vr∈Σ∗.v∼Ivlvr∧∃El,Er.E→I(a;El,Er)∧vl∈[[El]]∧vr∈[[Er]];
4. (d)
∃vl,vr∈Σ∗.v∈vl⋅Ivr∧∃El,Er.E→I(a;El,Er)∧vl∈[[El]]I∧vr∈[[Er]]I.
2. 2.
for any u,v∈Σ∗, the following are equivalent:
- (a)
uv∈[[E]]I;
2. (b)
∃z∈[[E]]. u∼⊲z⊳∼v;
3. (c)
∃n∈N,v0∈Σ∗,v1,…,vn−1∈Σ+,vn∈Σ∗.v∼Iv0v1…vn∧∃E0,…,En.E→I∗(u;E0,…,En)∧∀j.vj∈[[Ej]];
4. (d)
∃n∈N,v0∈Σ∗,v1,…,vn−1∈Σ+,vn∈Σ∗.v∈v0⋅Iv1⋅I…⋅Ivn∧∃E0,…,En.E→I∗(u;E0,…,En)∧∀j.vj∈[[Ej]]I.
3. 3.
*for any u∈Σ∗, *
* u∈[[E]]I⟺(u=ε∧E↓)∨(u=ε∧∃E0,E1.E→I∗(u;E0,E1)∧E0↓∧E1↓).*
Proof 6.5**.**
-
(a) ⟺ (b) follows from Proposition 3.6.
(b) ⟺ (c) follows from Proposition 6.2(1).
(c) ⟺ (d) follows from Proposition 3.10.
2. 2.
(a) ⟺ (b) follows from Proposition 3.6.
(b) ⟺ (c) follows from Proposition 6.2(2).
(c) ⟺ (d) follows from Proposition 3.10.
3. 3.
From (2) for E,u,ε.
Proposition 6.6**.**
For any E, N∈N, u∈Σ∗, z∈[[E]],
[TABLE]
Proof 6.7**.**
By replaying the proof of
Proposition 6.2(2.⟹). In the fourth subcase
(ul=ε, ur=ε) of the case ua of induction, IH
for u′=u, u′′=a is needed.
Corollary 6.8**.**
For any E such that [[E]] has uniform rank at most N,
-
for any
u,v∈Σ∗, the following are equivalent:
- (a)
uv∈[[E]]I;
2. (b)
∃z∈[[E]]. ∀u′,u′′.u=u′u′′⟹u′∼⊲Nz⊳∼u′′v;
3. (c)
∃n≤N,v0∈Σ∗,v1,…,vn−1∈Σ+,vn∈Σ∗.v∼Iv0v1…vn∧∃E0,…,En.E→NI∗(u;E0,…,En)∧∀j.vj∈[[Ej]];
4. (d)
∃n≤N,v0∈Σ∗,v1,…,vn−1∈Σ+,vn∈Σ∗.v∈v0⋅Iv1⋅I…⋅Ivn∧∃E0,…,En.E→NI∗(u;E0,…,En)∧∀j.vj∈[[Ej]]I.
2. 2.
*for any u∈Σ∗, *
* u∈[[E]]I⟺(u=ε∧E↓)∨(u=ε∧∃E0,E1.E→NI∗(u;E0,E1)∧E0↓∧E1↓).*
Proof 6.9** (Proof of 1).**
(a) ⟹ (b) is from E having uniform rank at most N. (b)
⟹ (c) follows from Proposition 6.6. (c)
⟹ (d) and (d) ⟹ (a) are those from Proposition
6.4.
Example 6.10**.**
We go back to Example 4.11. Recall that E=dfaa+ab+b and Eb=dfRbIE=aa+a0+0. Here is one of the refined reordering parts-of-derivatives of E∗ along bb.
[TABLE]
In this example, we chose N=df2. The regexp
1(Eb∗(a1))≐(aa)∗a is not nullable, so we could not have
dropped it. From here we cannot continue by deriving along a third b
by again taking it from the summand ab of E in 1E∗, as this
would produce another nondroppable 1(Eb∗(a1)) and make the list
too long (longer than 3). For example, we are not allowed to establish
w=dfbbbaaa∈[[E∗]]I (by deriving E∗ along w and
checking if we can arrive at E0,E1 with both E0,E1
nullable), mandated by z=dfababab∈[[E∗]], but we are
allowed to do so because of z′=dfbbabaa∈[[E∗]].
The word z is not useful since among the splits of w as w=uv
there is u=dfbbb, v=dfaaa, which splits z as
u∼⊲z⊳∼v scattering u into 3 blocks as
z=ababab (we underline the
letters from u); the full sequence of these corresponding splits of
z is ababab, ababab,
ababab,
ababab,
ababab,
ababab, ababab.
The word z′, on the contrary, is fine because, for every split of
w as w=uv, there are at most two blocks of letters from u in
z′: bbabaa, bbabaa, bbabaa,
bbabaa, bbabaa,
bbabaa, bbabaa. The choice N=2
suffices for accepting all of [[E∗]]I, since [[E∗]] happens
to have uniform rank 2.
The refined Antimirov reordering parts-of-derivatives of a regexp E
give a nondeterministic automaton by
QE=df{Γ∣∃u∈Σ∗.E→I∗(u;Γ)},
IE=df{E},
FE=df{E∣E↓}∪{E0,E1∈QE∣E0↓∧E1↓},
Γ→E(a;Γ′)=dfΓ⇒I(a;Γ′)
for Γ,Γ′∈QE. By Prop. 6.4, this
automaton accepts [[E]]I. It is generally not finite as QE can
contain states Γ of any length.
Given N∈N, another automaton is obtained by restricting
QE, FE and →E to
QNE=df{Γ∣∃u∈Σ∗.E→NI∗(u;Γ)},
FNE=df{E∣E↓}∪{E0,E1∈QNE∣E0↓∧E1↓},
Γ→NE(a;Γ′)=dfΓ⇒NI(a;Γ′)
for Γ,Γ′∈QNE. By Cor. 6.8, if
[[E]] has uniform rank at most N, then this smaller automaton
accepts [[E]]I despite the truncation. If [[E]] does not have
uniform rank or we choose N smaller than the uniform rank, then the
N-truncated automaton recognizes a proper subset of
[[E]]I. Prop. 5.7 gives an example of
this: however we choose N, the N-truncated automaton fails to
accept the word anbncanbn for n>N. This happens because
[[E]] does not have uniform rank (and that it has rank 2 does not
help).
6.2 Automaton Finiteness for Regular Expressions with Uniform Rank
Is the N-truncated Antimirov automaton finite? The states Γ
of QNE are all of length at most N+1, so there is hope. The
automaton will be finite if we can find a finite set containing all
the individual regexps E′ appearing in the states Γ. We now
define such a set E→∗.
Definition 6.11**.**
We define functions
(_)⇝+,R,(_)→+,(_)→∗:RE→PRE by
[TABLE]
[TABLE]
Proposition 6.12**.**
-
For any E, the set E→∗ is finite.
2. 2.
For any E and X, we have (RXIE)→∗⊆RXI(E→∗).
3. 3.
For any E, a and El,Er, if
E→I(a;El,Er), then El∈RaI(E⇝+) and
Er∈E⇝+.
4. 4.
*For any E,E′,X,a,El′,Er′, if E′∈RXI(E⇝+) and
E′→I(a;El′,Er′), *
then El′∈RXaI(E⇝+) and
Er′∈RXI(E⇝+).
5. 5.
*For any E, u and E0,…,En, if E→I∗(u;E0,…,En), then
∀j.Ej∈E→∗.
*
Proposition 6.13**.**
For every E and N, the state set
{Γ∣∃u∈Σ∗.E→NI∗(u;Γ)}
of the N-truncated refined Antimirov automaton for E
(accepting [[E]]I if [[E]] has uniform rank at most N)
is finite.
7 Related Work
Syntactic derivative constructions for regular expressions extended
with constructors for (versions of) the shuffle operation have been
considered, for example, by Sulzmann and Thiemann [23]
for the Brzozowski derivative and by Broda et al. [6]
for the Antimirov derivative. This is relevant to our derivatives
since L⋅IL′ is by definition a language between L⋅L′
and L⊔⊔L′. Thus our Brzozowski and Antimirov reordering
derivatives of EF must be between the classical Brzozowski and
Antimirov derivatives of EF and E⊔⊔F.
8 Conclusion and Future Work
We have shown that the Brzozowski and Antimirov derivative operations
generalize to trace closures of regular languages in the form of
reordering derivative operations. The sets of Brzozowski resp. Antimirov reordering (parts-of-)derivatives of a regexp are generally
infinite, so the deterministic and nondeterministic automata that they
give, accepting the trace closure, are generally infinite. Still, if
the regexp is star-connected, their appropriate quotients are
finite. Also, the set of N-bounded refined Antimirov reordering
parts-of-derivatives is finite without quotienting, and we showed
that, if the language of the regexp has uniform rank at most N, the
N-truncated refined Antimirov automaton accepts the trace
closure. We also proved that star-connected expressions define
languages with finite uniform rank.
In summary, we have established the following picture.
[TABLE]
Our intended application of
reordering derivatives is operational semantics in the
context of relaxed memory (where, e.g., shadow writes, i.e., writes
from local buffers to shared memory, can be reorderable with other
actions). For sequential composition EF it is usually required that,
to execute any action from F, execution of E must have
completed. In the jargon of derivatives, this is to say that for an
action from F to become executable, what is left of E has to have
become nullable (i.e., one can consider the execution of E
completed). With reordering derivatives, we can execute an action from
F successfully even when what is left of E is not nullable. It
suffices that some sequence of actions to complete the residual of E
is reorderable with the selected action of F.
In the definitions of the derivative
operations we only use I in one direction, i.e., we do not make use
of its symmetry. It would be interesting to see if our results can
be generalized to the setting of semi-commutations [8]
and which changes are required for that.