Subject: RE: Circular references

From: "Douglas Miles (Volt Computer)" <[email-masked]>
Date: Thu, 14 Sep 2000 19:55:26 -0700

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'; [email-masked]
> 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:[email-masked]]
> Sent: Thursday, September 14, 2000 1:47 PM
> To: [email-masked]
> 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
> 
> [email-masked]
> 
> 
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
> 
>     
> http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
> 
> or send mail to [email-masked] 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/
>