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
ask returns True instead of raising inconsistent assumptions exception #25349
Comments
Before this fix, extract_predargs was not extracting arguements that were only present in the assumptions in some cases. As a result, satask would fail to raise an inconsistent assumptions exception in some cases. This is now fixed. An unfortunate consequence of this fix is that it makes satask slower. Previously running the tests for the new assumptions took 21.7 +/- .2 seconds for me. Now they take 26.5 +/- .2 seconds.
@ShubhamKJha, @JSS95, @asmeurer can you shed some light on the purpose of this code from the sympy/sympy/assumptions/satask.py Lines 146 to 154 in a76b02f
|
My impression of it is that it's a way to reduce the number of clauses given to the sat solver to speed things up? However, as this bug demonstrates that's problematic for some edge cases. |
It looks like it was a performance optimization #17144. But we need to make sure that whatever optimizations we make are correct. It's better to have correct but slow code than to have code that is fast but gives wrong answers sometimes. |
The problem happens at lines 471 , 472 (of ask.py):
here we lose all of the predicate that don't have x as their argument.
Originally, I had thought this error had originated from satask, but it correctly rasies an exception here:
However, with a little modification satask has the same bug:
The problem is due the
get_all_relevant_facts
function which only thinks facts relating to the variables in the proposition are relevant. Facts about expressions like y which don't appear in the predicate are ignored.Edit: here's a modified case where satask correctly raises the exception:
The text was updated successfully, but these errors were encountered: