Repository: sympy/sympy

Issue:
Ask returns False when it should return None when using relational assumptions
These examples are correct:
```
>>> print(ask(Q.transcendental(x), Q.algebraic(x)))
False
>>> print(ask(Q.transcendental(x), Q.algebraic(x) | Q.positive(x)))
None
```
However, if we replace Q.positive(x) with x > 0  or Q.gt(x,0) we get False instead of None:
```
>>> print(ask(Q.transcendental(x), Q.algebraic(x) |  (x >0) )
False
```

Discussion:

Patch:
diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py
index d7b674f8f7..e65931d619 100644
--- a/sympy/assumptions/ask.py
+++ b/sympy/assumptions/ask.py
@@ -349,6 +349,10 @@ def _extract_all_facts(assump, exprs):
                 else:
                     # If any of the literals doesn't have matching expr don't add the whole clause.
                     break
+            else:
+                # If any of the literals aren't unary predicate don't add the whole clause.
+                break
+
         else:
             if args:
                 facts.add(frozenset(args))


Test patch:
diff --git a/sympy/assumptions/tests/test_query.py b/sympy/assumptions/tests/test_query.py
index 99a7d58d33..54d65b4704 100644
--- a/sympy/assumptions/tests/test_query.py
+++ b/sympy/assumptions/tests/test_query.py
@@ -2406,3 +2406,9 @@ def test_relational():
     assert not ask(Q.eq(x, 0), Q.nonzero(x))
     assert not ask(Q.ne(x, 0), Q.zero(x))
     assert ask(Q.ne(x, 0), Q.nonzero(x))
+
+
+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