o
    *ήc                     @   sH  d dl mZ d dlmZmZmZ d dl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 d dlmZmZmZmZmZmZmZ d d	lmZmZmZmZ d d
lm Z  d dl!m"Z"m#Z# dd Z$dd Z%dd Z&dd Z'dd Z(dd Z)dd Z*dd Z+dd Z,dd Z-d d! Z.d"d# Z/d$d% Z0d&d' Z1d(d) Z2d*d+ Z3d,d- Z4d.d/ Z5d0d1 Z6d2d3 Z7d4d5 Z8d6d7 Z9d8d9 Z:e#d:d; Z;d<d= Z<d>d? Z=d@dA Z>dBdC Z?dDdE Z@e#dFdG ZAdHdI ZBdJdK ZCdLdM ZDdNdO ZEdPdQ ZFdRdS ZGdTdU ZHdVdW ZIdXdY ZJdZd[ ZKd\d] ZLd^d_ ZMd`da ZNdbdc ZOddde ZPdfdg ZQdhdi ZRdjdk ZSdldm ZTdndo ZUdpdq ZVdrds ZWdtdu ZXe#dvdw ZYdxdy ZZdzd{ Z[d|d} Z\d~d Z]dd Z^dd Z_dd Z`dd Zae#dd Zbdd Zcdd Zddd Zedd Zfdd Zgdd Zhdd Zidd Zjdd Zkdd Zldd Zmdd Zndd Zodd Zpdd Zqdd ZrdS )    )Mod)Ioopi)	factorial)explog)sqrt)asinsin)simplify)SymbolSRationalIntegerDummyWildPow)assumptionscheck_assumptionsfailing_assumptionscommon_assumptions)InconsistentAssumptions)raisesXFAILc                  C   sX   t dddd} | jdu sJ | jdu sJ | jdu sJ | jdu s#J | jdu s*J d S )NxTrealintegerF)r   is_real
is_integeris_imaginaryis_noninteger	is_numberr    r%   H/tmp/pip-target-vg8gfxp4/lib/python/sympy/core/tests/test_assumptions.pytest_symbol_unset   s   r'   c                  C   s@  t d} | jdu sJ | jdu sJ | jdu sJ | jdu s J | jdu s'J | jdu s.J | jdu s5J | jdu s<J | j	du sCJ | j
du sJJ | jdu sQJ | jdu sXJ | jdu s_J | jdu sfJ | jdu smJ | jdu stJ | jdu s{J | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S )Nr   TFr   is_commutativer    is_rationalis_algebraicis_transcendentalr   
is_complexr"   is_irrationalr!   is_positiveis_negativeis_nonpositiveis_nonnegativeis_evenis_odd	is_finiteis_infiniteis_comparableis_primeis_compositer#   zr%   r%   r&   	test_zero   .   r<   c                  C   s@  t d} | jdu sJ | jdu sJ | jdu sJ | jdu s J | jdu s'J | jdu s.J | jdu s5J | jdu s<J | j	du sCJ | j
du sJJ | jdu sQJ | jdu sXJ | jdu s_J | jdu sfJ | jdu smJ | jdu stJ | jdu s{J | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S )N   TF)r   r)   r    r*   r+   r,   r   r-   r"   r.   r!   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r#   r9   r:   r%   r%   r&   test_one3   r=   r?   c                  C   s@  t d} | jdu sJ | jdu sJ | jdu sJ | jdu s J | jdu s'J | jdu s.J | jdu s5J | jdu s<J | j	du sCJ | j
du sJJ | jdu sQJ | jdu sXJ | jdu s_J | jdu sfJ | jdu smJ | jdu stJ | jdu s{J | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S )NTFr(   r:   r%   r%   r&   test_negativeoneM   r=   rA   c                  C   s  t j} | jdu s
J | jdu sJ | jdu sJ | jdu sJ | jdu s&J | jdu s-J | jdu s4J | j	du s;J | j
du sBJ | jdu sIJ | jdu sPJ | jdu sWJ | jdu s^J | jdu seJ | jdu slJ | jdu ssJ | jdu szJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S NTF)r   Infinityr)   r    r*   r+   r,   is_extended_realr   r-   r"   r.   r!   
is_nonzeror/   r0   r1   r2   is_extended_nonzerois_extended_positiveis_extended_negativeis_extended_nonpositiveis_extended_nonnegativer3   r4   r5   r6   r7   r8   r9   r#   )r   r%   r%   r&   test_infinityg   <   rK   c                  C   s  t j} | jdu s
J | jdu sJ | jdu sJ | jdu sJ | jdu s&J | jdu s-J | jdu s4J | j	du s;J | j
du sBJ | jdu sIJ | jdu sPJ | jdu sWJ | jdu s^J | jdu seJ | jdu slJ | jdu ssJ | jdu szJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S rB   )r   NegativeInfinityr)   r    r*   r+   r,   rD   r   r-   r"   r.   r!   rE   r/   r0   r1   r2   rF   rG   rH   rI   rJ   r3   r4   r5   r6   r7   r8   r9   r#   )mmr%   r%   r&   test_neg_infinity   rL   rO   c                  C   s4   t j} | jdu s
J | jdu sJ | jdu sJ d S NF)r   ComplexInfinityr-   r   r8   )zoor%   r%   r&   test_zoo   s   rS   c                  C   s>  t j} | jdu s
J | jd u sJ | jd u sJ | jd u sJ | jd u s&J | jd u s-J | jd u s4J | j	d u s;J | j
d u sBJ | jd u sIJ | jd u sPJ | jd u sWJ | jd u s^J | jd u seJ | jd u slJ | jd u ssJ | jd u szJ | jd u sJ | jdu sJ | jd u sJ | jd u sJ | jdu sJ d S rB   )r   NaNr)   r    r*   r+   r,   r   r-   r"   r.   r!   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r#   )nanr%   r%   r&   test_nan   s.   rV   c                  C   s  t dd} | jdu sJ | jdu sJ | jdu sJ | jdu s!J | jdu s(J | jdu s/J | jdu s6J | jdu s=J | j	du sDJ | j
du sKJ | jdu sRJ | jdu sYJ | jdu s`J | jdu sgJ | jdu snJ | jdu suJ | jdu s|J | jdu sJ | jdu sJ | jdu sJ | jdu sJ t dd} | jdu sJ | jdu sJ | jdu sJ | jdu sJ t dd} | jdu sJ | jdu sJ | jdu sJ | jdu sJ t dd} | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S )N      TFr>      )r   r)   r    r*   r+   r,   r   r-   r"   r.   r!   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   rr%   r%   r&   test_pos_rational   sJ   



r\   c                  C   s  t dd} | jdu sJ | jdu sJ | jdu sJ | jdu s!J t dd} | jdu s-J | jdu s4J | jdu s;J | jdu sBJ t dd} | jdu sNJ | jdu sUJ | jdu s\J | jdu scJ t dd} | jdu soJ | jdu svJ | jdu s}J | jdu sJ d S )NrX   FTr@   rW   )r   r/   r1   r0   r2   rZ   r%   r%   r&   test_neg_rational   s(   



r_   c                  C   0  t j} | jdu s
J | jdu sJ | jdu sJ | jdu sJ | jdu s&J | jdu s-J | jdu s4J | j	du s;J | j
du sBJ | jdu sIJ | jdu sPJ | jdu sWJ | jdu s^J | jdu seJ | jdu slJ | jdu ssJ | jdu szJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S rB   )r   Pir)   r    r*   r+   r,   r   r-   r"   r.   r!   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r%   r%   r&   test_pi  ,   rb   c                  C   r`   rB   )r   Exp1r)   r    r*   r+   r,   r   r-   r"   r.   r!   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r%   r%   r&   test_E&  rc   re   c                  C   s0  t j} | jdu s
J | jdu sJ | jdu sJ | jdu sJ | jdu s&J | jdu s-J | jdu s4J | j	du s;J | j
du sBJ | jdu sIJ | jdu sPJ | jdu sWJ | jdu s^J | jdu seJ | jdu slJ | jdu ssJ | jdu szJ | jdu sJ | jdu sJ | jdu sJ | jdu sJ d S rB   )r   ImaginaryUnitr)   r    r*   r+   r,   r   r-   r"   r.   r!   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r%   r%   r&   test_I?  rc   rg   c                  C   s   t ddd} | jdu sJ | jdu sJ | jdu sJ | jdu s"J | jdu s)J | jdu s0J | jdu s7J | jdu s>J | j	d u sEJ | j
d u sLJ | jd u sSJ | jd u sZJ | jd u saJ d S )NaFr   r   r   r    is_zeror0   r/   r2   r1   rE   rH   rG   rJ   rI   rF   rh   r%   r%   r&   test_symbol_real_falseX     rm   c                  C   s   t ddd} | jdu sJ | jdu sJ | jdu sJ | jdu s"J | jdu s)J | jdu s0J | jdu s7J | jdu s>J | j	du sEJ | j
du sLJ | jdu sSJ | jdu sZJ | jdu saJ d S )Nrh   Fextended_realrj   rl   r%   r%   r&   test_symbol_extended_real_falsem  rn   rq   c                  C   s   t ddd} | jdu sJ | jdu sJ | jdu sJ | jdu s"J | jdu s)J | jdu s0J | jdu s7J | jdu s>J d S )Nrh   T	imaginaryF)	r   r   r    r0   r/   r2   r1   rk   rE   rl   r%   r%   r&   test_symbol_imaginary  s   rt   c                  C   sj   t ddd} | jdu sJ | jsJ | jdu sJ | jsJ | jdu s%J | jdu s,J | jdu s3J d S )Nr   TzeroF)r   r/   r1   r0   r2   rk   rE   r5   r$   r%   r%   r&   test_symbol_zero  s   

