-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subs
raises assertion when substituting with constant
#118
Comments
Actually is seems that >>> eq = boolean.BooleanAlgebra().parse("(I0&I1&~I2&~I4&I5)|(I0&~I1&I2&I5)|(I0&~I1&I4)|(I0&I2&I4&~I5)|(~I0&~I1&I2&~I4&~I5)|(I1&I2&I4&I5)")
>>> eq.subs({boolean.Symbol("I5"):True})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 743, in subs
expr = self._subs(substitutions, default, simplify)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 781, in _subs
new_arg = arg._subs(substitutions, default, simplify)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 796, in _subs
newexpr = self.__class__(*new_arguments)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 1569, in __init__
super(AND, self).__init__(arg1, arg2, *args)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 1236, in __init__
super(DualBase, self).__init__(arg1, arg2, *args)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 1042, in __init__
assert all(
AssertionError: Bad arguments: all arguments must be an Expression: (Symbol('I0'), Symbol('I1'), NOT(Symbol('I2')), NOT(Symbol('I4')), True)
>>> eq = eq.simplify()
>>> eq.subs({boolean.Symbol("I5"):True})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 743, in subs
expr = self._subs(substitutions, default, simplify)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 781, in _subs
new_arg = arg._subs(substitutions, default, simplify)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 796, in _subs
newexpr = self.__class__(*new_arguments)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 1569, in __init__
super(AND, self).__init__(arg1, arg2, *args)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 1236, in __init__
super(DualBase, self).__init__(arg1, arg2, *args)
File "/home/jgoeders/bfasst/.venv/lib/python3.10/site-packages/boolean/boolean.py", line 1042, in __init__
assert all(
AssertionError: Bad arguments: all arguments must be an Expression: (Symbol('I0'), Symbol('I1'), NOT(Symbol('I2')), NOT(Symbol('I4')), True) |
jgoeders
changed the title
Oct 27, 2023
subs
raises assertion when equation is not simplified and is not dependent on inputsubs
raises assertion when substituting with constant
Ok, it seems I'm not supposed to use the Python Is this then the preferred way to access the class-level >>> eq = boolean.BooleanAlgebra().parse("A|B|C")
>>> eq.subs({boolean.Symbol("A"):eq.TRUE}).simplify()
TRUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: