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
Remove args and func overriding of AppliedPredicate #20847
Conversation
Remove args and func property.
Introduce _find_freepredicate()
✅ Hi, I am the SymPy bot (v161). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.9. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
I had to introduce |
Change `.args` to `.arguments` in UnevaluatedOnFree.__new__.
There are a lot of other errors which cannot be easily resolved.
|
This can fix some of the errors: diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py
index fb00dac5b3..a42d669e84 100644
--- a/sympy/assumptions/ask.py
+++ b/sympy/assumptions/ask.py
@@ -290,7 +290,7 @@ def _extract_all_facts(expr, symbols):
if isinstance(literal.lit, AppliedPredicate):
if literal.lit.arg in symbols:
# Add literal if it has 'symbol' in it
- args.append(Literal(literal.lit.func, literal.is_Not))
+ args.append(Literal(literal.lit.function, literal.is_Not))
else:
# If any of the literals doesn't have 'symbol' don't add the whole clause.
break |
Fix _extract_all_facts
Also this: diff --git a/sympy/assumptions/satask.py b/sympy/assumptions/satask.py
index d672f75cfc..e72d2f2df8 100644
--- a/sympy/assumptions/satask.py
+++ b/sympy/assumptions/satask.py
@@ -92,7 +92,7 @@ def find_symbols(pred):
req_keys |= tmp_keys
keys |= {l for l in lkeys if find_symbols(l) & req_keys != set()}
- exprs = {key.args[0] if isinstance(key, AppliedPredicate) else key for key in keys}
+ exprs = {key.arguments[0] if isinstance(key, AppliedPredicate) else key for key in keys}
return exprs, relevant_facts
for expr in exprs: |
Fix get_relevant_facts
Also this: diff --git a/sympy/assumptions/sathandlers.py b/sympy/assumptions/sathandlers.py
index 135e561f5a..6d856709dc 100644
--- a/sympy/assumptions/sathandlers.py
+++ b/sympy/assumptions/sathandlers.py
@@ -83,7 +83,7 @@ def __new__(cls, arg):
raise ValueError("The AppliedPredicates in arg must be applied to a single expression.")
obj = BooleanFunction.__new__(cls, arg)
obj.expr = predicate_args.pop()
- obj.pred = arg.xreplace(Transform(lambda e: e.func, lambda e:
+ obj.pred = arg.xreplace(Transform(lambda e: e.function, lambda e:
isinstance(e, AppliedPredicate)))
applied = obj.apply(obj.expr)
if applied is None: |
Fix UnevaluatedOnFree
Fix _extract_facts
Modify doc Add Predicate._eval_refine
Fix get_relevant_facts
@oscarbenjamin |
Looks good |
References to other Issues or PRs
Required for #20635
Brief description of what is fixed or changed
Previously,
AppliedPredicate.func
andAppliedPredicate.args
were overridden. This PR makesAppliedPredicate
just inheritBasic.func
andBasic.args
.Other comments
Release Notes
func
property ofAppliedPredicate
returnsAppliedPredicate
class instead of unapplied predicate object. User must usefunction
property to get the predicate. This breaks backwards compatibility.args
property ofAppliedPredicate
returns unapplied predicate object and arguments. User must usearguments
property to get the arguments without unapplied predicate. This breaks backwards compatibility.