rw   c                  C   sd   t ddd} | jdu sJ | jdu sJ | jdu sJ | jdu s"J | jdu s)J | jdu s0J d S Nr   TpositiveFr   r/   r1   r0   r2   rk   rE   r$   r%   r%   r&   test_symbol_positive     r|   c                  C   sf   t ddd } | jdu sJ | jdu sJ | jdu sJ | jdu s#J | jdu s*J | jdu s1J d S rx   r{   r$   r%   r%   r&   test_neg_symbol_positive     r~   c                  C   sd   t ddd} | jdu sJ | jdu sJ | jd u sJ | jd u s"J | jd u s)J | jd u s0J d S Nr   TnonpositiveFr{   r$   r%   r%   r&   test_symbol_nonpositive  r}   r   c                  C   sf   t ddd } | jd u sJ | jd u sJ | jdu sJ | jdu s#J | jd u s*J | jd u s1J d S r   r{   r$   r%   r%   r&   test_neg_symbol_nonpositive  r   r   c                  C   sd   t ddd} | jdu sJ | jd u sJ | jd u sJ | jd u s"J | jd u s)J | jd u s0J d S Nr   Fry   r{   r$   r%   r%   r&   test_symbol_falsepositive  r}   r   c                  C   sh   dt ddd } | jdu sJ | jd u sJ | jd u sJ | jd u s$J | jd u s+J | jd u s2J d S )N   r   Fry   r{   r$   r%   r%   r&   test_symbol_falsepositive_mul  s   r   c                  C   s"   t dddd} |  jd u sJ d S )NixT)infiniterp   )r   rG   )r   r%   r%   r&   test_symbol_infinitereal_mul  s   r   c                  C   sf   t ddd } | jd u sJ | jd u sJ | jdu sJ | jd u s#J | jd u s*J | jd u s1J d S r   r{   r$   r%   r%   r&   test_neg_symbol_falsepositive  r   r   c                  C   sf   t ddd } | jdu sJ | jd u sJ | jd u sJ | jd u s#J | jd u s*J | jd u s1J d S )Nr   Fnegativer{   r$   r%   r%   r&   test_neg_symbol_falsenegative  s   r   c                  C   sf   t dddd} | jdu sJ | jdu sJ | jd u sJ | jd u s#J | jd u s*J | jd u s1J d S Nr   FT)rz   r   r{   r$   r%   r%   r&   test_symbol_falsepositive_real  r   r   c                  C   sh   t dddd } | jd u sJ | jd u sJ | jdu sJ | jdu s$J | jd u s+J | jd u s2J d S r   r{   r$   r%   r%   r&   "test_neg_symbol_falsepositive_real      r   c                  C   sd   t ddd} | jdu sJ | jd u sJ | jd u sJ | jdu s"J | jdu s)J | jd u s0J d S )Nr   Fnonnegativer{   r$   r%   r%   r&   test_symbol_falsenonnegative
  r}   r   c                  C   sf   t ddd } | jd u sJ | jdu sJ | jdu sJ | jd u s#J | jdu s*J | jdu s1J d S )Nr   Fr   Tr{   r$   r%   r%   r&    test_neg_symbol_falsenonnegative  s   r   c                  C   sf   t dddd} | jdu sJ | jdu sJ | jdu sJ | jdu s#J | jdu s*J | jdu s1J d S Nr   FT)r   r   r{   r$   r%   r%   r&   !test_symbol_falsenonnegative_real  r   r   c                  C   sh   t dddd } | jdu sJ | jdu sJ | jdu sJ | jdu s$J | jdu s+J | jdu s2J d S r   r{   r$   r%   r%   r&   %test_neg_symbol_falsenonnegative_real)  r   r   c                   C   s   t jjdu sJ t djdu sJ t djdu sJ t jjdu s"J t jjdu s*J t djdu s3J t djdu s<J t djdu sEJ d S )NFr   T   rX   )r   NegativeOner8   ZeroOner%   r%   r%   r&   
