On Tue, Aug 26, 2014 at 10:15 PM, Aaron Meurer <[email protected]> wrote:

>
>
>
> On Tue, Aug 26, 2014 at 10:03 PM, Chris Smith <[email protected]> wrote:
>
>>
>>> Or I don't understand your problem [about the problem with calling for
>>> arg in the new assumptions handler]
>>>
>>
>> The problem is that arg is written using old assumptions, so unless you
>> rewrite arg to use the new assumptions and pass assumptions along to it,
>> you won't get the benefit of its computations. Here's a trivial example
>> using foo instead of arg but hopefully the point comes across:
>>
>> def foo(e):
>>     if e.is_positive:  return True
>>     return False
>>
>> Say that in a NEW handler you want to try
>>
>>    ...
>>    if foo(e): return 1
>>    else: return 2
>>    ...
>>
>> You will always get 2 if e is a symbol because when you call, say,
>>
>> ask(Q.Bar(x), Q.positive(x))
>>
>> x has no direct assumption so False will be returned from foo and thus 2
>> will result from the ask. So unless we either 1) assign assumptions to
>> symbols (but that will not be sufficient to handle things like Q.positive(x
>> + 2) or 2) start passing assumptions to all functions which have a
>> dependence on assumptions (so something like def foo(e) -> def foo(e,
>> assumptions={})) I don't know how we are going to get the
>> old-assumptions-API-based functions to start working with the new
>> assumptions. What am I missing? How will foo above need to be modified so
>> it works?
>>
>
> This is asking for the reverse of what I am suggesting. I am suggesting
> making the new assumptions recognize assumptions made in the old
> assumptions. You want the old assumptions to recognize assumptions made in
> the new assumptions.
>
> I tried doing it both ways, and it failed. It's too much work. I think
> just doing it in one direction is better, as then it only affects calls to
> ask(). We could even limit it further so that ask() only looks at the old
> assumptions on symbols. I suspect this change would lead to no test
> failures.
>

I gave this a shot, and, well, the tests take a long time to run. But so
far, there has only been one test failures, because x.is_commutative is
true by default, so the test ask(Q.commutative(x), ~Q.commutative(x))
fails. I guess one would also have to allow the new assumptions to override
the old, or else check that they don't conflict.

I pushed a proof of concept to https://github.com/sympy/sympy/pull/7925. It
probably shouldn't be merged yet, one because of the issue I noted above,
and two because the new and old assumptions still disagree on some things.
 I hope this at least gives an idea of what I am talking about, though.

Aaron Meurer


>
>
> Aaron Meurer
>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sympy.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/e664b892-c9e9-4cbf-b5be-0d6b6c123615%40googlegroups.com
>> <https://groups.google.com/d/msgid/sympy/e664b892-c9e9-4cbf-b5be-0d6b6c123615%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6K-acR34BxKthik3u-sCkEpxkdf4-Lv-oTw3qUbzT4noA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to