Given two boolean variables x1 and x2 (in the sense that they are in the range [0,1]), if I try to solve the following equation system with Solve:
Solve[{x1 == 1 - x2, x2 == 1 - x1}]
Mathematica will output:
{{x2 -> 1 - x1}}
I am aware that Solve is not treating the variables as boolean, but the statement that x2
can be replaced by the expression 1 - x1
is what I am interested in.
If, instead, I provide Solve with a system of inequalities:
Solve[{x1 != 1 - x2, x2 != 1 - x1}]
Mathematica will output the following error message:
Solve::fulldim: The solution set contains a full-dimensional component; use Reduce for complete solution information. >>
If I try to restrain the variable values in the system:
Solve[{x1 != 1 - x2, x2 != 1 - x1, 0 <= x1 <= 1, 0 <= x2 <= 1}, Integers]
Mathematica will correctly Solve the system:
{{x1 -> 0, x2 -> 0}, {x1 -> 1, x2 -> 1}}
But this is not the response I am interested in. The output I am looking for is
{{x1 -> x2}}
Since it is a logical conclusion that could be made by just looking at the system and knowing the variables are in the range [0,1].
Is there a way to make solve obtain the output {{x1 -> x2}}
instead of the variable values? Or any other function besides Solve that would give me that result?
Solve
will not read your intentions). Could doSolve[{x1 == 1 - x2, x2 == 1 - x1, x1^2==x1, x2^2==x2}, {x1,x2}]
orSolve[{x1 == 1 - x2, x2 == 1 - x1, 0<=x1<=1, 0<=x2<=1}, {x1,x2}, Integer s]
. $\endgroup$