# Simplify set-theoretic expressions [duplicate]

This question already has an answer here:

As I can get set-theoretic simplifications of expressions and corresponding Venn diagram for example

(((A \ B) ⋂ (A \ C)) ⋃ ((B \ A) ⋂ (B \ C))  ⋃ ((C \ A) ⋂ (C \ B)))


I get well as the symbols for the symmetric difference and complement

Symmetric Difference: A Δ B  and   '(complement)


## marked as duplicate by m_goldberg, MarcoB, Dr. belisarius, dr.blochwave, Yves KlettJul 20 '15 at 12:32

• Fernando, I am afraid that I do not understand your question. Could you expand it / clarify it, maybe adding an example of Mathematica code that you are struggling with? – MarcoB Jul 20 '15 at 4:00
• I ask for help to create an algorithm that allows me to simplify expressions of the theory of sets, and also plot the corresponientes Venn diagrams. I also ask you to tell me what commands correspond to the "symmetric difference A Δ B " between sets and "complement of a set ' or ^c" The idea is to take as input an expression with joint operations of the simplified and the draw (Venn diagrams) – Fernando Silva Jul 20 '15 at 4:28
• Fernando, even though your question was marked as a duplicate, please consider accepting one of the answers below by clicking on the grey check mark next to the answer. – MarcoB Jul 23 '15 at 5:08

This is not really an answer, but it was too long for a comment.

• Regarding plotting Venn diagrams, take a look at the answers to this question: Hot to plot Venn diagrams.

• For the more general question about manipulating set-theoretic expressions, it seems to me that Mathematica is limited to manipulating finite sets that can be represented as lists. In this connection, see this tutorial on Lists as Sets). The point has been discussed before on this site: Define a mathematical set, and the answer seem mostly negative for the general case.

• Jack Coen at the Colorado School of Mines had developed some functions to use Mathematica for set theory that are detailed in this report: Mathematica packages for Logic and Set Theory. Of course the code may need some updating since 1991...

You can rewrite it in terms of Boolean operators and use Simplify:

((a && ! b) && (a && ! c)) || ((b && ! a) && (b && ! c)) || ((c && ! a) && (c && ! b)) // Simplify

(* a \[Xor] b \[Xor] c \[Xor] (a && b && c) *)


The Xor Boolean operator corresponds to the symmetric difference set operation.

• thanks for the answers to this is sufficient – Fernando Silva Jul 21 '15 at 0:14