Skip to content
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

AssocOp._eval_template_is_attr is wrong or misused #5662

Open
ness01 opened this issue Jul 15, 2011 · 6 comments
Open

AssocOp._eval_template_is_attr is wrong or misused #5662

ness01 opened this issue Jul 15, 2011 · 6 comments

Comments

@ness01
Copy link
Contributor

ness01 commented Jul 15, 2011

This returns True if all elements have the property, False if at least one has the property set to False and all others have either True/False, and None if at least one element has the property set to None.

This is either not right or not used correctly. e.g.

In [5]: x = Symbol('x', real=True, bounded=False)
In [7]: (x*sin(1/x**2)).is_bounded
Out[7]: False # Wrong?

In [8]: k = Symbol('k', integer=True)
In [9]: (k/3).is_integer
Out[9]: False # Wrong if k=3

On the other hand changing the function to return True if all elements have the property and None otherwise introduces lots of test failures.

Original issue for #5662: http://code.google.com/p/sympy/issues/detail?id=2563
Original author: https://code.google.com/u/104531927090589914088/
Original owner: https://code.google.com/u/104531927090589914088/

@asmeurer
Copy link
Member

I don't completely follow how the _eval_template_is_attr effects the wrong results.

**Labels:** Assumptions  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2563#c1
Original author: https://code.google.com/u/asmeurer@gmail.com/

@rlamy
Copy link
Member

rlamy commented Jul 18, 2011

Yes, it's clearly wrong, we discussed it a bit on IRC previously: http://kottnet.net/irclogs/freenode/chn-%23sympy/2011-06-30.log (starts at 17:07).

Some of the tests failures could be due to the tests being wrong. ISTR there's one somewhere that's equivalent to assert (k/3).is_integer is False.

Original comment: http://code.google.com/p/sympy/issues/detail?id=2563#c2
Original author: https://code.google.com/u/101272611947379421629/

@ness01
Copy link
Contributor Author

ness01 commented Jul 19, 2011

aaron: _eval_template_is_attr is called by various _eval_is_foo methods.

While some of the tests are obviously wrong, some are not. What I'm trying to say is that apparently some uses of _eval_template_is_attr where the current semantics are /correct/.

Original comment: http://code.google.com/p/sympy/issues/detail?id=2563#c3
Original author: https://code.google.com/u/104531927090589914088/

@asmeurer
Copy link
Member

Perhaps it could benefit from a more descriptive name then.  Though I wouldn't go too far redesigning the system beyond fixing this bug, as it's all old assumptions stuff.  Did you try some of these things in the new assumptions to see if they are handled correctly there?

Original comment: http://code.google.com/p/sympy/issues/detail?id=2563#c4
Original author: https://code.google.com/u/asmeurer@gmail.com/

@ness01
Copy link
Contributor Author

ness01 commented Jul 19, 2011

No. I fixed Mul and Add ._eval_is_rational, ronan suggested I should fix _eval_template_..., but I couldn't figure out how to. Hence this bug report.

Original comment: http://code.google.com/p/sympy/issues/detail?id=2563#c5
Original author: https://code.google.com/u/104531927090589914088/

@asmeurer
Copy link
Member

**Status:** Valid  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2563#c6
Original author: https://code.google.com/u/asmeurer@gmail.com/

