-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Added is_Boolean = True to relationals #24087
base: master
Are you sure you want to change the base?
Conversation
✅ Hi, I am the SymPy bot (v167). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.12. Click here to see the pull request description that was parsed.
|
Shouldn't this be in |
The problem is that Symbol inherits from Boolean and therefore occupies an ambiguous state where it is both Expr and Boolean at the same time: In [3]: Symbol.mro()
Out[3]:
[sympy.core.symbol.Symbol,
sympy.core.expr.AtomicExpr,
sympy.core.basic.Atom,
sympy.core.expr.Expr,
sympy.logic.boolalg.Boolean,
sympy.core.basic.Basic,
sympy.printing.defaults.Printable,
sympy.core.evalf.EvalfMixin,
object] The purpose of the sympy/sympy/core/relational.py Lines 50 to 52 in e56ce69
As you can see from the comment Eq(x, True) it is possible that we would have a Symbol (both Expr and Boolean) on one side and a proper Boolean on the other. We could equally have Eq(x, 0) where the rhs is a proper Expr.
I don't know if we have an issue for this but there should really be a BooleanSymbol that is separate from Symbol and there should not be any objects that are both Expr and Boolean because that's clearly a contradiction. |
Symbol should be fixed to use the kind system. But also I don't think |
It does use the kind system:
The problem is that this is inconsistent with its usage as a boolean and there is no BooleanSymbol to be used with kind BooleanKind. |
Isn't the point of the kind system that we don't need a bunch of different Symbol classes to represent different types of symbols? There can be just one Symbol and it can have NumberKind or BooleanKind or whatever depending on what sort of object it represents. |
Yes, that's the idea. It should be possible to just do |
The authors test failed because the mailmap file should be sorted. Running the There are also some failures in stats:
I'm not sure what has caused those failures. |
I'm marking this as draft. Feel free to mark it as not draft if it becomes ready for review again. The main thing needed is to figure out what exactly has caused the stats failures. |
References to other Issues or PRs
Fixes #24086
Brief description of what is fixed or changed
Added is_Boolean = True to reationals to fix issue where booleans in equations being passed to Piecewise cause error
AttributeError: 'BooleanTrue' object has no attribute 'as_coeff_Add'
as suggested by @oscarbenjaminOther comments
Release Notes