K i ddlmZmZmZddlmZmZmZmZm Z m Z ddl m Z GddeZ eejeejeej eej"e ej$e ej&iZGddeZy) ) PredicateAppliedPredicateQ)EqNeGtLtGeLe) Dispatcherc(eZdZdZdZeddZy)CommutativePredicatez Commutative predicate. Explanation =========== ``ask(Q.commutative(x))`` is true iff ``x`` commutes with any other object with respect to multiplication operation. commutativeCommutativeHandlerzHandler for key 'commutative'.docN)__name__ __module__ __qualname____doc__namer handleri/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/assumptions/predicates/common.pyrrs  D-3STGrrc:eZdZdZdZeddZfdZxZS)IsTruePredicatea; Generic predicate. Explanation =========== ``ask(Q.is_true(x))`` is true iff ``x`` is true. This only makes sense if ``x`` is a boolean object. Examples ======== >>> from sympy import ask, Q >>> from sympy.abc import x, y >>> ask(Q.is_true(True)) True Wrapping another applied predicate just returns the applied predicate. >>> Q.is_true(Q.even(x)) Q.even(x) Wrapping binary relation classes in SymPy core returns applied binary relational predicates. >>> from sympy import Eq, Gt >>> Q.is_true(Eq(x, y)) Q.eq(x, y) >>> Q.is_true(Gt(x, y)) Q.gt(x, y) Notes ===== This class is designed to wrap the boolean objects so that they can behave as if they are applied predicates. Consequently, wrapping another applied predicate is unnecessary and thus it just returns the argument. Also, binary relation classes in SymPy core have binary predicates to represent themselves and thus wrapping them with ``Q.is_true`` converts them to these applied predicates. is_true IsTrueHandlerzBWrapper allowing to query the truth value of a boolean expression.rct|tr|St|ddr!tt |}||j St ||S)N is_RelationalF) isinstancergetattr binrelpredstypeargssuper__call__)selfargpred __class__s rr(zIsTruePredicate.__call__IsK c+ ,J 3 /tCy)D? "w$$r) rrrrrr rr( __classcell__)r,s@rrrs*)T D PG %%rrN)sympy.assumptionsrrrsympy.core.relationalrrrr r r sympy.multipledispatchr reqnegtltgeler$rrrrr7sf<<88- U9 U 144QTT2qttRr144QTTJ 9%i9%r