Ë
    7^(hÇ   ã                   óÌ   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZmZmZmZmZ ddlmZ ed„ «       Zedd
„«       Zedd„«       Zedd„«       Zd„ Zed„ «       Zd„ Zd„ Zy	)zÓ
Known facts in assumptions module.

This module defines the facts between unary predicates in ``get_known_facts()``,
and supports functions to generate the contents in
``sympy.assumptions.ask_generated`` file.
é    )ÚQ)ÚAppliedPredicate)Úcacheit)ÚSymbol)Úto_cnfÚAndÚNotÚImpliesÚ
EquivalentÚ	Exclusive)Úsatisfiablec                  ó~  — t         j                  t         j                  t         j                  z  t         j                  z  t         j
                  t         j                  t         j                  z  t         j                  t         j                  t         j                  z  t         j                  t         j                  t         j                  z  t         j                  t         j                  t         j                  z  t         j                  t         j                  t         j                  z  t         j                  z  t         j                  z  t         j                  z  t         j                  t         j                  t         j                  z  t         j                  t         j                  t         j                  z  t         j                   t         j                  t         j                  z  t         j                  z  t         j                  z  t         j"                  t         j                  t         j                  z  t         j                  z  t         j$                  t         j                  t         j                  z  t         j                  z  t         j&                  t         j(                  t         j*                  z  iS ©N)r   ÚrealÚnegativeÚzeroÚpositiveÚintegerÚevenÚoddÚnonpositiveÚnonzeroÚnonnegativeÚextended_realÚnegative_infiniteÚpositive_infiniteÚextended_positiveÚextended_negativeÚextended_nonzeroÚextended_nonpositiveÚextended_nonnegativeÚcomplexÚ	algebraicÚtranscendental© ó    úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/assumptions/facts.pyÚget_composite_predicatesr(      sz  € ô
 	
�‰”—‘œaŸf™fÑ$¤q§z¡zÑ1Ü	�	‰	”A—F‘FœQŸU™U‘NÜ	�‰œŸ
™
¤Q§V¡VÑ+Ü	�	‰	”A—J‘J¤§¡Ñ+Ü	�‰œŸ™¤§¡Ñ+Ü	�‰œ!×-Ñ-´·
±
Ñ:¼Q¿V¹VÑCÄaÇjÁjÑPÔST×SfÑSfÑfÜ	×ÑœQŸZ™Z¬!×*=Ñ*=Ñ=Ü	×ÑœQŸZ™Z¬!×*=Ñ*=Ñ=Ü	×ÑœA×/Ñ/´!·*±*Ñ<¼q¿z¹zÑIÌA×L_ÑL_Ñ_Ü	×Ñ¤× 3Ñ 3´a·j±jÑ @Ä1Ç6Á6Ñ IÜ	×Ñ¤§¡¬¯©Ñ 3´a×6IÑ6IÑ IÜ	�	‰	”A—K‘K¤!×"2Ñ"2Ñ2ðð r&   Nc                 ó\   — | €t        d«      } t        t        | «      t        | «      «      }|S )z÷
    Facts between unary predicates.

    Parameters
    ==========

    x : Symbol, optional
        Placeholder symbol for unary facts. Default is ``Symbol('x')``.

    Returns
    =======

    fact : Known facts in conjugated normal form.

    Úx)r   r   Úget_number_factsÚget_matrix_facts©r*   Úfacts     r'   Úget_known_factsr/   &   s3   € ð" 	€yÜ�3‹KˆäÜ˜ÓÜ˜Óó€Dð €Kr&   c                 óâ	  — | €t        d«      } t        t        t        j                  | «      t        j
                  | «      t        j                  | «      t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      z  t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                   | «      t        j"                  | «      z  «      t        t        j"                  | «      t        j                   | «      «      t        t        j                   | «      t        j                  | «      «      t        t        j$                  | «      t        j&                  | «      «      t        t        j(                  | «      t        j                   | «      «      t        t        j                  | «      t        j$                  | «      «      t        t        j*                  | «      t        j,                  | «      «      t        t        j*                  | «      t        j,                  | «      z  t        j(                  | «      t        j                  | «      z  «      t        t        j$                  | «      t        j                  | «      z  t        j,                  | «       z  t        j*                  | «      «      t        t        j                  | «      t        j.                  | «      «      t        t        j                  | «      t        j0                  | «      «      t        t        j                  | «      t        j.                  | «      t        j0                  | «      z  «      t        t        j2                  | «      t        j4                  | «      «      t        t        j                  | «      t        j4                  | «      «      t        t        j                  | «      t        j                  | «      z  t        j2                  | «      «      t        t        j4                  | «      t        j2                  | «      z  t        j6                  | «      «      «      }|S )zþ
    Facts between unary number predicates.

    Parameters
    ==========

    x : Symbol, optional
        Placeholder symbol for unary facts. Default is ``Symbol('x')``.

    Returns
    =======

    fact : Known facts in conjugated normal form.

    r*   )r   r   r   r   r   r   r   r   r   r   Ú	imaginaryr
   r"   r$   r#   r   ÚrationalÚ