test_prime3  s   r   c                  C   s   t jjdu sJ t djdu sJ t djdu sJ t jjdu s"J t djdu s+J t djdu s4J t djdu s=J tdddd} | jd u sKJ | d	 jd u sTJ tdddd
} | jdu sbJ | jdu siJ d S )NFr   r   r   r   rX   T)r   rz   primer>   )rz   evenr   )r   r   r9   r   r   r    r$   r%   r%   r&   test_composite>  s   r   c                  C   s   t ddd} | jdu sJ | jdu sJ | jdu sJ | jdu s"J | jdu s)J | jdu s0J t ddd} | jdu s=J | jd u sDJ | jd u sKJ | jd u sRJ | jd u sYJ | jd u s`J d S )Nr   Tr   F)r   r8   r    r/   r0   r1   r2   r$   r%   r%   r&   test_prime_symbolN  s   r   c                  C   s~   t ddd} | jd u sJ t ddd} | jdu sJ | jdu s!J | jdu s(J | jdu s/J | jdu s6J | jdu s=J d S )Nr   TcommutativeF)r   r-   r    r*   r+   r.   r   r$   r%   r%   r&   test_symbol_noncommutative`  s   r   c                  C   s  t ddd} | jdu sJ | jdu sJ | jdu sJ t dddd} | jdu s)J | jdu s0J | jdu s7J | jd u s>J | jdu sEJ t dddd} | jdu sSJ | jdu sZJ | jdu saJ | jd u shJ | jdu soJ t ddd} | jdu s|J | j	du sJ | jdu sJ | jdu sJ t ddd} | jdu sJ | j	d u sJ | jd u sJ | jd u sJ t ddd} | j	du sJ | jdu sJ | jdu sJ | jdu sJ t ddd} | j	du sJ | jd u sJ | jd u sJ | jd u sJ t dddd} | jdu sJ | jdu sJ | jdu sJ t dddd} | jdu s%J | jdu s-J | jdu s5J t ddd	} | jdu sCJ | jdu sKJ t ddd	} | jd u sYJ | jd u saJ t ddd
} | jdu soJ | jdu swJ t ddd
} | jd u sJ | jd u sJ t
t d| _W d    n	1 sw   Y  t ddd} | jdu sJ t ddd} | jdu sJ | jdu sJ | jdu sJ d S )Nr   Tr   r   r   F)r   r   )oddr   rational
irrational	algebraic)transcendental)r   r    r   r5   r2   r0   r/   r1   r4   r3   r   AttributeErrorr,   r+   r*   r$   r%   r%   r&   test_other_symbolm  s   
r   c                  C   sF   t d} t d}| | }||  }|j t|}t|}||ks!J dS )zcatch: hash instabilityr   yN)r   r7   hash)r   r   a1a2h1h2r%   r%   r&   test_issue_3825  s   r   c                  C   s0   dt dd dttd   } | jdv sJ d S )Nr@   r>   rW   )TN)r   r   r	   r   r:   r%   r%   r&   test_issue_4822  s   r   c                  C   s>   t ddd} t dddd}t| t|ksJ | |ksJ dS )z/seemingly different typeinfo, but in fact equalr   Tr   F)r   r   Nr   r   )x1x2r%   r%   r&   test_hash_vs_typeinfo  s   r   c                  C   s8   t d} t ddd}| |ksJ t| t|ksJ dS )z"different typeinfo should mean !eqr   Tr   Nr   )r   r   r%   r%   r&   test_hash_vs_typeinfo_2  s   r   c                  C   sf   dt j } t| }| j | jdu sJ |t| ksJ | jdd}t|}| |ks+J ||ks1J dS )z'catch: different hash for equal objectsr>   T)trigN)r   ra   r   r/   expand)rh   habhbr%   r%   r&   test_hash_vs_eq  s   
r   c                  C   sR  t dddd} t dddd}t dddd}t dddd}tddd	}t d
}t ddd}| | jd u s5J | | jd u s>J || jd u sGJ | | jd u sPJ | | jd u sYJ || jd u sbJ | | jdu skJ || jdu stJ | | jdu s}J || jdu sJ |tj jd u sJ || jsJ | | jsJ || jd u sJ d S )NnT)extended_negativer   )extended_nonnegativer   )extended_nonpositiver   p)extended_positiver   Frp   finiter   xfr   )r   r   rG   rH   r   rC   )r   nnnpr   r[   r   r   r%   r%   r&   test_Add_is_pos_neg  s*   r   c                  C   s    t dd} t|  t jsJ d S )NTr   )r   r   r!   )r   r%   r%   r&   test_Add_is_imaginary  s   
r   c                  C   s   t ddd} t ddd}t ddd}t ddd}t d}| | js#J || jd u s,J | | jdu s5J | | jd u s>J || jd u sGJ d S )Nrh   Tr   naFnbr   r   r+   )rh   r   r   r   r   r%   r%   r&   test_Add_is_algebraic  s   r   c                  C   s   t ddd} t ddd}t ddd}t dddd}t d	dd}t d
}| | jdu s,J || jd u s5J | | jd u s>J || jdu sGJ | | jd u sPJ || jd u sYJ d S )Nrh   Tr   r   r   Fan)r   nonzeror   r   r   )rh   r   r   r   r   r   r%   r%   r&   test_Mul_is_algebraic&  s   r   c            
      C   s  t ddd} td| ddjsJ td| ddjsJ t ddd}t d	ddd
}t ddd}t dddd}t dddd}t ddd}t d}|d jdu sNJ || jd u sWJ || jdu s`J || jd u siJ || jd u srJ || jdu s{J || jdu sJ ||  jd u sJ tdtdddjdu sJ ttjtdddjdu sJ t dddd}t ddd}	||	 jd u sJ ||	 jd u sJ td jdu sJ t ddd}t| jdu sJ d S )NeTr   r>   Fevaluater   rh   azf)r   rv   r   ia)r   r   ibr[   r   r   r   rW   t)r   r   r   r   ru   )r   r   r+   r	   r   GoldenRatior    r   )
r   rh   r   r   r   r   r[   r   r   r   r%   r%   r&   test_Pow_is_algebraic5  s6   r   c                  C   s   t dddd} t dddd}| | jd u sJ | d |d  jdu s$J | d |d  jdu s1J t ddd} | d |d  jd u sDJ | d |d  jd u sQJ d S )Nr   Trz   r   r   r>   Fry   r   r8   r9   r   r   r%   r%   r&   test_Mul_is_prime_composite\  s   r   c                  C   s`  t ddd} t ddd}tjtd jdu sJ tj|  jdu s"J tjtd jdu s.J tjtj jdu s9J |td jdu sDJ |td jd u sOJ td jdu sXJ td	 jdu saJ t d
dd}t dddd}t dddd}t ddd}t ddd}|| jdu sJ || jdu sJ || jdu sJ || jdu sJ || jdu sJ d S )Nr;   Tri   wr   r   rW   FrX   r   ru   q)rv   r   j)rv   r   r   r   )r   r   r   r/   r   r   r   r0   )r;   r   r   r   r   r   r   r%   r%   r&   test_Pow_is_pos_negh  s(   r   c                  C   s   t dddd} t dddd}| | jd u sJ | |d  jdu s"J | |d  jd u s-J | d |d  jdu s:J |  d d|  jdu sHJ t ddd} | | jd u sWJ d S )	Nr   Tr   r   r>   Fr   ry   r   r   r%   r%   r&   test_Pow_is_prime_composite  s   r   c                  C   s  t d} t ddd}t ddd}tdd}tddd	}d
dlm} | | jd u s*J | | jd u s3J || jd u s<J | | | jd u sGJ || jd u sPJ || jdu sYJ || jdu sbJ |d
|ddjdu snJ |d
|ddjd u szJ | | jd u sJ | | jd u sJ || jd u sJ | | | jd u sJ || jtjju sJ || jdu sJ || jdu sJ |d
|ddjdu sJ |d
|ddjtjju sJ d S )Nr   fTr   ir   ru   Fr   rv   r   )Mulr   )r   r   sympy.core.mulr   r5   r6   r   rT   )r   r   r   r;   nzfr   r%   r%   r&   test_Mul_is_infinite  s0   
 r   c                  C   s  t d} t ddd}t ddd}t ddd}tdd}tdd	d
}ddlm} | | jd u s0J | | jd u s9J || jd	u sBJ | | | jd u sMJ || jd	u sVJ || jd	u s_J || jdu shJ || jd u sqJ |d|d	djdu s}J |d|d	djd	u sJ | | jd u sJ | | jd u sJ || jdu sJ | | | jd u sJ || jdu sJ || jdu sJ || jd	u sJ || jd u sJ |d|d	djd	u sJ |d|d	djdu sJ d S )Nr   r   Tr   r   r   i2ru   Fr   r   )Addr   )r   r   sympy.core.addr   r5   r6   )r   r   r   r   r;   r   r   r%   r%   r&   test_Add_is_infinite  s6   
r   c                  C   s  t ddd} t ddd}t dddd}t ddd}t dddd	}t d
dd}t d}tdjdu s3J dtd jdu s>J dtd jdu sIJ tdjdu sRJ t|jdu s[J t|jdu sdJ t|jd u smJ ttdddjdu szJ ttdddjdu sJ tdjdu sJ t|d jdu sJ t|d jdu sJ t|jd u sJ tdtd jd u sJ tdtj jdu sJ ||  jd u sJ | |  jdu sJ | | jd u sJ ||  jd u sJ || jd u sJ || jd u sJ ||  jd u sJ |t ddd jsJ tdjdu sJ t|jdu s(J t|jdu s2J t|jd u s<J t|jdu sFJ ttdddjdu sTJ d S )Nr   Tr   r   ni)r   r   r[   r   )r   r   nrr   r   rW   Fr   r>   rY   r;   ru   )	r   r	   r*   r   r   r   ra   r   r
   )r   r   r   r[   rnr   r   r%   r%   r&   test_special_is_rational  sH    r   c                  C   sZ   t d} t| d tdtj sJ dtj tju r)t dd d}|d jd u s+J d S d S )Nr   r   r   r   )r   
