Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find alternative Boolean expressions using a given set of operators
ResourceFunction["FindBooleanAlternative"][expr, ops] finds an alternative expression for a Boolean expression expr in terms of the operators in the list ops. | |
ResourceFunction["FindBooleanAlternative"][expr, ops, n] returns up to n alternative expressions. |
Find alternative Boolean expressions for Nand and Implies:
In[1]:= | ![]() |
Out[1]= | ![]() |
In[2]:= | ![]() |
Out[2]= | ![]() |
Find three Boolean alternative expressions for Implies in terms of Nand:
In[3]:= | ![]() |
Out[3]= | ![]() |
Find all Boolean alternative expressions:
In[4]:= | ![]() |
Out[4]= | ![]() |
Express Majority in terms of And and Or:
In[5]:= | ![]() |
Out[5]= | ![]() |
Transform a BooleanFunction:
In[6]:= | ![]() |
Out[6]= | ![]() |
The "MaxSize" option specifies the maximum size of expressions to search for (default is 8):
In[7]:= | ![]() |
Out[7]= | ![]() |
Specify a larger "MaxSize":
In[8]:= | ![]() |
Out[8]= | ![]() |
FindBooleanAlternative is able to find the same forms of expressions as BooleanConvert:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
FindBooleanAlternative is able to find different alternatives, not necessary the canonical one:
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
For Boolean expressions not representable using a provided set of operators, FindBooleanAlternatives will try to find one until maximum expression size is reached, which may take a long time:
In[13]:= | ![]() |
Out[13]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License