class_docstr: Base class for mathematical predicates. It also serves as a
  constructor for undefined predicate objects.
  
  Explanation
  ===========
  
  Predicate is a function that returns a boolean value [1].
  
  Predicate function is object, and it is instance of predicate class.
  When a predicate is applied to arguments, ``AppliedPredicate``
  instance is returned. This merely wraps the argument and remain
  unevaluated. To obtain the truth value of applied predicate, use the
  function ``ask``.
  
  Evaluation of predicate is done by multiple dispatching. You can
  register new handler to the predicate to support new types.
  
  Every predicate in SymPy can be accessed via the property of ``Q``.
  For example, ``Q.even`` returns the predicate which checks if the
  argument is even number.
  
  To define a predicate which can be evaluated, you must subclass this
  class, make an instance of it, and register it to ``Q``. After then,
  dispatch the handler by argument types.
  
  If you directly construct predicate using this class, you will get
  ``UndefinedPredicate`` which cannot be dispatched. This is useful
  when you are building boolean expressions which do not need to be
  evaluated.
  
  Examples
  ========
  
  Applying and evaluating to boolean value:
  
  >>> from sympy import Q, ask
  >>> ask(Q.prime(7))
  True
  
  You can define a new predicate by subclassing and dispatching. Here,
  we define a predicate for sexy primes [2] as an example.
  
  >>> from sympy import Predicate, Integer
  >>> class SexyPrimePredicate(Predicate):
  ...     name = "sexyprime"
  >>> Q.sexyprime = SexyPrimePredicate()
  >>> @Q.sexyprime.register(Integer, Integer)
  ... def _(int1, int2, assumptions):
  ...     args = sorted([int1, int2])
  ...     if not all(ask(Q.prime(a), assumptions) for a in args):
  ...         return False
  ...     return args[1] - args[0] == 6
  >>> ask(Q.sexyprime(5, 11))
  True
  
  Direct constructing returns ``UndefinedPredicate``, which can be
  applied but cannot be dispatched.
  
  >>> from sympy import Predicate, Integer
  >>> Q.P = Predicate("P")
  >>> type(Q.P)
  <class 'sympy.assumptions.assume.UndefinedPredicate'>
  >>> Q.P(1)
  Q.P(1)
  >>> Q.P.register(Integer)(lambda expr, assump: True)
  Traceback (most recent call last):
    ...
  TypeError: <class 'sympy.assumptions.assume.UndefinedPredicate'> cannot be dispatched.
  
  References
  ==========
  
  .. [1] https://en.wikipedia.org/wiki/Predicate_%28mathematical_logic%29
  .. [2] https://en.wikipedia.org/wiki/Sexy_prime
class_docstr_tok: ["Base","class","for","mathematical","predicates",".","It","also","serves","as","a","constructor","for","undefined","predicate","objects",".","Explanation","===========","Predicate","is","a","function","that","returns","a","boolean","value","[","1","]",".","Predicate","function","is","object",",","and","it","is","instance","of","predicate","class",".","When","a","predicate","is","applied","to","arguments",",","``","AppliedPredicate","``","instance","is","returned",".","This","merely","wraps","the","argument","and","remain","unevaluated",".","To","obtain","the","truth","value","of","applied","predicate",",","use","the","function","``","ask","``",".","Evaluation","of","predicate","is","done","by","multiple","dispatching",".","You","can","register","new","handler","to","the","predicate","to","support","new","types",".","Every","predicate","in","SymPy","can","be","accessed","via","the","property","of","``","Q","``",".","For","example",",","``","Q.even","``","returns","the","predicate","which","checks","if","the","argument","is","even","number",".","To","define","a","predicate","which","can","be","evaluated",",","you","must","subclass","this","class",",","make","an","instance","of","it",",","and","register","it","to","``","Q","``",".","After","then",",","dispatch","the","handler","by","argument","types",".","If","you","directly","construct","predicate","using","this","class",",","you","will","get","``","UndefinedPredicate","``","which","can","not","be","dispatched",".","This","is","useful","when","you","are","building","boolean","expressions","which","do","not","need","to","be","evaluated",".","Examples","========","Applying","and","evaluating","to","boolean","value",":",">",">",">","from","sympy","import","Q",",","ask",">",">",">","ask","(","Q.prime","(","7",")",")","True","You","can","define","a","new","predicate","by","subclassing","and","dispatching",".","Here",",","we","define","a","predicate","for","sexy","primes","[","2","]","as","an","example",".",">",">",">","from","sympy","import","Predicate",",","Integer",">",">",">","class","SexyPrimePredicate","(","Predicate",")",":","...","name","=","``","sexyprime","''",">",">",">","Q.sexyprime","=","SexyPrimePredicate","(",")",">",">",">","@","Q.sexyprime.register","(","Integer",",","Integer",")","...","def","_","(","int1",",","int2",",","assumptions",")",":","...","args","=","sorted","(","[","int1",",","int2","]",")","...","if","not","all","(","ask","(","Q.prime","(","a",")",",","assumptions",")","for","a","in","args",")",":","...","return","False","...","return","args","[","1","]","-","args","[","0","]","==","6",">",">",">","ask","(","Q.sexyprime","(","5",",","11",")",")","True","Direct","constructing","returns","``","UndefinedPredicate","``",",","which","can","be","applied","but","can","not","be","dispatched",".",">",">",">","from","sympy","import","Predicate",",","Integer",">",">",">","Q.P","=","Predicate","(","``","P","''",")",">",">",">","type","(","Q.P",")","<","class","'sympy.assumptions.assume.UndefinedPredicate","'",">",">",">",">","Q.P","(","1",")","Q.P","(","1",")",">",">",">","Q.P.register","(","Integer",")","(","lambda","expr",",","assump",":","True",")","Traceback","(","most","recent","call","last",")",":","...","TypeError",":","<","class","'sympy.assumptions.assume.UndefinedPredicate","'",">","can","not","be","dispatched",".","References","==========","..","[","1","]","https",":","\/\/en.wikipedia.org\/wiki\/Predicate_","%","28mathematical_logic","%","29","..","[","2","]","https",":","\/\/en.wikipedia.org\/wiki\/Sexy_prime"]
docstr: Evaluate ``self(*args)`` under the given assumptions.
  
  This uses only direct resolution methods, not logical inference.
docstr_tok: ["Evaluate","``","self","(","*","args",")","``","under","the","given","assumptions",".","This","uses","only","direct","resolution","methods",",","not","logical","inference","."]
code: def eval(self, args, assumptions=True):
      """
      Evaluate ``self(*args)`` under the given assumptions.
  
      This uses only direct resolution methods, not logical inference.
      """
      result = None
      try:
          result = self.handler(*args, assumptions=assumptions)
      except NotImplementedError:
          pass
      return result
  
imports: from contextlib import contextmanager
  import inspect
  from sympy.core.symbol import Str
  from sympy.core.sympify import _sympify
  from sympy.logic.boolalg import Boolean, false, true
  from sympy.multipledispatch.dispatcher import Dispatcher, str_signature
  from sympy.utilities.exceptions import sympy_deprecation_warning
  from sympy.utilities.iterables import is_sequence
  from sympy.utilities.source import get_class
label_desc: Use image node_id 6 for calling the Predicate obj's underlying member method code with example usage: obj.eval(args, assumptions) and returns: result