From a-doug@microsoft.com  Fri Sep 15 05:01:23 2000
Received: from mail5.microsoft.com (mail5.microsoft.com [131.107.3.121])
	by swi.psy.uva.nl (8.9.3/8.9.3) with SMTP id FAA14496
	for <prolog@swi.psy.uva.nl>; Fri, 15 Sep 2000 05:01:22 +0200 (MET DST)
Received: from 157.54.9.108 by mail5.microsoft.com (InterScan E-Mail VirusWall NT); Thu, 14 Sep 2000 19:55:31 -0700 (Pacific Daylight Time)
Received: by INET-IMC-05 with Internet Mail Service (5.5.2651.58)
	id <S56FAZG2>; Thu, 14 Sep 2000 19:55:30 -0700
Message-ID: <56791EC22E349D428D0C05C89EAB8A2421A21A@red-msg-05.redmond.corp.microsoft.com>
From: "Douglas Miles (Volt Computer)" <a-doug@microsoft.com>
To: "'Gordon Streeter'" <GordonStreeter@bigfoot.com>, prolog@swi.psy.uva.nl
Subject: RE: Circular references
Date: Thu, 14 Sep 2000 19:55:26 -0700
X-Mailer: Internet Mail Service (5.5.2651.58)

correction about the way i used the = sign

> -----Original Message-----
> From: Douglas Miles (Volt Computer) 
> Sent: Thursday, September 14, 2000 6:41 PM
> To: 'Gordon Streeter'; prolog@swi.psy.uva.nl
> Subject: RE: Circular references
> 
> 
> Gordon, 
> 
>     A = a(A), assert(A).
> 
> generally assert and friends are limited to what you can write/1 
> 
> try    
> 
> 	A=a(A),write(A).
> 
> you should get the same error
> 
> 
> Do you want A to be turned inside out? so that A was the 
> inverse of a(A) ?
> and yet still be A?
> 
> I think you may mean to do this:
> 	
> 	P = circular_reference(A=a(A)) , assert(P).
> 
> or 
> 
> 	B=A, C=a(A), assert(B=C). 

This assert wouldn't have worked actually 
	=/2 is mot normally modifiable.

so you may

	:-dynamic circular_reference/2.
	:-op(700,xfx,circular_reference).
	:-op(700,xfx,equivical).

	equivical(X,Y):-!, circular_reference(X,Y);X=Y

and then start using equivical/2 in place of the =/2 predicate
	as in 


?- P = (A circular_reference a(A)) , assert(P).

?-  B equivical a(B).
B = _G0665
yes.

?-   A equivical B.
A=_G0666
B=a(_G0666)
yes.

?-   A equivical 1.
A=1
Yes.


> 
> Programmatically you could be asking the prolog database to remember
> something very neat about the current prolog state durring 
> the =/2 you were
> in while the assert/1 was happening. One possible state to 
> allow this would
> be 0xc00000fd :) (unless this was an access violation then 
> you would have
> need for infinate amount of memory and thus reaching a proximal Zen)  
> 
> You and i can look at it and not even attempt to break our 
> laws of logic.
>  
> Your first part of the query was
> 	 A=something(A)
> 
> Take in math:
> 	  A = X * A .. 
> We know that only  A=0 could be true..
> but maybe infinity or square root of negative 1 would be also 
> acceptable?
> 
> Back to "A=a(A)."
> 
> Prolog doesnt look it first, it will assume we asked it to 
> find some value
> in existance for A that will make the statement true.. 
> some strange term possibly..  So prolog could work hard on reaching an
> imaginary value/state that will allow something to be itself 
> as well as
> something other then itself at the same given time. 
> 
> 
> -----Original Message-----
> From: Gordon Streeter [mailto:GordonStreeter@bigfoot.com]
> Sent: Thursday, September 14, 2000 1:47 PM
> To: prolog@swi.psy.uva.nl
> Subject: Circular references
> 
> 
> I'm having various troubles dealing with circular references. 
>  The biggest
> problem is in trying to assert a term with a circular reference.  My
> application is more complex, but here is a simple test:
> 
>     A = a(A), assert(A).
> 
> This causes an exception (0xc00000fd) in PLWIN.EXE on WinNT 
> 4.0, SP6, for
> SWI-Prolog 3.2.8, 3.3.6, and 3.3.10.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> G
> 
> GordonStreeter@bigfoot.com
> 
> 
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
> 
>     
> http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
> 
> or send mail to prolog-request@swi.psy.uva.nl using the 
> Subject: "unsubscribe"
> (without the quotes) and *no* message body.
> 
> ** An ARCHIVE of this list is maintained at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
> 

