| OCR Text |
Show 85 The linearity condition can also be relaxed somewhat. For example, equa-tions like append(AAX, Y, AAZ) = append(X, Y, Z) A == A = true do not pose any problems, because the common variables have di sappeared from the righthand side.''' Nevertheless, the equational logic programming presented here is a powerful subset of Prolog as typically used in logic programming. In addition, it supports equality that Prolog does not handle. The equality =E can be directly supported by the operational semantics, because the operational semantics is defined in the same way as the E-unification algorithm using narrowing. =E is simply "evaluated" by narrowing and deletion upon successful unification, returning true when an empty goal is derived, and false when derivation stops with a nonempty goal. '"''' We can thus write equations like f(X) = if p(a) -E q(a) then g(X), which simulates the following clause in Prolog with equality: f(X) = g(X) :- p(a) = q(a). 5.2.3 Algebraic Semantics Let E be an equational logic program. Let F be the set of function symbols that occur in E and V be a set of variables, such that V n F = 0. The free a! gebra over V, denoted by T(F,V) contains the set of all terms constructed from function symbols in F and variables in V. The E-equality =E generated by an equational logic program E is the finest congruence on T(F,V), and closed under instantiation. *No residues have connections with these common variables, and therefore there is no need to distinguish them (cf. Chapter 4). ** Because of undecidability, computations for nonunifiable terms may not always terminate. |