# Completely expand and simplify logical expressions?

Consider a logical expression such as

expr = (a == b + q - w || c == d) && (q + c - d == w || e == r);


I wonder if there is a function that would completely expand the nested brackets and fully simplify each case, e.g.:

expr // ExpandAndSimplify


(a + w == b + q && c + r == d + e) || (a == b && q == w) ||

(c == d && q == w) || (c == d && r == e)

Is there such a function in Mathematica? Or maybe one can implement it somehow?

• Does expr // Reduce give you what you want? – Andrew Norton Aug 4 '19 at 22:30
• @AndrewNorton Oh, yes it does, thanks for pointing it out! – Kagaratsch Aug 4 '19 at 22:33