irrationalr   r   r   Ú	compositeÚprimeÚ	hermitianÚantihermitianÚinfiniteÚfiniteÚcommutativer-   s     r'   r+   r+   A   sã  € ð" 	€yÜ�3‹Kˆää”!×%Ñ% aÓ(¬!¯*©*°Q«-¼¿¹À»Ü�J‰J�q‹Mœ1×.Ñ.¨qÓ1ó	3ô 	”!—&‘&˜“)œQŸ[™[¨›^Ó,Ü”—‘�q“	œAŸK™K¨›NÑ*¬A¯I©I°a«LÓ9ô 	”!×"Ñ" 1Ó%¤q§{¡{°1£~Ó6Ü”1—6‘6˜!“9œaŸj™j¨›m¬a¯l©l¸1«oÑ=Ó>Ü”!—,‘,˜q“/¤1§:¡:¨a£=Ó1Ü”—
‘
˜1“œqŸ{™{¨1›~Ó.ô 	”!—&‘&˜“)œQŸU™U 1›XÓ&Ü”—	‘	˜!“œaŸj™j¨›mÓ,Ü”—‘�q“	œ1Ÿ6™6 !›9Ó%Ü”!—+‘+˜a“.¤!§'¡'¨!£*Ó-Ü”—‘˜A“¤§¡¨£Ñ+¬Q¯Y©Y°q«\¼A¿J¹JÀq»MÑ-IÓJÜ”—‘�q“	œAŸJ™J q›MÑ)¬Q¯W©W°Q«Z¨KÑ7¼¿¹ÀQ»ÓHô 	”—‘�q“	œ1Ÿ;™; q›>Ó*Ü”—‘˜A“¤§¡°Ó 2Ó3Ü”—‘�q“	œ1Ÿ;™; q›>¬A¯O©O¸AÓ,>Ñ>Ó?ô 	”!—*‘*˜Q“-¤§¡¨!£Ó-Ü”—	‘	˜!“œaŸh™h q›kÓ*Ü”×#Ñ# AÓ&¬×)<Ñ)<¸QÓ)?Ñ?ÄÇÁÈAÃÓOô 	”—‘˜“œaŸj™j¨›mÑ+¬Q¯]©]¸1Ó-=Ó>óE#€DðH €Kr&   c                 ó´	  — | €t        d«      } t        t        t        j                  | «      t        j
                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      z  t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j
                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      t        j                  | «      z  «      t        t        j                  | «      t        j                  | «      z  t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                   | «      t        j                  | «      «      t        t        j                  | «      t        j"                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j                  | «      t        j                  | «      «      t        t        j"                  | «      t        j                  | «      z  t        j                  | «      «      t%        t        j                  | «      t        j&                  | «       «      t        t        j(                  | «      t        j                  | «      «      t        t        j                  | «      t        j*                  | «      «      «      }|S )zþ
    Facts between unary matrix predicates.

    Parameters
    ==========

    x : Symbol, optional
        Placeholder symbol for unary facts. Default is ``Symbol('x')``.

    Returns
    =======

    fact : Known facts in conjugated normal form.

    r*   )r   r   r
   r   Ú
