+
    iK                         R t ^ RIHtHtHt ^ RIHtHtHt ^ RI	H
t
 ^ RIHt ^ RIHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHtHtHt  ! R	 R
4      t]! 4       tR tR]3R ltR t R t!R t"^ RI#H$t$H%t% R# )z4Module for querying SymPy objects about assumptions.)global_assumptions	PredicateAppliedPredicate)CNF
EncodedCNFLiteral)sympify)BooleanKind)EqNeGtLtGeLe)satisfiable)memoize_property)sympy_deprecation_warningSymPyDeprecationWarningignore_warningsc                     a  ] tR t^t o Rt]R 4       t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t ]R 4       t!]R 4       t"]R 4       t#]R  4       t$]R! 4       t%]R" 4       t&]R# 4       t']R$ 4       t(]R% 4       t)]R& 4       t*]R' 4       t+]R( 4       t,]R) 4       t-]R* 4       t.]R+ 4       t/]R, 4       t0]R- 4       t1]R. 4       t2]R/ 4       t3]R0 4       t4]R1 4       t5]R2 4       t6]R3 4       t7]R4 4       t8]R5 4       t9]R6 4       t:]R7 4       t;]R8 4       t<]R9 4       t=R:t>V t?R;# )<AssumptionKeyszm
This class contains all the supported keys by ``ask``.
It should be accessed via the instance ``sympy.Q``.