isinstancetyper   rC   rT   rk   )r   r   r%   r%   r&   test_issue_6275  s   r  c                     sv   t ttfD ],  dddd} | jdu sJ | jdu sJ  ddd djd u s(J tt fdd	 qttd
d	  d S )Nr   r>   r   )r   rz   TF c                      s    dd dS )Nr  r   r%   r%   clsr%   r&   <lambda>      z+test_sanitize_assumptions.<locals>.<lambda>c                   S   s   t td dS )Nr   )r   	_sanitizedictr%   r%   r%   r&   r    s    )r   r   r   r   r/   r   
ValueErrorr$   r%   r  r&   test_sanitize_assumptions  s   r  c                  C   s|   dt d t d d t dd  d  } t| dk tju s J t| dktju s+J | dkdu s3J | ddu s<J d S )Nr]   rY   
   r   r   FT)r	   r   r   falseequals)r   r%   r%   r&   test_special_assumptions  s
   *r  c                   C   s   t tdd  d S )Nc                   S   s   t ddddS )Nr   TF)r   r   )r   r%   r%   r%   r&   r    s    z#test_inconsistent.<locals>.<lambda>r   r   r%   r%   r%   r&   test_inconsistent  s   r  c                   C   sp   dt  jdu s	J dt d  jdu sJ dt d  jdu sJ dt tj  jdu s+J t t d  jdu s6J d S )Nr@   Tr   )r   r   r   ra   r%   r%   r%   r&   test_issue_6631  s
   r  c                   C   s   ddt   jdu sJ d S )Nr>   F)r   r   r%   r%   r%   r&   test_issue_2730  s   r  c                     s  dt  jsJ dt  jdu sJ dt  tjt   jsJ tddd} dt  tjt   | t   jd u s4J tddd}dt  tjt   |t   jsJJ tddd	}d
