# Splitting Logical Expression in list of expressions

I have long results of a Reduce statement in the form of {(expr1) || (expr2) || (expr3) || ...}

I am looking for a way to split them into a list {expr1, expr2, expr3, ...}

Even better, I would be happy to split the internal expressions to lists at the '&& operators as well.

• So how do you want a mixture of Ands and Ors to be treated? Jul 16, 2016 at 15:31
• Luckily the || are outside the expressions, and internally the expressions only have &&. I would probably prefer to have it converted into some canonical form first.
– Ron
Jul 16, 2016 at 15:35
• Now that you bring it up: look at BooleanConvert[]. Jul 16, 2016 at 15:41
• In certain cases results of Reduce can be transformed into rules by using ToRules, then this post might be helpful Assign the results from a Solve to variable(s). Nevertheless you should remember that Reduce and Solve are not equivalent in general What is the difference between Reduce and Solve?. Jul 16, 2016 at 15:42
• That was helpful - thanks! (though ToRules didn't apply in this case).
– Ron
Jul 16, 2016 at 16:17

When the expression is inside a List use Apply at level 1

list1 = {(expr1) || (expr2) || (expr3)};

List @@@ list1

(*  {{expr1, expr2, expr3}}  *)

list2 = {(expr1) && (expr2) && (expr3)};

List @@@ list2

(*  {{expr1, expr2, expr3}}  *)


If there is no external List then just use Apply

list3 = (expr1) || (expr2) || (expr3);

List @@ list3

(*  {expr1, expr2, expr3}  *)

list4 = (expr1) && (expr2) && (expr3);

List @@ list4

(*  {expr1, expr2, expr3}  *)
`
• I found out Level does the same thing. Converting to normal form using BooleanConvert prior to applying it helped. Many thanks!
– Ron
Jul 16, 2016 at 16:18