c                    ^RI Hp V! 4       # )   )HermitianPredicate)handlers.setsr   )selfr   s   & u/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/assumptions/ask.py	hermitianAssumptionKeys.hermitian        5!##    c                    ^RI Hp V! 4       # )r   )AntihermitianPredicate)r   r"   )r   r"   s   & r   antihermitianAssumptionKeys.antihermitian%   s    9%''r    c                    ^RI Hp V! 4       # )r   )RealPredicate)r   r&   )r   r&   s   & r   realAssumptionKeys.real*   s    0r    c                    ^RI Hp V! 4       # )r   )ExtendedRealPredicate)r   r*   )r   r*   s   & r   extended_realAssumptionKeys.extended_real/   s    8$&&r    c                    ^RI Hp V! 4       # )r   )ImaginaryPredicate)r   r.   )r   r.   s   & r   	imaginaryAssumptionKeys.imaginary4   r   r    c                    ^RI Hp V! 4       # )r   )ComplexPredicate)r   r2   )r   r2   s   & r   complexAssumptionKeys.complex9       3!!r    c                    ^RI Hp V! 4       # )r   )AlgebraicPredicate)r   r7   )r   r7   s   & r   	algebraicAssumptionKeys.algebraic>   r   r    c                    ^RI Hp V! 4       # )r   )TranscendentalPredicate)predicates.setsr;   )r   r;   s   & r   transcendentalAssumptionKeys.transcendentalC   s    <&((r    c                    ^RI Hp V! 4       # )r   )IntegerPredicate)r   r@   )r   r@   s   & r   integerAssumptionKeys.integerH   r5   r    c                    ^RI Hp V! 4       # )r   )NonIntegerPredicate)r<   rD   )r   rD   s   & r   
nonintegerAssumptionKeys.nonintegerM   s    8"$$r    c                    ^RI Hp V! 4       # )r   )RationalPredicate)r   rH   )r   rH   s   & r   rationalAssumptionKeys.rationalR   s    4 ""r    c                    ^RI Hp V! 4       # )r   )IrrationalPredicate)r   rL   )r   rL   s   & r   
irrationalAssumptionKeys.irrationalW   s    6"$$r    c                    ^RI Hp V! 4       # )r   )FinitePredicate)handlers.calculusrP   )r   rP   s   & r   finiteAssumptionKeys.finite\       6  r    c                    ^RI Hp V! 4       # )r   )InfinitePredicate)rQ   rV   )r   rV   s   & r   infiniteAssumptionKeys.infinitea       8 ""r    c                    ^RI Hp V! 4       # )r   )PositiveInfinitePredicate)rQ   r[   )r   r[   s   & r   positive_infinite AssumptionKeys.positive_infinitef       @(**r    c                    ^RI Hp V! 4       # )r   )NegativeInfinitePredicate)rQ   r`   )r   r`   s   & r   negative_infinite AssumptionKeys.negative_infinitek   r^   r    c                    ^RI Hp V! 4       # )r   )PositivePredicate)handlers.orderrd   )r   rd   s   & r   positiveAssumptionKeys.positivep       5 ""r    c                    ^RI Hp V! 4       # )r   )NegativePredicate)re   rj   )r   rj   s   & r   negativeAssumptionKeys.negativeu   rh   r    c                    ^RI Hp V! 4       # )r   )ZeroPredicate)re   rn   )r   rn   s   & r   zeroAssumptionKeys.zeroz   s    1r    c                    ^RI Hp V! 4       # )r   )ExtendedPositivePredicate)re   rr   )r   rr   s   & r   extended_positive AssumptionKeys.extended_positive       =(**r    c                    ^RI Hp V! 4       # )r   )ExtendedNegativePredicate)re   rw   )r   rw   s   & r   extended_negative AssumptionKeys.extended_negative   ru   r    c                    ^RI Hp V! 4       # )r   )NonZeroPredicate)re   r{   )r   r{   s   & r   nonzeroAssumptionKeys.nonzero   s    4!!r    c                    ^RI Hp V! 4       # )r   )NonPositivePredicate)re   r   )r   r   s   & r   nonpositiveAssumptionKeys.nonpositive       8#%%r    c                    ^RI Hp V! 4       # )r   )NonNegativePredicate)re   r   )r   r   s   & r   nonnegativeAssumptionKeys.nonnegative   r   r    c                    ^RI Hp V! 4       # )r   )ExtendedNonZeroPredicate)re   r   )r   r   s   & r   extended_nonzeroAssumptionKeys.extended_nonzero   s    <'))r    c                    ^RI Hp V! 4       # )r   )ExtendedNonPositivePredicate)re   r   )r   r   s   & r   extended_nonpositive#AssumptionKeys.extended_nonpositive       @+--r    c                    ^RI Hp V! 4       # )r   )ExtendedNonNegativePredicate)re   r   )r   r   s   & r   extended_nonnegative#AssumptionKeys.extended_nonnegative   r   r    c                    ^RI Hp V! 4       # )r   )EvenPredicate)handlers.ntheoryr   )r   r   s   & r   evenAssumptionKeys.even   s    3r    c                    ^RI Hp V! 4       # )r   )OddPredicate)r   r   )r   r   s   & r   oddAssumptionKeys.odd   s    2~r    c                    ^RI Hp V! 4       # )r   )PrimePredicate)r   r   )r   r   s   & r   primeAssumptionKeys.prime   s    4r    c                    ^RI Hp V! 4       # )r   )CompositePredicate)r   r   )r   r   s   & r   	compositeAssumptionKeys.composite   s    8!##r    c                    ^RI Hp V! 4       # )r   )CommutativePredicate)handlers.commonr   )r   r   s   & r   commutativeAssumptionKeys.commutative   s    9#%%r    c                    ^RI Hp V! 4       # )r   )IsTruePredicate)r   r   )r   r   s   & r   is_trueAssumptionKeys.is_true   s    4  r    c                    ^RI Hp V! 4       # )r   )SymmetricPredicate)handlers.matricesr   )r   r   s   & r   	symmetricAssumptionKeys.symmetric   s    9!##r    c                    ^RI Hp V! 4       # )r   )InvertiblePredicate)r   r   )r   r   s   & r   
invertibleAssumptionKeys.invertible       :"$$r    c                    ^RI Hp V! 4       # )r   )OrthogonalPredicate)r   r   )r   r   s   & r   
orthogonalAssumptionKeys.orthogonal   r   r    c                    ^RI Hp V! 4       # )r   )UnitaryPredicate)r   r   )r   r   s   & r   unitaryAssumptionKeys.unitary   s    7!!r    c                    ^RI Hp V! 4       # )r   )PositiveDefinitePredicate)r   r   )r   r   s   & r   positive_definite AssumptionKeys.positive_definite   r^   r    c                    ^RI Hp V! 4       # )r   )UpperTriangularPredicate)r   r   )r   r   s   & r   upper_triangularAssumptionKeys.upper_triangular       ?'))r    c                    ^RI Hp V! 4       # )r   )LowerTriangularPredicate)r   r   )r   r   s   & r   lower_triangularAssumptionKeys.lower_triangular   r   r    c                    ^RI Hp V! 4       # )r   )DiagonalPredicate)r   r   )r   r   s   & r   diagonalAssumptionKeys.diagonal   rY   r    c                    ^RI Hp V! 4       # )r   )FullRankPredicate)r   r   )r   r   s   & r   fullrankAssumptionKeys.fullrank   rY   r    c                    ^RI Hp V! 4       # )r   )SquarePredicate)r   r   )r   r   s   & r   squareAssumptionKeys.square   rT   r    c                    ^RI Hp V! 4       # )r   )IntegerElementsPredicate)r   r   )r   r   s   & r   integer_elementsAssumptionKeys.integer_elements   r   r    c                    ^RI Hp V! 4       # )r   )RealElementsPredicate)r   r   )r   r   s   & r   real_elementsAssumptionKeys.real_elements   s    <$&&r    c                    ^RI Hp V! 4       # )r   )ComplexElementsPredicate)r   r   )r   r   s   & r   complex_elementsAssumptionKeys.complex_elements  r   r    c                    ^RI Hp V! 4       # )r   )SingularPredicate)predicates.matricesr   )r   r   s   & r   singularAssumptionKeys.singular  s    : ""r    c                    ^RI Hp V! 4       # )r   )NormalPredicate)r   r   )r   r   s   & r   normalAssumptionKeys.normal  s    8  r    c                    ^RI Hp V! 4       # )r   )TriangularPredicate)r   r   )r   r   s   & r   
triangularAssumptionKeys.triangular  s    <"$$r    c                    ^RI Hp V! 4       # )r   )UnitTriangularPredicate)r   r   )r   r   s   & r   unit_triangularAssumptionKeys.unit_triangular  s    @&((r    c                    ^RI Hp V! 4       # )r   )EqualityPredicate)relation.equalityr   )r   r   s   & r   eqAssumptionKeys.eq  rY   r    c                    ^RI Hp V! 4       # )r   )UnequalityPredicate)r   r   )r   r   s   & r   neAssumptionKeys.ne  r   r    c                    ^RI Hp V! 4       # )r   )StrictGreaterThanPredicate)r   r   )r   r   s   & r   gtAssumptionKeys.gt$  s    A)++r    c                    ^RI Hp V! 4       # )r   )GreaterThanPredicate)r   r  )r   r  s   & r   geAssumptionKeys.ge)  s    ;#%%r    c                    ^RI Hp V! 4       # )r   )StrictLessThanPredicate)r   r  )r   r  s   & r   ltAssumptionKeys.lt.  s    >&((r    c                    ^RI Hp V! 4       # )r   )LessThanPredicate)r   r  )r   r  s   & r   leAssumptionKeys.le3  rY   r     N)@__name__
__module____qualname____firstlineno____doc__r   r   r#   r'   r+   r/   r3   r8   r=   rA   rE   rI   rM   rR   rW   r\   ra   rf   rk   ro   rs   rx   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  __static_attributes____classdictcell__)__classdict__s   @r   r   r      sj     $ $ ( (   ' ' $ $ " " $ $ ) ) " " % % # # % % ! ! # # + + + + # # # #   + + + + " " & & & & * * . . . .         $ $ & & ! ! $ $ % % % % " " + + * * * * # # # # ! ! * * ' ' * * # # ! ! % % ) ) # # % % , , & & ) ) # #r    r   c                   \        4       pV P                   F  p. pV F  p\        VP                  \        4      '       d~   \        VP                  P                  4      ^8X  dZ   VP                  P                  V9   d<   VP                  \        VP                  P                  VP                  4      4       K   K   K  	  V'       g   K  VP                  \        V4      4       K  	  \        V4      # )a3  
Extract all relevant assumptions from *assump* with respect to given *exprs*.