t  tjt   |t   js`J tddd  fddtdD g dkswJ td}|jdu sJ |jsJ d S )NrW   Fr   Tri   r   ry   r   r   r]   r   rr   c                    s   g | ]} | j qS r%   )r!   ).0rh   r   r%   r&   
<listcomp>.  s    z#test_issue_4149.<locals>.<listcomp>rX   )FTFTz"-sqrt(3)*I/2 + 0.866025403784439*I)r   r-   r!   r   ra   r   ranger   )r   r   r   r   r%   r  r&   test_issue_4149!  s    $  r  c                  C   s   t ddd} t| jsJ d S )Nr   Tr   )r   r	   r!   r   r%   r%   r&   test_issue_29207  s   r  c                  C   sV   t ddd} t|  jd u sJ | t | d  jd u sJ | t | d  jd u s)J d S )Nr   Tri   r>   )r   r   r   rk   r$   r%   r%   r&   test_issue_7899<  s   r  c                  C   s*   t dd} t dd}| | jdu sJ d S )NTr   )
nonintegerF)r   rk   r   r%   r%   r&   test_issue_7993C  s   

r  c                   C   s    t tdd  t tdd  d S )Nc                   S      t dddS )NTF)rv   r   r   r%   r%   r%   r&   r  K  r  z!test_issue_8075.<locals>.<lambda>c                   S   s   t dddS )NT)rv   r   r   r%   r%   r%   r&   r  L  r  r  r%   r%   r%   r&   test_issue_8075J  s   r!  c                  C   s.   t dddd} | d jd u sJ | d jd S )Nr   TFr   r   r   r    r$   r%   r%   r&   test_issue_8642O  s    r#  c                  C   s   t ddd} t ddd}| tj jsJ | d jsJ |d js"J |  d js*J | d js2J t dd}|d js>J |d jd u sGJ t ddd}|d jsTJ t dd	} | | d  d jsdJ | d d tj jspJ t dd
}|d js|J d S )NT)r   rz   r   r>   r   r   rW   )rz   r   ry   r   )r   r   Halfr/   r2   r1   r0   )r   r   r   r   r   r%   r%   r&   $test_issues_8632_8633_8638_8675_8992T  s"   


r%  c                  C   sz   t dddd} t| dkdksJ t| dk dksJ t| d jd u s&J t| d jdu s1J t| d dks;J d S )Nr   Tr   r>   Fr   )r   r   r3   r  r%   r%   r&   test_issue_9115_9150i  s   r&  c                  C   sV   t ddd} t ddd}d|  tju sJ dd|   tju s J d| tju s)J d S )	Nr;   Tru   r   Fr   r   r>   )r   r   rT   )r;   r   r%   r%   r&   test_issue_9165s  s
   r'  c                  C   s$   t d} t| dt jd u sJ d S )Nr   r   )r   r   r   rk   r$   r%   r%   r&   test_issue_10024{  s   r(  c                  C   s   t d} t ddd}ddt  dt   dddt    }||t  }|jd u s*J || jd u s3J d| jdu s<J td	dd
}|t jdu sKJ ||t  jd u sVJ |t js]J ||  t jd u shJ ||t  t jd u suJ d S )Nr   r[   Tri   rW   r   r>   Frh   ru   )r   r   r   r   rk   r   r!   )r   r[   ur   rh   r%   r%   r&   test_issue_10302  s   &r*  c                   C   s   dddt    jdu sJ d S )Nr>   rX   rW   F)r   r!   r%   r%   r%   r&   !test_complex_reciprocal_imaginary  s   r+  c                  C   s   t ddd} t ddd}t dddd}|  jdu sJ ||  jd u s$J ||  jdu s-J ||  |  jd u s8J |  jdu s@J d S )	Nr   Fro   kTri   l)r   rv   )r   r   r/   )r   r,  r-  r%   r%   r&   test_issue_16313  s   r.  c                  C   s~   t dddd} t dddd}| jdu sJ |jdu sJ t ddd}|jdu s)J ttd	d
  t ddd}|jdu s=J d S )Nr   TF)rp   r   r   r   c)complexc                   S   r  )NTF)r0  r   r   r%   r%   r%   r&   r    r  z"test_issue_16579.<locals>.<lambda>nfr   )r   r5   r6   r   r   )r   r   r/  r1  r%   r%   r&   test_issue_16579  s   r2  c                  C   s(   t t } | jdu sJ | jdu sJ d S rP   )r   r   r!   r5   r:   r%   r%   r&   test_issue_17556  s   r3  c                  C   s.   t dddd} dd|    }|jd u sJ d S )Nr,  Tr   r   r"  )r,  r   r%   r%   r&   test_issue_21651  s   r4  c                   C   s  t tdtddddiksJ t tddgi ksJ t tddgddiks*J t tdddiks6J t dd s>J t dt i d	dddd
dddddddddddddddddddddddddddddddddddddddddksJ d S )Nr   Tr   r   r   r>   rz   rW   r   r0  	compositeFr   r   r   r   extended_nonzeror   rp   r   rs   r   r   r   )r  r   r   r   r   rz   r   r   r   r   rv   )r   r   r
  r   r%   r%   r%   r&   test_assumptions_copy  sp   	
r7  c                     s
  t dddu s	J tddd t d du sJ t dddu s!J t dddu s*J tddd	} t | dd u s9J t td d	dd	d u sFJ t td d	dd	d u sSJ t tdd	dd	du s`J t tdd	dd	du smJ t tdd	d d	du szJ tt fd
