From ok@hermes.otago.ac.nz  Mon Dec  6 22:36:16 1999
Received: from hermes.otago.ac.nz (hermes.otago.ac.nz [139.80.32.49])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id WAA26107
	for <prolog@swi.psy.uva.nl>; Mon, 6 Dec 1999 22:36:14 +0100 (MET)
Received: (from ok@localhost)
	by hermes.otago.ac.nz (8.9.3/8.9.3) id KAA07738
	for prolog@swi.psy.uva.nl; Tue, 7 Dec 1999 10:36:15 +1300 (NZDT)
Date: Tue, 7 Dec 1999 10:36:15 +1300 (NZDT)
From: "Richard A. O'Keefe" <ok@hermes.otago.ac.nz>
Message-Id: <199912062136.KAA07738@hermes.otago.ac.nz>
To: prolog@swi.psy.uva.nl
Subject: Re: How to write join(X,Y)?


 	join(X,Y)
	
	combines the two equivalence relations X and Y (which must work
	on the same number of things for this to make good sense) things
	equivalent in X remain equivalent, things that are equivalent in
	Y remain equivalent and some things become equivalent because of
	the combination of X and Y.

At first it sounded to me as though this meant

    "if X : Eqv(S) and Y: Eqv(S) then join(X,Y) : Eqv(S)
     is the least (finest) equivalence relation containing 
     both X and Y".

If that's the case, then programming it is quite straightforward
(join(X, Y) = (X + Y)*, using obvious notation) once you tell us
how the equivalence relations X and Y and the result are to be
represented.

But then came the example:

	and the following is supposed to happen :
	
	| ?- unitequiv(5,2,4,X), unitequiv(5,2,3,Y), join(X,Y).
	X = [A,B,B,B,C]
	Y = [A,B,B,B,C] ? 
	no
	
That left me _completely_ confused.  the list [A,B,B,B,C] doesn't
look like any equivalence relation representation that I can think
of (unless it is the partition {{1}, {2,3,4}, {5}}) and join is a
predicate, not a function, with no place that I can see to put the
result.

Here's a wild guess.  S is the integers 1..N for some N.
A list [X1,...,XN] represents the equivalence relation
(i equiv j if and only if Xi is the same variable as Xj).
join(X, Y) is to take two such representations and *convert*
them both to the representation of (X+Y)* by binding variables.

If that's the case, then
    unit_equiv(5, 2,4, X)	=> X = [X1,X2,X3,X2,X5]
    unit_equiv(5, 2,3, Y)	=> Y = [Y1,Y2,Y2,Y4,Y5]
and the definition
    join(X, X) :- true.
should work.  You'd get
    X1 = Y1
    X2 = Y2 = X3 = Y4
    X5 = Y5
or  X = Y = [A,B,B,B,C].

If it's not the case, I have no idea what's going on.


