🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3882

Relational Arithmetic in Prolog

#3882
From: Andre Vellino
Date: Wed, 01 Feb 1989 17:41
41 lines
1892 bytes
There is another way of doing arithmetic logically (relationally),
without incurring too great a performance cost.  It is not
clear if it can be *compiled* well, but our interpreter performs
quite well.

The idea is to impose arithmetic constraints on *intervals* which
refer to a point between the upper and lower bounds (floating point
numbers).  As more constraints are placed on intervals, they may
narrow.  

The best way to get the idea across is with an example.  If the
predicate range/2 is used to declare that an arithmetic variable
is an interval, and range(X,_), makes X an interval with bounds
[minfloat,maxfloat], then the question

?- range(X,_), 2 is X * X.

will constrain X to be an interval between [-2.0001,2.0001] (the
bounds are upward rounded to ensure correctness).  Now,

?- range(X,_), 2 is X * X, ( X >= 2 ; X < 0).

will alternately constrain X to [2.0,2.0001] and [-2.0001,-2.0].
This kind of technique will yeild rather quick solutions to
systems of non-linear equations (polynomials, for example).

For further reference, see John Cleary's paper "Logical Arithmetic"
in Future Computing Systems, volume 2, number 2, 1987 pp.125-147.

If anyone is interested in the kinds of things you can do with this
idea, I have a draft of a paper which explains the system.  It differs
quite substantially from Prolog-III and CHIP and CLP(R), but
it is a constraint programming system.

Andre Vellino
Computing Research Lab
Bell-Northern Research
P.O. Box 3511 Station C
Ottawa, Ontario
K1Y 4H7
Technical Details
Message-ID: <152@bnr-di.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!bnr-vpa!bnr-fos!bnr-di!anv

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!bnr-vpa!bnr-fos!bnr-di!anv
From: anv@bnr-di.UUCP (Andre Vellino)
Newsgroups: comp.lang.prolog
Subject: Relational Arithmetic in Prolog
Keywords: Prolog Arithmetic Intervals Constraints
Message-ID: <152@bnr-di.UUCP>
Date: 1 Feb 89 17:41:56 GMT
Organization: DI, Bell-Northern Research, Ottawa, Ont.
Lines: 41