Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to dynamically add boolean variables?

I want to experiment with Groebner bases for a system of equations in boolean unknowns. In order to simplify equations I would like to dynamically insert new variables for some terms. Is this possible somehow?

An example could be:

F = BooleanPolynomialRing(4, ["x0", "x1", "x2", "x3"])
F.inject_variables()
eqns = [x0 + x1*x2 + x3 + 1, x0 + x1*x2*x3, x0 + 1]
# now add 'y == x1*x2'
eqns = [x0 + y + x3 + 1, x0 + y*x3, x0 + 1] # NameError: name 'y' is not defined