Parameters
==========

assump : sympy.assumptions.cnf.CNF

exprs : tuple of expressions

Returns
=======

sympy.assumptions.cnf.CNF

Examples
========

>>> from sympy import Q
>>> from sympy.assumptions.cnf import CNF
>>> from sympy.assumptions.ask import _extract_all_facts
>>> from sympy.abc import x, y
>>> assump = CNF.from_prop(Q.positive(x) & Q.integer(y))
>>> exprs = (x,)
>>> cnf = _extract_all_facts(assump, exprs)
>>> cnf.clauses
{frozenset({Literal(Q.positive, False)})}

)setclauses
isinstancelitr   len	argumentsargappendr   functionis_Notadd	frozensetr   )assumpexprsfactsclauseargsliterals   &&    r   _extract_all_factsr+  ;  s    < EE..G'++'788SAVAV=W[\=\;;??e+KK(<(<gnn MN    t		)D/*! !" u:r    Tc                    ^ RI Hp ^ RIHp ^ RIHp \        V 4      p \        V4      p\        V \        4      '       g   V P                  \        Jd   \        R4      h\        V\        4      '       g   VP                  \        Jd   \        R4      h\        \        P                  \        \        P                   \"        \        P$                  \&        \        P(                  \*        \        P,                  \.        \        P0                  /p\        V \2        4      '       d   V P4                  V P6                  rMAV P8                  V9   d   V\;        V 4      ,          V P<                  rM\        P>                  V 3r\@        PB                  ! V4      p	V	PE                  V4       \G        W4      p
\I        4       p\K        4       pVPM                  \A        V4      4       VPO                  V
4       V
PP                  '       d"   \S        V4      RJ d   \U        RV,          4      h\W        Wz4      pVe   V# V! V!  PY                  V4      pVe   \[        V4      # V! WVR	7      pVe   V#  V! WVR	7      pV#   T d     R# i ; i)
a  
Function to evaluate the proposition with assumptions.

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

This function evaluates the proposition to ``True`` or ``False`` if
the truth value can be determined. If not, it returns ``None``.

It should be discerned from :func:`~.refine` which, when applied to a
proposition, simplifies the argument to symbolic ``Boolean`` instead of
Python built-in ``True``, ``False`` or ``None``.

**Syntax**

    * ask(proposition)
        Evaluate the *proposition* in global assumption context.

    * ask(proposition, assumptions)
        Evaluate the *proposition* with respect to *assumptions* in
        global assumption context.

Parameters
==========

proposition : Boolean
    Proposition which will be evaluated to boolean value. If this is
    not ``AppliedPredicate``, it will be wrapped by ``Q.is_true``.

assumptions : Boolean, optional
    Local assumptions to evaluate the *proposition*.

context : AssumptionsContext, optional
    Default assumptions to evaluate the *proposition*. By default,
    this is ``sympy.assumptions.global_assumptions`` variable.

Returns
=======

``True``, ``False``, or ``None``

Raises
======

TypeError : *proposition* or *assumptions* is not valid logical expression.

ValueError : assumptions are inconsistent.

Examples
========

>>> from sympy import ask, Q, pi
>>> from sympy.abc import x, y
>>> ask(Q.rational(pi))
False
>>> ask(Q.even(x*y), Q.even(x) & Q.integer(y))
True
>>> ask(Q.prime(4*x), Q.integer(x))
False

If the truth value cannot be determined, ``None`` will be returned.

>>> print(ask(Q.odd(3*x))) # cannot determine unless we know x
None

``ValueError`` is raised if assumptions are inconsistent.

>>> ask(Q.integer(x), Q.even(x) & Q.odd(x))
Traceback (most recent call last):
  ...
ValueError: inconsistent assumptions Q.even(x) & Q.odd(x)

Notes
=====

Relations in assumptions are not implemented (yet), so the following
will not give a meaningful result.

>>> ask(Q.positive(x), x > 0)

It is however a work in progress.

See Also
========

sympy.assumptions.refine.refine : Simplification using assumptions.
    Proposition is not reduced to ``None`` if the truth value cannot
    be determined.
)satask)
lra_satask)UnhandledInputz.proposition must be a valid logical expressionz.assumptions must be a valid logical expressionFzinconsistent assumptions %sN)assumptionscontext).sympy.assumptions.sataskr-  sympy.assumptions.lra_sataskr.  !sympy.logic.algorithms.lra_theoryr/  r   r  r   kindr	   	TypeErrorr
   Qr   r   r   r   r  r   r	  r   r  r   r  r   r!  r  functyper)  r   r   	from_propextendr+  get_all_known_factsr   from_cnfadd_from_cnfr  r   
ValueError_ask_single_fact	_eval_askbool)propositionr0  r1  r-  r.  r/  binrelpredskeyr)  
assump_cnflocal_factsknown_facts_cnfenc_cnfress   &&&           r   askrK  o  s   t 07@+&K+&K+y))[-=-=[-PHII+y))[-=-=[-PHIIqttRr144QTT2qttRNK+/00((+*?*?T			[	([ 12K4D4DTII~T {+Jg %Z6K *+OlGS)*% {73u<6DEE 3
,C

 t*

{
+C
Cy w
GC

wO J  s   &
I2 2I=<I=c                >   VP                   '       Ed
   \        4       p\        VP                   4      ^8X  dq   VP                   w  p\        V4      ^8X  dS   Vw  pVP                  V R4      pVe
   V^ ,          M	\	        4       pVP
                  '       d   VP                  V9   d   R# VP                    Fe  p\        V4      ^8X  g   K  Vw  pVP
                  '       g   VP                  VP                  R4      MRpVf   KO  Vw  rhW9   d    R# W9   g   Kd   R# 	  R# )aE  
Compute the truth value of single predicate using assumptions.

Parameters
==========

key : sympy.assumptions.assume.Predicate
    Proposition predicate.

local_facts : sympy.assumptions.cnf.CNF
    Local assumption in CNF form.

Returns
=======

``True``, ``False`` or ``None``

Examples
========

>>> from sympy import Q
>>> from sympy.assumptions.cnf import CNF
>>> from sympy.assumptions.ask import _ask_single_fact

If prerequisite of proposition is rejected by the assumption,
return ``False``.

>>> key, assump = Q.zero, ~Q.zero
>>> local_facts = CNF.from_prop(assump)
>>> _ask_single_fact(key, local_facts)
False
>>> key, assump = Q.zero, ~Q.even
>>> local_facts = CNF.from_prop(assump)
>>> _ask_single_fact(key, local_facts)
False

If assumption implies the proposition, return ``True``.

>>> key, assump = Q.even, Q.zero
>>> local_facts = CNF.from_prop(assump)
>>> _ask_single_fact(key, local_facts)
True

If proposition rejects the assumption, return ``False``.

>>> key, assump = Q.even, Q.odd
>>> local_facts = CNF.from_prop(assump)
>>> _ask_single_fact(key, local_facts)
False
NFT)r  get_known_facts_dictr  getr  r"  r  )	rE  rG  known_facts_dictclf
prop_factsprop_reqr(  prop_rejs	   &&       r   r@  r@    s    f /1{""#q(%%CB2w!|-11#t<
,6,B:a=888 1 !))F6{aFGhhh-11!%%>TX
%%/"?_  * r    c           	        \        RRRR7       \        V \        4      '       d   V P                  P                  p \	        \
        V R4      pVe   VP                  V4       R# \        \
        V \        W.R7      4       R# )z
Register a handler in the ask system. key must be a string and handler a
class inheriting from AskHandler.

.. deprecated:: 1.8.
    Use multipledispatch handler instead. See :obj:`~.Predicate`.

z
        The AskHandler system is deprecated. The register_handler() function
        should be replaced with the multipledispatch handler of Predicate.
        1.8deprecated-askhandlerdeprecated_since_versionactive_deprecations_targetN)handlers)r   r  r   namegetattrr7  add_handlersetattr)rE  handlerQkeys   && r   register_handlerrb  Y  sj     	 "'#: #y!!hhmm1c4 D!3	#	:;r    c                    \        RRRR7       \        V \        4      '       d   V P                  P                  p \	        \
        4      ;_uu_ 4        \        \        V 4      P                  V4       RRR4       R#   + '       g   i     R# ; i)z
Removes a handler from the ask system.

.. deprecated:: 1.8.
    Use multipledispatch handler instead. See :obj:`~.Predicate`.

z
        The AskHandler system is deprecated. The remove_handler() function
        should be replaced with the multipledispatch handler of Predicate.
        rV  rW  rX  N)	r   r  r   r\  r   r   r]  r7  remove_handler)rE  r`  s   &&r   rd  rd  s  sd     	 "'#: #y!!hhmm	0	1	13&&w/ 
2	1	1	1s    A<<B	)r<  rM  N)&r  sympy.assumptions.assumer   r   r   sympy.assumptions.cnfr   r   r   
sympy.corer   sympy.core.kindr	   sympy.core.relationalr
   r   r   r   r   r   sympy.logic.inferencer   sympy.utilities.decoratorr   sympy.utilities.exceptionsr   r   r   r   r7  r+  rK  r@  rb  rd  sympy.assumptions.ask_generatedr<  rM  r  r    r   <module>rn     s{    :  : :  ' 8 8 - 69 9a# a#H	 1h "&/A TnPf<40. r    