
    MZd                     V    d Z ddlmZ ddlmZmZ efdZefdZefdZefdZ	efdZ
y	)
zStrategies to Traverse a Tree.    )	basic_fns)chaindo_onec                 &     t          fd      S )z;Apply a rule down a tree running it on the top nodes first.c                 <     t        t                    |       S Nsalltop_downexprfnsrules    ;/usr/lib/python3/dist-packages/sympy/strategies/traverse.py<lambda>ztop_down.<locals>.<lambda>   s    $BD$)<c$B4$H     r   r   r   s   ``r   r   r      s    HIIr   c                 &     t         fd       S )z>Apply a rule down a tree running it on the bottom nodes first.c                 <     t        t                    |       S r   r
   	bottom_upr   s    r   r   zbottom_up.<locals>.<lambda>   s    =d9T3#7=dC r   r   r   s   ``r   r   r      s    CTJJr   c                 &     t          fd      S )z+Apply a rule down a tree - stop on success.c                 <     t        t                    |       S r   r	   r   s    r   r   ztop_down_once.<locals>.<lambda>   s    %CT(4*=s%CD%I r   r   r   s   ``r   top_down_oncer      s    $IJJr   c                 &     t         fd       S )z)Apply a rule up a tree - stop on success.c                 <     t        t                    |       S r   r   r   s    r   r   z bottom_up_once.<locals>.<lambda>   s    >tIdC$8#>tD r   r   r   s   ``r   bottom_up_oncer      s    DdKKr   c                 X     t        |j                  d      \   fd}|S )z#Strategic all - apply rule to args.)opnewchildrenleafc                 Z     |       r| S t         |             }  |       g| S r   )map)r   argsr#   r$   r"   r!   r   s     r   all_rlzsall.<locals>.all_rl   s3    :KtXd^,Dr$x'$''r   )r&   get)r   r   r(   r#   r$   r"   r!   s   `  @@@@r   r
   r
      s.    !#''+LMBXt( ( Mr   N)__doc__sympy.strategies.utilr   sympy.strategies.corer   r   r   r   r   r   r
    r   r   <module>r.      sD    $ + / ! J
 " K
 & K
 ' L
  r   