Article View: comp.lang.functional
Article #337Mutual recursion elimination
From: Ronen Feldman
Date: Thu, 12 Jul 1990 22:32
Date: Thu, 12 Jul 1990 22:32
43 lines
1532 bytes
1532 bytes
I have the following program which have exponential complexity, I want by a set of automatic transformations to get to an equivalent program with linear complexity. The program is written in prolog but the problem exist also for any other language that support recursion. (so it is of interest to Lisp and ML people) The original program: a(X) :- f1(X),f2(X). a(s(X)) :- b(X),a(X). b(X) :- f2(X),f3(X). b(s(X)) :- c(X),b(X). c(X) :- f3(X),f1(X). c(s(X)) :- a(X),c(X). The program I want to get as a result of some set of automatic transformations: a1(X) :- f1(X),f2(X),f3(X). a1(s(X)) :- a1(X). An example for a query is a(s(s(s(c1)))) where f1(c1),f2(c1) and f3(c1) are true. I claim that a1(X) = a(X) = b(X) = c(X) for every X. (provided that the f1,f2,f3 relations are the same for both programs). Does anyone see the transformations that can be applied to program1 so we can get program2? I thought about magic sets I don't see how it can produce program2. please email directly. Thanks Ronen Feldman (feldman@cs.cornell.edu)
Technical Details
Message-ID:
<43268@cornell.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cornell!feldmanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cornell!feldman From: feldman@piccolo.cs.cornell.edu (Ronen Feldman) Newsgroups: comp.lang.functional,comp.lang.lisp Subject: Mutual recursion elimination Message-ID: <43268@cornell.UUCP> Date: 12 Jul 90 22:32:51 GMT Sender: nobody@cornell.UUCP Reply-To: feldman@cs.cornell.edu (Ronen Feldman) Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 44