({{, (RefLink[LogicalExpand, paclet:ref/LogicalExpand])[expr]
expands out logical combinations of equations, inequalities, and other functions. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[LogicalExpand, paclet:ref/LogicalExpand]) applies distributive laws for logical operations.

(RefLink[LogicalExpand, paclet:ref/LogicalExpand]) generates ORs of ANDs corresponding to disjunctive normal form, with some contractions.

OpenersPrimaryExamplesSection(Spacer1)Examples  (12)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Expand out logic expressions:

LogicalExpand[p&&!(q||r)]

OpenersExampleSection1(Spacer1)Scope  (7)

Represent logic expressions as a disjunction of conjunctions (disjunctive normal form):

LogicalExpand[(a||b)&&!(c||d||e)]

Simplify logic expressions:

LogicalExpand[a||!a]

LogicalExpand[a&&!a]

Expand logic expressions out to forms involving only (RefLink[And, paclet:ref/And]), (RefLink[Or, paclet:ref/Or]), and (RefLink[Not, paclet:ref/Not]):

LogicalExpand[Xor[p,q,r]]

Expand out combinations of equations:

LogicalExpand[x==a&&y==b||x==a||y==b]

Get separate equations for different terms in a series:

Series[f[x]^2,{x,0,2}]==2+x

LogicalExpand[%]

Convert multi-argument equations and inequalities to two-argument form:

x≤y+1<z&&x^2-1==y^2-2==z^2-3

LogicalExpand[%]

Expand negations of (RefLink[Element, paclet:ref/Element]) statements:

LogicalExpand[!Element[x|y|z,Reals]]

OpenersExampleSection2(Spacer1)Applications  (1)

Prove tautologies:

t=Implies[(p||!r)&&s,Implies[r&&s,p&&q||p]]

LogicalExpand[t]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

The output of (RefLink[LogicalExpand, paclet:ref/LogicalExpand]) is equivalent to the input:

e1=Implies[Xor[a,b,c],(a||b)&&c]

e2=LogicalExpand[e1]

Table[e1==e2,{a,{True,False}},{b,{True,False}},{c,{True,False}}]

De Morgan's laws:

LogicalExpand[!(a||b)]

LogicalExpand[!(a&&b)]

OpenersExampleSection4(Spacer1)Neat Examples  (1)

An expanded (RefLink[Xor, paclet:ref/Xor]) of n variables will always contain (2^(n-1)) terms:

LogicalExpand[Xor@@Array[(Subscript[x, #])&,6]]//TraditionalForm

Length[%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Expand, paclet:ref/Expand])  ▪  (RefLink[PiecewiseExpand, paclet:ref/PiecewiseExpand])  ▪  (RefLink[Reduce, paclet:ref/Reduce])  ▪  (RefLink[BooleanConvert, paclet:ref/BooleanConvert])  ▪  (RefLink[Implies, paclet:ref/Implies])  ▪  (RefLink[Resolve, paclet:ref/Resolve])  ▪  (RefLink[And, paclet:ref/And])  ▪  (RefLink[Not, paclet:ref/Not])  ▪  (RefLink[Or, paclet:ref/Or])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Relational and Logical Operators, paclet:tutorial/RelationalAndLogicalOperators])}, {▪(RefLinkPlain[Logical and Piecewise Functions, paclet:tutorial/LogicalAndPiecewiseFunctions])}, {▪(RefLinkPlain[Solving Equations Involving Power Series, paclet:tutorial/SolvingEquationsInvolvingPowerSeries])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Manipulating Equations, paclet:guide/ManipulatingEquations])}, {▪(RefLinkPlain[Inequalities, paclet:guide/Inequalities])}, {▪(RefLinkPlain[Algebraic Transformations, paclet:guide/AlgebraicTransformations])}, {▪(RefLinkPlain[Boolean Computation, paclet:guide/BooleanComputation])}, {▪(RefLinkPlain[Polynomial Systems, paclet:guide/PolynomialSystems])}})}})