[comp.lang.prolog] Absorbing unification

gp@sys.uea.ac.uk (George Papadopoulos CMP RA) (04/16/89)

Unlike what seems to be claimed in the relevant literature, it appears
that a  _complete_ absorption of  unification  in the mapping  of  one
concurrent logic language  onto another  is not  always possible.  The
case I have in mind (there may be others but I'm not aware of them) is
problematical  to  all   CLLs  since it has   to  do  with the  common
choose-only-one-rule   operational    semantics   rather  than    with
unification  itself.  It's the case   of    a procedure having guarded
clauses with non-deterministic input  patterns. Consider the following
contrived program (written in a GHC-like syntax):

p(f(X,Y),Z,W) :- g1(X,Y,U) | b1(X,Y,U,Z,W).
p(X,g(Y,Z),W) :- g2(X,Y,Z,V) | b2(Y,Z,V,W).

The usual (only?)  way to map  this sort of program to  another CLL is
by doing something like this:

p(P1,P2,W) :- g1'({P1,X1,Y1},U,I), g2'(P1,{P2,Y2,Z2},V,I),
              commit(I,X1,Y1,Y2,Z2,U,V,P2,W).

where {...} plays the role of Parlog's one-way matching  primitive. It
can be predefined or have its  functionality included in  g1' and  g2'
with something like:

g1'({f(X,Y),X1,Y1},U,I) :- g1(X,Y,U1) | X1=X, Y1=Y, U=U1, I=1.
g1'(_,_,_) :- otherwise | true.

...  etc.  Of course the  above scheme is incomplete;  it needs  extra
arguments  to report failures, kill  unnecessary work, etc.  The point
I'm driving  at   however  is  that   you need   the extra   variables
X1,Y1,Y2,Z2 to communicate the results  of the  input unifications  to
the   'commit' process. In  other  words  it  appears  that you  reify
unification rather  than absorb it.   Note that this  problem does not
arise  with non-overlapping  or  "identical" input  patterns; only one
clause will be candidate for commitment  then, and 'commit' can  refer
directly to the arguments imported during input unification.

Am I right here?

George


-- 
George A. Papadopoulos, RA,      !   Tel: +44-603-56161,  Ext. 2692      
SYS, UEA, Norwich NR4 7TJ, UK    !   e-mail: gp@sys.uea.ac.uk               

Disclaimer: "Reality is determined either by majority vote or government grant,              with the latter holding veto power over the former"                            L. Ron Hubbard, Mission Earth