o
    oh                     @   s   d dl mZmZmZ d dlmZmZmZmZm	Z	m
Z
 d dlmZ G dd deZeejeejeejeeje	eje
ejiZG dd deZdS )	    )	PredicateAppliedPredicateQ)EqNeGtLtGeLe)
Dispatcherc                   @   s    e Zd ZdZdZedddZdS )CommutativePredicatez
    Commutative predicate.

    Explanation
    ===========

    ``ask(Q.commutative(x))`` is true iff ``x`` commutes with any other
    object with respect to multiplication operation.

    commutativeCommutativeHandlerzHandler for key 'commutative'.docN)__name__
__module____qualname____doc__namer   handler r   r   w/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/assumptions/predicates/common.pyr      s    r   c                       s0   e Zd ZdZdZedddZ fddZ  ZS )IsTruePredicatea;  
    Generic predicate.

    Explanation
    ===========

    ``ask(Q.is_true(x))`` is true iff ``x`` is true. This only makes
    sense if ``x`` is a boolean object.

    Examples
    ========

    >>> from sympy import ask, Q
    >>> from sympy.abc import x, y
    >>> ask(Q.is_true(True))
    True

    Wrapping another applied predicate just returns the applied predicate.

    >>> Q.is_true(Q.even(x))
    Q.even(x)

    Wrapping binary relation classes in SymPy core returns applied binary
    relational predicates.

    >>> from sympy import Eq, Gt
    >>> Q.is_true(Eq(x, y))
    Q.eq(x, y)
    >>> Q.is_true(Gt(x, y))
    Q.gt(x, y)

    Notes
    =====

    This class is designed to wrap the boolean objects so that they can
    behave as if they are applied predicates. Consequently, wrapping another
    applied predicate is unnecessary and thus it just returns the argument.
    Also, binary relation classes in SymPy core have binary predicates to
    represent themselves and thus wrapping them with ``Q.is_true`` converts them
    to these applied predicates.

    is_trueIsTrueHandlerzBWrapper allowing to query the truth value of a boolean expression.r   c                    s<   t |tr|S t|ddrtt| }||j S t |S )Nis_RelationalF)
isinstancer   getattrbinrelpredstypeargssuper__call__)selfargpred	__class__r   r   r#   I   s   

zIsTruePredicate.__call__)	r   r   r   r   r   r   r   r#   __classcell__r   r   r'   r   r      s    *r   N)sympy.assumptionsr   r   r   sympy.core.relationalr   r   r   r   r	   r
   sympy.multipledispatchr   r   eqnegtltgeler   r   r   r   r   r   <module>   s     (