Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

BooleanLogic

Tutorials

  • BooleanBasics

Guides

  • Logic

Tech Notes

  • Boolean Basics

Symbols

  • AllBooleanFormsLiteralCounts
  • AllBooleanForms
  • AllMinimalBooleanFormsLiteralCounts
  • AllMinimalBooleanForms
  • BooleanCompose
  • BooleanStructureData
  • BooleanTruthInputData
  • FindBooleanAlternative
  • InverseBoole
  • RandomBooleanFunction
  • TruthTable
  • VennDiagram
Boolean Basics
​
The functions defined in the
BooleanLogic`
context provide support for finding solutions to logic problems.
This loads the package:
In[31]:=
Needs["PeterBurbery`BooleanLogic`"]
AllBooleanForms
find all forms of a boolean function
RandomBooleanFunction
create a random boolean function for testing purposes
XXXX.
Find all forms of Or:
In[36]:=
AllBooleanForms
[Or[b,c]]//TraditionalForm
Out[36]//TraditionalForm=
DNFb∨c,SOPb∨c,CNFb∨c,POSb∨c,ESOPc⊻(b∧¬c),ANFb⊻c⊻(b∧c),NOR¬(b⊽c),NAND¬b⊼¬c,AND¬(¬b∧¬c),ORb∨c,IMPLIES¬bc,ITEIf[b,True,If[c,True,False]],IFIf[b,True,If[c,True,False]],BFFBooleanFunction
Number of variables: 2
Function index: 14
(b,c),BDTb∨(¬b∧c)
And:
In[37]:=
AllBooleanForms
[And[b,c]]//TraditionalForm
Out[37]//TraditionalForm=
DNFb∧c,SOPb∧c,CNFb∧c,POSb∧c,ESOPb∧c,ANFb∧c,NOR¬b⊽¬c,NAND¬(b⊼c),ANDb∧c,OR¬(¬b∨¬c),IMPLIES¬(b¬c),ITEIf[b,If[c,True,False],False],IFIf[b,If[c,True,False],False],BFFBooleanFunction
Number of variables: 2
Function index: 8
(b,c),BDTb∧c
Nor:
In[38]:=
AllBooleanForms
[Nor[b,c]]//TraditionalForm
Out[38]//TraditionalForm=
DNF¬b∧¬c,SOP¬b∧¬c,CNF¬b∧¬c,POS¬b∧¬c,ESOP¬b∧¬c,ANF¬(b⊻c⊻(b∧c)),NORb⊽c,NAND¬(¬b⊼¬c),AND¬b∧¬c,OR¬(b∨c),IMPLIES¬(¬bc),ITEIf[b,False,If[c,False,True]],IFIf[b,False,If[c,False,True]],BFFBooleanFunction
Number of variables: 2
Function index: 1
(b,c),BDT¬b∧¬c
Nand:
In[39]:=
AllBooleanForms
[Nand[b,c]]//TraditionalForm
Out[39]//TraditionalForm=
DNF¬b∨¬c,SOP¬b∨¬c,CNF¬b∨¬c,POS¬b∨¬c,ESOP(¬b∧c)⊻¬c,ANF¬(b∧c),NOR¬(¬b⊽¬c),NANDb⊼c,AND¬(b∧c),OR¬b∨¬c,IMPLIESb¬c,ITEIf[b,If[c,False,True],True],IFIf[b,If[c,False,True],True],BFFBooleanFunction
Number of variables: 2
Function index: 7
(b,c),BDT(b∧¬c)∨¬b
Xor:
In[40]:=
AllBooleanForms
[Xor[b,c]]//TraditionalForm
Out[40]//TraditionalForm=
DNF(b∧¬c)∨(¬b∧c),SOP(b∧¬c)∨(¬b∧c),CNF(¬b∨¬c)∧(b∨c),POS(¬b∨¬c)∧(b∨c),ESOP(b∧¬c)⊻(¬b∧c),ANFb⊻c,NOR(¬b⊽¬c)⊽(b⊽c),NAND(b⊼¬c)⊼(¬b⊼c),AND¬(b∧c)∧¬(¬b∧¬c),OR¬(¬b∨c)∨¬(b∨¬c),IMPLIES(bc)¬(¬b¬c),ITEIf[b,If[c,False,True],If[c,True,False]],IFIf[b,If[c,False,True],If[c,True,False]],BFFBooleanFunction
Number of variables: 2
Function index: 6
(b,c),BDT(b∧¬c)∨(¬b∧c)
Xnor:
In[41]:=
AllBooleanForms
[Xnor[b,c]]//TraditionalForm
Out[41]//TraditionalForm=
DNF(b∧c)∨(¬b∧¬c),SOP(b∧c)∨(¬b∧¬c),CNF(¬b∨c)∧(b∨¬c),POS(¬b∨c)∧(b∨¬c),ESOP(b∧c)⊻(¬b∧¬c),ANF¬(b⊻c),NOR(¬b⊽c)⊽(b⊽¬c),NAND(b⊼c)⊼(¬b⊼¬c),AND¬(b∧¬c)∧¬(¬b∧c),OR¬(¬b∨¬c)∨¬(b∨c),IMPLIES(b¬c)¬(¬bc),ITEIf[b,If[c,True,False],If[c,False,True]],IFIf[b,If[c,True,False],If[c,False,True]],BFFBooleanFunction
Number of variables: 2
Function index: 9
(b,c),BDT(b∧c)∨(¬b∧¬c)
the logical implies function:
In[42]:=
AllBooleanForms
[Implies[b,c]]//TraditionalForm
Out[42]//TraditionalForm=
DNF¬b∨c,SOP¬b∨c,CNF¬b∨c,POS¬b∨c,ESOPc⊻(¬b∧¬c),ANF¬(b⊻(b∧c)),NOR¬(¬b⊽c),NANDb⊼¬c,AND¬(b∧¬c),OR¬b∨c,IMPLIESbc,ITEIf[b,If[c,True,False],True],IFIf[b,If[c,True,False],True],BFFBooleanFunction
Number of variables: 2
Function index: 11
(b,c),BDT(b∧c)∨¬b
The logical iff function:
In[43]:=
AllBooleanForms
[Equivalent[b,c]]//TraditionalForm
Out[43]//TraditionalForm=
DNF(b∧c)∨(¬b∧¬c),SOP(b∧c)∨(¬b∧¬c),CNF(¬b∨c)∧(b∨¬c),POS(¬b∨c)∧(b∨¬c),ESOP(b∧c)⊻(¬b∧¬c),ANF¬(b⊻c),NOR(¬b⊽c)⊽(b⊽¬c),NAND(b⊼c)⊼(¬b⊼¬c),AND¬(b∧¬c)∧¬(¬b∧c),OR¬(¬b∨¬c)∨¬(b∨c),IMPLIES(b¬c)¬(¬bc),ITEIf[b,If[c,True,False],If[c,False,True]],IFIf[b,If[c,True,False],If[c,False,True]],BFFBooleanFunction
Number of variables: 2
Function index: 9
(b,c),BDT(b∧c)∨(¬b∧¬c)
Find all forms of a function where at most two conditions are true:
In[33]:=
AllBooleanForms
[BooleanCountingFunction[2,4][b,c,d,e]]//TraditionalForm
Out[33]//TraditionalForm=
DNF(¬b∧¬c)∨(¬b∧¬d)∨(¬b∧¬e)∨(¬c∧¬d)∨(¬c∧¬e)∨(¬d∧¬e),SOP(¬b∧¬c)∨(¬b∧¬d)∨(¬b∧¬e)∨(¬c∧¬d)∨(¬c∧¬e)∨(¬d∧¬e),CNF(¬b∨¬c∨¬d)∧(¬b∨¬c∨¬e)∧(¬b∨¬d∨¬e)∧(¬c∨¬d∨¬e),POS(¬b∨¬c∨¬d)∧(¬b∨¬c∨¬e)∧(¬b∨¬d∨¬e)∧(¬c∨¬d∨¬e),ESOP(¬d∧¬e)⊻(¬c∧d∧¬e)⊻(¬c∧¬d∧e)⊻(¬b∧c∧d∧¬e)⊻(¬b∧c∧¬d∧e)⊻(¬b∧¬c∧d∧e),ANF¬((b∧c∧d)⊻(b∧c∧e)⊻(b∧d∧e)⊻(c∧d∧e)⊻(b∧c∧d∧e)),NOR(¬b⊽¬c⊽¬d)⊽(¬b⊽¬c⊽¬e)⊽(¬b⊽¬d⊽¬e)⊽(¬c⊽¬d⊽¬e),NAND(¬b⊼¬c)⊼(¬b⊼¬d)⊼(¬b⊼¬e)⊼(¬c⊼¬d)⊼(¬c⊼¬e)⊼(¬d⊼¬e),AND¬(b∧c∧d)∧¬(b∧c∧e)∧¬(b∧d∧e)∧¬(c∧d∧e),OR¬(b∨c)∨¬(b∨d)∨¬(b∨e)∨¬(c∨d)∨¬(c∨e)∨¬(d∨e),IMPLIES(b¬((c(¬de))¬(¬c¬(d¬e))))¬(¬b¬(c(d¬e))),ITEIf[b,If[c,If[d,False,If[e,False,True]],If[d,If[e,False,True],True]],If[c,If[d,If[e,False,True],True],True]],IFIf[b,If[c,If[d,False,If[e,False,True]],If[d,If[e,False,True],True]],If[c,If[d,If[e,False,True],True],True]],BFFBooleanFunction
Number of variables: 4
Function index: 6015
(b,c,d,e),BDT(b∧¬((c∧(d∨(¬d∧e)))∨(¬c∧d∧e)))∨(¬b∧¬(c∧d∧e))
Find all forms of a function where exactly two conditions are true:
In[34]:=
AllBooleanForms
[BooleanCountingFunction[{2},4][b,c,d,e]]//TraditionalForm
Out[34]//TraditionalForm=
DNF(b∧c∧¬d∧¬e)∨(b∧¬c∧d∧¬e)∨(b∧¬c∧¬d∧e)∨(¬b∧c∧d∧¬e)∨(¬b∧c∧¬d∧e)∨(¬b∧¬c∧d∧e),SOP(b∧c∧¬d∧¬e)∨(b∧¬c∧d∧¬e)∨(b∧¬c∧¬d∧e)∨(¬b∧c∧d∧¬e)∨(¬b∧c∧¬d∧e)∨(¬b∧¬c∧d∧e),CNF(¬b∨¬c∨¬d)∧(¬b∨¬c∨¬e)∧(¬b∨¬d∨¬e)∧(b∨c∨d)∧(b∨c∨e)∧(b∨d∨e)∧(¬c∨¬d∨¬e)∧(c∨d∨e),POS(¬b∨¬c∨¬d)∧(¬b∨¬c∨¬e)∧(¬b∨¬d∨¬e)∧(b∨c∨d)∧(b∨c∨e)∧(b∨d∨e)∧(¬c∨¬d∨¬e)∧(c∨d∨e),ESOP(b∧c∧¬d∧¬e)⊻(b∧¬c∧d∧¬e)⊻(b∧¬c∧¬d∧e)⊻(¬b∧c∧d∧¬e)⊻(¬b∧c∧¬d∧e)⊻(¬b∧¬c∧d∧e),ANF(b∧c)⊻(b∧d)⊻(b∧e)⊻(c∧d)⊻(c∧e)⊻(d∧e)⊻(b∧c∧d)⊻(b∧c∧e)⊻(b∧d∧e)⊻(c∧d∧e),NOR(¬b⊽¬c⊽¬d)⊽(¬b⊽¬c⊽¬e)⊽(¬b⊽¬d⊽¬e)⊽(b⊽c⊽d)⊽(b⊽c⊽e)⊽(b⊽d⊽e)⊽(¬c⊽¬d⊽¬e)⊽(c⊽d⊽e),NAND(b⊼c⊼¬d⊼¬e)⊼(b⊼¬c⊼d⊼¬e)⊼(b⊼¬c⊼¬d⊼e)⊼(¬b⊼c⊼d⊼¬e)⊼(¬b⊼c⊼¬d⊼e)⊼(¬b⊼¬c⊼d⊼e),AND¬(b∧c∧d)∧¬(b∧c∧e)∧¬(b∧d∧e)∧¬(¬b∧¬c∧¬d)∧¬(¬b∧¬c∧¬e)∧¬(¬b∧¬d∧¬e)∧¬(c∧d∧e)∧¬(¬c∧¬d∧¬e),OR¬(¬b∨¬c∨d∨e)∨¬(¬b∨c∨¬d∨e)∨¬(¬b∨c∨d∨¬e)∨¬(b∨¬c∨¬d∨e)∨¬(b∨¬c∨d∨¬e)∨¬(b∨c∨¬d∨¬e),IMPLIES(b¬((c(¬de))¬(¬c¬((de)¬(¬d¬e)))))¬(¬b¬((c¬((de)¬(¬d¬e)))¬(¬c(d¬e)))),ITEIf[b,If[c,If[d,False,If[e,False,True]],If[d,If[e,False,True],If[e,True,False]]],If[c,If[d,If[e,False,True],If[e,True,False]],If[d,If[e,True,False],False]]],IFIf[b,If[c,If[d,False,If[e,False,True]],If[d,If[e,False,True],If[e,True,False]]],If[c,If[d,If[e,False,True],If[e,True,False]],If[d,If[e,True,False],False]]],BFFBooleanFunction
Number of variables: 4
Function index: 5736
(b,c,d,e),BDT(b∧¬((c∧(d∨(¬d∧e)))∨(¬c∧((d∧e)∨(¬d∧¬e)))))∨(¬b∧¬((c∧((d∧e)∨(¬d∧¬e)))∨(¬c∧¬(d∧e))))
Find all forms of a function where between 2 and 3 conditions are true:
In[35]:=
AllBooleanForms
[BooleanCountingFunction[{2,3},4][b,c,d,e]]//TraditionalForm
Out[35]//TraditionalForm=
DNF(b∧c∧¬d)∨(b∧¬c∧d)∨(b∧¬d∧e)∨(¬b∧c∧d)∨(c∧d∧¬e)∨(c∧¬d∧e)∨(¬c∧d∧e),SOP(b∧c∧¬d)∨(b∧¬c∧d)∨(b∧¬d∧e)∨(¬b∧c∧d)∨(c∧d∧¬e)∨(c∧¬d∧e)∨(¬c∧d∧e),CNF(¬b∨¬c∨¬d∨¬e)∧(b∨c∨d)∧(b∨c∨e)∧(b∨d∨e)∧(c∨d∨e),POS(¬b∨¬c∨¬d∨¬e)∧(b∨c∨d)∧(b∨c∨e)∧(b∨d∨e)∧(c∨d∨e),ESOP(c∧d∧¬e)⊻(c∧¬d∧e)⊻(¬c∧d∧e)⊻(b∧c∧¬d∧¬e)⊻(b∧¬c∧d∧¬e)⊻(b∧¬c∧¬d∧e)⊻(¬b∧c∧d∧e),ANF(b∧c)⊻(b∧d)⊻(b∧e)⊻(c∧d)⊻(c∧e)⊻(d∧e),NOR(¬b⊽¬c⊽¬d⊽¬e)⊽(b⊽c⊽d)⊽(b⊽c⊽e)⊽(b⊽d⊽e)⊽(c⊽d⊽e),NAND(b⊼c⊼¬d)⊼(b⊼¬c⊼d)⊼(b⊼¬d⊼e)⊼(¬b⊼c⊼d)⊼(c⊼d⊼¬e)⊼(c⊼¬d⊼e)⊼(¬c⊼d⊼e),AND¬(b∧c∧d∧e)∧¬(¬b∧¬c∧¬d)∧¬(¬b∧¬c∧¬e)∧¬(¬b∧¬d∧¬e)∧¬(¬c∧¬d∧¬e),OR¬(¬b∨¬c∨d)∨¬(¬b∨c∨¬d)∨¬(¬b∨d∨¬e)∨¬(b∨¬c∨¬d)∨¬(¬c∨¬d∨e)∨¬(¬c∨d∨¬e)∨¬(c∨¬d∨¬e),IMPLIES(b¬((c¬(d¬e))¬(¬c¬(¬de))))¬(¬b¬((c¬(¬de))¬(¬c(d¬e)))),ITEIf[b,If[c,If[d,If[e,False,True],True],If[d,True,If[e,True,False]]],If[c,If[d,True,If[e,True,False]],If[d,If[e,True,False],False]]],IFIf[b,If[c,If[d,If[e,False,True],True],If[d,True,If[e,True,False]]],If[c,If[d,True,If[e,True,False]],If[d,If[e,True,False],False]]],BFFBooleanFunction
Number of variables: 4
Function index: 32488
(b,c,d,e),BDT(b∧¬((c∧d∧e)∨(¬c∧¬(d∨(¬d∧e)))))∨(¬b∧((c∧(d∨(¬d∧e)))∨(¬c∧d∧e)))
1, 3, or 5 conditions are true:
Exactly 1, 4, or 5 conditions are true:
Find all forms for a consecutive-2-out-of-3 boolean function:
Find all forms for a consecutive-2-out-of-3 boolean function that circles back:
Find all forms for a cylinder boolean consecutive function:

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com