+
    i                     H    R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	 RR lt
R# )z4Functions to support rewriting of SymPy expressions )Expr)ask)subs)rebuildunifyNc                (   a aaaa RVVV VV3R llpV# )a{  Rewrite rule.

Transform expressions that match source into expressions that match target
treating all ``variables`` as wilds.

Examples
========

>>> from sympy.abc import w, x, y, z
>>> from sympy.unify.rewrite import rewriterule
>>> from sympy import default_sort_key
>>> rl = rewriterule(x + y, x**y, [x, y])
>>> sorted(rl(z + 3), key=default_sort_key)
[3**z, z**3]

Use ``condition`` to specify additional requirements.  Inputs are taken in
the same order as is found in variables.

>>> rl = rewriterule(x + y, x**y, [x, y], lambda x, y: x.is_integer)
>>> list(rl(z + 3))
[3**z]

Use ``assume`` to specify additional requirements using new assumptions.

>>> from sympy.assumptions import Q
>>> rl = rewriterule(x + y, x**y, [x, y], assume=Q.integer(x))
>>> list(rl(z + 3))
[3**z]

Assumptions for the local context are provided at rule runtime

>>> list(rl(w + z, Q.integer(z)))
[z**w]
c           
   3   p  <"   \        SV / S	R 7       F  pS'       d-   S! S	 Uu. uF  q2P                  W34      NK  	  up!  '       g   K7  S'       d$   \        SP                  V4      V4      '       g   Kb  \	        V4      ! S4      p\        V\        4      '       d   \        V4      pVx  K  	  R# u upi 5i))	variablesN)r   getr   xreplacer   
isinstancer   r   )
exprassumptionsmatchvarexpr2assume	conditionsourcetargetr	   s
   &&   s/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/unify/rewrite.py
rewrite_rlrewriterule.<locals>.rewrite_rl,   s     64yAEyIy		# 3yIJJs6??5#9;GGK'E%&&K BIs   !B6B1

B6	B6A$B6)T )r   r   r	   r   r   r   s   fffff r   rewriteruler      s    H
 
     )r   NN)__doc__sympy.core.exprr   sympy.assumptionsr   sympy.strategies.toolsr   sympy.unify.usympyr   r   r   r   r   r   <module>r!      s    ;   ! ' -/r   