Bulletin of PFUR Series Mathematics. Information Sciences. Physics. No 2 (2). 2010. Pp. 19-23
UDC 512.563.6
Multi-level LP—Structures in Rewriting Systems
S. D. Makhortov
Department of Applied and System Software
Voronezh State University 1, University sq., 394006, Voronezh, Russia
An algebraic system containing the semantics of a set of rules of the conditional equa-tional theory (or the conditional term rewriting system) is introduced. The following basic questions are considered for the given model: existence of logical closure, equivalent transformations, construction of logical reduction. The obtained results can be applied to analysis and automatic optimization of the corresponding set of rules.
Key words and phrases: algebraic system, conditional rewriting, equivalent transformation, logical reduction.
1. Introduction
The term rewrite systems (TRS) occupy, to a certain extent, a boundary position between computer algebra and artificial intelligence. On the one hand, by means of TRS, the tasks of simplification of algebraic expressions are accomplished, on the other hand, the tasks of automatic theorem proving. Equivalent transformations and simplification of the sets of rules are important problems for the TRS. While for usual TRS similar problems have been solved in a number of works [1], for conditional TRS they, apparently, are still open. This fact can be explained by a more complicated structure of the rules for conditional TRS. For usual systems, the problem of minimization of a set of rules is eventually reduced to a transitive reduction of some binary relation («elimination of transitivity»). For conditional systems, it is possible to speak about a more complicated problem of finding a logical reduction.
A starting point in defining a rewrite system is usually the equational theory, whose set of rules consists of equalities. The TRS rules are obtained by "orientation" of equalities and, probably, by completion of the rules for attaining the confluence property. A similar approach is also applied to conditional TRS [2]. Since usually the equational theory is the criterion of equivalence of rewrite systems, the study of conditional TRS in this aspect can be started with reviewing the equivalence of conditional equational theories.
Let us assume that the equational theory (similar to [2]) contains a set of equalities of the form s1 = t1,... ,sn = tn : s = t. The meaning of the set is as follows: if all the equalities Si = U, i = 1,... ,n take place, then s = t is also fulfilled. If instead of the terms one considers independent elements, then the problem of simplification of such a set of conditional equalities can be reduced to the minimization of Horn conjunctive normal forms studied in [3]. The same method can also be applied to the equalities between the terms, but the optimization can appear to be only partial.
In the present paper, the algebraic model of the conditional equational theory (Lattice-Production structure) is introduced. This model takes into account possible connections between the terms, caused by the applications of functions and substitutions. The initial theory consists of conditional relations of the form s1 = t1,... ,sn = tn : u1=v1,..., um=vm. We shall call such relations (conditional) equational rules, or simply "rules", wherever this word will not cause misunderstandings. The left side (s1 = t1,... ,sn = tn) will be called condition, the right side (u1 = v1,..., um = vm) — conclusion of a rule. We interpret the equalities between the terms by the standard method of the equational theory: s = t, if the given equality can be obtained from the available set of equalities by means of the equational deduction under consideration. We shall define the corresponding axioms and inference rules in section 2. They
Received 28th November, 2009.
in a natural manner expand a set of axioms and inference rules, described in [4] for conditional equalities of the form s1 = t1,... ,sn = tn : s = t.
In the proposed algebraic model, conditional equational rules are realized by a binary relation R on a lattice generated by the sets of equalities {s^ = ti}. Note that R does not connect separate terms (as in the standard equational logic); it connects the sets of equalities between the terms: each rule s1 = t1,...,sn = tn : u1 = v1,..., um = vm is matched by the pair, (a, b) £ R, where a = {s1 = t1,... ,sn = tn} and b = {u1 = v1,...,um = vm}. Our model contains the logic of a production inference.
Apart from the model, the basic results of the paper (section 3) are as follows. For the given model the statement about the existence of a logical closure (theorem 1) is formulated, which makes it possible to formulate in the applications the notion of the equivalent equational theory. The possibility of locally equivalent transformations of the initial relation (theorem 2) is formulated, as well as the possibility of transformation of a set of rules. The structure of a logical closure (theorem 3) is investigated, which allows one to use fast algorithms in its construction. The problems of existence and construction of a logical reduction of a binary relation (theorem 4) are studied. This provides a theoretical basis for the minimization of conditional equational theory.
In section 4, the conclusions are drawn and prospects for further investigations are specified.
Proofs of the theorems presented in this paper are based on a detailed study of the properties of logical connections, generated by the relation on the lattice. Methods of the theory of sets, lattices and binary relations are used. Proof texts are to be published in a separate paper.
2. Basic Notions and Notations
A binary relation R on some set F is called reflexive, if for any a £ F holds (a, a) £ R; transitive, if for any a,b,c £ F from (a,b), (b,c) £ R follows (a,c) £ R. It is known that there exists a closure R* of an arbitrary relation R with respect to the properties of reflexivity and transitivity (reflexive-transitive closure). There exists a notion of a transitive reduction of a binary relation. Its construction is an inverse problem with respect to the closure construction. For the given relation R we seek the minimum relation R', such that its transitive closure coincides with the transitive closure of R. In [5] an algorithm of construction of a transitive reduction of the oriented graphs is given; it is shown that computationally this problem is equivalent to the problem of construction of a transitive closure, and the uniqueness of a transitive reduction of an acyclic graph is proved.
Lattice is a partially ordered set F, in which along with the relation ^ ("not greater than", "is contained") two binary operations A ("meet") and V ("join"), calculating, respectively, the greatest lower and least upper bounds for any a,b £ F. As is known, a set of all finite subsets X(U) of some set U is a lattice. In this paper, such form of lattices is considered. To underline this fact, we, instead of the symbols A and
V, shall use the signs of set-theoretic operations C, D, n and U. However, we preserve the use of the term "lattice", since later on our results can also be extended to other forms of lattices.
We use some basic definitions connected with the terms like in [4]. Let £ be an alphabet representing a union of the following non-intersecting sets: V is a set of variables; £n, n = 0,1,... are sets of n-arity functions. The set of terms T(£) is defined recursively [4]. The map a : V ^ T(£) is called substitution. This notion is extended to all t £ T(£).
The pair (£, E) is called the equational theory, where £ is the alphabet, consisting of a denumerable set of variables and a nonempty set of functional symbols, and E C T(£) x T(£) is a set of equalities of the form s = t (s,t £ T(£)). For the given set of equalities E we shall consider a set of finite subsets X(E). In it the relations of inclusion C, D, as well as "lattice" operations n and U are given. Besides, we
shall need two more groups of operations connected, respectively, with functions and substitutions of the terms:
1) if a = {si = tili = 1,...,n}, f G En, then f (a) = {f (sb..., sn) = f (h,. ..tn)};
2) if a = {sj = tj[j = 1,... ,m}, then a(a)={a(sj)=a(tj)|j=1,... ,m} for substitution a.
Def 1. Let an equational theory (T,,E) be set. The lattice obtained by the completion of X(E) with respect to the operations 1)-2) defined above will be called an equational lattice F.
As was already mentioned in section 1, we consider the conditional equational theory containing conditional rules of the form S1 = t1,... , — t"n : — lVl, . . . , Um — vm. Thus, the condition and conclusion of a rule are elements of F.
By analogy with [4], we shall introduce axioms and rules of our conditional equational deduction. The axioms are as follows: a : f (a) for any a = {s1 = t1,..., sn = tn} and f G £„; a : a (a) for any a G F and substitution a. In our logic, it is also possible to call such conditional rules tautologies. One more obvious tautology is the rule a : b, a,b G F if a 2 b.
The inference rules in conditional equational logic are as follows:
- a : b h a(a) : a(b) for any substitution a (see a similar rule in [4]);
- a : b, a : c h a : b U c (possible inference by parts);
- a : b,b : c h a : c (transitivity).
3. Algebraic Model of Conditional Equational
Theory
In this section, we consider binary relations on the equational lattice. Below we shall introduce the notion of a logical relation, which corresponds to a set of rules of the conditional equational theory.
First, a logical relation R should contain all tautologies. We shall introduce for them the general notation: a ^ b, if a 2 b, b = a(a) or b = f (a). Thus, for the logical relation R holds ^C R. Other properties of the logical relation follow from the deduction rules.
Let us call the relation R applicable, if for any substitution a from (a, b) G R follows (a(a), a(b)) G R. Let us call the relation R U-distributive, if for (a, b1), (a, b2) G R holds (a,b1 U b2) G R. The following definition summarizes the properties considered above.
Def 2. A binary relation on the equational lattice is called logical, if it contains tautologies, and is applicable, U-distributive and transitive. The least logical relation containing R is called a logical closure of an arbitrary relation R.
Two relations R1 and R2, defined on a common equational lattice, are called equivalent, if their logical closures coincide. We shall denote this fact as R1 ~ R2. A minimal relation R0 equivalent to it is called a logical reduction of the given relation R.
From the definition, no existence of a logical closure or reduction for an arbitrary binary relation follows. Below we shall consider these problems.
Def 3. Let some relation R be set on the equational lattice F. We shall say that the relation R logically connects the ordered pair a,b G F (we shall denote this fact by
a b), if one of the following conditions is fulfilled:
1) (a, b) G R or a ^ b;
2) there exist such a1,b1 G F and substitution a, that a = a(a1), b = a(b1), and
R, i, a1 —> bi;
R R
3) there exist such b1,b2 G F, that b1 U b2 = b, and a —> b1, a —> b2;
4) there exists an element c G F, such that a c and c b.
Theorem 1. For an arbitrary relation R on the equational lattice a logical clo-
R
sure exists and coincides with a set —> of all ordered pairs logically connected by the relation R.
R
Corollary 1. Let R be a binary relation on the equational lattice and at —> bt, Vt G T. Then the relation R! = R U {(at, bt)\t G T} (T is finite) is equivalent to R.
Let an arbitrary binary relation R on the equational lattice be given. Its equivalent transformation is such a replacement of all the set of the ordered pairs R or its part that the new relation P obtained as a result is logically equivalent to R, i.e. P ~ R.
Theorem 2. Let Ri,R2,R3,R4 be relations on a common equational lattice. If Ri ~ R2 and R3 ~ R4, then Ri U R3 ~ R2 U R4.
Corollary 2. Let Ri,R2,R be relations on a common equational lattice. If Ri ~ R2, then Ri U R ~ R2 U R.
Corollaries 1 and 2 justify the principle of locality of equivalent transformations of logical relations.
Let us try to clarify the question, whether it is possible to select the stage, corresponding to the transitive closure in the general process of the construction of a logical closure. This will allow us to reduce the study of some important problems, regarding logical relations, to the corresponding problems of transitive relations. In particular, the construction of a logical closure or a reduction can be realized by means of fast algorithms (similar to Warshall's algorithm) [5]).
For an arbitrary relation R on the equational lattice we shall consider a relation R, constructed with respect to the given R by a consecutive performance of the following steps:
1) add to R all pairs (a,b), for which b = a (a), or b = f (a), and denote the new relation Ri ;
2) add to Ri all pairs of the form (a(a),a(b)), for which (a,b) G Ri, and denote the new relation R2;
3) add to R2 all pairs of the form (ai U ... U am, bi U ... U bm), where (aj, bj) G R2, j = 1,... ,m, and denote the new relation R3;
4) combine R3 with the relation D .
Note that by virtue of the infinity of the set F, the described process of construction of R has a theoretical aspect. In applications, it is possible to take as F a final subset of the equational lattice, constructed under the boundedness of a maximal level of enclosure of the terms.
Theorem 3. A logical closure of the relation R on the equational lattice coincides with the transitive closure R* of the corresponding relation R.
Let us consider further a problem of existence and construction of a logical reduction of binary relations. For the relation R on the equational lattice we shall consider relation R constructed by the consecutive performance of the steps given by R, inverse
to the construction of R, namely:
1) exclude from R all pairs (a,b), for which a D b, and denote the new relation by R-i ;
2) exclude from R-i all pairs (a, b) of the form (ai U ... U am, bi U ... U bm), where (aj,bj) G R-i, j = 1,... ,m, and (a, b) coincides with no pair (aj, bj), and denote the result by R-2;
3) exclude from R-2 all pairs of the form (a(a),a(b)), for which (a,b) G R-2, and (a,b) does not coincide with the pair (a(a),a(b)), and denote the new relation by R-3 ;
4) exclude from R-3 all pairs (a, b), for which b = a (a), or b = f (a).
Theorem 4. Let for the relation R on the equational lattice F the corresponding relation R be constructed. Then, if for R there exists a transitive reduction R°, then the relation R° corresponding to it represents a logical reduction of the initial relation R.
4. Conclusions
In the present paper an algebraic lattice-based model of the conditional equational theory is proposed, and the results of the study of this model are presented. They make it possible to carry out locally equivalent transformations of a set of conditional rules, as well as its optimization by deriving an equivalent system with a minimal set of rules.
Later on, it will be possible to consider a more general algebraic model, using as its basis the Lindenbaum-Tarski lattice instead of X(E). Then the conditional rules can, as conditions and conclusions, contain formulas of propositional calculus, whereas the general methods of research will remain just the same.
Another possible direction is connected with a deeper reviewing of the structure of conditional rules. In section 1, we pointed out that by replacing the terms by independent elements of some set it is possible to optimize the system of rules on the basis of the methods described in [3]. This is the first level of the research. In the present work, we propose a model of the second level, taking into account the connections between the equalities on the basis of functions and substitutions. A deeper third level could consider the structure of separate terms in equalities.
References
1. Toyama Y. On Equivalence Transformations for Term Rewrite Systems. In Proceedings of the 1983 and 1984 RIMS Symposia on Software Science and Engineering // Lect. Notes Comput. Sci. — 1986. — Vol. 220. — Pp. 44-61.
2. Dershowitz N., Okada M., Sivakumar G. Canonical Conditional Rewrite Systems. // Lect. Notes Comput. Sci. — 1988. — Vol. 310. — Pp. 538-549.
3. Hammer P. L., Kogan A. Optimal Compression of Propositional Horn Knowledge Bases: Complexity and Approximation // Artif. Intell. — 1993. — Vol. 64, No 1. — Pp. 131-145.
4. Klop J. W. Osborne Handbooks of Logic In Computer Science. — Oxford University Press, New York, 1992. — Vol. 2.
5. Aho A. V., Garey M. R., Ulman J. D. The Transitive Reduction of a Directed Graph // SIAM J. Computing. — 1972. — Vol. 1, No 2. — Pp. 131-137.
УДК 512.563.6
Многоуровневые ЪР-структуры в системах переписывания
С. Д. Махортов
Факультет прикладной математики, информатики и механики Воронежский государственный университет Университетская пл., д.1, г. Воронеж, 394006, Россия
Вводится алгебраическая система, содержащая семантику множества правил условной эквациональной теории (или системы переписывания термов). Для данной модели рассматриваются следующие основные вопросы: существование логического замыкания, эквивалентные преобразования, построение логической редукции. Полученные результаты могут применяться для исследования и автоматической оптимизации соответствующего множества правил.
Ключевые слова: алгебраические системы, системы переписывания, эквивалентные преобразования, логическое замыкание.