Well suppose you have an expression e1 = x + y. You store "x>0" with x.
We also have a symbol z lying around, and store "z>0" with it.
Now I do ask(Q.positive(e1), Q.positive(y-z)).
You have to pull in the assumptions on e1, but also on z.
I suppose one might just pull in all the assumptions on all symbols
contained in any fact. If we additionally do not allow facts stored in
the .assumptions field to reference any other symbols, this probably
wouldn't be so bad.
On 10.04.2013 17:20, Matthew Rocklin wrote:
I think you would traverse the input expression tree once to collect all
assumptions stored in that tree into a set. You would then use that set
during the computation (maybe this goes into ask?). Probably a tree
would cache its set of assumptions after the first traversal. In what
case would facts change during a computation/query?
It doesn't strike me as the slow part of assumptions. In any case it's
something that you could slowly remove as code developed - fewer and
fewer bits of code would depend on the assumptions field.
But I don't like this idea anyway. I mostly don't like the idea of
adding an extra field to Basic. It makes it substantially less basic.
On Wed, Apr 10, 2013 at 11:01 AM, Tom Bachmann <[email protected]
<mailto:[email protected]>> wrote:
On 10.04.2013 16:56, Matthew Rocklin wrote:
Old and new assumptions differ in a few ways.
1. They store assumptions in different places (this is the main
issue
here I think)
2. They represent assumptions differently
3. They represent relations differently
4. They infer/compute differently
I don't particularly like this idea, but one could consider a
solution
that changes 2,3,4 but doesn't change 1. Alongside the .args tuple,
Basic could also hold an .assumptions frozenset as a field.
Computations that use assumptions could then check both the
global
collection and all assumptions in the expression tree. This
might be an
intermediate step in our development.
I thought about that, but it is not obvious how to make it work. I
suppose you would need to take the transitive closure of all
assumptions. I.e.:
- take all facts, extract all symbols into a list L
-0append the symbols in the expression being queried to L
-for every object in L, read out the assumptions frozenset, and
append it to facts
- start over if the facts have changed
This seems potentially quite slow.
--
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 sympy+unsubscribe@__googlegroups.com
<mailto:sympy%[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/__group/sympy?hl=en-US
<http://groups.google.com/group/sympy?hl=en-US>.
For more options, visit https://groups.google.com/__groups/opt_out
<https://groups.google.com/groups/opt_out>.
--
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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.