Path: utzoo!utgpu!attcan!uunet!seismo!sundc!pitstop!sun!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Determining order of argument unification Message-ID: <629@quintus.UUCP> Date: 4 Nov 88 12:26:19 GMT References: <8192@burdvax.PRC.Unisys.COM> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 23 In article <8192@burdvax.PRC.Unisys.COM> lang@zeta.PRC.Unisys.COM (Francois-Michel Lang) writes: >Is it possible to determine (by writing a Prolog program) >which of these two orders is used for given a Prolog system, >and, if so, how? >Credit is due to Kim Marriott and Harald Sondergaard >(Department of Computer Science, University of Melbourne) >for inspiring the question. Anyone who has read Marriott & Sondergaard's paper on the Occurs Check problem will think they know that the answer is yes, and will have some idea of what to try. However, the answer is *no*. The reason is that there are lots of other things a Prolog system could do. For example, the compiler could pick either order at random, or based on some property such as the spelling of the function symbol. Or the compiler might quite plausibly do some of the arguments out of order if they look nice (I think I wrote a note about this at Edinburgh). So f(X,Y+Z,W) might have its arguments processed in a different order from f(X,W,Y+Z). More to the point, the Prolog system might, like SICStus Prolog, have a unification algorithm which can hack cyclic terms (though other parts of SICStus Prolog didn't, the last time I tried).