Based on m previous comment, here is an example of a Python implementation to check in a brute-force manner that two conditions are equivalent. I just basically test all possible combinations for the logical values of the inputs. This results in $n 2^n$ operations. For example, it takes ~3s on my computer for $n=23$. It is of course much quicker for lower values of $n$, which might be the most frequently occuring situation.
import numpy as np
def exp1(x):
return (x[0,:] & (x[1,:] | x[8,:] | x[9,:]) & \
(x[2,:] | x[3,:] | x[4,:]) & \
(x[5,:] | x[6,:]) & x[7,:]) | \
(x[0,:] & (x[1,:] | x[8,:] | x[9,:]) & \
(x[10,:] | x[11,:]) & x[7,:])
def exp2(x):
return x[0,:] & (x[1,:] | x[8,:] | x[9,:]) & x[7,:] & \
(((x[2,:] | x[3,:] | x[4,:]) & \
(x[5,:] | x[6,:])) | x[10,:] | x[11,:])
# for other logical operations in Python:
# https://numpy.org/doc/stable/reference/arrays.ndarray.html#arithmetic-matrix-multiplication-and-comparison-operations
def compareBoolConditions(exp1,exp2,n):
## 1 - generate all possible combinations
# from itertools import product
# comb = np.array(tuple(product(np.array([True, False]), repeat=n))).T
## 1 - 2nd solution
comb = np.array(np.meshgrid( *[[True, False] for i in range(n)] ) , order='F').T.reshape(-1,n)
## 1 - 3rd solution
# see https://stackoverflow.com/questions/1208118/using-numpy-to-build-an-array-of-all-combinations-of-two-arrays
## 2 - vectorized check
if np.all( exp1(comb) == exp2(comb) ):
print('equivalent conditions')
else:
print('conditions are not equivalent')
compareBoolConditions(exp1, exp2, 12)
I've found multiple solutions to generate the combinations, so depending on the size of your problem you may want to test and choose the faster one.