-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
rewrite Expression.__nonzero__() #19040
Comments
comment:1
Be careful that in a lot of Sage place there are
or with So this change would also implies to change all of these in a uniform way. |
comment:2
Replying to @videlec:
This calls
Right, |
comment:3
It's not too bad. Catching |
comment:4
I agree that the change would be actually good (for the reason why you created this ticket). Thoug, for symbolic expression we want to create equations and check their validity
The above will not be enough anymore. What would be the new way of checking? This needs to be emphasized a lot in the documentation as it is backward incompatible. And I guess it is worth a thread on sage-devel. Not necessarily right now, it is always good to have concrete propositions. You should also have a look to |
comment:5
Replying to @videlec:
This is a long-standing omission, and it would resolve conceptual problems of #17700. It would use #19000 and, if that finds no solution, Maxima as before. SMT solvers can also give a satisfying
Three fails. |
comment:7
Actually, proving equality would need quantifiers like:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Dependencies: #18980 |
Commit: |
Author: Ralf Stephan |
Changed dependencies from #18980 to none |
New commits:
|
Changed branch from u/rws/defuse_bool_x__0__performance_bomb to u/rws/19040 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Dependencies: #17984 |
comment:34
This code cannot be separated from #19312 so I included it there. I'll let this ticket stay here for the description unless someone objects. |
Changed branch from u/rws/19040-2 to none |
Changed commit from |
Changed author from Ralf Stephan to none |
comment:36
Replying to @jdemeyer:
Correction: an advanced version of this code cannot be separated from #19312. So, this is already obsolete. If, however, #19312 merge is not in the forseeable future I'll consider presenting this branch for review again. |
comment:38
This will make it necessary to implement some (fast) functions from Pynac-0.5 in Python to achieve the same result. The two remaining fails are quite demanding. |
comment:41
What would be the difference between the output As I already mentioned in comment 24, it makes few sense that In an ideal world, the function
|
comment:42
other remark: If I understand correctly
|
comment:43
Replying to @videlec:
Agreed if we look at equalities. Inequalities can be undecidable if we know one side has no order relation. I don't know if there could be other reasons. I haven't decided yet if
Such will not be in the first versions. |
comment:44
Replying to @rwst:
What do you mean? Do you have an example of such inequality?
But do you have a syntax in mind for it. It would be cool to not multiply ad libitum the |
comment:45
Replying to @videlec:
Comparison of real/infinity with complex.
No syntax in my mind. There could be precedents in SMT-solvers which could be copied. |
comment:46
Replying to @rwst:
Then I would qualify this as undefined and not undecidable. The latter introduces confusion with the standard notion related to proofs and computability. |
comment:47
I will upload a fresh branch with this. |
This comment has been minimized.
This comment has been minimized.
comment:50
Replying to @rwst:
Which probably means lots of user code being broken, see my experience on sage-devel. In my opinion, for any change in this area, be it fixing a perceived bug or not, we definitely need a deprecation. We do not need on what user's code relies and The existing deprecation framework may not be enough: for some time, old and new code should be compared and a warning should be raised if the outcome is different. Users should be able to silence this warning once they have converted their code to the new behaviour; and the sage library should also silence the warning for its own use only. No idea how to implement this nicely, but I see no other option. |
comment:51
The easiest way for the user to see if behaviour has changed is to give the command You seem to be of the opinion that there exists a representative sample of tests that covers all eventualities. Needless to say there isn't---however, Sage development tries to come close with the code coverage tools. I think a good dose of realism can be gathered from, for example https://www.youtube.com/watch?v=VfRVz1iqgKU |
comment:52
The discussion is perhaps theoretical at this moment because there is no branch attached, so I do not know what will actually change. Replying to @rwst:
We are speaking about users, not developers. The most we could perhaps expect from users is to read well-written release notes giving a hint what changed. We do not currently have those.
Library code could call a new method or something like that. But it is certainly ugly. We do have a deprecation policy for much less serious cases: if a method is renamed, we have a one-year deprecation period; the only harm done is that a user gets a message that a method does no longer exist. Changing the behaviour of I see the following options:
Simply making a fundamental change in a random version (say 7.2) and letting users alone with their old code is not an option for me.
Certainly not, I think the contrary. I was surprised that at some point on this ticket, changed behaviour was caught by tests in |
comment:53
Replying to @cheuberg:
The branch is not listed in the ticket field but the recent commits are visible in the comments. The branch can be checked out via |
comment:55
A good way to contribute to this is to review #16397. Mixed order comparison is part of the branch mentioned above. |
Symbolic expressions may be part of type-neutral computations, e.g. matrices, polynomials. Developers do not expect proof machinery to crank up when writing
if x!=0
, but this is just what happens. Sobool(x1!=x2)
should be changed to meannot (x1-x2).is_trivial_zero()
for symbolicx
. The ticket should provide a different interface for cases requiring simplification/proof:bool(rel)
equivalent to(not)(LHS-RHS).is_trivial_zero()
for ==,!= ; and for <, >, <=, >= the result follows alpha order of lhs and rhssatisfiable(rel)
attempting simplification/proof, returning(Yes,example)/False/Undefined
solve(rel)
in case ofsatisfiable=Yes
returning the full solution setholds(rel)
, quick alias ofsatisfiable
(later without giving an example)ex.is_zero(simplify=False)
(default) calling the fastbool(ex==0)
ex.is_zero(simplify=True)
attempting simplification/proof by callingex==0
.holds()prove(rel)
showing more or less steps of simplification (which is out of reach for the moment)This ticket will implement the new behaviour of
bool(rel)
and put all other functionality ofex.__nonzero__()
intoholds()
andex.is_zero(simplify=True)
.See also #19162.
CC: @nexttime @behackl @kcrisman @eviatarbach
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/19040
The text was updated successfully, but these errors were encountered: