When using sets, adding an Element to the Set is done like this:

```
add_to_set(Element, [], [Element]).

add_to_set(Element, [Element | Set], [Element | Set]).

add_to_set(Element, [Element1 | Set], [Element1 | NewSet]) :-
  not(Element = Element1),
  add_to_set(Element, Set, NewSet).

```

Now, with this, I thought member\_of\_set would be like:

```
member_of_set(Element, [Element|_]).

member_of_set(Element, [Element1|Set]) :-
  not(Element = Element1), /* Not necessary */
  member_of_set(Element, Set).

```

This works like a charm, but in this case, `not(Element = Element1)` is not necessary. I can't seem to figure out why. If you ask for more answers from Prolog, won't it backtrack and succeed on the second clause of `member_of_set`?

An if it's not necessary in the `member_of_set`, then why is it necessary in the `add_to_set`?

Please keep in mind that I'm only studying since one month Prolog, so I'm still in some kind of mind switch... 

I know that using cut, there's probably better alternatives, but cut shouldn't be used.