d d S )Nr>   r   Fr   Try   r@   r   r   c                      s   t d   ddS )Nr   Try   )r   r%   r$   r%   r&   r    s    z(test_check_assumptions.<locals>.<lambda>)r   r   r   r   r  r  r%   r$   r&   test_check_assumptions  s   r8  c                  C   s   t ddd} t d}td|  | fi | ji dd dd dd d	d d
d dd dd dd dd dd dd dd dd dd dd dd dd dd iksRJ d S )Nr   Try   r      r   rs   r0  	hermitianrz   r   r   r   r   rv   rp   r   r   r   r   r   r6  r   )r   r   assumptions0r   r%   r%   r&   test_failing_assumptions  sB   r<  c                   C   s   t g di ddddddddddd	dd
ddddddddddddddddddddddddksBJ t g dd ddiksQJ t g dg i ks\J t g dgi ksfJ t dgdgddikssJ d S )N)r   r>   r   r   Tr   Fr:  rp   r   r   r   r   r   rs   r0  r   r  r5  r   r   r   )r   r   zpositive integerr   )r   splitr%   r%   r%   r&   test_common_assumptions  sT   
r>  N)ssympy.core.modr   sympy.core.numbersr   r   r   (sympy.functions.combinatorial.factorialsr   &sympy.functions.elementary.exponentialr   r   (sympy.functions.elementary.miscellaneousr	   (sympy.functions.elementary.trigonometricr
   r   sympy.simplify.simplifyr   
sympy.corer   r   r   r   r   r   r   sympy.core.assumptionsr   r   r   r   sympy.core.factsr   sympy.testing.pytestr   r   r'   r<   r?   rA   rK   rO   rS   rV   r\   r_   rb   re   rg   rm   rq   rt   rw   r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r  r  r!  r#  r%  r&  r'  r(  r*  r+  r.  r2  r3  r4  r7  r8  r<  r>  r%   r%   r%   r&   <module>   s    $	"")













Q
''



'