How to program set(X) + set(a) = set(X)

Quote:

>I'm going to code in prolog the 'set union' which takes into

>consideration set(X) which the set X is undetermined.

>The set union is like this:

> set(X) + set(a) =set(X).

>If it works, it might be used for any set operation such as subtract,

>implication, etc..

>Do you have on idea of the implementation?

I really don't. But I'm dissapointed not to see any responses to this

question, since it reflects on the logical nature of prolog vs.

real-world implementation.

Since every predicate implicitly defines a set, you can use

member/2.

Then maybe

in_union(Elem,Set1,Set2) :- member(Elem,Set1).

in_union(Elem,Set1,Set2) :- member(Elem,Set2).

This won't lead to set differences, since it is hard to ask

what is *not* a member (without red cuts and all that).

So, I guess I'll just ask the net again to answer this guy's

question: can you compute sets, should you, and how do you do it?

Damon

--

---------

Tulane University Computer Science Dept.