Information Processing Letters 80 (2001) 145–150
Set constraints and topology Franck Seynhaeve LIFL, Bât M3, Université Lille 1, F59655 Villeneuve d’Ascq cedex, France Received 17 January 2000; received in revised form 11 December 2000 Communicated by H. Ganzinger
Abstract Set constraints are inclusions between expressions denoting sets of trees. Such expressions are first-order terms with or without set operators. Many results in the literature on set constraints are topological in flavor. In this paper, we notice that the set of solutions of a system of set constraints of the class (PNSC) (class of positive and negative set constraints) is the intersection of a closed set and of an open set. This allows us to prove that the class (PSCP) (class of positive set constraints with projection) is strictly more expressive than the class (PNSC). 2001 Elsevier Science B.V. All rights reserved. Keywords: Set constraints; Formal languages; Topology; Expressivity
1. Introduction Set constraints are inclusions between expressions denoting sets of trees which are used in program analysis and type inference. Such expressions are firstorder terms with or without set operators. Many results in the literature on set constraints are topological in flavor. In [6], Kozen studies the topological structure of the set of solutions of systems of set constraints. He defines rational spaces, a family of topological spaces which formalize the notion of a topological space with a regular or self-similar structure (such as the Cantor Discontinuum), and gives a complete characterization of the sets of solutions of systems of set constraints in terms of rational spaces. In [1], Aiken et al. prove that the class (PNSC) (class of positive and negative set constraints without any projection) is strictly more expressive in sense of set of solutions than the class (PSC) (class of E-mail address:
[email protected] (F. Seynhaeve).
positive set constraints without any projection). The proof of this result is based on a compactness lemma which states that a system of positive set constraints is satisfiable if and only if all finite subsets are satisfiable. As mentioned in [6,9], this result can be obtained in another way. Indeed the fact that negative set constraints can express something that positive set constraints alone cannot is a simple consequence of the observation that the set of solutions of all systems of positive set constraints is closed, whereas the set of solutions of the negative set constraints X ⊆ ∅ is not closed. In [9], Tommasi proves using Tree Set Automata that the set of solutions of a system of set constraints of the class (PSC) is compact. Topological studies of automata can be also found in [5,8]. In [7], Staiger proves that several hierarchies of ω-languages are topologically based, that is, the distinctness of their classes can be proven by topogical means already. In this paper, we notice that the set of solutions of a system of set constraints of the class (PNSC) is
0020-0190/01/$ – see front matter 2001 Elsevier Science B.V. All rights reserved. PII: S 0 0 2 0 - 0 1 9 0 ( 0 1 ) 0 0 1 5 7 - 0
146
F. Seynhaeve / Information Processing Letters 80 (2001) 145–150
the intersection of a closed set and of an open set. This allows us to prove that the class (PSCP) (class of positive set constraints with projection) is strictly more expressive than the class (PNSC). Plan of the paper. Section 2 contains preliminaries and Section 3 results. 2. Preliminaries 2.1. Sets and terms Sets. Let n ∈ N and A, B be two sets. Let [n] be the set {1, . . . , n} (hence [0] = ∅), A B be the symmetrical difference of A and B, CA B = A \ B be the complement of B with respect to A and 2A be the set of subsets of A. Ranked alphabet. An alphabet Σ is ranked if Σ = Σ where each Σp is a finite set and, only for p p a finite number of p’s, Σp = ∅. Elements of Σp are said to be of arity p. Elements of arity 0, 1, . . . , p are respectively called constants, unary, . . . , p-ary symbols. In the following, f/p will denote a p-ary symbol f . Terms. Let Σ be a ranked alphabet and X be a set of symbols called variables. The set of terms over Σ ∪ X , denoted TΣ (X ), is the least set satisfying: • variables and constants are terms, i.e., (X ∪ Σ0 ) ⊆ TΣ (X ); • if f ∈ Σp and t1 , . . . , tp ∈ TΣ (X ), then f (t1 , . . . , tp ) ∈ TΣ (X ). If X = ∅ then TΣ (X ) is denoted by TΣ . The height h(t) of a term t is the length of the longest path starting from the root, i.e.: • h(t) = 0 if t ∈ X ∪ Σ0 , i.e., t is either a variable or a constant; • h(t) = 1 + max({h(ti ) | i ∈ [p]}) if t = f (t1 , . . . , tp ), p = 0. 2.2. Topology This section recalls results which can be found in books of topology (in particular in [4]). Topological space. A topology in a set X is a family T of subsets of X satisfying: ∅ and X are members of
T , and each union or finite intersection of members of T is also a member of T . A pair (X, T ) consisting of a set X and a topology T in X is called a topological space and the members of T are called the open sets of (X, T ). Closed sets. Let (X, T ) be a topological space and Y ⊆ X. Y is a closed set if CX Y is an open set. The set F of closed sets of (X, T ) satisfies: ∅ and X are members of F , and each intersection or finite union of members of F is also a member of F . Continuous map. Let (X, TX ), (Y, TY ) be two topological spaces. A map f : X → Y is said continuous if the inverse image of each open set in Y is an open set in X. Theorem 1. Let (X, TX ), (Y, TY ) and (Z, TZ ) be topological spaces. • f : X → Y is continuous if and only if the inverse image of each closed set in Y is a closed set in X. • If f : X → Y and g : Y → Z are continuous, so also is g ◦ f : X → Z (composition). Metric. Let E be a set. A metric (or distance function) on the set E is a map d : E × E → R with the properties: • d(x, y) 0 for each pair x, y; • d(x, y) = 0 if and only if x = y; • d(x, y) = d(y, x) for all x, y (d is symmetric); • d(x, z) d(x, y) + d(y, z) (d satisfies the triangle inequality). d(x, y) is called the distance between x and y and a pair (E, d) consisting of a set E and a metric d on E is called a metric space. Balls. Let (E, d) a metric space, x ∈ E and r > 0. The set B(x, r) = {y | d(x, y) < r} is called open ball of center x and radius r. If r 0, the set BF (x, r) = {y | d(x, y) r} is called closed ball of center x and radius r. Theorem 2. Let (E, d) be a metric space. Then (E, T ) is a topological space where T is the set of subsets A of E satisfying either A = ∅, or ∀x ∈ A, ∃r > 0, B(x, r) ⊆ A.
F. Seynhaeve / Information Processing Letters 80 (2001) 145–150
Let us remark that each open ball of E is an open set and each closed ball of E is a closed set of the topological space (E, T ). Sequence. A sequence in a metric space (E, d) is a family (un )n∈N of elements of E. The sequence (un )n∈N converges to l ∈ E if limn→∞ d(un , l) = 0. Theorem 3. Let F be a closed set in E and (un )n∈N be a sequence in F . Then if (un )n∈N converges to l, l is an element of F . 2.3. Set constraints Let Σ be a ranked alphabet, Σ −1 = {fi−1 | f ∈ Σp , 1 i p} be a set of unary symbols (projection symbols), Σs = {/0, ⊥/0, /1, ∪/2, ∩/2} be a set of special symbols and X be a set of variables. A set expression is a term in TΣ (X ) where Σ = Σ ∪ Σ −1 ∪ Σs . A set constraint is either a positive set constraint of the form e ⊆ e or a negative set constraint of the form e ⊆ e (or ¬(e ⊆ e )) where e and e are set expressions. A system of set constraints is de fined by ki=1 SCi where the SCi are set constraints. An interpretation is a map from X into 2TΣ . Each interpretation I can immediately be extended to each expression in the following way: I() = TΣ I(⊥) = ∅ I f (e1 , . . . , ep ) = f I(e1 ), . . . , I(ep ) I fi−1 (e) = ti | f (t1 , . . . , ti , . . . , tp ) ∈ I(e) I(e) = TΣ \ I(e)
I(e ∪ e ) = I(e) ∪ I(e ) I(e ∩ e ) = I(e) ∩ I(e ) An interpretation I satisfies a positive set constraint e ⊆ e if I(e) ⊆ I(e ) and a negative set constraint e ⊆ e if I(e) ⊆ I(e ). I satisfies a system of set constraints SC = ki=1 SCi if and only if it satisfies each set constraint SCi . For a system of set constraints SC, all the interpretations I satisfying SC are called solutions of SC. We denote by Sol(SC) the set of all solutions of SC. In the remainder, when a system of set constraints SC of n variables X1 , . . . , Xn will be considered, we
147
will identify a solution I of SC and a n-tuple of set of terms (I(X1 ), . . . , I(Xn )). Definition 4. The class (PSC), respectively (PSCP), is the class of systems of positive set constraints without, respectively with, possible occurrences of projection symbols. The class (PNSC) is the class of systems of positive and negative set constraints where no projection symbol occurs. Expressivity. Let (S1) and (S2) be two classes of set constraints. The class (S2) is said to be at least as expressive as the class (S1) in term of set of solutions if and only if for each system of set constraints of the class (S1), there exists a system of set constraints of the class (S2) with the same set of solutions.
3. Set constraints and topology 3.1. Metric on the set (2TΣ )n The usual metric on the set 2TΣ is d1 : 2TΣ × 2TΣ → R defined by d1 (S, S ) = 0 if S = S , else d1 (S, S ) = 2−m with m = min({h(t) | t ∈ S S }). Let n ∈ N, n = 0. Using the usual method of definition of a metric on a cartesian product, we define the following metric dn on (2TΣ )n : dn : (2TΣ )n × (2TΣ )n → R (S1 , . . . , Sn ), (S1 , . . . , Sn ) → max {d1 (Si , Si ) | i ∈ [n]} . Obviously, for each S = (S1 , . . . , Sn ) and S = (S1 , . . . , Sn ) in (2TΣ )n , dn (S, S ) = 0 if S = S , else dn (S, S ) = 2−m with m = min({h(t) | ∃i ∈ [n], t ∈ Si Si }).
In the following, for every n 1, the topology on (2TΣ )n is that induced by the metric dn . 3.2. Class of Positive Set Constraints (PSC) In [9], Tommasi considers the topology defined in the previous section and proves using Tree Set Automata that the set of solutions of a system of set constraints of the class (PSC) is closed (more exactly compact). Let us give another proof of this
148
F. Seynhaeve / Information Processing Letters 80 (2001) 145–150
result. Let us first associate a map with each symbol of {∪, ∩, } ∪ Σ:
3.3. Class of Positive and Negative Set Constraints (PNSC)
F∪ : (2TΣ )2 → 2TΣ
Lemma 6. Let SC be a system of set constraints of the class (PNSC), then Sol(SC) is the intersection of a closed set and of an open set.
such that F∪ (X, Y ) = X ∪ Y, F∩ : (2TΣ )2 → 2TΣ such that F∩ (X, Y ) = X ∩ Y, F : 2
TΣ
→2
such that F (X) = TΣ \ X, ∀f ∈ Σp , Ff : (2TΣ )p → 2TΣ such that Ff (X1 , . . . , Xp ) = f (X1 , . . . , Xp ), and we define for each integer n, n = 0, and each i in [n], a map Fin : Fin : (2TΣ )n → 2TΣ such that Fin (X1 , . . . , Xn ) = Xi
(projection).
We can prove that the inverse image of each open set by one of these maps is an open set hence these maps are continuous. Proposition 5. The set of solutions of a system of set constraints of the class (PSC) is closed. Proof. Let SC = ki=1 ei ⊆ ei be a system of set constraints of (PSC) with n variables. For each i ∈ [k], let φi : (2TΣ )n → 2TΣ be the map defined as follows: for every (X1 , . . . , Xn ) ∈ (2TΣ )n , if I is the interpretation corresponding to this n-tuple then φi (X1 , . . . , Xn ) = I(ei ) \ I(ei ). Note that for every i ∈ [k], φi is the composition of maps Fin , F∪ , F∩ , F , Ff hence φi is continuous and φi−1 ({∅}) is closed according to Theorem 1. Moreover Sol(ei ⊆ ei ) = I | I(ei ) \ I(ei ) = ∅ = φi−1 {∅} . Finally Sol(SC) =
Proof. Let
TΣ
k
φi−1 {∅}
i=1
is closed since the intersection of closed sets is closed.
SC =
k
l
ei ⊆ ei ∧
i=1
ei ⊆ ei
i=k+1
be a system of set constraints of (PNSC) with n variables. k
Sol(SC) = Sol(ei ⊆ ei ) ∩ i=1 l
Sol(ei ⊆ ei )
.
i=k+1
The set i∈[k] Sol(ei ⊆ ei ) is closed (Proposition 5). Let us now consider i ∈ N, k + 1 i l. Sol(ei ⊆ ei ) = C(2TΣ )n Sol(ei ⊆ ei ). Sol(ei ⊆ ei ) is closed since it is a solution of a set constraint of the class (PSC) (Proposition 5). Its complement is open. Therefore the finite intersec tion li=k+1 Sol(ei ⊆ ei ) is open which ends the proof. ✷ 3.4. Expressiveness Let us first recall that when Σ contains no symbol of arity at least two, the class (PSCP) is equal to the class (PSC) and then is strictly less expressive than the class (PNSC) [1]. When Σ contains at least one symbol of arity greater than two, the expressivity of the class (PSC) is only increased by set contraints of the form X ⊆ f1−1 (Y ). Let us now prove the following theorem: Theorem 7. When Σ contains at least one constant and one symbol of arity at least two, the class (PSCP) is strictly more expressive than the class (PNSC). Proof. Assume that Σ contains at least one constant a and one symbol f of arity p 2. We first prove that the class (PSCP) is at least as expressive as the
F. Seynhaeve / Information Processing Letters 80 (2001) 145–150
class (PNSC). Indeed, each negative set constraint without any projection e ⊆ e is equivalent to the constraint e ∩ e ⊆ ∅ and hence equivalent to the constraint a ⊆ fp−1 (f (e ∩ e, a, . . ., a)) (this result is also mentioned in [2,3]). We now prove that the class (PSCP) is strictly more expressive than the class (PNSC). We give an example of a system of set constraints of the class (PSCP) whose set of solutions cannot be the set of solutions of any system of set constraints of the class (PNSC) (we illustrate the proof for the case p = 2 but similar arguments can be used for p > 2). Let Σ = {a, f/2}, X = {X, Y } and the system SC of set constraints of (PSCP) composed of the unique set constraint Y ⊆ f1−1 (X). Let us suppose that Sol(SC) is the set of solutions of a system of set constraints of the class (PNSC). According to Lemma 6, Sol(SC) = Closed ∩ Open where Closed is a closed set and Open an open set. Let (tn )n∈N be the sequence defined by t0 = a and ∀p ∈ N, tp+1 = f (tp , a), and y S0 = S0x , S0 = {f (tn , tn ) | n ∈ N}, {tn | n ∈ N} . S0 is a solution of the system SC hence it belongs to Open. According to Theorem 2, there exists r > 0 such that B(S0 , r) ⊆ Open since Open = ∅. Hence there exists n0 ∈ N, n0 = 0 such that B(S0 , 2−(n0 −1) ) ⊆ Open. We deduce that the closed ball BF = BF (S0 , 2−n0 ) is a subset of Open. Hence Closed ∩BF ⊆ Sol(SC). Moreover the set Closed ∩BF is closed. Let us now consider (Sp )p∈N the sequence defined for every p ∈ N by: y Sp = Spx , Sp = {f (tn , tn ) | n n0 } ∪ {f (tn , tn+p ) | n > n0 }, {tn | n ∈ N} . For each p ∈ N, Sp ∈ Sol(SC) hence Sp ∈ Closed. Moreover for each p ∈ N, p = 0, d2 (S0 , Sp ) = 2−(n0 +2) since h(f (tn0 +1 , tn0 +1 )) = n0 + 2 and: S0x Spx = f (tn , tn ) | n > n0 ∪ f (tn , tn+p ) | n > n0 . Hence Sp ∈ BF. Finally (Sp )p∈N is a sequence in Closed ∩BF. Let us now prove that (Sp )p∈N converges to S = (S x , S y ) = {f (tn , tn ) | n n0 }, {tn | n ∈ N} .
149
Let p ∈ N. Spx S x = {f (tn , tn+p ) | n > n0 } hence d2 (Sp , S) = 2−(n0 +p+2) since h(f (tn0 +1 , tn0 +p+1 )) = n0 + p + 2. We deduce that limp→∞ d2 (Sp , S) = 0. Hence (Sp )p∈N converges to S. According to Theorem 3, S ∈ Closed ∩ BF. Hence S ∈ Sol(SC). But S is not a solution of the constraint Y ⊆ f1−1 (X), and we get a contradiction. We deduce that Sol(SC) cannot be the set of solutions of a system of set constraints of the class (PNSC). Hence the class (PSCP) is strictly more expressive than the class (PNSC).
4. Conclusion The set of solutions of a system of set constraints of the class (PSC) is closed and the set of solutions of a system of set constraints of the class (PNSC) is the intersection of a closed set and of an open set. We deduced that the class (PSCP) is strictly more expressive in sense of set of solutions than the class (PNSC). According to these results, we can think that topology allow to characterize the set of solutions of classes of set constraints. In particular, we conjecture that if the set of solutions of a system of set constraints of the class (PNSC) is closed, this set is the set of solutions of a finite union of systems of set constraints of the class (PSC).
Acknowledgements The author would like to thank the two anonymous referees for their valuable comments that helped him improve this paper.
References [1] A. Aiken, D. Kozen, E. Wimmers, Decidability of systems of set constraints with negative constraints, Inform. and Comput. 122 (1) (1995) 30–44. [2] L. Bachmair, H. Ganzinger, U. Waldmann, Set constraints are the monadic class, in: Proc. 8th Annual IEEE Symposium on Logic in Computer Science, IEEE Computer Society Press, 19– 23 June 1993, pp. 75–83. [3] W. Charatonik, L. Pacholski, Set constraints with projections are in NEXPTIME, in: Proc. 35th Symp. Foundations of Computer Science, 1994, pp. 642–653.
150
F. Seynhaeve / Information Processing Letters 80 (2001) 145–150
[4] J. Dugundji, Topology, Allyn and Bacon, Inc., Newton, MA, 1976. [5] H. Hoogeboom, G. Rozenberg, Infinitary languages: Basic theory and applications to concurrent systems, in: J. de Bakker et al. (Eds.), Current Trends in Concurrency, Lecture Notes in Comput. Sci., Vol. 224, Springer, Berlin, 1986, pp. 266–342. [6] D. Kozen, Rational spaces and set constraints, Theoret. Comput. Sci. 167 (1996) 73–94. Available on http://www.cs.cornell.edu/kozen/papers/rat.ps.
[7] L. Staiger, ω-languages, in: Handbook of Formal Languages, Vol. 3, Springer, Berlin, 1997, pp. 339–387. [8] W. Thomas, Automata on infinite objects, in: Handbook of Theoretical Computer Science, Vol. B, Elsevier, Amsterdam, 1990, pp. 134–191. [9] M. Tommasi, Automates et contraintes ensemblistes, PhD thesis, LIFL, 1994.