Content-Length: 379412 | pFad | http://github.com/sympy/sympy/pull/27461/files/b5a3dae0b4cbe4d2fa5907d8f751089a558972e8

73 Fixes issue #27450 by exclusively handelling the edge case in the IntegerPredicate. by GaganMishra305 · Pull Request #27461 · sympy/sympy · GitHub
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

Fixes issue #27450 by exclusively handelling the edge case in the IntegerPredicate. #27461

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
288c48f
Fixes issue #27450 by exclusively handeling the edge case in the assu…
GaganMishra305 Jan 8, 2025
0070754
Tried resolving the test issues
GaganMishra305 Jan 9, 2025
253c15f
Merge branch 'sympy:master' into solves-integer-issue
GaganMishra305 Jan 9, 2025
650c940
Modified mailmap as needed.
GaganMishra305 Jan 9, 2025
bdb6f0c
Moved the tests from core to the required destination.
GaganMishra305 Jan 10, 2025
1c5d5bf
Removed any alteration done to the core file.
GaganMishra305 Jan 10, 2025
b5a3dae
Maintaining code quality
GaganMishra305 Jan 10, 2025
a8a50ee
Modified is_integer to ask(Q.integer).
GaganMishra305 Jan 10, 2025
ca55f04
Improved the logic of pow in assumptions.
GaganMishra305 Jan 14, 2025
078a7c0
Merge branch 'sympy:master' into solves-integer-issue
GaganMishra305 Jan 14, 2025
5d8444e
Old to new assumptions.
GaganMishra305 Jan 14, 2025
2e283cc
Removed extra independent entries from the mailmap file.
GaganMishra305 Jan 15, 2025
55e7d63
Increased code readability by removing expr.args
GaganMishra305 Jan 18, 2025
f755d0d
Exp and not pow.
GaganMishra305 Jan 18, 2025
6568ca5
Merge branch 'sympy:master' into solves-integer-issue
GaganMishra305 Jan 18, 2025
dc3a933
Refactored integer predicate logic.
GaganMishra305 Jan 19, 2025
1d62c4e
Enhance integer power handling by adding base checks for -1 and 1.
GaganMishra305 Jan 19, 2025
71f9fef
Trigger Build
GaganMishra305 Jan 20, 2025
d1f16ac
Added more relevant tests
GaganMishra305 Jan 21, 2025
8594b4d
Refactor test cases.
GaganMishra305 Jan 22, 2025
e914050
Refactored testcases.
GaganMishra305 Jan 25, 2025
58e6d78
Enhance integer power handling by adding checks for additional test c…
GaganMishra305 Jan 27, 2025
6f0f658
Improved comments.
GaganMishra305 Jan 27, 2025
92e779b
Merge branch 'master' into solves-integer-issue
GaganMishra305 Jan 28, 2025
950e16c
Adding relative changes and refactoring test comments.
GaganMishra305 Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ G. D. McBain <gdmcbain@protonmail.com>
Gabriel Bernardino <gabriel.bernardino@upf.edu>
Gabriel Orisaka <orisaka@gmail.com>
Gaetano Guerriero <x.guerriero@tin.it>
Gagan Mishra <70949548+GaganMishra305@users.noreply.github.com>
Gagandeep Singh <singh.23@iitj.ac.in> Gagandeep Singh <36567889+czgdp1807@users.noreply.github.com>
Gagandeep Singh <singh.23@iitj.ac.in> Gagandeep Singh <czgdp1807@gmail.com>
Gagandeep Singh <singh.23@iitj.ac.in> Gagandeep Singh <gdp.1807@gmail.com>
Expand Down Expand Up @@ -1613,6 +1614,7 @@ anca-mc <anca-mc@users.noreply.github.com>
andreo <andrey.torba@gmail.com>
arooshiverma <av22@iitbbs.ac.in>
atharvParlikar <atharvparlikar@gmail.com>
beforeIkillYou <simonsimple305@gmail.com>
bharatAmeria <21001019007@jcboseust.ac.in> bharatAmeria <147488804+bharatAmeria@users.noreply.github.com>
bluebrook <perl4logic@gmail.com>
carstimon <carstimon@gmail.com>
Expand Down
17 changes: 16 additions & 1 deletion sympy/assumptions/handlers/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _(expr, assumptions):
raise MDNotImplementedError
return ret

@IntegerPredicate.register_many(Add, Pow)
@IntegerPredicate.register(Add)
def _(expr, assumptions):
"""
* Integer + Integer -> Integer
Expand All @@ -64,6 +64,21 @@ def _(expr, assumptions):
return _IntegerPredicate_number(expr, assumptions)
return test_closed_group(expr, assumptions, Q.integer)


GaganMishra305 marked this conversation as resolved.
Show resolved Hide resolved
@IntegerPredicate.register(Pow)
def _(expr, assumptions):
# """
# * Integer ** Integer -> Integer
# * Integer ** !Integer -> !Integer
# * !Integer ** !Integer -> ?
# * Integer ** -Integer -> !Integer
GaganMishra305 marked this conversation as resolved.
Show resolved Hide resolved
# """
if expr.is_number:
return _IntegerPredicate_number(expr, assumptions)
if ask(Q.integer(expr.args[0]), assumptions) and ask(Q.integer(expr.args[1]), assumptions) and expr.args[1].is_negative:
return False
return test_closed_group(expr, assumptions, Q.integer)

@IntegerPredicate.register(Mul)
def _(expr, assumptions):
"""
Expand Down
6 changes: 6 additions & 0 deletions sympy/assumptions/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -2415,3 +2415,9 @@ def test_issue_25221():
assert ask(Q.transcendental(x), Q.algebraic(x) | Q.positive(y,y)) is None
assert ask(Q.transcendental(x), Q.algebraic(x) | (0 > y)) is None
assert ask(Q.transcendental(x), Q.algebraic(x) | Q.gt(0,y)) is None


def test_issue_27450():
n = Symbol('n', negative=True, integer=True)
exp = 2**n
assert exp.is_integer is False
GaganMishra305 marked this conversation as resolved.
Show resolved Hide resolved
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sympy/sympy/pull/27461/files/b5a3dae0b4cbe4d2fa5907d8f751089a558972e8

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy