[Oz] equality of unbound variables

Denys Duchier Denys.Duchier at ps.uni-sb.de
Mon Dec 20 09:48:46 CET 1999


tinelli at cs.uiowa.edu (Cesare Tinelli) writes:

> Consider a tuple T, some of whose arguments are unbound variables,
> possibly with repetitions; for instance, something like T=t(X Y X Z Z).
> I want to create a fresh ``variant'' of T in the sense of unification
> theory, that is, a copy of T in which all of T's unbound variables are
> (bijectively) renamed to fresh variables. For instance, in the example
> above, I'd like to produce a tuple of the form  t(X1 Y1 X1 Z1 Z1) where
> X1, Y1, Z1 are fresh variables.

What you want to do sounds very much like a Prolog trick.  It would be
even more meaningless in Oz due to constraints and other cncurrent
agents :-) Fortunately, it has never been needed since Oz offers
"computation spaces" and "encapsulated search".

declare S = {Space.new proc {$ R} X Y Z in R=t(X Y X Z Z) end}

creates a computation space whose "root variable" is constrained to be
of the form you described.

{Space.inject S proc {$ R} R:::1#9 R.1=:1+R.2 end}

installs a constraint that causes X Y Z to become finite domain
variables in the range 1..9 and enforces X=1+Y.

You can now duplicate (clone) the entire computation space including
the constraints and threads that reside in it as follows:

declare S2 = {Space.clone S}

This cloning idea is the basis for the implementation of "encapsulated
search".

It might be helpful to describe _what_ you are trying to achieve.  We
might then be able to suggest how that is best realized in Oz.

> Put it more simply, is there any way in Oz to always tell whether to
> unbound variables are the same or not? I've been thinking of tricks
> involving spaces and stateful data, but I think it should be simpler
> than that.

You can use System.eq to test for identity, but I am afraid that would
be thinking along the wrong lines.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-users mailing list