Matches in SemOpenAlex for { <https://semopenalex.org/work/W3141129743> ?p ?o ?g. }
- W3141129743 abstract "q, t) = q if t ∈ V abstract(q, {t1, . . . , tn}) if t ≡ c(t1, . . . , tn), c ∈ C, n ≥ 0 abs call(q, t) if t ≡ f(t1, . . . , tn), f ∈ F , n ≥ 0 where applying abstract to a set of terms is simply defined as abstract(q, {t1, . . . , tn}) = abstract(. . . abstract(q, t1), . . . , tn) with n ≥ 1, and abstract(q,O) = q. The auxiliary function abs call is defined as —abs call(nil, t) = t —abs call((q1, . . . , qn), t) = (q1, . . . , qn, t) if 6 ∃i ∈ {1, . . . , n}. (comparable(qi, t) ∧ qi E t) abstract((q1, . . . , qn), S) if i is the maximum j ∈ {1, . . . , n} such that (comparable(qj , t)∧qj E t}), and qiθ = t for some θ, where S = {s | x/s ∈ θ} abstract(q, S) if i is the maximum j ∈ {1, . . . , n} such that (comparable(qj , t) ∧ qj E t}), and qi 6≤ t, where q ≡ (q1, . . . , qi−1, qi+1, . . . , qn), msg(qi, t) = 〈w, {θ1, θ2}〉, and S = {w}∪{s | x/s ∈ θ1 or x/s ∈ θ2}. Let us informally explain this definition. Given a configuration q, in order to add a new term t (headed by a defined function symbol), the function abstract proceeds as follows: —If t does not embed any comparable term in q, then t is simply added to q. —If t embeds several comparable terms of q, then it considers the rightmost one in the sequence, say t, and distinguishes two cases: —if t is an instance of t with substitution θ, then it recursively attempts to add the terms in θ to q; —otherwise, the msg of t and t is computed, say 〈w, θ1, θ2〉, and then it attempts to add w as well as the terms in θ1 and θ2 to the configuration resulting from removing t from q. We note that, in the latter case, if t were not removed from q, the abstraction operator could run into an infinite loop, as shown in the following example. Example 5.12. Let us consider the PE configuration q ≡ (f(x, x), g(x)) and assume that abs call is modified by not removing the rightmost term qi of the ACM Transactions on Programming Languages and Systems, Vol. 8, No. 1, January 1999. Partial Evaluation of Functional Logic Programs · 37 sequence q after computing the msg. Then, a call of the form abs call(q, f(y, z)) would proceed as follows: (1) the msg of f(x, x) and f(y, z) is computed, since they are comparable, f(y, z) is not an instance of f(x, x), and f(y, z) embeds f(x, x); (2) then the call to abstract(q, {f(y, z), x}) is done, where 〈f(y, z), {{y/x, z/x}, ǫ}〉 is the msg of f(x, x) and f(y, z); (3) finally, the call to abstract reproduces the original call: abs call(q, f(y, z)), thus entering into an infinite loop. A similar example can be found in Leuschel et al. [1998], where an alternative solution to this problem is proposed; namely, the so-called strict homeomorphic embedding E is used which requires s not to be a strict instance of s for s E s. Thus f(x, y) does not strictly embed f(x, x), and then it is simply added to the structure which is used to store the specialized calls. The loss of precision in the abstraction operator caused by the use of the msg is quite reasonable and is compensated by the simplicity of the resulting method. Also, although our list-like configurations can be considered poorer than the treelike states of Martens and Gallagher [1995] and Sorensen and Gluck [1995], they are commonly used and, in some cases, can avoid duplication of function definitions. The following example illustrates how our method achieves both termination and specialization. The positive supercompiler of Gluck and Sorensen [1994] and Sorensen et al. [1994] does not terminate on this example, due to the infinite generation of “fresh” calls which, because of the growing accumulating parameter, are not an instance of any call that was obtained previously. The PD procedure of Benkerimi and Hill [1993] and Benkerimi and Lloyd [1990] results in the same nontermination pattern for a logic programming version of this program. Most current methods (e.g., Gallagher [1993], Gluck et al. [1996], Leuschel and Martens [1996], Martens and Gallagher [1995], and Sorensen and Gluck [1995]), would instead terminate on this example. Example 5.13. Consider the following program R, which checks whether a sequence is a palindrome by using a reversing function with accumulating parameter: palindrome(x) → true ⇐ reverse(x) = x reverse(x) → rev(x, nil) rev(nil, ys) → ys rev(x : xs, ys) → rev(xs, x : ys) and consider the goal palindrome(1 :2 :x) = y. We follow the generic PE algorithm with the nonembedding unfolding rule (Definition 5.8) and abstraction operator (Definition 5.11). The initial PE configuration is q1 = abstract (nil, palindrome(1 :2 :xs)) = palindrome(1 :2 :xs). The partial evaluation of palindrome(1 :2 :xs) in R is the program R1: palindrome(1 :2 :x :xs) → true ⇐ rev(xs, x :2 :1 :nil) = 1 :2 :x :xs with Rcalls = {true, rev(xs, x :2 :1 :nil), 1 :2 :x :xs}. Then we obtain q2 = abstract (palindrome(1 :2 :xs),Rcalls) = (palindrome(1 :2 :xs), rev(xs, x :2 :1 :nil)). ACM Transactions on Programming Languages and Systems, Vol. 8, No. 1, January 1999. 38 · Maŕia Alpuente et al. The partial evaluation of rev(xs, x :2 :1 :nil) in R is the program R2: rev(nil, x :2 :1 :nil) → x :2 :1 :nil rev(x :xs, x :2 :1 :nil) → rev(xs, x :x :2 :1 :nil) with Rcalls = {x :2 :1 :nil, rev(xs, x :x :2 :1 :nil)}. Then we obtain q3 = abstract ((palindrome(1 :2 :xs), rev(xs, x :2 :1 :nil)),Rcalls) = (palindrome(1 :2 :xs), rev(xs, x1 :x2 :x3 :ys)). The partial evaluation of rev(xs, x1 :x2 :x3 :ys) in R is the program R3: rev(nil, x1 :x2 :x3 :ys) → x1 :x2 :x3 :ys rev(x :xs, x1 :x2 :x3 :ys) → rev(xs, x :x1 :x2 :x3 :ys) with Rcalls = {x1 :x2 :x3 :ys, rev(xs, x :x1 :x2 :x3 :ys)}. Then we obtain q4 = abstract ((palindrome(1 :2 :xs), rev(xs, x1 :x2 :x3 :ys)),Rcalls) = (palindrome(1 :2 :xs), rev(xs, x1 :x2 :x3 :ys)) ≡ q3. Thus, the specialized program R′ resulting from the PE of R with respect to the set of terms S = {palindrome(1 :2 :xs), rev(xs, ys)} is palindrome(1 :2 :x :xs) → true ⇐ rev(xs, x :2 :1 :nil) = 1 :2 :x :xs rev(nil, x1 :x2 :x3 :ys) → x1 :x2 :x3 :ys rev(x :xs, x1 :x2 :x3 :ys) → rev(xs, x :x1 :x2 :x3 :ys) where we have saved some infeasible branches which end with fail at specialization time. Note that all computations on the partially static structure have been performed. In the new partially evaluated program, the known elements of the list in the argument of palindrome are “passed on” to the list in the second argument of rev. The logical inferences needed to perform this, whose number n is linear in the number of the known elements of the list, is done at partial evaluation time, which is thus more efficient than performing the n logical inferences at runtime. The following lemma states that abstract is a correct instance of the generic notion of abstraction operator (the proofs of next lemma and theorem can be found in Appendix B.2). Lemma 5.14. The function abstract is an abstraction operator. The following theorem establishes the (local as well as global) termination of the considered instance of the generic PE algorithm Theorem 5.15. The narrowing-driven PE algorithm terminates for the domain State of PE configurations and the nonembedding unfolding rule (Definition 5.8) and abstraction operator (Definition 5.11). As a consequence of theorems in Sections 3.2 and 3.3, Theorem 5.15 establishes the total correctness of the considered partial evaluation algorithm for unrestricted conditional narrowing. In Section 6.2, we present a PE theorem which gives the total correctness of a call-by-value partial evaluator based on innermost conditional narrowing. The last example in this section illustrates the fact that our method can also eliminate intermediate data structures and turn multiple-pass programs into one-pass ACM Transactions on Programming Languages and Systems, Vol. 8, No. 1, January 1999. Partial Evaluation of Functional Logic Programs · 39 {y/a(a(xs, ys), zs)} {xs/nil} {xs/x ′ : x s }" @default.
- W3141129743 created "2021-04-13" @default.
- W3141129743 creator A5033696911 @default.
- W3141129743 date "2004-01-01" @default.
- W3141129743 modified "2023-10-15" @default.
- W3141129743 title "Partial Evaluation of Functional Logic Programs" @default.
- W3141129743 cites W100098737 @default.
- W3141129743 cites W107992588 @default.
- W3141129743 cites W147641928 @default.
- W3141129743 cites W1482061011 @default.
- W3141129743 cites W1485472834 @default.
- W3141129743 cites W1494825669 @default.
- W3141129743 cites W1498453116 @default.
- W3141129743 cites W1507781843 @default.
- W3141129743 cites W1511144413 @default.
- W3141129743 cites W1513315908 @default.
- W3141129743 cites W1515877009 @default.
- W3141129743 cites W1521225797 @default.
- W3141129743 cites W1530237295 @default.
- W3141129743 cites W1538694434 @default.
- W3141129743 cites W155273981 @default.
- W3141129743 cites W1556604985 @default.
- W3141129743 cites W1556849684 @default.
- W3141129743 cites W1559076591 @default.
- W3141129743 cites W1560828232 @default.
- W3141129743 cites W1562307676 @default.
- W3141129743 cites W1567856068 @default.
- W3141129743 cites W1568484765 @default.
- W3141129743 cites W1572831335 @default.
- W3141129743 cites W1574340008 @default.
- W3141129743 cites W1581534493 @default.
- W3141129743 cites W1583295953 @default.
- W3141129743 cites W1583454894 @default.
- W3141129743 cites W1585088833 @default.
- W3141129743 cites W1592422288 @default.
- W3141129743 cites W1598890912 @default.
- W3141129743 cites W1603305149 @default.
- W3141129743 cites W1608162599 @default.
- W3141129743 cites W1691095050 @default.
- W3141129743 cites W1866859260 @default.
- W3141129743 cites W1985929555 @default.
- W3141129743 cites W1988185893 @default.
- W3141129743 cites W2015660347 @default.
- W3141129743 cites W2015788118 @default.
- W3141129743 cites W2019962118 @default.
- W3141129743 cites W2020024606 @default.
- W3141129743 cites W2023299380 @default.
- W3141129743 cites W2031825596 @default.
- W3141129743 cites W2037035101 @default.
- W3141129743 cites W2048748607 @default.
- W3141129743 cites W2048831705 @default.
- W3141129743 cites W2053719172 @default.
- W3141129743 cites W2055807110 @default.
- W3141129743 cites W2056637458 @default.
- W3141129743 cites W2058958439 @default.
- W3141129743 cites W2059237359 @default.
- W3141129743 cites W2059799630 @default.
- W3141129743 cites W2084489002 @default.
- W3141129743 cites W2087389137 @default.
- W3141129743 cites W2094243107 @default.
- W3141129743 cites W2103914277 @default.
- W3141129743 cites W2106105719 @default.
- W3141129743 cites W2118351936 @default.
- W3141129743 cites W2118383426 @default.
- W3141129743 cites W2123396057 @default.
- W3141129743 cites W2125977928 @default.
- W3141129743 cites W2126018011 @default.
- W3141129743 cites W2127455814 @default.
- W3141129743 cites W2135124683 @default.
- W3141129743 cites W2135884324 @default.
- W3141129743 cites W2137818097 @default.
- W3141129743 cites W2138364864 @default.
- W3141129743 cites W2141578886 @default.
- W3141129743 cites W2142436113 @default.
- W3141129743 cites W2144352681 @default.
- W3141129743 cites W2144678770 @default.
- W3141129743 cites W2146817259 @default.
- W3141129743 cites W2147335415 @default.
- W3141129743 cites W2149545670 @default.
- W3141129743 cites W2154320795 @default.
- W3141129743 cites W2155847917 @default.
- W3141129743 cites W2162352259 @default.
- W3141129743 cites W2208923056 @default.
- W3141129743 cites W2522304419 @default.
- W3141129743 cites W2912818154 @default.
- W3141129743 cites W2915015834 @default.
- W3141129743 cites W330814066 @default.
- W3141129743 cites W92496487 @default.
- W3141129743 hasPublicationYear "2004" @default.
- W3141129743 type Work @default.
- W3141129743 sameAs 3141129743 @default.
- W3141129743 citedByCount "4" @default.
- W3141129743 crossrefType "journal-article" @default.
- W3141129743 hasAuthorship W3141129743A5033696911 @default.
- W3141129743 hasConcept C41008148 @default.
- W3141129743 hasConceptScore W3141129743C41008148 @default.
- W3141129743 hasOpenAccess W3141129743 @default.
- W3141129743 hasRelatedWork W1512719202 @default.
- W3141129743 hasRelatedWork W1556604985 @default.
- W3141129743 hasRelatedWork W1970252670 @default.