orthogonalÚpositive_definiteÚunitaryÚreal_elementsÚnormalÚ
invertibleÚsquareÚdiagonalÚupper_triangularÚlower_triangularÚ
triangularÚ	symmetricÚunit_triangularÚfullrankr   ÚsingularÚinteger_elementsÚcomplex_elementsr-   s     r'   r,   r,   |   sÙ  € ð" 	€yÜ�3‹Kˆää”—‘˜Q“¤×!4Ñ!4°QÓ!7Ó8Ü”—‘˜Q“¤§¡¨1£Ó.Ü”—	‘	˜!“œqŸ™¨qÓ1Ñ1´1·<±<À³?ÓCÜ”—	‘	˜!“œaŸh™h q›kÓ*Ü”—	‘	˜!“œaŸl™l¨1›oÓ.Ü”—‘˜“œQŸX™X a›[Ó)Ü”—
‘
˜1“œqŸx™x¨›{Ó+Ü”×#Ñ# AÓ&¬¯©°Q«Ó8Ü”—
‘
˜1“œq×1Ñ1°!Ó4Ó5Ü”—
‘
˜1“œq×1Ñ1°!Ó4Ó5Ü”×"Ñ" 1Ó%¤q§|¡|°A£Ó7Ü”×"Ñ" 1Ó%¤q§|¡|°A£Ó7Ü”—‘˜Q“¤×!3Ñ!3°AÓ!6¼×9KÑ9KÈAÓ9NÑ!NÓOÜ”×"Ñ" 1Ó%¬×(:Ñ(:¸1Ó(=Ñ=¼q¿z¹zÈ!»}ÓMÜ”—
‘
˜1“œqŸ{™{¨1›~Ó.Ü”×!Ñ! !Ó$¤a§l¡l°1£oÓ6Ü”—‘˜Q“¤§¡¨A£Ó/Ü”—‘˜Q“¤§¡¨!£Ó-Ü”—‘˜A“¤§¡¨£Ó,Ü”—
‘
˜1“¤§¡¨£Ñ+¬Q¯\©\¸!«_Ó=Ü”1—<‘< “?¤Q§Z¡Z°£] NÓ3Ü”×"Ñ" 1Ó%¤q§¡°qÓ'9Ó:Ü”—‘ Ó"¤A×$6Ñ$6°qÓ$9Ó:ó1€Dð4 €Kr&   c                 óŽ  — t        |«      }t        | |«      }i }|j                  «       D ]˜  \  }}t        «       }t        «       }|D ]i  }	t	        |	t
        «      r|j                  |	j                  «       Œ/t	        |	t        «      sŒ@|	j                  d   }
|j                  |
j                  «       Œk ||f||j                  <   Œš |S )a  
    Computes and returns a dictionary which contains the relations between
    unary predicates.

    Each key is a predicate, and item is two groups of predicates.
    First group contains the predicates which are implied by the key, and
    second group contains the predicates which are rejected by the key.

    All predicates in *keys* and *fact* must be unary and have same placeholder
    symbol.

    Parameters
    ==========

    keys : list of AppliedPredicate instances.

    fact : Fact between predicates in conjugated normal form.

    Examples
    ========

    >>> from sympy import Q, And, Implies
    >>> from sympy.assumptions.facts import generate_known_facts_dict
    >>> from sympy.abc import x
    >>> keys = [Q.even(x), Q.odd(x), Q.zero(x)]
    >>> fact = And(Implies(Q.even(x), ~Q.odd(x)),
    ...     Implies(Q.zero(x), Q.even(x)))
    >>> generate_known_facts_dict(keys, fact)
    {Q.even: ({Q.even}, {Q.odd}),
     Q.odd: ({Q.odd}, {Q.even, Q.zero}),
     Q.zero: ({Q.even, Q.zero}, {Q.odd})}
    r   )
r   Úsingle_fact_lookupÚitemsÚsetÚ
isinstancer   ÚaddÚfunctionr	   Úargs)Úkeysr.   Úfact_cnfÚmappingÚretÚkeyÚvalueÚimpliedÚrejectedÚexprÚpreds              r'   Úgenerate_known_facts_dictr_   ®   s³   € ôB �d‹|€HÜ   xÓ0€Gà
€CØ—m‘m“oò 	0‰
ˆˆUÜ“%ˆÜ“5ˆØò 	,ˆDÜ˜$Ô 0Ô1Ø—‘˜DŸM™MÕ*Ü˜D¤#Õ&Ø—y‘y ‘|�Ø—‘˜TŸ]™]Õ+ð	,ð % hÐ/ˆˆC�L‰LÒð	0ð €Jr&   c                  óp  — t         j                  t         j                  t         j                  t         j                  t         j
                  t         j                  h} g }t         j                  j                  D ]:  }|j                  d«      rŒt        t         |«      }|| v rŒ*|j                  |«       Œ< |S )z”
    Return every unary predicates registered to ``Q``.

    This function is used to generate the keys for
    ``generate_known_facts_dict``.

    Ú__)r   ÚeqÚneÚgtÚltÚgeÚleÚ	__class__Ú__dict__Ú
