o
    Rh                     @   s  d Z ddlmZmZmZ ddlmZmZ ddlm	Z	m
Z
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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	fuzzy_andfuzzy_or)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__ c/home/air/sanwanet/backup_V2/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'   r0   zCommonHandler.AlwaysFalsec                 C   s   d S Nr"   r,   r"   r"   r#   
AlwaysNone+   r0   zCommonHandler.AlwaysNoneN)	r$   r%   r&   r'   staticmethodr/   r2   r4   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   
r9   c                 C   s&   | j D ]}tt||s dS qdS )NFT)r   r   r   r7   )r-   r.   argr"   r"   r#   r9   @   s
   
c                 C   r*   r+   r"   r,   r"   r"   r#   r9   G   r0   c                 C   r*   r+   r"   r,   r"   r"   r#   r9   K   r0   c                 C   s   | S r3   r"   r,   r"   r"   r#   r9   R   r0   c                 C   r*   r+   r"   r,   r"   r"   r#   r9   V   r0   c                 C   r*   r1   r"   r,   r"   r"   r#   r9   Z   r0   c                 C   s
   t | |S r3   r   r,   r"   r"   r#   r9   ^   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.   r:   valuer"   r"   r#   r9   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.   resultr:   pr"   r"   r#   r9   n      
c                 C   r?   )NTr<   Fr@   rA   r"   r"   r#   r9   y   rD   c                 C   s   | j \}}t| |B |dS Nr<   r@   )r-   r.   rC   qr"   r"   r#   r9      s   
c                 C   sB   | j \}}t||d}|d u rd S t||d}|d u rd S ||kS rE   r@   )r-   r.   rC   rF   ptqtr"   r"   r#   r9      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 r3   r;   ).0ar.   keyr"   r#   	<genexpr>   s    z$test_closed_group.<locals>.<genexpr>T)
quick_exit)r   r   )r-   r.   rL   r"   rK   r#   test_closed_group   s   rO   c                       t  fdd|D S )Nc                 3       | ]}t | V  qd S r3   r;   rI   queryr<   r"   r#   rM          zask_all.<locals>.<genexpr>)r   r.   queriesr"   r<   r#   ask_all      rW   c                    rP   )Nc                 3   rQ   r3   r;   rR   r<   r"   r#   rM      rT   zask_any.<locals>.<genexpr>)r	   rU   r"   r<   r#   ask_any   rX   rY   N)%r'   sympy.assumptionsr   r   r   
sympy.corer   r   sympy.core.logicr   r   r	   sympy.core.numbersr
   r   sympy.logic.boolalgr   r   r   r   r   r   r   r   sympy.utilities.exceptionsr   predicates.commonr   r   r   r)   registerr9   boolrO   rW   rY   r"   r"   r"   r#   <module>   sN    (














