Path: utzoo!utgpu!bnr-vpa!bnr-fos!bnr-di!anv From: anv@bnr-di.UUCP (Andre Vellino) Newsgroups: comp.lang.prolog Subject: Re: IC-Prolog Summary: Why one might want logical arithmetic Message-ID: <155@bnr-di.UUCP> Date: 6 Feb 89 22:29:17 GMT References: <587@gould.doc.ic.ac.uk> <187@aucsv.UUCP> Distribution: comp Organization: DI, Bell-Northern Research, Ottawa, Ont. Lines: 38 In article <187@aucsv.UUCP>, ok@aucsv.UUCP (Richard Okeefe) writes: > Note that having a predicate > times(A, B, A_times_B) > is not all joy. Successor and plus are ok, but times takes you out of the > decidable fragment of arithmetic. Of course using only successor and times is also ok (adding plus also takes you out of that decidable fragment of arithmetic). > Note that > times(X, 0, 0) > has *infinitely* many solutions. Surely that's ok too if you have a way of representing that many solutions without actually computing all of them (e.g. by imposing constraints on floating point intervals). That doesn't necessarily mean delaying the evaluation until X is sufficiently bound it means evaluating times(X,[0,0],[0,0]) where X is initially [minfloat,maxfloat], and verifying that this call to times remains true every time X gets narrowed, which in this instance will always be the case. With this kind of idea you can compute (with reasonable efficiency) all kinds of arithmetic expressions that have infinte solutions. For example, if range/2 defines interval-terms, the question ?- range(C, [-34,0]), range(F, [-40,14]), F is C * 9/5 + 32. will narrow C to [-34,-10] and F to [-29.2, 14] (which, by the way, is roughly the temperature range in Ottawa these days). -- Andre Vellino Bell-Northern Research Computing Research Laboratory % Standard disclaimers here, about my views being my own, etc.