startswithÚgetattrÚappend)ÚexcludeÚresultÚattrr^   s       r'   Úget_known_facts_keysrp   à   s„   € ô �t‰t”Q—T‘Tœ1Ÿ4™4¤§¡¤q§t¡t¬Q¯T©TÐ2€Gà€FÜ—‘×$Ñ$ò ˆØ�?‰?˜4Ô ØÜ”q˜$ÓˆØ�7‰?ØØ�‰�dÕðð €Mr&   c                 óÈ   — i }| D ]Z  }|h||<   | D ]M  }||k7  sŒ	t        |||«      r||   j                  |«       t        | ||«      sŒ9||   j                  | «       ŒO Œ\ |S r   )Úask_full_inferencerR   )Úknown_facts_keysÚknown_facts_cnfrW   rY   Ú	other_keys        r'   rN   rN   ÷   s   € à€GØò 1ˆØ�uˆ�‰Ø)ò 	1ˆIØ˜CÓÜ% i°°oÔFØ˜C‘L×$Ñ$ YÔ/Ü% y j°#°ÕGØ˜C‘L×$Ñ$ i ZÕ0ñ	1ð1ð €Nr&   c           	      ór   — t        t        ||| «      «      syt        t        ||t        | «      «      «      syy)z9
    Method for inferring properties about objects.

    FTN)r   r   r	   )ÚpropositionÚassumptionsrt   s      r'   rr   rr     s4   € ô
 ”s˜?¨K¸ÓEÔFØÜ”s˜?¨K¼¸[Ó9IÓJÔKØØr&   r   )Ú__doc__Úsympy.assumptions.askr   Úsympy.assumptions.assumer   Úsympy.core.cacher   Úsympy.core.symbolr   Úsympy.logic.boolalgr   r   r	   r
   r   r   Úsympy.logic.inferencer   r(   r/   r+   r,   r_   rp   rN   rr   r%   r&   r'   ú<module>r€      s›   ðñõ $Ý 5Ý $Ý $÷÷ å -ð 	ñó 	ðð& 	òó 	ðð4 	ò7ó 	ð7ðt 	ò-ó 	ð-òb/ðd 	ñó 	ðò,ó	r&   