# How do we express set theoretic extensionality in Mathematica for instance I want it to see {2,1} as equal to {1,2)

I think the title pretty much covers it

• I think we need not create a new type name set,just use function and operator such Union ,Intersection etc. act on the list – cvgmt Oct 13 '20 at 2:23
• Look in the help under "guide/OperationsOnSets" – Daniel Huber Oct 13 '20 at 10:23
• And the proof that {1,2}={1,2} can be found where in the help guide? – Veritas Lux Oct 13 '20 at 15:43

ClearAll[set]
SetAttributes[set, Orderless];
s : set[___] /; ! DuplicateFreeQ[Unevaluated @ s] := DeleteDuplicates[Unevaluated @ s];

set[1, 2] === set[2, 1] === set[1, 1, 2]


True

Just be aware that the built-in function Set has nothing to do with set theory.

• Their needs to be a closer parallel to the axiom of extensionality. I don't want it to know that {1,2}={2,1}, I want to be able to prove from extensionality things like {1,1,1,1,1,2,1,2,1,1}={1,2} but there is an unlimited different presentation for even just a finite set... – Veritas Lux Oct 14 '20 at 19:48
• I think you may need to elaborate your question then, because it's not clear to me what you want to do exactly. – Sjoerd Smit Oct 15 '20 at 8:13
• I want to write the axiom of extensionality in Mathematica. – Veritas Lux Oct 15 '20 at 23:08