This paper presents a simpler, explicit algorithm for deciding bisimulation equivalence of first-order grammars, which subsumes previous results for deterministic pushdown automata and may allow for complexity analysis.
Contribution
It offers a new, more straightforward proof of decidability for bisimulation equivalence, providing an explicit algorithm rather than semidecision procedures.
Findings
01
Decidability of bisimulation equivalence for first-order grammars established
02
Provides an explicit algorithm potentially suitable for complexity analysis
03
Simplifies previous proofs by Sénizergues for deterministic pushdown automata
Abstract
A decidability proof for bisimulation equivalence of first-order grammars is given. It is an alternative proof for a result by S\'enizergues (1998, 2005) that subsumes his affirmative solution of the famous decidability question for deterministic pushdown automata. The presented proof is conceptually simpler, and a particular novelty is that it is not given as two semidecision procedures but it provides an explicit algorithm that might be amenable to a complexity analysis.
Tables1
Table 1. Table 1: Small upper bounds determined by a given grammar
𝒢 𝒢 \mathcal{G}
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Full text
Equivalence of pushdown automata via first-order grammars
Petr Jančar
Dept of Computer Science, Faculty of Science, Palacký
University in Olomouc,
Czechia
A decidability proof for bisimulation
equivalence of first-order grammars is given. It is an alternative proof for
a result by Sénizergues (1998, 2005) that subsumes his affirmative solution
of the famous decidability question for deterministic pushdown
automata.
The presented proof is conceptually simpler,
and a particular novelty is that it is not given as two
semidecision procedures but it provides an explicit algorithm that
might be amenable to a complexity analysis.
1 Introduction
Decision problems for semantic equivalences
have been a frequent topic in computer science.
For pushdown automata (PDA)
language equivalence was quickly shown undecidable,
while
the decidability in the case of deterministic PDA (DPDA)
is
a famous result
by Sénizergues [1].
A finer equivalence, called bisimulation equivalence or
bisimilarity, has emerged as another fundamental behavioural
equivalence [2]; for deterministic systems it essentially coincides with
language equivalence.
By [3] we can exemplify the
first decidability results for infinite-state systems (a subclass of
PDA, in fact),
and
refer to [4] for a survey of results in a relevant area.
One of the most involved results in this area
shows the decidability of bisimilarity
of equational graphs with finite out-degree, which are equivalent
to PDA with alternative-free ε-steps (if an ε-step is enabled, then it has no alternative);
Sénizergues [5] has thus generalized his
decidability result for DPDA.
We recall that the complexity of the DPDA problem remains
far from clear, the problem is known to be
PTIME-hard and to be in TOWER
(i.e., in the first complexity class beyond elementary
in the terminology of [6]); the upper bound
was shown
by Stirling [7]
(and formulated more explicitly in [8]).
For PDA the bisimulation equivalence problem is known to be
nonelementary [9] (in fact, TOWER-hard),
even for real-time PDA, i.e. PDA with no ε-steps.
For the above mentioned PDA with alternative-free ε-steps
the
problem is even not primitive recursive;
its Ackermann-hardness was shown in [8].
The decidability proofs, both for DPDA and PDA, are involved and hard
to understand.
This paper aims to contribute to
a clarification of the more general decidability proof, showing an
algorithm deciding
bisimilarity of PDA with alternative-free ε-steps.
The proof is shown in the framework
of labelled transition systems generated by first-order
grammars (FO-grammars), which seems to be a particularly convenient
formalism; it is called term context-free grammars
in [10]. Here the states
(or configurations)
are first-order terms over a
specified finite set of function symbols (or “nonterminals”); the
transitions are induced by a first-order grammar, which is
a finite set
of labelled rules for rewriting the roots of terms.
This framework
is equivalent
to the framework of [5]; cf.,
e.g., [11, 10] and the
references therein, or also [12]
for a concrete transformation of PDA
to FO-grammars.
The proof here
is in principle based on the high-level ideas from the proof
in [5] but with various simplifications and new
modifications.
The presented proof has resulted by a thorough reworking of the
conference paper [13], aiming to get an
algorithm that might be amenable to a complexity analysis.
Proof overview. We give a flavour of the process that is
formally realized in the paper.
It is standard to characterize bisimulation equivalence (also called
bisimilarity) in terms of a
turn-based game between Attacker and Defender, say.
If two PDA-configurations, modelled by first-order terms E,F in our
framework, are non-bisimilar, then
Attacker can force his win within k rounds of the game, for some
number k∈N; in this case k−1 for the least such k can be
viewed as the equivalence-level\textscel(E,F) of terms E,F: we
write E∼k−1F and E∼kF.
If E,F are bisimilar, i.e. E∼F, then Defender has a winning strategy and we
put \textscel(E,F)=ω.
A natural idea is to search for a computable function f attaching
a number f(G,E,F)∈N to terms E,F
and a grammar G
so that it is guaranteed that \textscel(E,F)≤f(G,E,F) or \textscel(E,F)=ω; this immediately yields an
algorithm that computes \textscel(E,F) (concluding that
\textscel(E,F)=ω
when finding that \textscel(E,F)>f(G,E,F)).
We will show such a computable function f by analysing optimal plays
from E0∼F0; such an optimal play gives rise
to a sequence (E0,F0), (E1,F1), …, (Ek,Fk)
of pairs of terms where \textscel(Ei,Fi)=\textscel(Ei−1,Fi−1)−1
for i=1,2,…,k, and \textscel(Ek,Fk)=0 (hence
\textscel(E0,F0)=k).
This sequence is then suitably modified to yield a certain sequence
[TABLE]
such that
(E0′,F0′)=(E0,F0) and \textscel(Ei′,Fi′)=\textscel(Ei,Fi)
for all i=1,2,…,k; here we use simple congruence properties
(if E′ arises from E by replacing a subterm H with H′ such
that H∼kH′, then E∼kE′). Doing this modification
carefully, adhering to a sort of “balancing policy”
(inspired by one crucial ingredient
in [1, 5],
used also in [14])
we derive that if k is “large”,
then the sequence (1) contains a “long” subsequence
[TABLE]
called an
(n,s,g)-sequence, where the variables in all “tops”
Ej,
Fj are from the set {x1,…,xn}, σ is the
common “tail” substitution (maybe with “large” terms xiσ), and the size-growth of the
tops is bounded: \textscSize(Ej,Fj)≤s+g⋅(j−1) for
j=1,2,…,z. The numbers n,s,g are elementary in the size of the
grammar G.
Then another fact is used (whose analogues in
different frameworks
could be traced back to [1, 5] and other related
works):
if \textscel(E1,F1)=e<ℓ=\textscel(E1σ,F1σ),
then
there is i∈{1,2,…,n} and a term
H=xi reachable from E1 or
F1 within e moves (i.e. root-rewriting steps) such
that xiσ∼ℓ−eHσ.
This entails that for j=e+2,e+3,…,z
the tops
(Ej,Fj) in (2)
can be replaced with
(Ej[xi/H′],Fj[xi/H′]),
where H′ is the regular term
H[xi/H][xi/H][xi/H]⋯,
without changing the equivalence-level;
hence
\textscel(Ejσ,Fjσ)=\textscel(Ej[xi/H′]σ,Fj[xi/H′]σ).
Though H′ might be an infinite regular term, its natural graph
presentation is not larger than the presentation of H. Moreover,
xi does not occur in H′, and thus the term xiσ ceases to
play any role in the pairs
(Ej[xi/H′]σ,Fj[xi/H′]σ)
(j=e+2,e+3,…,z).
By continuing this reasoning inductively (“removing” one xiσ
in each of at most n phases), we note that the length of
(n,s,g)-sequences (2) is bounded by a (maybe
large) constant determined by the grammar G.
By a careful analysis we then show that such a constant is, in fact,
computable when a grammar is given.
Further remarks on related research.
Further work is needed to fully understand the bisimulation problems on
PDA and their subclasses, also regarding
their computational complexity.
E.g., even the case
of BPA processes, generated by real-time PDA with
a single control-state, is not quite clear.
Here the bisimilarity
problem is EXPTIME-hard [15] and in 2-EXPTIME [16]
(proven explicitly in [17]); for the subclass of normed BPA
the problem is polynomial [18]
(see [19] for the best published upper bound).
Another issue is the precise decidability border. This was also
studied in [20];
allowing that ε-steps can have alternatives
(though they are restricted to be stack-popping)
leads to undecidability of bisimilarity.
This aspect has been also refined, for
branching bisimilarity [21].
For second-order PDA the undecidability is established without
ε-steps [22].
We can refer to the survey
papers [23, 24]
for the work on higher-order PDA, and in particular
mention that the decidability of
equivalence of deterministic higher-order PDA remains open;
some progress in this direction was made by Stirling
in [25].
Finally we remark that recently (while this paper was under review)
the author cooperated with Sylvain Schmitz on developing a concrete
version of the algorithm suggested here, and its complexity analysis
has revealed an Ackermannian upper bound; with the lower bound
from [8] this yields the Ackermann-completeness of the studied equivalence
problem [26].
Organization of the paper.
After the preliminaries in Section 2 we state the main
theorem in Section 3. The theorem is proven in
Section 7, using the notions and results discussed
in Sections 4, 5,
and 6; each of these sections starts with an informal
summary.
2 Basic Notions and Facts
In this section we define basic notions and observe their simple
properties.
Some standard definitions are restricted
when we do not need full generality.
By N and N+ we denote the
sets
of nonnegative integers and of positive integers, respectively.
By [i,j], for i,j∈N, we denote the set {i,i+1,…,j}.
For a set A, by A∗ we denote the set of finite
sequences of elements of A, which are also called words
(over A).
By ∣w∣ we denote the
length of
w∈A∗, and
by ε the empty sequence;
hence ∣ε∣=0. We put
A+=A∗∖{ε}.
Labelled transition systems.
A labelled transition system, an LTS for short,
is a tuple
L=(S,Σ,(a)a∈Σ)
where S is a finite or countable
set of states,
Σ is a finite or countable
set of actions
and a⊆S×S is a set of
a-transitions (for each a∈Σ).
We say that L is
a deterministic LTS if for each pair
s∈S, a∈Σ there is
at most one s′ such that sas′ (which stands for
(s,s′)∈a).
By sws′, where
w=a1a2…an∈Σ∗,
we denote
that there is a paths=s0a1s1a2s2⋯ansn=s′;
the length of such a path is n, which is zero for the
(trivial) path sεs.
If sws′, then
s′ is reachable froms. By sw we denote that w is
enabled ins, or w is performable froms,
i.e., sws′ for some s′.
If L is deterministic, then the expressions
sws′ and sw also denote a unique path.
Bisimilarity, eq-levels.
Given L=(S,Σ,(a)a∈Σ),
a setD⊆S×Scovers(s,t)∈S×S if
for any sas′ there is tat′ such that
(s′,t′)∈D, and for any tat′ there is sas′
such that
(s′,t′)∈D.
For D,D′⊆S×S
we say that D′coversD if D′
covers each (s,t)∈D.
A set D⊆S×S
is a bisimulation if D covers D.
States s,t∈S are bisimilar,
written s∼t, if there is a bisimulation
D containing (s,t).
A standard
fact is that
∼⊆S×S is an equivalence relation,
and it is the largest
bisimulation, namely the union of all bisimulations.
We also
put ∼0=S×S, and define
∼k+1⊆S×S
(for k∈N)
as the set of pairs
covered by ∼k.
It is obvious that ∼k are equivalence relations, and
that ∼0⊇∼1⊇∼2⊇⋯⋯⊇∼.
For the (first limit) ordinal ω we put
s∼ωt if s∼kt for all k∈N; hence
∼ω=⋂k∈N∼k.
We will only consider image-finite LTSs, where
the set {s′∣sas′} is finite for each
pair s∈S, a∈Σ.
In this case
⋂k∈N∼k is a bisimulation
(for each (s,t)∈⋂k∈N∼k and sas′,
in the finite set {t′∣tat′}
there must be one t′ such that
s′∼kt′ for infinitely many k, which entails
(s′,t′)∈⋂k∈N∼k),
and thus ∼=⋂k∈N∼k=∼ω.
To each pair of states s,t
we attach their equivalence level (eq-level):
\textscel(s,t)=max{k∈N∪{ω}∣s∼kt}.
Hence \textscel(s,t)=0 iff {a∈Σ∣sa}={a∈Σ∣ta} (i.e., s and t enable different sets of
actions).
The next proposition captures a few additional simple facts;
we should add that we handle ω as an infinite amount,
stipulating ω>n and ω+n=ω−n=ω for all n∈N.
Proposition 1**.**
If \textscel(t,t′)>\textscel(s,t), then
\textscel(s,t)=\textscel(s,t′).
2. 2.
If ω>\textscel(s,t)>0, then there is either a transition
sas′ such that for all transitions tat′ we have
\textscel(s′,t′)≤\textscel(s,t)−1, or
a transition
tat′ such that for all transitions sas′ we have
\textscel(s′,t′)≤\textscel(s,t)−1.
3. 3.
If ∣w∣≤\textscel(s,t) and sws′, then
twt′ for t′ such that \textscel(s′,t′)≥\textscel(s,t)−∣w∣.
Proof.
If s∼kt, s∼k+1t, and t∼k+1t′, then
s∼kt′ and s∼k+1t′.
The points 2 and 3 trivially follow from the definition of ∼k
(for k∈N∪{ω}).
∎
We will consider LTSs
in which the states
are
first-order regular terms.
The terms are built from variables
taken from a fixed countable set
[TABLE]
and from
function symbols, also called (ranked) nonterminals,
from some specified finite set N; each A∈N has
arity(A)∈N.
We reserve symbols A,B,C,D to range over nonterminals, and
E,F,G,H,T,U,V,W
to range over
terms.
An example of a finite term is E1=A(D(x5,C(x2,B)),x5,B),
where the arities of nonterminals A,B,C,D are 3,0,2,2,
respectively.
Its syntactic tree is depicted on the left of Fig.1.
We identify terms with their syntactic trees.
Thus a term overN is (viewed as) a rooted, ordered, finite or infinite tree where each node
has a label from N∪\textscVar; if the label of a node is x∈\textscVar,
then the node has no successors, and if the label is A∈N, then
it has m (immediate) successor-nodes where m=arity(A).
A subtree of a term
E is also called a
subterm of E. We make no difference between isomorphic
(sub)trees, and thus a subterm can have more (maybe infinitely
many) occurrences in E. Each subterm-occurrence has
its (nesting) depth inE, which is its (naturally defined)
distance from the root of E.
E.g., C(x2,B) is a depth-2 subterm of E1; x5 is a subterm
with a depth-1 and a depth-2 occurrences.
We also use the standard notation for terms:
we write E=xi or E=A(G1,…,Gm) with the obvious meaning; in
the latter case \textscroot(E)=A∈N, m=arity(A), and
G1,…,Gm are the ordered depth-1 occurrences of subterms of
E, which are also called the root-successors in E.
A term is finite if the respective tree is finite.
A (possibly infinite) term is regular
if it has only finitely many subterms (though the subterms may be infinite and
may have infinitely many occurrences).
We note that any regular term has at least one graph
presentation, i.e. a finite directed graph with a designated root,
where each node has a
label from N∪\textscVar; if the label of a node is x∈\textscVar,
then the node has no outgoing arcs, if the label is A∈N,
then it has m
ordered outgoing arcs where m=arity(A).
We can see an example of such a graph presenting a term E3 on the right in
Fig. 1.
The standard tree-unfolding of the
graph is the respective term, which is infinite if there are cycles in
the graph. There is a bijection between
the nodes in the least graph presentation of E
and (the roots of) the subterms of E.
Sizes, heights, and variables of terms.
By \textscTermsN we denote the set of all regular terms over N
(and Var); we do not consider non-regular terms.
By a “term” we mean a general regular term unless the context makes
clear that the term
is finite.
By \textscSize(E) we mean the number of nodes
in the least graph presentation of E. E.g., in
Fig.1\textscSize(E1)=6 (E1 has six subterms)
and \textscSize(E3)=5.
By \textscSize({E1,E2,…,En})
we mean the number of nodes
in the least graph presentation
in which
a distinguished node \textscri corresponds to the (root
of the) term Ei, for each i∈[1,n].
(Since E1,E2,…,En can share some subterms, \textscSize({E1,E2,…,En})
can be smaller than
∑i∈[1,n]\textscSize(Ei).)
We usually write \textscSize(E,F) instead of \textscSize({E,F}).
E.g., \textscSize(E1,E2)=9 in Fig. 1.
For a finite term E we define 0pt(E) as the maximal depth of a
subterm; e.g., 0pt(E1)=3 in Fig.1.
We put \textscvar(E)={x∈\textscVar∣x occurs in E} and
\textscvar(E,F)={x∈\textscVar∣x occurs in E or F}.
E.g., \textscvar(E1,E2)={x2,x5} in Fig.1.
Substitutions, associative composition, iterated
substitutions.
A substitutionσ is a mapping
σ:\textscVar→\textscTermsN whose
support
\textscsupp(σ)={x∈\textscVar∣σ(x)=x}
is finite;
we reserve the symbol σ for substitutions.
By applying a substitutionσ to
a term E we get the term Eσ
that arises from E by replacing each occurrence of x∈\textscVar with
σ(x); given graph presentations,
in the graph of E we just redirect each arc
leading to a node labelled with x towards the root of σ(x) (which includes the
special “root-designating arc” when E=x). Hence E=x implies
Eσ=xσ=σ(x).
The natural composition of substitutions, where
σ=σ1σ2 is defined by
xσ=(xσ1)σ2,
can be easily verified to be
associative. We thus write Eσ1σ2 instead of
(Eσ1)σ2 or E(σ1σ2).
For i∈N we define σi inductively: σ0 is the
empty-support substitution, and σi+1=σσi.
By [xi1/H1,xi2/H2,…,xik/Hk],
where ij=ij′ for j=j′,
we denote the
substitution σ such that xijσ=Hj for all j∈[1,k]
and xσ=x for all
x∈\textscVar∖{xi1,xi2,…,xik}.
We will use
σω=σσσ⋯ just for the special case
σ=[xi/H], where σω
is clearly well-defined; a graph presentation
of the term xiσω arises from a graph presentation of H
by redirecting each arc leading to xi (if any exists)
towards the root; we have xiσω=H if
xi∈\textscvar(H), or if H=xi.
In Fig.1, for σ=[x2/E1] we have
E2=E1σ and E3=E1σω.
By σ[−xi] we denote the substitution arising from σ by
removing xi from its support (if it is there): hence xiσ[−xi]=xi and
xσ[−xi]=xσ for all x∈\textscVar∖{xi}.
We note a trivial fact (for later use):
Proposition 2**.**
If H=xi, then for the term
H′=H[xi/H][xi/H][xi/H]⋯
we have
xi∈\textscvar(H′), and thus
H′σ=H′σ[−xi] for any σ.
We also have \textscSize(H′)≤\textscSize(H).
First-order grammars.
A first-order grammar,
or just a grammar for short, is a tuple
G=(N,Σ,R) where N
is a finite nonempty set of
ranked nonterminals, viewed as function symbols with arities,
Σ
is a finite nonempty set of actions (or “letters”),
and R
is
a finite nonempty set of
rules of the form
[TABLE]
where A∈N, arity(A)=m,
a∈Σ,
and E is a
finite
term over N
in which each occurring variable
is
from the set {x1,x2,…,xm}; we can have E=xi for some
i∈[1,m].
LTSs generated by rules, and by actions, of grammars.
Given G=(N,Σ,R),
by LG\textscr we denote the (rule-based) LTS
LG\textscr=(\textscTermsN,R,(r)r∈R)
where each rule r of the form
A(x1,x2,…,xm)aE
induces
transitions A(x1,…,xm)σrEσ
for all substitutions σ.
The transition induced by σ
with \textscsupp(σ)=∅ is
A(x1,…,xm)rE.
Using terms from Fig.1 as examples, if a rule r1
is A(x1,x2,x3)bx2, then we have E3r1x5
(since E3 can be written as A(x1,x2,x3)σ where
x2σ=x5); the action b only plays a role
in the LTS LG\textsca defined below
(where we have E3bx5).
For a rule r2:A(x1,x2,x3)aC(x2,D(x2,x1)) we deduce
E1r2C(x5,D(x5,D(x5,C(x2,B)))); we note that the
third root-successor in E1 thus “disappears” since
x3∈\textscvar(C(x2,D(x2,x1))).
By definition, the LTS LG\textscr is deterministic
(for each F and r there is at most one H such that FrH).
We note that variables are dead (have no outgoing
transitions).
We also note
that FwH implies \textscvar(H)⊆\textscvar(F)
(each variable occurring in H also occurs in F)
but not \textscvar(F)⊆\textscvar(H) in general.
Remark.
Since the rhs (right-hand sides) E in the rules (3)
are finite, all
terms reachable from a finite term are finite.
The “finite-rhs version” with general regular terms in LTSs has been
chosen for technical convenience.
This is not crucial, since the equivalence problem for
the “regular-rhs version”
can be easily reduced to the problem for our
finite-rhs version.
The deterministic rule-based LTS LG\textscr is helpful
technically,
but we are primarily interested in the (image-finite nondeterministic)
action-based LTS
LG\textsca=(\textscTermsN,Σ,(a)a∈Σ)
where each rule A(x1,…,xm)aE
induces the transitions
A(x1,…,xm)σaEσ for all substitutions σ.
(Hence the rules r1 and r2 in the
above examples induce E3bx5 and
E1aC(x5,D(x5,D(x5,C(x2,B)))).)
Fig.2 sketches a path in some LTS
LG\textscr
where we have, e.g., r1:A(x1,x2,x3)a1C(D(x2,x3),x3)
and r2:C(x1,x2)a2x2 for some actions a1,a2 (which
would replace r1,r2 in the LTS
LG\textsca). In the rectangle just a part of a regular-term
presentation is sketched. Hence the initial root-node A might be
accessible from later roots due to its possible undepicted
ingoing arcs. On the other hand, the
root-node
D after the steps r1r2r3 is not accessible (and can be omitted)
in the presentation of the final term.
Eq-levels of pairs of terms.
Given a grammar G=(N,Σ,R),
by \textscel(E,F) we refer to the equivalence level of (regular) terms E,F
in LG\textsca, with the following adjustment:
though variables xi are handled as dead also in
LG\textsca, we stipulate \textscel(xi,H)=0 if
H=xi (while \textscel(xi,xi)=ω);
this would be achieved automatically if
we enriched LG\textsca with transitions
xaxx where ax is a special action added
to each variable x∈\textscVar.
This adjustment gives us the point 1 in the next
proposition on compositionality.
We put σ∼kσ′ if xσ∼kxσ′ for all
x∈\textscVar, and
define
For all σ,σ′,σ′′,E,F, and
k∈N∪{ω} the following conditions hold:
If σ′∼kσ′′, then σ′σ∼kσ′′σ.
Hence \textscel(σ′,σ′′)≤\textscel(σ′σ,σ′′σ).
In particular, \textscel(E,F)≤\textscel(Eσ,Fσ).
2. 2.
If σ′∼kσ′′, then
σσ′∼kσσ′′.
Hence
\textscel(σ′,σ′′)≤\textscel(σσ′,σσ′′).
In particular, \textscel(σ′,σ′′)≤\textscel(Eσ′,Eσ′′).
Proof.
It suffices to prove the claims for k∈N, since
∼ω=⋂k∈N∼k. We use an
induction on k, noting that for
k=0 the claims are trivial.
Assuming k>0
and E∼kF, we show that Eσ∼kFσ:
We cannot have {E,F}={xi,H} for some H=xi (since then
\textscel(E,F)=0 by our definition).
Hence either
E=F=x for some x∈\textscVar, in which case Eσ=Fσ,
or E∈\textscVar and F∈\textscVar. In the latter case every
transition EσaG (FσaG)
is, in fact, EσaE′σ (FσaF′σ) where
EaE′ (FaF′),
and there must be a corresponding transition FaF′ (EaE′)
such that E′∼k−1F′
(by Proposition 1(3)); by the induction hypothesis
E′σ∼k−1F′σ, which shows that Eσ∼kFσ (since (Eσ,Fσ) is covered by ∼k−1).
This gives us the point 1. For the point 2 we note that
σ′∼kσ′′ implies Eσ′∼kEσ′′, which is
even more straightforward to verify.
∎
The next lemma shows a simple but important fact (whose analogues in
different frameworks
could be traced back to [1, 5] and other related
works). Its claim is sketched in a part of Figure 3.
(We recall that E,F denote general regular terms when we do not say
that they are finite.)
Lemma 4**.**
If \textscel(E,F)=k<ℓ=\textscel(Eσ,Fσ),
then
there are xi∈\textscsupp(σ), H=xi,
and w∈Σ∗, ∣w∣≤k, such that
Ewxi, FwH or EwH, Fwxi, and
xiσ∼ℓ−kHσ.
Proof.
We assume \textscel(E,F)=k<ℓ=\textscel(Eσ,Fσ)
and use an induction on k.
If k=0, then necessarily
{E,F}={xi,H} for some xi=H (since
E∈\textscVar, F∈\textscVar would
imply
\textscel(Eσ,Fσ)=0 as well); the claim is thus trivial
(if xi∈\textscsupp(σ), i.e. xiσ=xi,
then H=xj and xjσ=xi,
which entails that xj∈\textscsupp(σ)).
For k>0 we must have E∈\textscVar, F∈\textscVar.
There must be a transition EaE′ (or FaF′) such that for
all FaF′ (for all EaE′) we have
\textscel(E′,F′)≤k−1 (by Proposition 1(2)).
On the other hand, for each
EσaG1 (and each FσaG2) there is
FσaG2 (EσaG1) such that
\textscel(G1,G2)≥ℓ−1
(by Proposition 1(3)); since
E∈\textscVar and F∈\textscVar, the transitions
EσaG1, FσaG2 can be written
EσaE′σ, FσaF′σ, respectively,
where EaE′, FaF′.
Hence there is a pair of transitions
EaE′, FaF′ such that \textscel(E′,F′)=k′≤k−1 and
\textscel(E′σ,F′σ)=ℓ′≥ℓ−1.
We apply the induction
hypothesis and deduce that there are
xi∈\textscsupp(σ), H=xi,
and w∈Σ∗, ∣w∣≤k′, such that
E′wxi, F′wH or E′wH, F′wxi, and
xiσ∼ℓ′−k′Hσ, which entails
xiσ∼ℓ−kHσ (since ℓ−k=(ℓ−1)−(k−1)≤ℓ′−k′). Since
Eawxi, FawH or EawH, Fawxi,
we are done.
∎
Bounded growth of sizes and heights.
We fix a grammar
G=(N,Σ,R),
and note a few simple facts to aid later analysis;
we also introduce the constants
SInc (size increase), HInc (height increase)
related to G.
We recall that the rhs-terms E in the rules (3) are
finite, and we put
[TABLE]
We add that in this paper we stipulate max∅=0.
By \textscNtSize(E) we mean the number of nonterminal nodes in the
least graph presentation of E (hence the number of non-variable subterms of E).
We put
[TABLE]
The next proposition
shows (generous) upper bounds on the size
and height increase
caused by (sets of) transition sequences.
(It is helpful to recall Fig. 2, assuming that the
rectangle contains a presentation of G.)
Proposition 5**.**
If GwF, then \textscSize(F)≤\textscSize(G)+∣w∣⋅\textscSInc.
2. 2.
If GwF where G is a finite term, then 0pt(F)≤0pt(G)+∣w∣⋅\textscHInc.
3. 3.
If Gv1F1,
Gv2F2, ⋯, GvpFp,
where ∣vi∣≤d for all i∈[1,p], then
\textscSize({F1,F2,…,Fp})≤\textscSize(G)+p⋅d⋅\textscSInc.
Proof.
The points 1 and 2 are immediate.
A “blind” use of 1 in the point 3 would yield
\textsc{Size}(\{F_{1},F_{2},\dots,F_{p}\})\leq p\cdot\big{(}\textsc{Size}(G)+d\cdot\textsc{SInc}\big{)}. But since
the terms Fi can share subterms of G,
we get the
stronger bound \textscSize(G)+p⋅d⋅\textscSInc.
∎
Shortest sink words.
If A(x1,…,xarity(A))wxi in LG\textscr
(hence w∈R+), then we call
w an (A,i)-sink word.
We note that such w can be written rw′ where
A(x1,…,xarity(A))rEw′xi; hence w′ “sinks” along a branch
of E to xi, or w′=ε when E=xi.
This
suggests a standard dynamic programming
approach to find and fix some shortest (A,i)-sink words w[A,i]
for all elements (A,i) of the set
\textscNA={(B,j)∣B∈N,j∈[1,arity(B)]}
for which such words exist.
We can clearly (generously) bound the lengths of w[A,i] by
h∣\textscNA∣ where
h=2+\textscHInc (i.e., h=1+\max\big{\{}0pt(E)\mid E is the
rhs of a rule in \mathcal{R}\big{\}}).
We put
[TABLE]
The above discussion entails that d0 is a (quickly) computable number,
whose value is at most exponential in the size of
the given grammar G.
Remark.
For any grammar G we can construct a
“normalized” grammar G′ in which
w[A,i] exists for each
(A,i)∈\textscNA, while the LTSs LG\textsca and
LG′\textsca are isomorphic.
(We can refer to [27] for more details.)
We do not need such normalization in this paper.
Convention.
When having a fixed grammar G=(N,Σ,R),
we also put
[TABLE]
but we will often write A(x1,…,xm)
even if arity(A) might not be maximal. This is harmless
since such m could be always replaced with arity(A)
if we wanted to be pedantic.
(In fact, the grammar could be also normalized
so that the arities of nonterminals are
the same [27]
but this is a superfluous technical
issue here.)
3 Main Result (Computability of Equivalence
Levels)
Small numbers.
We use the notion of “small”
numbers determined by a grammar G;
by saying that a numberd∈N is small
we mean that it is a computable number (for a given grammar G)
that is elementary in the size of G.
E.g., the numbers m, HInc, SInc
(defined by (7), (4), (5))
are trivially small, and we have also shown that
d0 (defined by (6)) is small.
In what follows we will also introduce further specific small numbers,
summarized in Table 1 at the end of the paper.
Main theorem.
We first note a fact that is obvious
(by induction on k):
Proposition 6**.**
There is an algorithm that, given a grammar G, terms T,U, and
k∈N, decides if T∼kU
in the LTS LG\textsca.
Hence
the next theorem adds the decidability of
∼ (i.e., of ∼k for k=ω).
Theorem 7**.**
For any grammar G=(N,Σ,R)
there is a small number c and a computable (not
necessarily small) number E such that for all
T,U∈\textscTermsN we have:
[TABLE]
Corollary 8**.**
It is decidable, given G, T, U, if T∼U in
LG\textsca.
Theorem 7 is proven in
Section 7; the proof uses the notions and
results from
Sections 4, 5,
and 6.
Each section starts with an informal summary, and the collection
of these summaries yields a more detailed informal overview of the proof
than that given in the introduction.
4 Bounding the Lengths of “(n,s,g)-sequences”
The top of Figure 3 depicts (a prefix of) a sequence of the
form
(E1σ,F1σ), (E2σ,F2σ), …,
(Ezσ,Fzσ)
(Ei,Fi being regular terms)
where we assume that the eq-levels are finite and
decreasing:
We then have \textscel(E1,F1)=k≤ℓ=\textscel(E1σ,F1σ)
(for some k,ℓ∈N),
by Proposition 3. If σ is the empty-support
substitution, then k=ℓ and the sequence length z is bounded by
1+k. If k<ℓ, then Lemma 4 yields some xi
and
H=xi (xi=x1 in Figure 3)
where xiσ∼ℓ−kHσ; hence
in each pair (Ejσ,Fjσ) where
j∈[2+k,z] we can (repeatedly) replace
xiσ with Hσ without changing
the eq-level
of the pair.
This is depicted in Figure 4;
since \textscel(E2+kσ,F2+kσ)=ℓ′<ℓ−k, the
respective eq-levels do not change
due to Propositions 3 and 1.
If, moreover, we are guaranteed that the size growth of (Ej,Fj) is
controlled, i.e.,
[TABLE]
for some
fixed constants s and g (and j∈[1,z]),
and \textscvar(Ej,Fj)⊆{x1,…,xn}
for some fixed n (which bounds the support of σ), then
a bound on the lengths z of such
(n,s,g)-sequences
is determined
by the respective grammar G (independently of the sizes of terms
xiσ). This is straightforward, as we now show.
Given n,s,g, the number of respective pairs
(E1,F1) is bounded, and there is thus e∈N that is the largest
\textscel(E1,F1) for such pairs (we recall that
ω>\textscel(E1σ,F1σ)≥\textscel(E1,F1)); at this
moment we do
not claim that e is computable.
For each (n,s,g)-sequence (E1σ,F1σ),
(E2σ,F2σ), …,
(Ezσ,Fzσ) where z>1+e we have
(\textscel(E1,F1)<\textscel(E1σ,F1σ) and)
either E1wxi and F1wH, or E1wH and
F1wxi, ∣w∣≤e, for the
respective xi,H discussed above and illustrated in
Figures 3 and 4; hence
\textscSize(H)≤\textscSize(E1,F1)+e⋅\textscSInc (by
Proposition 5(1)).
This entails that replacing xiσ with H′σ[−xi]
where H′=H[xi/H][xi/H][xi/H]⋯ (recall
Proposition 2) in the pairs
(Ejσ,Fjσ) for
j=1+e+1,1+e+2,…,z gives us
an (n−1,s′,g)-sequence of length z−(1+e), where
s′=s+g⋅(1+e)+s+e⋅\textscSInc (which bounds the size of
terms E2+e,F2+e extended by a shared subterm H′).
To be precise,
for the terms Ej′=Ej[xi/H′] and Fj′=Fj[xi/H′] we only have
\textscvar(Ej′,Fj′)⊆{x1,…,xn}∖{xi},
and xn can occur in them (when xi=xn).
In this case we just replace xn with xi
in all Ej′,Fj′ (j=1+e+1,1+e+2,…,z) and use
the tail-substitution σ′ that arises
from σ by putting xiσ′=xnσ
and xnσ′=xn. An inductive argument thus establishes
that there is indeed a claimed bound (on the lengths of
(n,s,g)-sequences) determined by the grammar.
We will later show that such a bound is even computable
when G,n,s,g are given. Moreover, we will also show how to compute small
n,s,g to a given G so that the computable bound on the length
of (n,s,g)-sequences gives us the number E in
Theorem 7.
In the rest of this section
we formalize the above ideas showing that (n,s,g)-sequences are bounded.
In this formalization
we also define the notion of
(n,s,g)-candidates, candidates for “non-equivalence
bases”;
intuitively, the baseBn,s,g is intended to collect all possible “tops”
(Ej,Fj), (Ej[xi/H′],Fj[xi/H′]), …
from all (eqlevel-decreasing) (n,s,g)-sequences
that
undergo the above described inductive transformation.
Eqlevel-decreasing (n,s,g)-sequences.
We fix a grammar G=(N,Σ,R).
By an eqlevel-decreasing sequence we mean
a sequence (T1,U1),(T2,U2),…,(Tz,Uz)
of pairs of terms
(where z∈N+) such that
ω>\textscel(T1,U1)>\textscel(T2,U2)>⋯>\textscel(Tz,Uz).
The length z of such a sequence is obviously at most
1+\textscel(T1,U1).
For n,s,g∈N
we say that an eqlevel-decreasing sequence
in the form
[TABLE]
is an (n,s,g)-sequence if
\textscvar(Ej,Fj)⊆{x1,…,xn} and
\textscSize(Ej,Fj)≤s+g⋅(j−1)
for all j∈[1,z]. (The size of “tops” (Ej,Fj) is at most
s at the start,
and g bounds the “growth-rate” of tops; the terms xiσ,
i∈[1,n],
might be large but the “tail substitution” σ
is the same in all elements of the sequence.)
Candidates for (non-equivalence) bases.
To show a bound on the lengths of (n,s,g)-sequences
in a convenient form (in Lemma 10), we introduce further
notions; we start with a piece of notation.
For any n,s∈N we put
Given n,s,g∈N,
we say that B⊆\textscTermsN×\textscTermsN is
an (n,s,g)-candidate (intended to collect the tops of
(n,s,g,)-sequences that undergo the above described inductive transformation)
if the following
conditions 1–3 hold (in which an implicit induction
on n is used):
If n>0, then
the set
B′=B∖\textscPairs\textscvar:n
is an (n−1,s′,g)-candidate
where
[TABLE]
Every (n,s,g)-candidate B
yields a boundEBn,s,g∈N+, denoted just EB when
n,s,g are clear from the context;
in the above notation (around (10))
we define
EBn,s,g
as follows:
if n=0, then EBn,s,g=1+e;
if n>0, then
EBn,s,g=1+e+EB′n−1,s′,g.
An (n,s,g)-candidateB is full below an
eq-levele∈N∪{ω}
if
each pair (E,F)\in\big{(}\textsc{Pairs}_{\,\textsc{var}\,:\,0}\cup\textsc{Pairs}_{\,\textsc{var}\,:\,1}\cup\cdots\cup\textsc{Pairs}_{\,\textsc{var}\,:\,n}\big{)}\mathop{\cap}\textsc{Pairs}_{\,\textsc{size}\leq s}
such that \textscel(E,F)<e belongs to B,
and, moreover, in the case n>0 the (n−1,s′,g)-candidate B′ is full below e.
We say that B is full if it is full below ω
(in which case B contains all relevant non-equivalent
pairs).
Proposition 9**.**
For any n,s,g there is the unique full (n,s,g)-candidate, denoted
Bn,s,g.
Proof.
Given n,s,g, the full
(n,s,g)-candidate B=Bn,s,g is defined as follows:
\mathcal{B}\cap\textsc{Pairs}_{\,\textsc{size}\leq s}=\big{(}\textsc{Pairs}_{\,\textsc{var}\,:\,0}\cup\textsc{Pairs}_{\,\textsc{var}\,:\,1}\cup\cdots\cup\textsc{Pairs}_{\,\textsc{var}\,:\,n}\big{)}\mathop{\cap}\textsc{Pairs}_{\,\textsc{size}\leq s}\mathop{\cap}\not\sim
and,
moreover, in the case
n>0
the set B′=B∖\textscPairsn,s is the full (n−1,s′,g)-candidate
(where s′ is defined as in (10)).
∎
The unique full (n,s,g)-candidate Bn,s,g will be also
called the (n,s,g)-base.
The (n,s,g)-sequences have bounded lengths.
We show the announced bound.
Lemma 10**.**
If (E1σ,F1σ),(E2σ,F2σ),…,(Ezσ,Fzσ)
is an (n,s,g)-sequence and B is an (n,s,g)-candidate that is
full below 1+\textscel(E1σ,F1σ), then z≤EB;
in particular, z≤EBn,s,g.
Proof.
We consider an (n,s,g)-sequence
(E1σ,F1σ),(E2σ,F2σ),…,(Ezσ,Fzσ)
as in (9), and an (n,s,g)-candidate B that is
full below 1+\textscel(E1σ,F1σ).
Since
ω>\textscel(E1σ,F1σ)≥\textscel(E1,F1)
(by Proposition 3(1)),
we have
(E1,F1)∈B∩\textscPairs\textscsize≤s.
This entails
If \textscel(E1σ,F1σ)=\textscel(E1,F1)=k, which is surely
the case when n=0
(in this case (E1σ,F1σ)=(E1,F1)),
then z≤1+k, due to the required eqlevel-decreasing
property of (n,s,g)-sequences;
in this case z≤1+e≤EB.
We proceed inductively (on n), assuming
n>0 and \textscel(E1σ,F1σ)=ℓ>k=\textscel(E1,F1).
By Lemma 4 there is xi∈\textscsupp(σ),
i∈[1,n], and H=xi
such that E1wxi and F1wH, or E1wH and
F1wxi, for some w∈Σ∗ with ∣w∣≤k, where
xiσ∼ℓ−kHσ.
Hence σ∼ℓ−k[xi/H]σ,
which entails that
σ∼ℓ−k[xi/H]jσ for all
j∈N (by applying Proposition 3(2)
repeatedly).
We can also easily check that
[xi/H]ℓ−kσ∼ℓ−k[xi/H]ωσ
(by induction on ℓ−k), hence
xiσ∼ℓ−kH′σ[−xi] where
H′=H[xi/H][xi/H][xi/H]⋯
and note that
\textscel(Ejσ,Fjσ)=\textscel(Ej′σ[−xi],Fj′σ[−xi]),
since \textscel(Ejσ,Fjσ)<ℓ−k (for each j≥k+2); here we use that \textscel(Ejσ,Ej[xi/H′]σ)≥ℓ−k and \textscel(Fjσ,Fj[xi/H′]σ)≥ℓ−k, and we recall Proposition 1(1).
We also note that for each j∈[k+2,z] we have
is “almost” an
(n−1,s′,g)-sequence.
The only problem is that xn can occur in Ej′,Fj′.
But we use the fact that xi does not occur in Ej′,Fj′, and we
replace xn with xi, while replacing σ[−xi]
with σ′ where xnσ′=xn,
xiσ′=xnσ[−xi], and xσ′=xσ[−xi] for all
x∈\textscVar∖{xi,xn}.
We note that the (n−1,s′,g)-candidate
B′=B∖\textscPairs\textscvar:n is full below
1+\textscel(Ek+2′σ[−xi],Fk+2′σ[−xi])
(since B′ is full below 1+\textscel(E1σ,F1σ),
and
\textscel(Ek+2′σ[−xi],Fk+2′σ[−xi])=\textscel(Ek+2σ,Fk+2σ)<\textscel(E1σ,F1σ)).
By the induction hypothesis z−(k+1)≤EB′,
and thus
z≤1+k+EB′≤1+e+EB′=EB.
∎
In the final argument of the proof of Theorem 7
(in Section 7)
we will use EBn,s,g as E
in (8), for some specific small n,s,g.
Though we have defined the
(n,s,g)-base Bn,s,g only semantically, it will turn out that it coincides
with an effectively constructible “sound” (n,s,g)-candidate.
But we first need some further technicalities to clarify the specific
n,s,g (as well as c in (8)).
5 Plays (of Bisimulation Game) and their
Balancing
In Section 1 we discussed the notion of
optimal plays, which we make more precise now.
We assume a given grammar G=(N,Σ,R);
for r∈R of the form A(x1,…,xm)aE
we put \textsclab(r)=a.
For technical convenience, by a play we only mean
an optimal play from a non-equivalent pair, i.e., a sequence
[TABLE]
where for each i∈[1,k] we have ri,ri′∈R,
\textsclab(ri)=\textsclab(ri′),
Ti−1riTi, Ui−1ri′Ui (in the LTS
LG\textscr); moreover,
ω>\textscel(T0,U0) and
\textscel(Ti,Ui)=\textscel(Ti−1,Ui−1)−1 for each i∈[1,k]
(in the LTS LG\textsca).
If \textscel(Tk,Ek)=0, then
it is a completed play, in which case \textscel(T0,U0)=k.
(We recall that T0,U0 can be regular terms of a large size.)
The length of the play (11) is (defined to be)
k, and another presentation of the play is
U0T0u′⟶uUkTk, or also just
U0T0u′⟶u,
where
u=r1r2⋯rk and u′=r1′r2′⋯rk′.
Our aim is to bound
the lengths of completed plays in the way stated in Theorem 7.
To facilitate this task,
in this section we show a particular transformation of a completed
play (11) into a sequence of plays of the same
overall length (i.e., the sum of lengths) that
are connected by so-called eqlevel-concatenation⊙; such concatenation
[TABLE]
is defined if (and only if) \textscel(T′,U′)=\textscel(T′′,U′′),
though the pairs (T′,U′) and (T′′,U′′) can differ.
The overall length of this concatenation is ∣u1∣+∣u2∣; if
U′′T′′u2′⟶u2U′′′T′′′ is a
completed play, then this length (∣u1∣+∣u2∣) is obviously the same as the length
of any completed play starting with (T,U).
In the first phase of the mentioned transformation of a completed
play (11) we will replace it with the concatenation
of two plays in the
form
[TABLE]
where v0u1 is a certain prefix of u=r1r2⋯rk,
v0′u1′ is a prefix of u′=r1′r2′⋯rk′ (of the same
length as v0u1),
and [U1′′T1′′v′⟶v] is a completed play
(while v (v′) is generally not a suffix of u (u′)). Further we
replace [U1′′T1′′v′⟶v] with
[U1′′T1′′v1′u2′⟶v1u2U2′T2′]⊙[U2′′T2′′vˉ′⟶vˉ]
where v1u2 is a certain prefix of v,
v1′u2′ is a prefix of v′,
and
[U2′′T2′′vˉ′⟶vˉ] is a
completed play;
we continue in this way, doing ℓ phases for a certain number
ℓ, until finally getting
[TABLE]
where [Uℓ′′Tℓ′′vℓ′⟶vℓUˉℓ+1Tˉℓ+1] is
completed and “non-transformable”;
the overall length of (12) is thus equal to
k=\textscel(T0,U0). In fact, we have ℓ=0 when already (11) is
non-transformable; we thus put
(T0′′,U0′′)=(T0,U0) for convenience.
(Later we repeat (12) as (17)
without the bars in the notation Tˉj,Uˉj; now the bars
are added to avoid the confusion with Tj,Uj
in (11).)
More concretely, we will perform the transformation so that
for each phase j∈[1,ℓ] we have ∣uj∣=d0
(for d0 defined by (6)), one of the terms
Tˉj,Uˉj is the pivotWj, and the
pair (Tj′′,Uj′′) is
the balancing
result, or the bal-result for short, related to the pivotWj.
In fact, if Wj=Uˉj, then we have Uj′′=Uj′ (and Tj′′=Tj′); in this case the j-th phase consists in replacing the
completed play
[Uj−1′′Tj−1′′v′⟶v] with
the eqlevel-concatenation
[Uj−1′′Tj−1′′vj−1′⟶vj−1UˉjTˉjuj′⟶ujUj′Tj′]⊙[Uj′Tj′′vˉ′⟶vˉ]
(where
[Uj−1′′Tj−1′′vj−1′⟶vj−1UˉjTˉjuj′⟶ujUj′Tj′] is a prefix of
[Uj−1′′Tj−1′′v′⟶v]);
this is called a left balancing step (the
left
term in (Tj′,Uj′) has been replaced with Tj′′ so that
\textscel(Tj′,Uj′)=\textscel(Tj′′,Uj′)).
Similarly, if Wj=Tˉj, then we have Tj′′=Tj′, and we have
performed a right balancing step, replacing
Uj′ with Uj′′.
We thus have pivots W1,W2,…,Wℓ, each having its related
bal-result.
Since the sequence
(T1′′,U1′′),(T2′′,U2′′),…,(Tℓ′′,Uℓ′′)
of bal-results is eqlevel-decreasing,
no pair can repeat in the sequence.
We will “balance” in a way that will also yield a pivot path
[TABLE]
where w0∈R∗, wj∈R+ for j∈[1,ℓ],
W0∈{T0,U0}, Wℓ+1∈{Tˉℓ+1,Uˉℓ+1}, and
we will guarantee the following properties:
There is some small n such that for each j∈[1,ℓ] there are
small finite terms G,E,F, with
\textscvar(E,F)⊆\textscvar(G)⊆{x1,…,xn},
such that
Wj=Gσ and
(Tj′′,Uj′′)=(Eσ,Fσ),
for a
substitution σ (with
\textscsupp(σ)⊆{x1,…,xn}).
(Hence the terms in the bal-result arise from the
pivot W by replacing a small top of W by other
small tops.)
This is depicted in
Figure 5 for some Wj and Wj+1 (and
in more detail in Figure 6).
2. 2.
Each pivot-path segment WjwjWj+1
(for j∈[0,ℓ])
is either short (i.e., its length is small),
or it has a short prefix and a short suffix while the middle part
is “quickly sinking” (to a deep
subterm of Wj if this part is long).
We note that we do not exclude that a pivot W occurs more than once in the
pivot path
(W=Wj and W=Wj′ for j=j′), but the number of its occurrences
must be small; this follows from the point 1 which
entails that there is only a small number of possible
bal-results related to one pivot, and from the fact
that the bal-results cannot repeat.
Figure 5 depicts a “non-sinking
segment” on the pivot path. (In such a segment, no root-successor of
the starting term is exposed.) By the above point 2 it is
intuitively clear
that any long non-sinking segment must contain a
large number of pivots, and that the possible increase of (the tops
of) the pivots is controlled.
Hence any long non-sinking segment of the pivot path gives rise to a
long (n,s,g)-sequence, for some small n,s,g; here we use the
point 1 (and recall Figure 5).
This is a crucial fact for our proof of
Theorem 7.
In this section, our task is to show a transformation that guarantees
a suitable pivot path (13)
and the above properties 1 and 2.
A concrete way how we do a left balancing step is captured by
Figure 6.
Informally speaking, if the left-hand side
does not sink to a root-successor
within less than d0 moves
(for d0 defined by (6)),
which is the case
in Figure 6
due to A(x1,…,xm)uE′, then the other side (U=Gσ
in Figure 6) can become a pivot, and the bal-result
can be created as depicted; the original root-successors in the
left-hand side are replaced
by suitable terms that are shortly reachable from the pivot, so that
the respective eq-level does not change
(\textscel(E′σ′,U′)=\textscel(E′σ′′,U′) in
Figure 6).
The existence of such a transformation (we claim nothing about its
effectiveness) is clear by
Propositions 1 and 3.
Right balancing steps are analogous (they are elligible when
the right-hand side does not sink within less than d0 moves).
We observe that any path WvW′ can sink to some depth-∣v∣
subterm of W at most, surely not deeper; hence W′ arises from W
by replacing its “∣v∣-top” with another top; the size of these tops
is small
when v is short.
This observation now easily entails
the above property 1, guaranteed by our transformation.
To guarantee a suitable pivot path (13) and its property 2,
as a first attempt we consider the following procedure in the j-th
phase (of the transformation of (11)
into (12)): when we are about to replace the completed play
[Uj−1′′Tj−1′′v′⟶v], we use its shortest
prefix of the form
[Uj−1′′Tj−1′′vj−1′⟶vj−1UˉjTˉjuj′⟶ujUj′Tj′] where
[UˉjTˉjuj′⟶ujUj′Tj′]
enables a (left or right) balancing step (i.e., some side
does not sink to a root successor within less than d0
moves).
But doing this balancing as suggested
would complicate our task of creating a suitable
pivot path (13), as we now discuss.
First we note that we can smoothly define W0w0W1:
it is U0v0U1
if W1=U1, and T0v0T1 if W1=T1.
Similarly we define WℓwℓWℓ+1 as
Uˉℓuℓ′vℓ′Uˉℓ+1
if Wℓ=Uˉℓ, and as
TˉℓuℓvℓTˉℓ+1
if Wℓ=Tˉℓ.
If in the consecutive phases j and j+1 we have the
pivot on the same side, say Wj=Uˉj and
Wj+1=Uˉj+1, then we have no problem either: we define
WjwjWj+1 simply as Uˉjuj′vj′Uˉj+1
(which is legal since Uj′=Uj′′).
A problem to define WjwjWj+1 arises when there is a switch
of balancing sides. Hence we add a simple condition to be satisfied when
such a switch is allowed to occur.
Suppose Wj=Uj, and let
Figure 6 describe the respective left balancing step.
In the (j+1)-th phase of the transformation we have
and we are about to replace the (current) completed play
[Uj′E′σ′′v′⟶v].
We would prefer to do another left balancing, ideally for a short
prefix of this completed play. This is not possible only if
the path E′σ′′v is quickly sinking in the beginning, i.e.,
within each segment of length d0 a root-successor of the term
starting the segment is exposed;
the path E′σ′′v thus has a short prefix
E′σ′′vj1xiσ′′ for some xi (since E′ is
a small finite term and the path sinks along one of its branches).
But xiσ′′ is reachable from the last pivot Wj (Wj=Uj)
by a short word vˉ (e.g., if xiσ′′=V2 in
Figure 6, then we use the path Uvˉ2V2).
Hence only after such a short prefix
[Uj′E′σ′′vj1′⟶vj1Uxiσ′′]
we allow to balance on both sides (if a left balancing is not possible
earlier).
If a switch of balancing sides indeed happens in our discussed case, then we can write the
j-th and the (j+1)-th play in the
sequence (12) in the form
and define WjwjWj+1 as
Wjvˉxiσ′′vj2Wj+1 (where vˉ is
shorter than the short word ujvj1 but this does not matter).
To summarize: for the consecutive phases j and j+1 where the
j-th phase is a left-balancing step captured by
Figure 6, we get
where either vj is short and Wj+1=Uˉj+1 or we can
write vj=vj1vj2 where vj1 is short and
we have E′σ′′vj1xiσ′′. In the latter case we can
write
[TABLE]
where Wj+1∈{Tˉj+1,Uˉj+1}, and
both paths xiσ′′vj2Tˉj+1 and
Uˉvj2′Uˉj+1 (that may be long) are quickly
sinking (since there is no balancing possibility there).
Hence the above property 2 of the pivot path is also clear
(including the case Wj+1=Uˉj+1, where WjwjWj+1
is Uˉjuj′vj1′vj2′Uˉj+1).
Now we define the described transformation in a more formal way.
Modified optimal plays, and their eqlevel-concatenation.
We still assume a fixed grammar G=(N,Σ,R).
Now we let
u,v,w (with subscripts etc.) range over R∗ (not over Σ∗);
hence EwF determines one path in the LTS
LG\textscr. For r∈R of the form A(x1,…,xm)aE
we put \textsclab(r)=a;
this is extended to the
respective homomorphism \textsclab:R∗→Σ∗.
An optimal play, or just a play for short,
is a sequence
where
T0∼U0 and for each j∈[1,k] we have
Tj−1rjTj, Uj−1rj′Uj,
\textsclab(rj)=\textsclab(rj′), and \textscel(Tj,Uj)=\textscel(Tj−1,Uj−1)−1.
It is clear (by Proposition 1(2,3))
that for any T0∼U0
there is a play of the form (15) such that
k=\textscel(T0,U0) (and \textscel(Tk,Uk)=0).
A play μ of the form (15)
is a play from
\textscStart(μ)=(T0,U0) to \textscEnd(μ)=(Tk,Uk),
and is also written as U0T0u′⟶uUkTk,
or just as U0T0u′⟶u,
where
u=r1r2⋯rk and u′=r1′r2′⋯rk′;
we put
\textsclength(μ)=k and \textscPairs(μ)={(Ti,Ui)∣i∈[0,k]}.
We also consider the trivial plays of the form (T0,U0) with the length k=0 (for
T0∼U0).
A play (15)
is a
completed play if \textscel(Tk,Uk)=0.
The standard concatenationμν of plays
μ=UTu′⟶uU′T′
and ν=U′′T′′v′⟶vU′′′T′′′ is
defined if (and only if) (T′,U′)=(T′′,U′′); in this case μν
is the play UTu′v′⟶uvU′′′T′′′
(hence \textscEnd(μ) and \textscStart(ν) get merged).
We aim to show a bound of the form (8)
on the lengths of completed plays from (T,U).
The use of (n,s,g)-sequences,
bounded by Lemma 10,
will become clear after we introduce a special modification of plays.
Generally,
a modified playπ is a sequence of plays
μ1,μ2,…,μℓ (ℓ≥1)
where for each j∈[1,ℓ−1] we have
\textscel(\textscEnd(μj))=\textscel(\textscStart(μj+1))
but \textscEnd(μj)=\textscStart(μj+1);
it is a modified play from\textscStart(π)=\textscStart(μ1)to\textscEnd(π)=\textscEnd(μℓ), and it is
a completed modified play if
\textscel(\textscEnd(μℓ))=0.
(As expected, if \textscEnd(μ)=(T,U), then by
\textscel(\textscEnd(μ)) we refer to the eq-level
\textscel(T,U); similarly in the other cases.)
We put \textsclength(π)=∑j∈[1,ℓ]\textsclength(μj), and
\textscPairs(π)=⋃j∈[1,ℓ]\textscPairs(μj).
We do not consider peculiar modified plays
where \textscEnd(μj)=\textscStart(μj+p) for p≥2,
in which case μj+1,μj+2,⋯,μj+p−1 are
zero-length plays; we implicitly deem the modified plays to be normalized
by (repeated) replacing such segments
μj,μj+1,⋯,μj+p−1,μj+p
with μjμj+p.
E.g., a modified play μ1,μ2,μ3 of
the form
U0T0u1′⟶u1UT,U′T′,UTu2′⟶u2U′′T′′ (where
\textscel(T,U)=\textscel(T′,U′)) is replaced with
μ1μ3=U0T0u1′u2′⟶u1u2U′′T′′.
Proposition 11**.**
For any T∼U there is a completed play from (T,U),
and we have
\textsclength(π)=\textscel(T,U) for
each completed modified play π from (T,U);
moreover, no pair
can appear at
two different positions in π (we thus have no repeat of a pair in
π).
Proof.
The eq-levels of pairs in
π=μ1,μ2,…,μℓ are dropping in each μj;
we have
\textscel(\textscEnd(μj))=\textscel(\textscStart(μj+1))
but \textscEnd(μj)=\textscStart(μj+p) for p≥1
by definition (which includes the normalization).
∎
We also define a partial operation on the set of modified plays that
is called
the eqlevel-concatenation and denoted by ⊙ . For
modified plays π=μ1,μ2,…,μk and
ρ=ν1,ν2,…,νℓ, the eqlevel-concatenation π⊙ρ is defined if (and only if)
\textscel(\textscEnd(π))=\textscel(\textscStart(ρ)); we recall
that \textscEnd(π)=\textscEnd(μk) and
\textscStart(ρ)=\textscStart(ν1).
Suppose that π⊙ρ, in the above notation, is defined.
If \textscEnd(μk)=\textscStart(ν1), then
π⊙ρ=μ1,μ2,…,μk,ν1,ν2,…,νℓ; if
\textscEnd(μk)=\textscStart(ν1), then
π⊙ρ=μ1,μ2,…,μk−1,μkν1,ν2,ν3,…,νℓ.
(We implicitly assume a normalization in the end, if necessary; but
this will not be needed in our concrete cases.)
We note that the operation ⊙ is
associative.
In what follows, by writing the expression
π⊙ρ for modified plays π,ρ
we implicitly claim that π⊙ρ is defined (and we refer to the
resulting modified play π⊙ρ).
By writing πρ we implicitly claim that
\textscEnd(π)=\textscStart(ρ), and πρ refers to the
modified play π⊙ρ.
We now show a particular modification of plays, a first step towards
creating (n,s,g)-sequences.
In this process we will frequently replace a (sub)play of the type
ρ=UTu′⟶uU′T′
with a modified play
ρ′=UTu′⟶uU′T′⊙U′T′′
that has the same length by definition; essentially it means that we
have replaced T′ with T′′ while guaranteeing that
\textscel(T′,U′)=\textscel(T′′,U′).
Balancing steps, their pivots and balanced results.
Informally speaking,
a play UTu′⟶uU′T′
enables left balancing if
TuT′ misses the opportunity to sink to a root-successor
as quickly as possible (recall w[A,i] and
d0 defined around (6)).
A left balancing is illustrated in Figure 6
(in both a pictorial and a textual form).
We start with a simple example,
and only then we give a formal
definition.
where r1 is A(x1,x2)a1B(C(x2,x1),x1),
and r2 is B(x1,x2)a2B′(x2,x1).
Let r3 be A(x1,x2)a3x1, hence we also have
A(G1,G2)a3G1. (Therefore the path Tr1r2T′ clearly
missed the
opportunity to sink to G1 as quickly as possible.)
Since Ta3G1,
there must be a transition Ua3V1, generated by a rule r3′, such that
\textscel(G1,V1)≥\textscel(T,U)−1
(by Proposition 1(3)); hence
\textscel(G1,V1)>\textscel(T′,U′)
(since \textscel(T′,U′)=\textscel(T,U)−2 by
the definition of plays).
In T′=B′(G1,C(G2,G1)) we can thus replace G1 with V1 without affecting
\textscel(T′,U′); indeed, we have
\textscel(T′,B′(V1,C(G2,V1))≥\textscel(G1,V1)
(using Proposition 3(2)),
and \textscel(G1,V1)>\textscel(T′,U′) thus entails that
\textscel(B′(V1,C(G2,V1)),U′)=\textscel(T′,U′)
(by Proposition 1(1)).
If also G2 can be reached from A(G1,G2) in less than two
steps, we similarly get V2, where Ur4′V2 for some r4′, so that
\textscel(B′(V1,C(V2,V1)),U′)=\textscel(T′,U′); hence
is a well-defined modified play in this case.
Here U is the “pivot”, and we note that U′,V1,V2 are all reachable
from U in at most two steps. Hence if we present U
in a “2-top
form”, say U=Gσ where
G=A0(A1(x1,x2),A2(x3,x4)), then
we have U′=Fσ, V1=F1σ, V2=F2σ where
Gr1′r2′F,
Gr3′F1, Gr4′F2.
Now the “bal-result” (T′′,U′)=(B′(V1,C(V2,V1)),U′) can be
presented as (Eσ,Fσ) where E=B′(F1,C(F2,F1)); we note
that in U=Gσ the top G is small, hence also E,F
are small, while the terms xσ might be large. We now formalize
(and generalize) the observation that has been exemplified.
We again consider a fixed general grammar
G=(N,Σ,R), and the numbers m (7) and d0
(6). We say
that
a playρ=UTu′⟶uU′T′enables L-balancing if
∣u∣=d0 (hence also ∣u′∣=d0)
and
TuT′ is root-performable, i.e.,
T=A(x1,…,xm)σ′, A(x1,…,xm)uE′,
and thus T′=E′σ′ (where A∈N, E′∈\textscTermsN,
\textscvar(E′)⊆{x1,…,xm}).
We can thus write
(We have not excluded that E′=xi for some i∈[1,m].)
In the described case, in T′ we can replace each occurrence
of a root-successor of T (which is xiσ′ for i∈[1,m])
with a term that is
shortly reachable from U so that
\textscel(T′,U′) is unaffected by this replacement; we now make this
claim more
precise, referring again to the illustration in Figure 6.
Suppose A(x1,…,xm)w[A,i]xi (cf. the definitions around (6)), hence
Tw[A,i]xiσ′; since
\textscel(T,U)=d0+\textscel(T′,U′)≥d0 and ∣w[A,i]∣<d0,
there must be vˉi∈R+ and a term Vi such that
∣vˉi∣=∣w[A,i]∣,
\textsclab(vˉi)=\textsclab(w[A,i]), UvˉiVi,
and \textscel(xiσ′,Vi)≥\textscel(T,U)−∣w[A,i]∣>\textscel(T,U)−d0=\textscel(T′,U′) (we use Proposition 1(3)).
We can thus reason for all i∈[1,m].
If there is no w[A,i] for some i∈[1,m], then xiσ′ is
not “exposable” in T=A(x1,…,xm)σ′, hence
not in T′=E′σ′ either, and
xiσ′ can
be replaced by any term without changing the equivalence class of T′;
in this case we put Vi=U, thus having UεVi.
Therefore \textscel(E′σ′,U′)=\textscel(E′σ′′,U′) where
xiσ′′=Vi for all i∈[1,m]
(by using
Propositions 3(2) and 1(1)).
Hence for a play ρ=UTu′⟶uU′T′
in the above notation we can soundly define
an L-balancing stepρ⊢Lρ′
where ρ′ is a
modified play
ρ′=ρ⊙(E′σ′′,U′), depicted in Fig.6.
For such an L-balancing step ρ⊢Lρ′,
the term U is called the pivot
and the pair (E′σ′′,U′) is called the bal-result.
An R-balancing stepρ⊢Rρ′ is defined symmetrically:
if in ρ=UTu′⟶uU′T′ we have
∣u∣=∣u′∣=d0 and
Uu′U′ is root-performable,
and presented as A(x1,…,xm)σ′u′F′σ′,
then we can soundly define
here T is the pivot and (T′,F′σ′′) is the
bal-result.
Relation of the tops of the pivot and of the bal-result.
We now look in more detail at the fact that the pivot of a balancing
step and the respective bal-result can be written Gσ and
(Eσ,Fσ) for specifically related small “tops” G,E,F
(as is also depicted in Figure 6).
We say that a finite term G is a p-top, for p∈N+,
if 0pt(G)≤p, each depth-p subterm is a variable,
and \textscvar(G)={x1,…,xn} for some n∈N; hence n≤mp
(for m being
the maximum arity of nonterminals (7)).
We note that each term W has a p-top formGσ, i.e.,
W=Gσ, G is a p-top, \textscsupp(σ)⊆\textscvar(G),
and
we have xσ∈\textscVar for each x
occurring in G in depth less than p.
(Only a branch of W that finishes with a variable in depth less than
p gives rise to such a branch in G.)
E.g., a 2-top form of A(B(x9,C(x3,x6)),x9)
is Gσ where G=A(B(x1,x2),x3) and
σ=[x1/x9,x2/C(x3,x6),x3/x9]; another 2-top form of
this term is G′σ′ where G′=A(B(x1,x2),x1) and
σ′=[x1/x9,x2/C(x3,x6)].
(We could strengthen the
definition to get the unique p-top form to each term, but this is not
necessary.)
We say that Gσ is a p-safe form ofW if W=Gσ and
Wv, ∣v∣≤p, implies Gv
(i.e., each word v∈R∗ of length at most p that is performable from W is
also performable from G).
We easily observe that each p-top form Gσ of W is also
a p-safe form of W.
The next proposition follows immediately from the definition of balancing
steps.
Proposition 12**.**
Let W be the pivot and (T′′,U′′) the bal-result of an
L-balancing step.
Then for any d0-safe form Gσ of W we have
(T′′,U′′)=(Eσ,Fσ) where
•
Gu′F* for some u′∈R+, ∣u′∣=d0;*
•
E=E′σ* where
A(x1,…,xm)uE′ for some A∈N,
u∈R+, ∣u∣=d0, and for all i∈[1,m] we
have
GviFi where Fi=xiσ, for some
vi, ∣vi∣<d0 (hence
T′′=Eσ=E′σσ=E′σ′′
where
Wvixiσ′′,
for all
i∈[1,m]).*
A symmetric claim holds if W, (T′′,U′′) correspond to an R-balancing
step.
We note a concrete consequence for future use.
(Fig. 2 might be again helpful.)
Corollary 13**.**
Let Gσ be a d0-safe form of W.
If W is the pivot of a balancing step, then the respective
bal-result can be written as (Eσ,Fσ)
where \textscvar(E,F)⊆\textscvar(G) and
W.l.o.g. we assume an
L-balancing step, and use
E=E′σ and F guaranteed
by Proposition 12,
where xiσ=Fi for all i∈[1,m].
We thus have
[TABLE]
since for presenting E we redirect each arc in E′ that leads to xi towards the root
of Fi (for i∈[1,m]). Since
A(x1,…,xm)uE′ where ∣u∣=d0, we have
\textscNtSize(E′)≤d0⋅\textscSInc.
Since all F,F1,F2,…,Fm are reachable from G in at most
d0 steps, we get
\textscSize({F,F1,F2,…,Fm})≤\textscSize(G)+(m+1)⋅d0⋅\textscSInc by Proposition 5(3); moreover, all
sets
\textscvar(F) and \textscvar(Fi), i∈[1,m], are thus subsets of
\textscvar(G). The claim follows.
∎
We derive a small bound on the number
of bal-results when the pivot is fixed.
We put
[TABLE]
(referring to
the grammar G=(N,Σ,R)).
Proposition 14**.**
The number of bal-results related to a fixed pivot W is at most
d1.
Proof.
Given W, we fix its d0-safe form
Gσ (e.g., a d0-top form). Now we suppose that W=Gσ is the pivot of an L-balancing step;
let (Eσ,Fσ)=(E′σσ,Fσ)
be the respective bal-result, as captured by
Proposition 12.
We have at most ∣R∣d0 options for u′ determining F, and
at most ∣N∣⋅∣R∣d0 options for E′.
For each i∈[1,m], we have at most
1+∣R∣1+∣R∣2⋯+∣R∣d0−1≤max{d0,∣R∣d0} options for Fi.
Altogether we get no more than
∣N∣⋅(max{d0,∣R∣d0})m+2 options for the
bal-result.
The same number bounds the possible bal-results of R-balancing steps
with the pivot W, hence the claim follows.
∎
Balanced modified plays, and pivot paths.
We now describe a balancing policy, yielding a sequence of balancing steps
that transform a completed play to a “balanced” modified play;
the idea of this policy
(in a different
framework)
can be traced back to Sénizergues [1] (and was
also used by Stirling [14]).
Let T0∼U0 and let π be a completed play π from
(T0,U0). We show a sequence of transformation phases;
after j phases we will get a completed modified play
from (T0,U0) of the
form
πj=μ0ρ1′μ1ρ2′⋯μj−1ρj′πj′
where
πj′ is a play to be transformed in the (j+1)-th phase.
We start with π0=π0′=π.
In general
πj′ is not a suffix of π but the lengths of the modified plays
π0,π1,π2,… are the same (recall
Proposition 11).
In the end
we get a balanced modified playπℓ=μ0ρ1′μ1ρ2′⋯μℓ−1ρℓ′πℓ′
(for some ℓ≥0) where πℓ′ is non-transformable;
this final modified play
πℓ=μ0ρ1′μ1ρ2′⋯μℓ−1ρℓ′μℓ (where μℓ=πℓ′)
can be also presented as
[TABLE]
where μj is U0T0v0′⟶v0U1T1
for j=0 and
Uj′′Tj′′vj′⟶vjUj+1Tj+1
for j∈[1,ℓ], and
ρj′ is UjTjuj′⟶ujUj′Tj′⊙Uj′′Tj′′ (for j∈[1,ℓ]).
By ρj we denote
UjTjuj′⟶ujUj′Tj′, and we have either ρj⊢Lρj′ or
ρj⊢Rρj′. (Hence all μj and ρj are plays,
while ρj′ is a modified play resulting from ρj by
a balancing step.)
By our conventions (and associativity of ⊙) we can present
πℓ=μ0ρ1′μ1ρ2′⋯μℓ−1ρℓ′μℓ also as
[TABLE]
There are ℓ (occurrences of) pivots
W1,W2,⋯,Wℓ in (17),
where Wj∈{Tj,Uj}
for each j∈[1,ℓ]; the bal-result corresponding to Wj is
(Tj′′,Uj′′).
Though the pivots Wj can be changing their sides (we can have, e.g.,
Wj=Uj and Wj+1=Tj+1), they will be on one
specific pivot path in the LTS LG\textscr,
denoted
[TABLE]
and defined below;
we will have W0∈{T0,U0} and
Wℓ+1∈{Tℓ+1,Uℓ+1} but
W0,Wℓ+1 are no pivots, except the case w0=ε and
W0=W1.
The pivot path will be a useful ingredient for applying our bound on
(n,s,g)-sequences
(Lemma 10).
Now we describe the transformation phases (as non-effective
procedures), giving also a finer presentation of μj (j∈[1,ℓ]) as
μj=μj\textscu or μj=μj\textscuμj\textscs
(u for “unclear”, s for “sinking”) to be
discussed later.
The first phase, starting with π0=π, works as follows:
If possible, present π0 as μ0ρ1π′ where ρ1 enables a balancing step
(on any side)
and μ0ρ1 is the shortest possible. If there is no such
presentation of π0, then put μ0=π0 and halt (here
ℓ=0). In this case we do not need to define the
path (18).
2. 2.
Replace ρ1 with ρ1′ where ρ1⊢Lρ1′
or ρ1⊢Rρ1′ (choosing arbitrarily when ρ1 allows both
L-balancing and R-balancing). Finally replace
π′
with a completed play π1′ from the bal-result,
i.e., from \textscEnd(ρ1′), thus getting
π1=μ0ρ1′π1′ where
μ0ρ1′=U0T0v0′⟶v0U1T1u1′⟶u1U1′T1′⊙U1′′T1′′.
We also define the prefix W0w0W1 of (18):
if we have ρ1⊢Lρ1′, hence W1=U1, then this prefix
is U0v0′U1; if ρ1⊢Rρ1′, hence W1=T1, then
the prefix
is T0v0T1.
For j≥1, the (j+1)-th phase starts with
πj=μ0ρ1′μ1ρ2′⋯μj−1ρj′πj′
where the last balancing step was either left, ρj⊢Lρj′, or
right, ρj⊢Rρj′.
We
describe the (j+1)-th phase for the case ρj⊢Lρj′;
the other case is symmetric. We recall Figure 6 and
present ρj′πj′ as
We have also already defined the prefix
W0w0W1w1W2⋯wj−1Wj
of (18), and we have Wj=Uj in our considered case
ρj⊢Lρj′.
Informally,
the (j+1)-phase aims to make a balancing step in πj′ as
early as possible but balancing at the opposite side than previously
is a bit constrained.
In our case a future right balancing would entail
that the next pivot is on the path E′σ′′v, and we first have
to wait until a term xiσ′′ is exposed (i.e., until a prefix of
v exposes one of V1,V2 in Figure 6, where U
represents the last pivot Uj). Only then a
right balancing is allowed. This exposing must obviously happen soon
(i.e., for a
short prefix of v) if a further left balancing is not enabled for a
while (since in this case E′σ′′v must be quickly sinking along a
branch of E′).
Hence if even under this constraint the earliest next balancing will
be a right balancing, then the next pivot Tj+1 will be the final
term on a path
E′σ′′vj1xiσ′′vj2Tj+1 where
vj1vj2 is a prefix of v and vj1 is short.
Since xiσ′′ is reachable by a short vˉ
from the last pivot Uj
(e.g., if xiσ′′=V2 in Figure 6, then
we use Uvˉ2V2),
we continue building the pivot
path smoothly:
in our case WjwjWj+1 will be defined as
Ujvˉxiσ′′vj2Tj+1.
When a left (unconstrained) balancing is the earliest possibility,
WjwjWj+1 will be defined simply as
Ujuj′vj′Uj+1 for the respective prefix vj′ of v′.
(We note that the pivot path gets a bit
shorter than the modified play (17) whenever a switch of balancing
sides occurrs.)
Now we describe the (j+1)-phase more formally
(assuming ρj⊢Lρj′).
If possible, present πj′=Uj′E′σ′′v′⟶v as μjρj+1π′
with the shortest possible
μjρj+1 where
a)
either ρj+1 enables L-balancing,
2. b)
or ρj+1 does not
enable L-balancing but it enables R-balancing
and the
path E′σ′′vjTj+1 in the play μj=Uj′E′σ′′vj′⟶vjUj+1Tj+1
can be written
E′σ′′vj1xiσ′′vj2Tj+1
where E′vj1xi, for some i∈[1,m].
(We recall that Ujvxiσ′′ where
∣v∣<d0.)
If there is no such
presentation of πj′, then
put μj=πj′ and halt (here ℓ=j).
In this case we have
ρℓ′μℓ=WℓA(x1,…,xm)σ′uℓ′⟶uℓUℓ′E′σ′⊙Uℓ′E′σ′′vℓ′⟶vℓUℓ+1Tℓ+1
and we define WℓwℓWℓ+1 as
Wℓuℓ′vℓ′Uℓ+1.
In each case we get
μj=Uj′E′σ′′vj′⟶vjUj+1Tj+1,
and if E′σ′′vjTj+1 can be written
E′σ′′vj1xiσ′′vj2Tj+1 where
E′vj1xi
(which holds in the case b) by definition),
then we put
μj=μj\textscuμj\textscs where
μj\textscu=Uj′E′σ′′vj1′⟶vj1Ujxiσ′′
and
μj\textscs=Ujxiσ′′vj2′⟶vj2Uj+1Tj+1;
otherwise μj=μj\textscu.
(We note that the “unclear” play μj\textscu is always short. The
“sinking” play μj\textscs can be nonempty even if there is no
switch in balancing sides, and μj\textscs can be long, but both paths in
μj\textscs are quickly sinking [since no balancing possibility
appears].)
2. 2.
Replace ρj+1 with ρj+1′
where ρj+1⊢Lρj+1′
in the case a),
and ρj+1⊢Rρj+1′ in the case b).
Finally replace
π′
with a completed play πj+1′ from the bal-result,
i.e., from \textscEnd(ρj+1′), thus getting
πj+1=μ0ρ1′μ1ρ2′⋯μjρj+1′πj+1′.
In the case ρj+1⊢Lρj+1′ we have
ρj′μj=WjA(x1,…,xm)σ′uj′⟶ujUj′E′σ′⊙Uj′E′σ′′vj′⟶vjWj+1Tj+1
and we put wj=uj′vj′, thus defining WjwjWj+1.
In the case ρj+1⊢Rρj+1′ we have
ρj′μj=WjA(x1,…,xm)σ′uj′⟶ujUj′E′σ′⊙Uj′E′σ′′vj1′⟶vj1Ujxiσ′′vj2′⟶vj2Uj+1Wj+1
and we define WjwjWj+1 by
putting wj=vvj2
for a respective v, ∣v∣<d0, for which
Wjvxiσ′′.
As already mentioned, the work of the (j+1)-phase in the case
ρj⊢Rρj′ is symmetric;
here we have R-balancing in the “unconditional” case a), and
L-balancing in the case b) that now requires a prefix
μj\textscu=F′σ′′Tj′vj1′⟶vj1xiσ′′Tj (where xiσ′′ is shortly reachable
from the last pivot Tj).
6 Analysis of Balanced Modified Plays
Assuming a given grammar G=(N,Σ,R),
we have shown a transformation of a completed play π starting
in (T0,U0) (where T0,U0 can be large regular terms)
to
a balanced modified play
πℓ=μ0ρ1′μ1ρ2′⋯μℓ−1ρℓ′μℓ in the form (17),
repeated here:
[TABLE]
In this section we perform a technical analysis of such
πℓ,
to verify that we indeed get specific small
numbers n,s,g and c yielding (8), where
E=EB for a “sound” (n,s,g)-candidate B
(which will turn out equal to the base
Bn,s,g, as discussed in Section 7).
First we recall the
discussion at the beginning of Section 5
and give an informal
overview of the future analysis.
We recall that in the pivot path
W0w0W1w1W2⋯wℓ−1WℓwℓWℓ+1
we have Wj∈{Tj,Uj} for j∈[0,ℓ+1], and the pivots
W1,W2,…, Wℓ have the respective related (eqlevel-decreasing)
bal-results (T1′′,U1′′),(T2′′,U2′′),…,(Tℓ′′,Uℓ′′).
Referring to (19), we recall that ui (hence also ui′) are short since
∣ui∣=∣ui′∣=d0 for all i∈[1,ℓ] (and d0
from (6)).
Recalling the discussion around (14), we can
present (19) in a refined form as
[TABLE]
here
[Uj′′Tj′′vj′⟶vjUj+1Tj+1uj+1′⟶uj+1Uj+1′Tj+1′],
for j∈[1,ℓ],
is presented as
[Uj′′Tj′′vj1′⟶vj1UjTjvj2′⟶vj2Uj+1Tj+1uj+1′⟶uj+1Uj+1′Tj+1′]
where vj1 is short and both paths
Tjvj2Tj+1 and
Ujvj2′Uj+1 are d0-sinking (i.e., in each segment
of length d0 of these paths a root-successor in the term that starts the segment is exposed); we can have
vj2=ε.
The first segment W0w1W1 is one of the paths T0v0T1 and
U0v0′U1; each of these two paths is d0-sinking (since
otherwise the first balancing would be possible earlier).
For the segment WjwjWj+1, j∈[1,ℓ], we have four
options:
•
Ujuj′vj1′Ujvj2′Uj+1, if Wj=Uj and
Wj+1=Uj+1;
•
Tjujvj1Tjvj2Tj+1, if Wj=Tj and
Wj+1=Tj+1;
•
UjvˉTjvj2Tj+1 for some
vˉ, ∣vˉ∣<d0,
if Wj=Uj and
Wj+1=Tj+1;
•
TjvˉUjvj2′Uj+1 for some
vˉ, ∣vˉ∣<d0,
if Wj=Tj and
Wj+1=Uj+1.
Hence each WjwjWj+1 has a short “unclear” prefix
(it is unclear if it sinks or not), followed
by a d0-sinking suffix (which might be empty, or short, or long
…).
This entails that if the path WjwjWj+1 visits a subterm
of W0, which is surely the case for
W0w0W1,
then Wj+1 is
shortly reachable from a subterm of W0.
Indeed,
if WjwjWj+1 is Wjwj′Vwj′′Wj+1
where V is the last subterm of W0 visited by the path
WjwjWj+1, then wj′′ has a short unclear prefix (maybe
empty) followed by a d0-sinking suffix; but if this suffix was not
short, then it would necessarily expose a root-successor in V, which is another
subterm of W0; this would contradict the choice of V.
(Figure 2 might be again helpful to realize this
fact.)
For each subterm V of W0 we certainly have only a small number of
terms W that are shortly reachable from V.
Since there is only a small number of possible bal-results related to each
concrete pivot W, and the bal-results do not repeat, we get that
the number of indices j∈[0,ℓ] for which WjwjWj+1 visits a subterm
of W0 is bounded by d⋅\textscSize(T0,U0) for a small
constant d. (We recall that W0∈{T0,U0}.)
We say that a segment of the pivot path of the form
VwWj+1wj+1Wj+2⋯wj+z−1Wj+zw′V′
is crucial if w is a nonempty suffix of wj, 1≤z≤ℓ−j,
w′ is a prefix of wj+z,
V is a subterm of W0, and no subterm of W0 is visited
inside the segment; moreover,
either V′ is a subterm of W0
or V′=Wℓ+1 (the end of
the pivot path).
(We can again look at Figure 2, and imagine that
W0 is the (maybe large regular) term in the rectangle and V is its subterm
determined in the third rectangle, whose root is B. The next two steps
can be viewed as a prefix of a crucial segment that could finish after
many steps later when some of the root-successors of B in the
rectangle is exposed and becomes the current root.)
Since each crucial segment is non-sinking (until the last
step), it gives rise to an
(n,s,g)-sequence (for some small n,s,g), as was depicted in
Figure 5 and discussed in the informal
beginning of
Section 5.
It is thus intuitively clear that the length of any crucial segment
of the pivot path, as well as the length of its corresponding segment
of the modified play (19), is bounded by
d′⋅EBn,s,g for a small constant d′ (and the
(n,s,g)-base Bn,s,g, by Lemma 10).
Since each crucial segment is fully determined by the segment
WjwjWj+1 in which it starts (and which visits a subterm of
W0),
there are at most d⋅\textscSize(T0,U0) crucial segments, and
their overall length is thus bounded by d⋅\textscSize(T0,U0)⋅d′⋅EBn,s,g.
Hence
we are approaching the required bound
for a small constant c.
The bound c⋅(\textscSize(T0,U0))2 serves for bounding the sum of
lengths of subpaths of WjwjWj+1 (and the corresponding
subplays in (19)) when both sides are quickly
sinking “inside” the (regular) terms T0 and U0, respectively.
(An extreme case is when there is no balancing
since
both paths from T0 and U0, respectively, are d0-sinking all
the time.)
Since the eq-level drops by one in each step of each play
in (19), we cannot have a repeat of a pair there.
Hence there is some small c such that c⋅(\textscSize(T0,U0))2
bounds the number of those pairs
in (19) in which
both members are “close to” subterms of T0 or U0.
This bounds the sum of lengths of the respective
segments of (19) that are sinking “closely to
T0,U0” on both sides.
The claim of Theorem 7 is now almost
clear; it will be completed
in Section 7 where we show that the respective
constant E=EBn,s,g is indeed computable.
In the rest of this section we perform a routine (and somewhat
tedious) analysis to show some concrete numbers n,s,g,c (cf.
Table 1 at the end of the paper).
Refined presentations of balanced modified plays.
Assuming a given grammar G=(N,Σ,R), we fix
a completed play π from some (maybe large regular terms) (T0,U0)
and its transformation
πℓ=μ0ρ1′μ1ρ2′⋯μℓ−1ρℓ′πℓ′
in the previous notation; in fact, we also use a finer
form and write
[TABLE]
(where the superscript u can be read as “unclear” and
s as “sinking”).
We add that μ0\textscs=μ0 and that we view ε (the empty sequence)
also as the empty play, and we put
μj\textscs=ε in the cases where μj\textscs
has not been defined
explicitly. As expected, we stipulate \textsclength(ε)=0,
\textscPairs(ε)=∅, and
με=εμ=μ
for all (modified) plays μ.
The presentation (17) is accordingly refined
(as in (20)) to
[TABLE]
where, for j∈[1,ℓ], we have
μj\textscu=Uj′′Tj′′vj1′⟶vj1UjTj,
and either
μj\textscs=UjTjvj2′⟶vj2Uj+1Tj+1 or
μj\textscs=ε in which case
vj2=vj2′=ε, Tj=Tj+1,
Uj=Uj+1.
To explain the use of the superscript s (“sinking”) in
μj\textscs, we
introduce a few notions.
An (A,i)-sink word v∈R+
(satisfying A(x1,…,xm)vxi) is also called
a sink-segment;
any
path of the form VvV′ is then also
understood as a sink-segment
(presentable as A(x1,…,xm)σvxiσ).
We say that a pathVvV′ is d0-sinking, if
v=v1v2⋯vk+1 where ∣vj∣<d0 for all j∈[1,k+1]
and vj, j∈[1,k], are sink-segments.
A zero-length path
VεV is d0-sinking, by putting k=0 and
vk+1=ε.
A playμ=UTv′⟶vU′T′
is d0-sinking if both its paths TvT′ and
Uv′U′ are d0-sinking. In particular, a zero-length
play μ=UT is d0-sinking, and we also view
the empty play ε as d0-sinking.
The above transformation (of π to πℓ) guarantees that
all plays μ0, μ1\textscs, μ2\textscs, …,
μℓ\textscs are d0-sinking (therefore we have put
μ0=μ0\textscs). Indeed, if some
μj\textscs (j∈[0,ℓ])
was not d0-sinking, then there would be a possibility
to make a “legal”
balancing step earlier in the respective transformation phase.
The presentations (21)
and (22)
also yield the corresponding refined version
of the pivot path (18):
[TABLE]
where each segment
Wjwj\textscsWj+1
(for j∈[0,ℓ] when putting W0=W0) corresponds
to one of the paths in the play
μj\textscs, and is thus d0-sinking.
More concretely, W0w0\textscsW1
(where w0\textscs=w0)
is either T0v0T1 or
U0v0′U1, and
Wjwj\textscsWj+1 is either
Tjvj2Tj+1 or
Ujvj2′Uj+1.
Each (“unclear”) segment
Wjwj\textscuWj is one of the following paths:
•
Ujuj′vj1′Uj, if Wj=Uj and
Wj+1=Uj+1 (in which case Uj′=Uj′′);
•
Tjujvj1Tj+1, if Wj=Tj and
Wj+1=Tj+1 (in which case Tj′=Tj′′);
•
UjvTj for some v, ∣v∣<d0,
if Wj=Uj and
Wj+1=Tj+1;
•
TjvUj for some v, ∣v∣<d0,
if Wj=Tj and
Wj+1=Uj+1.
We now note that the length of each segment
ρj′μj\textscu=UjTjuj′⟶ujUj′Tj′⊙Uj′′Tj′′vj1′⟶vj1UjTj, and of the respective
pivot-path segment Wjwj\textscuWj, can be bounded
by the small number
[TABLE]
Proposition 15**.**
For each j∈[1,ℓ] we have ∣wj\textscu∣≤\textsclength(ρj′μj\textscu)≤d2.
Proof.
We have ∣wj\textscu∣≤\textsclength(ρj′μj\textscu) by the above definitions
(since \textsclength(ρj′μj\textscu)≥d0, and either
∣wj\textscu∣=\textsclength(ρj′μj\textscu) or ∣wj\textscu∣<d0).
W.l.o.g. we suppose ρj⊢Lρj′ (illustrated in Fig.6)
and present ρj′μj\textscu accordingly as
where
A(x1,…,xm)ujE′ and ∣uj∣=d0; hence
0pt(E′)≤1+d0⋅\textscHInc.
We have Tj=Tj+1 if μj\textscs=ε, and
Tj=xiσ′′ (for some i∈[1,m])
if μj\textscs=ε.
The path
E′σ′′vj1Tj must be
d0-sinking (otherwise there would be
an earlier next balancing step).
Hence
∣vj1∣≤0pt(E′)⋅(d0−1).
We thus get
Having bounded the parts ρj′μj\textscu, we will
now bound
the total length of the suffixes of μj\textscs that are “close
to” T0,U0; then we will finally bound the number and the length
of so-called “crucial segments” of πℓ starting with pivots that are also close
to T0,U0 in a sense.
Close sink-parts in πℓ.
Since μ0=μ0\textscs=U0T0v0′⟶v0U1T1
is d0-sinking, both paths T0v0T1 and U0v0′U1
are frequently visiting subterms of the terms T0 and U0.
Using the fact that no pair repeats along πℓ
(recall Proposition 11),
we now derive a bound on the length of μ0 and other
segments that are “close” to (T0,U0).
For each j∈[1,ℓ] where μj\textscs=ε
we define the presentation
μj\textscs=μj\textscusμj\textsccs
(the superscript us for “unclear sinking” and
cs for “close sinking”) as follows:
If some of the paths in the play
μj\textscs=UjTjvj2′⟶vj2Uj+1Tj+1
never visits a subterm of T0 or U0, then
μj\textscus=μj\textscs and
μj\textsccs=ε.
Otherwise
we write μj\textscs as
UjTjvj2′⟶vj2UjTjvj2′⟶vj2Uj+1Tj+1
for the shortest prefix
μj\textscus=UjTjvj2′⟶vj2UjTj
such that each of the paths
Tjvj2Tj
and
Ujvj2′Uj
visits a
subterm of T0 or U0; in this case
μj\textsccs=UjTjvj2′⟶vj2Uj+1Tj+1.
(Since μj\textscs is d0-sinking,
both paths
Tjvj2Tj+1 and
Ujvj2′Uj+1
are frequently visiting subterms of the terms T0 and U0.)
If μj\textscs=ε, then we put
μj\textscus=μj\textsccs=ε; we also put
μ0=μ0\textscs=μ0\textsccs (while μ0\textscus=ε).
The balanced modified play πℓ (21) can be
thus presented in more detail as
[TABLE]
We refer to
μj\textsccs, j∈[0,ℓ], as to
close sink-parts.
The next proposition bounds the total length of close sink-parts
in (25), using
the small number
The number of subterms of T0 and U0 is
\textscSize(T0,U0), and each
term can reach at most max{∣R∣d0,d0}
terms within less than d0 steps
(since ∣R∣0+∣R∣1+⋯+∣R∣d0−1≤∣R∣d0
when ∣R∣≥2).
Hence there are at most
\big{(}\max\{|\mathcal{R}|^{d_{0}},d_{0}\}\cdot\textsc{Size}(T_{0},U_{0})\,\big{)}^{2} elements
in
⋃j∈[0,ℓ]\textscPairs(μj\textsccs).
Since there is no repeat of a pair in
πℓ,
the claim follows.
∎
Crucial segments of πℓ.
For πℓ=μ0\textsccsρ1′μ1\textscuμ1\textscusμ1\textsccsρ2′μ2\textscuμ2\textscusμ2\textsccs⋯ρℓ′μℓ\textscuμℓ\textscusμℓ\textsccs
and the respective pivot path W0w0W1w1W2w2⋯WℓwℓWℓ+1,
assuming ℓ≥1,
we say that Wj, j∈[1,ℓ] is close
(which is another variant of closeness to (T0,U0)) if the path
Wj−1wj−1Wj visits a subterm of T0 or U0; in this
case we also write Wj−1wj−1Wj as
Wj−1wj−1′Vj−1wj−1′′Wj
where Vj−1 is the
last subterm of T0 or U0 in the path (not excluding the cases
Vj−1=Wj−1 and Vj−1=Wj). We note that W1 is close,
since W0∈{T0,U0}.
Let {j∈[1,ℓ]∣Wj is close}={k1,k2,…,kp}
where 1=k1<k2<k3⋯<kp≤ℓ; for technical reasons we
also put kp+1=ℓ+1.
The pivot path can be thus written
[TABLE]
where the brackets are just highlighting the corresponding segments.
We use the segmentation (27) of the pivot path to
induce the following segmentation of πℓ:
[TABLE]
The highlighted segments are called the crucial segments (of
πℓ).
The total length of “non-crucial” segments
μ0\textsccs, μk2−1\textsccs, μk3−1\textsccs, ⋯, μℓ\textsccs
is bounded by Proposition 16.
We note that μj\textsccs inside the crucial segments are
empty since otherwise we had a close pivot there.
For bounding the number p of crucial segments and their lengths, it
is useful to use the notions of stairs and their simple-stair
decompositions.
A word v∈R∗ is a stair if v=ε or
v=rv′ where r∈R, let r be
A(x1,…,xm)aE, and Ev′F for some F∈\textscVar.
If v is a stair,
then any path of the form VvV′ is also
called a stair (in the form A(x1,…,xm)σvFσ).
Hence no prefix of a stair is a sink-segment.
We say that v=rv′∈R+
(r∈R) is
a simple stair if A(x1,…,xm)rEv′F
(for r being A(x1,…,xm)aE)
where F is a
subterm of E with a nonterminal root (hence F∈\textscVar)
and v′ is a (possibly empty) concatenation of (possibly long) sink-segments
(hence v′=u1u2⋯uk where ui, i∈[1,k], are
sink-segments).
If v is a simple stair, then also any path VvV′
is called a simple
stair.
Proposition 17**.**
Any stair v∈R∗ has the unique simple-stair
decompositionv=v1v2⋯vq (q∈N) where vi,
i∈[1,q], are simple stairs.
2. 2.
If Gv1v2⋯vqG′ where vi
are simple stairs, then
\textscSize(G′)≤\textscSize(G)+q⋅\textscSInc; moreover, if G is finite, then
0pt(G′)≤0pt(G)+q⋅\textscHInc.
Proof.
By induction on ∣v∣, for stairs v. If v=ε, then q=0.
If ∣v∣>0, then we write v=v1v′ for the shortest v1∈R+
such that v′ is a stair; v′ has the unique simple-stair
decomposition by the induction hypothesis.
We can easily verify that v1 is a simple stair, and that we cannot have
v1v′=v1′v′′ where v1′ is
a simple stair, v′′ is a stair (decomposed into simple stairs),
and v1′=v1.
We recall that A(x1,…,xm)rE entails
\textscSize(Eσ)≤\textscSize(A(x1,…,xm)σ)+\textscSInc,
and we have
\textscSize(Fσ)≤\textscSize(Eσ) for any
subterm F of E; moreover, if A(x1,…,xm)σ is finite,
then 0pt(Fσ)≤0pt(Eσ)≤0pt(A(x1,…,xm)σ)+\textscHInc.
∎
Bounding the number of crucial segments.
To
bound the number p of crucial segments, we use the small number
[TABLE]
where \textscSrhs={F∣F is a subterm of the rhs
of a rule
in R and F∈\textscVar}.
Proposition 18**.**
The number p of crucial segments is
at most
d4⋅\textscSize(T0,U0).
Proof.
First we note that we can have Wj=Wj′
for different j,j′∈[1,ℓ]; but for each W we can have
W=Wj for at most d1 indices j∈[1,ℓ], since there are at
most d1 possible bal-results for each pivot
(Proposition 14) and the
bal-results (Tj′′,Uj′′), j∈[1,ℓ], are all pairwise
different (Proposition 11).
Hence if we get a bound on the cardinality of the set
\textscSP={Wk1,Wk2,…,Wkp}
of “starting pivots” of the crucial segments
(where k1=1), then multiplying this bound by d1 yields a bound
on p.
We fix j∈[1,p], and note that
the stair Vkj−1wkj−1′′Wkj
is a suffix of the path
Wkj−1wkj−1\textscuWkj−1wkj−1\textscsWkj,
where ∣wkj−1\textscu∣≤d2 and
Wkj−1wkj−1\textscsWkj can be written
Wkj−1wWwWkj where w is a
sequence of sink-segments and ∣w∣<d0.
The simple-stair decomposition of Vkj−1wkj−1′′Wkj
is thus a sequence of at most d2+(d0−1) simple stairs.
Hence a (generous) upper bound on ∣\textscSP∣ is
\textscSize(T0,U0)⋅(1+∣\textscSrhs∣)d2+d0−1.
This yields p≤\textscSize(T0,U0)⋅(1+∣\textscSrhs∣)d2+d0−1⋅d1=d4⋅\textscSize(T0,U0) as claimed.
∎
Bounding the lengths of crucial segments.
For j∈[1,p], we view the number kj+1−kj
as the index length of the crucial
segment \big{[}\rho^{\prime}_{k_{j}}\cdots\mu^{\textsc{us}}_{k_{j+1}-1}\big{]}.
We first bound the index length, defining n,s,g and using the bound
on (n,s,g)-sequences (Lemma 10), and then we
bound the standard length.
We first note that each highlighted segment
in (27)
is a stair.
Indeed, if
the path
[TABLE]
(for j∈[1,p])
had a prefix that is a sink-segment, then one of
Wkj+1,Wkj+2,…,Wkj+1−1 would be also close, since
Vkj−1 is the last subterm of T0 or U0 in
Wkj−1wkj−1Wkj, and each subterm of Vkj−1 is
also a subterm of T0 or U0.
Thus the index length of crucial segments is bounded due to the next
lemma, for which we define
the following small numbers:
[TABLE]
[TABLE]
[TABLE]
Lemma 19**.**
We assume a balanced modified play
πℓ=μ0\textsccsρ1′μ1\textscuμ1\textscusμ1\textsccs⋯ρℓ′μℓ\textscuμℓ\textscusμℓ\textsccs
and the respective pivot path W0w0W1w1⋯WℓwℓWℓ+1.
Let
[TABLE]
be a segment of the pivot path that is a stair,
where j≥0, k≥1, j+k≤ℓ,
and w is a suffix of wj.
Let e=1+\textscel(\textscEnd(ρj+1′))
(where \textscEnd(ρj+1′)
is the bal-result related to the pivot Wj+1, hence
(Tj+1′′,Uj+1′′) in (22)).
Then k≤EB
for each (n,s,g)-candidate
B that is full below e; in particular, k≤EBn,s,g.
(Here n,s,g are the numbers defined
by (29), (30), (31).)
Proof.
We will show that the (eqlevel-decreasing)
sequence \textscEnd(ρj+1′),
\textscEnd(ρj+2′), …, \textscEnd(ρj+k′)
of the bal-results
corresponding to the pivots Wj+1,
Wj+2, …,
Wj+k
can be presented as an
(n,s,g)-sequence
[TABLE]
The claim then follows by
Lemma 10.
Hence it remains to show the presentation (33) of
the respective bal-results.
By the definition of
stairs,
we can present (32) as
A(x1,…,xm)σ′wG1′σ′wj+1G2′σ′⋯wj+k−1Gk′σ′
where
[TABLE]
we thus have Wj+i=Gi′σ′ (for i∈[1,k]) where Gi′
are finite terms with nonterminal roots.
Recalling the refined presentation (23), we write
the path
Wj+iwj+i\textscuWj+iwj+i\textscsWj+i+1,
for each i∈[0,k−1], as
Wj+iwj+i\textscuWj+iwiWj+iwiWj+i+1
where
Wj+iwiWj+i
is a sequence of sink-segments of lengths less than d0,
and ∣wi∣<d0.
We thus present (34) as
[TABLE]
We recall that ∣wj+i\textscu∣≤d2 (for all i∈[0,k−1]).
Since w is a suffix of
wj\textscuwj\textscs=wj\textscuw0w0,
we note that the simple-stair decomposition of the
stair A(x1,…,xm)wG1′ is a sequence of at most
d2+(d0−1) simple stairs.
More generally, for each i∈[1,k], the simple-stair
decomposition of the stair
[TABLE]
is a sequence of at most i⋅(d2+(d0−1)) simple stairs; hence
[TABLE]
(recalling Proposition 17).
We recall the relation of a pivot, Wj+i=Gi′σ′ in our case,
and its bal-result,
as captured by Proposition 12 (and illustrated
in Figure 6).
We note that Gi′σ′ might not be a d0-safe form of Wj+i
(due to possible short branches of Gi′).
This leads us to present
V=A(x1,…,xm)σ′ in a d0-top form, as
A(x1,…,xm)σσ where
A(x1,…,xm)σ is the respective
d0-top.
Putting Gi=Gi′σ, we get
Wj+i=Gi′σ′=Gi′σσ=Giσ, for each
i∈[1,k]. We have
\textscvar(Gi)⊆\textscvar(A(x1,…,xm)σ)⊆{x1,…,xn} (for
n=md0), and
any word v∈R∗ with ∣v∣≤d0
that is performable from Wj+i=Giσ is
performable from Gi as well.
Since Giσ is thus a d0-safe form of
Wj+i,
the bal-result related to Wj+i=Giσ
can be written as (Eiσ,Fiσ) where
\textscvar(Ei,Fi)⊆\textscvar(Gi)⊆{x1,…,xn},
and \textscSize(Ei,Fi)≤\textscSize(Gi)+(m+2)⋅d0⋅\textscSInc (by Corollary 13).
By mimicking the derivation of the bound (35), we get
Since \textscSize(A(x1,…,xm)σ)≤md0+1,
and g=(d2+d0−1)⋅\textscSInc, we get
\textscSize(Gi)≤md0+1+i⋅g, for all i∈[1,k].
From \textscSize(Ei,Fi)≤\textscSize(Gi)+(m+2)⋅d0⋅\textscSInc we derive, for all i∈[1,k], that
[TABLE]
Hence the sequence \textscEnd(ρj+1′),
\textscEnd(ρj+2′), …, \textscEnd(ρj+k′)
can be indeed presented as an (n,s,g)-sequence
(E1σ,F1σ),(E2σ,F2σ),…,(Ekσ,Fkσ).
∎
Corollary 20**.**
For each crucial segment ρkj′⋯μkj+1−1\textscus we
have kj+1−kj≤EB for each (n,s,g)-candidate
B that is full below 1+\textscel(\textscEnd(ρkj′));
in particular, kj+1−kj≤EBn,s,g.
We will now bound the (standard) length of a crucial segment by
multiplying its index length, increased by 1, by
the small
number
[TABLE]
Proposition 21**.**
For each j∈[1,p] we have
\textsclength(ρkj′⋯μkj+1−1\textscus)≤d5⋅(1+kj+1−kj).
Proof.
We fix
a crucial segment ρkj′⋯μkj+1−1\textscus.
We make a convenient notational change
(using j+1 for the previous kj, and k for kj+1−kj)
and present
this segment as
(for i∈[1,k−1] we have μj+i\textscus=μj+i\textscs since
μj+i\textsccs=ε).
In a more detailed presentation, the segment is a prefix of
[TABLE]
finishing somewhere in the part
Uj+kTj+kvj+k,2′⟶vj+k,2Uj+k+1Tj+k+1,
as determined by μj+k\textsccs (which might be empty or
nonempty).
We also consider the related pivot-path stair
[TABLE]
where VwWj+1 is related to the part
ρj′μj\textscuμj\textscs
that precedes our crucial segment: the path VwWj+1
is the suffix
Vjwj′′Wj+1 of Wjwj\textscuWjwj\textscsWj+1
for the
respective last subterm
Vj of T0 or U0.
We present the stair (38)
similarly as
the stair (32) in the proof of
Lemma 19.
We get V=A(x1,…,xm)σ′ and
which yields \textsclength(ρj+1′⋯μj+k\textscus)≤d5⋅(1+k) and thus finishes the proof.
We show (39):
Similarly as (35), we derive
0pt(Gi′)≤1+i⋅(d2+d0−1)⋅\textscHInc, for all i∈[1,k].
Since ∣wj+i\textscu∣≤\textsclength(ρj+i′μj+i\textscu)≤d2,
∣wiwi∣=\textsclength(μj+i\textscs),
GiwiGi
is a sequence of sink-segments of lengths less than d0,
and ∣wi∣<d0, we also derive
We show (40):
We recall that \textsclength(ρj+k′μj+k\textscu)≤d2, and aim to bound μj+k\textscus,
assuming μj+k\textscus=ε.
In this case \textscStart(μj+k\textscus)=(Tj+k,Uj+k), and both paths
Tj+kvj+k,2, Uj+kvj+k,2
of the play μj+k\textscusμj+k\textsccs
(recall (37))
are d0-sinking.
In the worst case the play μj+k\textscus
finishes when each of these two paths visits a subterm of T0 or U0
(in which case μj+k\textsccs=ε follows).
Due to the construction of ρj+k′μj+k\textscu we have that
both Tj+k and Uj+k are reachable from
the pivot Wj+k=Gk′σ′∈{Tj+k,Uj+k} in at most d2
steps (in fact, one even in less than d0 steps).
We recall that \textscvar(Gk′)⊆{x1,…,xm} and
that xqσ′ is a subterm of T0 or U0, for each
q∈[1,m] (since V=A(x1,…,xm)σ′ is a subterm of
T0 or U0). Thus if the respective paths
Gk′σ′vTj+k
and
Gk′σ′vUj+k,
where ∣v∣≤d2 and ∣v∣≤d2,
“sink inside”
the
terms xqσ′, they visit subterms of T0 or U0 at such
moments.
The pair
(Tj+k,Uj+k)
can be thus surely presented as
(Eσ1,Fσ2)
where \textscvar(E) and \textscvar(F) are subsets
of {x1,…,xm}, the terms
xqσ1 and xqσ2 are subterms of
T0 or U0, for each
q∈[1,m], and both
0pt(E) and 0pt(F) are bounded by
0pt(Gk′)+d2⋅\textscHInc.
Therefore μj+k\textscus cannot be longer than
(d0−1)⋅(0pt(Gk′)+d2⋅\textscHInc). This yields
\textsclength(ρj+k′μj+k\textscuμj+k\textscus)≤d2+(d0−1)⋅(0pt(Gk′)+d2⋅\textscHInc), which
implies (40).
∎
Below we repeat the statement of
Theorem 7,
and show a proof based on the previous results.
In fact, it remains to prove that E=EBn,s,g
is computable. The idea is that we stepwise increase an under-approximation
of Bn,s,g and of the respective E; the pairs
(E,F) (of the respective sizes) that are in this process so far deemed to be equivalent
(i.e., assumed to satisfy E∼F) are verified by using
the assumption (43) for the current
(under-approximation of) E. If we find that
\textsc{el}(E,F)\leq c\cdot\big{(}\mathcal{E}\cdot\textsc{Size}(E,F)+(\textsc{Size}(E,F))^{2}\big{)}
for some of such pairs (E,F)
(which can be checked
Proposition 6),
then we adjust (increase) the
under-approximation. This process must clearly terminate, and at the
end the claim (43) holds for all T∼U, as
can be easily shown by contradicting the existence of a violating pair
T∼U with the least eq-level.
Theorem 7. *
For any grammar G=(N,Σ,R)
there is a small number c and a computable (not
necessarily small) number E such that for all
T,U∈\textscTermsN we have:*
[TABLE]
Proof.
We fix a grammar G=(N,Σ,R), which determines the
small numbers in Table 1,
and two terms T0,U0 such that T0∼U0.
Let
[TABLE]
be a respective balanced modified play
for which we
use the above developed notions and
notation;
we recall that
\textsclength(πℓ)=\textscel(T0,U0).
Highlighting the crucial segments, we write πℓ as
[TABLE]
We have p=0 (and ℓ=0) if πℓ=μ0\textsccs; otherwise
1=k1<k2<k3⋯<kp<kp+1=ℓ+1.
The close sink-segments μkj−1\textsccs, for j∈[1,p+1],
might be empty or
nonempty, but all close sink-segments inside the crucial segments are
empty.
The total length of the close sink-segments
is bounded by
d3⋅(\textscSize(T0,U0))2 (by Proposition 16),
the number p of the crucial segments is bounded by d4⋅\textscSize(T0,U0)
(by Proposition 18),
and the length of each crucial segment is bounded by
d5⋅(1+EBn,s,g)
(by Corollary 20 and
Proposition 21).
Hence \textsclength(πℓ) (and thus \textscel(T0,U0)) is bounded by
It remains to show that EBn,s,g is computable.
We first recall that EBn,s,g in the bound
d5⋅(1+EBn,s,g)
on the length of each crucial segment can be refined, as stated in
Corollary 20.
For all terms T,U we thus get
the following implication:
[TABLE]
for any (n,s,g)-candidate B that is full below
\textscel(T,U). (In this case B is surely full below
1+\textscel(Eσ,Fσ) for the first, and each further, bal-result
(Eσ,Fσ)
in any balanced modified play from (T,U), if there is any
balancing step there at all.)
For k∈N we define the (reflexive and symmetric) relation ≈k
on \textscTermsN
as follows:
hence ∼⊆≈k for all k∈N.
We say that an (n,s,g)-candidate B
is k-sound (for k∈N)
if
(\textscPairsn,s∖B)⊆≈k
and, moreover, in the case n>0 the (n−1,s′,g)-candidate B′ is k-sound (we use the
notation (10)).
An (n,s,g)-candidateB is sound if it is
EB-sound.
We note that the full candidate Bn,s,g is sound (since
all relevant
pairs outside Bn,s,g are in ∼, and
thus in ≈k for all k).
There is an obvious algorithm that constructs a sound
(n,s,g)-candidate B, for the above defined small n,s,g, and
c. (Just a systematic brute-force search would do.)
We will now observe that for each sound (n,s,g)-candidate B we
have ≈EB=∼ (on the set \textscTermsN),
and thus
B=Bn,s,g; by this the proof will be finished.
For the sake of contradiction we suppose a sound (n,s,g)-candidate B
and some
(T,U)∈≈EB∩∼ where
\textscel(T,U) is the least possible.
Then B is full below
\textscel(T,U) (for any (T′,U′) with
\textscel(T′,U′)<\textscel(T,U) we have T′≈EBU′,
hence all relevant (T′,U′)
with \textscel(T′,U′)<\textscel(T,U)
must be in B since B is
sound).
But then (45), applied to our T,U,B,
contradicts the assumption T≈EBU.
∎
Acknowledgements.
The author acknowledges the support of the Grant Agency of the Czech
Rep., GAČR 18-11193S, and thanks
Sylvain Schmitz for a detailed discussion
and his comments helping to improve the form of the paper.
Also the useful comments of anonymous reviewers are gratefully acknowledged.
Bibliography27
The reference list from the paper itself. Each links out to its DOI / PubMed record.
1[1] G. Sénizergues, L(A)=L(B)? Decidability results from complete formal systems, Theor. Comput. Sci. 251 (1–2) (2001) 1–166.
2[2] R. Milner, Communication and concurrency, Prentice-Hall, Inc., 1989.
3[3] J. Baeten, J. Bergstra, J. Klop, Decidability of bisimulation equivalence for processes generating context-free languages, J.ACM 40 (3) (1993) 653–682.
4[4] J. Srba, Roadmap of infinite results, in: Current Trends In Theoretical Computer Science, The Challenge of the New Century, Vol. 2, World Scientific Publishing Co., 2004, pp. 337–350, (updated version at http://users-cs.au.dk/srba/roadmap/).
5[5] G. Sénizergues, The bisimulation problem for equational graphs of finite out-degree, SIAM J.Comput. 34 (5) (2005) 1025–1106, (preliminary version at FOCS’98).