Re: CHR max two Head limitation

From: Kish Shen <ks15_at_icparc.ic.ac.uk>
Date: Tue 09 Jul 2002 03:37:01 PM GMT
Message-Id: <E17Rx2z-0000VF-00@holborn.icparc.ic.ac.uk>
Aykut,

>I was trying to write simple CHR expressions for a particular problem 
>involving symbolic equation solving, but the CHR limitation for maximum two 
>head elements is causing serious trouble.

This is a restriction on our implementations of CHR. I assume you are using
lib(chr) rather than the newer lib(ech). Note that lib(ech) relaxes some
of the restrictions that were in lib(chr). In particular, more than two
head constraints is allowed for simpagation and simplification rules, but
not for propagation rules. Unfortunately, your example uses propagation 
rules.

In your particular case, could you not rewrite your bound/1 constraint so
that it takes a list, e.g.:

sub(X,Y,Z), bound([X,Y]) ==> bound([Z]).

Does having >2 heads for simpagation and simplification rules help you?
I would guess that if you are doing symbolic equation solving, you would
be rewriting an equalition into a simplier form in many cases, in which
case you would use the simplification rule, which does allow >2 heads.

>Is there an easier solution? Should I consider using an expert system shell 
>as a constraint store instead?

The other alternatives to writing constraints in ECLiPSe are to use
the propia library, which is `higher level' than CHRs, or you can go
lower level and use ECLiPSe's attributed variable and suspension
facilities to write your own constraints. 

Without knowing more about your problem, it is difficult to make a more
concrete suggestion, except to say that using the low-level facilities
would probably not be easy. Also, for pure symbol manipulation, you
may not need to use constraints at all. 

If you really need a CHR where you can write propagation rules with
more than two heads, you may want to consider the CHR that comes with
SICStus Prolog 3. 

--Kish Shen
  IC-Parc
  Imperial College
  London SW7 2AZ
  U.K.
Received on Tue Jul 09 16:38:55 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:15 PM GMT GMT