
Implementing Inequality and Nondeterministic Specifications with Bi-rewriting Systems⋆ Jordi Levy and Jaume Agust´ı Institut d’Investigaci´oen Intel·lig`encia Artificial, CSIC, Cam´ıSta. B`arbara s/n, 17300 Blanes, Girona, Spain. E-mail: [email protected] and [email protected] Abstract. Rewriting with non-symmetric relations can be considered as a computational model of many specification languages based on non- symmetric relations. For instance, Logics of Inequalities, Ordered Al- gebras, Rewriting Logic, Order-Sorted Algebras, Subset Logic, Unified Algebras, taxonomies, subtypes, Refinement Calculus, all them use some kind of non-symmetric relation on expressions. We have developed an op- erational semantics for these inequality specifications named bi-rewriting systems. In this paper we show the applicability of bi-rewriting systems to Unified Algebras and nondeterministic specifications. In the first case, we give a canonical bi-rewriting system implementing the basic theory of these algebras. In the second case, nondeterministic specifications are viewed as inclusion specifications, thus bi-rewriting is a sound, although not always complete deduction method. We show how a specification has to be completed in order to have both soundness and completeness. 1 Introduction Term rewriting systems TRS have been usually associated with equational logic [DJ90]. Overcoming this tendency it has been shown recently [Mes90, Mes92] that the logic implicit in TRS is a generalization of equational logic, named preorder logic POL, or rewriting logic, which is addressed to unify a wide variety of models of concurrency. Following the new trend, we proposed in [LA93] an operative method based on rewriting techniques to automatize the deduction in the preorder logic. The inference rules defining this logic are quite similar to the ones defining the equational logic, but they do not include the symmetry rule: s ⊆ t t ⊆ v Reflexivity Transitivity t ⊆ t s ⊆ v s ⊆ t . s ⊆ t s ⊆ t 1 1 n n Monotonicity Substitution f(s1, . ,sn) ⊆ f(t1, . ,tn) σ(s) ⊆ σ(t) ⋆ This work has been partially supported by the project TESEU (TIC 91-430) funded by the CICYT. An inclusion theory or specification I is defined by a finite set of inclusions t ⊆ u, n where t and u are first order terms T (Σ, X ) over a finite signature Σ = ∪n≥0Σ of function symbols and a denumerable set of variables X . The idea of applying rewriting techniques to the deduction of inclusions be- tween terms like t ⊆ u is very simple. We compute by repeatedly replacing both 1) subterms of t by bigger terms using the axioms and 2) subterms of u by smaller terms using the same axioms, until we find a path of the bi-directional search connecting t and u. To use inclusion axioms as rewrite rules we must orient them in one, the other or both directions, which produces a pair of rewriting system: ⊆ ⊇ one R⊆ with rules oriented like t−−→u and the other R⊇ with rules like u−−→t. The pair hR⊆,R⊇i is a bi-rewriting system. In [LA93] we started to study the theory of bi-rewriting systems, their prop- erties and the completion process in order to ensure the termination and com- pleteness of the bi-directional search proof procedure. These depend on two properties, the termination of both rewriting relations −−→ and −−→, and the R⊆ R⊇ ∗ ∗ commutation of them ←−−◦−−→ ⊆ −−→◦←−−. The first property is usually proved R⊇ R⊆ R⊆ R⊇ using the standard methods based on simplification orderings. The second one requires a new definition: ⊆ ⊇ Definition 1. Let α1−−→β1 in R⊆ and α2−−→β2 in R⊇ be two rewriting rules (with distinct variables) and p a position in α1, then 1. if α1|p is a non-variable subterm and ρ is the most general unifier of α1|p and α2 then ρ(α1[β2]p) ⊆ ρ(β1) is a (standard) critical pair, 2. if α1|p = x is a repeated variable in α1, F a term, q an occurrence in F , ∗ and α2−−→β2 is not satisfied, then ρ(α1[F [β2]q]p) ⊆ ρ(β1) is an (extended) R⊆ critical pair where ρ only substitutes x by F [α2]q. The same for critical pairs between R⊇ and R⊆ . In [LA93] we proved the following theorem. Theorem 2. Given a bi-rewriting system hR⊆ ,R⊇ i, if R⊆ and R⊇ are both ter- minating then the bi-rewriting system commutes iff all the critical pairs are con- fluent. The same result was extended to bi-rewriting modulo a set of nonorientable inclusions, like it is done in the equational case when we rewrite in equivalence classes. The Knuth-Bendix completion process for bi-rewriting systems has some problems (the set of extended critical pairs is in general infinite) which are the object of current work [Lev93]. In this paper we apply the bi-rewriting technique to the automatic deduction in inclusion specifications. In section 2 we complete the basic inclusion theory of Unified Algebras, that is the theory of distributive lattices, and we give a canonical bi-rewriting system for it. This example shows the problems arising from the use of extended critical pairs. Section 3 has more theoretical interest. It has been shown that bi-rewriting is a sound and complete deduction technique for the preorder logic. The class of models of this logic are the preorder algebras. However, the models usually used in nondeterministic specifications are multialgebras. We study which conditions a specification I has to satisfy in order to be equivalent both classes of models. If this conditions are not satisfied, we propose a completion method for I. This completion introduces new rules t−−→⊆ u, leaving the rules t−−→⊇ u which define the computation unchanged. 2 Implementing the Inequality Specification of Distributive Lattices The commutativity of a bi-rewriting system requires the confluence of all the standard and extended critical pairs. The confluence of a standard critical pair, like l ⊆ r, can be assured adding to the system the rule l−−→⊆ r or r−−→⊇ l when it is not confluent. The same solution does not apply to the extended critical pair case because they involve inclusion schemes. The confluence of an inclusion scheme may require the addition of more than one rule and the search of the rules to add is not automatizable. Our approach to the problem is to orient the inclusion scheme in a rule scheme, and to study the new rule schemes that can be generated from it. The generation of critical pairs between rule schemes has not been solved yet. Nevertheless, in the following example we show that some particular rule instances of rule schemes may make confluent the original inclusion scheme (the extended critical pair). The rules added are sound because they are instances of rule schemes generated from extended critical pairs. The example we present is the inequality specification of distributive lattices. This specification is the base for many other specifications or specification lan- guages like the Unified Algebras [Mos89]. The presentation of the distributive lattice theory may be given by the following set of inclusions: X ∪ X ⊆ X X ∩ X ⊇ X X ∪ Y ⊇ X X ∩ Y ⊆ X X ∪ Y ⊇ Y X ∩ Y ⊆ Y X ∩ (Y ∪ Z) ⊆ (X ∩ Y ) ∪ (X ∩ Z) The orientation of all these inclusions to the right results in a terminat- ing bi-rewriting system where all standard critical pairs are confluent. However, the presence of the two non-left-linear rules X ∪ X−−→⊆ X and X ∩ X−−→⊇ X makes necessary the consideration of the extended critical pairs. If we only take into account, in a first step, all those extended critical pairs of the form hσ(α1[β2]p),σ(β1)i, which correspond to the particular case where the position q in F is the most external one q = λ, then we can generate the following sequence of new rules: ⊆ q1 Y ∪ (X ∪ Y )−−→X ∪ Y ⊆ q2 Y ∪ X−−→X ∪ Y ⊆ q3 (X ∪ Y ) ∪ Y −−→X ∪ Y ⊆ q4 (X ∪ Y ) ∪ (Y ∪ Z)−−→X ∪ (Y ∪ Z) ⊆ q5 (X ∪ Y ) ∪ Z−−→X ∪ (Y ∪ Z) and the equivalent ones for ∩. The rules q2 and q5 are non-orientable and subsume the rest of rules. They make necessary the use of the bi-rewriting modulo a set of inclusions technique. These rules are symmetric –they are really equations–, therefore we can apply the standard commutative-associative closure definition [PS81]. We obtain then the following set of rules. ⊆ r1 X ∪ X−−→X ext ⊆ r1 X ∪ X ∪ Y −−→X ∪ Y ⊆ R = r2 X ∩ Y −−→X ⊆ ⊆ r3 X ∩ (Y ∪ Z)−−→(X ∩ Y ) ∪ (X ∩ Z) rext X ∩ (Y ∪ Z) ∩ T −−→⊆ (X ∩ Y ) ∪ (X ∩ Z) ∩ T 3 ⊇ r4 X ∩ X−−→X ext ⊇ R⊇ = r4 X ∩ X ∩ Y −−→X ∩ Y ⊇ r5 X ∪ Y −−→X ⊆ r6 Y ∪ X−−→X ∪ Y ⊆ r7 (X ∪ Y ) ∪ Z−−→X ∪ (Y ∪ Z) I = ⊆ r8 Y ∩ X−−→X ∩ Y ⊆ r9 (X ∩ Y ) ∩ Z−−→X ∩ (Y ∩ Z) In a second step we have to consider also those rules needed to make confluent the rest of extended critical pairs. F [X] ∪ F [X ∪ Y ] ⊆ F [X ∪ Y ] F [X ∩ Y ] ⊆ F [X] ∩ F [X ∩ Y ] First, we will study the second extended critical pair. If we orient it to the left, we obtain the rule scheme F [X] ∩ F [X ∩ Y ]−−→⊇ F [X ∩ Y ]. This rule scheme generates a standard critical pair with the rule X ∩ Y −−→⊆ Y , which is made confluent adding the rule scheme F [X] ∩ F [Y ]−−→⊇ F [X ∩ Y ]. The overlapping of the context F [ ] of this rule scheme with the left part of the rule X ∩ Y −−→⊆ Y ⊇ generates infinite many rule schemes F [X1, . , Xn] ∩ F [Y1, . ,Yn]−−→F [X1 ∩ Y1, . , Xn ∩ Yn] for n ≥ 1.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages16 Page
-
File Size-