o
    jg                     @   s  d Z ddlmZmZmZ ddlmZmZ ddlm	Z	 ddl
mZmZ ddlmZmZmZmZmZmZmZmZ ddlmZ dd	lmZmZ G d
d dZG dd deZeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zeedd Zdd Z dS )zj
This module defines base class for handlers and some core handlers:
``Q.commutative`` and ``Q.is_true``.
    )QaskAppliedPredicate)BasicSymbol)_fuzzy_group)NaNNumber)AndBooleanTrueBooleanFalse	conjuncts
EquivalentImpliesNotOr)sympy_deprecation_warning   )CommutativePredicateIsTruePredicatec                       s    e Zd ZdZ fddZ  ZS )
AskHandlerz.Base class that all Ask Handlers must inherit.c                    s(   t dddd t j| g|R i |S )Nz
            The AskHandler system is deprecated. The AskHandler class should
            be replaced with the multipledispatch handler of Predicate
            z1.8zdeprecated-askhandler)deprecated_since_versionactive_deprecations_target)r   super__new__)clsargskwargs	__class__ Y/var/www/html/zoom/venv/lib/python3.10/site-packages/sympy/assumptions/handlers/common.pyr      s   zAskHandler.__new__)__name__
__module____qualname____doc__r   __classcell__r    r    r   r!   r      s    r   c                   @   s8   e Zd ZdZedd Zedd Zedd ZeZdS )	CommonHandlerz5Defines some useful methods common to most Handlers. c                 C      dS NTr    exprassumptionsr    r    r!   
AlwaysTrue#      zCommonHandler.AlwaysTruec                 C   r(   NFr    r*   r    r    r!   AlwaysFalse'   r.   zCommonHandler.AlwaysFalsec                 C   s   d S Nr    r*   r    r    r!   
AlwaysNone+   r.   zCommonHandler.AlwaysNoneN)	r"   r#   r$   r%   staticmethodr-   r0   r2   r   r    r    r    r!   r'      s    


r'   c                 C   sR   t |}| jdur| jot|  |vS t| |v rdS t|  |v r'dS dS )z>Objects are expected to be commutative unless otherwise statedNTF)r   is_commutativer   commutative)r+   r,   assumpsr    r    r!   _4   s   
r7   c                 C   s&   | j D ]}tt||s dS qdS )NFT)r   r   r   r5   )r+   r,   argr    r    r!   r7   @   s
   
c                 C   r(   r)   r    r*   r    r    r!   r7   G   r.   c                 C   r(   r)   r    r*   r    r    r!   r7   K   r.   c                 C   s   | S r1   r    r*   r    r    r!   r7   R   r.   c                 C   r(   r)   r    r*   r    r    r!   r7   V   r.   c                 C   r(   r/   r    r*   r    r    r!   r7   Z   r.   c                 C   s
   t | |S r1   r   r*   r    r    r!   r7   ^   s   
c                 C   s2   | j d }|jr
d S t||d}|dv r| S d S )Nr   r,   )TF)r   	is_Symbolr   )r+   r,   r8   valuer    r    r!   r7   b   s   
c                 C   :   d}| j D ]}t||d}|du r dS |d u rd }q|S )NFr:   Tr   r   r+   r,   resultr8   pr    r    r!   r7   n      
c                 C   r=   )NTr:   Fr>   r?   r    r    r!   r7   y   rB   c                 C   s   | j \}}t| |B |dS Nr:   r>   )r+   r,   rA   qr    r    r!   r7      s   
c                 C   sB   | j \}}t||d}|d u rd S t||d}|d u rd S ||kS rC   r>   )r+   r,   rA   rD   ptqtr    r    r!   r7      s   
c                    s   t  fdd| jD ddS )zS
    Test for membership in a group with respect
    to the current operation.
    c                 3   s    | ]
}t | V  qd S r1   r9   ).0ar,   keyr    r!   	<genexpr>   s    z$test_closed_group.<locals>.<genexpr>T)
quick_exit)r   r   )r+   r,   rJ   r    rI   r!   test_closed_group   s   rM   N)!r%   sympy.assumptionsr   r   r   
sympy.corer   r   sympy.core.logicr   sympy.core.numbersr   r	   sympy.logic.boolalgr
   r   r   r   r   r   r   r   sympy.utilities.exceptionsr   predicates.commonr   r   r   r'   registerr7   boolrM   r    r    r    r!   <module>   sJ    (














