From afromant@midway.uchicago.edu  Mon Dec  6 13:54:19 1999
Received: from midway.uchicago.edu (midway.uchicago.edu [128.135.12.12])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id NAA09822
	for <prolog@swi.psy.uva.nl>; Mon, 6 Dec 1999 13:54:14 +0100 (MET)
Received: from harper.uchicago.edu (root@harper.uchicago.edu [128.135.12.7])
	by midway.uchicago.edu (8.9.3/8.9.3) with ESMTP id GAA14508
	for <prolog@swi.psy.uva.nl>; Mon, 6 Dec 1999 06:54:15 -0600 (CST)
Received: from equality-7-2524 (pierce-175-003.rh.uchicago.edu [128.135.175.3])
	by harper.uchicago.edu (8.9.3/8.9.3) with SMTP id GAA04134
	for <prolog@swi.psy.uva.nl>; Mon, 6 Dec 1999 06:54:14 -0600 (CST)
Message-Id: <199912061254.GAA04134@harper.uchicago.edu>
X-Sender: afromant@nsit-popmail.uchicago.edu
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.0.1 
Date: Mon, 06 Dec 1999 06:55:36 -0500
To: prolog@swi.psy.uva.nl
From: alexandra romantseva <afromant@midway.uchicago.edu>
Subject: How to write join(X,Y)?
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"

I'm still trying to compose a definition for join(X,Y).


here is an example of how join(X,Y) should work...

unitequiv(7,3,6,X), unitequiv(7,2,6,Y), join(X,Y), instequivclasses(X).

should have a first return of X = [1,2,2,3,4,2,5] and Y=[1,2,2,3,4,2,5]

where the following definitions apply: 
max(X, Y, X) :- X >= Y. 
max(X, Y, Y) :- Y >= X. 
min(X, Y, X) :- Y >= X. 
min(X, Y, Y) :- X >= Y. 
instequivclassesn([], M, N). 
instequivclassesn([M | R], M, N) :- 
M > 0, P is M+1, max(P,N,Q), instequivclassesn(R, Q, Q). 
instequivclassesn([X | R], M, N) :- 
M > 1, P is M-1, instequivclassesn([X | R], P, N). 
instequivclasses(X) :- instequivclassesn(X, 1, 1). 
trivequiv(0, []). 
trivequiv(N, [X | R]) :- N > 0, P is N-1, min(P,N,Q), trivequiv(Q, R). 
insert(1, X, Y, [X | Y]). 
insert(I, X, [Y | R], [Y | Z]) :- P is I-1, min(P,I,Q), insert(Q,X,R,Z). 
unitequiv(N, I, J, X) :- 
N > 1, I =\= J, P=N-1, min(P,N,Q), trivequiv(Q,Z), 
insert(J,I,Z,X).



	Sasha
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/freevideo/

