({{, (RefLink[BooleanConvert, paclet:ref/BooleanConvert])[expr] 
converts the Boolean expression expr to disjunctive normal form.}, {, (RefLink[BooleanConvert, paclet:ref/BooleanConvert])[expr,form]
converts the Boolean expression expr to the specified form.}, {, (RefLink[BooleanConvert, paclet:ref/BooleanConvert])[expr,form,cond]
finds an expression in the specified form that is equivalent to expr when cond is true.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[BooleanConvert, paclet:ref/BooleanConvert])[expr,form] will produce an expression equivalent to expr.

Available forms are:

The expression expr can contain any Boolean or logical functions, including (RefLink[BooleanFunction, paclet:ref/BooleanFunction]), (RefLink[BooleanCountingFunction, paclet:ref/BooleanCountingFunction]), etc.

(RefLink[BooleanConvert, paclet:ref/BooleanConvert])[bf,form] converts the internal form of a pure (RefLink[BooleanFunction, paclet:ref/BooleanFunction]) object.

(RefLink[BooleanConvert, paclet:ref/BooleanConvert]) supports a (RefLink[Method, paclet:ref/Method]) option that specifies the detailed method to use.

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Convert a Boolean expression to disjunctive normal form:

BooleanConvert[Equivalent[x,y,z]]

Convert x⊻y to some common forms:

Table[BooleanConvert[Xor[x,y],fm],{fm,{"DNF","CNF","NAND","NOR"}}]

Convert x⊻y⊻z using the condition that x∧(y∨z) is true:

BooleanConvert[Xor[x,y,z],"DNF",x∧(y∨z)]

Show that the output is equivalent to the input when x∧(y∨z):

TautologyQ[Implies[x∧(y∨z),Equivalent[Xor[x,y,z],%]]]

OpenersExampleSection1(Spacer1)Scope  (2)

Convert a Boolean expression to different forms:

expr=BooleanCountingFunction[{2,3},4][a,b,c,d]

Disjunctive normal form:

e1=BooleanConvert[expr]

Conjunctive normal form:

e2=BooleanConvert[expr,"CNF"]

Exclusive sum of products:

e3=BooleanConvert[expr,"ESOP"]

Algebraic normal form:

e4=BooleanConvert[expr,"ANF"]

Two-level (RefLink[Nand, paclet:ref/Nand]) and (RefLink[Not, paclet:ref/Not]):

e5=BooleanConvert[expr,"NAND"]

Two-level (RefLink[Nor, paclet:ref/Nor]) and (RefLink[Not, paclet:ref/Not]):

e6=BooleanConvert[expr,"NOR"]

Two-level (RefLink[And, paclet:ref/And]) and (RefLink[Not, paclet:ref/Not]):

e7=BooleanConvert[expr,"AND"]

Two-level (RefLink[Or, paclet:ref/Or]) and (RefLink[Not, paclet:ref/Not]):

e8=BooleanConvert[expr,"OR"]

(RefLink[Implies, paclet:ref/Implies]) and (RefLink[Not, paclet:ref/Not]):

e9=BooleanConvert[expr,"IMPLIES"]

(RefLink[If, paclet:ref/If]) and constants:

e10=BooleanConvert[expr,"ITE"]

Boolean function form:

e11=BooleanConvert[expr,"BFF"]

Boolean decision tree:

e12=BooleanConvert[expr,"BDT"]

Show that they are all equivalent:

TautologyQ[Equivalent[expr,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12]]

Convert a Boolean function using a "care set" or condition:

f=BooleanCountingFunction[{2,3},4][a,b,c,d]

cond=Xor[a,b,c,d]

g=BooleanConvert[f,cond]

h=BooleanConvert[f,"CNF",cond]

The resulting forms are equivalent when cond is true:

TautologyQ[Implies[cond,Equivalent[f,g,h]]]

They are not equivalent without the condition:

TautologyQ[Equivalent[f,g,h]]

Typically the forms are longer without conditions:

BooleanConvert[f]

BooleanConvert[f,"CNF"]

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

The output from (RefLink[BooleanConvert, paclet:ref/BooleanConvert]) is equivalent to its input:

f=BooleanFunction[228,3][a,b,c]

g=BooleanConvert[f]

TautologyQ[Equivalent[f,g]]

The output from (RefLink[BooleanConvert, paclet:ref/BooleanConvert]) with condition is conditionally equivalent to its input:

f=BooleanFunction[158,{a,b,c}]

cond=a||b||c;

g=BooleanConvert[f,"DNF",cond]

The forms f and g are equivalent when cond is true:

TautologyQ[Implies[cond,Equivalent[f,g]]]

They are not equivalent on their own:

TautologyQ[Equivalent[f,g]]

Use (RefLink[BooleanMinimize, paclet:ref/BooleanMinimize]) to get the minimal length form:

f=BooleanConvert[BooleanCountingFunction[{1,2},3][a,b,c]]

g=BooleanMinimize[f]

The forms are equivalent:

TautologyQ[Equivalent[f,g]]

OpenersExampleSection4(Spacer1)Neat Examples  (1)

{a,b,c,d}=Table[Graphics[{col,Disk[]},ImageSize->25],{col,{Red,Green,Blue,Yellow}}]

BooleanConvert[Xor[a,b,c,d]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BooleanMinimize, paclet:ref/BooleanMinimize])  ▪  (RefLink[LogicalExpand, paclet:ref/LogicalExpand])  ▪  (RefLink[BooleanFunction, paclet:ref/BooleanFunction])  ▪  (RefLink[BooleanTable, paclet:ref/BooleanTable])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Boolean Computation, paclet:guide/BooleanComputation])}, {▪(RefLinkPlain[Algebraic Transformations, paclet:guide/AlgebraicTransformations])}, {▪(RefLinkPlain[Theorem Proving, paclet:guide/TheoremProving])}, {▪(RefLinkPlain[Logic & Boolean Algebra, paclet:guide/LogicAndBooleanAlgebra])}, {▪(RefLinkPlain[Computational Systems, paclet:guide/ComputationalSystemsAndDiscovery])}})}})