From ok@atlas.otago.ac.nz  Thu Nov 23 00:18:05 2000
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id AAA00444
	for <prolog@swi.psy.uva.nl>; Thu, 23 Nov 2000 00:18:04 +0100 (MET)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id MAA01013;
	Thu, 23 Nov 2000 12:17:52 +1300 (NZDT)
Date: Thu, 23 Nov 2000 12:17:52 +1300 (NZDT)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200011222317.MAA01013@atlas.otago.ac.nz>
To: jcabrera@dis.ulpgc.es, prolog@swi.psy.uva.nl
Subject: Re:  About unification

	can someone explain this behavior in unification:
	
	?-  -A = -(3).
	A = 3
	Yes
	
This is exactly what you should expect.  On the left we have the
compound term -(A), and on the right we have the compound term -(3).  


	?- -A = -3.
	No
	
This is exactly what you should expect.  On the left we have the
compound term -(A), and on the right we have a simple number which
happens to be negative.  The failure of -3 to unify with -A is no
more surprising than the failure of 333 to unify with iA.

	Is it the right behavior?.
	
Yes of course.  It is essential to have a way of writing negative numbers
in patterns.  We could have gone the APL or ML route of using two different
symbols for <negate> and <start of negative number>, but that would have
confused pretty much everyone.  So the Edinburgh Prolog designers chose to
write negative numbers as, well, negative numbers.

	The only explanation I can think of is how the term '-A' is
	treated internally, as shown using display/1.

There is nothing special about -A.  It's the difference between the
simple negative number -1 and the compound term -(1) that has confused
you.

Note that it's the same in Scheme and Lisp: (- 3) is an arithmetic
expression that negates a 3 at run time, but -3 is a simple negative number.

