({{, (RefLink[BooleanVariables, paclet:ref/BooleanVariables])[expr] 
gives a list of the Boolean variables in the Boolean expression expr.}, {, (RefLink[BooleanVariables, paclet:ref/BooleanVariables])[bf]
gives the number of Boolean variables in the (RefLink[BooleanFunction, paclet:ref/BooleanFunction]) object bf.}})

OpenersNotesSection(Spacer1)Details

In (RefLink[BooleanVariables, paclet:ref/BooleanVariables])[expr], the expression expr can involve any combination of Boolean functions such as (RefLink[And, paclet:ref/And]), (RefLink[Or, paclet:ref/Or]), (RefLink[Not, paclet:ref/Not]), as well as (RefLink[BooleanFunction, paclet:ref/BooleanFunction]) and related functions.

In (RefLink[BooleanVariables, paclet:ref/BooleanVariables])[bf], the expression bf must be a single (RefLink[BooleanFunction, paclet:ref/BooleanFunction]) object.

(RefLink[BooleanVariables, paclet:ref/BooleanVariables])[expr] gives a list of variables in the order returned by (RefLink[Sort, paclet:ref/Sort]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (7)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Find the variables in a Boolean expression:

BooleanVariables[a||!b&&b]

Find the number of variables for a pure (RefLink[BooleanFunction, paclet:ref/BooleanFunction]) object:

BooleanVariables[BooleanFunction[30,3]]

OpenersExampleSection1(Spacer1)Scope  (2)

Find the Boolean variables in a Boolean expression:

BooleanVariables[Xor[a,And[b,Or[c,d]]]]

BooleanVariables[BooleanCountingFunction[2,3][a,b,c]]

Programmatically get the number of arguments to a pure Boolean function:

BooleanVariables[BooleanFunction[12345,20]]

BooleanVariables[BooleanCountingFunction[3,17]]

BooleanVariables[#1&&#199&]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

(RefLink[BooleanVariables, paclet:ref/BooleanVariables]) is by default used as the list of variables for (RefLink[BooleanTable, paclet:ref/BooleanTable]):

BooleanTable[And[c,Or[a,b]]]

BooleanTable[And[c,Or[a,b]],BooleanVariables[And[c,Or[a,b]]]]

Use (RefLink[BooleanVariables, paclet:ref/BooleanVariables]) to get a variable list for (RefLink[SatisfiabilityInstances, paclet:ref/SatisfiabilityInstances]):

v=BooleanVariables[And[c,Or[a,b]]]

SatisfiabilityInstances[And[c,Or[a,b]],v]

(RefLink[FindInstance, paclet:ref/FindInstance]):

FindInstance[And[c,Or[a,b]],v]

(RefLink[Conjunction, paclet:ref/Conjunction]) and (RefLink[Disjunction, paclet:ref/Disjunction]):

Conjunction[And[c,Or[a,b]],v]

Disjunction[And[c,Or[a,b]],v]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

Anything that is not explicitly constructed using Boolean primitives and functions is variable:

BooleanVariables[&&]

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

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Boolean Computation, paclet:guide/BooleanComputation])}})}})