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

Assumption bug of positive symbolic variable #21923

Open
mathzeta opened this issue Nov 22, 2016 · 11 comments
Open

Assumption bug of positive symbolic variable #21923

mathzeta opened this issue Nov 22, 2016 · 11 comments

Comments

@mathzeta
Copy link

There is an easily reproducible bug with assumptions:

sage: var("p", domain="positive")
p
sage: assume(p<1)
sage: bool(p<1)
True
sage: bool(p^2<1)
True
sage: bool(p^6<1) # Should be True
False

The same happens for var("p") and then assuming assume(p>0). The following list should be [0..999], but we see something different:

sage: [i for i in range(1000) if bool(p^i < 1)]
[1, 2, 3, 4, 5, 7, 8, 9, 11, 16, 25, 27, 32, 64, 81]

CC: @rwst

Component: symbolics

Keywords: days79

Issue created by migration from https://trac.sagemath.org/ticket/21923

@mathzeta mathzeta added this to the sage-7.5 milestone Nov 22, 2016
@mathzeta
Copy link
Author

Changed keywords from none to days79

@mathzeta

This comment has been minimized.

@mo271
Copy link
Contributor

mo271 commented Nov 22, 2016

comment:2

double floating problem?

sage: [bool(p^(i)<=1+1e-15) for i in range(20)]
[True, True, True, True, True, True, False, True, True, True, False, True, False, False, False, False, True, False, False, False]
sage: [bool(p^(i)<=1+1e-14) for i in range(20)]
[True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]

@mo271
Copy link
Contributor

mo271 commented Nov 22, 2016

comment:3
sage: var("p", domain="positive")
sage: assume(p<1/1000000)
sage: bool(p^6<5)
False

@rwst
Copy link

rwst commented Nov 24, 2016

comment:5

It is well known that there is no reasoning capability in Sage. See for example this thread: https://groups.google.com/d/msg/sage-support/AiPtd0x52kQ/WeOmvlFCEAAJ

The assume command mainly sets Maxima assumptions for use in DEs and integrals. Everything else is experimental.

@rwst
Copy link

rwst commented Nov 24, 2016

comment:6

See also #19162.

@mathzeta
Copy link
Author

comment:7

Yes, this is already in Maxima:

(%i1) assume(p>0);
(%o1)                               [p > 0]
(%i2) assume(p<1);        
(%o2)                               [p < 1]
(%i3) is(p^2<1); 
(%o3)                                true
(%i4) is(p^6<1);        
(%o4)                               unknown

Now I see that http://maxima.sourceforge.net/docs/manual/maxima_11.html#assume mentions
Maxima's deduction mechanism is not very strong; there are many obvious consequences which cannot be determined by is. This is a known weakness.
But Maxima does have a tristate, as can be seen above. See #17700 for more.

Should the milestone of this ticket be changed to sage-duplicate or to sage-wishlist?

@rwst
Copy link

rwst commented Nov 25, 2016

comment:8

I think it's a duplicate of the enhancement ticket #19162.

@rwst rwst removed this from the sage-7.5 milestone Nov 25, 2016
@rwst
Copy link

rwst commented Nov 25, 2016

comment:9

BTW for an overview of existing symbolic tickets please see https://trac.sagemath.org/wiki/symbolics

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Nov 27, 2016

comment:10

I am not sure such tickets should be closed like that. Indeed, compared to #19162, there is a concrete use case (a bug), so it is important to keep track of it in the doctests, even if the fix comes from another ticket. At least, we have to copy the doctest on the other ticket, in order not to lose it.

@dimpase
Copy link
Member

dimpase commented Dec 4, 2021

comment:11

still reproducible in 9.5.beta7

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

4 participants