Skip to content

Commit

Permalink
Merge pull request #26500 from SamLubelsky/xor-fix
Browse files Browse the repository at this point in the history
Fixes Xor simplification with simplify to be consistent with other boolean operators
  • Loading branch information
smichr committed Apr 15, 2024
2 parents 826dd0f + 791181b commit d11d0b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions sympy/logic/boolalg.py
Expand Up @@ -1046,6 +1046,7 @@ def _eval_simplify(self, **kwargs):
# And and Or, we only simplify the partial expressions before using
# patterns
rv = self.func(*[a.simplify(**kwargs) for a in self.args])
rv = rv.to_anf()
if not isinstance(rv, Xor): # This shouldn't really happen here
return rv
patterns = _simplify_patterns_xor()
Expand Down
1 change: 1 addition & 0 deletions sympy/logic/tests/test_boolalg.py
Expand Up @@ -355,6 +355,7 @@ def test_simplification_boolalg():
assert And(Eq(x - 1, 0), Eq(x + 2, 2)).simplify() == False
assert And(Ne(x - 1, 0), Ne(x + 2, 2)).simplify(
) == And(Ne(x, 1), Ne(x, 0))
assert simplify(Xor(x, ~x)) == True


def test_bool_map():
Expand Down

0 comments on commit d11d0b2

Please sign in to comment.