This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
)] ≥ 2/3. We want to test periodicity in the family of functions defined on N. To make the problem finite, we fix an upper bound on the period. Then, a function f : {0, . . . , T − 1} → S is q-periodic, for 1 ≤ q < T , if f (x + aq) = f (x), for every x, a ∈ N such that x + aq < T . The problem we now want to test is if there exists a period less than some given number t. More precisely, we define for integers 2 ≤ t ≤ T, INT-PERIOD(T, t) = {f : {0, . . . , T − 1} → S | ∃q : 1 ≤ q < t, f is q-periodic}. Here we do not require that q divides t since we do not have any finite group structure.
Quantum Testers for Hidden Group Properties
427
Test Integer periodf (T, t, δ) 1. N ← Ω((log T )2 /δ). 2. For i = 1, . . . , N do yi ← Fourier samplingf (ZT ), and use the continued fractions method to round yTi to the nearest fraction abii with bi < t. 3. p ← lcm{bi : 1 ≤ i ≤ N }. 4. If p ≥ t, reject. 5. Tp ← T /pp. 6. M ← Ω(1/δ). 7. For i = 1, . . . , M let ai , xi ∈R ZTp . 1 |{i : f (xi + ai p mod Tp ) = f (xi )}| < 2δ . 8. Accept iff M Theorem 3. For 0 < δ < 1, and integers 2 ≤ t ≤ T such that T /(log T )4 = Ω((t log t/δ)2 ), Test Integer period(T, t, δ) is a δ-tester with two-sided error for INT-PERIOD(T, t) on the family of functions from {0, . . . , T − 1} to S, with O((log T )2 /δ) query complexity and (log T /δ)O(1) time complexity.
5
Common Coset Range
In this section, G denotes a finite group and S a finite set. Let f0 , f1 be functions from G to S. For a normal subgroup H G, we say that f0 and f1 are Hsimilar if on all cosets of H the ranges of f0 and f1 are the same, that is, the multiset equality f0 (xH) = f1 (xH) holds for every x ∈ G. Consider the function f : G × Z2 → S, where by definition f (x, b) = fb (x). We will use f for (f0 , f1 ) when it is convenient in the coming discussion. We denote by Range(H) the set of functions f such that f0 and f1 are H-similar. We say that H is (k, t)-generated, for some positive integers k, t, if |H| ≤ k and it is the normal closure of a subgroup generated by at most t elements. The aim of this section is to establish that for any positive integers k and t, the family COMMON-COSET-RANGE(k, t) (for short CCR(k, t)), defined as the set {f : G × Z2 → S | ∃H G : H is (k, t)-generated, f0 and f1 are H-similar}, can be tested by the following quantum test. Note that a subgroup of size k is always generated by at most log k elements, therefore we always assume that t ≤ log k. In the testing algorithm, we assume that we have a quantum oracle for the function f : G × Z2 → S. Test Common coset rangef (G, k, t, δ) 1. N ← 2kt log(|G|)/δ. 2. For i = 1, . . . , N do (ρi , bi ) ← Fourier samplingf (G × Z2 ). 3. Accept iff ∃H G : H is (k, t)-generated ∀i (bi = 1 =⇒ ρi ∈ H ⊥ ). We first prove the robustness of the property that when Fourier samplingf (G × Z2 ) outputs (ρ, 1), where G is any finite group, H G and f ∈ Range(H), then ρ is not in H ⊥ .
428
Katalin Friedl et al.
Lemma 5. Let S be a finite set and G a finite group. Let f : G × Z2 → S and H G. Then dist(f, Range(H)) ≤ |H| · Pr[Fourier samplingf (G × Z2 ) outputs (ρ, 1) such that ρ ∈ H ⊥ ]. Our next theorem implies that CCR(k, t) is query efficiently testable when k is polynomial in log|G|. Theorem 4. For any finite set S, finite group G, integers k ≥ 1, 1 ≤ t ≤ log k, and 0 < δ < 1, Test Common coset range(G, k, t, δ) is a δ-tester for CCR(k, t) on the family of all functions from G × Z2 to S, with O(kt log(|G|)/δ) query complexity. The proof technique of Theorem 4.2 of [2] yields: Theorem 5. Let G be a finite Abelian group and let k be the exponent of G. For testing CCR(k, 1) on G, any classical randomized bounded error query algorithm on G requires Ω( |G|) queries.
References 1. C. H. Bennett and G. Brassard. Quantum cryptography: Public key distribution and coin tossing. In Proc. IEEE International Conference on Computers, Systems, and Signal Processing, pages 175–179, 1984. 2. H. Buhrman, L. Fortnow, I. Newman, and H. R¨ ohrig. Quantum property testing. In Proc. ACM-SIAM Symposium on Discrete Algorithms, 2003. 3. M. Blum, M. Luby, and R. Rubinfeld. Self-testing/correcting with applications to numerical problems. J. Comput. System Sci., 47(3):549–595, 1993. 4. W. van Dam, F. Magniez, M. Mosca, and M. Santha. Self-testing of universal and fault-tolerant sets of quantum gates. Proc. 32nd ACM STOC, pp. 688–696, 2000. 5. M. Ettinger and P. Høyer. On quantum algorithms for noncommutative hidden subgroups. Adv. in Appl. Math., 25(3):239–251, 2000. 6. E. Fischer. The art of uninformed decisions: A primer to property testing, the computational complexity. In The Computational Complexity Column, volume 75, pages 97–126. The Bulletin of the EATCS, 2001. 7. K. Friedl, G. Ivanyos, F. Magniez, M. Santha, and P. Sen. Hidden translation and orbit coset in quantum computing. In Proc. 35th ACM STOC, 2003. 8. O. Goldreich, S. Goldwasser, and D. Ron. Property testing and its connection to learning and approximation. J. ACM, 45(4):653–750, 1998. 9. L. Hales. The Quantum Fourier Transform and Extensions of the Abelian Hidden Subgroup Problem. PhD thesis, University of California, Berkeley, 2002. 10. L. Hales and S. Hallgren. An improved quantum Fourier transform algorithm and applications. In Proc. 41st IEEE FOCS, pages 515–525, 2000. 11. A. Kitaev. Quantum measurements and the Abelian Stabilizer Problem. Technical report no. 9511026, Quantum Physics e-Print archive, 1995. 12. D. Mayers and A. Yao. Quantum cryptography with imperfect apparatus. In Proc. 39th IEEE FOCS, pages 503–509, 1998. 13. M. Nielsen and I. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, 2000. 14. R. Rubinfeld and M. Sudan. Robust characterizations of polynomials with applications to program testing. SIAM J. Comp., 25(2):23–32, 1996. 15. P. Shor. Algorithms for quantum computation: Discrete logarithm and factoring. SIAM J. Comp., 26(5):1484–1509, 1997.
Local LTL with Past Constants Is Expressively Complete for Mazurkiewicz Traces Paul Gastin1 , Madhavan Mukund2 , and K. Narayan Kumar2 1 2
LIAFA, Universit´e Paris 7, 2, place Jussieu, F-75251 Paris Cedex 05, France [email protected] Chennai Mathematical Institute, 92 G N Chetty Road, Chennai 600 017, India {madhavan,kumar}@cmi.ac.in
Abstract. To obtain an expressively complete linear-time temporal logic (LTL) over Mazurkiewicz traces that is computationally tractable, we need to intepret formulas locally, at individual events in a trace, rather than globally, at configurations. Such local logics necessarily require past modalities, in contrast to the classical setting of LTL over sequences. Earlier attempts at defining expressively complete local logics have used very general past modalities as well as filters (side-conditions) that “look sideways” and talk of concurrent events. In this paper, we show that it is possible to use unfiltered future modalities in conjunction with past constants and still obtain a logic that is expressively complete over traces. Keywords: Temporal logics, Mazurkiewicz traces, concurrency
1
Introduction
Linear-time temporal logic (LTL) [17] has established itself as a useful formalism for specifying the interleaved behaviour of reactive systems. To combat the combinatorial blow-up involved in describing computations of concurrent systems in terms of interleavings, there has been a lot of interest in using temporal logic more directly on labelled partial orders. Mazurkiewicz traces [13] are labelled partial orders generated by dependence alphabets of the form (Σ, D), where D is a dependence relation over Σ. If (a, b) ∈ / D, a and b are deemed to be independent actions that may occur concurrently. Traces are a natural formalism for describing the behaviour of static networks of communicating finite-state agents [24]. LTL over Σ-labelled sequences is equivalent to FOΣ (<), the first-order logic over Σ-labelled linear orders [12] and thus defines the class of aperiodic languages over Σ. Though FOΣ (<) permits assertions about both the past and the future, future modalities suffice for establishing the expressive completeness of LTL with respect to FOΣ (<) [8]. From a practical point of view, a finite-state program may be checked against an LTL specification relatively efficiently.
Partial support of CEFIPRA-IFCPAR Project 2102-1 (ACSMV) is gratefully acknowledged.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 429–438, 2003. c Springer-Verlag Berlin Heidelberg 2003
430
Paul Gastin, Madhavan Mukund, and K. Narayan Kumar
The first expressively complete temporal logic over traces was described in [6] for finite traces and in [19] for infinite traces. The result was refined in [4] to show expressive completeness without past modalities, using an extension of the proof technique developed for LTL in [23]. Formulas in both these logics are defined at global configurations (maximal antichains). Unfortunately, reasoning at the level of global configurations makes the complexity of deciding satisfiability non-elementary [21]. Computational tractability seems to require interpreting formulas at local states—effectively at individual events. Recently, in [10], a local temporal logic has been defined over traces and shown to be expressively complete and tractable (the satisfiability problem is in Pspace). This logic uses both future and past modalities (similar to the until and since operators of LTL) which are further equipped with filters (side-conditions). It was also shown that for finite traces, a restricted form of past modalities suffices, but only in conjunction with filtered future modalities. Another proposal is presented in [1] and this logic also uses the since operator. LTL without any past operators is expressively complete over words but this cannot be the case for traces: there exist two first-order inequivalent traces that cannot be distinguished using only future modalities [22]. In this paper, we show that a very limited ability to talk about the past is sufficient to obtain expressive completeness over traces. Our logic uses unfiltered future modalities and a finite number of past constants. (In particular, there is no nesting of past operators and for that matter even future formulas cannot be nested into past formulas.) As in [3,4,10], we show expressive completeness using an extension to traces of the proof technique introduced in [23] for LTL over sequences. From the recent general result proved in [9], it follows that the satisfiability problem for this new logic is also in Pspace. The paper is organized as follows. We begin with some preliminaries about traces. In Section 3 we define our new temporal logic. Section 4 describes a syntactic partition of traces that is used in Section 5 to establish expressive completeness. Many proofs have had to be omitted in this extended abstract. A full version of the paper is available in [11].
2
Preliminaries
We briefly recall some notions about Mazurkiewicz traces (see [5] for background). A dependence alphabet is a pair (Σ, D) where the alphabet Σ is a finite set of actions and the dependence relation D ⊆ Σ ×Σ is reflexive and symmetric. The independence relation I is the complement of D. For A ⊆ Σ, the set of letters independent of A is denoted by I(A) = {b ∈ Σ | (a, b) ∈ I for all a ∈ A} and the set of letters depending on (some action in) A is denoted by D(A) = Σ \ I(A). A Mazurkiewicz trace is a labelled partial order t = [V, ≤, λ] where V is a set of vertices labelled by λ : V → Σ and ≤ is a partial order over V satisfying the following conditions: For all x ∈ V , the downward set ↓x = {y ∈ V | y ≤ x} is finite, (λ(x), λ(y)) ∈ D implies x ≤ y or y ≤ x, and xy implies (λ(x), λ(y)) ∈ D, where = < \ <2 is the immediate successor relation in t.
Local LTL with Past Constants Is Expressively Complete
431
The alphabet of a trace t is the set alph(t) = λ(V ) ⊆ Σ and its alphabet at infinity, alphinf(t), is the set of letters occurring infinitely often in t. The set of all traces is denoted by R(Σ, D) or simply by R. A trace t is called finite if V is finite. For t = [V, ≤, λ] ∈ R, we define min(t) ⊆ V as the set of all minimal vertices of t. We can also read min(t) ⊆ Σ as the set of labels of the minimal vertices of t. It will be clear from the context what we actually mean. Let t1 = [V1 , ≤1 , λ1 ] and t2 = [V2 , ≤2 , λ2 ] be a pair of traces such that alphinf(t1 ) × alph(t2 ) ⊆ I. We then define the concatenation of t1 and t2 to be t1 ·t2 = [V, ≤, λ] where V = V1 ∪V2 (assuming wlog that V1 ∩V2 = ∅), λ = λ1 ∪λ2 and ≤ is the transitive closure of the relation ≤1 ∪ ≤2 ∪ (V1 × V2 ∩ λ−1 (D)). The set of finite traces is then a monoid, denoted M(Σ, D) or simply M, with the empty trace 1 = (∅, ∅, ∅) as unit. Here is some useful notation for subclasses of traces. For C ⊆ Σ, let RC = {t ∈ R | alph(x) ⊆ C} and MC = M ∩ RC . Also, (alph = C) = {t ∈ R | alph(t) = C}, (alphinf = C) = {t ∈ R | alphinf(t) = C} and (min = C) = {t ∈ R | min(t) = C}. For A, C ⊆ Σ, we set RA C = RC ∩ (alphinf = A). Observe that MC = R∅C . The first order theory of traces FOΣ (<) is given by the syntax: ϕ ::= Pa (x) | x < y | ¬ϕ | ϕ ∨ ϕ | ∃xϕ, where a ∈ Σ and x, y ∈ Var are first order variables. Given a trace t = [V, ≤, λ] and a valuation σ : Var → V , t, σ |= ϕ denotes that t satisfies ϕ under σ. We interpret each predicate Pa by the set {x ∈ V | λ(x) = a} and the relation < as the strict partial order relation of t. The semantics then lifts to all formulas as usual. Since the meaning of a closed formula (sentence) ϕ is independent of the valuation σ, we can associate with each sentence ϕ the language L(ϕ) = {t ∈ R | t |= ϕ}. We say that a trace language L ⊆ R is expressible in FOΣ (<) if there exists a sentence ϕ ∈ FOΣ (<) such that L = L(ϕ). We denote by FO(Σ,D) (<) the set of trace languages L ⊆ R(Σ, D) that are expressible in FOΣ (<). For n > 0, FOnΣ (<) denotes the set of formulas with at most n distinct variables (note that each variable may be bound and reused several times). We use the algebraic notion of recognizability. Let h : M → S be a morphism to a finite monoid S. For t, u ∈ R, we say that t and u are h-similar, denoted t ∼h u, if either t, u ∈ M and h(t) = h(u) or t and u have infinite factorizations in non-empty finite traces t = t1 t2 · · ·, u = u1 u2 · · · with h(ti ) = h(ui ) for all i. The transitive closure ≈h of ∼h is an equivalence relation. Since S is finite, this equivalence relation is of finite index with at most |S|2 + |S| equivalence classes. A trace language L ⊆ R is recognized by h if it is saturated by ≈h (or equivalently by ∼h ), i.e., t ∈ L implies [t]≈h ⊆ L for all t ∈ R. Let L ⊆ R be recognized by a morphism h : M → S. For B ⊆ Σ, L ∩ MB and L ∩ RB are recognized by h MB the restriction of h to MB . A finite monoid S is aperiodic if there is an n ≥ 0 such that sn = sn+1 for all s ∈ S. A trace language L ⊆ R is aperiodic if it is recognized by some morphism to a finite and aperiodic monoid. First-order definability coincides with aperiodicity for traces.
432
Paul Gastin, Madhavan Mukund, and K. Narayan Kumar
Theorem 1 ([6,7]). A language L ⊆ R(Σ, D) is expressible in FOΣ (<) if and only if it is aperiodic.
3
Local Temporal Logic
We denote by LocTLiΣ the set of (internal) formulas over the alphabet Σ. They are given by the following syntax: ϕ ::= a ∈ Σ | ¬ϕ | ϕ ∨ ϕ | EX ϕ | ϕ U ϕ | ¬a S b, a, b ∈ Σ Let t = [V, ≤, λ] ∈ R be a finite or infinite trace and let x ∈ V be some vertex of t. We write t, x |= ϕ to denote that trace t at node x satisfies the formula ϕ ∈ LocTLiΣ . This is defined inductively as follows: t, x |= a t, x |= ¬ϕ t, x |= ϕ ∨ ψ t, x |= EX ϕ t, x |= ϕ U ψ t, x |= ¬a S b
ϕ ϕUψ
λ(x) = a t, x |= ϕ t, x |= ϕ or t, x |= ψ ∃y. x y and t, y |= ϕ ∃z ≥ x. [t, z |= ψ and ∀y. (x ≤ y < z) ⇒ t, y |= ϕ] ∃z ≤ x. [λ(z) = b and ∀y. (z < y ≤ x) ⇒ λ(y) = a]
if if if if if if
@
@ @
ψ
b
@ ¬a @ @ ¬a S b
The modality U is the “universal” until operator defined in [3]. The modality S is the corresponding since operator. Note that we only use the operator S in the very restricted form of a fixed number of past constants. Past modalities are essential, as indicated by the following example from [22], where the dependence relation is a − b − c − d. These two traces are not first-order equivalent but are bisimilar at the level of events and thus cannot be distinguished by purely future modalities. a → b → c → b → c ··· d → c → b → c → b ··· ↑ ↑ a→b d→c As usual, we can derive useful operators such as universal next AX ϕ = ¬ EX ¬ϕ, eventually in the future F ϕ = U ϕ and always in the future G ϕ = ¬ F ¬ϕ. The modality F∞ a = F a ∧ G(a ⇒ EX F a) expresses the existence of infinitely many vertices labelled with a above the current vertex. Traces as Models of Formulas: We now turn our attention to defining when a trace satisfies a formula. For LTL over sequences, lifting satisfaction at positions to satisfaction by a word is quite simple: a word models a formula if its initial position models the formula. Since a trace, in general, does not have a unique
Local LTL with Past Constants Is Expressively Complete
433
initial position, we need to use initial formulas as introduced in [3]. These are boolean combinations of formulas EM ϕ, each of which asserts the existence of a minimal vertex in a trace satisfying the internal formula ϕ. More precisely, the set LocTLΣ of initial formulas over the alphabet Σ is defined as follows: α ::= ⊥ | EM ϕ, ϕ ∈ LocTLiΣ | ¬α | α ∨ α The semantics of EM is given by: t |= EM ϕ if ∃x. (x ∈ min(t) and t, x |= ϕ) An initial formula α ∈ LocTLΣ defines the trace language L(α) = {t ∈ R | t |= α}. We can then express various alphabetic properties using initial formulas: L(EM a) = {t ∈ R | a ∈ min(t)}, L(EM F a) = {t ∈ R | a ∈ alph(t)}, and L(EM F∞ a) = {t ∈ R | a ∈ alphinf(t)}. Therefore, for C ⊆ Σ, trace languages such as (alph = C), (alphinf = C) and (min = C) are expressible in LocTLΣ . The following result is immediate from the definition of LocTLΣ . Proposition 2. If a trace language is expressible in LocTLΣ , then it is expressible in FO3Σ (<). We now show that the “filtered” modalities EXb and Fb from [10], with the following semantics, are both expressible in LocTLiΣ . t, x |= EXb ϕ if ∃y. [x y and t, y |= ϕ and ∀z. (z ≤ y ∧ λ(z) = b) ⇒ z ≤ x] t, x |= Fb ϕ if ∃y. [x ≤ y and t, y |= ϕ and ∀z. (z ≤ y ∧ λ(z) = b) ⇒ z ≤ x] Proposition 3. For any trace t over some alphabet Σ, any position x in t and any formula ϕ of LocTLiΣ t, x |= EXb ϕ ⇐⇒ t, x |= (b ∧ EX(ϕ ∧ ¬b)) ∨ (a ∧ EX(ϕ ∧ ¬(¬a S b)))
a=b
Let the formula Safeb = (b ∧ AX ¬b) ∨ a=b (a ∧ AX ¬(¬a S b)). Further, let F0b ϕ = Safeb U ϕ and Fk+1 ϕ = Safeb U EXb (Fkb ϕ). b Proposition 4. For any trace t ∈ R(Σ, D), any position x in t and any formula ϕ of LocTLiΣ Fkb ϕ t, x |= Fb ϕ ⇐⇒ t, x |= k≤|Σ|
Now we establish some important lemmas that are critical in proving the expressive completeness of LocTLΣ . Lemma 5. Let A ⊆ Σ and b ∈ Σ with b ∈ / A. For all ϕ ∈ LocTLiA , there i is a formula ϕ ∈ LocTLA∪{b} such that for all t = t1 bt2 t3 ∈ R with t1 ∈ R, t2 ∈ RA , min(t2 ) ⊆ D(b) and min(t3 ) ⊆ {b} and for all x ∈ bt2 we have bt2 , x |= ϕ iff t, x |= ϕ.
t1
b
t2
b
t3
434
Paul Gastin, Madhavan Mukund, and K. Narayan Kumar
EX Proof Sketch. We have a = a, ¬ϕ = ¬ϕ, ϕ ∨ψ =ϕ ∨ ψ, ϕ = EXb ϕ, ϕ Uψ = U (d ∧ ψ)) ∧ Fb (d ∧ ψ)) and ¬c S d = (¬c S d) ∧ ¬(¬d S b). d∈A∪{b} ((ϕ Lemma 6. Let A ⊆ Σ and b ∈ Σ with b ∈ / A. For all α ∈ LocTLA , there exists a formula α ∈ LocTLiA∪{b} such that for all t = t1 bt2 t3 ∈ R with t1 ∈ R, t2 ∈ RA , min(t2 ) ⊆ D(b) and min(t3 ) ⊆ {b}, we have t2 |= α if and only if t, min(bt2 t3 ) |= α. Proof Sketch. We have ¬α = ¬α, α ∨ β = α ∨ β and EM ϕ = EX(ϕ ∧ ¬b) where ϕ is the formula given by Lemma 5. Lemma 7. Let A ⊆ Σ and b ∈ Σ with b ∈ / A. For all α ∈ LocTLA , there exists a formula α ∈ LocTLA∪{b} such that for all t = t1 t2 with t1 ∈ RA and min(t2 ) ⊆ {b}, we have t1 |= α if and only if t |= α . ¬ϕ Proof Sketch. Let ϕ ∨ψ =ϕ ∨ ψ, = ¬ϕ, EX ϕ = EX(ϕ ∧ ¬(¬b S b)), ϕ Uψ = ϕ U (ψ ∧ ¬(¬b S b)) and ¬c S d = ¬c S d. Then, for all t = t1 t2 with t1 ∈ RA , min(t2 ) ⊆ {b} and for all x ∈ t1 , we have t1 , x |= ϕ if and only if t, x |= ϕ. ϕ = EM(ϕ Finally, let EM ∧ ¬b).
4
Decomposition of Traces
The proof of our main result is a case analysis based on partitioning the set of traces according to the structure of the trace. Fix a letter b ∈ Σ and set B = Σ \ {b}. Using the notation introduced in Section 2, let Γ A = {t ∈ RA B | min(t) ⊆ D(b)}, Γ = Γ ∅ , and ΩA = {t ∈ RI(A) | min(t) ⊆ {b}}. Each trace t ∈ R has a unique finite or infinite factorization t = t0 bt1 bt2 · · · with t0 ∈ RB and ti ∈ RB ∩ (min ⊆ D(b)) for all i > 0. In particular, we have (bΓ )∗ bΓ A ΩA (min = {b}) = (bΓ )+ (bΓ )ω ∅=A⊆B
The following two results will allow us to use this decomposition effectively in proving the expressive completeness of our logic. For this, we use F∞ b a = Fb a ∧ ¬ Fb (a ∧ ¬ EXb Fb a). Lemma 8. Let t = t0 t with t0 , t ∈ R and min(t ) = {b}. Then, 1. t ∈ (bΓ )∞ \ {1} if and only if t, min(t ) |= β with ∞ ∞ F c∧ ¬F c β= C
c∈C
c∈C /
where C ranges over connected subsets of Σ such that b ∈ C if C = ∅.
Local LTL with Past Constants Is Expressively Complete
435
2. t ∈ (bΓ )∗ bΓ A ΩA if and only if t, min(t ) |= γ with ∞ ∞ ∞ ∞ ¬F c ∧ F b ∧ F c∧ Fb a ∧ ¬ Fb a . γ= C⊆Σ
c∈C
c∈C /
a∈A
a∈A /
A
Note that “the” b in bΓ ΩA is characterized by the formula b ∧ F∞ b a, where a is any letter in A. Lemma 9. Let A ⊆ Σ and let L ⊆ R be a trace language recognized by a morphism h from M into a finite monoid S. Then, L ∩ (bΓ )∗ bΓ A ΩA = (L1 ∩ (bΓ )∗ )b(L2 ∩ Γ A )(L3 ∩ ΩA ) finite where the trace languages Li ⊆ R are recognized by h.
5
Expressive Completeness
If T is a finite alphabet, we define the linear temporal logic LTLT (XU) by the syntax: f ::= u ∈ T | f XU f | ¬f | f ∨ f. The length of a finite or infinite word w = w1 w2 · · · ∈ T ∞ is |w| ∈ N ∪ {ω}. For a word w = w1 w2 · · · ∈ T ∞ the semantics of LTLT (XU) is given by w |= u if |w| > 0 and w1 = u w |= f XU g if ∃j ∈ N with 1 < j ≤ |w| + 1 and wj wj+1 · · · |= g and wk wk+1 · · · |= f, ∀1 < k < j. Note that if w |= f XU g then w is nonempty. A formula f ∈ LTLT (XU) defines the word language L(f ) = {w ∈ T ∞ | w |= f }. We use the following proposition which is a consequence of several results on the equivalence between aperiodic word languages, star-free word languages, first order word languages and word languages expressible in LTLT (XU) [18,12,14,20,8,15,16,2]. Proposition 10. Every aperiodic word language K ∈ T ∞ is expressible in LTLT (XU). We fix T = h(bΓ ) and we define the mapping σ : (bΓ )∞ → T ∞ by σ(t) = h(bt1 )h(bt2 ) · · · if t = bt1 bt2 · · · with ti ∈ Γ for i ≥ 1. Note that the mapping σ is well-defined since each trace t ∈ (bΓ )∞ has a unique factorization t = bt1 bt2 · · · with ti ∈ Γ for i ≥ 1. Lemma 11. Let L ⊆ R be recognized by h. Then, 1. L ∩ (bΓ )ω = σ −1 (K) for some K expressible in LTLT (XU). 2. L ∩ (bΓ )+ = σ −1 (K) for some K expressible in LTLT (XU). Next we show show how to lift an LTLT (XU) formula for K ⊆ T ∞ to a LocTLi formula for σ −1 (K) ∈ (bΓ )∞ . Lemma 12. Suppose that any aperiodic trace language over B is expressible in LocTLB . Then, for all f ∈ LTLT (XU) there exists f ∈ LocTLiΣ such that for all t = t1 t with t1 ∈ R and t ∈ (bΓ )∞ \ {1}, we have σ(t ) |= f iff t, min(t ) |= f.
436
Paul Gastin, Madhavan Mukund, and K. Narayan Kumar
Proof Sketch. The formula f is defined by structural induction. We let f ∨g =
f ∨ g, ¬f = ¬f , f XU g = EX (¬b ∨ f ) U (b ∧ g) . The difficult case is when f = s ∈ T . For all r ∈ S, the trace language h−1 (r) ∩ MB is aperiodic and therefore expressible in LocTLB by the hypothesis of the lemma: we find αr ∈ LocTLB such that for all t ∈ MB , h(t ) = r if and only if t|= αr . Let αr ∈ LocTLiΣ be the formula obtained using Lemma 6. We let s = h(b)·r=s αr . Lemma 13. Suppose that any aperiodic trace language over B is expressible in LocTLB . Let A ⊆ Σ be non-empty and let f ∈ LTLT (XU). There exists f ∈ LocTLiΣ such that for all t = t1 t2 t3 with t1 ∈ R, t2 ∈ (bΓ )∗ , t3 ∈ bΓ A ΩA , we have σ(t2 ) |= f iff t, min(t2 t3 ) |= f. Lemma 14. Suppose that for any proper subset A of Σ, any aperiodic trace language over A is expressible in LocTLA . Let L ⊆ R be an aperiodic trace language over Σ. Then, for all b ∈ Σ, there exists ϕ ∈ LocTLiΣ such that for all t = t0 t with t0 , t ∈ R and min(t ) = {b}, t ∈ L iff t, min(t ) |= ϕ. Proof. We prove this lemma by induction on the size of the alphabet Σ. If Σ = ∅ then there is nothing to prove. Now, suppose that Σ = ∅ and let b ∈ Σ. We assume that L is recognized by the aperiodic morphism h : M → S. Now, L ∩ (min = {b}) can be written as (L ∩ (bΓ )∗ bΓ A ΩA ). (L ∩ ((bΓ )∞ \ {1})) ∅=A⊆B
By Lemma 11 we get L ∩ ((bΓ )∞ \ {1}) = σ −1 (L(f )) for some f ∈ LTLT (XU). From the hypothesis, aperiodic languages over B are expressible in LocTLB . Hence, we can apply Lemma 12 and we get f such that for all t = t0 t with t0 ∈ R and t ∈ (bΓ )∞ \ {1}, we have σ(t ) |= f iff t, min(t ) |= f. We conclude this case taking ϕ = β ∧ f where β is defined in Lemma 8. Now, we consider L ∩ (bΓ )∗ bΓ A ΩA where ∅ = A ⊆ B. By Lemma 9, (L1 ∩ (bΓ )∗ )b(L2 ∩ Γ A )(L3 ∩ ΩA ) L ∩ (bΓ )∗ bΓ A ΩA = finite where each Li is an aperiodic language recognized by h. Thus, it suffices to show that for aperiodic languages L1 , L2 and L3 recognized by h, there is a formula ϕ such that for all t = t0 t with t0 , t ∈ R and min(t ) = {b}, we have t, min(t ) |= ϕ if and only if t ∈ (L1 ∩ (bΓ )∗ )b(L2 ∩ Γ A )(L3 ∩ ΩA ). By Lemma 11 we get L1 ∩ (bΓ )∗ = σ −1 (L(f1 )) for some f1 ∈ LTLT (XU). From the hypothesis, aperiodic languages over B are expressible in LocTLB . Hence, we can apply Lemma 13 and we get f1 such that for all t = t0 t1 t with t0 ∈ R and t1 ∈ (bΓ )∗ , and t ∈ bΓ A ΩA , we have t1 ∈ L1 iff t, min(t1 t ) |= f1 . Using again the hypothesis of the lemma, we get some formula α2 ∈ LocTLB such that L2 ∩ RB = L(α2 ). By Lemma 6 we find α2 ∈ LocTLiΣ such that for all t = t0 t1 bt2 t3 with t0 ∈ R and t1 ∈ (bΓ )∗ , t2 ∈ Γ A and t3 ∈ ΩA , we have t2 ∈ L2 iff t, min(bt2 t3 ) |= α2 .
Local LTL with Past Constants Is Expressively Complete
437
Finally, L3 is an aperiodic trace language over a smaller alphabet (since A = ∅, I(A) is a proper subset of Σ) and hence by induction hypothesis there is a formula ϕ3 such that for all t = t0 t1 bt2 t3 with t0 ∈ R and t1 ∈ (bΓ )∗ , t2 ∈ Γ A and t3 ∈ ΩA with t3 = 1, we have t3 ∈ L3 iff t, min(t3 ) |= ϕ3 . Putting these three pieces together we let ψ = f1 ∧ F(b ∧ F∞ b a ∧ α2 ∧ (ϕ4 ∨ Fb EX(b ∧ ϕ3 ))) / L3 and ϕ4 = ¬ EX F b otherwise. Then, for all t = t0 t1 bt2 t3 with ϕ4 = ⊥ if 1 ∈ with t0 ∈ R and t1 ∈ (bΓ )∗ , t2 ∈ Γ A and t3 ∈ ΩA , we get from the above discussion that t1 bt2 t3 ∈ L1 bL2 L3 if and only if t, min(t1 bt2 t3 ) |= ψ. We complete the proof with ϕ = γ ∧ ψ where γ is the formula defined in Lemma 8. Theorem 15. Any aperiodic real trace language over R(Σ, D) is expressible in LocTLΣ . Proof. The proof proceeds by induction on the size of Σ. When Σ = {a} is a singleton, L is either a finite set or the union of a finite set and a set of the form an a∗ for some n ≥ 0. In both cases, it is easy to check that L is expressible in LocTLΣ . For the inductive step, assume that the theorem holds for any aperiodic language over any proper subset of Σ. Let L be recognized by an aperiodic morphism h : M → S. Let b ∈ Σ and B = Σ \ {b} as usual. We can show as in Lemma 9 that L can be written as follows: L = (L1 ∩ RB )(L2 ∩ (min ⊆ {b})) finite
where L1 and L2 are languages recognized by the same aperiodic morphism h. Since the decomposition of any trace t ∈ R as t1 t2 with t1 ∈ RB and t2 ∈ (min ⊆ {b}) is unique, the above decomposition can be rewritten as (L1 ∩ RB )(min ⊆ {b}) ∩ (RB (L2 ∩ (min ⊆ {b}))) L = finite
Now, by the induction hypothesis, there is formula α1 in LocTLB such that for t1 ∈ RB , t1 |= α1 if and only if t1 ∈ L1 . Thus, by Lemma 7, there is a formula α 1 in LocTLΣ such that t |= α 1 if and only if t1 |= α1 whenever t = t1 t2 with α1 ). t1 ∈ RB and min(t2 ) ⊆ {b}. Thus, (L1 ∩ RB )(min ⊆ {b}) = L( Since we have assumed expressive completeness for every proper subset of Σ, by Lemma 14 there is a formula ϕ2 such that for any t = t1 t2 with min(t2 ) = b, t2 ∈ L2 if and only if t, min(t2 ) |= ϕ2 . Consider the formula α = α ∨ EM((b ∧ ϕ2 ) ∨ (¬b ∧ Fb EX(b ∧ ϕ2 ))) where α = ⊥ if 1 ∈ / L2 and α = ¬ EM F b otherwise. Then, t |= α if and only if either t ∈ RB and 1 ∈ L2 , or there is a minimal b event x in the trace t and t, x |= ϕ2 . That is t = t1 t2 with t1 ∈ RB , min(t2 ) = {b} and t2 ∈ L2 . Thus RB (L2 ∩ (min ⊆ {b})) = L(α) is also expressible in LocTLΣ .
438
Paul Gastin, Madhavan Mukund, and K. Narayan Kumar
References 1. B. Adsul and M. Sohoni. Complete and tractable local linear time temporal logics over traces. In Proc. of ICALP’02, LNCS 2380, 926–937. Springer Verlag, 2002. 2. J. Cohen, D. Perrin, and J.-E. Pin. On the expressive power of temporal logic. Journal of Computer and System Sciences, 46:271–295, 1993. 3. V. Diekert and P. Gastin. Local temporal logic is expressively complete for cograph dependence alphabets. In Proc. of LPAR’01, LNAI 2250, 55–69. Springer Verlag, 2001. 4. V. Diekert and P. Gastin. LTL is expressively complete for Mazurkiewicz traces. Journal of Computer and System Sciences, 64:396–418, 2002. 5. V. Diekert and G. Rozenberg, editors. The Book of Traces. World Scientific, Singapore, 1995. 6. W. Ebinger. Charakterisierung von Sprachklassen unendlicher Spuren durch Logiken. Dissertation, Institut f¨ ur Informatik, Universit¨ at Stuttgart, 1994. 7. W. Ebinger and A. Muscholl. Logical definability on infinite traces. Theoretical Computer Science, 154:67–84, 1996. 8. D. Gabbay, A. Pnueli, S. Shelah, and J. Stavi. On the temporal analysis of fairness. In Proc. of PoPL’80, 163–173, Las Vegas, Nev., 1980. 9. P. Gastin and D. Kuske. Satisfiability and model checking for MSO-definable temporal logics are in PSPACE. To appear in Proc. of CONCUR’03. 10. P. Gastin and M. Mukund. An elementary expressively complete temporal logic for Mazurkiewicz traces. In Proc. of ICALP’02, LNCS 2380, 938–949. Springer Verlag, 2002. 11. P. Gastin, M. Mukund, and K. Narayan Kumar. Local LTL with past constants is expressively complete for Mazurkiewicz traces. Tech. Rep. 2003-008, LIAFA, Universit´e Paris 7 (France), 2003. 12. J.A.W. Kamp. Tense Logic and the Theory of Linear Order. PhD thesis, University of California, Los Angeles, California, 1968. 13. A. Mazurkiewicz. Concurrent program schemes and their interpretations. DAIMI Rep. PB 78, Aarhus University, Aarhus, 1977. 14. R. McNaughton and S. Papert. Counter-Free Automata. MIT Press, 1971. 15. D. Perrin. Recent results on automata and infinite words. In Proc. of MFCS’84, LNCS 176, 134–148. Springer Verlag, 1984. 16. D. Perrin and J.-E. Pin. First order logic and star-free sets. Journal of Computer and System Sciences, 32:393–406, 1986. 17. A. Pnueli. The temporal logic of programs. In FOCS’77, 46–57, 1977. 18. M.-P. Sch¨ utzenberger. On finite monoids having only trivial subgroups. Information and Control, 8:190–194, 1965. 19. P.S. Thiagarajan and I. Walukiewicz. An expressively complete linear time temporal logic for Mazurkiewicz traces. In Proc. of LICS’97, 183–194, 1997. 20. W. Thomas. Star-free regular sets of ω-sequences. Information and Control, 42:148–156, 1979. 21. I. Walukiewicz. Difficult configurations – on the complexity of LTrL. In Proc. of ICALP’98, LNCS 1443, 140–151. Springer Verlag, 1998. 22. I. Walukiewicz. Local logics for traces. Journal of Automata, Languages and Combinatorics, 7(2):259–290, 2002. 23. Th. Wilke. Classifying discrete temporal properties. In Proc. of STACS’99, LNCS 1563, 32–46. Springer Verlag, 1999. 24. W. Zielonka. Notes on finite asynchronous automata. R.A.I.R.O. — Informatique Th´eorique et Applications, 21:99–135, 1987.
LTL with Past and Two-Way Very-Weak Alternating Automata Paul Gastin and Denis Oddoux LIAFA, Universit´e Paris 7, 2, place Jussieu, F-75251 Paris Cedex 05, France {Paul.Gastin,Denis.Oddoux}@liafa.jussieu.fr Abstract. In this paper, we propose a translation procedure of PLTL (LTL with past modalities) formulas to B¨ uchi automata using two-way very-weak alternating automata (2VWAA) as an intermiediary step. Our main result is an efficient translation of 2VWAA to generalized B¨ uchi automata (GBA).
1
Introduction
Nowadays, computer systems (both hardware and software) play a central role in most human activities, including safety critical areas. It is therefore essential to improve their reliability. For this, we need to formally specify their expected behaviors. Choosing the specification language is a crucial factor for the overall validation process. We need a language that allows to express easily all desired properties. Moreover the specification language must be easily amenable to validation techniques such as model checking for instance. Temporal logics [13,1,12] are among the most widely used specification languages, the most popular ones being branching time temporal logics (CTL, CTL*) and linear time temporal logic (LTL). These logics are based on pure future modalities, i.e., modalities that does not depend on what happened before the current time. Adding past modalities to LTL does not increase its expressive power [6,2,10] but PLTL (LTL with past modalities) is exponentially more succinct than LTL [9]. In this paper, we focus our attention on PLTL. The drawback of using past modalities is that the satisfiability and the model checking problems are harder to solve. Not harder from a theoretical point of view since both problems are PSPACE complete [15] regardless of whether we use past modalities or not, but harder from a practical point of view. Model checking algorithms for PLTL have already been proposed [7,14,18] but few have been implemented and used in actual model checker. This is surprising since past modalities make specifications more succinct and, more importantly, much easier and more natural [11]. We believe that the reason is the difficulty to build efficiently a B¨ uchi automaton associated with a PLTL formula, which is a crucial step for a model checker using PLTL as a specification language. This is precisely the problem addressed in the present paper. The easiest construction is the so-called tableau construction (see e.g. [7,11,15]) but a straightforward implementation, called declarative tableau, is highly inefficient. Implementations are based on incremental tableau. They construct B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 439–448, 2003. c Springer-Verlag Berlin Heidelberg 2003
440
Paul Gastin and Denis Oddoux
only reachable states and apply some simplification techniques. An incremental tableau construction for PLTL [7] requires backtracking and is much harder to implement than for LTL [5]. Following the automata theoretic approach of [17], another technique to generate efficiently a generalized B¨ uchi automaton (GBA) from an LTL formula is to use very-weak alternating automata (VWAA) as an intermediary step. As demonstrated in [3], this yields an implementation which is dramatically faster than those based on the tableau construction. In this paper, we develop the same technique for PLTL. Since we have to deal with past modalities we use two-way very-weak alternating automata (2VWAA). Two-way alternating automata (2AA) were already proposed for specification languages that are much more expressive than PLTL [16,8] and a translation procedure from general 2AA to GBA is given in [8]. Since PLTL formulas are sufficient to specify most interesting properties and can be easily translated to 2VWAA, it is very important to develop an efficient translation procedure restricted to 2VWAA. The main result of this paper is an efficient translation procedure of progressing 2VWAA to GBA. Starting from a progressing 2VWAA with n states, we construct a GBA with at most 2n states. Since the translation from a PLTL formula ϕ gives a progressing 2VWAA with at most |ϕ| + 1 states, we get for this formula a GBA with at most 2|ϕ|+1 states. As a comparison, the algorithm of [8] 2 gives an automaton with 2O(|ϕ| ) states (recall that the specification language considered in [8] is much more expressive than PLTL). Due to space constraints, some proofs have had to be omitted in this extended abstract. A full version of the paper is available in [4].
2
Two-Way Very-Weak Alternating Automata (2VWAA)
A two-way alternating automaton (2AA) is a six-tuple A = (Q, Σ, δ, I, F, R) Q Σ Q where Q is the set of states, Σ is the alphabet, δ : Q → 22 ×2 ×2 is the Q transition function, I ⊆ 2 gives the initial condition, F ⊆ Q is the set of final states. R ⊆ Q is the set of repeated states. A more classical way of defining 2AAs would use I ∈ B+ (Q) and δ : Q×Σ → + B (Q × {−1, 1}), where −1 and 1 indicate whether the head moves left or right. While the two approaches are equivalent, our definition allows for more compact representations of the automata and for faster algorithms. Notice in particular that in the transition function we use 2Σ instead of Σ, so that transitions that differ only by actions can be gathered. However, the automaton still reads finite and infinite words in Σ ∞ = Σ + ∪ Σ ω . Runs of 2AAs are defined using Q-forests. A Q-forest over a word u ∈ Σ ∞ is a labeled forest (V, E, σ, ν) where V is the set of vertices, E ⊆ V × V is the set of edges, σ : V → Q is the state labeling function, ν : V → N is the position labeling function: it indicates the letter the automaton A is reading; ∀x ∈ V , 0 ≤ ν(x) ≤ |u| + 1 (where |u| ∈ N ∪ {ω} denotes the length of u), and ∀(x, y) ∈ E, either ν(y) = ν(x) + 1 if A goes forward on u, or ν(y) = ν(x) − 1 if A goes backward on u.
LTL with Past and Two-Way Very-Weak Alternating Automata
441
We shall use the following notations: λ = (σ, ν) : V → Q × N is the labelling ← − function, E(x) = {y ∈ V | (x, y) ∈ E} is the set of the sons of x, E (x) = {y ∈ → − ← − E(x) | ν(y) = ν(x) − 1} is the set of the left sons of x, and E (x) = E(x)\ E (x) ← − is the set of the right sons of x, left(x) = E ∗ ( E (x)) ∪ {x}, ]x, y] = {z ∈ E + (x) | y ∈ E ∗ (z)}, and similarly for [x, y], ]x, y[ and [x, y[. A run ρ of a 2AA A on a word u = u1 u2 · · · ∈ Σ ∞ is a Q-forest (V, E, σ, ν) over u such that the roots satisfy the initial condition: if Γ ⊆ V are the roots of the forest, then σ(Γ ) ∈ I and ν(Γ ) ⊆ {1}; and the sons of any node satisfy the transition function: ∀x ∈ V if ν(x) = 0 or ν(x) = |u| + 1 then E(x) = ∅, ← − → − otherwise ∃α ∈ 2Σ , uν(x) ∈ α and (σ( E (x)), α, σ( E (x))) ∈ δ(σ(x)). A run ρ is accepting if ∀x ∈ V , ν(x) = 0 or ν(x) = |u| + 1 imply σ(x) ∈ F ; and if any infinite branch of ρ goes infinitely often through R (note that ρ may have infinite branches even if u is finite). Finally, L(A) is the set of words on which there exists an accepting run of A. A two-way very-weak alternating automaton (2VWAA) is a 2AA where there ← − → − ← − − → exists a partial order on Q such that ∀p ∈ Q, ∀( X , α, X ) ∈ δ(p), ∀q ∈ X ∪ X , q p. Actually, we use progressing (or loop-free) 2VWAA for which we describe in Section 4 an efficient translation to B¨ uchi automaton. A run ρ is progressing if any infinite branch x0 . . . xn . . . in ρ satisfies the following property: ∀N ≥ 0, ∃i ≥ 0, ν(xi ) ≥ N . A run ρ has a loop if two nodes on a same branch have the same label: ∃x ∈ V , ∃y ∈ E + (x), λ(x) = λ(y). Otherwise ρ is loop-free. A 2AA is progressing (respectively loop-free) if all runs (accepting or not) of this automaton are progressing (respectively loop-free). Note that a loop-free run on a finite word has no infinite branches and is therefore progressing. More generally, any loop-free run is progressing. The converse is trivially false. Still, we have Proposition 1. A 2AA is progressing iff it is loop-free. Also, given a 2VWAA with n states we can effectively construct a progressing 2VWAA with at most 2n states, accepting the same language. When combined with the translation of progressing 2VWAA to GBA presented in Section 4, this yields an efficient translation from general 2VWAA to GBA.
3
PLTL to Progressing 2VWAA
The syntax and the semantics of PLTL is classical [12]. Here we use the following syntax: ϕ ::= ⊥ | p | ¬ ϕ | ϕ ∨ ϕ | X ϕ | Y ϕ | ϕ U ϕ | ϕ S ϕ, where ⊥ stands for false and p ranges over the set AP of atomic propositions. An LTL formula is a PLTL formula that uses neither Y nor S. Let Σ = 2AP . We write L(ϕ) ⊆ Σ ∞ for the set of words satisfying a PLTL formula ϕ. We also use the dual operators Y, U, ϕ = ¬ X ¬ ϕ and ϕ1
, ∧, X, S. For instance, X S ϕ2 = ¬(¬ ϕ1 S ¬ ϕ2 ). Note ϕ = ¬ X ∨ X ϕ. that X ϕ is not equivalent to X ϕ on finite words: we have X A PLTL formula can be written in negative normal form, where negations are on predicates only. A formula in negative normal form uses ⊥, , predicates in
442
Paul Gastin and Denis Oddoux
AP, their negations, the operators ∨, X, U, Y, S and their duals. A PLTL formula in negative normal form that is neither a disjunction (∨) nor a conjunction (∧) is called a temporal formula. Notice that transforming a formula in negative normal form does not change the number of temporal operators of the formula. From now on, we suppose that every PLTL formula is in negative normal form. This section is devoted to the first step of our algorithm: from a PLTL formula with n temporal operators we can compute a progressing 2VWAA with at most Q Σ Q n + 1 states. We use the following notations. For J1 , J2 ∈ 22 ×2 ×2 we let ← − ← − → − − → ← − → − ← − → − J1 ⊗J2 = {( X 1 ∪ X 2 , α1 ∩α2 , X 1 ∪ X 2 ) | ( X 1 , α1 , X 1 ) ∈ J1 , ( X 2 , α2 , X 2 ) ∈ J2 }. For a PLTL formula ψ in negative normal form we define ψ inductively by: ψ = {{ψ}} if ψ is a temporal formula, ψ1 ∨ ψ2 = ψ1 ∪ ψ2 and ψ1 ∧ ψ2 = {X1 ∪ X2 | X1 ∈ ψ1 and X2 ∈ ψ2 }. It is actually not completely immediate to deal smoothly with the special cases raised when checking a past modality at the beginning of a word, or a future modality at the end of a finite word. We solve this problem using a special state END, which is reached in an accepting run when the current position ν is outside the word u (σ(x) = END ⇒ ν(x) = 0 or ν(x) = |u| + 1). Definition 2 (ϕ to Aϕ ). For any PLTL formula ϕ in negative normal form on the set AP, let Aϕ = (Q, Σ, δ, I, F, R) be the 2AA defined by Q = sub(ϕ)∪{END} where sub(ϕ) are the temporal subformulae of ϕ, Σ = 2AP , I = ϕ, F = {END}, R is the set of the subformulae in sub(ϕ) that are not of the form ϕ1 U ϕ2 , and δ isdefined below (∆ extends δ to B + (Q)): δ(⊥) = ∅ δ( ) = {(∅, Σ, ∅)} δ(p) = {(∅, Σp , ∅)} where Σp = {a ∈ Σ | p ∈ a} δ(¬ p) = {(∅, Σ¬ p , ∅)} where Σ¬ p = Σ\Σp δ(X ψ) = (∅, Σ, e) | e ∈ ψ ψ) = (∅, Σ, e) | e ∈ ψ ∪ {(∅, Σ, {END})} δ(X δ(Y ψ) = (e, Σ, ∅) | e ∈ ψ ψ) = (e, Σ, ∅) | e ∈ ψ ∪ {({END}, Σ, ∅)} δ(Y δ(ψ1 U ψ2 ) = ∆(ψ2 ) ∪ (∆(ψ1 ) ⊗ {(∅, Σ, {ψ1 U ψ2 })}) δ(ψ U ψ2 ) = ∆(ψ2 ) ⊗ (∆(ψ1 ) ∪ {(∅, Σ, {ψ1 U ψ2 }), (∅, Σ, {END})}) 1 δ(ψ S ψ ) = ∆(ψ ) ∪ (∆(ψ ) ⊗ {({ψ S ψ }, Σ, ∅)}) 1 2 2 1 1 2 δ(ψ ) = ∆(ψ ) ⊗ (∆(ψ ) ∪ {({ψ S ψ S ψ 1 2 2 1 1 2 }, Σ, ∅), ({END}, Σ, ∅)}) δ(END) = ∅ ∆(ψ) = δ(ψ) if ψ is a temporal formula ∆(ψ1 ∨ ψ2 ) = ∆(ψ1 ) ∪ ∆(ψ2 ) ∆(ψ1 ∧ ψ2 ) = ∆(ψ1 ) ⊗ ∆(ψ2 ) Theorem 3 (PLTL to Progressing 2VWAA). For any PLTL formula in negative normal form ϕ with n temporal subformulae, the automaton Aϕ is a progressing 2VWAA with at most n + 1 states and L(Aϕ ) = L(ϕ). Proof. Let us define ψ1 ψ2 if ψ1 = END or if ψ1 is a subformula of ψ2 . It is easy to see with this partial order that Aϕ is very-weak.
LTL with Past and Two-Way Very-Weak Alternating Automata
443
Now, we show that Aϕ is progressing. Suppose that a node x and its son → − y have the same state-label ψ in a run of Aϕ . Then, either (y ∈ E (x) and ← − ψ2 )), or (y ∈ E (x) and (ψ = ψ1 S ψ2 or ψ = ψ1 (ψ = ψ1 U ψ2 or ψ = ψ1 U S ψ2 )). Now let x0 , x1 , . . . be an infinite branch of a run ρ of Aϕ . Since Aϕ is veryweak, the sequence σ(x0 ), σ(x1 ), . . . is ultimately constant. From the previous ψ2 , statement, necessarily the limit of this sequence is a formula ψ1 U ψ2 or ψ1 U and hence ν is strictly increasing from a certain node on the branch: Aϕ is progressing. The proof for L(Aϕ ) = L(ϕ) is omitted. It is similar to the classical proof used for the similar translation of LTL formulas to VWAA.
4
Progressing 2VWAA to GBA
The general translation from a 2AA to a BA is rather involved. Here we take full advantage of the fact that we start from a progressing 2VWAA. The basic idea, starting from an accepting run ρ of a 2AA A over a word u = u1 u2 . . . ∈ Σ ∞ , is to consider the sets Xi = σ(ν −1 (i)), and to build a kind of automaton B such that the sequence X0 , X1 , X2 , . . . is an accepting run of B on u. Transitions of B should reflect the fact that each node x of ρ satisfies the transition function of A. If ν(x) = i, this involves the sets Xi−1 , Xi , Xi+1 and the letter ui . Hence it is natural to consider quadruples (Xi−1 , Xi , Xi+1 , ui ) as transitions of B. This is why we introduce here generalized BA having such quadruples as transitions. We are also using several acceptance conditions on transitions instead of states since the construction becomes simpler. A GBA is a five-tuple G = (Q, Σ, T, I, F, T ) where: Q is the set of states, Σ is the alphabet, T ⊆ Q × Q × Q × 2Σ is the transition function, I ⊆ Q × Q is the set of initial states, F ⊆ Q × Q is the set of final states, T = {T1 , . . . , Tr } where Tj ⊆ T are the acceptance tables. A run σ of a GBA G on a word u = u1 u2 . . . ∈ Σ ω is an infinite sequence q0 , q1 , α1 , . . . , qn , αn , . . . such that (q0 , q1 ) ∈ I, and ∀i ≥ 1, ui ∈ αi and (qi−1 , qi , qi+1 , αi ) ∈ T . A run on a finite word u ∈ Σ + is defined similarly. The run σ is accepting if u ∈ Σ n and (qn , qn+1 ) ∈ F or u ∈ Σ ω and σ uses infinitely many transitions from each Tj , 1 ≤ j ≤ r. L(G) is the set of words on which there exists an accepting run of G. 1 Definition 4 (A to GA ). For any progressing 2VWAA A = (Q, Σ, δ, I, F, R), 1 we define the GBA GA = (Q , Σ, T , I , F , T ) by Q = 2Q , ← − → − ← − → − ← − ← − → → − − T = {( X , X, X , α) | ∃ ( Y , α, Y ) ∈ δ(q) with Y ⊆ X and Y ⊆ X }, q∈X
I = {(X, Y ) ∈ Q × Q | X ⊆ F and ∃Z ∈ I with Z ⊆ Y }, F = {(X, Y ) ∈ Q × Q | Y ⊆ F }, and T = {Tq | q ∈ Q\R} where ← − → − Tq = {( X , X, X , α) ∈ T | q ∈ / X or ← − → − ← − ← − − → − → → − ∃( Y , β, Y ) ∈ δ(q) with Y ⊆ X , Y ⊆ X , β ⊇ α and q ∈ / Y} Indeed, the hard part in a translation from a 2AA A to a GBA G is to make sure that each accepting run of G, which is a flat sequence of nodes, can be lifted
444
Paul Gastin and Denis Oddoux
to a Q-forest which defines an accepting run of A. It is remarkable that if A is a progressing 2VWAA, we can simply use sequences X0 , X1 , X2 , . . . as runs of G and still be able to lift them to accepting runs of A. 1 ) ⊆ L(A). Proposition 5. For any progressing 2VWAA A, L(GA 1 ) = L(A), but the other inclusion follows directly from results Actually L(GA that will be proved afterwards, hence we will not prove it here. See theorem 9 for the final result. 1 on a word u = Proof. Let X0 , X1 , α1 , X2 , α2 , . . . be an accepting run of GA ∞ u1 u2 . . . ∈ Σ . We are going to define a labelled graph ρ = (V, E, σ, ν). Let V = {(q, i) | i ≥ 0, q ∈ Xi }. By definition of T , ∀1 ≤ i ≤ |u|, ∀q ∈ Xi , there ← − → − ← − → − exist Y ⊆ Xi−1 , Y ⊆ Xi+1 and α ∈ 2Σ with αi ⊆ α and ( Y , α, Y ) ∈ δ(q), and → − such that q ∈ / Y whenever q ∈ / R and (Xi−1 , Xi , Xi+1 , αi ) ∈ Tq . Let E((q, i)) = ← − → − Y × {i − 1} ∪ Y × {i + 1}. If i ∈ {0, |u| + 1} then let E((q, i)) = ∅. ∀(q, i) ∈ V , let σ((q, i)) = q and ν((q, i)) = i. Since (X0 , X1 ) ∈ I , ∃Γ ⊆ X1 × {1} such that σ(Γ ) ∈ I. Now if we “unfold” the labelled graph ρ = (V, E, σ, ν) from the set of roots Γ , we obtain a Q-forest ρ = (V , E , σ , ν ). Let x ∈ V . If ν (x) ∈ {0, |u| + 1} then E (x) = ∅. Otherwise, let q = σ (x) ← − − → ← − → − and i = ν (x), let Y = σ (E (x)) = σ(E(q, i)∩Q×{i−1}) and Y = σ (E (x)) = σ(E(q, i) ∩ Q × {i + 1}). By construction of ρ there exists α ∈ 2Σ with αi ⊆ α ← − → − and ( Y , α, Y ) ∈ δ(q). Since ui ∈ αi , we have proved that the sons of x satisfy the transition function. Hence ρ is a run of A on u. We shall now check that ρ is accepting: – σ (ν −1 (0)) ⊆ σ(ν −1 (0)) = X0 ⊆ F , since (X0 , X1 ) ∈ I , – if u is finite of length n then σ (ν −1 (n + 1)) ⊆ σ(ν −1 (n + 1)) = Xn+1 ⊆ F since (Xn , Xn+1 ) ∈ F , – assume that ρ contains an infinite branch x0 , x1 , . . . ultimately state-labelled in Q\R: ∃q ∈ Q\R, ∃N > 0, ∀i ≥ N , σ(xi ) = q. Since A is progressing, from proposition 1 we know that ρ is loop-free (which implies that ρ is loop-free) and u is infinite. Since X0 , X1 , . . . is accepting, ∃k ≥ ν(xN ) such that (Xk−1 , Xk , Xk+1 , αk ) ∈ Tq . ρ is loop-free so ν is necessarily strictly increasing on xN , xN +1 , . . ., and there exists j ≥ N such that λ(xj ) = (q, k) and λ(xj+1 ) = (q, k +1). But since σ(xj ) = q and (Xk−1 , Xk , Xk+1 , αk ) ∈ Tq we chose E((q, k)) in ρ such that (q, k+1) ∈ / E((q, k)). This is a contradiction, and hence ρ cannot contain such a branch. 1 is still too big to be used in an efficient It is quite easy to see that GA implementation. It contains many useless states, and keeping only the accessible states would not be enough since the initial states are too numerous already. We 1 introduced GA merely to prove more easily that our construction is correct. The intuition how to get a smaller GBA from a 2VWAA is as follows: by removing useless parts of runs of a 2VWAA we obtain minimal runs, such that removing any subtree of the forest makes the run invalid. Ideally, we would like
LTL with Past and Two-Way Very-Weak Alternating Automata
445
2 1 to construct a GBA GA which is the restriction of GA to transitions of the form −1 −1 −1 (σ(ν (i − 1)), σ(ν (i)), σ(ν (i + 1)), ui ) obtained from minimal runs. For this, we start from a small set of initial states, and we compute the states and transitions accessible from these states. We need to store both the current set of states Y and the previous one X. Since A is two-way, it may happen that the set X is not big enough to fulfil all requirements imposed by Y . In this case, we have to backtrack and enlarge X. 2 Definition 6 (A to GA ). For any progressing 2VWAA A = (Q, Σ, δ, I, F, R), 2 = (Q , Σ, T , I , F , T ) be the GBA computed by let GA Initialization: I = {F } × I, ∇ = {F } × I, T = ∅. Then, we apply the following saturation procedure for each state (X, Y ) ∈ ∇ until we reach a fixed point: δ(q) for each (X , α, Z) ∈
q∈Y
if X ⊆ X if (Y, Z) ∈ / ∇ then add (Y, Z) to ∇ (a) if (X, Y, Z, α) ∈ / T then add (X, Y, Z, α) to T else for each (F, X, Y, β) ∈ T with (F, X) ∈ I if (F, X ∪ X ) ∈ / ∇ then add (F, X ∪ X ) to ∇ (b) add (F, X ∪ X ) to I for each (V, W, X, γ), (W, X, Y, β) ∈ T if (W, X ∪ X ) ∈ / ∇ then add (W, X ∪ X ) to ∇ (c) if (V, W, X ∪ X , γ) ∈ / T then add (V, W, X ∪ X , γ) to T Finally, we set Q = {X ∈ 2Q | ∃Y ∈ 2Q , (X, Y ) ∈ ∇ or (Y, X) ∈ ∇} F = (2Q × 2F ) ∩ (Q × Q ), and T = {Tq | q ∈ Q\R} where ← − → − Tq = {( X , X, X , α) ∈ T | q ∈ / X or ← − → − ← − ← − − → − → → − ∃( Y , β, Y ) ∈ δ(q) with Y ⊆ X , Y ⊆ X , β ⊇ α and q ∈ / Y} 2 1 Proposition 7. For any progressing 2VWAA A, L(GA ) ⊆ L(GA ). 2 1 Proof. It is easy to notice that any state or transition of GA appears in GA : 2 Q ⊆ Q and T ⊆ T . Hence any accepting run of GA on a word u is also an 1 accepting run of GA on the same word. 2 ). Proposition 8. For any progressing 2VWAA A, L(A) ⊆ L(GA
Proof. Let ρ = (V, E, σ, ν) be an accepting run of A on a word u. We build by induction on k a sequence ρk = X0 , (Xi , αi )0
446
Paul Gastin and Denis Oddoux
Otherwise, ∀q ∈ Xn , choose xq ∈ V such that λ(xq ) = (q, n), and such that → − if q ∈ / R then q ∈ / σ( E (xq )) whenever this is possible. Let X = {xq | q ∈ Xn }, ← − → − Xn−1 = σ( E (X)), Xn+1 = σ( E (X)). Since ρ is a run of A on u and n ≤ |u|, , αn , Xn+1 ) ∈ δ(q). Since ρk satisfies the ∃αn with un ∈ αn such that (Xn−1 q∈Xn
inductive hypothesis, we have (Xn−1 , Xn ) ∈ ∇ and three cases can occur: 2 ⊆ Xn−1 , then from the construction of GA , (Xn , Xn+1 ) ∈ ∇ (a) if Xn−1 and (Xn−1 , Xn , Xn+1 , αn ) ∈ T . Moreover, for each q ∈ Xn \ R, if ∃x ∈ → − ν −1 (n) with σ(x) = q and q ∈ / σ( E (x)) then ∃β ⊇ αn , ∃X ⊆ Xn−1 , ∃Z ⊆ Xn+1 \{q}, (X , β, Z ) ∈ δ(q) hence (Xn−1 , Xn , Xn+1 , αn ) ∈ Tq . Therefore, ρk+1 = ρk , αn , Xn+1 satisfies the inductive hypothesis. ⊆ Xn−1 . Note that this implies n ≥ 2, because if We now suppose that Xn−1 n = 1 then since ρ is accepting, X0 ⊆ F = X0 . (b) If n = 2 then (X0 , X1 , X2 , α1 ) ∈ T and (X0 , X1 ) ∈ I so from the 2 construction of GA , (X0 , X1 ∪ X1 ) ∈ I ⊆ ∇. Hence ρk+1 = X0 , X1 ∪ X1 satisfies the inductive hypothesis. (c) Assume now that n ≥ 3. Then we have (Xn−3 , Xn−2 , Xn−1 , αn−2 ) ∈ 2 , T and (Xn−2 , Xn−1 , Xn , αn−1 ) ∈ T . From the construction of GA (Xn−3 , Xn−2 , Xn−1 ∪ Xn−1 , αn−2 ) ∈ T and (Xn−2 , Xn−1 ∪ Xn−1 ) ∈ ∇. Moreover if (Xn−3 , Xn−2 , Xn−1 , αn−2 ) ∈ Tq then (Xn−3 , Xn−2 , Xn−1 ∪ , αn−2 ) ∈ Tq . Therefore, ρk+1 = X0 , . . . , Xn−2 , αn−2 , Xn−1 ∪ Xn−1 Xn−1 satisfies the inductive hypothesis. Now, we show that the sequence (ρk )k≥0 converges. For this, consider the alphabet A = 2Q × 2Σ partially ordered by (X, α) (Y, β) if X ⊆ Y . Let us write ρk = (X0 , ∅), (Xi , αi )1≤i≤n , (Xn+1 , ∅) ∈ A∗ . The sequence of words (ρk )k≥0 is strictly increasing for the lexicographic order induced by . Hence, we can easily show that this sequence is either finite (if the construction terminates) or infinite and converges to an infinite word ρ ∈ Aω . If u is finite then the words ρk are of length at most |u| + 2. Therefore the construction terminates at some step k: let ρ = ρk . Since ρ is accepting, 2 σ(ν −1 (|u| + 1)) ⊆ F so (X|u| , X|u|+1 ) ∈ F . Hence ρ is an accepting run of GA on u. If u is infinite then the sequence (ρk )k≥0 must be infinite and converges to an infinite word ρ ∈ Aω . Since any prefix of ρ is also a prefix of ρk for 2 on u. Suppose that ρ is not accepting: there exists some k, ρ is a run of GA q ∈ Q\R such that after a given rank N , all transitions used in ρ are not in Tq . → − Hence ∀x ∈ V if λ(x) = (q, i) with i ≥ N then q ∈ σ( E (x)). Moreover, since (XN −1 , XN , XN +1 , αN ) ∈ / Tq , we have q ∈ XN . So we can find in ρ an infinite branch ultimately labelled by q, which is a contradiction with ρ accepting. As a consequence of Propositions 5, 7 and 8 we obtain: Theorem 9 (Progressing 2VWAA to GBA). For any progressing 2VWAA 1 2 A, L(GA ) = L(GA ) = L(A). Hence from any progressing 2VWAA with n states and r repeated states we can construct a GBA accepting the same language with at most 2n states and n − r acceptance tables.
LTL with Past and Two-Way Very-Weak Alternating Automata
447
We conclude this section by explaining several simplifications that are used in the implementation of the algorithm described in Definition 6. Saturation procedure: In order to generate all needed transitions, we have to repeat the saturation procedure until no more changes occur. This has to be carefully implemented to avoid redundant computations. The idea here is to timestamp states and transitions by integers. When they are first created, new elements of ∇ are timestamped by 0, whereas new transitions in T get the current timestamp. Each time a pair (X, Y ) is considered for saturation, the current timestamp is incremented, and when this pair has been treated, it gets the current timestamp. Now, step (a) is executed only when the timestamp of (X, Y ) is 0. In step (b) we consider only transitions (F, X, Y, β) whose timestamps are greater or equal to that of (X, Y ). Similarly, in step (c), we only consider pairs of transitions for which at least one timestamp is greater or equal to that of (X, Y ). Transition simplification: The idea here is to remove redundant transitions. When there exist two transitions (X, Y, Z, α) and (X, Y, Z, β) with α ⊆ β, the first transition is more restrictive than the second one, and thus can be deleted. This simplification can be done on-the-fly, that is when the algorithm adds a new transition to T . State simplification: The idea here is to merge equivalent pairs of states. When two pairs of states (X, Y ) and (X , Y ) have the same outgoing transitions ((X, Y, Z, α) ∈ T ⇐⇒ (X , Y , Z, α) ∈ T and ∀q ∈ Q\R, (X, Y, Z, α) ∈ Tq ⇐⇒ (X , Y , Z, α) ∈ Tq ), they can be merged, and any transition pointing on one of the two states can now point on the merged state. The overall simplification alternates transition simplification and state simplification until a fixed point is reached. Experimental Results: We have implemented two algorithms, building re1 2 spectively GA and GA from a PLTL formula ϕ. Here are the results of some computations on the formula ϕn = ¬ G(p1 → F−1 (p2 ∧ F−1 (p3 ∧ . . . F−1 pn ) . . .), stating that each p1 is preceded by p2 , preceded itself by p3 , and so on until pn . This demonstrates the striking improvement of the on-the-fly algorithm.
ϕ2 ϕ3 ϕ4 ϕ5
Aϕ states 3 4 5 6
before 28, 82 100, 544 364, 3630 1348,24830
1 GA after time space 6, 11 0.03 <380 12, 36 0.83 <380 27,102 230 1,700 58,264 130,000 39,000
before 7, 10 10, 19 13, 31 16, 46
2 GA after time space 4, 6 0.01 <380 6,13 0.01 <380 8,23 0.08 635 10,36 9.40 32,000
In order of appearance : tested formula, number of states of the VWAA, and i for each i ∈ {1, 2}, number of states and transitions of GA before and after simplification, computation time in seconds, memory used in KB.
Model-Checking: At this point we are able from any PLTL formula ϕ to compute a GBA accepting the models of ϕ. In order to apply usual model checking techniques we can transform our GBA G = (Q, Σ, T, I, F, T ) to a more conventional automaton G = (Q , Σ, T , I, F, T ) where T = {((q− , q), α, (q, q+ )) |
448
Paul Gastin and Denis Oddoux
(q− , q, q+ , α) ∈ T }, the same for acceptance tables, and Q is the set of all pairs (q− , q) or (q, q+ ) appearing in T . We can actually view G as a convenient encoding of G . Classical techniques allows also to get a B¨ uchi automaton (BA) replacing the acceptance tables by a single set of repeated states.
References 1. E.A. Emerson. Temporal and modal logic. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B, chapter 16, pages 995–1072. Elsevier Science, 1990. 2. D. Gabbay, A. Pnueli, S. Shelah, and J. Stavi. On the temporal analysis of fairness. In Proc. of PoPL’80, pages 163–173, Las Vegas, Nev., 1980. 3. P. Gastin and D. Oddoux. Fast ltl to b¨ uchi automata translation. In Proc. of CAV’01, number 2102 in LNCS, pages 53–65. Springer Verlag, 2001. 4. P. Gastin and D. Oddoux. LTL with past and two-way very-weak alternating automata. Tech. Rep. LIAFA 2003–010, Universit´e Paris 7 (France). 5. R. Gerth, D. Peled, M.Y. Vardi, and P. Wolper. Simple on-the-fly automatic verification of linear temporal logic. In Protocol Specification Testing and Verification, pages 3–18, Warsaw, Poland, 1995. Chapman & Hall. 6. J.A.W. Kamp. Tense Logic and the Theory of Linear Order. PhD thesis, University of California, Los Angeles, California, 1968. 7. Y. Kesten, Z. Manna, H. McGuire, and A. Pnueli. A decision algorithm for full propositional temporal logic. In Proc. of CAV’93, number 697 in LNCS, pages 97–109. Springer Verlag, 1993. 8. O. Kupferman, N. Piterman, and M.Y. Vardi. Extended temporal logic revisited. In Proc. of CONCUR’01, number 2154 in LNCS, pages 519–535. Springer Verlag, 2001. 9. F. Laroussinie, N. Markey, and Ph. Schnoebelen. Temporal logic with forgettable past. In Proc. of LICS’02, pages 383–392, 2002. 10. F. Laroussinie and Ph. Schnoebelen. A hierarchy of temporal logics with past. Theoretical Computer Science, 148:303–324, 1995. 11. O. Lichtenstein, A. Pnueli, and L.D. Zuck. The glory of the past. In Proc. of the 3rd Workshop on Logics of Programs, number 193 in LNCS, pages 196–218. Springer Verlag, 1985. 12. Z. Manna and A. Pnueli. The temporal logic of reactive and concurent systems: Specification. Springer Verlag, Berlin-Heidelberg-New York, 1992. 13. A. Pnueli. The temporal logic of programs. In Proc. of FOCS’77, pages 46–57, 1977. 14. Y.S. Ramakrishna, L.E. Moser, L.K. Dillon, P.M. Melliar-Smith, and G. Kutty. An automata theoretic decision procedure for propositional temporal logic with Since and Until. Fundamenta Informaticae, 17:271–282, 1992. 15. A.P. Sistla and E.M. Clarke. The complexity of propositional linear time logic. Journal of the Association of Computing Machinery, 32:733–749, 1985. 16. M.Y. Vardi. Reasonning about the past with two-way automata. In Proc. of ICALP’98, number 1443 in LNCS, pages 628–641. Springer Verlag, 1998. 17. M.Y. Vardi and P. Wolper. An automata-theoretic approach to automatic program verification. In Proc. of LICS’86, pages 332–344, 1986. 18. M.Y. Vardi and P. Wolper. Reasonning about infinite computations. Information and Computation, 115:1–37, 1994.
Match-Bounded String Rewriting Systems Alfons Geser1 , Dieter Hofbauer2 , and Johannes Waldmann3 1
3
National Institute of Aerospace, 144 Research Drive Hampton, Virginia 23666, USA [email protected] 2 Fachbereich Mathematik/Informatik, Universit¨ at Kassel D-34109 Kassel, Germany [email protected] Fakult¨ at f¨ ur Mathematik und Informatik, Universit¨ at Leipzig D-04109 Leipzig, Germany [email protected]
Abstract. We investigate rewriting systems on strings by annotating letters with natural numbers, so called match heights. A position in a reduct will get height h+1 if the minimal height of all positions in the redex is h. In a match-bounded system, match heights are globally bounded. Exploiting recent results on deleting systems, we prove that it is decidable whether a given rewriting system has a given match bound. Further, we show that match-bounded systems preserve regularity of languages. Our main focus, however, is on termination of rewriting. Match-bounded systems are shown to be linearly terminating, and–more interestingly– for inverses of match-bounded systems, termination is decidable. These results provide new techniques for automated proofs of termination.
1
Introduction
Rewriting is a model of computation. It allows to handle questions like termination (there is no infinite computation), normalization (a final configuration is reachable) and correctness (no erroneous configuration is reachable). These questions can be formulated in terms of sets of descendants: if R is a rewriting system, and L is a language, then R∗ (L) = {y | x ∈ L, x →∗R y}. Now R is correct for L iff R∗ (L) ∩ Err = ∅, and R is normalizing for L iff L ⊆ R−∗ (Final), with Err (resp. Final) denoting the set of erroneous (resp. final) configurations. Starting from classical program analysis, recent applications include verification of XML transformations, and cryptographic protocols [6]. From the point of view of these applications, it is highly desirable that the reachability relation R∗ effectively respects language classes with good decidability and closure properties. In the present paper, we achieve this by restricting the flow of information in rewriting systems, using match bounds. We can then apply recent results on deleting systems, to obtain closure and termination results. All constructions are effective (and we have indeed implemented them), so they can be used in automated proofs of termination. For instance, we can B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 449–459, 2003. c Springer-Verlag Berlin Heidelberg 2003
450
Alfons Geser, Dieter Hofbauer, and Johannes Waldmann
automatically verify termination of Zantema’s System {a2 b2 → b3 a3 }, a task that is notoriously difficult even for a human. To obtain automated termination proofs, we transform rewriting systems as follows: We annotate letters with numbers, so called match heights. A position in a reduct will get height h + 1 if the minimal height of all positions in the redex is h. A rewriting system is match-bounded if match heights of derivations are globally bounded. We give the definition and examples in Sections 3 and 4, while in Section 5 we discuss how to verify or refute a match-bound. Results follow from our recent research [10] on deleting systems. A string rewriting system R is called deleting if there exists a partial ordering on its alphabet such that each letter in the right hand side of a rule is less than some letter in the corresponding left hand side. Deleting systems can be regarded as the inverses of context limited grammars as defined and investigated by Hibbard [9]. Deleting rewriting systems terminate, and they have linearly bounded derivational complexity. In Section 6, we show that inverses of deleting string rewriting systems have decidable termination and uniform termination problem. This carries over to inverse match-bounded systems immediately: match-bounded systems are terminating, and inverse match-bounded systems have decidable termination and uniform termination problems. An application is given in Section 6. We conclude by discussing ramifications for further research in Section 7.
2
Preliminaries
We mostly stick to standard notations for strings and string rewriting, as e.g. in [2]. A string rewriting system (SRS) over an alphabet Σ is a relation R ⊆ Σ ∗ × Σ ∗ , inducing the rewrite relation →R = {(xy, xry) | x, y ∈ Σ ∗ , (, r) ∈ R} on Σ ∗ . Unless indicated otherwise, all rewriting systems are finite. Pairs (, r) from R are frequently referred to as rules → r. By lhs(R) and rhs(R) we denote the sets of left (resp. right) hand sides of R. The reflexive and transitive closure of + →R is →∗R , often abbreviated as R∗ , and →+ R or R denote the transitive closure. A rewriting rule → r is context-free if || ≤ 1, and a SRS is context-free if all its rules are. We use for the empty string, and |x| is the length of a string x. Further, for a language L ⊆ Σ ∗ , let factor(L) = {y ∈ Σ ∗ | ∃x, z ∈ Σ ∗ : xyz ∈ L}. For standard results on rational transductions we refer to [1]. For arelation ρ ⊆ A × B let ρ(a) = {b ∈ B | (a, b) ∈ ρ} for a ∈ A and ρ(A ) = a∈A ρ(a) for A ⊆ A, so the set of descendants of a language L ⊆ Σ ∗ modulo R is R∗ (L). The inverse of ρ is ρ− = {(b, a) | (a, b) ∈ ρ} ⊆ B × A, and we say that ρ satisfies the property inverse P if ρ− satisfies P . Define Inf(ρ) = {a ∈ A | ρ(a) is infinite}; the relation ρ is finitely branching if Inf(ρ) = ∅. For a relation ρ ⊆ Σ ∗ ×Σ ∗ and a set ∆ ⊆ Σ, let ρ|∆ denote ρ∩(∆∗ ×∆∗ ). Note the difference between R∗ |∆ and (R|∆ )∗ for a SRS R. E.g., for R = {a → b, b → / (R|∆ )∗ . c} over Σ = {a, b, c} and ∆ = {a, c} we have (a, c) ∈ R∗ |∆ , but (a, c) ∈ ∗ ∗ A relation s ⊆ Σ × Γ is a substitution if s() = and s(xy) = s(x)s(y) for x, y ∈ Σ ∗ , so s is uniquely determined by the languages s(a) for a ∈ Σ. For a family of languages L over Γ , the substitution s is an L-substitution if s(a) ∈ L
Match-Bounded String Rewriting Systems
451
for a ∈ Σ. For instance, if L is the family of finite (context-free) languages, then s is a finite (resp. context-free) substitution. If ∈ / s(a) for every a ∈ Σ, then s is epsilon-free. Note that a finite substitution is finitely branching, and the same holds for the inverse of a finite and epsilon-free substitution. Now we recall definitions and results regarding deleting string rewriting systems. This topic originates with Hibbard [9]. A string rewriting system R over an alphabet Σ is >-deleting for a precedence > on Σ if ∈ / lhs(R), and if for each rule → r in R and for each letter a in r, there is some letter b in with b > a. The system R is deleting if it is >-deleting for some precedence >. If R is deleting, then R is terminating, and R has linear derivational complexity. Theorem 1 ([10]). Let R be a deleting string rewriting system over Σ. Then there are an extended alphabet Γ ⊇ Σ, a finite substitution s ⊆ Σ ∗ × Γ ∗ , and a context-free string rewriting system C over Γ such that R∗ = (s ◦ C −∗ )|Σ . This decomposition result implies that deleting systems effectively preserve regularity, and that inverse deleting systems effectively preserve context-freeness, the latter being already shown in [9].
3
Match-Bounded String Rewriting Systems
We will now apply the theory of deleting systems to obtain results for matchbounded rewriting. A derivation is match-bounded if dependencies between rule applications are limited. To make this precise, we will annotate positions in strings by natural numbers that indicate their matching height. Positions in a reduct will get height h + 1 if the minimal height of all positions in the corresponding redex was h. Given an alphabet Σ, define the morphisms liftc : Σ ∗ → (Σ × N)∗ for c ∈ N by liftc : a → (a, c), base : (Σ × N)∗ → Σ ∗ by base : (a, c) → a, and height : (Σ × N)∗ → N∗ by height : (a, c) → c. For a string rewriting system R over Σ we define the rewriting system match(R) = { → liftc (r) | ( → r) ∈ R, base( ) = , c = 1 + min(height( ))} over alphabet Σ × N. For instance, the system match({ab → bc}) contains the rules {a0 b0 → b1 c1 , a0 b1 → b1 c1 , a1 b0 → b1 c1 , a1 b1 → b2 c2 , a0 b2 → b1 c1 , . . .}, writing xh as abbreviation for (x, h). Note that this is an infinite system. Every derivation modulo match(R) corresponds to a derivation modulo R, (for x, y ∈ (Σ × N)∗ , if x →match(R) y then base(x) →R base(y)) and vice versa. (for v, w ∈ Σ ∗ and x ∈ (Σ × N)∗ , if v →R w and base(x) = v, then there is y ∈ (Σ × N)∗ such that base(y) = w and x →match(R) y). Definition 1. A string rewriting system R over Σ is called match-bounded for L ⊆ Σ ∗ by c ∈ N if ∈ / lhs(R) and max(height(x)) ≤ c for every x ∈ match(R)∗ (lift0 (L)). If we omit L, then it is understood that L = Σ ∗ . Note that max(height x) (resp. min(height ) in the definition of match(R)) denotes the maximum (resp. minimum) of the corresponding sets of heights. We set max(∅) = 0.
452
Alfons Geser, Dieter Hofbauer, and Johannes Waldmann
For those systems R that are indeed match-bounded, it is enough to consider finite restrictions of the infinite system match(R). Denote by matchc (R) the restriction of match(R) to the alphabet Σ × {0, 1, . . . , c}. Proposition 1. If R is match-bounded by c, then R∗ = lift0 ◦ matchc (R)∗ ◦base. Proposition 2. For all R, and all c ∈ N, the system matchc (R) is deleting. Proof. Use the ordering > on Σ × {0, . . . , c} where (a, m) > (b, n) iff m < n. (Letters of minimal match height are maximal in the deletion ordering.) Corollary 1. If R is match-bounded for L, then R is terminating on L. Proof. An infinite R-derivation can be transformed into an infinite match(R)derivation which, given that R is match-bounded by c, is a matchc (R)-derivation. However, matchc (R) is terminating, since it is deleting. We conclude this section with a few examples of match-bounded rewriting systems; for non-examples, see Section 5. A large class of examples comes from the following observation: Dually to Proposition 2, we have Proposition 3. If R is deleting, then R is match-bounded. Proof. Assume R over Σ is deleting for the ordering > on Σ. Then R is matchbounded by the maximal depth (i.e., length of a descending chain) in (Σ, >). Example 1. The system {ba → cb, bd → d, cd → de} is match-bounded by 2, since it is deleting for the ordering a > b > d, a > c > e, c > d. Example 2. The system {ab → bac} is match-bounded by 1, {ab → ac, ca → bc} is match-bounded by 2, and {ab → ac, ca → b} is match-bounded by 3. (None of these systems is deleting.) See Section 5 for verification of the bounds.
4
Match-Bounded Systems Preserve Regularity
Theorem 2. If R is match-bounded, then R preserves regularity. Proof. By Theorem 1, deleting systems preserve regularity. By Proposition 1, all we need is two more rational transducers to do the encoding and decoding. Example 3. The system R = {ab → ba} on Σ = {a, b} is not regularity preserving, since R∗ ((ab)∗ )∩a∗ b∗ = {an bn | n ≥ 0} is not regular. So Theorem 2 implies that R is not match-bounded. (See Example 5 for a more direct proof.) Example 4. Peg solitaire is a one-person game. The objective is to remove pegs from a board. A move consists of one peg X hopping over an adjacent peg Y , landing on the empty space on the other side of Y . After the hop, Y is removed. Peg solitaire on a one-dimensional board corresponds to the rewriting system P = { → , → },
Match-Bounded String Rewriting Systems
453
where stands for “peg”, and for “empty”. One is interested in the language of all positions that can be reduced to one single peg, which is P −∗ (∗ ∗ ). Regularity of P −∗ (∗ ∗ ) is a “folklore theorem”, see [16] for its history. The system P − is match-bounded by 2, so we obtain yet another proof of that result. The automata Ac constructed for matchc (P − )∗ (∗ ∗ ) have sizes of 2, 14, and 30 respectively for A0 , A1 , and A2 . Remark 1. Ravikumar [17] proved that P − preserves regularity by considering the system’s change-bound (which is 4). Change-boundedness is a concept which is strongly related to match-boundedness. Given a length-preserving string rewriting system R (viz. || = |r| for every rule → r), define the system change(R) = { → r | (base() → base(r)) ∈ R, height(succ()) = height(r)} over alphabet Σ × N, where succ is the morphism succ : (Σ × N)∗ → (Σ × N)∗ induced by succ : (a, h) → (a, h + 1). Ravikumar proves that if change(R) has bounded height, then R preserves regularity. Our results both generalize and strengthen this, the main improvement being that the definition of match does also apply to systems that are not length-preserving. For length-preserving systems, match(R) will always give lower or equal heights, so our result implies Ravikumar’s.
5
Verification and Refutation of Match-Bounds
Theorem 3. The following problem is decidable: Given: A string rewriting system R, a regular language L, and c ∈ N. Question: Is R match-bounded by c for L? Proof. Construct (a finite automaton for) Lc = (lift0 ◦ matchc (R)∗ )(L), using Proposition 1. Then decide whether Lc contains a string x that has a factor liftc (), for some rule → r in R. If this is not the case, then Lc = Lc+1 = · · · and R is match-bounded by c for L. Otherwise, we have found a “high redex” in x, thus there is a string y with x →match(R) y and max(height(y)) = c + 1. For an implementation, the enormous growth of | matchc (R)| as a function of c is problematic. If we are computing matchc (R)∗ (lift0 (L)), then we should restrict attention to those rules of matchc (R) that are accessible in derivations starting from lift0 (L). For a language L ⊆ Σ ∗ , a system R over Σ, and a system S ⊆ match(R) define accessible(L, R, S) = match(R) ∩ (factor(S ∗ (lift0 (L))) × (Σ × N)∗ ). Note that this construction is effective if a finite system S and a regular language L are effectively given. We construct a sequence of rewriting systems Ri by R0 = ∅ and Ri+1 = accessible(L, R, Ri ). Induction on i shows Ri ⊆ matchi (R) for i ≥ 0. In particular, every system Ri is finite. By induction on i, using
454
Alfons Geser, Dieter Hofbauer, and Johannes Waldmann
monotonicity of S → accessible(L, R, S), one also proves that Ri ⊆ Ri+1 . Define ∗ R∞ = i∈N Ri . Clearly, R∞ (lift0 (L)) = match(R)∗ (lift0 (L)). If R is matchbounded by c, then R∞ is a subset of matchc (R); so R∞ is finite, and there is an index N such that RN = RN +1 = · · · . If R is not match-bounded then R∞ contains for each c a rule with height c, and is so infinite. The enumeration of Ri up to i = | matchc (R)| + 1 can be used as an alternative decision procedure for Theorem 3. In some cases we can also verify automatically that a given rewriting system R is not match-bounded for a language L. For this purpose, we try to find a self-embedding set of witnesses, as follows. The set raisedc (R, L) consists of all strings that occur as the base of a “high factor” (with all positions of height > 0) of a string that is reachable by a matchc (R)-derivation starting from lift0 (L): raisedc (R, L) = base(factor(matchc (R)∗ (lift0 (L))) ∩ (Σ × {1, 2, . . .})∗ ). First we observe that a match(R)-derivation can be raised to larger heights. For u , u ∈ (Σ × N)∗ we write u ≥ u if base(u ) = base(u) and height(u ) ≥n height(u), where ≥n denotes the pointwise greater-or-equal ordering on Nn . Lemma 1. If u ≥ u →match(R) v, then u →match(R) v ≥ v for some string v . Proposition 4. Let R be a string rewriting system, let L be a language, both over Σ. If there are c ∈ N and a language W ⊆ L ∩ raisedc (R, W ) with W ⊆ {}, then R is not match-bounded for L. Proof. We call u ∈ Σ ∗ a witness for height h if there is a match(R)-derivation from lift0 (u) to some string in (Σ × N)∗ that contains at least one position of height ≥ h. We will show that for each h ∈ N, there is some witness u ∈ W for height h. For h = 0, there is nothing to prove. By induction, assume u ∈ W is a witness for height h. Since W ⊆ raisedc (R, W ), there is some v ∈ W such that u ∈ raisedc (R, v). We claim that v is a witness for height h + 1. By definition of raisedc , there is a match(R)-derivation D from lift0 (v) to some string xu y with base(u ) = u and min(height u ) ≥ 1. Since u is a witness for h, there is a match(R)-derivation E from lift0 (u) to some word w with maximum height ≥ h. This derivation can be relabelled to a derivation from succ(lift0 (u)) = lift1 (u) to succ(w), where succ is the morphism defined in Section 4 that increases the height of each position by 1. By Lemma 1 and u ≥ lift1 (u), this derivation can be raised to a derivation E : u →∗ w for some string w ≥ succ(w). Now, D and E can be combined to lift0 (v) →∗ xu y →∗ xw y, such that max(height w ) ≥ h + 1. Note that the condition in Proposition 4 can be effectively checked if a finite SRS R, a number c ∈ N, and regular languages W and L are effectively given. Example 5. The system R = {ab → ba} (cf. Example 3) is not match-bounded for Σ ∗ . Take W = (ab)+ . Then raised1 (R, W ) = factor((ba)+ ) ⊇ W . Example 6. Neither is R = {aabb → ba} match-bounded, as wittnessed by W = {a, b}∗ = raised1 (R, W ). See Example 8 for a similar system with different behaviour.
Match-Bounded String Rewriting Systems
455
We have implemented the algorithm according to Theorem 3 and Proposition 4, see http://theo1.informatik.uni-leipzig.de/˜joe/bounded/.
6
Deciding Termination for Inverse Deleting and Inverse Match-Bounded Systems
In this section, we will prove that termination is decidable for inverse deleting string rewriting systems, and conclude that the same holds for inverse matchbounded systems. Lemma 2. Let s ⊆ Σ ∗ × Γ ∗ be a substitution, and let K be a regular language over Γ . Then Inf(s ∩ (Σ ∗ × K)) is regular. Proof. Consider a finite automaton A with state set Q that accepts K. Denote x by L(A, p, q) the set of strings x for which there is a path p → q in A. We define an automaton B over alphabet Σ × {F, I} as follows. The sets of states, initial states, and final states of B and A coincide. For p, q ∈ Q and a ∈ Σ, B contains the transition (a,I)
– p −→ q iff the language s(a) ∩ L(A, p, q) is infinite, (a,F )
– p −→ q iff the language s(a) ∩ L(A, p, q) is finite and non-empty. We claim that a1 . . . an ∈ Inf(s ∩ (Σ ∗ × K)) for ai ∈ Σ if and only if there is an accepting path in B that is labelled by (a1 , b1 ) . . . (an , bn ) where at least one bi equals I. Therefore, Inf(s ∩ (Σ ∗ × K)) = π(L(B) \ (Σ × F )∗ ) where π : (Σ × {I, F })∗ → Σ ∗ is the morphism induced by π : (a, b) → a. Lemma 3. Let Σ, Σ0 , Γ, Γ0 be alphabets, let s ⊆ Σ ∗ × Γ ∗ be a substitution, and let T1 ⊆ Σ0∗ × Σ ∗ and T2 ⊆ Γ ∗ × Γ0∗ be finitely branching rational transductions. Then Inf(T1 ◦ s ◦ T2 ) is regular. Proof. By Lemma 2, since Inf(T1 ◦ s ◦ T2 ) = T1− (Inf(s ∩ (Σ ∗ × T2− (Γ0∗ )))).
Remark 2. The regularity results in Lemma 2 and Lemma 3 are effective if s is an L-substitution for a family L of languages that is closed under intersection with regular sets, and for which emptiness and finiteness are decidable. This is the case, e.g., for the family of context-free languages, as in the proof of Proposition 5 below. Proposition 5. For an inverse deleting SRS R, Inf(R∗ ) is effectively regular. Proof. Let R be a system over alphabet Σ such that R− is deleting. First we exclude some trivial cases. Since R is inverse deleting, we have ∈ / rhs(R). And if R contains a rule → r = , then Inf(R∗ ) = Σ ∗ . So from now on, we may assume ∈ / lhs(R) ∪ rhs(R). By Theorem 1 we have R−∗ = (s ◦ C −∗ ) ∩ (Σ ∗ × Σ ∗ ), where s ⊆ Σ ∗ × Γ ∗ is a finite substitution into an extended alphabet Γ ⊇ Σ, and C is a context-free
456
Alfons Geser, Dieter Hofbauer, and Johannes Waldmann
rewriting system over Γ . Reviewing the construction in [10], we find that no can occur on either side of s and C, so C −∗ is a context-free substitution c ⊆ Γ ∗ ×Γ ∗ , and s− ⊆ Γ ∗ × Σ ∗ is the inverse of a finite and epsilon-free subsitution. We have R∗ = e ◦ c ◦ s− , where e ⊆ Σ ∗ × Γ ∗ is the embedding of Σ ∗ in Γ ∗ , therefore the claim follows by Lemma 3 and Remark 2. Theorem 4. The following problem is decidable: Given: A regular language L over Σ; an inverse deleting SRS R over Σ. Question: Is there an infinite R-derivation starting from a string in L? Proof. A finitely branching binary relation ρ is well-founded if and only if ρ∗ is finitely branching and ρ+ is irreflexive. Note that if R− is deleting then R−+ is well-founded, hence irreflexive. So there is an infinite R-derivation starting from a string in L if, and only if, Inf(R∗ )∩L = ∅. By Proposition 5, Inf(R∗ ) is regular, so emptiness of Inf(R∗ ) ∩ L is decidable. Corollary 2. Termination and uniform termination are decidable for inverse deleting string rewriting systems. Proof. Choose L = {x} to decide whether there is an infinite derivation starting with string x, and choose L = Σ ∗ to decide uniform termination. Example 7. McNaughton [13] proves decidability of termination and of uniform termination for the following class of string rewriting systems: A system R is called an inhibitor system, if there is a letter a ∈ / Σ such that ∈ Σ + and ∗ ∗ r ∈ (Σ ∪ {a}) \ Σ for every rule → r in R. (Inhibitor systems play a vital role in solving the uniform termination problem of well-behaved SRSs [13].) We can give an alternative proof by observing that an inhibitor system R is inverse deleting for the ordering that makes a greater than every other letter. Hence decidability of (uniform) termination follows from Corollary 2. As a bonus, we get context-freeness of R∗ (x) for x ∈ Σ ∗ , a result by Ginsburg and Greibach [8]. This shows once more that language classes and the uniform termination problem are intrinsically related. Theorem 5. Termination and uniform termination is decidable for string rewriting systems R for which R− is match-bounded. Proof. Assume R− match-bounded by c. Then each derivation modulo R corresponds to a derivation modulo matchc (R− )− = S, by the remark before Definition 1. So termination of R and S coincide. By Proposition 2, S is an inverse deleting system, and by Corollary 2, (uniform) termination of S is decidable. Example 8. Proving termination of the one-rule system Z = {aabb → bbbaaa} is known as Zantema’s Problem. This is a “modern classic” in rewriting [3,4,12,19,20,22], as it provides a test case where most of the automated methods for termination proofs fail. The match-bound of Z − is 2, therefore termination can be mechanically verified. (Recall that the fact that Z − is inverse match-bounded is in itself not a proof of termination for Z.) The computation of match(Z − )∗ (Σ ∗ ) according to Section 5 takes five iterations (i.e.,
Match-Bounded String Rewriting Systems
457
Z4− = Z5− = Z6− = · · · ). In our implementation (Haskell code compiled with ghc-5.04.2), this needs about 70 CPU seconds on a 2.4-GHz Pentium. The resulting automaton has 199 states. The intermediate constructions according to Theorem 1 involve much larger automata (up to 1576 states with 15999 transitions), on much larger alphabets (up to 283 letters).
7
Discussion
If the flow of information during rewriting is suitably restricted, nice properties hold: termination, bounded derivational complexity, or preservation of regular languages. For instance, McNaughton [13] and independently Ferreira and Zantema [5] use extra letters to indicate absence of information flow through certain positions. Kobayashi et al. [11] restrict derivations by using markers for the start and the end of a redex. S´enizergues [19] constructs finite automata to solve the termination problem for certain one-rule string rewriting systems. Moczydlowski and Geser [14,15] restrict the way the right hand side of a rule may be consumed in order to simulate the rewrite relation by the computation of a pushdown automaton. Our concepts of deleting and match-bounded rewriting aim at extending these approaches to a systematic theory of termination by language properties. The concept of match-bounded string rewriting opens two novel approaches to automated termination proofs: match-bounded systems are terminating, and for inverse match-bounded systems, termination is decidable. These methods can be further strengthened by considering match-boundedness not for all strings over the respective alphabet, but only for suitably chosen subsets. As we have demonstrated elsewhere [7], the right hand sides of forward closures are a suitable such subset. We expect these powerful tools to enable some major progress in the problem of deciding uniform termination for one-rule string rewriting systems, an open problem for 13 years [12], see [18, Problem 21]. Single-player games like Peg Solitaire can be analyzed through the construction of reachability sets. It is very challenging to extend this approach to twoplayer rewriting games [21]. Instead of termination (which is required anyway to give a well-defined game), for instance, one would like to know whether winning sets are regular. Even the impartial case is hard; here the central question is whether Grundy values are bounded. It seems natural to carry over the notion of match-boundedness to term rewriting, in order to obtain both closure properties and new automated termination proof methods.
Acknowledgements This research was supported in part by the National Aeronautics and Space Administration (NASA) while the last two authors were visiting scientists at the Institute for Computer Applications in Science and Engineering (ICASE), NASA Langley Research Center (LaRC), Hampton, VA, in September 2002.
458
Alfons Geser, Dieter Hofbauer, and Johannes Waldmann
References 1. J. Berstel. Transductions and Context-Free Languages. Teubner, Stuttgart, 1979. 2. R. V. Book and F. Otto. String-Rewriting Systems. Texts and Monographs in Computer Science. Springer-Verlag, New York, 1993. 3. T. Coquand and H. Persson. A proof-theoretical investigation of Zantema’s problem. In M. Nielsen and W. Thomas (Eds.) 11th Annual Conf. of the EACSL CSL-97, Lect. Notes Comp. Sci. Vol. 1414, pp. 177–188. Springer-Verlag, 1998. 4. N. Dershowitz and C. Hoot. Topics in termination. In C. Kirchner (Ed.), Proc. 5th Int. Conf. Rewriting Techniques and Applications RTA-93, Lect. Notes Comp. Sci. Vol. 690, pp. 198–212. Springer-Verlag, 1993. 5. M. C. F. Ferreira and H. Zantema. Dummy elimination: Making termination easier. In H. Reichel (Ed.), 10th Int. Symp. Fundamentals of Computation Theory FCT-95, Lect. Notes Comp. Sci. Vol. 965, pp. 243–252. Springer-Verlag, 1995. 6. T. Genet and F. Klay. Rewriting for Cryptographic Protocol Verification. In D. A. McAllester (Ed.), 17th Int. Conf. Automated Deduction CADE-17, Lect. Notes Artificial Intelligence Vol. 1831, pp. 271–290. Springer-Verlag, 2000. 7. A. Geser, D. Hofbauer, and J. Waldmann. Match-bounded string rewriting systems and automated termination proofs. 6th Int. Workshop on Termination WST-03, Valencia, Spain, 2003. 8. S. Ginsburg and S. A. Greibach. Mappings which preserve context sensitive languages. Inform. and Control, 9(6):563–582, 1966. 9. T. N. Hibbard. Context-limited grammars. J. ACM, 21(3):446–453, 1974. 10. D. Hofbauer and J. Waldmann. Deleting string rewriting systems preserve regularity. In Proc. 7th Int. Conf. Developments in Language Theory DLT-03, Lect. Notes Comp. Sci., Springer-Verlag, 2003. To appear. 11. Y. Kobayashi, M. Katsura, and K. Shikishima-Tsuji. Termination and derivational complexity of confluent one-rule string-rewriting systems. Theoret. Comput. Sci., 262(1-2):583–632, 2001. 12. W. Kurth. Termination und Konfluenz von Semi-Thue-Systemen mit nur einer Regel. Dissertation, Technische Universit¨ at Clausthal, Germany, 1990. 13. R. McNaughton. Semi-Thue systems with an inhibitor. J. Automat. Reason., 26:409–431, 2001. 14. W. Moczydlowski Jr. Jednoregulowe systemy przepisywania sl´ ow. Masters thesis, Warsaw University, Poland, 2002. 15. W. Moczydlowski Jr. and A. Geser. Termination of single-threaded one-rule SemiThue systems. Technical Report TR 02-08 (273), Warsaw University, Dec. 2002. Available at http://research.nianet.org/˜geser/papers/single.html. 16. C. Moore and D. Eppstein. One-dimensional peg solitaire, and duotaire. In R. J. Nowakowski (Ed.), More Games of No Chance, Cambridge Univ. Press, 2003. 17. B. Ravikumar. Peg-solitaire, string rewriting systems and finite automata. In H.-W. Leong, H. Imai, and S. Jain (Eds.), Proc. 8th Int. Symp. Algorithms and Computation ISAAC-97, Lect. Notes Comp. Sci. Vol. 1350, pp. 233–242. SpringerVerlag, 1997. 18. The RTA list of open problems. http://www.lsv.ens-cachan.fr/rtaloop/. 19. G. S´enizergues. On the termination problem for one-rule semi-Thue systems. In H. Ganzinger (Ed.), Proc. 7th Int. Conf. Rewriting Techniques and Applications RTA-96, Lect. Notes Comp. Sci. Vol. 1103, pp. 302–316. Springer-Verlag, 1996.
Match-Bounded String Rewriting Systems
459
20. E. Tahhan Bittar. Complexit´e lin´eaire du probl`eme de Zantema. C. R. Acad. Sci. Paris S´er. I Inform. Th´ eor., t. 323:1201–1206, 1996. 21. J. Waldmann. Rewrite games. In S. Tison (Ed.), Proc. 13th Int. Conf. Rewriting Techniques and Applications RTA-02, Lect. Notes Comp. Sci. Vol. 2378, pp. 144– 158. Springer-Verlag, 2002. 22. H. Zantema and A. Geser. A complete characterization of termination of 0p 1q → 1r 0s . Appl. Algebra Engrg. Comm. Comput., 11(1):1–25, 2000.
Probabilistic and Nondeterministic Unary Automata Gregor Gramlich Institut f¨ ur Informatik Johann Wolfgang Goethe–Universit¨ at Frankfurt Robert-Mayer-Straße 11-15 60054 Frankfurt am Main, Germany [email protected] Fax: +49 - 69 - 798-28814
Abstract. We investigate unary regular languages and compare deterministic finite automata (DFA’s), nondeterministic finite automata (NFA’s) and probabilistic finite automata (PFA’s) with respect to their size. Given a unary PFA with n states and an -isolated cutpoint, we show 1 that the minimal equivalent DFA has at most n 2 states in its cycle. This result is almost optimal, since for any α < 1 a family of PFA’s can be α constructed such that every equivalent DFA has at least n 2 states. Thus we show that for the model of probabilistic automata with a constant error bound, there is only a polynomial blowup for cyclic languages. Given a unary NFA with n states, we show that efficiently √ approximating the size of a minimal equivalent NFA within the factor ln nn is impossible unless P = N P . This result even holds under the promise that the accepted language is cyclic. On the other hand we show that we can approximate a minimal NFA within the factor ln n, if we are given a cyclic unary n-state DFA.
1
Introduction
Regular languages and finite state automata as their acceptance devices, are well studied objects. We consider DFA’s, NFA’s and PFA’s with isolated cutpoint and compare their sizes. For an n-state PFA with -isolated cutpoint, the equivalent DFA needs at 1 n−1 most (1 + 2 ) states [9]. For a unary alphabet, Milani and Pighizzini [8] show √ the tight bound of Θ(e n ln n ) for the number of states in the cycle of the minimal DFA. This result does not depend on the size of the isolation and the proof of the lower bound actually relies on an isolation that tends to zero. We show that the isolation plays a crucial role, namely that L can be accepted by a DFA 1 with at most n 2 states in its cycle. Thus, for constant isolation , we improve the upper bound of Milani and Pighizzini to be a polynomial in n.
Partially supported by DFG project SCHN503/2-1
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 460–469, 2003. c Springer-Verlag Berlin Heidelberg 2003
Probabilistic and Nondeterministic Unary Automata
461
The minimization problem for DFA’s can be efficiently solved. But for a given DFA, the problem of determining the minimal number of states of an equivalent NFA is P SP ACE-complete [5]. A result of Stockmeyer and Meyer [10] shows that the problem of minimizing a given NFA is P SP ACE-complete for a binary alphabet and N P -complete for a unary alphabet. We show that, given an n-state NFA accepting L, it is impossible to efficiently approximate the number of states of a minimal NFA accepting L within a factor √ of ln nn unless P = N P . This result holds even under the promise that L is a unary cyclic language and can be extended to PFA’s with isolated cutpoint. On the other hand we show that if we are given a unary cyclic n-state DFA accepting L, then we can efficiently construct an equivalent NFA with at most k · (1 + ln n) states, where k is the number of states of a minimal NFA accepting L. This contrasts with a result of Jiang et al. [4] who show that the number of states of a minimal NFA, equivalent to a given unary DFA, cannot be computed in polynomial time, unless N P ⊆ DT IM E(nO(ln n) ). This result even holds, if we restrict the DFA to accept only cyclic languages. The next section gives a short introduction into unary NFA’s and unary PFA’s. Unary PFA’s with -isolated cutpoint, resp. unary NFA’s, are investigated in sections 3 and 4 respectively.
2
Preliminaries
We consider unary languages L ⊆ {a}∗ . A unary regular language is recognized by a DFA that starts with a possibly empty path and ends in a non-empty cycle. A language L is ultimately d-cyclic, if there is a µ ∈ IN0 , so that (aj ∈ L ⇔ j+d a ∈ L) holds for any j ≥ µ and we say that d is an ultimate period of L. A smallest ultimate period is called the minimal ultimate period c(L) and any ultimate period is a multiple of the minimal ultimate period. L is called cyclic, if the path of the minimal DFA for L is empty. For cyclic languages we use the term period instead of ultimate period and d-cyclic (resp. minimally d-cyclic) instead of ultimately d-cyclic (resp. minimally utimately d-cyclic). The size of an automaton A is the number of states of A. For a given regular language L, we use nsize(L) as the minimal size of an NFA accepting L. A normal form for unary NFA’s is established by Chrobak in [1]. His construction converts a given NFA N with n states into an equivalent NFA N consisting of a deterministic path and several deterministic cycles. Only the last state of the path branches nondeterministically into one state of each cycle. The path of N has length O(n2 ), and the number of all states in the cycles is bounded by n. Chrobak proves, that L(N ) is ultimately d-cyclic, where d is the least common multiple of the length of the cycles in N . For cyclic languages we introduce union automata as automata in Chrobak normal form with an empty path. Definition 1. A union automaton U is described by a collection (A1 , . . . , Ak ) of cyclic DFA’s. U accepts an kinput w iff there is an Ai , such that Ai accepts w. The size of U is defined as i=1 si , where si is the number of states of Ai .
462
Gregor Gramlich
To convert a union automaton U into an NFA with a single inital state, we simply add one state q0 and transitions from q0 to each state that succeeds an initial state of the deterministic automata that U consists of. Jiang, McDowell and Ravikumar [4] show a structural result about minimal unary NFA’s accepting cyclic languages. Fact 1. [4] Let L be a minimally D-cyclic unary language. Every minimal NFA accepting L can be obtained by converting some minimal union automaton U accepting L into an NFA. Moreover D is the least common multiple of the cycle lengths of U . αr 1 Consider the prime factorization of D = pα 1 ·. . .·pr , where the pi are distinct αr 1 and αi ∈ IN, then every NFA accepting L has at least pα 1 + . . . + pr states. This result offers some clues about the composition of the (ultimate) period of a unary language which also apply to probabilistic finite automata which we define as follows. A unary PFA M with a set Q of n states is described by a stochastic n × n matrix A, a stochastic row vector π representing the initial distribution, and a column vector η ∈ {0, 1}n indicating the final states. Observe that πAj η is the acceptance probability for input aj . The language accepted by M with respect to a cutpoint λ ∈ [0, 1] is L(M, λ) = {aj |πAj η > λ}. We call cutpoint λ -isolated, if for any j ∈ IN0 : |πAj η − λ| ≥ . We call a cutpoint isolated, if there is an > 0, so that it is -isolated. We regard A as the stochastic matrix of a finite Markov chain M, with rows and columns indexed by states, and consider the representation of M as a directed graph GA = (V, E) with V = Q. An arc from state q to state p exists in GA , if Ap,q > 0. We call a strongly connected component B ⊆ Q in GA ergodic1 , if starting in any state q ∈ B, we cannot reach any state outside of B. States within an ergodic component are called ergodic states, non-ergodic states are called transient. For an ergodic component B, the period of q ∈ B is defined as dq = gcd{j| starting in q one can reach q with exactly j steps}. All states q ∈ B have the same period d = dq , which we call the period of B. Factorization and primality play an important role for (ultimate) periods. To estimate the size of the i-th prime number we use the following fact. Fact 2. [3] If pi is the i-th prime number, then i ln i ≤ pi ≤ 2i ln i for i ≥ 3.
3
Unary PFA’s with -Isolated Cutpoint
In [8] Milani and Pighizzini show, that the ergodic components of a unary PFA with isolated cutpoint basically play the same role as the cycles of an NFA in Chrobak normal form. The least common multiple D of the periods of these components is an ultimate period of the language L(M, λ) accepted by the PFA. This result does not take the isolation into account and yields√an exponential upper bound for the ultimate period, namely c(L(M, λ)) = O(e n ln n ) where n 1
Unlike some authors we do not require an ergodic component to be aperiodic.
Probabilistic and Nondeterministic Unary Automata
463
is the number of states in the PFA. We show that the ultimate period c(L(M, λ)) decreases significantly with increasing isolation and this results in a polynomial upper bound for c(L(M, λ)), if is a constant. As a first step, Lemma 1 shows that the period di of an ergodic component Bi with absorption probability ri < 2, where (πAt )p = prob(a random walk is eventually absorbed into Bi ), ri := lim t→∞
p∈Bi
does not play a role for c(L(M, λ)), neither do periods of collections of ergodic components with small combined absorption probability. Lemma 1. Let B1 , . . . , Bm be the ergodic components of a Markov chain with periods di and absorption probabilities ri , respectively. If the corresponding PFA M accepts L := L(M, λ) with -isolated cutpoint, then for any I ⊆ {1, . . . , m} with i∈I ri > 1 − 2, D(I) := lcm{di |i ∈ I} is an ultimate period of L and thus is a multiple of c(L). Proof (Sketch). For an ultimate period D of L the limit A∞ := limt→∞ (AD )t exists, where we require convergence in each entry of the matrix. This can be shown by bringing the matrix A into a normal form (see Gantmacher [2]), so that the stochastic submatrix Ai for each ergodic component Bi forms a block within A. If Bi has period di , then limt→∞ (Adi i )t exists. Since D is a multiple of every di , the limit of (AD )t exists. As a consequence from [8] and from the existence of this limit, for every δ there must be a µδ ∈ IN, such that for every j ≥ µδ , aj ∈ L ⇔ aj+D ∈ L and |(πAj )q − (πA(j mod D) A∞ )q | < δ. q∈Q
Let I ⊆ {1, . . . , m} be a set of indices with i∈I ri > 1 − 2. Assume that D(I) is not an ultimate period of L. Then there is some j > µδ with aj ∈ L and aj+D(I) ∈ L. So πAj η ≥ λ + and πAj+D(I) η ≤ λ − , and thus j j+D(I) η ≥ 2. Let (x)+ = x if x > 0, and π A −A let (x)+ = 0 otherwise. n Remember, that η ∈ {0, 1} . Then we have with QI := i∈I Bi ∪ {q|q transient} (π(Aj − Aj+D(I) ))q 2 ≤ q∈Q
≤
(π(Aj − Aj+D(I) ))+ q +
q∈QI
(π(Aj − Aj+D(I) ))+ q .
(1)
q∈QI
The proof of the existence of A∞ also shows that if we restrict the matrix A to all the states in QI and call the resulting substochastic matrix AI , then the D(I) limit limt→∞ (AI )t exists as well. And so, for δ = 2 − i∈I ri and for any j ≥ µδ , we get (π(Aj − Aj+D(I) ))+ (2) q < δ. q∈QI
But on the other hand, for any j ≥ 0
464
Gregor Gramlich
(π(Aj − Aj+D(I) ))+ q ≤
q∈QI
(πAj )q ≤
q∈QI
ri = 2 − δ.
(3)
i∈I
The second inequality follows, since the absorption probability is the limit of a monotonically increasing sequence. So we have reached a contradiction, since the sum of (3) and (2) does not satisfy (1). We can now exclude some prime powers as potential divisors of c(L(M, λ)). Definition 2. Let M be a PFA with ergodic periods di and absorption probabilities ri . We call a prime power q = ps -essential (for M ), if ri ≥ 2 and ri < 2. i: q divides di
i: q·p divides di
Lemma 2. If λ is -isolated for a PFA M , then D= q. q is −essential
is an ultimate period of L = L(M, λ). Hence D is a multiple of c(L). Proof. Assume that c(L) is a multiple of a prime power pk which does not divide any -essential prime power. Let J = {i|pk divides di }, and let I = {1, . . . , m}\J be the complement of J. Then pk does not divide any di with i ∈ I and thus pk k does not divide D(I) = lcm{d i |i ∈ I}.Since p does not divide any -essential prime power, we have that i∈J ri < 2, and so i∈I ri > 1 − 2. According to Lemma 1, D(I) is a multiple of c(L). But on the other hand D(I) is not a multiple of pk . This is a contradiction, since pk was assumed to divide c(L). Now we show the tight upper bound for the minimal ultimate period of a language accepted by an -isolated PFA. Theorem 1. a) For any unary PFA M with n states and -isolated cutpoint λ 1
c(L(M, λ)) ≤ n 2 . 1 with m ∈ IN, there is a PFA M with n b) For any 0 ≤ α < 1 and any = 2m α states and -isolated cutpoint λ, such that c(L(M, λ)) > n 2 .
Proof. a) Let M have m ergodic components with periods d1 , . . . , dm . Set D := q and remember, that q is −essential i: q divides di ri ≥ 2 for any -essential q, then ri 2 2 q ≤ q i: q divides di D = q is −essential
=
q is −essential m i=1 q is −essential, q divides di
q ri ≤
m i=1
dri i .
Probabilistic and Nondeterministic Unary Automata
465
m Now, since i=1 ri = 1, the weighted arithmetic mean is at least as large as the geometric mean, and thus m
ri d i ≥
i=1
m i=1
dri i .
Since D ≥ c(L(M, λ)) with Lemma 2, we obtain n≥
m
di ≥
i=1
m
ri d i ≥
i=1
m i=1
dri i ≥ D2 ≥ c(L(M, λ))2 .
And the claim follows. b) Let p1 , p2 , . . . be the sequence of prime numbers. We define the languages
k+m−1 j Lk,m = a j ≡ 0 mod pi i=k
k+m−1
m for k, m ≥ 1. Obviously c(Lk,m ) = i=k p i ≥ pm k ≥ (k ln k) . 1 On the other hand Lk,m can be accepted by a PFA with isolation = 2m 1 and cutpoint λ = 1 − 2m as follows. We define a “union automaton with an initial distribution” by setting up m disjoint cycles of length pk , pk+1 , . . . , pk+m−1 , respectively. The transition probability from one state to the next in a cycle is 1. There is exactly one final state in each cycle and the initial distribution 1 places probability m on each final state. For every word az ∈ Lk,m we have z ≡ 0(mod pi ) for every k ≤ i ≤ k + m − 1 and for every word az ∈ Lk,m there is at least one i with z ≡ 0(mod pi ). Thus a word is either accepted with 1 probability 1, or it can reach acceptance probability at most 1 − m . Applying Fact 2, the number of states in the PFA is
k+m k+m−1 k+m−1 pi ≤ 2 i ln i ≤ 2 x ln x dx nk,m = i=k
=2
i=k
k
2 x=k+m
x x ln x − 2 4 2
x=k
≤ (k + 2km + m ) ln(k + m) − k 2 ln k m + (2km + m2 ) ln(k + m). = k 2 ln 1 + k m k ≤ ln em = m, But since k ln 1 + m k = ln 1 + k 2
2
nk,m ≤ km + (2km + m2 ) ln(k + m) ≤ (3km + m2 ) ln(k + m). Thus for any 0 ≤ α < 1, any constant m =
1 2
and a sufficiently large k, we have a
2 , c(Lk,m ) ≥ (k ln k)m > ((3km + m2 ) ln(k + m))αm ≥ nk,m
and the claim follows.
Our result shows that for a fixed isolation , the ultimate period of the language accepted by the PFA M with n states is only polynomial in n.
466
4
Gregor Gramlich
Approximating the Size of a Minimal NFA
Stockmeyer and Meyer [10] show, that the universe problem L(N ) = Σ ∗ is N P complete for regular expressions and NFA’s N , even if we consider only unary languages. Since our argument is based on their construction, we show the proof. Fact 3. [10] For a unary NFA N , it is N P -hard to decide, if L(N ) = {a}∗ . Proof. We reduce 3SAT to the universe problem for unary NFA’s. Let Φ be a 3CNF-formula overn variables with m clauses. Let p1 , . . . , pn be the first n n primes and set D := i=1 pi . According to the chinese remainder theorem, the n function µ : IN0 → IN0 with µ(x) = (x mod p1 , . . . , x mod pn ) is injective, if we restrict the domain to {0, . . . , D − 1}. We call x a code (for an assignment), if µ(x) ∈ {0, 1}n . We construct a union automaton NΦ that accepts {a}∗ iff Φ is not satisfiable. We first make sure, that L0,Φ = {ak |k is not a code} is accepted. Therefore, for every prime pi (pi > 2) we construct a cycle that accepts the words aj with j ≡ 0(mod pi ) ∧ j ≡ 1(mod pi ). So there are 2 non-final states and (pi − 2) final states in the cycle. For every clause C of Φ with variables xi1 , xi2 , xi3 we construct a cycle C ∗ of length pi1 pi2 pi3 . C ∗ will accept {ak | the assignment k mod pij for xij (j = 1, 2, 3) does not satisfy C}. Since the falsifying assignment is unique for the three variables in question, exactly one state is accepting in C ∗ . The construction can be done in time polynomial in the length of Φ. If there is a word aj ∈ L(NΦ ), then j is a code for a satisfying assignment. On the other hand every satisfying assignment has a code j and aj is not accepted by NΦ . We set LΦ = L(NΦ ) for the automaton NΦ constructed above. Observe that LΦ is a union of cyclic languages and hence itself cyclic. Obviously if Φ ∈ 3SAT , 1. We will show, that for Φ ∈ 3SAT every then the minimal NFA for LΦ has size n NFA accepting LΦ must have at least i=2 pi states, which implies Theorem 2. Theorem 2. Given an NFA N with n states, it is impossible to efficiently ap√ n proximate nsize(L(N )) within a factor of ln n unless P = N P . We first determine a lower bound for the period of LΦ . Lemma 3. For nany given 3CNF-formula Φ ∈ 3SAT the minimal period of LΦ is either D := i=2 pi or 2D. Proof. LΦ is 2D-cyclic, since 2D is the least common multiple of the cycle lengths of NΦ . Assume that neither D nor 2D is the minimal period of LΦ . Then there is i ≥ 2, such that d = pDi is a period of LΦ . We know that aqpi +2 ∈ L0,Φ for every q ∈ IN, because qpi + 2 does not represent a code. Since L0,Φ ⊆ LΦ and we assume that LΦ is d-cyclic, aqpi +2+rd belongs to LΦ for every r ∈ IN as well. On the other hand, since LΦ = {a}∗ , there is an al ∈ LΦ , and so al+td ∈ LΦ for every t ∈ IN. It is a contradiction, if we find q, r, t ∈ IN0 , so that qpi +2+rd =
Probabilistic and Nondeterministic Unary Automata
467
l + td, since the corresponding word has to be in LΦ because of the left-hand side of the equation and cannot be in LΦ because of the right-hand side. ∃q, r, t : qpi + 2 + rd = l + td ⇔ ∃q, r, t : qpi = l − 2 + (t − r)d (mod d) ⇔ ∃q : qpi ≡ l − 2 ⇔ ∃q : q ≡ (l − 2)p−1 (mod d) i The multiplicative inverse of pi modulo d exists, since gcd(pi , d) = 1, and we have obtained the desired contradiction. We will need a linear relation between the number of clauses and variables in the CNF-formula. Fact 4. Let E3SAT −E5 be the satisfiability problem for formulae with exactly 3 literals in every clause and every variable appearing in exactly 5 distinct clauses, then E3SAT − E5 is N P -complete. The following Lemma determines a lower bound for the size of an NFA equivalent to NΦ , if Φ is satisfiable. Lemma 4. Let Φ ∈ E3SAT − E5 and assume that Φ consists of m clauses. Then nsize(L(NΦ )) ≥ cm2 ln m for some constant c. Proof. We know from Lemma 3, that L(NΦ ) is either minimally D-cyclic or 2Dn cyclic with D = i=2 pi where n is the number of variables n in Φ. Applying Fact 1 the size of a minimal NFA accepting LΦ is at least i=2 pi . We observe that n
i=2
pi ≥
n
i=1
i ln i ≥
n 1
x ln x dx ≥
n2 4
ln n
We have 5n = 3m and thus nsize(LΦ ) ≥ cm2 ln m for some constant c.
Finally we determine an upper bound for the size of the NFA NΦ . Lemma 5. Let Φ be a 3CNF formula with m clauses and exactly 5 appearances of every variable. Then the NFA NΦ has size Θ m4 (ln m)3 . Proof. The number of states in a cycle for a clause is a product of three primes. 3 (m ln m) ) states in all of these cycles. The So there are at most m · p3n = Θ(m n 2 cycles recognizing L0,Φ have i=2 pi = Θ(n ln n) states, where n is the number of variables of Φ. Since n = Θ(m) the claim follows. Proof (of Theorem 2). Assume that the polynomial time deterministic algorithm √ A approximates nsize(L(N )) within the factor ln ss for an NFA N with s states. We show that the satisfiablity problem can be decided in polynomial time. Let Φ be the given input for the E3SAT − E5 problem, where we assume that Φ has n variables and m clauses. We construct the NFA NΦ as in fact 3. If Φ is not satisfiable, then nsize(LΦ ) = 1, and according to Lemma 5 the algorithm A claims that an equivalent NFA with at most √ (Θ(m4 (ln m)3 )) s = o(m2 ln m) = ln s ln(Θ(m4 (ln m)3 ))
468
Gregor Gramlich
n 2 states exists. Since i=2 pi = Θ(m ln m), the claimed number of states is asymptotically smaller than nsize(LΨ ) for any satisfiable formula Ψ with the same number of clauses as Φ. Hence with the help of A, we can decide if Φ is satisfiable within polynomial time. Remark 1. For every 0 < ≤ 1 the same construction as in the proof of Theorem 2 can be used to show that it is not possible to approximate the size of a minimal 1 PFA with isolation equivalent to a given n-state PFA with isolation c · n− 4 √ within the factor ln nn . For a given formula Φ with m clauses we construct the PFA MΦ with m cycles2 and uniform initial distribution for the initial states of each cycle. We 1 . Hence a word is accepted by MΦ iff it is accepted define the cutpoint as λ = 2m 1 1 ≥ c · n− 4 for by at least one cycle. Thus the cutpoint λ is δ-isolated with δ = 2m some appropriate c, and MΦ behaves like a union automaton. Since L(MΦ , λ) is the same languageas considered before, it is 1-cyclic if Φ is not satisfiable m and has period D = i=2 pi or 2D if Φ is satisfiable. Every PFA with isolated m m cutpoint that accepts a language with period i=2 pi has at least i=2 pi states [7], independent of the actual isolation. The approximation complexity changes if a unary cyclic language is specified by a DFA M , although the decision problem, namely to decide whether there is a k-state NFA accepting the cyclic language L(M ), is not efficiently solvable unless N P ⊆ DT IM E(nO(ln n) ) [4]. Theorem 3. Given a unary cyclic DFA accepting L with D states, an NFA for L with at most nsize(L) · (1 + ln D) states computed in polynomial time. can be3 Observe that nsize(L) · (1 + ln D) = O nsize(L) 2 ln nsize(L) . Proof. We reduce the optimization problem for a given cyclic DFA M to an instance of the weighted set cover problem. We can assume M to be a minimal cyclic D-state DFA with the set of states Q = {0, . . . , D − 1}, 0 as the initial state, and final states F ⊆ Q. Then L(M ) = {aj+kD |j ∈ F, k ∈ IN0 }. For every dl that divides D we construct a deterministic cycle Cl with period dl . The union automaton consisting of these cycles will accept L(M ), if we choose the final states of Cl as follows: For each aj ∈ L with 0 ≤ j < dl , we let Cl accept aj , iff aj+k·dl ∈ L(M ) for any 0 ≤ k < dDl . Remember, that we don’t have to check for ax with x ≥ D, since L(M ) is D-cyclic and dl divides D. At this stage the union automaton will have a lot of unnecessary cycles. Therefore we define an instance of the set cover problem, where we introduce a set Tl := {j|0 ≤ j < D, aj is accepted by Cl } of weight wl := dl for every cycle Cl . The universe is {j|0 ≤ j < D, aj ∈ L(M )}. The instance can be constructed in polynomial time, since the number of divisors of D is less than D and thus the set cover problem consists of at most D sets with at most D elements. If N is a minimal NFA accepting L(M ), then we know from Fact 1 that N is a union automaton (with an additional initial state) that consists of cycles 2
To check the validity of a code we can also use the clause cycles.
Probabilistic and Nondeterministic Unary Automata
469
with periods that divide D. Every cycle C ∗ of N corresponds to a set Tl and the accepted words of C ∗ up to length D − 1 are contained in Tl . So a minimal union automaton with n states can be expressed by a set cover of weight n. On the other hand, every set cover can be considered to be a union automaton. Thus a minimal set cover corresponds to a minimal NFA. The greedy algorithm for the weighted set problem approximates the cover k optimal set cover within the factor H(k) = i=1 k1 ≤ 1 + ln k, where k is the size of the largest set [6]. For an n-state NFA N Chrobak [1] bounds the size of √ c(L(N )) by the Landau function and receives D = O(e n ln n ).
5
Conclusions and Open Problems
In Theorem 1 we have shown that PFA’s with constant isolation lead to only polynomially smaller automata in comparison to cyclic unary DFA’s. It is not hard to observe that PFA’s with constant isolation are negatively exponentially smaller than DFA’s for non-cyclic unary languages. The size relation between minimal PFA’s and minimal DFA’s for non-cyclic unary languages is to be further explored. The hardness result of Theorem 2 for minimizing unary NFA’s is tight within √ a square, since size ln nn is excluded for a given NFA of size n. Is Theorem 2 “essentially” optimal? Jiang and Ravikumar [5] state the open problem of approximating a minimal NFA given a DFA. Specifically to determine the complexity of designing an NFA accepting L(M ) with at most nsize(L(M ))k states for a given DFA M and a given k. We have answered the question for the case of unary cyclic DFA’s and k > 32 in Theorem 3.
References 1. Chrobak, M.: Finite automata and unary languages, Theoretical Computer Science 47, 1986, pp. 149-158. 2. Gantmacher, F.R.: Theory of Matrices, Vol. II, Chelsea, New York, 1959. 3. Graham, R., Knuth, D., Patashnik, O.: Concrete Mathematics, Addison Wesley, Reading, Massachusetts, 1989. 4. Jiang, T., McDowell, E., Ravikumar, B.: The structure and complexity of minimal NFA’s over a unary alphabet, Int. J. Found. of Comp. Sci., 2, 1991, pp. 163-182. 5. Jiang, T., Ravikumar, B.: Minimal NFA problems are hard, SIAM Journal on Computing, 22 (1), 1993, pp. 1117-1141. 6. Hochbaum, D. (editor): Approximation algorithms for N P -hard problems, PWS Publishing Company, Boston, 1997. 7. Mereghetti, C., Palano, B., Pighizzini, G.: On the succinctness of deterministic, nondeterministic, probabilistic and quantum finite automata, DCAGRS 2001. 8. Milani, M., Pighizzini, G.: Tight bounds on the simulation of unary probabilistic automata by deterministic automata, DCAGRS 2000. 9. Rabin, M.: Probabilistic automata, Information and Control, 1963, pp. 230-245. 10. Stockmeyer, L., Meyer, A.: Word Problems Requiring Exponential Time, Proc. of the 5th Ann. ACM Symposium on Theory of Computing, New York, 1973, pp. 1-9.
On Matroid Properties Definable in the MSO Logic Petr Hlinˇen´ y ´ SAV) Institute of Mathematics and Comp. Science (MU Matej Bel University and Slovak Academy of Sciences Severn´ a ul. 5, 974 00 Bansk´ a Bystrica, Slovakia [email protected]
Abstract. It has been proved by the author that all matroid properties definable in the monadic second-order (MSO) logic can be recognized in polynomial time for matroids of bounded branch-width which are represented by matrices over finite fields. (This result extends so called “M S2 -theorem” of graphs by Courcelle and others.) In this work we review the MSO theory of finite matroids and show some interesting matroid properties which are MSO-definable. In particular, all minorclosed properties are recognizable in such way. Keywords: matroid, branch-width, MSO logic, parametrized complexity.
1
Introduction
The theory of parametrized complexity provides a background for analysis of difficult algorithmic problems which is finer than classical complexity theory. We postpone formal definitions till Section 3. Briefly saying, a problem is called “fixed-parameter tractable” if there is an algorithm having running time with the (possible) super-polynomial part separated in terms of some natural “parameter”, which is supposed to be small even for large input in practice. (Successful practical applications of this concept are known, for example, in computational biology or in database theory.) We are interested in algorithmic problems that are parametrized by a “treelike” structure of the input objects. Graph “branch-width” is closely related to well-known tree-width [13], but a branch decomposition does not refer to vertices, and so branch-width directly generalizes from graphs to matroids. It follows from works of Courcelle [2] and Bodlaender [1] that all graph problems definable in the monadic second-order logic can be solved in linear time for graphs of bounded tree-width. Those include many notoriously hard problems like 3-colouring, Hamiltonicity, etc.
Parts of this research have been done during author’s stay at the Victoria University of Wellington in New Zealand. From August 2003 also Department of Computer Science, Technical University Ostrava, Czech Republic.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 470–479, 2003. c Springer-Verlag Berlin Heidelberg 2003
On Matroid Properties Definable in the MSO Logic
471
We study and present analogous results for matroids representable over finite fields. The motivation of our research is mainly theoretical — to show how the mentioned complexity phenomenon extends from graphs to a much larger class of combinatorial objects, and to stimulate further research interest in matroid branch-width and the complexity of matroid problems. (Unfortunately, wide generality of our approach leads to impractically huge constants involved in the algorithms, such as in Theorem 4.1.) Since not all computer scientists are familiar with structural matroid theory or with parametrized complexity, we give a basic overview of necessary concepts in the next two sections.
2
Matroids and Branch-Width
We refer to Oxley [12] for matroid terminology. A matroid is a pair M = (E, B) where E = E(M ) is the ground set of M (elements of M ), and B ⊆ 2E is a nonempty collection of bases of M . Moreover, matroid bases satisfy the “exchange axiom”; if B1 , B2 ∈ B and x ∈ B1 − B2 , then there is y ∈ B2 − B1 such that (B1 − {x}) ∪ {y} ∈ B. We consider only finite matroids. Subsets of bases are called independent sets, and the remaining sets are dependent. Minimal dependent sets are called circuits. All bases have the same cardinality called the rank r(M ) of the matroid. The rank function rM : 2E → N of M tells the maximal cardinality rM (X) of an independent subset of a set X ⊆ E(M ). If G is a graph, then its cycle matroid on the ground set E(G) is denoted by M (G). The bases of M (G) are the (maximal) spanning forests of G, and the circuits of M (G) are the cycles of G. Another example of a matroid is a finite set of vectors with usual linear dependency. If A is a matrix, then the matroid formed by the column vectors of A is called the vector matroid of A, and denoted by M (A). The matrix A is a representation of a matroid M M (A). We say that the matroid M (A) is F-represented if A is a matrix over a field F. The dual matroid M ∗ of M is defined on the same ground set E, and the bases of M ∗ are the set-complements of the bases of M . The dual rank function satisfies rM ∗ (X) = |X| − r(M ) + rM (E − X). A set X is coindependent in M if it is independent in M ∗ . An element e of M is called a loop (a coloop), if {e} is dependent in M (in M ∗ ). The matroid M \ e obtained by deleting a noncoloop element e is defined as (E − {e}, B − ) where B − = {B : B ∈ B, e ∈ B}. The matroid M/e obtained by contracting a non-loop element e is defined using duality M/e = (M ∗ \ e)∗ . (This corresponds to contracting an edge in a graph.) A minor of a matroid is obtained by a sequence of deletions and contractions of elements. Since these operations naturally commute, a minor M of a matroid M can be uniquely expressed as M = M \ D/C where D are the coindependent deleted elements and C are the independent contracted elements. A matroid family M is minor-closed if M ∈ M implies that all minors of M are in M. A matroid N is called an excluded minor (also known as “forbidden”) for a minor-closed family M if N ∈ M but N ∈ M for all proper minors N of N . The connectivity function λM of a matroid M is defined for all subsets A ⊆ E = E(M ) by λM (A) = rM (A) + rM (E − A) − r(M ) + 1. Notice that λM (A) =
472
Petr Hlinˇen´ y 1
2
4
3
8
7 4
2
1
9
3
1
2
6
5
7
4
8 5
3
6
5 6
7
8 9
4
8
3
7
2
6
1
5
Fig. 1. Two examples of width-3 branch decompositions of the Pappus matroid (top left, rank 3) and of the binary affine cube (bottom left, rank 4). Here the lines depict linear dependencies between matroid elements.
λM (E − A). Is is also routine to verify that λM (A) = λM ∗ (A), i.e. matroid connectivity is dual-invariant. A subset A ⊆ E is k-separating if λM (A) ≤ k. A partition (A, E−A) is called a k-separation if A is k-separating and both |A|, |E− A| ≥ k. For n > 1, the matroid M is called n-connected if it has no k-separation for k = 1, 2, . . . , n − 1, and |E(M )| ≥ 2n − 2. (A connected matroid corresponds to a vertex 2-connected graph. Geometric interpretation of a k-separation (A, B) is that the spans of A and of B intersect in a subspace of rank less than k.) Let (T ) denote the set of leaves of a tree T . A branch decomposition of a matroid M is a pair (T, τ ) where T is a tree of maximal degree three, and τ is a bijection of E(M ) onto (T ). Let f be an edge of T , and T1 , T2 be the connected components of T − f . The width of an edge f in T is λM (A) = λM (B), where A = τ −1 ((T1 )) and B = τ −1 ((T2 )). The width of the branch decomposition (T, τ ) is maximum of the widths of all edges of T , and the branch-width of M is the minimal width over all branch decompositions of M . If T has no edge, then we take its width as 0. An example of a branch decomposition is presented in Fig. 1. Notice that matroid branch-width is invariant under duality. It is straightforward to verify that branch-width does not increase when taking minors: Let (T, τ ) be a branch decomposition of a matroid M . Say, up to duality, that M = M \ e. We form T from T by deleting the leaf τ (e), and set τ to be τ restricted to E(M ). Then, for any partition (A, B) of E(M ) given by an edge f in T , we have obvious λM (A − {e}) ≤ λM (A), and so the width of (T , τ ) is not bigger than the width of (T, τ ) for M .
On Matroid Properties Definable in the MSO Logic
473
We remark that branch-width of a graph G is defined analogously, using the connectivity function λG where λG (F ) for F ⊆ E(G) is the number of vertices incident both with F and E(G) − F . Clearly, branch-width of a graph G is never smaller than branch-width of its cycle matroid M (G). It is still an open conjecture that these numbers are actually equal. On the other hand, branchwidth is within a constant factor of tree-width in graphs [13]. Lastly in this section we mention few words about relations of matroid theory to computer science. As the reader surely knows, a greedy algorithm on a matroid is one of the basic tools in combinatorial optimization. That is why matroids naturally arise in a number of optimization problems; such as the minimum spanning tree or job assignment problems. More involved applications of matroids in combinatorial optimization could be found in numerous works of Edmonds, Cunningham and others. Besides that, the concept of branch-width has attracted increasing attention among matroid theorists recently, and several deep results of Robertson-Seymour’s graph minor theory have been extended from graphs to matroids representable over finite fields; such as [6]. Robertson-Seymour’s theory has been followed by many interesting algorithmic applications on graphs (mostly related to tree-width or branch-width). Therefore we think it is right time now to look at complexity aspects of branchwidth in matroid problems. For example, we have given a straightforward polynomial algorithm for computation of the Tutte polynomial [10] on a representable matroid of bounded branch-width. (It seems that matroids present a more suitable model than graphs for computing the Tutte polynomial on structures of bounded tree-/branch-width.) As yet another motivation we remark that linear codes over a finite field F are in a direct correspondence with F-represented matroids.
3
Parametrized Complexity
When speaking about parametrized complexity, we closely follow Downey and Fellows [4]. Here we present the basic definition of parametrized tractability. For simplicity, we restrict the definition to decision problems, although an extension to computation problems is straightforward. Let Σ be the input alphabet. A parametrized problem is an arbitrary subset Ap ⊆ Σ ∗ × N. For an instance (x, k) ∈ Ap , we call k the parameter and x the input for the problem. (The parameter is sometimes implicit in the context.) We say that a parametrized problem Ap is (nonuniformly) fixed-parameter tractable if there is a sequence of algorithms {Ai : i ∈ N}, and a constant c; such that (x, k) ∈ Ap iff the algorithm Ak accepts (x, k), and that the running time of Ak on (x, k) is O(|x|c ) for each k. Similarly, a parametrized problem Ap is uniformly fixed-parameter tractable if there is an algorithm A, a constant c, and an arbitrary function f : N → N; such that (x, k) ∈ Ap iff the algorithm A accepts (x, k), and that the running time of A on (x, k) is O(f (k) · |x|c ). There is a natural correspondence of a parametrized problem Ap to an ordinary problem A = { x, k : (x, k) ∈ Ap } (for example, the problem of a
474
Petr Hlinˇen´ y
k-vertex cover in a graph), or to a problem A = {x : ∃k (x, k) ∈ Ap } if k is not “directly involved” in the question (such as a Hamiltonian cycle in a graph of tree-width k). On the other hand, an ordinary problem may have several natural parametrized versions respecting different parameters. We remark that the parameter is formally a natural number, but that may encode arbitrary finite structures in a standard way. As we have already noted above, our interest is in parametrized problems where the parameter is branch-width (tree-width). Inspired by the algorithm of Bodlaender [1], we have shown that branch-width of matroids represented over finite fields is fixed parameter tractable, and that, moreover, we could efficiently construct a branch decomposition. Let Bt denote the class of all matroids of branch-width at most t. We have proved the following: Theorem 3.1. (PH [9]) Let t ≥ 1 be fixed, and let F be a finite field. Suppose that A is an r × n matrix over F (r ≤ n) such that the represented matroid M (A) ∈ Bt . Then there is an algorithm that finds a branch decomposition of the matroid M (A) of width at most 3t in time O(n3 ). Actually, our algorithm directly constructs a so called “parse tree” for the mentioned branch decomposition. Unfortunately, the algorithm in Theorem 3.1 does not necessarily produce the optimal branch decomposition. On the other hand, there are finitely many excluded minors for the class Bk for each k, and these excluded minors are constructed algorithmically since they have size at most 15 (6k+1 − 1) by [5]. Hence, in this particular case, we can extend the idea in Theorem 5.2 to show: Corollary 3.2. Let F be a finite field. Suppose that A is a given matrix over F. Then branch-width of the matroid M (A) is uniformly fixed parameter tractable.
4
MSO Logic of Matroids
The monadic second-order (MSO) theory of matroids uses language based on the monadic second-order logic. The syntax includes variables for matroid elements and element sets, the quantifiers ∀, ∃ applicable to these variables, the logical connectives ∧, ∨, ¬, and the following predicates: 1. =, the equality for elements and their sets, 2. e ∈ F , where e is an element variable and F is an element set variable, 3. indep(F ), where F is an element set variable, and the predicate tells whether F is independent in the matroid. Moreover, we write φ → ψ to stand for ¬φ∨ψ, and X ⊆ Y for ∀x(x ∈ Y ∨x ∈ X). Notice that the “universe” of a formula (the model in logic terms) in the above theory is one particular matroid. To give a better feeling for the MSO theory of matroids, we provide few simple predicates now. We write basis(B) ≡ indep(B) ∧ ∀e e ∈ B ∨ ¬ indep(B ∪ {e}) where indep(B ∪ {e}) is a shortcut for obvious ∃X indep(X) ∧ e ∈ X ∧ B ⊆ X ∧ ∀x(x = e ∨ x ∈ B ∨ x ∈ X) . Similarly,
On Matroid Properties Definable in the MSO Logic
475
we write a predicate circuit(C) ≡ ¬ indep(C) ∧ ∀e e ∈ C → indep(C − {e}) where indep(C − {e}) is a shortcut for ∃X indep(X) ∧ e ∈ X ∧ X ⊆ C ∧ ∀x(x = e ∨ x ∈ C ∨ x ∈ X) . Let us now look at the (graph) property of being Hamiltonian. In matroid language, that means to have a circuit containing a basis. So we may write a sentence hamilton ≡ ∃C circuit(C) ∧ ∃e basis(C − {e}) . A related matroidal property is to be a paving matroid M — i.e., to have all circuits C in M of size |C| ≥ r(M ). Let us explain this sample property in detail. Since C − {e} is independent for each e ∈ C by definition of a circuit, we have |C| ≤ r(M ) + 1 for any circuit C in M . Considering a basis B ⊇ C − {e} and the inequality |C| ≥ r(M ) = |B| valid in a paving matroid, we conclude that there is an element f such that B ⊆ C ∪ {f}. The converse also holds. Hence we express paving ≡ ∀C circuit(C) → ∃f, B B ⊆ C ∪ {f } ∧ basis(B) . The reason why we are looking for properties definable in the MSO logic of matroids is, that such properties can be recognized in polynomial time for matroids of bounded branch-width over finite fields. The following result is based on a finite-state recognizability of matroidal MSO properties, proved by the author in [8], and on Theorem 3.1. Theorem 4.1. (PH [7,8,9]) Let F be a finite field. Assume that M is a class of matroids defined in one of the following ways; (a) there is an MSO sentence φ such that M ∈ M iff φ is true on M , or (b) there is a sequence of MSO sentences {φk : k = 1, 2, . . .} and, for all k ≥ 1 and matroids M ∈ Bk , we have M ∈ M iff φk is true on M . Suppose that A is an n-column matrix over F such that M (A) ∈ Bt where t ≥ 1 is fixed. Then there is an algorithm deciding whether M (A) ∈ M in time O(n3 ), and this algorithm can be constructed from the given sentence(s) φ or φt for all t. Remark. In the language of parametrized complexity, Theorem 4.1 says that the class of F-represented matroids defined by MSO sentences φ or φt is fixedparameter tractable with respect to the combined parameter F, t . Moreover, in the case (a), or in the case (b) when the sentences φk are constructible by an algorithm, the class M is uniformly fixed-parameter tractable. So it follows that the properties of being Hamiltonian or a paving matroid can be efficiently recognized on F-represented matroids of bounded branch-width. Other simple matroidal properties definable in the MSO logic are, for example, the properties of being identically self-dual, or being a “free spike” [11]. Moreover, all properties definable in the extended MSO theory of graphs (M S2 ) are also MSO-definable over graphic matroids [8]. Several more interesting classical matroid properties are shown to be MSO-definable in the next sections.
5
Minor-Closed Properties
It is easy to see that the class of F-representable matroids is minor-closed, and so is the class Bt of matroids of branch-width at most t. We say that a set S is wellquasi-ordered (WQO) if there are neither infinite antichains nor infinite strictly
476
Petr Hlinˇen´ y
descending chains in S. By a deep result of [6], matroids of bounded branchwidth which are representable over a fixed finite field F are WQO in the minor order. (However, unlike graphs, matroids are not WQO in general.) So it follows that any minor-closed matroid family M has a finite number of F-representable excluded minors in Bt . We now show that presence of one particular minor can be described by an MSO sentence. Lemma 5.1. Let N be a matroid. There is a (computable) MSO sentence ψN such that ψN is true on a matroid M if and only if M has an N -minor. Proof. N is a minor of M if and only if there are two sets C, D such that C is independent and D is coindependent in M , and that N = M \ D/C. Suppose that N = M \ D/C holds. Then a set X ⊆ E(N ) is dependent in N if and only if there is a dependent set Y ⊆ E(M ) in M such that Y − X ⊆ C. (This simple claim may be more obvious when viewed over the dual matroid M ∗ — a set is dependent in M iff it intersects each basis of M ∗ , and N ∗ = M ∗ /D \ C.) Since N is fixed, we may identify the elements of the (supposed) N -minor in M by variables x1 , . . . , xn in order, where n = |E(N )|. Then, knowing the contract set C (and implicit D), we are able to say which subsets of {x1 , . . . , xn } are dependent in M \ D/C. For each J ⊆ [1, n], we write mdep(xj : j ∈ J; C) ≡ ∃ Y ¬ indep(Y ) ∧ ∀y y ∈ Y ∨ y ∈ C ∨ y = xj . j∈J
Now, M \ D/C is isomorphic to N iff the dependent subsets of {x1 , . . . , xn } exactly match the dependent sets of N . Hence we express ψN as
¬ mdep(xj : j ∈ J; C) ∧ mdep(xj : j ∈ J; C) , ∃ C ∃ x1 , . . . , xn J∈J+
J∈J−
where J+ is the set of all J ⊆ [1, n] such that {xj : j ∈ J} actually is independent in N , and where J− is the complement of J+ . 2 Hence, in connection with Theorem 4.1, we conclude: Theorem 5.2. Let t ≥ 1 be fixed, let F be a finite field, and let M be a minorclosed family. Given a matrix A over F with n columns such that M (A) ∈ Bt , one can decide whether the matroid M (A) belongs to M in time O(n3 ). Proof. As already noted above, the family M has a finite number of Frepresentable excluded minors X1 , . . . , Xp ∈ Bt . Keeping in mind that all minors of M (A) also belong to Bt , we see that M (A) ∈ M iff M (A) has no minors isomorphic to X1 , . . . , Xp . (For formal completeness, we may verify M (A) ∈ Bt using Corollary 3.2.) We write φt ≡ ¬ψX1 ∧ . . . ∧ ¬ψXp using Lemma 5.1. Finally, we apply Theorem 4.1(b). 2 Applications of this theorem include determining the exact branch-width (cf. Section 3) or tree-width of a matroid, or deciding matroid orientability and representability over another field.
On Matroid Properties Definable in the MSO Logic
477
Remark. Unfortunately, the proof of Theorem 5.2 is non-constructive — there is no way in general how to compute the excluded minors X1 , . . . , Xp , not even their number or size. So we cannot speak about uniform fixed-parameter tractability here.
6
Matroid Connectivity
Another interesting task is to describe matroid connectivity in the MSO logic. That can be done quite easily. Lemma 6.1. Let M be a matroid on the ground set E, and let k ≥ 1. There is an MSO formula σk (X) which is true for X ⊆ E if and only if λM (X) ≥ k + 1. Proof. By definition, λM (X) ≥ k + 1 iff rM (X) + rM (E − X) ≥ r(M ) + k. Using standard matroidal arguments, this is equivalent to stating that there exist two bases B1 , B2 of M such that B2 ∩ X ⊂ B1 and |(B1 − B2 ) ∩ X| ≥ k. We may formalize this statement as
σk (X) ≡ ∃B1 , B2 basis(B1 ) ∧ basis(B2 ) ∧ ∀x (x ∈ B2 ∧ x ∈ X) → x ∈ B1 ∧ ∧ ∃z1 , . . . , zk
i=j
zi = zj ∧
i
zi ∈ X ∧
i
zi ∈ B1 ∧
i
zi ∈ B2
. 2
So we may finish this section with the next immediate result: Corollary 6.2. For each n > 1, there is an MSO sentence κn which is true on a matroid M if and only if M is n-connected.
7
Transversal Matroids
A matroid M is transversal if there is a bipartite graph G with vertex parts V = E(M ) and W , such that the rank of any set X in M equals the largest size of a matching incident with X in G. (Equivalently, a transversal matroid is a union of rank-1 matroids.) We consider transversal matroids here mainly because they have long history of research, but there is not much known about their relation to branch-width. Two elements e, f in a matroid M are parallel if {e, f } form a circuit, and e, f are in series if e, f are parallel in the dual M ∗ . A series minor of a matroid M is obtained by a sequence of contractions of series elements and arbitrary deletions of elements in M . A matroid having a representation over GF (2) is called a binary matroid. The trouble with transversal matroids is that these are not closed under taking minors or duals. However, series minors of transversal matroids are transversal again. We cannot use a “series” analogue of Theorem 5.2 since there is no wellquasi-ordering property of series minors even of bounded branch-width. Still, we can say a bit:
478
Petr Hlinˇen´ y
Theorem 7.1. There is an MSO sentence τ which is true on a matroid M if and only if M is a binary transversal matroid. Sketch of proof. Let Ck2 denote the graph obtained from a length-k cycle Ck by adding one parallel edge to each edge of Ck . According to [3], the following is true: A matroid M is both binary and transversal if and only if M has no series minor isomorphic to either the 4-element line U2,4 , or the graphic matroids M (K4 ) or M (Ck2 ) for k ≥ 3. Let N = M \ D/C be a minor of M , and let F = E(N ). There are no problems to express that N is a series minor of M , i.e. that C consists of series elements of M \ D. (For simplicity, we assume no coloops.) We write ∀x ∈ C ∃y ∈ F ∀Z Z ⊆ F ∪ C ∧ basis(Z) → x ∈ Z ∨ y ∈ Z . Now let P be a matroid. We may express whether P is isomorphic to M (Ck2 ) (regardless of the value of k) as follows ∃Z circuit(Z) ∧ ∀x ∈ Z ∃y ∈ Z circuit(x, y) ∧ ∀y ∈ Z ∃!x x ∈ Z ∧ circuit(x, y) where ∃!x Π(x) is a shortcut for ∃x Π(x) ∧ ∀x, x x = x ∨ ¬Π(x) ∨ ¬Π(x ) . The rest of the proof proceeds by combining the previous formulas with the ideas in the proof of Lemma 5.1. (Considering matroid P as a minor of M , we use the predicate mdep from that proof to express circuit in the above formula.) We leave technical details to the reader. 2 Since the proof of Theorem 7.1 is very specific to binary matroids, we doubt that it could be extended to all matroids. Thus we ask: Problem 7.2. Is the property of being a transversal matroid MSO-definable?
Acknowledgement I would like to thank Prof. Geoff Whittle from Victoria University for introducing me to the beauties of structural matroid theory, and to Prof. Rod Downey for pointing my research towards parametrized complexity of matroid problems. Moreover, I am grateful to the NZ Marsden Fund and the Victoria University of Wellington for supporting my stay in New Zealand.
References 1. H.L. Bodlaender, A Linear Time Algorithm for Finding Tree-Decompositions of Small Treewidth, SIAM J. Computing 25 (1996), 1305–1317. 2. B. Courcelle, The Monadic Second-Order Logic of Graphs I. Recognizable sets of Finite Graphs, Information and Computation 85 (1990), 12–75. 3. J. de Sousa, D.J.A. Welsh, A Characterisation of Binary Transversal Matroids, J. Math. Anal. Appl. 40 (1972), 55–59.
On Matroid Properties Definable in the MSO Logic
479
4. R.G. Downey, M.R. Fellows, Parametrized Complexity, Springer-Verlag, 1999. 5. J.F. Geelen, A.H.M. Gerards, N. Robertson, G.P. Whittle, On the Excluded Minors for the Matroids of Branch-Width k, J. Combin. Theory Ser. B, to appear (2003). 6. J.F. Geelen, A.H.M. Gerards, G.P. Whittle, Branch-Width and Well-QuasiOrdering in Matroids and Graphs, J. Combin. Theory Ser. B 84 (2002), 270–290. 7. P. Hlinˇen´ y, Branch-Width, Parse Trees, and Monadic Second-Order Logic for Matroids (Extended Abstract), In: STACS 2003, Lecture Notes in Computer Science 2607, Springer Verlag (2003), 319–330. 8. P. Hlinˇen´ y, Branch-Width, Parse Trees, and Monadic Second-Order Logic for Matroids, submitted, 2002. 9. P. Hlinˇen´ y, A Parametrized Algorithm for Matroid Branch-Width, submitted, 2002. 10. P. Hlinˇen´ y, The Tutte Polynomial for Matroids of Bounded Branch-Width, submitted, 2002. 11. P. Hlinˇen´ y, It is Hard to Recognize Free Spikes, submitted, 2002. 12. J.G. Oxley, Matroid Theory, Oxford University Press, 1992,1997. 13. N. Robertson, P.D. Seymour, Graph Minors X. Obstructions to Tree-Decomposition, J. Combin. Theory Ser. B 52 (1991), 153–190.
Characterizations of Catalytic Membrane Computing Systems (Extended Abstract) Oscar H. Ibarra1 , Zhe Dang2 , Omer Egecioglu1 , and Gaurav Saxena1 1
2
Department of Computer Science University of California Santa Barbara, CA 93106, USA [email protected] Fax: 805-893-8553 School of Electrical Engineering and Computer Science Washington State University Pullman, WA 99164, USA
Abstract. We look at 1-region membrane computing systems which only use rules of the form Ca → Cv, where C is a catalyst, a is a noncatalyst, and v is a (possibly null) string of noncatalysts. There are no rules of the form a → v. Thus, we can think of these systems as “purely” catalytic. We consider two types: (1) when the initial configuration contains only one catalyst, and (2) when the initial configuration contains multiple (not necessarily distinct) catalysts. We show that systems of the first type are equivalent to communication-free Petri nets, which are also equivalent to commutative context-free grammars. They define precisely the semilinear sets. This partially answers an open question in [19]. Systems of the second type define exactly the recursively enumerable sets of tuples (i.e., Turing machine computable). We also study an extended model where the rules are of the form q : (p, Ca → Cv) (where q and p are states), i.e., the application of the rules is guided by a finite-state control. For this generalized model, type (1) as well as type (2) with some restriction correspond to vector addition systems. Keywords: membrane computing, catalytic system, semilinear set, vector addition system, reachability problem.
1
Introduction
In recent years, there has been a burst of research in the area of membrane computing [16], which identifies an unconventional computing model (namely a P system) from natural phenomena of cell evolutions and chemical reactions [2]. Due to the built-in nature of maximal parallelism inherent in the model, P systems have a great potential for implementing massively concurrent systems in an efficient way, once future biotechnology (or silicon-technology) gives way to a practical bio-realization (or a chiprealization). In this sense, it is important to study the computing power of the model.
This research was supported in part by NSF Grants IIS-0101134 and CCR02-08595.
B. Rovan and P. Vojt´asˇ (Eds.): MFCS 2003, LNCS 2747, pp. 480–489, 2003. c Springer-Verlag Berlin Heidelberg 2003
Characterizations of Catalytic Membrane Computing Systems
481
Two fundamental questions one can ask of any computing device (such as a Turing machine) are: (1) What kinds of restrictions/variations can be placed on the device without reducing its computing power? (2) What kinds of restrictions/variations can be placed on the device which will reduce its computing power? For Turing machines, the answer to (1) is that Turing machines (as well as variations like multitape, nondeterministic, etc.) accept exactly the recursively enumerable (r.e.) languages. For (2), there is a wide spectrum of well-known results concerning various sub-Turing computing models that have been introduced during the past half century – to list a few, there are finite automata, pushdown automata, linearly bounded automata, various restricted counter automata, etc. Undoubtedly, these sub-Turing models have enhanced our understanding of the computing power of Turing machines and have provided important insights into the analysis and complexity of many problems in various areas of computer science. We believe that studying the computing power of P systems would lend itself to the discovery of new results if a similar methodology is followed. Indeed, much research work has shown that P systems and their many variants are universal (i.e., equivalent to Turing machines) [4,16,17,3,6,8,19] (surveys are found in [12,18]). However, there is little work in addressing the sub-Turing computing power of restricted P systems. To this end, we present some new results in this paper, specifically focusing on catalytic P systems. A P system S consists of a finite number of membranes, each of which contains a multiset of objects (symbols). The membranes are organized as a Venn diagram or a tree structure where one membrane may contain 0 or many membranes. The dynamics of S is governed by a set of rules associated with each membrane. Each rule specifies how objects evolve and move into neighboring membranes. The rule set can also be associated with priority: a lower priority rule does not apply if one with a higher priority is applicable. A precise definition of S can be found in [16]. Since, from a recent result in [19], P systems with one membrane (i.e., 1-region P systems) and without priority are already able to simulate two counter machines and hence universal [14], for the purposes of this paper, we focus on catalytic 1-region P Systems, or simply catalytic systems (CS’s) [16,19]. A CS S operates on two types of symbols: catalytic symbols called catalysts (denoted by capital letters C, D, etc) and noncatalytic symbols called noncatalysts (denoted by lower case letters a, b, c, d, etc). An evolution rule in S is of the form Ca → Cv, where C is a catalyst, a is a noncatalyst, and v is a (possibly null) string (an obvious representation of a multiset) of noncatalysts. A CS S is specified by a finite set of rules together with an initial multiset (configuration) w0 , which is a string of catalysts and noncatalysts. As with the standard semantics of P systems [16], each evolution step of S is a result of applying all the rules in S in a maximally parallel manner. More precisely, starting from the initial configuration w0 , the system goes through a sequence of configurations, where each configuration is derived from the directly preceding configuration in one step by the application of a subset of rules, which are chosen nondeterministically. Note that a rule Ca → Cv is applicable if there is a C and an a in the preceding configuration. The result of applying this rule is the replacement of a by v. If there is another occurrence of C and another occurrence of a, then the same rule or another rule with Ca on the left hand side can be applied. We require that the chosen subset of rules to apply must be
482
Oscar H. Ibarra et al.
maximally parallel in the sense that no other applicable rule can be added to the subset. Configuration w is reachable if it appears in some execution sequence. w is halting if none of the rules is applicable. The set of all reachable configurations is denoted by R(S). The set of all halting reachable configurations (which is a subset of R(S)) is denoted by Rh (S). We show that CS’s, whose initial configuration contains only one catalyst, are equivalent to communication-free Petri nets, which are also equivalent to commutative context free grammars [5,11]. They define precisely the semilinear sets. Hence R(S) and Rh (S) are semilinear. This partially answers an open problem in [19], where it was shown that when the initial configuration contains six catalysts, S is universal, and [19] raised the question of what is the optimal number of catalysts for universality. Our result shows that one catalyst is not enough. We also study an extended model where the rules are of the form q : (p, Ca → Cv) (where q and p are states), i.e., the application of the rules is guided by a finite-state control. For this generalized model, systems with one catalyst in its initial configuration as well as systems with multiple catalysts in its initial configuration but with some restriction correspond to vector addition systems. We conclude this section by recalling the definitions of semilinear sets and Parikh maps [15]. Let N be the set of nonnegative integers and k be a positive integer. A set S ⊆ Nk is a linear set if there exist vectors v0 , v1 , . . . , vt in Nk such that S = {v | v = v0 + a1 v1 + . . . + at vt , ai ∈ N}. The vectors v0 (referred to as the constant vector) and v1 , v2 , . . . , vt (referred to as the periods) are called the generators of the linear set S. A set S ⊆ Nk is semilinear if it is a finite union of linear sets. The empty set is a trivial (semi)linear set, where the set of generators is empty. Every finite subset of Nk is semilinear – it is a finite union of linear sets whose generators are constant vectors. Clearly, semilinear sets are closed under union and projection. It is also known that semilinear sets are closed under intersection and complementation. Let Σ = {a1 , a2 , . . . , an } be an alphabet. For each string w in Σ ∗ , define the Parikh map of w to be ψ(w) = (|w|a1 , |w|a2 , . . . , |w|an ), where |w|ai is the number of occurrences of ai in w. For a language (set of strings) L ⊆ Σ ∗ , the Parikh map of L is ψ(L) = {ψ(w) | w ∈ L}.
2
1-Region Catalytic Systems
In this section, we study 1-region membrane computing systems which use only rules of the form Ca → Cv, where C is a catalyst, a is a noncatalyst, and v is a (possibly null) string of noncatalysts. Note that we do not allow rules of the form a → v as in a P System. Thus, we could think of these systems as “purely” catalytic. As defined earlier, we denote such a system by CS. Let S be a CS and w be an initial configuration (string) representing a multiset of catalysts and noncatalysts. A configuration x is a reachable configuration if S can reach x starting from the initial configuration w. Call x a halting configuration if no rule is applicable on x. Unless otherwise specified, “reachable configuration” will mean any reachable configuration, halting or not. Note that a non-halting reachable configuration x is an intermediate configuration in a possibly infinite computation. We denote by R(S)
Characterizations of Catalytic Membrane Computing Systems
483
the set of Parikh maps of reachable configurations with respect to noncatalysts only. Since catalysts do not change in a computation, we do not include them in the Parikh map. Also, for convenience, when we talk about configurations, we sometimes do not include the catalysts. R(S) is called the reachability set of R. Rh (S) will denote the set of all halting reachable configurations. 2.1 The Initial Configuration Has Only One Catalyst In this subsection, we assume that the initial configuration of the CS has only one catalyst C. A noncatalyst a is evolutionary if there is a rule in the system of the form Ca → Cv; otherwise, a is non-evolutionary. Call a CS simple if each rule Ca → Cv has at most one evolutionary noncatalyst in v. Our first result shows that semilinear sets and simple CS’s are intimately related. Theorem 1. 1. Let Q ⊆ Nk . If Q is semilinear, then there is a simple CS S such that Q is definable by S, i.e., Q is the projection of Rh (S) on k coordinates. 2. Let S be a simple CS. Then Rh (S) and R(S) are semilinear. Later, in Section 4, we will see that, in fact, the above theorem holds for any CS whose initial configuration has only one catalyst. Suppose that we extend the model of a CS so that the rules are now of the form q : (p, Ca → Cv), i.e., the application of the rules is guided by a finite-state control. The rule means that if the system is in state q, application of Ca → Cv will land the system in state p. We call this system a CS with states or CSS. In addition, we allow the rules to be prioritized, i.e., there is a partial order on the rules: A rule r of lower priority than r cannot be applied if r is applicable. We refer to such a system as a CSSP. For both systems, the computation starts at (q0 , w), where q0 is a designated start state, and w is the initial configuration consisting of catalyst C and noncatalysts. In Section 4, we will see that a CSS can define only a recursive set of tuples. In contrast, the following result shows that a CSSP can simulate a Turing machine. Theorem 2. Let S be a CSSP with one catalyst and two noncatalysts. Then S can simulate a Turing machine. Directly from Theorem 2, we have: Corollary 1. Let S be a CSSP with one catalyst and two noncatalysts. Then R(S) ⊆ N2 need not be a semilinear set. We will see later that in contrast to the above result, when the rules are not prioritized, i.e., we have a CSS S with one catalyst and two noncatalysts, R(S) is semilinear. 2.2 The Initial Configuration Has Multiple Catalysts In this subsection, we assume that initial configuration of the CS can have multiple catalysts.
484
Oscar H. Ibarra et al.
In general, we say that a noncatalyst is k-bounded if it appears at most k times in any reachable configuration. It is bounded if it is k-bounded for some k. Consider a CSSP whose initial configuration has multiple catalysts. Assume that except for one noncatalyst, all other noncatalysts are bounded or make at most r (for some fixed r) alternations between nondecreasing and nonincreasing multiplicity in any computation. Call this a reversal-bounded CSSP. Corollary 2. If S is a reversal-bounded CSSP, then Rh (S) and R(S) are semilinear. Without the reversal-bounded restriction, a CSSP can simulate a TM. In fact, a CS (with multiple catalysts in its initial configuration) can simulate a TM. It was shown in [19] that a CS augmented with noncooperating rules of the form a → v, where a is a noncatalyst and v is a (possibly null) string of noncatalysts is universal in the sense that such an augmented system with 6 catalysts can define any recursively enumerable set of tuples. A close analysis of the proof in [19] shows that all the rules can be made purely catalytic (i.e., of the form Ca → Cv) using at most 8 catalysts. Actually, this number 8 can be improved further using the newest results in [7]: Corollary 3. A CS with 7 catalysts can define any recursively enumerable set of tuples. There is another restriction on a CSSP S that makes it define only a semilinear set. Let T be a sequence of configurations corresponding to some computation of S starting from a given initial configuration w (which contains multiple catalysts). A noncatalyst a is positive on T if the following holds: if a occurs in the initial configuration or does not occur in the initial configuration but later appears as a result of some catalytic rule, then the number of occurrences (multiplicity) of a in any configuration after the first time it appears is at least 1. (There is no bound on the number of times the number of a’s alternate between nondecreasing and nonincreasing, as long there is at least 1.) We say that a is negative on T if it is not positive on T , i.e., the number of occurrences of a in configurations in T can be zero. Any sequence T of configurations for which every noncatalyst is bounded or is positive is called a positive computation. Corollary 4. Any semilinear set is definable by a CSSP where every computation path is positive. Conversely, we have, Corollary 5. Let S be a CSSP. Suppose that every computation path of S is positive. Then Rh (S) and R(S) are semilinear. The previous corollary can further be strengthened. Corollary 6. Let S be a CSSP. Suppose we allow one (and only one) noncatalyst, say a, to be negative. This means that a configuration with a positive occurrence (multiplicity) of a can lead to a configuration with no occurrence of a. Suppose that every computation path of S is positive, except for a. Then Rh (S) and R(S) are semilinear.
Characterizations of Catalytic Membrane Computing Systems
3
485
Characterizations in Terms of Vector Addition Systems
An n-dimensional vector addition system (VAS) is a pair G = x, W , where x ∈ Nn is called the start point (or start vector) and W is a finite set of vectors in Zn , where Z is the set of all integers (positive, negative, zero). The reachability set of the VAS x, W is the set R(G) = {z | for some j, z = x + v1 + ... + vj , where, for all 1 ≤ i ≤ j, each vi ∈ W and x + v1 + ... + vi ≥ 0}. The halting reachability set Rh (G) = {z | z ∈ R(G), z + v ≥ 0 for every v in W }. An n-dimensional vector addition system with states (VASS) is a VAS x, W together with a finite set T of transitions of the form p → (q, v), where q and p are states and v is in W . The meaning is that such a transition can be applied at point y in state p and yields the point y + v in state q, provided that y + v ≥ 0. The VASS is specified by G = x, T, p0 , where p0 is the starting state. The reachability problem for a VASS (respectively, VAS) G is to determine, given a vector y, whether y is in R(G). The equivalence problem is to determine given two VASS (respectively, VAS) G and G , whether R(G) = R(G ). Similarly, one can define the reachability problem and equivalence problem for halting configurations. We summarize the following known results concerningVAS andVASS [20,9,1,10,13]: Theorem 3. 1. Let G be an n-dimensional VASS. We can effectively construct an (n + 3)-dimensional VAS G that simulates G. 2. If G is a 2-dimensional VASS G, then R(G) is an effectively computable semilinear set. 3. There is a 3-dimensional VASS G such that R(G) is not semilinear. 4. If G is a 5-dimensional VAS G, then R(G) is an effectively computable semilinear set. 5. There is a 6-dimensional VAS G such that R(G) is not semilinear. 6. The reachability problem for VASS (and hence also for VAS) is decidable. 7. The equivalence problem for VAS (and hence also for VASS) is undecidable. Clearly, it follows from part 6 of the theorem above that the halting reachability problem for VASS (respectively, VAS) is decidable. 3.1 The Initial Configuration Has Only One Catalyst We first consider CSS (i.e., CS with states) whose initial configuration has only one catalyst. There is an example of a 3-dimensional VASS G in [10] such that R(G) is not semilinear: G =< x, T, p >, where x = (0, 0, 1), and the transitions in T are: p → (p, (0, 1, −1)) p → (q, (0, 0, 0)) q → (q, (0, −1, 2)) q → (p, (1, 0, 0)) Thus, there are only two states p and q. The following was shown in [10]: 1. (x1 , x2 , x3 ) is reachable in state p if and only if 0 < x2 + x3 ≤ 2x1 . 2. (x1 , x2 , x3 ) is reachable in state q if and only if 0 < 2x2 + x3 ≤ 2x1 +1 . Hence R(G) is not semilinear. From this example, we can show: Corollary 7. There is CSS S with 1 catalyst, 3 noncatalysts, and two states such that R(S) is not semilinear.
486
Oscar H. Ibarra et al.
In fact, as shown below, each CSS corresponds to a VASS and vice versa. Lemma 1. 1. Let S be a CSS. We can effectively construct a VASS G such that R(G) = R(S). 2. Every VASS can be simulated by a CSS. From Theorem 3 part 6, we have: Corollary 8. The reachability problem for CSS is decidable. Clearly a reachable configuration is halting if no rule is applicable on the configuration. It follows from the above result that the halting reachability problem (i.e., determining if a configuration is in Rh (S)) is also decidable. A VASS is communication-free if for each transition q → (p, (j1 , ..., jk )) in the VASS, at most one ji is negative, and if negative its value is −1. From Lemma 1 and the observation that the VASS constructed for the proof of Lemma 1 can be made communication-free, we have: Theorem 4. The following systems are equivalent in the sense that each system can simulate the others: CSS, VASS, communication-free VASS. Now consider a communication-free VASS without states, i.e., a VAS where in every transition, at most one component is negative, and if negative, its value is -1. Call this a communication-free VAS. Communication-free VAS’s are equivalent to communicationfree Petri nets, which are also equivalent to commutative context-free grammars [5,11]. It is known that they have effectively computable semilinear reachability sets [5]. It turns out that communication-free VAS’s characterize CS’s. Theorem 5. Every communication-free VAS G can be simulated by a CS, and vice versa. Corollary 9. If S is a CS, then R(S) and Rh (S) are effectively computable semilinear sets. The following is obvious, as we can easily construct a VAS from the specification of the linear set. Corollary 10. If Q is a linear set, then we can effectively construct a communicationfree VAS G such that R(G) = Q. Hence, every semilinear set is a union of the reachability sets of communication-free VAS’s. From the NP-completeness of the reachability problem for communication-free Petri nets (which are equivalent to commutative context-free grammars) [11,5], we have: Corollary 11. The reachability problem for CS is NP-complete. We have already seen that a CSS S with prioritized rules (CSSP) and with two noncatalysts can simulate a TM (Theorem 2); hence R(S) need not be semilinear. Interestingly, if we drop the requirement that the rules are prioritized, such a system has a semilinear reachable set. Corollary 12. Let S be a CSS with two noncatalysts. Then R(S) and Rh (S) are effectively computable semilinear sets. Open Problem: Suppose S has only rules of the form Ca → Cv whose initial configuration has exactly one catalyst. Suppose the rules are prioritized. How is R(S) related to VASS?
Characterizations of Catalytic Membrane Computing Systems
487
3.2 The Initial Configuration Has Multiple Catalysts We have seen that a CS with multiple catalysts can simulate a TM. Consider the following restricted version: Instead of “maximal parallelism” in the application of the rules at each step of the computation, we only allow “limited parallelism” by organizing the rules to apply in one step to be in the following form (called a matrix rule): (D1 b1 → D1 v1 , ..., Ds bs → Ds vs ) where the Di ’s are catalysts (need not be distinct), the bi ’s are noncatalysts (need not be distinct), the vi ’s are strings of noncatalysts (need not be distinct), and s is the degree of the matrix. The matrix rules in a given system may have different degrees. The meaning of a matrix rule is that it is applicable if and only if each component of the matrix is applicable. The system halts if no matrix rule is applicable. Call this system a matrix CS, or MCS for short. We shall also consider MCS with states (called MCSS), where now the matrix rules have states and are of the form: p : (q, (D1 b1 → D1 v1 , ..., Ds bs → Ds vs )) Now the matrix is applicable if the system is in state p and all the matrix components are applicable. After the application of the matrix, the system enters state q. Lemma 2. Given a VAS (VASS) G, we can effectively construct an MCS (MCSS) S such that R(S) = R(G) × {1}. Lemma 3. Given an MCSS S over n noncatalysts, we can effectively construct an (n + 1)-dimensional VASS G such that R(S) = projn (R(G) ∩ (Nn × {1})). The VASS in Lemma 3 can be converted to a VAS. It was shown in [10] that if G is an n-dimensional VASS with states q1 , ..., qk , then we can construct an (n+3)-dimensional VAS G with the following property: If the VASS G is at (i1 , ..., in ) in state qj , then the VAS G will be at (i1 , ..., in , aj , bj , 0), where aj = j for j = 1 to k, bk = k + 1 and bj = bj+1 + k + 1 for j = 1 to k − 1. The last three coordinates keep track of the state changes, and G has additional transitions for updating these coordinates. However, these additional transitions only modify the last three coordinates. Define the finite set of tuples Fk = {(j, (k − j + 1)(k + 1)) | j = 1, ..., k} (note that k is the number of states of G). Then we have: Corollary 13. Given an MCSS S over n noncatalysts, we can effectively construct an (n+4)-dimensional VAS G such that R(S) = projn (R(G )∩(Nn ×{1}×Fk ×{0})), for some effectively computable k (which depends only on the number of states and number of rules in G). From Theorem 4, Lemmas 2 and 3, and the above corollary, we have: Theorem 6. The following systems are equivalent in the sense that each system can simulate the others: CSS, MCS, MCSS, VAS, VASS, communication-free VASS. Corollary 14. It is decidable to determine, given an MCSS S and a configuration α, whether α is a reachable configuration (halting or not).
488
Oscar H. Ibarra et al.
Corollary 15. It is decidable to determine, given an MCSS S and a configuration α, whether α is a halting reachable configuration. From Lemma 2 and Theorem 3 part 7, we have: Corollary 16. The equivalence and containment problems for MCSS are undecidable.
4
Closure Properties
Let S be a catalytic system of any type introduced in the previous sections. For the purposes of investigating closure properties, we will say that S defines a set Q ⊆ Nk (or Q is definable by S) if Rh (S) = Q × {0}r for some given r. Thus, the last r coordinates of the (k + r)-tuples in Rh (S) are zero, and the first k-components are exactly the tuples in Q. Fixed the noncatalysts to be a1 , a2 , a3 , .... Thus, any system S has noncatalysts a1 , ..., at for some t. We say that a class of catalytic systems of a given type is closed under: 1. Intersection if given two systems S1 and S2 , which define sets Q1 ⊆ Nk and Q2 ⊆ Nk , respectively, there exists a system S which defines Q = Q1 ∩ Q2 . 2. Union if given two systems S1 and S2 , which define sets Q1 ⊆ Nk and Q2 ⊆ Nk , respectively, there exists a system S which defines Q = Q1 ∪ Q2 3. Complementation if given a system S which defines a set Q ⊆ Nk , there exists a system S which defines Q = Nk − Q. 4. Concatenation if given two systems S1 and S2 , which define sets Q1 ⊆ Nk and Q2 ⊆ Nk , respectively, there exists a system S which defines Q = Q1 Q2 , where Q1 Q2 = {(i1 + j1 , ..., ik + jk ) | (i1 , ..., ik ) ∈ Q1 , (j1 , ..., jk ) ∈ Q2 }. 5. Kleene + if given a system S which defines a set Q ⊆ Nk , there exists a system S which defines Q = n≥1 Qn . 6. Kleene * if given a system S which defines a set Q ⊆ Nk , there exists a system S which defines Q = n≥0 Qn . Other unary and binary operations can be defined similarly. Theorem 7. The class CS with only one catalyst in the initial configuration is closed under intersection, union, complementation, concatenation, and Kleene+ (or Kleene∗ ). Investigation of closure properties of other types of catalytic systems is a subject for future research.
Acknowledgment We would like to thank Dung Huynh and Hsu-Chun Yen for their comments and for pointing out some of the references concerning vector addition systems. We also appreciate the comments and encouragement of Gheorghe Paun and Petr Sosik on this work.
Characterizations of Catalytic Membrane Computing Systems
489
References 1. H. G. Baker. Rabin’s proof of the undecidability of the reachability set inclusion problem for vector addition systems. In C.S.C. Memo 79, Project MAC, MIT, 1973. 2. G. Berry and G. Boudol. The chemical abstract machine. In POPL’90, pages 81–94. ACM Press, 1990. 3. P. Bottoni, C. Martin-Vide, Gh. Paun, and G. Rozenberg. Membrane systems with promoters/inhibitors. Acta Informatica, 38(10):695–720, 2002. 4. J. Dassow and Gh. Paun. On the power of membrane computing. Journal of Universal Computer Science, 5(2):33–49, 1999. 5. J. Esparza. Petri nets, commutative context-free grammars, and basic parallel processes. In FCT’95, volume 965 of LNCS, pages 221–232. Springer, 1995. 6. R. Freund and M. Oswald. P Systems with activated/prohibited membrane channels. In WMC-CdeA’02, volume 2597 of LNCS, pages 261–269. Springer, 2003. 7. R. Freund, M. Oswald, and P. Sosik. Reducing the number of catalysts needed in computationally universal P systems without priorities. In the 5th Descriptional Complexity of Formal Systems Workshop (DFCS), July 12-14, 2003, Budapest, Hungary. 8. P. Frisco and H. Jan Hoogeboom. Simulating counter automata by P Systems with symport/antiport. In WMC-CdeA’02, volume 2597 of LNCS, pages 288–301. Springer, 2003. 9. M. H. Hack. The equality problem for vector addition systems is undecidable. In C.S.C. Memo 121, Project MAC, MIT, 1975. 10. J. Hopcroft and J.-J. Pansiot. On the reachability problem for 5-dimensional vector addition systems. TCS, 8(2):135–159, 1979. 11. D.T. Huynh. Commutative grammars: The complexity of uniform word problems. Information and Control, 57:21–39, 1983. 12. C. Martin-Vide and Gh. Paun. Computing with membranes (P Systems): Universality results. In MCU, volume 2055 of LNCS, pages 82–101. Springer, 2001. 13. E. Mayr. Persistence of vector replacement systems is decidable. Acta Informatica, 15:309– 318, 1981. 14. M. Minsky. Recursive unsolvability of Post’s problem of Tag and other topics in the theory of Turing machines. Ann. of Math., 74:437–455, 1961. 15. R. Parikh. On context-free languages. Journal of the ACM, 13:570–581, 1966. 16. Gh. Paun. Computing with membranes. JCSS, 61(1):108–143, 2000. 17. Gh. Paun. Computing with membranes (P Systems): A variant. International Journal of Foundations of Computer Science, 11(1):167–181, 2000. 18. Gh. Paun and G. Rozenberg. A guide to membrane computing. TCS, 287(1):73–100, 2002. 19. P. Sosik and R. Freund. P Systems without priorities are computationally universal. In WMC-CdeA’02, volume 2597 of LNCS, pages 400–409. Springer, 2003. 20. J. van Leeuwen. A partial solution to the reachability problem for vector addition systems. In STOC’74, pages 303–309.
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets in Undirected Graphs Toshimasa Ishii and Masayuki Hagiwara Department of Information and Computer Sciences Toyohashi University of Technology Aichi 441-8580, Japan {ishii,masa}@algo.ics.tut.ac.jp
Abstract. Given an undirected multigraph G = (V, E), a family W of sets W ⊆ V of vertices (areas), and a requirement function rW : W → Z + (where Z + is the set of positive integers), we consider the problem of augmenting G by the smallest number of new edges so that the resulting graph has at least rW (W ) edge-disjoint paths between v and W for every pair of a vertex v ∈ V and an area W ∈ W. So far this problem was shown to be NP-hard in the uniform case of rW (W ) = 1 for each W ∈ W, and polynomially solvable in the uniform case of rW (W ) = r ≥ 2 for each W ∈ W. In this paper, we show that the problem can be solved in O(m+ pr∗ n5 log (n/r∗ )) time, even in the general case of rW (W ) ≥ 3 for each W ∈ W, where n = |V |, m = |{{u, v}|(u, v) ∈ E}|, p = |W|, and r∗ = max{rW (W ) | W ∈ W}. Moreover, we give an approximation algorithm which finds a solution with at most one surplus edges over the optimal value in the same time complexity in the general case of rW (W ) ≥ 2 for each W ∈ W.
1
Introduction
In a communication network, graph connectivity is a fundamental measure of its robustness. The problem of achieving a high connectivity between every (or specified) two vertices has been extensively studied as the network design problem and so on (see [2,12] for surveys). Most of all those researches have dealt with connectivity between two vertices in a graph. However, in many real-wold networks, the connectivity between every two vertices is not necessarily required. For example, in a multimedia network, for a set W of vertices offering certain service i, such as mirror servers, a user at a vertex v can use service i by communicating with one vertex w ∈ W through a path between w and v. In such networks, it is desirable that the network has some pairwise disjoint paths from the vertex v to at least one of vertices in W . This means that the measure of reliability is the connectivity between a vertex and a set of vertices rather than that between two vertices. From this point of view, H. Ito et al. considered the node to area connectivity (NA-connectivity, for B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 490–499, 2003. c Springer-Verlag Berlin Heidelberg 2003
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets
491
v3 v5
v4
W3
W3
v
v2
10
v1
v
11
W1
v7
W1
v9
v6
W2
W2
v8
W
(G=(V,E),
rW W1 (
(i)
)=2,
={W1,W2,W3})
rW W2 (
) =3,
rW W3 (
) = 4
W
(G=(V,E),
rW W1 (
(ii)
)=2,
={W1,W2,W3})
rW W2 (
) =3,
rW W3 (
) = 4
Fig. 1. Illustration of an instance of rW -NA-ECAP. (i) An initial graph G = (V, E) with a family W = {W1 = {v4 , v7 , v11 }, W2 = {v1 , v8 , v9 }, W3 = {v1 , v2 , v10 }} of areas, where a requirement function rW : W → Z + satisfies rW (W1 ) = 2, rW (W2 ) = 3, and rW (W3 ) = 4. (ii) An rW -NA-edge-connected graph obtained from G by adding a set of edges drawn as broken lines; there are at least rW (W ) edge-disjoint paths between every pair of a vertex v ∈ V and an area W ∈ W.
short) as a concept that represents the connectivity between vertices and sets of vertices (areas) in a graph [5,6,7]. In this paper, given a multigraph G = (V, E) with a family W of sets W of vertices (areas), and a requirement function rW : W → Z + , we consider the problem of asking to augment G by adding the smallest number of new edges so that the resulting graph has at least rW (W ) pairwise edge-disjoint paths between v and W for every pair of a vertex v ∈ V and an area W ∈ W. We call this problem rW -NA-edge-connectivity augmentation problem (for short, rW -NA-ECAP). Figure 1 gives an instance of rW -NA-ECAP with rW (W1 ) = 2, rW (W2 ) = 3, and rW (W3 ) = 4. So far r-NA-ECAP in the uniform case that rW (W ) = r holds for every area W ∈ W has been studied, and several algorithms have been developed. It was shown by H. Miwa et al. [9] that 1-NA-ECAP is NP-hard. Whereas, r-NA-ECAP is polynomially solvable in the case of r = 2 by H. Miwa et al. [9], and in the case of r ≥ 3 by T. Ishii et al. [4]. However, it was still open whether the problem with general requirements rW (W ) ≥ 2, W ∈ W is polynomially solvable or not. The above two algorithms for r-NA-ECAP are based on algorithms for solving the classical edge-connectivity augmentation problem which augments the edge-connectivity of a graph, but they are essentially different; the former one follows the method based on the minimum cut structure by T. Watanabe et al. [13], and the latter one follows the so-called ‘splitting off’ method by A. Frank [1]. In this paper, by extending the approach in [4] and establishing a min-max formula to rW -NA-ECAP, we show that rW -NA-ECAP with general requirements rW (W ) ≥ 3 for each W ∈ W can be solved in O(m+ pr∗ n5 log (n/r∗ )) time, where n = |V |, m = |{{u, v}|(u, v) ∈ E}|, p = |W|, and r∗ = max{rW (W ) | W ∈ W}. We also give an approximation algorithm for rW -NA-ECAP with general requirements rW (W ) ≥ 2, W ∈ W which delivers a solution with at most one edge over the optimal in the same time complexity. Some of the proofs will be omitted from this extended abstract.
492
2
Toshimasa Ishii and Masayuki Hagiwara
Problem Definition
Let G = (V, E) stand for an undirected graph with a set V of vertices and a set E of edges. An edge with end vertices u and v is denoted by (u, v). We denote |V | by n and |{{u, v}|(u, v) ∈ E}| by m. A singleton set {x} may be simply written as x, and “ ⊂ ” implies proper inclusion while “ ⊆ ” means “ ⊂ ” or “ = ”. In G = (V, E), its vertex set V and edge set E may be denoted by V (G) and E(G), respectively. For a subset V ⊆ V in G, G[V ] denotes the subgraph induced by V . For an edge set E with E ∩ E = ∅, we denote the augmented graph (V, E ∪ E ) by G + E . For an edge set E , we denote by V [E ] a set of all end vertices of edges in E . An area graph is defined as a graph G = (V, E) with a family W of vertex subsets W ⊆ V which are called areas (see Figure 1). We denote an area graph G with W by (G, W). In the sequel, we may denote (G, W) by G simply if no confusion arises. For two disjoint subsets X, Y ⊂ V of vertices, we denote by EG (X, Y ) the set of edges e = (x, y) such that x ∈ X and y ∈ Y , and also denote |EG (X, Y )| by dG (X, Y ). A cut is defined as a subset X of V with ∅ = X = V , and the size of a cut X is defined by dG (X, V − X), which may also be written as dG (X). Moreover, we define d(∅) = 0. For two cuts X, Y ⊂ V with X ∩ Y = ∅ in G, we denote by λG (X, Y ) the minimum size of cuts which separate X and Y , i.e., λG (X, Y ) = min{dG (S)|S ⊇ X, S ⊆ V − Y }. For two cuts X, Y ⊂ V with X ∩ Y = ∅ in G, we define λG (X, Y ) = ∞. The edge-connectivity of G, denoted by λ(G), is defined as minX⊂V,Y ⊂V λG (X, Y ). For a vertex v ∈ V and a set W ⊆ V of vertices, the node-to-area edge-connectivity (NA-edge-connectivity, for short) between v and W is defined as λG (v, W ). Note that λG (v, W ) = ∞ holds for v ∈ W . Also note that by Menger’s theorem, λG (v, W ) ≥ r holds if and only if there exist at least r edge-disjoint paths between v and W . For an area graph (G, W) and a function rW : W → Z + ∪ {0}, we say that (G, W) is rW -NA-edge-connected if λ(v, W ) ≥ rW (W ) holds for every pair of a vertex v ∈ V and an area W ∈ W. Note that the area graph (G, W) in Figure 1(ii) is rW -NA-edge-connected, where rW (W1 ) = 2, rW (W2 ) = 3, and rW (W3 ) = 4. In this paper, we consider the following problem, called rW -NA-ECAP. Problem 1. (rW -NA-edge-connectivity augmentation problem, rW -NA-ECAP) Input: An area graph (G, W) and a requirement function rW : W → Z + . Output: A set E ∗ of new edges with the minimum cardinality such that G + E ∗ is rW -NA-edge-connected.
3
Lower Bound on the Optimal Value
For an area graph (G, W) and a fixed function rW : W → Z + , let opt(G, W, rW ) denote the optimal value to rW -NA-ECAP in (G, W), i.e., the minimum size |E ∗ | of a set E ∗ of new edges such that G + E ∗ is rW -NA-edge-connected. In this section, we derive lower bounds on opt(G, W, rW ) to rW -NA-ECAP with (G, W). In the sequel, let W = {W1 , W2 , . . . , Wp }, rW (Wi ) = ri , and r1 ≤ r2 ≤ · · · ≤ rp if no confusion occurs.
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets
493
A family X = {X1 , . . . , Xt } of cuts in G is called a subpartition of V , if every two cuts Xi , Xj ∈ X satisfy Xi ∩ Xj = ∅ and ∪X∈X X ⊆ V holds. For an area graph (G, W) and an area Wi ∈ W, a cut X with X ∩ Wi = ∅ is called type (Ai ), and a cut X with X ⊇ Wi is called type (Bi ) (note that a cut X of type (Bi ) satisfies X = V by the definition of a cut). We easily see the following property. Lemma 1. An area graph (G, W) is rW -NA-edge-connected if and only if all cuts X ⊂ V of type (Ai ) or (Bi ) satisfy dG (X) ≥ ri for each area Wi ∈ W.
Let X be a cut in (G, W). If X is a cut of type (Ai ) or (Bi ) with dG (X) < ri for some area Wi ∈ W, then it is necessary to add at least ri − dG (X) edges between X and V − X. It follows since if X is of type (Ai ) (resp., type (Bi )), then the NA-edge-connectivity between a vertex in X (resp., V − X) and an area Wi ∈ W with Wi ∩ X = ∅ (resp., Wi ⊆ X) need be augmented to at least ri . Here we define αG,W,rW (X) as follows, which indicates the number of necessary edges which join two vertices form a cut X to the cut V − X (note that r1 ≤ r2 ≤ · · · ≤ rp holds). Definition 1. For each cut X of type (Aj ) or (Bj ) for some area Wj , we define iX as the maximum index i such that X is of type (Ai ) or (Bi ), and define αG,W,rW (X) = max{0, riX − dG (X)}. For any other cut X, we define
αG,W,rW (X) = 0. Lemma 2. For each cut X, it is necessary to add at least αG,W,rW (X) edges between X and V − X.
Let
α(G, W, rW ) = max αG,W,rW (X) , X
(1)
X∈X
where the maximization is taken over all subpartitions of V . Then any feasible solution to rW -NA-ECAP with (G, W) must contain an edge which joins two vertices from a cut X with αG,W,rW (X) > 0 and the cut V − X. Adding one edge can contribute to at most two ‘cut deficiencies’ in a subpartition of V , and hence we see the following lemma. Lemma 3. opt(G, W, rW ) ≥ α(G, W, rW )/2 holds.
The area graph (G, W) in Figure 1(i) satisfies α(G, W, rW ) = 8. We have X∈X αG,W,rW (X) = 8 for the subpartition X = {{v1 }, {v2 }, {v4 }, {v6 , v7 , v8 }, {v9 , v11 }, {v10 }} of V . We remark that there is an area graph (G, W) with opt(G, W, rW ) > α(G, W, rW )/2. Figure 2 gives an instance for r = r1 = r2 = r3 = 2. Each cut {vi }, i = 1, 2, 4 is of type (A3 ) and satisfies r − dG (vi ) = 1 and the cut {v3 } is of type (A1 ) and satisfies r − dG (v3 ) = 1. Then we see α(G, W, rW )/2 = 2. In order to make (G, W) rW -NA-edge-connected by adding two new edges, we must add e = (v1 , v2 ) and e = (v3 , v4 ) without loss of generality. G + {e, e } is not rW -NA-edge-connected by λG+{e,e } (v1 , W3 ) = 1. We will show that all such instances can be completely characterized as follows.
494
Toshimasa Ishii and Masayuki Hagiwara
v1 W3
v3 v4
W2
W1
v2
W) Fig. 2. Illustration of an area graph (G, W) with opt(G, W, rW ) = α(G,W,r + 1, 2 where rW (Wi ) = 2 holds for i = 1, 2, 3.
Definition 2. We say that an area graph (G, W) has property (P ) ifα(G, W, rW ) is even and there is a subpartition X = {X1 , . . . , Xt } of V with X∈X αG,W,rW (X) = α(G, W, rW ) satisfying the following conditions (P 1)–(P 3): (P 1) Each cut X ∈ X is of type (Ai ) for some Wi ∈ W. (P 2) The cut X1 satisfies αG,W,rW (X1 ) = 1 and X1 ⊂ C1 for some component C1 of G with X ∩ C1 = ∅ for each = 2, 3, . . . , t. (P 3) For each = 2, 3, . . . , t, there is a cut Y of type (Bj ) with some Wj ∈ W such that we have X ∪ X1 ⊆ Y and X∈X ,X⊂Y αG,W,rW (X) ≤ (rj + 1) −dG (Y ), and that every cut X ∈ X satisfies X ⊂ Y or X ∩ Y = ∅.
Intuitively, the above condition (P3) indicates that for any feasible solution E , if the number of edges e ∈ E incident to Y is equal to X∈X ,X⊂Y αG,W,rW (X), then any edge e ∈ E must have its end vertex also in V − Y , from dG+E (Y ) ≥ rj . Note that (G, W) in Figure 2 has property (P) because α(G, W, rW ) = 4 holds and a subpartition X = {X1 = {v4 }, X2 = {v1 }, X3 = {v2 }, X4 = {v3 }} of V satisfies Y2 = C1 ∪{v1 }, Y3 = C1 ∪{v2 }, and Y4 = C1 ∪{v3 } for the component C1 of G containing v4 . Lemma 4. If (G, W) has property (P), then opt(G, W, rW ) ≥ α(G, W, rW )/2 +1 holds. Proof. Assume by contradiction that (G, W) has property (P) and there is an edge set E ∗ with |E ∗ | = α(G, W, rW )/2 such that G + E ∗ is rW -NAedge-connected (note that α(G, W, rW ) is even). Let X = {X1 , . . . , Xt } denote a subpartition of V satisfying X∈X αG,W,rW (X) = α(G, W, rW ) and the above (P1)–(P3). Since |E ∗ | = α(G, W, rW )/2 holds, each cut X ∈ X satisfies dG+E ∗ (X) = riX , and hence dG (X) = riX − dG (X) = αG,W,rW (X), where G = (V, E ∗ ). Therefore, any edge (x , x ) ∈ E ∗ satisfies x ∈ X and x ∈ X for some two cuts X , X ∈ X with = . From this, there exists a cut Xs ∈ X with s = 1 and EG (Xs , X1 ) = ∅. Since (G, W) satisfies property (P), there is a cut Ys of type (Bj ) which satisfies (P3), and hence d v∈Ys G (v) ≤ (rj +1)−dG (Ys ). Since G [Ys ] contains one edge in EG (Xs , X1 ), we have dG (Ys ) ≤ (rj − 1) − dG (Ys ), which implies that dG+E ∗ (Ys ) = dG (Ys ) + dG (Ys ) ≤ rj − 1. Hence a vertex v ∈ V − Ys satisfies λG+E ∗ (v, Wj ) ≤ rj − 1, contradicting that G + E ∗ is rW -NA-edge-connected (note that Ys is of type (Bj ) and hence we have Wj ⊆ Ys ).
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets
495
In this paper, we prove that rW -NA-ECAP enjoys the following min-max theorem and is polynomially solvable. Theorem 1. For rW -NA-ECAP with rW (W ) ≥ 3 for each area W ∈ W, opt(G, W, rW ) = α(G, W, rW )/2 holds if (G, W) does not have property (P ), and opt(G, W, rW ) = α(G, W, rW )/2 + 1 holds otherwise. Moreover, a solution E ∗ with |E ∗ | = opt(G, W, rW ) can be obtained in O(m+ prp n5 log (n/rp )) time.
Theorem 2. For rW -NA-ECAP with rW (W ) ≥ 2 for each area W ∈ W, a solution E ∗ with |E ∗ | ≤ opt(G, W, rW ) + 1 can be obtained in O(m+ prp n5 log (n/rp )) time.
4
Algorithm
Based on the lower bounds in the previous section, we give an algorithm, called rW -NAEC-AUG, which finds a feasible solution E to rW -NA-ECAP with |E | = opt(G, W, rW ), for a given area graph (G, W) and a requirement function rW : W → Z + − {1, 2}. It finds a feasible solution E with |E | = α(G, W, rW )/2 + 1 if (G, W) has property (P), |E | = α(G, W, rW )/2 otherwise. For a graph H = (V ∪ {s}, E) and a designated vertex s ∈ / V , an operation called edge-splitting (at s) is defined as deleting two edges (s, u), (s, v) ∈ E and adding one new edge (u, v). That is, the graph H = (V ∪ {s}, (E − {(s, u), (s, v)}) ∪ {(u, v)}) is obtained from such edge-splitting operation. Then we say that H is obtained from H by splitting a pair of edges (s, u) and (s, v). A sequence of splittings is complete if the resulting graph H does not have any neighbor of s. Conversely, we say that H is obtained from H by hooking up an edge (u, v) ∈ E(H − s) at s, if we construct H by replacing an edge (u, v) with two edges (s, u) and (s, v) in H. The edge-splitting operation is known to be a useful tool for solving connectivity augmentation problems [1]. An outline of our algorithm is as follows. We first add a new vertex s and the minimum number of new edges between s and an area graph (G, W) to construct an rW -NA-edge-connected graph H and convert H into an rW -NAedge-connected graph by splitting off edges incident to s and eliminating s. More precisely, we describe the algorithm below, and introduce three theorems necessary to justify the algorithm, whose proofs are omitted due to space limitation. An example of computational process of rW -NAEC-AUG is shown in Figure 3. Algorithm rW -NAEC-AUG. Input: An area graph (G = (V, E), W = {W1 , W2 , . . . , Wp }) and a requirement function rW : W → Z + − {1, 2}. Output: A set E ∗ of new edges with |E ∗ | = opt(G, W, rW ) such that G + E ∗ is rW -NA-edge-connected. Step 1: We add a new vertex s and a set F1 of new edges between s and V such that in the resulting graph H = (V ∪ {s}, E ∪ F1 ), all cuts X ⊂ V of type (Ai ) or (Bi ) satisfy dH (X) ≥ ri for each Wi ∈ W, (2)
496
Toshimasa Ishii and Masayuki Hagiwara
∪
H=(V
{s},
E
F1
∪
F1)
∪
H=(V
s
{s},
E
F1
∪
F1)
s
W3
v1 v2
W1 W2
(i)
∪
H=(V
{s},
E
F1
∪
F1)
(ii)
s
∪
H=(V
{s},
F1
E
∪
F1)
s
v3 v4
(iii)
(iv)
Fig. 3. Computational process of algorithm rW -NAEC-AUG applied to the area graph (G, W) in Figure 1 and (rW (W1 ), rW (W2 ), rW (W3 )) = (2, 3, 4). The lower bound in Section 3 is α(G, W, rW )/2 = 4. (i) H = (V ∪ {s}, E ∪ F1 ) obtained by Step 1. Edges in F1 are drawn as broken lines. Then λH (v, W ) ≥ rW (W ) holds for every pair of v ∈ V and W ∈ W. (ii) H1 = (H − {(s, v1 ), (s, v2 )}) ∪ {(v1 , v2 )} obtained from H by an admissible splitting of (s, v1 ) and (s, v2 ). (iii) H2 = (H1 − {(s, v3 ), (s, v4 )}) ∪ {(v3 , v4 )} obtained from H1 by an admissible splitting of (s, v3 ) and (s, v4 ). (iv) H3 obtained from H2 by a complete admissible splitting at s. The graph G3 = H3 − s is rW -NAedge-connected.
and no F ⊂ F1 satisfies this property (as will be shown, |F1 | = α(G, W, rW ) holds). If dH (s) is odd, then we add to F1 one extra edge between s and V . Step 2: We split two edges incident to s while preserving (2) (such splitting pair is called admissible). We continue to execute admissible edge-splittings at s until no pair of two edges incident to s is admissible. Let H2 = (V ∪ {s}, E ∪ E2 ∪ F2 ) be the resulting graph, where F2 = EH2 (s) and E2 denotes a set of split edges. If F2 = ∅ holds, then halt after outputting E ∗ := E2 . Otherwise dH2 (s) = 4 holds and the graph H2 − s has two components C1 and C2 with dH2 (s, C1 ) = 3 and dH2 (s, C2 ) = 1, where EH2 (s, C2 ) = {(s, u∗ )}. We have the following four cases (a) – (d). (a) The vertex u∗ is contained in no cut X ⊆ C2 of type (Ai ) with dH2 (X) = ri for any i. Then after replacing (s, u∗ ) with a new edge (s, v) for some vertex v ∈ C1 while preserving (2), execute a complete admissible splitting at s. Output a set E ∗ of all split edges, where |E ∗ | = α(G, W, rW )/2 holds.
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets
497
(b) E2 ∩ E(H2 [V − C1 ]) = ∅ holds. Then after hooking up one edge e ∈ E2 ∩ E(H2 [V − C1 ]), execute a complete admissible splitting at s. Output a set E ∗ of all split edges, where |E ∗ | = α(G, W, rW )/2 holds. (c) There is a set E ⊆ E2 of at most two split edges such that the graph H3 resulting from hooking up a set E of edges in H2 has an admissible pair {(s, u∗ ), f } for some f ∈ EH3 (s, V ). After a complete admissible splitting at s in H3 , output a set E ∗ of all split edges, where |E ∗ | = α(G, W, rW )/2 holds. (d) None of (a) – (c) holds. Then we can prove that (G, W) has property (P). After adding one new edge e∗ to EH2 (C1 , C2 ), execute a complete admissible splitting at s in H2 + {e∗ }. Outputting an edge set E ∗ := E3 ∪ {e∗ }, where E3 denotes a set of all split edges and |E ∗ | = α(G, W, rW )/2 + 1 holds.
To justify the algorithm rW -NAEC-AUG, it suffices to show the following three theorems. Theorem 3. Let (G = (V, E), W = {W1 , . . . , Wp }) be an area graph, and 0 ≤ / V and r1 ≤ · · · ≤ rp be integers. Let H = (V ∪ {s}, E ∪ F1 ) be a graph with s ∈ F1 = EH (s, V ) such that H satisfies (2) and no F ⊂ F1 satisfies this property. Then |F1 | = α(G, W, rW ) holds.
Theorem 4. Let (G = (V, E), W = {W1 , . . . , Wp }) be an area graph, and 2 ≤ r1 ≤ · · · ≤ rp be integers. Let H = (V ∪ {s}, E ∪ F ) with F = EH (s, V ) = ∅, s∈ / V , and an even dH (s), satisfy (2). If no pair of two edge in F is admissible, then we have dH (s) = 4 and G has two components C1 and C2 with dH (s, C1 ) = 3 and dH (s, C2 ) = 1. Moreover, in the graph H + e∗ obtained by adding one arbitrary new edge e∗ to EG (C1 , C2 ), there is a complete admissible splitting at s.
Theorem 5. Let (G, W) and H satisfy the assumption of Theorem 4, and 3 ≤ r1 ≤ · · · ≤ rp be integers. Let H ∗ be a graph obtained by a sequence of admissible splittings at s from H such that EH ∗ (s, V ) = ∅ holds and no pair of two edge in EH ∗ (s, V ) is admissible in H ∗ . Let C1 and C2 be two components in H ∗ − s with dH ∗ (s, C1 ) = 3 and dH ∗ (s, C2 ) = 1 (they exist by Theorem 4). Then if H ∗ satisfies one of the following conditions (a)–(c), then H has a complete admissible splitting at s after replacing at most one edge in EH (s, V ). Otherwise (G, W) has property (P). (a) For {(s, u∗ )} = EH ∗ (s, C2 ), u∗ is contained in no cut X ⊆ C2 of type (Ai ) with dH ∗ (X) = ri for any i. (b) E1 ∩ E(H ∗ [V − C1 ]) = ∅ holds, where E1 denotes a set of all split edges. (c) There is a set E ⊆ E1 of at most two split edges such that the graph H resulting from hooking up a set E of edges in H ∗ has an admissible pair {(s, u∗ ), f } for some f ∈ EH (s, V ).
By Theorems 4 and 5, for a set E ∗ of edges obtained by algorithm rW -NAECAUG, the graph H ∗ = (V ∪ {s}, E ∪ E ∗ ) satisfies (2), i.e., all cuts X ⊂ V of type (Ai ) or (Bi ) satisfy dH ∗ (X) ≥ ri for each area Wi ∈ W. By dH ∗ (s) = 0, all cuts X ⊂ V satisfy dG+E ∗ (X) = dH ∗ (X). By Lemma 1, this implies that G + E ∗ is rW -NA-edge-connected. By Theorems 3 and 5, we have |E ∗ | =
498
Toshimasa Ishii and Masayuki Hagiwara
α(G, W, rW )/2+1 in the cases where an initial area graph (G, W) has property (P), |E ∗ | = α(G, W, rW )/2 otherwise. By Lemmas 3 and 4, we have |E ∗ | = opt(G, W, rW ). Finally, we analyze the time complexity of algorithm rW -NAEC-AUG. By the maximum flow technique in [3], we can compute in O(mn log (n2 /m)) time λG (v, W ) for a vertex v ∈ V and an area W ∈ W. Hence it can be checked in O(mpn2 log (n2 /m)) time whether H satisfies (3) or not. In Step 1, for each vertex v ∈ V , after deleting all edges between s and v, we check whether the resulting graph H satisfies (3) or not. If (3) is violated, then we add maxx∈V,Wi ∈W {ri − λH (x, Wi )} edges between s and v in H . In Step 2, for each pair {u, v} ⊆ V , after splitting min{dH (s, u), dH (s, v)} pairs {(s, u), (s, v)}, we check whether the resulting graph H satisfies (3) or not. If (3) is violated, then we hook up 12 maxx∈V,Wi ∈W {ri −λH (x, Wi )} pairs in H . The procedures (a) – (d) can be also executed in polynomial time since the number of hooking up operations is O(n4 ). By further analysis, we can prove that hooking up split edges O(n2 ) times suffice for these procedures, but we here omit the details. Therefore, we see that algorithm rW -NAEC-AUG can be implemented to run in O(mpn4 log (n2 /m)) time. As a result, this total complexity can be reduced to O(m+ prp n5 log (n/rp )) by applying the procedure to a sparse spanning subgraph of G with O(rp n) edges, where such sparsification takes O(m + n log n) time [10,11]. Summarizing the argument given so far, Theorem 1 is now established. Notice that the assumption of r1 ≥ 3 is necessary only for Theorem 5. Therefore, even in the case of r1 = 2, we see by Theorem 4 that we can obtain a feasible solution E to rW -NA-ECAP with |E | ≤ α(G, W, rW )/2 + 1 ≤ opt(G, W, rW ) + 1. This implies Theorem 2. Actually, we remark that there are some differences between the case of r1 = 2 and the case of r1 ≥ 3. For example, a graph (G = (V ∪ {v}, E), W) obtained from the graph (G, W) in Figure 2 by adding an isolated vertex v does not have property (P), but satisfies opt(G , W, rW ) > α(G , W, rW )/2.
5
Conclusion
In this paper, given an area multigraph (G = (V, E), W) and a requirement function rW : W → Z + , we have proposed a polynomial time algorithm for rW -NA-ECAP in the case where each area W ∈ W satisfies rW (W ) ≥ 3. The time complexity of our algorithm is O(m+ pr∗ n5 log (n/r∗ )). Moreover, we have showned that in the case of rW (W ) ≥ 2, W ∈ W, a solution with at most one edge over the optimal can be found in the same time complexity. However, it is still open whether the problem in the case of rW (W ) ≥ 2, W ∈ W is polynomially solvable. We finally remark that our method in this paper cannot be applied to the problem of augmenting a given simple graph while preserving the simplicity of the graph. For such simplicity preserving problems, it was shown [8] that even the edge-connectivity augmentation problem is NP-hard.
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets
499
Acknowledgments This research is supported by a Grant-in-Aid for the 21st Century COE Program “Intelligent Human Sensing” from the Ministry of Education, Culture, Sports, Science, and Technology.
References 1. A. Frank, Augmenting graphs to meet edge-connectivity requirements, SIAM J. Discrete Math., 5(1), (1992), 25–53. 2. A. Frank, Connectivity augmentation problems in network design, in Mathematical Programming: State of the Art 1994, J.R. Birge and K.G. Murty (Eds.), The University of Michigan, Ann Arbor, MI, (1994), 34–63. 3. A. V. Goldberg and R. E. Tarjan, A new approach to the maximum flow problem, J. Assoc. Comput. Mach., 35, (1988), 921–940. 4. T. Ishii, Y. Akiyama, and H. Nagamochi, Minimum augmentation of edgeconnectivity between vertices and sets of vertices in undirected graphs, Electr. Notes Theo. Comp. Sci., vol.78, Computing Theory: The Australian Theory Symposium (CATS’03), (200 3). 5. H. Ito, Node-to-area connectivity of graphs, Transactions of the Institute of Electrical Engineers of Japan, 11C(4), (1994), 463-469. 6. H. Ito, Node-to-area connectivity of graphs, In M. Fushimi and K. Tone, editors, Proceedings of APORS94, World Scientific publishing, (1995), 89–96. 7. H. Ito and M. Yokoyama, Edge connectivity between nodes and node-subsets, Networks, 31(3), (1998), 157–164. 8. T. Jord´ an, Two NP-complete augmentation problems, Preprint no. 8, Department of Mathematics and Computer Science, Odense University, (1997). 9. H. Miwa and H. Ito, Edge augmenting problems for increasing connectivity between vertices and vertex subsets, 1999 Technical Report of IPSJ, 99-AL-66(8), (1999), 17–24. 10. H. Nagamochi and T. Ibaraki, A linear-time algorithm for finding a sparse kconnected spanning subgraph of a k-connected graph, Algorithmica, 7, (1992), 583– 596. 11. H. Nagamochi and T. Ibaraki, Computing edge-connectivity of multigraphs and capacitated graphs, SIAM J. Discrete Math., 5, (1992), 54–66. 12. H. Nagamochi and T. Ibaraki, Graph connectivity and its augmentation: applications of MA orderings, Discrete Applied Mathematics, 123(1), (2002), 447–472. 13. T. Watanabe and A. Nakamura, Edge-connectivity augmentation problems, J. Comput. System Sci., 35, (1987), 96–144.
Scheduling and Traffic Allocation for Tasks with Bounded Splittability Piotr Krysta1, Peter Sanders1 , and Berthold V¨ ocking2 1
2
Max-Planck-Institut f¨ ur Informatik Stuhlsatzenhausweg 85, Saarbr¨ ucken, Germany {krysta,sanders}@mpi-sb.mpg.de Dept. of Computer Science, Universit¨ at Dortmund Baroper Str. 301, 44221 Dortmund, Germany [email protected]
Abstract. We investigate variants of the problem of scheduling tasks on uniformly related machines to minimize the makespan. In the k-splittable scheduling problem each task can be broken into at most k ≥ 2 pieces to be assigned to different machines. In a more general SAC problem each task j has its own splittability parameter kj ≥ 2. These problems are NPhard and previous research focuses mainly on approximation algorithms. Our motivation to study these scheduling problems is traffic allocation for server farms based on a variant of the Internet Domain Name Service (DNS) that uses a stochastic splitting of request streams. We show that the traffic allocation problem with standard latency functions from Queueing Theory cannot be approximated in polynomial time within any finite factor because of the extreme behavior of these functions. Our main result is a polynomial time, exact algorithm for the k-splittable scheduling problem as well as the SAC problem with a fixed number of machines. The running time of our algorithm is exponential in the number of machines but is only linear in the number of tasks. This result is the first proof that bounded splittability reduces the complexity of scheduling as the unsplittable scheduling is known to be NP-hard already for two machines. Furthermore, since our algorithm solves the scheduling problem exactly, it also solves the traffic allocation problem.
1
Introduction
A server farm is a collection of servers delivering data to a set of clients. Large scale server farms are distributed all over the Internet and deliver various types of site content including graphics, streaming media, downloadable files, and HTML on behalf of other content providers who pay for an efficient and reliable delivery of their site data. To satisfy these requirements, one needs an advanced traffic management that takes care for the assignment of traffic streams to individual servers. Such streams can be formed, e.g., by traffic directed to the same page,
Partially supported by DFG grants Vo889/1-1, Sa933/1-1, and the IST program of the EU under contract IST-1999-14186 (ALCOM-FT).
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 500–510, 2003. c Springer-Verlag Berlin Heidelberg 2003
Scheduling and Traffic Allocation for Tasks with Bounded Splittability
501
traffic directed to pages of the same content provider, or by the traffic requested from clients in the same geographical region or domain, or also by combinations of these criteria. The objective is to distribute these streams as evenly as possible over all servers in order to ensure site availability and optimal performance. For each traffic stream there is a corresponding stream of requests sent from the clients to the server farm. Current implementations of commercial Web server farms use the Internet Domain Name Service (DNS) to direct the requests to the server that is responsible for delivering the data of the corresponding traffic stream. The DNS can answer a query such as “What is www.uni-dortmund.de?” with a short list of IP addresses rather than only a single IP address. The original idea behind returning this list is that, in case of failures, clients can redirect their requests to alternative servers. Nowadays, slightly deviating from this idea, these lists are also used for the purpose of load balancing among replicated servers (cf., e.g., [8]). When clients make a DNS query for a name mapped to a list of addresses, the server responds with the entire list of IP addresses, rotating the ordering of addresses for each reply. As clients typically send their HTTP requests to the IP address listed first, DNS rotation distributes the requests more or less evenly among all the replicated servers in the list. Suppose the request streams are formed by a sufficiently large number of clients such that it is reasonably well described by a Poisson process. Let λj denote the rate of stream j, i.e., the expected number of requests in some specified time interval. Under this assumption, rotating a list of servers corresponds to splitting stream j into substreams each of which having rate λj /. We propose a slightly more sophisticated stochastic splitting policy that allows for a better load balancing and additionally preserves the Poisson property of the request streams. Suppose, the DNS attaches a vector pj1 , . . . , pj with i pji = 1 to the list of each stream j. In this way, every individual request in stream j can be directed to the ith server on this list with probability pji . This policy breaks Poisson stream j into Poisson streams of rate pj1 λj , . . . , pj λj , respectively. The possibility to split streams into smaller substreams can obviously reduce the maximum latency. It is not obvious, however, whether it is easier or more difficult to find an optimal assignment if every stream is allowed to be broken into a bounded number of substreams. Observe that the allocation problem above is a variant of machine scheduling in which streams correspond to jobs and servers to machines. In the context of machine scheduling, bounded splittability has been investigated before with the motivation to speed up the execution of parallel programs. We will introduce first the relevant background in scheduling. Scheduling on Uniformly Related Machines. Suppose a set of jobs [n] = {1, . . . , n} need to be scheduled on a set of machines [m] = {1, . . . , m}. Jobs are described by sizes λ1 , . . . , λn ∈ >0 , and machines are described by their speeds s1 , . . . , sn ∈ >0 . In the classical, unsplittable scheduling problem on uniformly related machines, every job must be assigned to exactly one machine. This mapping can be described by an assignment matrix (xij )i∈[m],j∈[n] , where xij is an indicator variable with xij = 1 if job j is assigned to machine i and 0 otherwise. The objective is to minimize the makespan z = maxi∈[m] j∈[n] λj xij /si . It is
502
Piotr Krysta, Peter Sanders, and Berthold V¨ ocking
well known that this problem is strongly NP-hard. Hochbaum and Shmoys [5, 6] gave the first polynomial time approximation schemes (PTAS) for this problem. If the number of machines is fixed, then the problem is only weakly NP-hard and it admits a fully polynomial time approximation scheme (FPTAS) [7]. A fractional relaxation of the problem leads to splittable scheduling. In the fully splittable scheduling problem the variables xij can take arbitrary real values from [0, 1] subject to the constraints i∈[m] xij ≥ 1, for every j ∈ [n]. This problem is trivially solvable, e.g., by assigning a piece of each job to each machine whose size is proportional to the speed of the machine. k-Splittable Machine Scheduling and the SAC Problem. In the k-splittable machine scheduling problem each job can be broken into at most k ≥ 2 pieces that must be placed on different machines, i.e., at most k of the variables xij ∈ [0, 1], for every j, are allowed to be positive. Recently, Shachnai and Tamir [12] introduced a generalization of this problem, called scheduling with machine allotment constraints (SAC). In this problem, each job j has its own splittability parameter kj ≥ 1. In our study, we will mostly assume kj ≥ 2, for every j ∈ [n]. Shachnai and Tamir [12] prove that, in contrast to the fully splittable scheduling problem, the k-splittable machine scheduling problem is strongly NP-hard even on identical machines. They also give a PTAS for the SAC problem, whose running time, however, does not render practical as the splittability appears double exponentially in the running time. As a more practical result, they present a very fast maxj (1 + 1/kj )-approximation algorithm. This result suggests that, in fact, approximation should get easier when the splittability is increased. We should mention here, that there is a related scheduling problem in which preemption is allowed, that is, jobs can be split arbitrarily but pieces of the same job cannot be processed at the same time on different machines. Shachnai and Tamir study also combinations of SAC and scheduling with preemption in which jobs can be broken into a bounded number of pieces and additionally there are bounds on the number of pieces that can be executed at the same time. Further variants of scheduling with different notions of splittability with motivations from parallel computing and production planning can be found in [12] and [13]. Scheduling with Non-linear Latency Functions. The only difference between the k-splittable scheduling and the traffic allocation problems is that the latency occurring at servers may not be linear. A typical example of a latency function at a server of speed s with an incoming Poisson stream at rate λ is λ . This family of functions can be derived from the formula fs (λ) = s(s−min{s,λ}) for the waiting time on an M/M/1 queueing system. Of course, M/M/1 waiting time is only one out of many examples for latency functions that can be obtained from Queueing Theory. In fact, a typical property of such functions is that the latency goes to infinity when the injection rate approaches the service rate. Instead of focusing on particular latency functions, we will set up a more general framework to analyze the effects of non-linearity. The k-splittable traffic allocation problem is a variant of the k-splittable scheduling. Streams are described by rates λ1 , . . . , λn , and servers–by bandwidths or service rates s1 , . . . , sm . Hence, traffic streams can be identified with jobs and servers with machines.
Scheduling and Traffic Allocation for Tasks with Bounded Splittability
503
The latencies occurring at the servers are described by a family of latency functions F = {fs : ≥0 → ≥0 ∪{∞} | s ∈ >0 } where fs denotes a non-decreasing latency function for a server with service rate s. Scheduling under non-linear latency functions has been considered before. Alon et al. [2] give a PTAS for makespan minimization on identical machines with certain well-behaved latency functions. This was extended into a PTAS for makespan minimization on uniformly related machines by Epstein and Sgall [4]. In both studies, the latency functions must fulfill some analytical properties like convexity and uniform continuity under a logarithmic scale. Unfortunately, the uniform continuity condition excludes typical functions from Queueing Theory. Our Results. The main result of this paper is a fixed-parameter tractable algorithm for the k-splittable scheduling and the more general SAC problem with splittability at least two for every job. Our algorithm has polynomial running time for every fixed number of machines. This result is remarkable as unsplittable scheduling is known to be NP-hard already on two machines. In fact, our result is the first proof that bounded splittability reduces the complexity of scheduling. In more detail, given any upper bound T on the makespan of an optimal assignment, our algorithm computes a feasible assignment with makespan at most T in time O(n+mm+m/(k0 −1) ) with k0 = min{k1 , k2 , . . . , kn }. Furthermore, despite the possibility to split the jobs into pieces of non-rational size, we prove that the optimal makespan can be represented by a rational number with only a polynomial number of bits. Thus the optimal makespan can be found by using binary search techniques over the rationals. This yields an exact, polynomialtime algorithm for SAC with a fixed number of machines. (We have recently improved the running time in case of identical machines [1].) Note, that this problem is strongly NP-hard when the number of machines is not fixed and k0 ≥ 2 [12]. In addition, we study the effects due to the non-linearity of latency functions. The algorithm above can be adopted to work efficiently for a wide class of latency functions containing even such extreme functions as M/M/1 waiting time. On the negative side, we prove that latency functions like M/M/1 do not admit polynomial time approximation algorithms with finite approximation ratio if the number of machines is unbounded. The latter result is an ultimate rationale for our approach to devise efficient algorithms for a fixed number of machines.
2
An Exact Algorithm for SAC with Given Makespan
We present here an exact algorithm for SAC with kj ≥ 2 for every job. Our algorithm has polynomial running time for any fixed number of machines. We assume that an upper bound on the optimal makespan is given. This upper bound defines a capacity for each machine. The capacity of machine i is denoted by ci . The computed schedule has to satisfy j∈[n] λj xij ≤ ci , for every i ∈ [m]. A difficult subproblem to be solved is to decide into which pieces of which size the jobs should be cut. In principle, the number of possible cuts is unbounded. We will show that it suffices to consider only those cuts that “saturate” a machine.
504
Piotr Krysta, Peter Sanders, and Berthold V¨ ocking
Let πij = λj xij denote the size of the piece of job j allocated to machine i. Machine i is saturated by job j if πij = ci . Our algorithm (Algorithm 1) schedules the bulkiest job j first where the bulkiness of j is λj /(kj − 1). Using backtracking it tries all ways to cut one piece from job j s.t. a machine is saturated. The saturated machine is removed from the problem; the splittability and size of j is reduced accordingly. The remaining problem is solved recursively. Two special cases arise. If j is too small to saturate kj machines, all remaining jobs can be scheduled using a simple greedy approach known as McNaughton’s rule [10]. Since the splittability kj of a job is decreased whenever a piece is cut off, a remaining piece can eventually become unsplittable. Since this remaining piece will be infinitely bulky, it will be scheduled next. In this case, all machines that can accommodate the piece are tried. For the precise description see Fig. 1. I := [n] – – Machines to be saturated; Jobs to be scheduled [m]; J := λ > c ∨ ¬solve() then output “no solution possible” if j i j∈J i∈I else output nonzero πij values Function solve() : Boolean if J = ∅ then return true find a j ∈ J that maximizes λj /(kj − 1) – – Unsplittable remaining piece if kj = 1 then forall i ∈ I with ci ≥ λj do – – (*) πij := λj ; ci := ci − λj ; J := J \ {j} if solve() then return true undo changes made in line (*) else – – Job j is splittable if λj /(kj − 1) ≤ min {ci : i ∈ I} then McNaughton(); return true forall i ∈ I with ci < λj do – – (**) πij := ci ; λj := λj − ci ; kj := kj − 1; I := I \ {i} if solve() then return true undo changes made in line (**) return false Procedure McNaughton() – – Schedule greedily pick any i ∈ I foreach j ∈ J do while ci ≤ λj do πij := ci ; λj := λj − ci ; I := I \ {i}; pick any new i ∈ I πij := λj ; ci := ci − λj Fig. 1. Algorithm 1: Find a schedule of n jobs with splittabilities kj to m machines.
Theorem 1. Algorithm 1 finds a feasible solution for SAC with a given possible makespan, provided that the splittability of each job is at least two. It can be implemented to run in time O n + mm+m/(k0 −1) , where k0 = min{k1 , . . . , kn }. Proof. All the necessary data structures can be initialized in time O(m + n) if we use a representation of the piece size matrix (πij ) that only stores nonzero entries. There can be at most m recursive calls that saturate a machine and at
Scheduling and Traffic Allocation for Tasks with Bounded Splittability
505
most m/(k0 − 1) recursive calls made for unsplittable pieces that remain after a job j was split kj − 1 times. All in all, the backtrack tree considers no more than m!mm/(k0 −1) possibilities. The selection of the bulkiest job can be implemented to run in time O(log m) independent of n: Only the m largest jobs can ever be a candidate. Hence it suffices to select these jobs initially using an O(n) time algorithm [3] and keep them in a priority queue data structure. Greedy scheduling using McNaughton’s rule takes time O(n + m). Overall, we get an execution time of O n + m + m!mm/(k0 −1) log m = O n + mm+m/(k0 −1) . The algorithm also produces only correct schedules. In particular, when λj /(kj − 1) ≤ min {ci : i ∈ I} McNaughton’s rule can complete the schedule because no remaining job is large enough to saturate more than k j −1 of the remain ing machines. In particular, solve() maintains the invariant j∈J λj ≤ i∈I ci and when McNaughton’s rule is called, it can complete the schedule: Lemma 1. McNaughton’s rule computes a correct schedule if j∈J λj ≤ i∈I ci and ∀i ∈ I, j ∈ J : λj /(kj − 1) ≤ ci . Proof. The only thing that can go wrong is that a job j is split more than kj − 1 times, i.e., into ≥ kj + 1 pieces. Then, it completely fills at least kj − 1 machines with capacity at least mini∈I ci , contradicting λj /(kj −1) ≤ ci . Now we come to the interesting part of the proof. We have to show that the search succeeds if a feasible schedule exists. We show the stronger claim that the algorithm is correct even if unsplittable jobs are present. (In this case only the above running time analysis would fail.) The proof is by induction on m. For m = 1 this is trivial since no splits are necessary. Consider the case m > 1. If there are unsplittable jobs, they are infinitely bulky and so are scheduled first. Since all possible placements for them are tried, nothing can be missed for them. When a splittable job is bulkiest, only those splits are considered that saturate one machine. Lemma 2 shows that if there is a feasible schedule, there must also be one with this property. The recursive call leaves a problem with one machine less and the induction hypothesis is applicable. Lemma 2. If a feasible schedule exists and the bulkiest job is large enough to saturate a machine then there is a feasible schedule where the bulkiest job saturates a machine. Our approach to proving Lemma 2 is to show that any feasible schedule can be transformed into a feasible schedule where the bulkiest job saturates a machine. To simplify this task, we first establish a toolbox of simpler transformations. We begin with two very simple transformations that affect only two jobs and obviously maintain feasibility. See Fig. 2-(a) and 2-(b) for illustrations. Lemma 3. For any feasible schedule, consider two jobs p and q sharing machine i , i.e., πi p > 0 and πi q > 0. For any machine i such that πi q < πip there is a feasible schedule where the overlapping piece of q is moved to machine i, i.e., (πi p , πip , πi q , πiq ) := (πi p + πi q , πip − πi q , 0, πiq + πi q ).
506
Piotr Krysta, Peter Sanders, and Berthold V¨ ocking
Fig. 2. Manipulating schedules. Lines represent jobs. (Bent) boxes represent machines. (a): The move from Lemma 3; (b): The swap from Lemma 4; (c): Saturation using Lemma 5; (d): The rotation from Lemma 6; (e): Moving j away from r.
Lemma 4. For any feasible schedule, consider two jobs p and q sharing machine i, i.e., πip > 0 and πiq > 0. Furthermore, consider two other pieces πip p and πiq q of p and q. If πip p ≤ πiq + πiq q and πiq q ≤ πip + πip p then there is a feasible schedule where the pieces πip p and πiq q are swapped as follows: ( πip p , πip , πiq p , πip q , πiq , πiq q ) := ( 0, πip + πip p − πiq q , πiq p + πiq q , πip q + πip p , πiq + πiq q − πip p , 0 ) As a first application of Lemma 3 we now explain how a large job j allocated to at most kj − 1 machines can “take over” a small machine. Lemma 5. Consider a job j and machine i such that λj /(kj − 1) ≥ ci . If there is a feasible schedule where j is scheduled to at most (kj − 1) machines, then there is a feasible schedule where j saturates machine i. Proof. Let i denote a machine index that maximizes πi j and note that πi j ≥ λj /(kj −1) ≥ ci . We can now apply Lemma 3 to subsequently move all the pieces on machine i to machine i . Lemma 3 remains applicable because πi j is large enough to saturate machine i. See Fig. 2-(c) for an illustration. After the above local transformations, we come to a global transformation that greatly simplifies the kind of schedules we have to consider. Definition 1. Job j is called split if |{i : πij > 0}| > 1. The split graph corresponding to a schedule is an undirected hypergraph G = ([m], E) where each split job j corresponds to a hyperedge {i : πij > 0} ∈ E. Lemma 6. If a feasible schedule exists, then there is a feasible schedule whose split graph is a forest. Proof. It suffices to show that for a feasible schedule whose split graph G contains a cycle there is also a feasible schedule whose corresponding split graph has a smaller value of e∈E |e|. Then it follows that a feasible schedule that minimizes |e| is a forest. e∈E So suppose G contains a cycle involving edges. Let succ(j) stand for (j + 1) mod + 1. By appropriately renumbering machines and jobs we can assume
Scheduling and Traffic Allocation for Tasks with Bounded Splittability
507
without loss of generality that this cycle is made up of jobs 1 to and machines 1 to such that for j ∈ [], πjj > 0, πsucc(j)j > 0, and δ = π11 = minj∈[] min πjj , πsucc(j)j . Fig. 2-(d) depicts this normalized situation. Now we rotate the pieces in the cycle by increasing πjj by δ and decreasing πsucc(j)j by the same amount. The schedule remains feasible since the load of the machines in the cycle remains unchanged. Since the first job is now split in one piece less, e∈E |e| decreases. Now we have all the necessary tools to establish Lemma 2. Proof. Consider any feasible schedule; let j denote the bulkiest job and let there be a machine i0 with λj /(kj − 1) ≥ ci0 . We transform this schedule in several steps. We first apply Lemma 6 to obtain a schedule whose split graph is a forest. We now concentrate on the tree T where j is allocated. If job j is allocated to at most kj − 1 machines, we can saturate i0 using Lemma 5 and we are done. If one piece of j is allocated to a leaf i of T then all other jobs mapped to machine i are allocated there entirely. Let i denote another machine j is mapped to. We apply Lemma 3 to move small jobs from i to i . When this is no longer possible, either job j saturates machine i and we are done or there is a job j with λj = πij > πi j . Now we can apply Lemma 4 to pieces πij , πi j , πij , and a zero size piece of job j . This transformation reduces the number of pieces of job j so that we can saturate machine i0 using Lemma 5. Finally, j could be allocated to machines that are all interior nodes of T . We focus on the two largest pieces πij and πi j so that πij + πi j ≥ 2λj /kj . Now fix a leaf r that is connected to i via a path that does not involve j as an edge. This is possible since j is connected to interior nodes only. Now we intend to move job j away from r, i.e., we transform the schedule such that the path between node r and job j becomes longer. (The path between a node v and a job e in a tree starts at v and uses edges e = e until a node is reached that has e as an incident edge.) We do this iteratively until j is incident to a leaf in T . Then we can apply the transformations described above and we are done. We first apply Lemma 3 to move small pieces of jobs allocated to machine i to machine i. Although this changes the shape of T , it leaves the distance between jobs j and r invariant unless j ends up in machine i completely so that we can apply Lemma 5 and we are done. When Lemma 3 is no longer applicable, either j saturates machine i and we are done or there is a job q with πi q > πij . In that case we consider the smallest other piece πiq q of job q. More precisely, if q is split into at most kq − 1 nonzero pieces we pick some iq with πiq q = 0. Otherwise we pick iq = min { = i : πq > 0}. In either case πiq q ≤ λq /(kq − 1). Recall that πij + πi j ≥ 2λj /kj since this sum is invariant under the move operations we have performed. Furthermore, j is the bulkiest job so that πiq q ≤
λj 2λj 2λj λq ≤ = ≤ kq − 1 kj − 1 (kj − 1) + (kj − 1) (kj − 1) + 1 2λj = ≤ πij + πi j . kj
508
Piotr Krysta, Peter Sanders, and Berthold V¨ ocking
So, we can apply Lemma 4 to pieces i and i of job j and to pieces i and iq of job q. This increases the distance from job j to machine r as desired. Fig. 2-(e) gives an example where we apply Lemma 3 once and then Lemma 4.
3
Finding the Optimal Makespan
We assumed so far that an upper bound on the optimal makespan is known. The obvious idea now is to find the optimal makespan using binary search. In order to show that this search terminates one needs to prove that the optimal makespan is a rational number. This is not completely obvious as in principle jobs might be broken into pieces of non-rational size. The following lemma, however, shows that the optimal makespan can be represented by rational numbers of polynomial length. Let denote the set of non-negative rational numbers that can be represented by an -bit numerator and an -bit denominator and the symbol ∞. The proof of the next lemma is omitted in this extended abstract. Lemma 7. There is a constant κ > 0 s.t. the value of an optimum solution to SAC problem with kj ≥ 2 (for all j) is in N κ , where N is the problem size. By Lemma 7, the optimal makespan can be found by binary search methods over the rationals (see, e.g., [9, 11]) with Algorithm 1 as a decision oracle. Thus: Corollary 1. For every fixed number of machines, there is an exact polynomial time optimization algorithm for the SAC problem with splittability at least two.
4
Solving the Traffic Allocation Problem
In this section, we show how to apply the binary search approach to the traffic allocation problem, i.e., we solve the SAC problem with non-linear latency functions. We need to make some very modest assumptions about these functions. A latency function is monotone if it is positive and non-decreasing. The functions need not be continuous or strictly increasing, e.g., step functions are covered. For a monotone function f : ≥0 → ≥0 ∪ {∞}, let the inverse of f be defined by f −1 (y) = sup{λ|f (λ) ≤ y}, for y ≥ f (0), and f −1 (y) = 0, for y < f (0). We say that a function f is polynomially length-bounded if for every λ ∈ , f (λ) ∈ poly() . For example, the M/M/1 waiting time function is polynomially length-bounded although limλ→b− fs (λ) = ∞. This is because, for λ, s ∈ with λ < s, one can show (s − λ) ∈ 2 , s(s − λ) ∈ 4 and λ/(s(s − λ)) ∈ 8 so that f (λ) ∈ 8 . We say that a family of latency functions F is efficiently computable if, for every s, λ ∈ , fs (λ) and fs−1 (λ) can be calculated in time polynomial in . Observe that the functions from an efficiently computable family must also be polynomially length-bounded. It is easy to check that the M/M/1 waiting time family and other typical function families from Queueing Theory are efficiently computable. We obtain the following result whose proof is omitted.
Scheduling and Traffic Allocation for Tasks with Bounded Splittability
509
Theorem 2. Let F be any efficiently computable family of monotone functions. Consider the SAC problem with latency functions from F and splittability at least two. Suppose the best possible maximum latency can be represented by a number from . Then an optimal solution can be found in time O poly() · (n + mm+m/(k0 −1) ) with k0 = min{kj : j = 1, 2, . . . , n}. Note that is an obvious lower bound on the running time of any algorithm computing the exact, optimal makespan. It is unclear if there exist latency functions s.t. cannot be bounded polynomially in the input length. If an appropriate upper bound on is not known in advance, we can use the geometric search, which can be stopped after computing the optimal latency with desired precision.
5
Non-approximability for Non-linear Scheduling
The M/M/1 waiting time cost function family defined in Section 1 has an infinity pole as λ → b− . Intuitively, this pole reflects the capacity restriction on the servers and it is typical also for other families that can be derived from Queueing Theory. The following theorem, whose proof is omitted, shows that the non-linear k-splittable scheduling even with identical servers is completely inapproximable. Theorem 3. Let F be an efficiently computable family of monotone latency functions. Suppose there is s ∈ >0 s.t. limλ→s fs (λ) = ∞. Then there does not exist a polynomial time approximation algorithm with finite approximation ratio for the non-linear k-splittable scheduling problem under F , provided P = NP.
References 1. A. Agarwal, T. Agarwal, S. Chopra, A. Feldmann, N. Kammenhuber, P. Krysta and B. V¨ ocking. An Experimental Study of k-Splittable Scheduling for DNS-Based Traffic Allocation. To appear in Proc. of the 9th EUROPAR, 2003. 2. N. Alon, Y. Azar, G. J. Woeginger and T. Yadid. Approximation schemes for scheduling on parallel machines. Journal of Scheduling, 1:55–66, 1998. 3. M. Blum, R. Floyd, V. Pratt, R. Rivest, and R. Tarjan. Time bounds for selection. J. Computer and System Science, 7(4):448–461, August 1973. 4. L. Epstein and J. Sgall. Approximation schemes for scheduling on uniformly related and identical parallel machines. Proc. of the 7th ESA, 151–162, 1999. 5. D. S. Hochbaum and D.B. Shmoys. Using dual approximation algorithms for scheduling problems: theoretical and practical results. J. ACM, 34: 144–162, 1987. 6. D. S. Hochbaum and D.B. Shmoys. A polynomial approximation scheme for scheduling on uniform processors: using the dual approximation approach. SIAM Journal on Computing, 17: 539–551, 1988. 7. E. Horowitz and S. K. Sahni. Exact and approximate algorithms for scheduling nonidentical processors. J. ACM, 23:317–327, 1976. 8. J. F. Kurose and K. W. Ross. Computer networking: a top-down approach featuring the Internet. Addison-Wesley, 2001. 9. St. Kwek and K. Mehlhorn. Optimal search for rationals. Information Processing Letters, 86:23 - 26, 2003.
510
Piotr Krysta, Peter Sanders, and Berthold V¨ ocking
10. R. McNaughton. Scheduling with deadlines and loss functions. Management Science, 6:1–12, 1959. 11. C. H. Papadimitriou. Efficient search for rationals. Information Processing Letters, 8:1–4, 1979. 12. H. Shachnai and T. Tamir. Multiprocessor Scheduling with Machine Allotment and Parallelism Constraints. Algorithmica, 32(4): 651–678, 2002. 13. W. Xing and J. Zhang. Parallel machine scheduling with splitting jobs. Discrete Applied Mathematics, 103: 259–269, 2000.
Computing Average Value in Ad Hoc Networks Mirosław Kutyłowski1 and Daniel Letkiewicz2 1
2
Inst. of Mathematics, Wrocław University of Technology [email protected] Inst. of Engineering Cybernetics, Wrocław University of Technology [email protected]
Abstract. We consider a single-hop sensor network with n = Θ(N ) stations using R independent communication channels. Communication between the stations can fail at random or be scrambled by an adversary so that it cannot be distinguished from a random noise. Assume that each station Si holds an integer value Ti . The problem that we consider is to replace the values Ti by their average (rounded to integer values). A typical situation is that we have a local sensor network that needs to make a decision based on the values read by sensors by computing the average value or some kind of voting. We design a protocol that solves this problem in O(N/R · log N ) steps. The protocol is robust: a constant random fraction of messages can be lost (by communication channel failure, by action of an adversary or by synchronization problems). Also a constant fraction of stations may go down (or be destroyed by an adversary) without serious consequences for the rest. The algorithm is well suited for dynamic systems, for which the values Ti may change and the protocol once started works forever. Keywords: mobile computing, radio network, sensor network
1 Introduction Ad hoc networks that communicate via radio channels gain importance due to many new application areas: sensor networks used to monitor environment, self-organizing networks of mobile devices, mobile networks used in military and rescue operations. Ad hoc networks provide many features that are very interesting from practical point of view. They have no global control (which could be either attacked or accidentally destroyed), should work if some stations leave or join the network. So the systems based on ad hoc networks are robust (once they work). On the other side, it is quite difficult to design efficient algorithms for ad hoc networks. Classical distributed algorithms have been designed for wired environments with quite different communication features. For instance, in many cases one can assume that an hoc networks works synchronously (due to GPS signals); if the network works on a small area, then two stations may communicate directly (single-hop model) and there is no communication latency. On the other hand, stations compete for access into a limited number of radio channels. They may disturb each other making the transmission
This research was partially supported by Komitet Bada´n Naukowych grant grant 8T11C 04419.
B. Rovan and P. Vojt´asˇ (Eds.): MFCS 2003, LNCS 2747, pp. 511–520, 2003. c Springer-Verlag Berlin Heidelberg 2003
512
Mirosław Kutyłowski and Daniel Letkiewicz
unreadable, if broadcasting at the same time on the same channel. Therefore quite a different algorithmic approach is necessary. Recently, there have been a lot of research on fundamental issues for ad hoc networks (as a starting point for references see [7]). Problem Statement. In this paper we consider the following task. Each station Si of a network holds initially an integer value Ti . The goal is to compute the average value of all numbers Ti so that each station changes its Ti into the average value. We demand that the numbers held by the stations remain to be integers and their sum is not changed (so at the end, some small differences could be inevitable and the stations hold not exactly the average value but values close to it). The intuition is that Ti might be a physical value measured by a sensor or a preference of Si , expressed as an integer value (for instance 0 meaning totally against, 50 meaning undecided and 100 as a fully supporting voice). The network may have to compute the average in order to get an output of a group of sensors or to make a common decision regarding its behavior. This task, which can trivially be solved for most computing systems (for instance, by collecting data, simple arithmetic and broiadcasting the result) becomes non trivial in ad hoc networks. Computation Model. We consider networks consisting of identical stations with no ID’s (the idea is that it is unpredictable which stations appear in the network and the devices are bulk produced). However, we assume that the stations know n, the number of stations in the network, within a constant factor. This parameter is called N for the rest of the paper. (Let us remark that N can be derived by an efficient algorithm [5].) Communication between stations is accomplished through R independent communication channels labeled by numbers 0 through R−1. A station may either send a message through a chosen channel or listen to a chosen channel (but not both at the same time, according to the IEEE 802.11 standard). If more than one station is sending on the same channel, then a collision occurs and the messages on this channel are scrambled. We assume that a station listening to the channel on which there is a collision receives noise and cannot even recognize that a collision has occurred (no-collision-detection model). In this paper we consider only networks that are concentrated in a local area: we assume that if a station sends a message, then every station (except the sender) can hear it. So we talk about single-hop network. Computation of each station consists of steps. During a step a station may perform a local computation and either send or receive messages through a chosen channel. For the sake of simplicity of presentation we assume that computation is synchronous. However, our results also hold for asynchronous systems, provided that the stations work with comparable speeds and lack of synchronization may only result in failure of a constant fraction of communication rounds. We do not use any global clock available to all stations. (In fact, our algorithm can be used to agree upon a common time for other purposes.) Design Goals. We design a protocol that has to remain stable and efficient in the following sense:
Computing Average Value in Ad Hoc Networks
513
– Each station may break down or leave the network. However we assume that Ω(N ) stations remain active. – A message sent by one station is not received by a station that is listening with probability not lower than p, where p < 1 is fixed. – An adversary, who knows all details about the algorithm, may scramble communication for a constant fraction of the total communication time over all communication channels. (So no “hot spots” of communication pattern of the protocol are admissible - they would be easily attacked by an adversary). – The protocol has to be suited for dynamic systems, which once started compute the average forever. So it has to be applied in systems where the values Ti may change. (For a discussion on dynamic systems see [8].) Preferably, a solution should be periodic with the same code is executed repeatedly. – The protocol should ensure that the number of steps at which a station transmitting a message or listening is minimized. Also there should be no station that is involved in communication substantially longer than an average station. This is due to the fact that energy consumption is due mainly for radio communication and that battery opereted devices has only limited energy resources. Former Results. Computing an average value is closely related to load balancing in distributed systems. (In fact, in the later case we have not only to compare the loads but also forward some tasks.) However, the algorithms are designed for wired networks. An exception for it is a solution proposed by Gosh and Muthukrishnan [4]: they propose a simple protocol based on random matchings in the connection graph. In one round of their protocol the load is balanced between the nodes connected by an edge of a matching. This approach is very different from straightforward algorithms that try to gather information and then make decisions based on it. They provide an estimation of convergence of this algorithm to the equal load based on total characteristics of the graph (its degree and the second eigenvalue). Their proof shows decrease of a certain potential describing how much the load is unbalanced. The protocol of Gosh and Muthukrishnan has been reused for permuting at random in a distributed system [2]. However, in this case the analysis is based on a rapid-mixing property of a corresponding Markov chain and a refined path coupling approach [3]. New Results. We extend the results from [4] and adopt it to the case of a single hop ad hoc network. The issue is that in the protocol of Gosh and Muthukrishnan one needs to show not only that a certain potential decreases fast, but also that there are no “bad points” in the network that have results far from the valid ones (if potential is low, we can only guarantee that the number of bad points is small). Theorem 1. Consider an ad hoc network consisting of Θ(N ) stations using R communication channels. Let D denote the maximum difference of the form Ti − Tj at the beginning of the protocol. With high probability, i.e. probability at least 1 − N1 , after executing O(N/R · (log N + log D)) steps of the protocol: – the sum of all values Ti remains unchanged and each station keeps one value, – either all station keep the same value Ti , or these values differ by at most 1, or they differ by at most 2 and the number of stations that keep the biggest and the smallest values is bounded by ε · N for a small constant ε.
514
Mirosław Kutyłowski and Daniel Letkiewicz
2 Protocol Description The protocol repeats a single stage consisting of 3N/R steps, three consecutive steps are called a round. A stage is in fact a step of protocol of Gosh and Muthukrishnan. Description of a Stage. 1. Each station Si chooses t, t ∈ [1, . . . , N ] and a bit b uniformly at random (the choices of t, t and b are stochastically independent). 2. Station Si performs the following actions during round t/R on the channel t mod R. – If b = 0, then Si transmits Ti at step 1. Otherwise, it transmits Ti at step 2. – At step 3, station Si listens. If a message comes from another station with the Ti transmitted and an another value, say Tj , then Si changes Ti as follows: • if Ti + Tj is even, then station Si puts Ti := 12 (Ti + Tj ), • if Ti + Tj is odd, then station Si puts Ti := 12 (Ti + Tj ), if its b equals 0, and Ti := 12 (Ti + Tj ) otherwise. 3. If t = t, then during round t /R station Si uses channel t mod R: – it listens during the first two steps, – it concatenates the messages heard and sends them during the third step. The idea of the protocol is that 3N/R steps of a single stage are used as a place for N slots in which pairs of stations can balance their values. If everything works fine, then for a given channel at a given round: – during step 1 a station Su for which b = 0 sends Tu , – during step 2 a station Sv for which b = 1 sends Tv , – step 3 is used to avoid Byzantine problems [6]: another station Sw repeats Tu and Tv . Otherwise, neither Su nor Sv could be sure that its message came through. (An update of only one of the values Su or Sv would violate the condition that the sum of all values must not change.) Of course, such a situation happens only for some slots. However, standard considerations (see for instance [3]) show that the following fact: Lemma 1. With high probability, during a stage balancing does occur at step 3 for at least c · N slots, where c is a fixed constant, 0 < c < 1. Note that Lemma 1 holds also, if for a constant fraction of slots communication failure occurs or an adversary scrambles messages. Since the stations communicate at randomly chosen moments, it is difficult for an adversary to attack only some group of stations.
3 Analysis of the Protocol The analysis consists of three different phases (even if the stations behave in exactly the same way all the time). In Phase I we show that some potential function reaches a certain low level – this part is borrowed from [4]. In Phase II we guarantee with high probability that all stations deviate by at most β from the average value. Then Phase 3 is used to show that with high probability all stations hold one of at most 3 consecutive values. In order to simplify the presentation we call the stations S1 , . . . Sn , even if the algorithm does not use any ID’s of the stations.
Computing Average Value in Ad Hoc Networks
515
3.1 Phase I Let Tt,j denote the value of Tj hold by S j nimmediately after executing stage t. Let T denote the average value, that is, T = n1 i=1 T0,i . We examine the values xt,j = Tt,j − T . In order to examine the differences from the average value we consider the following potential function: ∆t =
n
x2t,i .
i=1
Claim A. E [∆t+1 ] ≤ ρ · ∆t +
n 4
for some constant ρ < 1.
Proof. We first assume that new values hold by two stations after balancing their values become equal (possibly reaching non-integer values). Then we make an adjustment to the real situation when the values must remain to be integers. By linearity of expectation, n n E [∆t+1 ] = E x2t+1,i = E x2t+1,i . i=1
i=1
So now we inspect a single E x2t+1,i . As already mentioned, with a constant probability δ station Si balances Tt,j with some other station, say with Ss . Assume that the values held by Si and Ss become equal. So xt+1,i and xt+1,s become equal to z = 12 (xt,i + xt,s ). Therefore 2 2 xt,i + xt,s 2 E xt+1,i = (1 − δ) · xt,i + δ · E 2 = (1 − δ) · x2t,i + δ · E 14 x2t,i + 14 x2t,s + 12 xt,i · xt,s = (1 − 34 δ) · x2t,i + 14 δ · E x2t,s + 12 δ · E [xt,i · xt,s ] . Since s is uniformly distributed over {1, . . . , n}, we get n 1 2 1 · xt,j = · ∆t . E x2t,s = n n j=1
The next expression we have to evaluate is n n 1 1 E [xt,i · xt,s ] = · (xt,i · xt,j ) = · xt,i · xt,j . n n j=1 j=1
n
xt,j = 0. So E [xt,i · xt,s ] equals 0 and finally, 1 E x2t+1,i = (1 − 34 δ) · x2t,i + 14 δ · · ∆t . n When we sum up all expectations E x2t+1,i we get n 1 E [∆t+1 ] = (1 − 34 δ) · x2t,i + 14 δ · ∆t n i=1 Obviously,
j=1
= (1 − 34 δ) · ∆t + 14 δ · ∆t = (1 − 12 δ) · ∆t .
516
Mirosław Kutyłowski and Daniel Letkiewicz
Now, let us consider the case when Tt,i + Tt,s (or equivalently xt,i + xt,s ) is odd. Let us see how it contributes to the change of ∆t+1 compared to the value computed previously. In the simplified case, Si and Ss contribute 2 xt,i + xt,s 2 2 to the value of ∆t+1 . Now, this contribution could be 2 2 xt,i + xt,s + 1 xt,i + xt,s − 1 + . 2 2 For every y,
y+1 2
2 +
y−1 2
2
=2·
y 2 2
+
so we have to increase the value computed for ∆t+1 by at most established a link. It follows finally that n E [∆t+1 ] ≤ ρ · ∆t + 4 1 for ρ = (1 − 2 δ).
1 2 1 2
for each pair that has (1)
Claim B. After τ0 = O(log D + log n) stages, ∆τ0 ≤ α · n + 1 with probability 1 − O( n12 ). Proof. Let ∇t = ∆t − αn, for α =
1 4(1−ρ) .
By inequality (1)
E [∇t+1 ] = E [∆t+1 − αn] ≤ ρ · ∆t +
n − αn = 4
n − αn = ρ · ∇t . 4 It follows that E [∇t+1 ] ≤ ρ · E [∇t ]. Let τ0 = logρ−1 D · n2 . Then E [∇τ0 ] ≤ n−2 . So by Markov inequality, Pr[∇τ0 ≥ 1] ≤ n−2 . We conclude that Pr[∆τ0 < 1 + αn] is at least 1 − n−2 . ρ · ∇t + ραn +
3.2 Phase II
√ We assume that ∆τ0 < 1 + αn. Let β = 2 α. Let B = Bt be the set of stations Si such that |xt,i | > β, and G = Gt be the set of stations Sj such that |xt,j | = β. Claim C. |B ∪ G| < 14 n + O(1)
for each t ≥ τ0 .
Proof. The stations from B ∪ G contribute at least |B ∪ G| · β 2 = |B ∪ G| · 4α to ∆t . 1 Since ∆t ≤ ∆τ0 < αn + 1, we must have |B ∪ G| < 14 n + 4α . Now we define a potential function ∆ used to measure the size of Bt . Definition 1. For station Si ∈ Bt define x ˜i,t = xi,t − β and as a zero otherwise. Then x ˜2i,t . ∆t = i∈Bt
Computing Average Value in Ad Hoc Networks
Claim D. E ∆t+1 ≤ µ · ∆t
517
for some constant µ < 1.
Proof. We consider a single station Si ∈ Bt , with xi,t > β. By Claim C, with a constant probability it communicates with a station Sj ∈ Bt ∪ Gt . In this case, station Sj may join B, but let us consider contribution of stations Si and Sj to ∆t+1 . Let δ = β − xj,t . Then: 2 2 2 x ˜2i,t x ˜i,t − δ x˜i,t − 1 x˜i,t 2 2 . ˜j,t+1 ≤ 2 · <2· ≤2· = x ˜i,t+1 + x 2 2 2 2 If Si communicates with a station Sj ∈ Bt ∪ Gt , then obviously x ˜2i,t+1 + x ˜2j,t+1 ≤ x˜2i,t + x ˜2j,t . We may apply a simple bookkeeping technique assigning the contribution of stations ˜2i,t for to ∆t+1 so that the expected value of contribution of Si is bounded by µ · x some constant µ (we assign to Si the contribution of Si and Sj in the first case, and equals contribution of Si in the second case). Since by linearity of expectation E ∆ t+1 the sum of expected values of these contributions, E ∆t+1 ≤ µ · E [∆t ]. Claim E. For t ≥ τ0 + T , where T = O(log n), the set Bt is empty with probability 1 − O( n12 ). E ∆τ0 ≤ E [∆τ0 ] Proof. By Claim D, E ∆τ0 +t ≤ µt · E ∆τ0 . On the other hand, < α · n + 1. Let T = logµ−1 (2α · n3 ) and t ≥ T . Then E ∆τ0 +t ≤ n−2 . So by Markov inequality, Pr[∆τ0 +t ≥ 1] ≤ n−2 . Observe that ∆ takes only integer values, so Bτ0 +t is empty, if ∆τ0 +t < 1. 3.3 Phase III Let τ1 = τ0 + T , where T satisfies Claim E. Then for t > τ1 we may assume that for no station |xi,t | ≥ β. Our goal now is to reduce the maximal value of |xi,t |. We achieve this in at most 2β − 1 subphases, each consisting of O(log n) stages: during each subphase we “cut off” one of the values that can be taken by xi,t . Always it is the smallest or the biggest value. Let V (s) = Vt (s) be the set of stations, for which xi,t takes the value s. Consider t1 > τ1 . Let l = min{xi,t1 : i ≤ n} and and g = max{xi,t1 : i ≤ n}. Assume that l + 1 < g − 1 (so, there are at least four values of numbers xi,t1 ). We show that for t = t1 + O(log n) either Vt (l) = ∅ or Vt (g) = ∅. Obviously, no station may join Vt (l) or Vt (g), so their sizes are non-increasing. Now consider a single stage. Observe that |Vt (l)∪Vt (l+1)| ≤ 12 n or |Vt (g)∪Vt (g−1)| ≤ 12 n. W.l.o.g. we may assume that |Vt (g) ∪ Vt (g − 1)| ≤ 12 n. Consider a station Si ∈ Vt (g). With a constant probability Si communicates with a station Sj that does not belong to Vt (g) ∪ Vt (g − 1). Then station Si leaves Vt (g) and Sj remains outside Vt (g). Indeed, the values xi,t and xj,t differ by at most 2, so xi,t+1 , xj,t+1 ≤ xi,t − 1. It follows that E [|Vt+1 (l)|] ≤ ψ · |Vt (l)| for some ψ < 1. We see that in a single stage we expect either |Vt (l)| or |Vt (g)| to shrink by a constant factor. Using Markov inequality as in the proof of Claim E we may then easily derive the following property:
518
Mirosław Kutyłowski and Daniel Letkiewicz
Claim F. For some T = O(log n), if t > T , then with probability 1 − O( n12 ) either the set Vτ1 +t (l) or the set Vτ1 +t (g) is empty. By Claim F, after O(β log n) = O(log n) stages we end up in the situation in which there are at most three values taken by xi,t . Even then, we may proceed in the same way as before in order to reduce the sizes of Vt (l) or Vt (g) as long as one of these sets has size Ω(n). So we can derive the following claim which concludes the proof of Theorem 1: Claim G. For some T = O(log n), for τ2 = τ1 + T and t ≥ τ2 with probability 1 − O( n12 ) either xi,t takes only two values, or there are three values and the number of stations holding the smallest and the largest values is at most γ · n.
4 Properties of the Protocol and Discussion Changes in the Network. By a simple examination of the proof we get the following additional properties: – the result holds even if a constant fraction of messages is lost. This only increases the number of stages by a constant factor. – if some number of stations goes down during the execution of the protocol, then the final values do not concentrate around the average value of the original values of the stations that have survived, but anyway they differ by at most 2. If a new station joins the network and its value deviates from the values hold by the rest of the stations, then we may proceed with the same analysis. Conclusions regarding the rate of convergence and the rate at which new stations emerge can be derived as before. Energy Efficiency. Time complexity is not the most important complexity measure for mobile networks. Since the devices are powered by batteries, it is important to design algorithms that are energy efficient (otherwise, the network may fail due to exhaustion of batteries). The main usage of energy is for transmitting messages and listening to the communication channel. Energy usage of internal computations and sensors is substantially smaller and can be neglected. Surprisingly, for transmitting and listening comparable amounts of energy are necessary. A properly designed algorithm should require a small number of messages (not only messages sent, but also messages awaited by the stations). Additionally, the differences between the number of messages sent or awaited by different stations should be as small as possible. The reason is that with similar energy resources no station should be at higher risk of going down due to energy exhaustion. In out algorithm energy usage of each station is Θ(log n). This is optimal since we need that many sending trials to ensure that its value has been transmitted successfully with high probability in the presence of constant probability of transmission failures. Protocol Extensions – Getting Exactly One Value. Our algorithm leaves the network in a state in which there might be 3 different values. The bound from Theorem 1 regarding behavior of the algorithm cannot be improved. Indeed, consider the following example:
Computing Average Value in Ad Hoc Networks
519
assume that initially exactly one station holds value T − 1, exactly one station holds T + 1, and the rest has value T . Then in order to get into the state when all stations get value T we need that the station with T − 1 communicates with the station with value T + 1. However, probability that it happens during a single stage is Θ(1/N ). Therefore, probability that these two station encounter each other within logarithmic number of stages is O(log N/N ). Once we are left with the values that differ from the average value by less than two, it is quite reasonable to start a procedure of computing the minimum over all active stations. In fact, it suffices to redefine part 3 of a stage: instead of computing the average of two values both stations are assigned the smaller of their two values. Arguing as in Claim E, we may easily show that after O(log n) stages with high probability all stations know the minimum. If each station knows the number n of the active stations, a simple trick may be applied to compute the average value exactly. At the beginning, each value is multiplied by n. Then the average value becomes s = Ti and it is an integer. So after executing the protocol we end up in the second situation described in Theorem 1 or all stations hold the same value. In order to get rid of the first situation a simple protocol may broadcast the minimal and maximal values to all stations within O(log N ) steps. Then all stations may find s and thereby the average s/n. Dynamic Processes. For a dynamic process, in which the the values considered are changing (think for instance about the output of sensors), we may observe that the protocol works quite well. For the sake of discussion assume that the values may only increase. If we wish to ignore the effect of increments of the values we may think about old units of the values existing at the beginning of the protocol, and the new ones due to incrementing the values. When executing part 3 of a stage and “allocating” the units to stations A and B we may assume that first the same (up to 1) amount of old units is given to A and B and afterwards the new units are assigned. In this way, the new units do not influence the behavior of the old ones. So a good distribution of the old units will be achieved as stated by Theorem 1 despite the fact that the values have changed. Security Issues. Since the stations exchange information at random moments an adversary which only disturbs communication can only slow down the rate of convergence. However, if it knows that there is a station with a value X that differs a lot from the average, it may increase its chances a little bit: if X has not occurred so far during a stage, then it might be advantageous for the adversary to scramble the rest of the stage making sure that X remains untouched. Of course, serious problems occur when an adversary can fake messages of the legitimate stations. If the legitimate stations have a common secret, say K, then the problems can be avoided. Faking messages becomes hard, when the messages are secured with MAC code using K. In order to avoid the first problem it is necessary to encipher all messages (together with random nounces). In this case an adversary cannot say which values are exchanged by the algorithm. The only information that might be derived is the fact that somebody has transmitted at a given time. But this seems not to bring any substantial advantage, except that then it could be advantageous to attack the third step
520
Mirosław Kutyłowski and Daniel Letkiewicz
of a round. Encryption with a symmetric algorithm should be no problem regarding speed differences between transmission and internal computations.
Acknowledgment We thank Artur Czumaj for some ideas developed together and contained in this paper.
References 1. Chlebus, B. S.: Randomized communication in radio networks. A chapter in “Handbook on Randomized Computing” (P. M. Pardalos, S. Rajasekaran, J. H. Reif, J. D. P. Rolim, Eds.), Kluwer Academic Publishers, 2001, vol. I, 401-456 2. Czumaj, A., Kanarek, P., Kutyłowski, M., and Lory´s, K.: Distributed stochastic processes for generating random permutations. ACM-SIAM SODA’99, 271-280 3. Czumaj, A., Kutyłowski, M.: Generating random permutations and delayed path coupling method for mixing time of Markov chains. Random Structures and Algorithms 17 (2000), 238–259 4. Gosh, B., Muthukrishnan, S.: Dynamic Load Balancing in Parallel and Distributed Networks by Random Matchings. JCSS 53(3) (1996), 357–370 5. Jurdzi´nski, T., Kutyłowski, M., Zatopia´nski, J.: Energy-Efficient Size Approximation for Radio Networks with no Collision Detection. COCOON’2002, LNCS 2387, Springer-Verlag, 279-289 6. L. Lamport, R. Shostak and M. Pease: The Byzantine Generals Problem. ACM TOPLAS 4 (1982), 382-401 7. I. Stojmenoviˇc (Ed.): Handbook of Wireless Networks and Mobile Computing, Wiley, 2002 8. E. Upfal: Design and Analysis of Dynamic Processes: A Stochastic Approach, ESA’1998, LNCS 1461, Springer-Verlag, 26–34
A Polynomial-Time Algorithm for Deciding True Concurrency Equivalences of Basic Parallel Processes Sławomir Lasota Institute of Informatics, Warsaw University, Poland [email protected]
Abstract. A polynomial-time algorithm is presented to decide distributed bisimilarity of Basic Parallel Processes. As a direct conclusion, several other noninterleaving semantic equivalences are also decidable in polynomial time for this class of process, since they coincide with distributed bisimilarity.
1 Introduction One important problem in the verification of concurrent systems is to check whether two given systems P and Q are equivalent under a chosen notion of equivalence. For process algebras generating infinite-state systems the equivalence checking problem cannot be decidable in general, therefore restricted classes of processes have been defined and investigated. We study here the class of Basic Parallel Processes [9] (BPP), an extension of recursively defined finite-state systems by parallel composition. Strong bisimilarity [25] is a well accepted behavioural equivalence, which often remains decidable for infinite-state systems. An elegant proof of decidability of bisimilarity for BPP and even for BPPτ , extension of BPP by communication, was given in [10]. The PSPACE lower bound has been recently proved in [26], followed by the PSPACEcompleteness result of Janˇcar [18]. On the other hand, all other equivalences in van Glabbeek’s spectrum are undecidable [17]. BPP is the natural class of processes to investigate non-interleaving equivalences, intended to capture true concurrent computations of a system. One of the bisimulationlike non-interleaving equivalences is distributed bisimilarity [6], taking into account spatial distribution of a process. Already in [8] distributed bisimilarity was shown to be decidable on BPPτ by means of a sound and complete tableau proof system. Concerning complexity, the tableau depth was only bounded exponentially. In this paper we design a polynomial-time decision procedure for distributed bisimilarity. It strongly uses a polynomial-time algorithm for deciding strong bisimilarity on normed BPP processes proposed in [16]. Distributed bisimilarity is therefore very likely to be computationally more feasible than interleaving bisimilarity, in the light of the recent PSPACE lower bound for the latter one by Srba [26]. Further interesting conclusions follow from the fact that many non-interleaving equivalences coincide on BPP. As mentioned in [12], Kiehn proved [21] that location equivalence [7], causal equivalence [11] and distributed bisimilarity all coincide
A part of this work has been performed during the post-doc stay at Laboratoire Specification et Verification, ENS Cachan. Partially supported by the KBN grant 7 T11C 002 21 and the EC Research Training Network “Games and Automata for Synthesis and Validation” (GAMES).
B. Rovan and P. Vojt´asˇ (Eds.): MFCS 2003, LNCS 2747, pp. 521–530, 2003. c Springer-Verlag Berlin Heidelberg 2003
522
Sławomir Lasota
on CPP, a sublanguage of BPPτ without explicit τ , hence also on BPP. Furthermore, causal equivalence and history preserving bisimilarity [13] coincide on BPP by the result of Aceto [1]; moreover, Fr¨oschle showed coincidence of distributed and history preserving bisimilarity on BPP [12]. The coincidence with performance equivalence, a timed bisimulation equivalence proposed by [14], has been shown in [23], to complete the picture1 . As a direct conclusion from all these results, all the mentioned equivalences can be also decided in polynomial time on BPP. Related results are [15] decision procedures for causal equivalence, location equivalence and ST-bisimulation equivalence of BPPτ as well as for their weak versions on a subset of BPPτ . However, complexity issues were not addressed there. Furthermore, polynomial-time complexity of performance equivalence extends the result of [5] shown only for timed BPP in a full standard form [9]. Surprisingly, polynomial-time complexity of history preserving bisimilarity on BPP can be contrasted with the EXPTIME-completeness on finite-state systems (finite 1-safe nets) [19]. Similarly, decidability of hereditary history preserving bisimilarity [4] on BPP, proved in [12], can be contrasted with undecidability on finite 1-safe nets shown by Jurdzi´nski and Nielsen in [20]. We start by Section 2 containing definitions and some basic facts and then we outline our algorithm in Section 3. The algorithm works for BPP processes in standard form, similarly as in [9]. A polynomial-time preprocessing procedure transforming a process into standard form can be found in the full version of the paper [24].
2 Basic Definitions and Facts Let Act be a finite set of actions, ranged over by a, b, etc. and let Const be a finite set of process constants, ranged over by X, Y , etc. The set of BPP process expressions [9] over Act and Const is given by: Pi | P P | P P (1) P ::= 0 | X | a.P | i∈I
where 0 denotes the empty process, a. is an action prefix, i∈I Pi is a finite nondeterministic choice for a finite nonempty set I and stands for a parallel composition. The only operator not present in CCS [25] is the left merge , which differs from the parallel composition only in that the very first action must be performed in the left argument. The purpose of considering here is the standard form (3) below. A BPP process definition ∆ consists of a finite set Act(∆) of actions, a finite set Const(∆) of constants and a finite number of recursive process equations X = P, def
one for each constant X ∈ Const(∆), where P is a process expression over Act(∆) and Const(∆). Sets Const(∆) and Act(∆) are often even not mentioned explicitly, as they can be deduced from process equations. In the sequel we shall assume that a 1
Related results are [2], where Aceto proved that distributed bisimilarity coincides with timed bisimilarity on BPP without recursion, and [22], where decidability of strong bisimilarity for timed BPP was shown, that generalizes the result of [10].
A Polynomial-Time Algorithm for Deciding True Concurrency Equivalences
523
process definitions that our algorithm inputs is guarded, i.e., that each occurrence of a constant on the right-hand side is within the scope of an action prefix. For instance, def X = a.Y X + b.Z is not guarded. By a BPP process we mean a pair (P, ∆), where ∆ is a BPP process definition and P is a BPP process expression over Act(∆) and Const(∆). When ∆ is evident from the context, P itself is called a process too. Distributed bisimilarity was introduced in [6], but here we follow [9]. Given a BPP process definition ∆, consider the following SOS transition rules: a
P → [P , P ]
(X = P ) ∈ ∆ def
a
X → [P , P ] a
Pj → [P , P ] for some j∈I a i∈I Pi → [P , P ] a
P → [P , P ] a
P Q →
a
a.P → [P, 0] a
P → [P , P ] a
P Q → [P , P Q] a
(2)
Q → [Q , Q ]
[P , P Q]
a
P Q → [Q , P Q ]
a
We write P → [P , P ] if this transition can be derived from the above rules. The rules a reflect a view on a process as distributed in space. Each transition P → [P , P ] gives rise to a local derivative P , which intuitively records a location at which the action is observed, and a concurrent derivative P , recording the part of the process separated from the local component. BPP processes (P1 , ∆1 ) and (P2 , ∆2 ) are distributed bisimilar, denoted (P1 , ∆1 ) ∼ (P2 , ∆2 ) if they are related by some distributed bisimulation R, i.e., a binary relation over BPP process expressions such that whenever (P, Q) ∈ R, for each a ∈ Act, a
a
– if P → [P , P ] then Q → [Q , Q ] for some Q , Q such that (P , Q ) ∈ R and (P , Q ) ∈ R, a a – if Q → [Q , Q ] then P → [P , P ] for some P , P such that (P , Q ) ∈ R and (P , Q ) ∈ R. In the next section we prove polynomial-time complexity of the problem of checking distributed bisimilarity for a given pair of constants. We do not lose generality, as checking P ∼Q for arbitrary P, Q is equivalent to checking XP ∼XQ , where XP and def def XQ are new fresh constants with defining equations: XP = a.P and XQ = a.Q, for arbitrary a. Moreover, w.l.o.g. we assume that both constants share a process definition. Problem: D ISTRIBUTED BISIMILARITY FOR BPP Instance: A BPP process definition ∆ and X, Y ∈ Const(∆) Question: (X, ∆)∼(Y, ∆) ? Christensen presented in [8] a sound and complete tableau proof system for ∼ on BPPτ and proved an exponential upper bound for the depth of a tableau. Theorem 1 ([8, 9]). Distributed bisimilarity is decidable on BPP.
524
Sławomir Lasota
Christensen [9] showed also that each BPP process definition ∆ can be effectively transformed into an equivalent process definition ∆ in standard form, i.e., consisting exclusively of process equations in the restricted form def X= (ai .Pi )Qi , (3) i∈I
where all Pi and Qi are merely a parallel composition of constants, i.e., of the form X1 X2 . . .Xn ,
for n > 0 and X1 , . . . , Xn ∈ Const(∆ ).
(4)
Note that (3) is not guarded in general. We omit brackets in (4) as is associative and commutative w.r.t. ∼ (and w.r.t. any other known semantical equivalence, in fact). A parallel composition of constants (4) is called basic process (expression) in the sequel. Observe that processes Pi in (3) are precisely local derivatives of X and processes Qi are precisely its concurrent derivatives. Hence the left merge operator allows here to syntactically separate both derivatives. Consequently, in the next section we will only consider basic processes since both local and concurrent derivatives of a basic process are basic again. Since ∆ is guarded, the process definition ∆ produced by Christensen’s transformation is bounded in the following sense: Definition 1. Define a binary relation over Const(∆ ) as follows: Y ≺1 X iff Y appears in some concurrent derivative of X. We say that ∆ is bounded if the transitive + closure ≺+ 1 of ≺1 is irreflexive, i.e., no constant satisfies X≺1 X.
Christensen’s transformation produces ∆ that contains only basic processes consisting of at most three constants. The price for this constant bound is the exponential size of ∆ w.r.t. the size of ∆, defined as the number of process equations in ∆ plus the sum of lengths of right-hand sides. This is why we proved (Theorem 2 below) that the transformation to the standard form (3) can be done in polynomial time.
Theorem 2. There exists a polynomial-time algorithm that transforms a guarded process definition ∆ into a process definition ∆ such that: 1. ∆ is in standard form (3), 2. ∆ is bounded, 3. Const(∆) ⊆ Const(∆ ) and for each X ∈ Const(∆), (X, ∆)∼(X, ∆ ). (The proof is given in the full version of this paper [24].) a → P obtained Strong bisimilarity is defined w.r.t. single-derivative transitions P − by the rules (2) when the distribution of a process is ignored – for details we refer eg. to [25]. A remarkable result is that strong bisimilarity can be decided for BPP processes in polynomial time [16], but only when all the constants are normed. A constant, or generally a process P , is normed if an inactive process is reachable from P , i.e., if there a1 an a2 P1 −→ . . . −− → Pn , n ≥ 0, such that there are is a finite sequence of transitions P −→ no further transition from Pn . The norm of P is the length of the shortest such sequence. Strong bisimilarity is less restrictive than distributed bisimilarity. Hence a process definition ∆ can be transformed into a strong bisimilarity equivalent process definition ∆ in a more restrictive than (3) full standard form [9]. Full standard form admits exdef clusively process equations in the form: X = i∈I ai .Pi , where all Pi are basic again. Theorem 3 ([16]). There exists a polynomial-time algorithm to decide strong bisimilarity on normed BPP in full standard form.
A Polynomial-Time Algorithm for Deciding True Concurrency Equivalences
525
3 Algorithm Throughout this section we fix ∆, and hence also sets of constants and actions. ∆ is assumed to be in standard form and bounded. A more succinct representation is possible for ∆ in standard form. Namely, due to associativity and commutativity of , it is sufficient to remember the number of occurrences of each constant in each basic expression Pi and Qi in the right-hand side of all equations (3) in ∆, encoded in binary. In this section, complexity is measured w.r.t. the size of ∆ defined as the number of process equations plus the sum of lengths of the succinct representations of the right-hand sides. Theorem 3 is still valid for this definition of size. The reachability relation over process expressions is defined as the smallest transitive relation such that each P is related to all its local and concurrent derivatives, i.e, a whenever P → [P , P ], the relation contains pairs (P, P ) and (P, P ). We say that Q is reachable from P if the pair (P, Q) is in the reachability relation. Let us denote by P the set of all process expressions reachable from the constants. As observed previously, all P ∈ P are basic. Unless stated otherwise, all the relations mentioned below are binary relations over P. This includes also ∼, which is restricted now to P only. Unless explicitly stated otherwise, P , Q, etc., range over P. An exponential-time algorithm can be easily derived as follows. First define two monotonic operators as follows. The operator B2 acts on a pair of relations as follows: (P, Q) ∈ B2 (R , R ) iff for each a ∈ Act, a
a
– if P → [P , P ] then Q → [Q , Q ] for some Q , Q such that (P , Q ) ∈ R and (P , Q ) ∈ R , a a – if Q → [Q , Q ] then P → [P , P ] for some P , P such that (P , Q ) ∈ R and (P , Q ) ∈ R . Then the operator B1 is defined by B1 (R) := B2 (R, R). Now, define the approximating equivalences ∼i as follows: – P ∼0 Q for all P and Q, – ∼i+1 := B1 (∼i ), for i ≥ 0. Distributed bisimulations R are exactly the post-fixed points of B1 , i.e., are defined by R ⊆ B1 (R). Hence ∼ being the union of all distributed bisimulations is then the greatest fixed point of B1 , by the Knaster-Tarski theorem. Recall that BPP is imagefinite, that is to say each process expression has only finitely many local and concurrent derivatives. Thus by a standard argument the decreasing chain {∼i } converges to ∼: ∼= ∼i . (5) i∈N
Furthermore, observe that each local derivative of a basic process X1 . . .Xn is a local derivative of some Xj , i.e., is equal to some process Pi appearing in a process equation (3) in ∆. In consequence, the number of local derivatives of all basic processes is polynomial. Let us denote the set of all those by L. Moreover, there are only exponentially many processes reachable from each P ∈ L – this follows easily from boundedness of ∆. Consequently, the cardinality N of the whole P is exponential. Hence ∼
526
Sławomir Lasota
can be computed over P in exponential time, e.g., as the limit of the sequence {∼i } of equivalences, since the sequence stabilizes after at most N −1 steps. We have not focused on details of the exponential-time algorithm, as in the rest of this section we argue that one can do better: the problem can be solved in polynomial time. Essentially, this is possible due to a ”quicker” convergence to the greatest fixed point, as explained in Lemma 2 below and thereafter. Then, in the crucial Lemma 4 we reduce distributed bisimilarity to strong bisimilarity between normed processes. To this aim we incorporate local derivatives into actions and obtain single-derivative transitions. We start by a couple of definitions and simple facts. Definition 2. Given a binary relation S, a distributed bisimulation w.r.t. S is any binary relation R such that R ⊆ B2 (S, R). P and Q are distributed bisimilar w.r.t. S, denoted P ∼S Q, if they are related by some distributed bisimulation w.r.t. S. Definition 3. We say that a relation R is a distributed bisimilarity w.r.t. itself if R = ∼R . Let ≈ denote the greatest distributed bisimilarity w.r.t. itself. A relation is a distributed bisimilarity w.r.t. itself precisely if it is a fixed point of the monotonic mapping R → ∼R . Hence the greatest distributed bisimilarity w.r.t. itself always exists. Lemma 1. ∼ and ≈ coincide. Proof. For one inclusion, recall that ∼ is the union of all distributed bisimulations while ∼∼ is the union of all distributed bisimulations w.r.t. ∼. Since each distributed bisimulation is a distributed bisimulation w.r.t. ∼, we have ∼ ⊆ ∼∼ , i.e., ∼ is a post-fixed point of the mapping R → ∼R . As ≈ is the greatest fixed point of that mapping, we obtain ∼ ⊆ ≈. For the other inclusion, assume a relation S is a distributed bisimilarity w.r.t. itself, S = ∼S . Since ∼S is the union of all distributed bisimulations w.r.t. S, it is the (greatest) fixed point of the monotonic mapping R → B2 (S, R), i.e., ∼S = B2 (S, ∼S ). Substituting S in place of ∼S we get S = B2 (S, S), i.e., S is a fixed point of B1 . Hence S ⊆ ∼. As S was chosen arbitrary, we showed that each distributed bisimilarity w.r.t. itself is included in ∼. Hence also ≈ does, i.e., ≈ ⊆ ∼. 2 We proved that ≈ is just another formulation of ∼. But ≈ gives rise to another sequence of approximating equivalences {≈i } that converges more rapidly than {∼i }, namely after a polynomial number of iterations: Lemma 2. ≈ = i∈N ≈i , where the sequence {≈i } is defined by: – P ≈0 Q for all P and Q, – ≈i+1 := ∼≈i . Proof. Obviously ≈ ⊆ i∈N ≈i , so we only need to show the opposite inclusion. Similarly as ∼, ∼S is the greatest fixed point of the monotonic mapping R → B2 (S, R), for any fixed S. So ∼S is also a limit of a decreasing sequence of approximations: ∼Si , (6) ∼S = i∈N
where relations ∼Si are defined by:
A Polynomial-Time Algorithm for Deciding True Concurrency Equivalences
527
– P ∼S0 Q for all P and Q, – ∼Si+1 := B2 (S, ∼Si ). Having this, by an easy induction we show ≈i ⊆ ∼i , for all i ≥ 0. As the induction assumption suppose ≈i ⊆ ∼i , for a fixed i ≥ 0. Now substitute ≈i in place of S in (6) and in the definition of ∼Sj , j ≥ 0. Due to monotonicity of B2 we derive by another ≈i i easy induction on j ≤ i that ∼≈ j+1 = B2 (≈i , ∼j ) ⊆ B2 (∼j , ∼j ) = ∼j+1 , since i ≈i ⊆ ∼i ⊆ ∼j by the induction assumption and by j ≤ i. Hence ∼≈ i+1 ⊆ ∼i+1 . ≈i ≈i By (6) we know that ≈i+1 = ∼ ⊆ ∼i+1 , hence we conclude ≈i+1 ⊆ ∼i+1 . This completes the induction step. 2 Having ≈i ⊆ ∼i , for all i ≥ 0, we apply Lemma 1 and (5). Equipped with Lemmas 1 and 2, we are ready to describe the polynomial-time algorithm. Recall that L denotes the set of all local derivatives. The algorithm consists of two phases as outlined in the figure below. By R∩(L×L) we mean here the restriction of a relation R to pairs from L. P HASE 1: let 0 := L×L REPEAT FOR n = 0, 1, . . . compute n+1 ⊆ L×L as follows: n+1 := ∼n ∩(L×L) UNTIL n = n+1 P HASE 2:
decide whether X ∼n Y
The first phase is a crucial one, but amounts simply to computing an initial part of {≈i } up to the position n where it eventually stabilizes. The trick is that ≈i is computed only for local derivatives. Then, in the second phase we only need to check whether the input pair (X, Y ) belongs to ∼≈n . Assuming that the first phase of the algorithm terminates, the outcome ∼n coincides with ≈. Lemma 3. If n = n+1 then ∼n = ≈. Proof. Assuming n = n+1 , we will show ∼n ⊆ ≈ and ∼n ⊇ ≈. For both inclusions we will silently use an obvious fact: when two relations S1 and S2 coincide on L × L, i.e., S1 ∩(L×L) = S2 ∩(L×L), then ∼S1 = ∼S2 . For ∼n ⊆ ≈, it is sufficient to show that ∼n is a distributed bisimilarity w.r.t. itn n = ∼∼ ∩(L×L) = ∼n+1 = ∼n . self. Indeed, ∼∼ n For ∼ ⊇ ≈, we show by induction that for all i ≥ 0, (a) i = ≈i ∩(L×L), (b) ∼i = ≈i+1 . For i = 0 it is obvious, so assume i > 0 and (a) and (b) hold for i−1. We prove (b)
(a) first: i = ∼i−1 ∩(L×L) = ≈i ∩(L×L). Then (b) follows easily from (a): (a)
∼i = ∼≈i ∩(L×L) = ∼≈i = ≈i+1 . Now ∼n ⊇ ≈ follows from (b) since ≈n+1 ⊇ ≈, by Lemma 2.
2
528
Sławomir Lasota
Termination of the first phase of the algorithm after a polynomial number of iterations of the main loop is guaranteed as the sequence {i } is non-increasing: 0 ⊇ 1 ⊇ . . . , and each i contains only polynomially many pairs. What we still need to show is that the single iteration of the loop body, i.e., computation of i+1 from i , can be done in polynomial time. To this aim we will prove the following Lemma 4. In the proof we will profit from Theorem 3. Lemma 4. Let S ⊆ L×L be an equivalence such that there exists a polynomial-time algorithm (w.r.t. the size of ∆) to decide whether (P, Q) ∈ S, for given P, Q ∈ L. Then there exists a polynomial-time algorithm to decide P ∼S Q, for given P , Q ∈ P. Proof. As the first stage, we construct from ∆ a new process definition ∆ in the full standard form, equivalent to ∆ in the following sense: P, Q ∈ P, (P, ∆) ∼S (Q, ∆)
iff (P, ∆ ) is strongly bisimilar to (Q, ∆ ).
(7)
The construction of ∆ is as follows: Const(∆ ) := Const(∆)
Act(∆ ) := Act(∆) × L/S,
where L/S denotes the set of equivalence classes of S and can be computed in polynomial time. Furthermore, whenever ∆ contains a process equation def X= (ai .Pi )Qi , (8) i∈I
∆ contains
X= def
i∈I
(ai , [Pi ]S ).Qi ,
(9)
where [Pi ]S denotes the equivalence class of Pi in S. Having this, (7) is clear, by the very definitions of the two bisimilarities involved. Now, the crucial point is that ∆ is always normed, since ∆ is bounded. We have Y ≺1 X (cf. Section 2) iff Y appears in some Qi on the right-hand side of process equation (8) defining X. As the transitive closure ≺+ 1 is irreflexive, the following equations (10) and (11) are well-defined and give the norm of all the constants. First, for each constant X defined by (9) in ∆ , norm(X) = 1 + min{norm(Qi )}. i∈I
(10)
Second, the norm is additive w.r.t. parallel composition: norm(P Q) = norm(P ) + norm(Q),
(11)
and this implies that the norm of each concurrent derivative Qi in equation (10) is the sum of norms of all parallel components. Now we apply Theorem 3 to ∆ and by (7) get a polynomial-time procedure to decide ∼S . 2 Evidently each i is an equivalence, hence the lemma applies and we conclude that the body of the main loop of the first phase requires only polynomial time: it amounts to invoking the decision procedure for strong bisimilarity on normed BPP polynomially many times, since the set L×L has polynomial cardinality. By Lemma 4 the second phase can be computed in polynomial time as well. Correctness of the algorithm follows by Lemmas 3 and 1. This completes the proof of the following:
A Polynomial-Time Algorithm for Deciding True Concurrency Equivalences
529
Theorem 4. There exists a polynomial-time algorithm to decide distributed bisimilarity for BPP processes.
4 Final Remarks We have proposed a polynomial-time decision procedure for distributed bisimilarity on BPP. As mentioned in the introduction, many non-interleaving equivalences coincide on BPP. Therefore, we directly conclude from Theorem 4: Corollary 1. There exists a polynomial-time algorithm to decide the following equivalences for BPP processes: location equivalence, causal equivalence, history preserving equivalence, performance equivalence. Consider BPPτ , an extension of BPP with communication between parallel components expressed by one additional rule: a
P → [P , P ] τ
a ¯
Q → [Q , Q ]
P Q → [P Q , P Q ]
.
(12)
A local derivative of a τ -transition can be composed of two local derivatives of parallel components. Hence local derivatives cannot be encoded directly into actions, and the reduction of distributed bisimilarity to strong bisimilarity in the proof of Lemma 4 fails. A crucial ingredient of our decision procedure is the polynomial-time transformation of a process definition to the standard form, described in the full version of this paper [24]. It is different from the transformation proposed by Christensen in [9], since the process definition in standard form yielded by the latter is of exponential size. Our algorithm needs Θ(n2 ) calls to the polynomial-time algorithm of [16] in each iteration in the first phase, where n stands for the size of ∆. At most n iterations are needed, since all i are equivalences, and therefore total cost is Θ(n3 ) calls to the procedure of [16]. On the other hand, P-completeness of the problem follows easily since it subsumes strong bisimilarity for finite-state systems and the latter is P-complete [3]. An interesting continuation of the work would be to develop a more efficient direct algorithm, not referring to the procedure of [16].
Acknowledgements The author is very grateful to Philippe Schnoebelen for many fruitful discussions.
References 1. L. Aceto. History preserving, causal and mixed-ordering equivalence over stable event structures. Fundamenta Informaticae, 17:319–331, 1992. 2. L. Aceto. Relating distributed, temporal and causal observations of simple processes. Fundamenta Informaticae, 17:369–397, 1992. 3. J. Balc´azar, J. Gabarr´o, and M. S´antha. Deciding bisimilarity is P-complete. Formal Aspects of Computing, (6A):638–648, 1992.
530
Sławomir Lasota
4. M. Bednarczyk. Hereditary history preserving bisimulation or what is the power of the future perfect in program logics. Technical report, Polish Academy of Sciences, Gda´nsk, 1991. 5. B. B´erard, A. Labroue, and P. Schnoebelen. Verifying performance equivalence for timed Basic Parallel Processes. In Proc. FOSSACS’00, LNCS 1784, pages 35–47, 2000. 6. I. Castellani. Bisimulations for Concurrency. PhD thesis, University of Edinburg, 1988. 7. I. Castellani. Process algebras with localities. In J. Bergstra, A. Ponse, S. Smolka, eds., Handbook of Process Algebra, chapter 15, pages 945–1046, 2001. 8. S. Christensen. Distributed bisimilarity is decidable for a class of infinite state systems. In Proc. 3th Int. Conf. Concurrency Theory (CONCUR’92), LNCS 630, pages 148–161, 1992. 9. S. Christensen. Decidability and Decomposition in process algebras. PhD thesis, Dept. of Computer Science, University of Edinburgh, UK, 1993. 10. S. Christensen, Y. Hirshfeld, and F. Moller. Bisimulation equivalence is decidable for Basic Parallel Processes. In Proc. CONCUR’93, LNCS 713, pages 143–157, 1993. 11. P Darondeau and P. Degano. Causal trees. In Proc. ICALP’89, LNCS 372, pages 234–248, 1989. 12. S. Fr¨oschle. Decidability of plain and hereditary history-preserving bisimulation for BPP. In Proc. EXPRESS’99, volume 27 of ENTCS, 1999. 13. R. van Glabbeek and U. Goltz. Equivalence notions for concurrent systems and refinement of actions. In Proc. MFCS’89, LNCS 379, pages 237–248, 1989. 14. R. Gorrieri, M. Roccetti, and E. Stancampiano. A theory of processes with durational actions. Theoretical Computer Science, 140(1):73–94, 1995. 15. M. Hennessy and A. Kiehn. On the decidability of non-interleaving process equivalences. In Proc. 5th Int Conf. Concurrency Theory (CONCUR’94), pages 18–33, 1994. 16. Y. Hirshfeld, M. Jerrum, and F. Moller. A polynomial time algorithm for deciding bisimulation equivalence of normed basic parallel processes. Mathematical Structures in Computer Science, 6:251–259, 1996. 17. H. H¨uttel. Undecidable equivalences for basic parallel processes. In Proc. TACS’94, LNCS 789, pages 454–464, 1994. 18. P. Janˇcar. Bisimilarity of basic parallel processes is PSPACE-complete. In Proc. LICS’03, to appear, 2003. 19. L Jategaonkar and A. R. Meyer. Deciding true concurrency equivalences on safe, finite nets. Theoretical Computer Science, 154:107–143, 1996. 20. M. Jurdzi´nski and M. Nielsen. Hereditary history preserving bisimilarity is undecidable. In Proc. STACS’00, LNCS 1770, pages 358–369, 2000. 21. A. Kiehn. A note on distributed bisimulations. Unpublished draft, 1999. 22. S. Lasota. Decidability of strong bisimilarity for timed BPP. In Proc. 13th Int. Conf. on Concurrency Theory (CONCUR’02), LNCS 2421, pages 562–578. Springer-Verlag, 2002. 23. S. Lasota. On coincidence of distributed and performance equivalence for Basic Parallel Processes. http://www.mimuw.edu.pl/˜sl/papers/, unpublished draft, 2002. 24. S. Lasota. A polynomial-time algorithm for deciding true concurrency equivalences of Basic Parallel Processes. Research Report LSV-02-13, LSV, ENS de Cachan, France, 2002. 25. R. Milner. Communication and Concurrency. Prentice Hall, 1989. 26. J. Srba. Strong bisimilarity and regularity of Basic Parallel Processes is PSPACE-hard. In Proc. STACS’02, LNCS 2285, 2002.
Solving the Sabotage Game Is PSPACE-Hard Christof L¨ oding and Philipp Rohde Lehrstuhl f¨ ur Informatik VII, RWTH Aachen {loeding,rohde}@informatik.rwth-aachen.de
Abstract. We consider the sabotage game as presented by van Benthem. In this game one player moves along the edges of a finite multigraph and the other player takes out a link after each step. One can consider usual algorithmic tasks like reachability, Hamilton path, or complete search as winning conditions for this game. As the game definitely ends after at most the number of edges steps, it is easy to see that solving the sabotage game for the mentioned tasks takes at most PSPACE in the size of the graph. In this paper we establish the PSPACE-hardness of this problem. Furthermore, we introduce a modal logic over changing models to express tasks corresponding to the sabotage games and we show that model checking this logic is PSPACE-complete.
1
Introduction
In some fields of computer science, especially the controlling of reactive systems, an interesting sort of tasks arises, which consider temporal changes of a systems itself. In contrast to the usual tasks over reactive systems, where movements within a system are considered, an additional process affects: the dynamic change of the system itself. Hence we have two different processes: a local movement within the system and a global change of the system. Consider, for example, a network where connections or servers may break down. Some natural questions arise for such a system: is it possible – regardless of the removed connections – to interchange information between two designated servers? Is there a protocol which guarantees that the destination can be reached? Another example for a task of this kind was recently given by van Benthem [1], which can be described as the real Travelling Salesman Problem: is it possible to find your way between two cities within a railway network where a malevolent demon starts cancelling connections? As usual one can model such kind of reactive system as a two-person game, where one player tries to achieve a certain goal given by a winning condition and the other player tries to prevent this. As winning conditions one can consider algorithmic tasks over graphs as, e.g., reachability, Hamilton path, or complete search. Determining the winner of these games gives us the answers for our original tasks. In this paper we show that solving sabotage games where one player (the Runner ) moves along edges in a multi-graph and the other player (the Blocker ) removes an edge in each round is PSPACE-hard for the three mentioned winning B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 531–540, 2003. c Springer-Verlag Berlin Heidelberg 2003
532
Christof L¨ oding and Philipp Rohde
conditions. The main aspect of the sabotage game is that the Runner can only act locally by moving one step further from his actual position whereas the Blocker has the possibility to behave globally on the arena of the game. So the sabotage game is in fact a match between a local and a global player. This distinguishes the sabotage game from the classical games that are studied in combinatorial game theory (see [2] for an overview). In Sect. 2 we introduce the basic notions of the sabotage game. In Sect. 3 we show the PSPACE-hardness for the sabotage game with the reachability condition on undirected graphs by giving a polynomial time reduction from the PSPACE-complete problem of Quantified Boolean Formulas to these games. In Sect. 4 we give polynomial time reductions from sabotage games with reachability condition to the other winning conditions. In the last section we introduce the extension SML of modal logic over transitions systems which captures the concept of removing edges, i.e., SML is a modal logic over changing models. We give the syntax and the semantics of SML and provide a translation to first order logic. By applying the results of the first part we will show that model checking for this logic is PSPACE-complete. We would like to thank Johan van Benthem and Peter van Emde Boas for several ideas and comments on the topic.
2
The Sabotage Game
In this section we give the definition of the sabotage game and we repeat three algorithmic tasks over graphs which can be considered as winning conditions for this game. A multi-graph is a pair (V, e) where V is a non-empty, finite set of vertices and e : V × V → N is an edge multiplicity function, i.e., e(u, v) denotes the number of edges between the vertices u and v. e(u, v) = 0 means that u and v are not connected. In case of an undirected graph we have in addition e(u, v) = e(v, u) for all u, v ∈ V . A single-graph is given by a multiplicity function with e(u, v) ≤ 1 for all vertices u, v ∈ V . The size of a multi-graph (V, e) is given by |V | + |E|, where we set |E| := u,v∈V e(u, v) for directed graphs and |E| := 12 u,v∈V e(u, v) for undirected graphs. Let (V, e0 ) be a multi-graph and v0 ∈ V be an initial vertex. The two-person sabotage game is played as follows: initially the game arena is A0 = (V, e0 , v0 ). The two players, which we call Runner and Blocker, move alternatingly, where the Runner starts his run from vertex v0 . At the start of round n the Runner moves one step further along an existing edge of the graph, i.e., if vn is his actual position, he chooses a vn+1 ∈ V with en (vn , vn+1 ) > 0 and moves to vn+1 . Afterwards the Blocker removes one edge of the graph, i.e., he chooses two vertices u and v somewhere in the graph with en (u, v) > 0. In the directed case we define en+1 (u, v) := en (u, v) − 1 and en+1 (·, ·) := en (·, ·) otherwise. In the undirected case we let en+1 (u, v) := en+1 (v, u) := en (u, v) − 1. The multi-graph An+1 = (V, en+1 , vn+1 ) becomes the arena for the next round. The game ends, if either the Runner cannot make a move, i.e., there is no link starting from his actual position or if the winning condition is fulfilled.
Solving the Sabotage Game Is PSPACE-Hard
533
As winning conditions for the sabotage game on an undirected or directed graph one can consider the usual tasks over graphs, for example: 1. Reachability: the Runner wins iff he can reach a given vertex (which we call the goal ) 2. Hamilton Path or Travelling Salesman: the Runner wins iff he can move along a Hamilton Path, i.e., he visits each vertex exactly once 3. Complete Search: the Runner wins iff he can visit each vertex (possibly more than once) It is easy to see that for the reachability game with one single goal the use of multi-graphs is crucial, but we can bound the multiplicity uniformly by two or, if we allow a second goal vertex, we even can transform every multi-graph game into a single-graph game: Lemma 1. Let G be a sabotage game with reachability condition on a multigraph arena A. Then there are games G , G on arenas A , A with a size polynomial in the size of A such that the Runner wins G iff he wins G , resp. G , and A is a single-graph with two goals and A is a multi-graph with one goal and only single or double edges where the double edges occur only connected with the goal. Proof. We only sketch the proof for directed graphs. To obtain A one adds a new goal and replaces each edge between vertices u and v with multiplicity k > 0 by the construction depicted in Fig. 1 (with k new vertices). We actually need a new goal if v is the original goal. The arena A is constructed similarly: if v is not the original goal we apply the same construction (Fig. 1), but reusing the existing goal instead of adding a new one. If v is the goal then we add double edges from the new vertices to v (see Fig. 2). Note that Blocker does not gain additional moves because all new vertices are directly connected to the goal. u •
•
···
u •
•
v Fig. 1. Replacement for A
•
•
• 2
2
··· v
2
•
•
2
Fig. 2. Replacement for A
Since edges are only deleted but not added during the play the following fact is easy to see: Lemma 2. If the Runner has a winning strategy in the sabotage game with reachability condition then he can win without visiting any vertex twice. In the sequel we will introduce several game arenas where we use edges with a multiplicity ‘high enough’ to ensure that the Blocker cannot win the game
534
Christof L¨ oding and Philipp Rohde
by reducing these edges. In figures these edges are represented by a curly link • . For the moment we can consider these links to be ‘unremovable’. • Due to the previous lemma we have: if the Runner can win the reachability game at all, then he can do so within at most |V | − 1 rounds. Hence we can set the multiplicity of the ’unremovable’ edges to |V | − 1. To bound the multiplicity of edges uniformly one can apply Lemma 1.
3
PSPACE-Hardness for Sabotage Reachability Games
In this section we prove that the PSPACE-complete problem of Quantified Boolean Formulas (cf. [3]), QBF for short, can be reduced by a polynomial time reduction to sabotage games on undirected graphs with the reachability condition. Let ϕ ≡ ∃x1 ∀x2 ∃x3 . . . Qxn ψ be an instance of QBF, where Q is ∃ for n odd and ∀ otherwise and ψ is a quantifier-free Boolean formula in conjunctive normal form. We will construct an undirected game arena for a sabotage game Gϕ with a reachability condition such that the Runner has a winning strategy in the game iff the formula ϕ is satisfiable. A reduction like the classical one from QBF to the Geography Game (cf. [3]) does not work here, since the Blocker may destroy connections in a part of the graph which should be visited only later in the game. This could be solved by blowing up the distances, but this approach results in an arena with a size exponential in the size n of ϕ. So we have to restrict the liberty of the Blocker in a more sophisticated way, i.e., to force him removing edges only ‘locally’. The game arena Gϕ consists of two parts: a chain of n gadgets where first the Runner chooses an assignment for x1 , then the Blocker chooses an assignment for x2 before the Runner chooses an assignment for x3 and so on. The second part gives the Blocker the possibility to select one of the clauses of ψ. The Runner must certify that this clause is indeed satisfied by the chosen assignment: he can reach the goal vertex and win the game iff at least one literal in the clause is true under the assignment. Figure 5 shows an example of the sabotage game Gϕ for the formula ϕ ≡ ∃x1 ∀x2 ∃x3 (c1 ∧c2 ∧c3 ∧c4 ) where we assume that each clause consists of exactly three literals. In the following we describe in detail the several components of Gϕ and their arrangement. The main step of the construction is to take care about the opportunity of the Blocker to remove edges somewhere in the graph. The ∃-Gadget. The gadget where the Runner chooses an assignment for the xi with i odd is displayed in Fig. 3. We are assuming that the run reaches this gadget at vertex A at the first time. Vertex B is intended to be the exit. In the complete construction there are also edges from Xi , resp. Xi leading to the last gadget of the graph, represented as dotted lines labelled by back. We will see later that taking these edges as a shortcut, starting from the ∃-gadget directly to the last gadget is useless for the Runner. The only meaningful direction is coming from the last gadget back to the ∃-gadget. So we temporary assume that
Solving the Sabotage Game Is PSPACE-Hard
in
•
•
•
Xi
in
A 4
4
•
535
•
•
•
D
Xi
•
•
Xi
back
back
•
A 4
4
•
Xi
•
3
C back
back
B
B
out
out
Fig. 3. ∃-gadget for xi with i odd
Fig. 4. ∀-gadget for xi with i even
start
•
•
•
X1
•
•
•
X2
•
•
•
X3
• 4
•
4
• 4
•
4
• 4
•
4
•
•
X1
•
•
•
X2
•
3
•
•
X3
•
• A1 C1 • • •
A2 •
C2 • • •
A3 •
C3
•
• • •
• •
• unremovable link n
• edge of multiplicity n • single edge
•
C4
•
• • •
Fig. 5. The arena for ∃x1 ∀x2 ∃x3 (c1 ∧ c2 ∧ c3 ∧ c4 ) Types of edges: •
A4
536
Christof L¨ oding and Philipp Rohde
the Runner does not take these edges. In the sequel we further assume, due to Lemma 2, that the Runner does not move backwards. The Runner makes his choice simply by moving from A either to the left or to the right. Thereby he moves either towards Xi if he wants xi to be false or towards Xi if he wants xi to be true. We consider only the first case. The Blocker has exactly four steps to remove all the links between Xi and the goal before the Runner reaches this vertex. On the other hand the Blocker cannot remove edges somewhere else in the graph without loosing the game. Why we use four steps here will be clarified later on. If the Runner has reached Xi and he moves towards B then the Blocker has to delete the edge between B and Xi since otherwise the Runner can reach the goal on this way (there are still four edges left between Xi and the goal). The ∀-Gadget. The gadget where the Blocker chooses an assignment for the xi with i even is a little bit more sophisticated. Figure 4 shows the construction. If the Blocker wants xi to be false he tries to lead the Runner towards Xi . In this case he simply removes the three edges between C and Xi during the first three steps. Then the Runner has to move across D and in the meantime the Blocker deletes the four edges between Xi and the goal to ensure that the Runner cannot win directly. As above he removes in the last step the link between B and Xi to prevent a premature end of the game. If the Blocker wants to assign true to xi he should lead the Runner towards Xi . To achieve this aim he removes three of the four links between Xi and the goal before the Runner reaches C. Nevertheless the Runner has the free choice at vertex C whether he moves towards Xi or towards Xi , i.e., the Blocker cannot guarantee that the run goes across Xi . But let us consider the two possible cases: first we assume that the Runner moves as intended and uses an edge between C and Xi . In this round the Blocker removes the last link from Xi to the goal. Then the Runner moves to B and the Blocker deletes the edge from B to Xi . Now assume that the Runner ‘misbehaves’ and moves from C to D and further towards Xi . Then the Blocker first removes the four edges between Xi and the goal. When the Runner now moves from Xi to B the Blocker has to take care that the Runner cannot reach the goal via the link between B and Xi (there is still one edge left from Xi to the goal). For that he can delete the last link between Xi and the goal and isolate the goal completely within this gadget. The Verification Gadget. The last component of the arena is a gadget where the Blocker can choose one of the clauses of the formula ψ. Before we give the representation of this gadget let us explain the idea. If the Blocker chooses the clause c then the Runner can select for his part one literal xi of c. There is an edge back to the ∃-gadget if i is odd or to the ∀-gadget if i is even, videlicet to Xi if xi is positive in c, resp. to Xi if xi is negative in c. So if the chosen assignment satisfies ψ, then for all clauses of ψ there is at least one literal which is true. Since the path through the assignment gadgets visits the opposite truth values this means that there is at least one edge back to an Xi , resp. Xi , which itself is connected to the goal by an edge with a multiplicity of four (assuming
Solving the Sabotage Game Is PSPACE-Hard
537
that the Runner did not misbehave in the ∀-gadget). Therefore the Runner can reach the goal and wins the game. For the converse if the chosen assignment does not satisfy ψ, then there is a clause c in ψ such that every literal in c is assigned false. If the Blocker chooses this clause c then every edge back to the assignment gadgets ends in an Xi , resp. Xi , which is unconnected to the goal. If we show that there is no other way to reach the goal this means that the Runner looses the game. But we have to be very careful neither to allow any shortcuts for the Runner nor to give the Blocker to much liberty. Figure 5 contains the verification gadget for ψ ≡ c1 ∧ c2 ∧ c3 ∧ c4 where each clause ci has exactly three literals. The curly edges at the bottom of the gadget lead back to the corresponding literals of each clause. The Blocker chooses the clause ck by first removing the edges from Aj to Cj for j < k one after the other. Then he cuts the link between Ak and Ak+1 , resp. between Ak and the goal if ck is the last clause. By Lemma 2 it is useless for the Runner to go back, thus he can only follow the given path to Ck . If he reaches this vertex the Blocker must remove the link from Ck to the goal to prevent the win for the opponent. In the next step the Runner selects a literal xi , resp. ¬xi in ck , moves towards the corresponding vertex and afterwards along the curly edge back to the assignment gadgets as described above. At this point the Blocker has exactly two moves left, i.e., he is allowed to remove two edges somewhere in the graph. But we have: if the ‘right’ assignment for this literal has been chosen then there are exactly four edges left connecting the corresponding vertex and the goal. So the Blocker has not the opportunity to isolate the goal and the Runner wins the game. Otherwise, if the ‘wrong’ assignment has been chosen then there is no link from Xi , resp. Xi to the goal left. Any continuation which the Runner could take either leads him back to an already visited vertex (which is a loss by Lemma 2) or, by taking another back -edge in the ‘wrong’ direction, to another vertex in the verification gadget. We handle the latter case in general: if the Runner uses a shortcut starting from a literal vertex and moves directly to the bottom of the verification gadget then the Blocker can prevent the continuation of the run by removing the corresponding single edge between the clause vertex Ck and the vertex beneath and the Runner has to move back. So the Runner wins the game if and only if he wins it without using any shortcut. If the Runner reaches a vertex Ak and the Blocker removes either the edge between Ak and Ck or the one between Ck and the goal or one of the edges leading to the vertices beneath Ck (one for each literal in ck ) then the Runner moves towards Ak+1 , resp. towards the goal if ck is the last clause. The Runner has to do so since, in the latter two cases, entering the ‘damaged’ area around Ck could be a disadvantage for him. Finally we consider the case that the Blocker removes an edge somewhere else in the graph instead. This behaviour is only reasonable if the chosen assignment satisfies ψ. So consider the round when the Runner reaches for the first time an Ak such that the edges from Ak to Ak+1 , resp. the goal, as well as all edges connected to Ck are still left. If ck is the last clause then the Runner just reaches
538
Christof L¨ oding and Philipp Rohde
the goal and wins the game. Otherwise he moves to Ck , chooses an appropriate literal xi , resp. ¬xi such that at least three edges from the corresponding vertex are still left (at least one literal of this kind exists in each clause). Since Ak is the first vertex with this property the Blocker has gained only one additional move, so nevertheless it remains at least one edge from the vertex Xi , resp. Xi to the goal. So if the Runner can chose a satisfying assignment at all then the Blocker cannot prevent the win for the Runner by this behaviour. This explains the multiplicity of four within the assignment gadgets. This completes the construction of the game Gϕ . Obviously, this construction can be done in polynomial time. Therefore, we obtain the following results. Lemma 3. The Runner has a winning strategy in the sabotage game Gϕ iff ϕ is satisfiable. Theorem 4. There is a polynomial time reduction from QBF to sabotage games with reachability winning condition on undirected graphs. In particular solving these games is PSPACE-hard. Since each edge of the game Gϕ has an ‘intended direction’, it is straight forward to check that a similar construction works for directed graphs as well. The construction can also be adapted to prove the PSPACE-hardness of other variants of the game, e.g., if the Blocker is allowed to remove up to n edges in each round for a fixed number n or if the Blocker removes vertices instead of edges. For the details we refer the reader to [4].
4
The Remaining Winning Conditions
In this section we give polynomial time reductions from sabotage games with reachability condition to the ones with complete search condition and with Hamilton path condition. We only consider games on undirected graphs. Let G be a sabotage game on an undirected arena A = (V, e, v0 ) with the reachability condition. We present an arena B such that the Runner wins G iff he wins the game G on B with the complete search condition iff he wins the game G on B with the Hamilton path condition. To obtain B we add several vertices to A: let m := |V | − 2 and let v1 , . . . , vm be an enumeration of all vertices in A except the initial vertex and the goal. We add a sequence P1 , . . . , Pm of new vertices to A together with several chains of new vertices such that each chain has length max{|V |, |E|} and their nodes are linked among each other by ‘unremovable’ edges. We add these chains from Pi as well as from Pi+1 to vertex vi for i < m and one chain from Pm to vertex vm . Furthermore we add for i < m shortcuts from the last vertices in the chains between Pi and vi to the last vertices in the chains between Pi+1 and vi to give the Runner the possibility to skip the visitation of vi . Additionally there is one link with multiplicity |V | from P1 to the goal in A, see Fig. 6. If the Runner can reach the goal in the original game G then by Lemma 2 he can do so within at most |V | − 1 steps. In this case there is at least one link
Solving the Sabotage Game Is PSPACE-Hard
539
|V |
goal •
A start •
v1 v2 v3
•
...
•
•
...
•
•
...
•
•
...
•
•
...
•
P1 P2 P3
max{|V |,|E|}
Fig. 6. Game arena B
to P1 which he uses to reach P1 . He follows the chain to v1 . If he had already visited v1 on his way to the goal he uses the shortcut at the last vertex in the chain, otherwise he visits v1 . Afterwards he moves to P2 using the next chain. Continuing like this he reaches Pm and moves towards the last vertex vm . If he had already visited vm he just stops one vertex before. Otherwise he stops at vm . Moving this way he visits each vertex of B exactly once and wins both games G and G . For the converse: if the Runner cannot reach the goal in G then he cannot do so in the games G and G as well. If he tries to use a shortcut via some Pi the Blocker has enough time on the way to Pi to cut all the links between the goal and P1 . On Runner’s way back from some Pj to a vertex in A he is able to remove all edges in the original game arena A to isolate the goal completely. Thus the Runner looses both games G and G on B. So we have: Theorem 5. There is a polynomial time reduction from sabotage games with reachability condition to sabotage games with complete search condition, resp., with Hamilton path condition. In particular solving these games is PSPACEhard.
5
A Sabotage Modal Logic
In [1] van Benthem considered a ‘sabotage modal logic’, i.e., a modal logic over changing models to express tasks corresponding to sabotage games. He introduced a cross-model modality referring to submodels from which objects have been removed. In this section we will give a formal definition of a sabotage modal logic with a ‘transition-deleting’ modality and we will show how to apply the results of the previous sections to determine the complexity of uniform model checking for this logic. To realise the use of multi-graphs we will interpret the logic over edge-labelled transition systems. By applying Lemma 1 the complexity results for the reachability game can be obtained for multi-graphs with a uniformly bounded multiplicity. Hence we can do with a finite alphabet Σ.
540
Christof L¨ oding and Philipp Rohde
Definition 6. Let p be an unary predicate symbol and a ∈ Σ. Formulae of the sabotage modal logic SML over transition systems are defined by ϕ ::= p | ¬ϕ | ϕ ∨ ϕ | ♦a ϕ | ♦ - aϕ The dual modality a and the label-free versions ♦, are defined as usual. The - a, ♦- and - are defined analogously. modalities Let T = (S, {Ra | a ∈ Σ}, L) be a transition system. For t, t ∈ S and a ∈ Σ a we define the submodel T(t,t ) := (S, {Rb | b ∈ Σ \ {a}} ∪ {Ra \ {(t, t )}}, L). For a given state s ∈ S the semantics of SML is defined as for usual modal logic together with a (T , s) |= ♦ - a ϕ iff there is (t, t ) ∈ Ra such that (T(t,t ) , s) |= ϕ
For a transition system T let Tˆ be the corresponding FO-structure. Similar to the usual modal logic one can translate the logic SML into first order logic. Since FO-model checking is in PSPACE we obtain (see [4] for a proof): Theorem 7. For every SML-formula ϕ there is an effectively constructible FOformula ϕ(x) ˆ such that for every transition system M and state s of M one has ˆ The size of ϕ(x) ˆ is polynomial in the size of ϕ. (T , s) |=SML ϕ iff Tˆ |=FO ϕ[s]. In particular, SML-model checking is in PSPACE. We can express the winning of the Runner in the sabotage game G on directed graphs with the reachability condition by an SML-formula. For that we consider the game arena as a transition system T (G) such that the multiplicity of edges is captured by the edge labelling and such that the goal vertex of the game is viewed as the only state with predicate p. We inductively define the SML-formula - γi ) ∨ p. Then we obtain the following lemma (see γn by γ0 := p and γi+1 := (♦ [4] for a proof) and in combination with Theorem 4 the PSPACE-completeness of SML model checking. Lemma 8. The Runner has a winning strategy from vertex s in the sabotage game G iff (T (G), s) |= γn where n is the number of edges of the game arena. Theorem 9. Model checking for the sabotage logic SML is PSPACE-complete.
References 1. van Benthem, J.: An essay on sabotage and obstruction. In Hutter, D., Werner, S., eds.: Festschrift in Honour of Prof. J¨ org Siekmann. LNAI. Springer (2002) 2. Demaine, E.D.: Playing games with algorithms: Algorithmic combinatorial game theory. In: Proceedings of MFCS 2001. Volume 2136 of LNCS., Springer (2001) 18–32 3. Papadimitriou, C.H.: Computational Complexity. Addison–Wesley (1994) 4. L¨ oding, C., Rohde, P.: Solving the sabotage game is PSPACE-hard. Technical Report AIB-05-2003, RWTH Aachen (2003)
The Approximate Well-Founded Semantics for Logic Programs with Uncertainty Yann Loyer1 and Umberto Straccia2 1
PRiSM, Universit´e de Versailles, 45 Avenue des Etats-Unis, 78035 Versailles, France 2 I.S.T.I. - C.N.R., Via G. Moruzzi,1 I-56124 Pisa, Italy
Abstract. The management of uncertain information in logic programs becomes to be important whenever the real world information to be represented is of imperfect nature and the classical crisp true, false approximation is not adequate. A general framework, called Parametric Deductive Databases with Uncertainty (PDDU) framework [10], was proposed as a unifying umbrella for many existing approaches towards the manipulation of uncertainty in logic programs. We extend PDDU with (non-monotonic) negation, a well-known and important feature of logic programs. We show that, dealing with uncertain and incomplete knowledge, atoms should be assigned only approximations of uncertainty values, unless some assumption is used to complete the knowledge. We rely on the closed world assumption to infer as much default “false” knowledge as possible. Our approach leads also to a novel characterizations, both epistemic and operational, of the well-founded semantics in PDDU, and preserves the continuity of the immediate consequence operator, a major feature of the classical PDDU framework.
1
Introduction
The management of uncertainty within deduction systems is an important issue whenever the real world information to be represented is of imperfect nature. In logic programming, the problem has attracted the attention of many researchers and numerous frameworks have been proposed. Essentially, they differ in the underlying notion of uncertainty (e.g. probability theory [9,13,14,15], fuzzy set theory [16,17,19], multivalued logic [7,8,10], possibilistic logic [2]) and how uncertainty values, associated to rules and facts, are managed. Lakshmanan and Shiri have recently proposed a general framework [10], called Parametric Deductive Databases with Uncertainty (PDDU), that captures and generalizes many of the precedent approaches. In [10], a rule is of the form α A ← B1 , ..., Bn . Computationally, given an assignment I of certainties to the Bi s, the certainty of A is computed by taking the “conjunction” of the certainties I(Bi ) and then somehow “propagating” it to the rule head, taking into account the certainty α of the implication. However, despite its generality, one fundamental issue that remains unaddressed in PDDU is non-monotonic negation, a well-known and important feature in logic programming. In this paper, we extend PDDU [10] to normal logic programs, logic programs with negation. In order to deal with knowledge that is usually not only uncertain, but also incomplete, we believe that one should rely on approximations of uncertainty values only. Then we study the problem of assigning a semantics to a normal logic program in such B. Rovan and P. Vojt´asˇ (Eds.): MFCS 2003, LNCS 2747, pp. 541–550, 2003. c Springer-Verlag Berlin Heidelberg 2003
542
Yann Loyer and Umberto Straccia
a framework. We first consider the least model, show that it extends the Kripke-Kleene semantics [4] from Datalog programs to normal logic programs, but that it is usually to weak. We then explain how one should try to determine approximations as much precise as possible by completing its knowledge by a kind of default reasoning based on the wellknown Closed World Assumption (CWA). Our approach consists in determining how much knowledge “extracted” from the CWA can “safely” be used to “complete” a logic program. Our approach leads to novel characterizations, both epistemic and operational, of the well-founded semantics [3] for logic programs and extends that semantics to PDDU. Moreover we show that the continuity of the immediate consequence operator, used for inferring information from the program, is preserved. This is important as this is a major feature of classical PDDU, opposed to classical frameworks like [8]. Negation has already been considered in some deductive databases with uncertainty frameworks. In [13,14], the stable semantics has been considered, but limited to the case where the underlying uncertainty formalism is probability theory. That semantics has been considered also in [19], where a semi-possibilistic logic has been proposed, a particular negation operator has been introduced and a fixed min/max-evaluation of conjunction and disjunction is adopted. To the best of our knowledge, there is no work dealing with default negation within PDDU, except than our previous attempt [11]. The semantics defined in [11] is weaker than the one presented in this paper, as in the latter approach more knowledge can be extracted from a program, it has no epistemic characterization, and rely on a less natural management of negation. In the remaining, we proceed as follows. In the following section, the syntax of PDDU with negation, called normal parametric programs, is given, Section 3 contains the definitions of interpretation and model of a program. In Section 4, we present the fundamental notion of support of a program provided by the CWA with respect to (w.r.t.) an interpretation. Then we propose novel characterizations of the well-founded semantics and compare our approach with usual semantics. Section 5 concludes.
2
Preliminaries
Consider an arbitrary first order language that contains infinitely many variable symbols, finitely many constants, and predicate symbols, but no function symbols. The predicate symbol π(A) of an atomic formula A given by A = p(X1 , . . . , Xn ) is defined by π(A) = p. The truth-space is given by a complete lattice: atomic formulae are mapped into elements of a certainty lattice L = T , , ⊗, ⊕ (a complete lattice), where T is the set of certainty values, is a partial order, ⊗ and ⊕ are the meet and join operators, respectively. With ⊥ and we denote the least and greatest element in T . With B(T ) we denote the set of finite multisets (denoted {| · }| ) over T . For instance, a typical certainty lattice is L[0,1] = T , , ⊗, ⊕, where T = [0, 1], α β iff α ≤ β, α⊗β = min(α, β), α ⊕ β = max(α, β), ⊥ = 0 and = 1. While the language does not contain function symbols, it contains symbols for families of conjunction (Fc ), propagation (Fp ) and disjunction functions (Fd ), called combination functions. Roughly, as we will see below, the conjunction function (e.g. ⊗) determines the certainty of the conjunction of L1 , ..., Ln α (the body) of a logic program rule like A ← L1 , ..., Ln , a propagation function (e.g. ⊗) determines how to “propagate” the certainty, resulting from the evaluation of the body L1 , ..., Ln , to the head A, by taking into account the certainty α of the implication,
The Approximate Well-Founded Semantics for Logic Programs with Uncertainty
543
while the disjunction function (e.g. ⊕) dictates how to combine the certainties in case an atom appears in the heads of several rules (evaluates a disjunction). Examples of conjunction, propagation and disjunction over L[0,1] are fc (x, y) = min(x, y), fp (x, y) = xy, fd (x, y) = x + y − xy. Formally, a propagation function is a mapping from T × T to T and a conjunction or disjunction function is a mapping from B(T ) to T . Each combination function is monotonic and continuous w.r.t. each one of its arguments. Conjunction and disjunction functions are commutative and associative. Additionally, each kind of function must verify some of the following properties1 : (i) bounded-above: f (α1 , α2 ) αi , for i = 1, 2, ∀α1 , α2 ∈ T ; (ii) bounded-below: f (α1 , α2 ) αi , for i = 1, 2, ∀α1 , α2 ∈ T ; (iii) f ({α}) = α, ∀α ∈ T ; (iv) f (∅) = ⊥; (v) f (∅) = ; and (vi) f (α, ) = α, ∀α ∈ T . The following should be satisfied. A conjunction function in Fc should satisfy properties (i), (iii), (v) and (vi); a propagation function in Fp should satisfy properties (i) and (vi), while a disjunction function in Fd should satisfy properties (ii), (iii) and (iv). We also assume that there is a function from T to T , called negation function, denoted ¬, that is anti-monotone w.r.t. and satisfies ¬¬α = α, ∀α ∈ T . E.g., in L[0,1] , ¬α = 1 − α is quite typical. Finally, a literal is an atomic formula or its negation. Definition 1 (Normal Parametric Program [10]). A normal parametric program P (np-program) is a 5-tuple L, R, C, P, D, whose components are defined as follows: (i) L = T , , ⊗, ⊕ is a complete lattice, where T is a set of certainties partially ordered by , ⊗ is the meet operator and ⊕ the join operator; (ii) R is a finite set of normal α parametric rules (np-rules), each of which is a statement of the form: r : A ←r L1 , ..., Ln where A is an atomic formula, L1 , ..., Ln are literals or values in T and αr ∈ T \ {⊥} is the certainty of the rule; (iii) C maps each np-rule to a conjunction function in Fc ; (iv) P maps each np-rule to a propagation function in Fp ; (v) D maps each predicate symbol in P to a disjunction function in Fd . α
For ease of presentation, we write r : A ←r L1 , ..., Ln ; fd , fp , fc to represent a np-rule in which fd ∈ Fd is the disjunction function associated with π(A) and, fc ∈ Fc and fp ∈ Fp are respectively the conjunction and propagation functions associated with r. Note that, by Definition 1, rules with same head must have the same disjunction function associated. The following example illustrates the notion of np-program. Example 1. Consider an insurance company, which has information about its customers used to determine the risk coefficient of each customer. The company has: (i) data grouped into a set F of facts; and (ii) a set R of rules. Suppose the company has the following database (which is an np-program P = F ∪ R), where a value of the risk coefficient may be already known, but has to be re-evaluated (the client may be a new client and his risk coefficient is given by his precedent insurance company). The certainty lattice is L[0;1] , with fp (x, y) = xy.
F =
1
1 Experience(John) ← 0.7 ⊕, fp , ⊗ Risk(John)
1
← 0.5 ⊕, f , ⊗
p 1 Sport car(John) ← 0.8 ⊕, fp , ⊗
For simplicity, we formulate the properties treating any function as a binary function on T .
544
Yann Loyer and Umberto Straccia
R=
1 Good driver(X) ← Experience(X), ¬Risk(X) ⊕, ⊗, ⊗ 0.8 Risk(X)
Risk(X) Risk(X)
← Young(X), ⊕, fp , ⊗
0.8
← Sport car(X) ⊕, fp , ⊗ 1
← Experience(X), ¬Good driver(X) ⊕, fp , ⊗
Using another disjunction function associated to the rules with head Risk, such as fd (x, y) = x + y − xy, might have been more appropriate in such an example (i.e. we accumulate the risk factors, rather than take the max only), but we will use ⊕ in order to facilitate the reader’s comprehension later on when we compute the semantics of P . We further define the Herbrand base BP of an np-program P as the set of all instantiated atoms corresponding to atoms appearing in P and define P ∗ to be the Herbrand instantiation of P , i.e. the set of all ground instantiations of the rules in P (P ∗ is finite). Note that a Datalog program with negation P is equivalent to the np-program constructed by ret placing each rule in P of the form A←L1 , ..., Ln by the rule A ← L1 , ..., Ln ; ⊕, ⊗, ⊗, where the classical certainty lattice L{t,f } is considered, where L{t,f } = T , , ⊗, ⊕, with T = {t, f }, is defined by f t, ⊕ = max , ⊗ = min , ¬f = t and ¬t = f , ⊥ = f and = t.
3
Interpretations of Programs
The semantics of a program P is determined by selecting a particular interpretation of P in the set of models of P , where an interpretation I of an np-program P is a function that assigns to all atoms of the Herbrand base of P a value in T . In Datalog programs, as well as in PDDU, that chosen model is usually the least model of P w.r.t. 2 . Unfortunately, the introduction of negation may have the consequence that some logic programs do not have a unique minimal model, as shown in the following example. Example 2. Consider the certainty lattice L[0,1] and the program P = {(A←¬B), (B←¬A), (A←0.2), (B←0.3)}. Informally, an interpretation I is a model of the program if it satisfies every rule, while I satisfies a rule X ← Y if I(X) I(Y ) 3 . So, this program has an infinite number of models Ixy , where 0.2 x 1, 0.3 y 1, y ≥ 1 − x, Ixy (A) = x and Ixy (B) = y (those in the A area). There are also an infinite number of minimal models (those on the thin diagonal line). The minimal models Ixy are such that y = 1 − x. 2 Concerning the previous example we may note that the certainty of A in the minimal models is in the interval [0.2, 0.7], while for B the interval is [0.3, 0.8]. An obvious question is: what should be the answer to a query A to the program proposed in Example 2? There are at least two answers: (i) the certainty of A is undefined, as there is no unique minimal model. This is clearly a conservative approach, which in case of ambiguity prefers to leave A unspecified; (ii) the certainty of A is in [0.2, 0.7], which means that even if there is no unique value for A, in all minimal models the certainty of A is in [0.2, 0.7]. In this approach we still try to provide some information. Of course, some 2 3
is extended to the set of interpretations as follows: I J iff for all atoms A, I(A) J(A). Roughly, X ← Y dictates that “X should be at least as true as Y .
The Approximate Well-Founded Semantics for Logic Programs with Uncertainty
545
care should be used. Indeed from I(A) ∈ [0.2, 0.7] and I(B) ∈ [0.3, 0.8] we should not conclude that I(A) = 0.2 and I(B) = 0.3 is a model of the program. Applying a usual approach, like the well-founded semantics [18] or the Kripke-Kleene semantics [4], would lead us to choose the conservative solution 1. This was also the approach in our early attempt to deal with normal parametric programs [11]. Such a semantics seems to be too weak, in the sense that it loses some knowledge (e.g. the value of A should be at least 0.2). In this paper we address solution 2. To this end, we propose to rely on T × T . Any element of T × T is denoted by [a; b] and interpreted as an interval on T , i.e. [a; b] is interpreted as the set of elements x ∈ T such that a x b. For instance, turning back to Example 2 above, in the intended model of P , the certainty of A is “approximated” with [0.2; 0.7], i.e. the certainty of A lies in between 0.2 and 0.7 (similarly for B). Formally, given a complete lattice L = T , , ⊗, ⊕, we construct a bilattice over T ×T , according to a well-known construction method (see [3,6]). We recall that a bilattice is a triple B, t , k , where B is a nonempty set and t , k are both partial orderings giving to B the structure of a lattice with a top and a bottom [6]. We consider B = T ×T with orderings: (i) the truth ordering t , where [a1 ; b1 ] t [a2 ; b2 ] iff a1 a2 and b1 b2 ; and (ii) the knowledge ordering k , where [a1 ; b1 ] k [a2 ; b2 ] iff a1 a2 and b2 b1 . The intuition of those orders is that truth increases if the interval contains greater values (e.g. [0.1; 0.4] t [0.2; 0.5]), whereas the knowledge increases when the interval (i.e. in our case the approximation of a certainty value) becomes more precise (e.g. [0.1; 0.4] k [0.2; 0.3], i.e. we have more knowledge). The least and greatest elements of T × T are respectively (i) f = [⊥; ⊥] (false) and t = [; ] (true), w.r.t. t ; and (ii) ⊥ = [⊥; ] (unknown – the less precise interval, i.e. the atom’s certainty value is unknown) and = [; ⊥] (inconsistent – the empty interval) w.r.t. k . The meet, join and negation on T × T w.r.t. both orderings are defined by extending the meet, join and negation from T to T × T in the natural way: let [a1 ; b1 ], [a2 ; b2 ] ∈ T × T , then – [a1 ; b1 ] ⊗t [a2 ; b2 ] = [a1 ⊗ a2 ; b1 ⊗ b2 ] and [a1 ; b1 ] ⊕t [a2 ; b2 ] = [a1 ⊕ a2 ; b1 ⊕ b2 ]; – [a1 ; b1 ] ⊗k [a2 ; b2 ] = [a1 ⊗ a2 ; b1 ⊕ b2 ] and [a1 ; b1 ] ⊕k [a2 ; b2 ] = [a1 ⊕ a2 ; b1 ⊗ b2 ]; – ¬[a1 ; b1 ] = [¬b1 ; ¬a1 ]. ⊗t and ⊕t (⊗k and ⊕k ) denote the meet and join operations on T × T w.r.t. the truth (knowledge) ordering, respectively. For instance, taking L[0,1] , [0.1; 0.4] ⊕t [0.2; 0.5] = [0.2; 0.5], [0.1; 0.4]⊗t [0.2; 0.5] = [0.1; 0.4], [0.1; 0.4]⊕k [0.2; 0.5] = [0.2; 0.4], [0.1; 0.4] ⊗k [0.2; 0.5] = [0.1; 0.5] and ¬[0.1; 0.4] = [0.6; 0.9]. Finally, we extend in a similar way the combination functions from T to T × T . Let fc (resp. fp and fd ) be a conjunction (resp. propagation and disjunction) function over T and [a1 ; b1 ], [a2 ; b2 ] ∈ T × T : (i) fc ([a1 ; b1 ], [a2 ; b2 ]) = [fc (a1 , a2 ); fc (b1 , b2 )]; (ii) fp ([a1 ; b1 ], [a2 ; b2 ]) = [fp (a1 , a2 ); fp (b1 , b2 )]; and (iii)fd ([a1 ; b1 ], [a2 ; b2 ]) = [fd (a1 , a2 ); fd (b1 , b2 )]. It is easy to verify that these extended combination functions preserve the original properties of combination functions.The following theorem holds. Theorem 1. Consider T × T with the orderings t and k . Then (i) ⊗t , ⊕t , ⊗k , ⊕k and the extensions of combination functions are continuous (and, thus, monotonic) w.r.t. t and k ; (ii) any extended negation function is monotonic w.r.t. k ; and (iii) if the negation function satisfies the de Morgan laws, i.e. ∀a, b ∈ T .¬(a ⊕ b) = ¬a ⊗ ¬b then the extended negation function is continuous w.r.t. k .
546
Yann Loyer and Umberto Straccia
Proof: We proof only the last item, as the others are immediate. Consider a chain of intervals x0 k x1 k . . ., where xj = [aj ; bj ] with aj , bj ∈ T . To show the continuity of the extended negation function w.r.t. k , we show that ¬ ⊕kj≥0 xj = ⊕kj≥0 ¬xj : ¬ ⊕kj≥0 xj = ¬[⊕j≥0 aj ; ⊗j≥0 bj ] = [¬ ⊗j≥0 bj ; ¬ ⊕j≥0 aj ] = [⊕j≥0 ¬bj ; ⊗j≥0 ¬aj ] = ⊕kj≥0 [¬bj ; ¬aj ] = ⊕kj≥0 ¬[aj ; bj ] = ⊕kj≥0 ¬xj . We can now extend interpretations over T to the above specified “interval” bilattice. Definition 2 (Approximate Interpretation). Let P be an np-program. An approximate interpretation of P is a total function I from the Herbrand base BP to the set T × T . The set of all the approximate interpretations of P is denoted CP . Intuitively, assigning the logical value [a; b] to an atom A means that the exact certainty value of A lies in between a and b with respect to . Our goal will be to determine for each atom of the Herbrand base of P the most precise interval that can be inferred. At first, we extend the two orderings on T ×T to the set of approximate interpretations CP in a usual way: let I1 and I2 be in CP , then (i) I1 t I2 iff I1 (A) t I2 (A), for all ground atoms A; and (ii) I1 k I2 iff I1 (A) k I2 (A), for all ground atoms A. Under these two orderings CP becomes a complete bilattice. The meet and join operations over T × T for both orderings are extended to CP in the usual way (e.g. for any atom A, (I ⊕k J)(A) = I(A) ⊕k J(A)). Negation is extended similarly, for any atom A, ¬I(A) = I(¬A), and approximate interpretations are extended to T , for any α ∈ T , I(α) = [α; α]. At second, we identify the models of a program. The definition extends the one given in [10] to intervals. Definition 3 (Models of a Logic Program). Let P be an np-program and let I be an approximate interpretation of P . α
1. I satisfies a ground np-rule r : A ←r L1 , ..., Ln ; fd , fp , fc in P , denoted |=I r, iff fp ([αr ; αr ], fc ({|I(L1 ), . . . , I(Ln )|})) t I(A); 2. I is a model of P , or I satisfies P , denoted |=I P , iff for all atoms A ∈ BP , fd (X) t I(A) where fd is the disjunction function associated with π(A) and α X = {|fp ([αr ; αr ], fc ({|I(L1 ), . . . , I(Ln )|})): A ←r L1 , ..., Ln ; fd , fp , fc ∈ P ∗}| . At third, among all possible models of an np-program, we have now to specify which one is the intended model. The characterization of that model will require the definition of an immediate consequence operator that will be used to infer knowledge from a program. That operator is a simple extension from T to T × T of the immediate consequence operator defined in [10] to give semantics to classical PDDU. Definition 4. Let P be any np-program. The immediate consequence operator TP is a mapping from CP to CP , defined as follows: for every interpretation I, for every ground atom A, TP (I)(A) = fd (X), where fd is the disjunction function associated with π(A) α and X = {|fp ([αr ; αr ], fc ({|I(L1 ), . . . , I(Ln )|})): A ←r L1 , ..., Ln ; fd , fp , fc ∈ P ∗}| . Note that from the property (iv) of combination functions satisfied by all disjunction functions, it follows that if an atom A does not appear as the head of a rule, then TP (I)(A) = f. Note also that any fixpoint of TP is a model of P . We have Theorem 2. For any np-program P , TP is monotonic and, if the de Morgan laws hold, continuous w.r.t. k .
The Approximate Well-Founded Semantics for Logic Programs with Uncertainty
547
Proof: The proof of monotonicity is easy. To prove the continuity w.r.t. k , consider a chain of interpretations I0 k I1 k . . .. We show that for any A ∈ BP , TP (⊕kj≥0 Ij )(A) = ⊕kj≥0 TP (Ij )(A) (Eq. 1). As CP is a complete lattice, the sequence I0 k I1 k . . . ¯ has a least upper bound, say I¯ = ⊕kj≥0 Ij . For any B ∈ BP , we have ⊕kj≥0 Ij (B) = I(B) k k k ¯ and, from Theorem 1, ⊕j≥0 Ij (¬B) = ⊕j≥0 ¬Ij (B) = ¬ ⊕j≥0 Ij (B) = ¬I(B) and, ¯ thus, for any literal or certainty value L, ⊕kj≥0 Ij (L) = I(L) (Eq. 2) Now, consider the finite set (P ∗ is finite) of all ground rules r1 , . . . , rk having A as head, where α ri = A ←i Li1 , ..., Lini ; fd , fpi , fci ). Let us evaluate the left hand side of Equation (1). ¯ ¯ i ), . . . , I(L ¯ i }| )): 0 ≤ i ≤ TP (⊕kj≥0 Ij )(A) = TP (I)(A) = fd ({|fpi ([αi ; αi ], fci ({|I(L ni 1 k k i k|}). On the other hand side, ⊕j≥0 TP (Ij )(A) = ⊕j≥0 fd ({|fp ([αi ; αi ], fci ({|Ij (Li1 ),. . . , Ij (Lini }| )): 0 ≤ i ≤ k|}). But, fd , fpi and fci are continuous and, thus, by Equation (2), ⊕kj≥0 TP (Ij )(A) = fd ({| ⊕kj≥0 {fpi ([αi ; αi ], fci ({|Ij (Li1 ),. . . , Ij (Lini }| )): 0 ≤ i ≤ k}|}) = fd ({|fpi ([αi ; αi ], ⊕kj≥0 {fci ({|Ij (Li1 ), . . . , Ij (Lini }| )}): 0 ≤ i ≤ k|}) = fd ({|fpi ([αi ; αi ], ¯ i ), . . . , fci ({| ⊕kj≥0 Ij (Li1 ), . . . , ⊕kj≥0 Ij (Lini }| )): 0 ≤ i ≤ k|}) = fd ({|fpi ([αi ;αi ],fci ({|I(L 1 i ¯ I(Lni }| )): 0 ≤ i ≤ k|}). Therefore, Equation (1) holds and, thus, TP is continuous.
4
Semantics of Normal Logic Programs
Usually, the semantics of a normal logic program is the least model of the program w.r.t. the knowledge ordering. That model always exists and coincides with the the least fixed-point of TP with respect to k (which exists as TP is monotonic w.r.t. k ). Note that this least model with respect to k corresponds to an extension of the classical KripkeKleene semantics [4] of Datalog programs with negation to normal parametric programs: if we restrict our attention to Datalog with negation, then we have to deal with four values [f ; f ], [t; t], [f ; t] and [t; f ] that correspond to the truth values false, true, unknown and inconsistent, respectively. Then, our bilattice coincides with Belnap’s logic [1] and for any Datalog program with negation P , the least fixed-point of TP w.r.t. k is a model of P that coincides with the Kripke-Kleene semantics of P . To illustrate the different notions introduced in the paper, we rely on the Example 3. Example 3 (Running example). The certainty lattice is L[0,1] and the np-program is 1
1
1
P = {(A ← B, 0.6; ⊕, ⊗, ⊗), (B ← B; ⊕, ⊗, ⊗), (A ← 0.3; ⊕, ⊗, ⊗)}.
2
For ease of presentation, we represent an interpretation as a set of expressions of the form A: [x; y], where A is a ground atom, indicating that I(A) = [x; y]. E.g. the following sequence of interpretations I0 , I1 , I2 shows how the Kripke- Kleene semantics, KKP , of the running Example 3 is computed (as the iterated fixed-point of TP , starting from I0 = I⊥ , the k minimal interpretation that maps any A ∈ BP to [⊥; ], and In+1 = TP (In )): I0 = {A: [0; 1], B: [0; 1]}, I1 = {A: [0.3; 0.6], B: [0; 1]}, I2 = I1 = KK(P ). In that model, which is minimal w.r.t. k and contains only the knowledge provided by P , the certainty of B lies between 0 and 1, i.e. is unknown, and the certainty of A then lies between 0.3 and 0.6. As well known, that semantics is usually considered as too weak. We propose to consider the Closed World Assumption (CWA) to complete our knowledge (the CWA assumes that all atoms whose value cannot be inferred from the program are false by default). This is done by defining the notion of support, introduced
548
Yann Loyer and Umberto Straccia
in [12], of a program w.r.t. an interpretation. Given a program P and an interpretation I, the support of P w.r.t. I, denoted CP (I), determines in a principled way how much false knowledge, i.e. how much knowledge provided by the CWA, can “safely” be joined to I w.r.t. the program P . Roughly speaking, a part of the CWA is an interpretation J such that J k If , where If maps any A ∈ BP to [⊥; ⊥], and we consider that such an interpretation can be safely added to I if J k TP (I ⊕k J), i.e. if J does not contradict the knowledge represented by P and I. Definition 5. The support of an np-program P w.r.t. an interpretation I, denoted CP (I), is the maximal interpretation J w.r.t. k such that J k If and J k TP (I ⊕k J). k It is easy to note that CP (I) = {J | J k If and J k TP (I ⊕k J)}. The following theorem provides an algorithm for computing the support. Theorem 3. CP (I) coincides with the iterated fixpoint of the function FP,I beginning the computation with If , where FP,I (J) = If ⊗k TP (I ⊕k J). From Theorems 1 and 2, it can be shown that FP,I is monotone and, if the de Morgan laws hold, continuous w.r.t. k . It follows that the iteration of the function FP,I starting from If decreases w.r.t. k . We will refer to CP as the closed world operator. Corollary 1. Let P be an np-program. The closed world operator CP is monotone and, if the de Morgan laws hold, continuous w.r.t. the knowledge order k . The following sequence of interpretations J0 , J1 , J2 shows the computation of CP (KKP ), i.e. the additional knowledge that can be considered using the CWA on the Kripke-Kleene semantics KKP of the running Example 3 (I = KKP , J0 = If and Jn+1 = FP,I (Jn )): J0 = {A: [0; 0], B: [0; 0]}, J1 = {A: [0.0; 0.3], B: [0; 0]}, J2 = J1 = CP (KKP ). CP (KKP ) asserts that, according to the CWA and w.r.t. P and KKP , the certainty of A should be at most 0.3, while that of B is exactly 0. We have now two ways to infer information from an np-program P and an approximate interpretation I: using TP and using CP . To maximize the knowledge derived from P and the CWA, but without introducing any other extra knowledge, we propose to choose the least model of P containing its own support, i.e. that cannot be completed anymore according to the CWA, as the semantics of P . This consideration leads to the following epistemic definition of semantics of a program P . Definition 6. The approximate well-founded semantics of an np-program P , denoted WP , is the least model I of P w.r.t. k such that CP (I) k I. Now we provide a fixpoint characterization and, thus, a way of computation of the approximate well-founded semantics. It is based on an operator, called approximate well-founded operator, that combines the two operators that have been defined above. Given an interpretation I, we complete it with its support provided by the CWA, and then activate the rules of the program on the obtained interpretation using the immediate consequence operator. Definition 7. Let P be an np-program. The approximate well-founded operator, denoted AWP , takes in input an approximate interpretation I ∈ CP and returns AWP (I) ∈ CP defined by AWP (I) = TP (I ⊕k CP (I)).
The Approximate Well-Founded Semantics for Logic Programs with Uncertainty
549
From [12], the following theorems can be shown. Theorem 4. Let P be an np-program. Any fixed-point I of AWP is a model of P . Using the properties of monotonicity and continuity of TP and CP w.r.t. the knowledge order k over CP , from the fact that CP is a complete lattice w.r.t. k , by the well-known Knaster-Tarski theorem, it follows that Theorem 5. Let P be an np-program. The approximate well-founded operator AWP is monotone and, if the de Morgan laws hold, continuous w.r.t. the knowledge order k . Therefore, AWP has a least fixed-point w.r.t. the knowledge order k . Moreover that least fixpoint