Path: utzoo!attcan!uunet!munnari!mulga!lee From: lee@mulga.oz (Lee Naish) Newsgroups: comp.lang.prolog Subject: Re: Clause fusion Message-ID: <2772@mulga.oz> Date: 17 May 88 04:46:09 GMT References: <983@cresswell.quintus.UUCP> Reply-To: lee@mulga.UUCP (Lee Naish) Organization: Comp Sci, Melbourne Uni, Australia Lines: 33 In article <983@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: >in order to perform optimisations like this >automatically a compiler needs to be licensed to treat predicates >according to their declarative reading rather than according to the >strict behaviour of a Prolog interpreter. NU-Prolog allows procedures to be declared "pure" for precisely this reason. One of the problems with Prolog as a logic programming language is that it is impossible to avoid over-specification when writing a program. Whatever logic you write also has a fixed procedural interpretation. This means that even with very smart compilers, parallel machines etc, the scope for optimization is quite limited. It also means that programmers must consider the control component of their programs. Logical NU-Prolog constructs normally have both declarative and procedural meanings: "A;B" means "A or B" declaratively and "execute A and, on backtracking, execute B" procedurally. If a procedure is declared pure, only the declarative meaning is defined. Currently, the transformations done by the compiler are quite simple. However, the compiler can be extended and the declarations can be used for other tools which transform programs (eg, adding control information, magic sets, fold/unfold,...). One of the problems with the idea is that we cant have 100% confidence in such a system. The undecidability of the halting problem means that no matter how smart logic programming systems are, programmers will still need to consider procedural factors in some cases. I think the difference between logic programming and automated theorem proving is that in logic programming, programmers are responsible for infinite loops. Lee Naish