@ness01 ness01 self-assigned this Mar 7, 2014
@ness01 ness01 removed their assignment Feb 15, 2015
skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
    close sympy/sympy#9173 (test was added in 5a510ac)
    close sympy/sympy#9808 (fixed in 09e539b)
    close sympy/sympy#9341 (fixed in af98a00)
    close sympy/sympy#9908 (fixed in cc3fa8d)
    close sympy/sympy#6171 (test added in d278031)
    close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
    close sympy/sympy#10201 (fixed in 0d0fc5f)
    close sympy/sympy#9057 (test was added in 8290a0c)
    close sympy/sympy#11159 (test was added in ffb76cb)
    close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
    close sympy/sympy#11081 (see ed01e16 and bb92329)
    close sympy/sympy#10974 (see 73fc425)
    close sympy/sympy#10806 (test in 539929a)
    close sympy/sympy#10801 (test in 2fe3da5)
    close sympy/sympy#9549 (test in 88bdefa)
    close sympy/sympy#4231 (test was added in fb411d5)
    close sympy/sympy#8634 (see 2fcbb58)
    close sympy/sympy#8481 (see 1ef20d3)
    close sympy/sympy#9956 (fixed in a34735f)
    close sympy/sympy#9747 (see e117c60)
    close sympy/sympy#7853 (see 3e4fbed)
    close sympy/sympy#9634 (see 2be03f5)
    close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
    close sympy/sympy#9192 (see 9bf622f)
    close sympy/sympy#7130 (see e068fa3)
    close sympy/sympy#8514 (see b2d543b)
    close sympy/sympy#9334 (see 90de625)
    close sympy/sympy#8229 (see 9755b89)
    close sympy/sympy#8061 (see 7054f06)
    close sympy/sympy#7872 (tested in diofant#6)
    close sympy/sympy#3496 (tested in test_log_symbolic)
    close sympy/sympy#2929 (see da7db7a)
    close sympy/sympy#8203 (oo is not a real, see diofant#36)
    close sympy/sympy#7649 (0 is imaginary since diofant#8)
    close sympy/sympy#7256 (fixed in c0a4549)
    close sympy/sympy#6783 (see cb28d63)
    close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
    close sympy/sympy#5295 (fixed with diofant#354)
    close sympy/sympy#4856 (we now have flake/pep tests)
    close sympy/sympy#4555 (flake8 enabled after diofant#214)
    close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
    close sympy/sympy#5484 (see above)

    Added regression tests:
    from https://groups.google.com/forum/#!topic/sympy/LkTMQKC_BOw
    fixes sympy/sympy#8825 (probably via diofant#209)
    fixes sympy/sympy#8635
    fixes sympy/sympy#8157
    fixes sympy/sympy#7872
    fixes sympy/sympy#7599
    fixes sympy/sympy#6179
    fixes sympy/sympy#5415
    fixes sympy/sympy#2865
    fixes sympy/sympy#5907
    fixes sympy/sympy#11722

    Closes diofant#347
skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
    close sympy/sympy#9173 (test was added in 5a510ac)
    close sympy/sympy#9808 (fixed in 09e539b)
    close sympy/sympy#9341 (fixed in af98a00)
    close sympy/sympy#9908 (fixed in cc3fa8d)
    close sympy/sympy#6171 (test added in d278031)
    close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
    close sympy/sympy#10201 (fixed in 0d0fc5f)
    close sympy/sympy#9057 (test was added in 8290a0c)
    close sympy/sympy#11159 (test was added in ffb76cb)
    close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
    close sympy/sympy#11081 (see ed01e16 and bb92329)
    close sympy/sympy#10974 (see 73fc425)
    close sympy/sympy#10806 (test in 539929a)
    close sympy/sympy#10801 (test in 2fe3da5)
    close sympy/sympy#9549 (test in 88bdefa)
    close sympy/sympy#4231 (test was added in fb411d5)
    close sympy/sympy#8634 (see 2fcbb58)
    close sympy/sympy#8481 (see 1ef20d3)
    close sympy/sympy#9956 (fixed in a34735f)
    close sympy/sympy#9747 (see e117c60)
    close sympy/sympy#7853 (see 3e4fbed)
    close sympy/sympy#9634 (see 2be03f5)
    close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
    close sympy/sympy#9192 (see 9bf622f)
    close sympy/sympy#7130 (see e068fa3)
    close sympy/sympy#8514 (see b2d543b)
    close sympy/sympy#9334 (see 90de625)
    close sympy/sympy#8229 (see 9755b89)
    close sympy/sympy#8061 (see 7054f06)
    close sympy/sympy#7872 (tested in diofant#6)
    close sympy/sympy#3496 (tested in test_log_symbolic)
    close sympy/sympy#2929 (see da7db7a)
    close sympy/sympy#8203 (oo is not a real, see diofant#36)
    close sympy/sympy#7649 (0 is imaginary since diofant#8)
    close sympy/sympy#7256 (fixed in c0a4549)
    close sympy/sympy#6783 (see cb28d63)
    close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
    close sympy/sympy#5295 (fixed with diofant#354)
    close sympy/sympy#4856 (we now have flake/pep tests)
    close sympy/sympy#4555 (flake8 enabled after diofant#214)
    close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
    close sympy/sympy#5484 (see above)

    Added regression tests:
    from https://groups.google.com/forum/#!topic/sympy/LkTMQKC_BOw
    fixes sympy/sympy#8825 (probably via diofant#209)
    fixes sympy/sympy#8635
    fixes sympy/sympy#8157
    fixes sympy/sympy#7872
    fixes sympy/sympy#7599
    fixes sympy/sympy#6179
    fixes sympy/sympy#5415
    fixes sympy/sympy#2865
    fixes sympy/sympy#5907
    fixes sympy/sympy#11722

    Closes diofant#347
@smichr smichr removed the Valid label Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants