voda@faculty.cs.ubc.ca (Paul Voda) (07/01/88)
The reason I am writing this note is that the programming language Trilogy I have designed and implemented as an answer to the extra-logical features of supposedly declarative Prolog as well as to it's appalling inefficiency in the deterministic (procedural) situtations (see the Ross Overbeek's theorem prover benchmark) is being misrepresented by some very influential protagonists of logic programming. For almost a year now I have been presenting Trilogy as a logic programming language with built-in costraints (Presburger arithmetic, array constraints, etc.). I was always stressing that Trilogy is a language based on logic, i.e. on the first order theory of pairs. The variables in Trilogy's programs range over pairs (i.e. over S-expressions of Lisp). Trilogy does not use Horn clauses, its predicates have the form of iff conditions (similar to the completed form of Prolog predicates). Moreover, the computation of Trilogy programs does not have to be explained by the unification. This is because Trilogy constraints include the equality over the domain of pairs. Instead of unifying the term a with b it is enough to issue a constraint a = b and rely on the decision procedure for the equality built into Trilogy. I was also stressing that thanks to the Trilogy's modes and types the non-backtracking (deterministic) programs can be compiled with the efficiency of Pascal. The typing of Trilogy is quite unique in that the type inclusion is supported and the values can be converted from one type into another (by typing all variable to be of the universal type U of all pairs one achieves the effect of typeless programming). I was stating the above on various occasions and with many repetitions hoping that people will get interested. Well many people were. On the other hand, I was very disappointed when I have heard (and I was also told by somebody who have heard himself) some pretty careless comments on Trilogy. One comment came from one of the top people connected with CLP. He has publicly dismissed Trilogy as a combination of Prolog and Ada (the emphasis was on the lack of logic of Ada I pressume), the other public comment came from a real authority on logic programming: Trilogy is a cross between Prolog and Pascal (with the same implication). Such comments are very damaging because Trilogy is quite different from Prolog, yet it is a logic programming language. As it is I have enough difficulties presenting Trilogy on account of the different foundations and syntax. Needless to say the comments are absolutely unjustified and what really hurts is that they were stated by such big authorities. As far as I know neither of the authorities have seen Trilogy in operation and very likely did not feel sufficiently motivated to read thouroghly the papers I wrote on the semantic of Trilogy as well as my older papers where I was explaining my approach to logic programming. It is quite ironic to have Trilogy presented as the operational Pascal or Ada. What about the extra-logical features of Prolog? Prolog's cuts, vars, asserts, i/o, etc. are all outside of logic in the domain of operational behavior. Actually the extra-logical features of Prolog are much more damaging to the cause of declarative programming than the honest non-declarativeness of Pascal. Witness how are the extra-logical "bugs" of Prolog discussed as "meta-theoretic features" in almost all Prolog texts. If the theoreticians can do that, the computer hobbyists are only too happy to indulge in the "meta-programming" without seeing anything wrong about it. One of the most horrible examples of this was in the August 1987 issue of the Byte magazine. One enthusiast have programmed a Prolog simulation of a microprocessor. He of course knew that the execution of a processor instruction changes the state of the processor. Instead of parameterizing each instruction with the old and new state he has retracted the old state before executing an instruction and asserted it afterwards. I could almost see him to be so proud of himself; after all he knew from the Prolog's texts that he was doing a real meta-programming. Trilogy was designed as a language without extralogical features. It was implemented without any. For instance we have added to Trilogy a form of a cut (a one solution operator) only when we have explained it logically. Even the input/output operations and file updates are handled in Trilogy completely within logic. Since I have supervised the implementation of Trilogy I did not permit into the implementation a single quick implementation hack which, although speeding up the execution, could destroy the logic. As it happens Trilogy is the only programming language commercially available which has both the declarative logic and sufficient efficiency in deterministic situations. Paul Voda Complete Logic Systems, 741 Blueridge Ave, N. Vancouver B.C. V7R 2J5 Canada (604)986-3234