A few new operators added, first of all we have the negations, `⊈ ⊄ ⊉ ⊅ ∉`

which are self explanatory. The task for this post is that ski on ##prolog asked about solving equations or similar in order to state set equations a little implicit, but also easy generate the set of sets etc. We added two new operators `⊔`

and `∖∖`

. The first one in equations tell you that the varaibles in the terms are a disjoint union and the second one tell you that the variable to the left does not contain the variable to the right. If possible finite sets the system will generate all solutions which means that `X ∪ Y = Z`

will behave nicely and generate solutions if `Z`

is a attributed set, but `X ∩ Y = Z`

would not because the number of solutions are infinte. We have also added support for solutions the subset operator to generate all subsets in case the l.h.s. is variable or formula. The system is not general and quite in it's beginning, but still a bit cool. Now you can do

```
%generates all subsets (note that X must be a attribute guarded).
f1(Z) :- mk({1,2,3},X),Z⊆X.
%generate all disjoint decompositoins.
f2(A,B) :- mk({1,2,3},X),(A⊔B)=X.
%generate all unions decompositoins.
f3(A,B) :- mk({1,2},X),(A∪B)=X.
%generate all decompositions of subsets.
f4(A,B) :- mk({1,2},X),(A⊔B)⊂X.
```

Runing this gives output:

first case:

```
> .* f1(X).
X = {3,2,1}.
X = {2,1}.
X = {3,1}.
X = {1}.
X = {3,2}.
X = {2}.
X = {3}.
X = ∅.
```

second case:

```
> .* f2(A,B).
A = {3,2,1}, B = ∅.
A = {2,1}, B = {3}.
A = {3,1}, B = {2}.
A = {1}, B = {2,3}.
A = {3,2}, B = {1}.
A = {2}, B = {1,3}.
A = {3}, B = {1,2}.
A = ∅, B = {1,2,3}.
```

third case:

```
> .* f3(A,B).
A = {2,1}, B = {1,2}.
A = {2,1}, B = {2}.
A = {2,1}, B = {1}.
A = {2,1}, B = ∅.
A = {1}, B = {1,2}.
A = {1}, B = {2}.
A = {2}, B = {2,1}.
A = {2}, B = {1}.
A = ∅, B = {1,2}.
```

fourth case:

```
> .* f4(A,B).
A = {1,2}, B = ∅.
A = {2}, B = {1}.
A = {1}, B = {2}.
A = ∅, B = {2,1}.
A = {1}, B = ∅.
A = ∅, B = {1}.
A = {2}, B = ∅.
A = ∅, B = {2}.
A = ∅, B = ∅.
```

Happy hacking!

## Comments

comments powered by Disqus