Dear All,
Samer Abdallahs SWI-Prolog thread Automatic differ-
entiation in CHR did an interesting experiment
in CAS and Prolog.
It showed that we can use CLP forward checking
(a variable gets a value assigned, and constraints are
updated) also in the context of this marriage.
But somehow I have the impression that the goal of a new
CLP(*) schema instance was not reached. This is
mainly due to the fact, that comparison operators
were not considered. But I guess with the help of
CHR we could also implement a couple of comparison
operators, that would react on forward checking.
We could then possibly do:
?- mul(X,2,Y), less(Y,10), X=4.
Yes
?- mul(X,2,Y), less(Y,10), X=5.
No
So there is still room to further develop CAS and Prolog.
In my auto diff variant I was already overriding is/2
and all the arithmetic comparison operators <, =:= etc...
But they arithmetic comparison operators don't react
yet on forward checking, so here is my idea for a
new CLP(*) from Hell:
**CLP(*) from Hell concept**
1) We would not have operators #<, #>, #=<, #>=,
but instead the usual ISO arithmetic operators
are overriden: <, >, =<, >=. So an existing Prolog
program needs zero changes.
2) We would not have operators #=, #\=,
but instead the usual ISO arithmetic operators
are overriden: =:=, =\=. So an existing Prolog
program needs zero changes.
3) The domain would not be the integers as in CLP(FD),
and also declaring ranges for variables would not
be so important, instead the following would happen:
3.1) The domain would be rather the reals itself, and
its more manageable incarnations, for example
the radical datatype.
3.2) Possibly there will be predicate similar to label/1,
but it would then compute a Gröbner Base, and from it
determine the variety, yielding constant values if
possible, similary like CLP(FD) already does.
Point 1) and 2) are rather cosmetics. The interesting
point is 3.1) and 3.2), especially the solver in 3.2).
That 3.2) is possible is already demonstrated in existing
systems, such as SAGE:
Gröbner Bases, Martin R. Albrecht,
DTU Crypto Group, 22 October 2013
http://martinralbrecht.files.wordpress.com/2010/07/20131022_buchberger_dtu.pdf
What I wonder is whether there will be some advantage of
using Prolog. For example the SAGE variety() function
has some similarity to constraint logic programming, the
CLP(*) scheme, for example an equation:
x^3-x = x*(x-1)*(x+1) = 0
Has 3 solutions, and if we have a triangular equation system,
back propagating this in Prolog, we would typically use
backtracking. What I did not yet find, is so much material
about Gröbner Bases and inequalities.
Concerning inequalities, some algorithms are just variations
of Gauss Elimination, maybe something similar can be
also done for Gröbner Bases. We will possibly get into the
waters of
https://en.wikipedia.org/wiki/Hilbert's_seventeenth_problem
Bye