
    z	i o                       S r SSKJr  / SQrSSKrSSKJrJrJrJ	r	J
r
JrJr  SSKJrJr  SS	KJr  \R"                  (       a  SSKrS)S
 jr    S*S jrS+S,S jjrS-S jrS.S jrS.S jrS/S jrS0S jrS1S jrS1S jrS1S jrS0S jrS1S jrS1S jr S0S jr!S1S jr"S1S jr#S0S jr$S1S jr%S1S jr&S1S jr'S1S jr(          S2S  jr)S+S3S! jjr*S+S3S" jjr+S4S# jr,S0S$ jr-S1S% jr.S1S& jr/S1S' jr0S1S( jr1g)5zvUser-space constructor functions for the expression tree, which do some of the inference and
lifting boilerplate work.    )annotations)liftcastbit_not	logic_notbit_andbit_orbit_xor	logic_andlogic_orequal	not_equalless
less_equalgreatergreater_equal
shift_leftshift_rightindexaddsubmuldivlift_legacy_conditionN   )ExprVarValueUnaryBinaryCastIndex   )CastKind	cast_kind)typesc                    [        U R                  U5      nU[        R                  L a  U $ U[        R                  L a
  [        XSS9$ U[        R                  L a
  [        XSS9$ g)z}Coerce ``expr`` to ``type`` by inserting a suitable :class:`Cast` node, if the cast is
lossless.  Otherwise, return ``None``.TimplicitFN)r%   typer$   EQUALIMPLICITr!   LOSSLESS)exprr*   kinds      d/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/circuit/classical/expr/constructors.py_coerce_losslessr1   8   s^     TYY%Dx~~x   D..x   D//    c               \   SSK Jn  U u  p#[        X!5      (       aU  [        R                  " 5       nU(       a  [        X$5      $ [        [        R                  R                  [        X$5      U5      $ [        U[        R                  " UR                  S95      nUR                  5       UR                  :  a+  [        U[        R                  " UR                  5       S9SS9n[        X5R                  5      n[        [        R                  R                   XV[        R                  " 5       5      $ )zJLift a legacy two-tuple equality condition into a new-style :class:`Expr`.r   )ClbitwidthTr(   )qiskit.circuitr4   
isinstancer&   Boolr   r   Op	LOGIC_NOTUintsize
bit_lengthr!   r   r*   r    r+   )	conditionr4   targetvaluebool_leftrights          r0   r   r   E   s     %MF&  

%*s6!dehh6H6H#fJ\^c0ddvuzz45DFKK'D%**5+;+;+=>N%#E&))//4

==r2   c          	     X   [        U [        5      (       a  Ub  [        S5      eU $ SSKJnJnJn  U SL d  U SL d  [        X5      (       a,  [        R                  " 5       nU SL d  U SL a  [        O[        nO[        X5      (       a%  [        R                  " U R                  S9n[        nO[        U [        5      (       aC  U S:  a  [        S5      e[        R                  " U R                  5       =(       d    SS9n[        nOl[        U [        5      (       a  [        R                   " 5       n[        nO;[        X5      (       a  [        R                  " 5       n[        nO[#        S	U  S
35      eUc  Un[        R$                  " X5      (       a  U" X5      $ [#        SU SU  SU S
35      e)a
  Lift the given Python ``value`` to a :class:`~.expr.Value` or :class:`~.expr.Var`.

If an explicit ``type`` is given, the typing in the output will reflect that.

Examples:
    Lifting simple circuit objects to be :class:`~.expr.Var` instances::

        >>> from qiskit.circuit import Clbit, ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.lift(Clbit())
        Var(<clbit>, Bool())
        >>> expr.lift(ClassicalRegister(3, "c"))
        Var(ClassicalRegister(3, "c"), Uint(3))

    The type of the return value can be influenced, if the given value could be interpreted
    losslessly as the given type (use :func:`cast` to perform a full set of casting
    operations, include lossy ones)::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr, types
        >>> expr.lift(ClassicalRegister(3, "c"), types.Uint(5))
        Var(ClassicalRegister(3, "c"), Uint(5))
        >>> expr.lift(5, types.Uint(4))
        Value(5, Uint(4))
z3use 'cast' to cast existing expressions, not 'lift'r   )r4   ClassicalRegisterDurationTFr5   z!cannot represent a negative valuer   zfailed to infer a type for ''zthe explicit type 'z$' is not suitable for representing 'z''; it must be non-strict supertype of ')r8   r   
ValueErrorr7   r4   rF   rG   r&   r9   r   r   r<   r=   intr>   floatFloat	TypeErroris_supertype)rA   r*   r4   rF   rG   inferredconstructors          r0   r   r   V   si   4 %RSSAA }*U*B*B::<$}eC	E	-	-::EJJ/	E3		19@AA::E$4$4$6$;!<	E5	!	!;;=	E	$	$>>#6ugQ?@@|$))5''

dV#Gw O008z	< r2   c                   [        U 5      n [        U R                  U5      [        R                  L a  [        SU  SU S35      e[        X5      $ )a  Create an explicit cast from the given value to the given type.

Examples:
    Add an explicit cast node that explicitly casts a higher precision type to a lower precision
    one::

        >>> from qiskit.circuit.classical import expr, types
        >>> value = expr.value(5, types.Uint(32))
        >>> expr.cast(value, types.Uint(8))
        Cast(Value(5, types.Uint(32)), types.Uint(8), implicit=False)
zcannot cast 'z' to 'rH   )r   r%   r*   r$   NONErM   r!   )operandr*   s     r0   r   r      sI     7mGt$5-ytfA>??r2   c               L   [        U 5      n U R                  R                  [        R                  [        R
                  4;  a4  [        S[        R                  R                   SU R                   S35      e[        [        R                  R                  X R                  5      $ )a  Create a bitwise 'not' expression node from the given value, resolving any implicit casts and
lifting the value into a :class:`Value` node if required.

Examples:
    Bitwise negation of a :class:`.ClassicalRegister`::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.bit_not(ClassicalRegister(3, "c"))
        Unary(Unary.Op.BIT_NOT, Var(ClassicalRegister(3, 'c'), Uint(3)), Uint(3))
cannot apply '' to type 'rH   )
r   r*   r/   r&   r9   r<   rM   r   r:   BIT_NOT)rS   s    r0   r   r      sq     7mG||UZZ 88.)9)9(:+gll^STUVV!!7LL99r2   c                   [        U 5      n [        U [        R                  " 5       5      nUc4  [	        S[
        R                  R                   SU R                   S35      e[        [
        R                  R                  XR                  5      $ )a  Create a logical 'not' expression node from the given value, resolving any implicit casts and
lifting the value into a :class:`Value` node if required.

Examples:
    Logical negation of a :class:`.ClassicalRegister`::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.logic_not(ClassicalRegister(3, "c"))
        Unary(Unary.Op.LOGIC_NOT, Cast(Var(ClassicalRegister(3, 'c'), Uint(3)), Bool(), implicit=True), Bool())
rU   rV   rH   )	r   r1   r&   r9   rM   r   r:   r;   r*   )rS   coerced_operands     r0   r   r      sl      7mG&w

=O.););(<K~UVWXX##_6J6JKKr2   c                   [        U [        5      =(       a    [        U [        5      (       + n[        U[        5      =(       a    [        U[        5      (       + nU(       d   U(       d  [        U 5      n [        U5      nX4$ U(       d  [        U5      nUR                  R
                  [        R                  L aR  U R                  5       UR                  R                  :  a  [        SU  SU S35      e[        XR                  5      n X4$ [        U 5      n  X4$ U(       d  [        U 5      n U R                  R
                  [        R                  L aR  UR                  5       U R                  R                  :  a  [        SU SU  S35      e[        XR                  5      nX4$ [        U5      n X4$ [        R                  " [        U R                  5       UR                  5       S5      5      n[        X5      n [        X5      nX4$ )zLift two binary operands simultaneously, inferring the widths of integer literals in either
position to match the other operand.zinteger literal 'z#' is wider than the other operand 'rH   r   )r8   rJ   boolr   r*   r/   r&   r<   r>   r6   rM   r   max)rC   rD   left_int	right_intuints        r0   _lift_binary_operandsr`      s    $$CZd-C)CH5#&Fz%/F+FI	DzU4 ;3 U::??ejj( 5::#3#33'v-PQVPWWXY  zz*D$ ;! :D  ; Dz99>>UZZ'!DIIOO3'w.QRVQWWXY  %+E ; KE ; zz#doo/1A1A1CQGHT e";r2   c           	        [        X5      u  pUR                  R                  UR                  R                  s=L a  [        R                  L a  O  O[        R                  " 5       nOUR                  R                  [        R
                  L a  UR                  R                  [        R
                  L aa  UR                  UR                  :w  a:  [        SUR                  R                   SUR                  R                   S35      eUR                  nO)[        SU  SUR                   SUR                   S35      e[        XX#5      $ )Nz[binary bitwise operations are defined between unsigned integers of the same width, but got z and .invalid types for '': '' and 'rH   )	r`   r*   r/   r&   r9   r<   rM   r6   r    oprC   rD   r*   s       r0   _binary_bitwiserh      s    '4KDyy~~6EJJ6zz|	5::	%%**//UZZ*G99

" IIOO,E%**2B2B1C1F  yy-bTdii[

|STUVV"E((r2   c               J    [        [        R                  R                  X5      $ )a  Create a bitwise 'and' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Bitwise 'and' of a classical register and an integer literal::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.bit_and(ClassicalRegister(3, "c"), 0b111)
        Binary(Binary.Op.BIT_AND, Var(ClassicalRegister(3, 'c'), Uint(3)), Value(7, Uint(3)), Uint(3))
    )rh   r    r:   BIT_ANDrC   rD   s     r0   r   r           699,,d::r2   c               J    [        [        R                  R                  X5      $ )a  Create a bitwise 'or' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Bitwise 'or' of a classical register and an integer literal::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.bit_or(ClassicalRegister(3, "c"), 0b101)
        Binary(Binary.Op.BIT_OR, Var(ClassicalRegister(3, 'c'), Uint(3)), Value(5, Uint(3)), Uint(3))
)rh   r    r:   BIT_ORrk   s     r0   r	   r	     s      699++T99r2   c               J    [        [        R                  R                  X5      $ )a
  Create a bitwise 'exclusive or' expression node from the given value, resolving any implicit
casts and lifting the values into :class:`Value` nodes if required.

Examples:
    Bitwise 'exclusive or' of a classical register and an integer literal::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.bit_xor(ClassicalRegister(3, "c"), 0b101)
        Binary(Binary.Op.BIT_XOR, Var(ClassicalRegister(3, 'c'), Uint(3)), Value(5, Uint(3)), Uint(3))
)rh   r    r:   BIT_XORrk   s     r0   r
   r
   *  rl   r2   c           	         [         R                  " 5       n[        U5      n[        U5      n[        X5      n[        X#5      nUb  Uc)  [	        SU  SUR
                   SUR
                   S35      e[        XXS5      $ Nrc   rd   re   rH   )r&   r9   r   r1   rM   r*   r    )rg   rC   rD   rB   coerced_leftcoerced_rights         r0   _binary_logicalru   =  su    JJLE:DKE#D0L$U2M}4-bTdii[

|STUVV"M99r2   c               J    [        [        R                  R                  X5      $ )a  Create a logical 'and' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Logical 'and' of two classical bits::

        >>> from qiskit.circuit import Clbit
        >>> from qiskit.circuit.classical import expr
        >>> expr.logical_and(Clbit(), Clbit())
        Binary(Binary.Op.LOGIC_AND, Var(<clbit 0>, Bool()), Var(<clbit 1>, Bool()), Bool())
)ru   r    r:   	LOGIC_ANDrk   s     r0   r   r   H  s     699..<<r2   c               J    [        [        R                  R                  X5      $ )a  Create a logical 'or' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Logical 'or' of two classical bits

        >>> from qiskit.circuit import Clbit
        >>> from qiskit.circuit.classical import expr
        >>> expr.logical_and(Clbit(), Clbit())
        Binary(Binary.Op.LOGIC_OR, Var(<clbit 0>, Bool()), Var(<clbit 1>, Bool()), Bool())
)ru   r    r:   LOGIC_ORrk   s     r0   r   r   W  s     699--t;;r2   c           	        [        X5      u  pUR                  R                  UR                  R                  La)  [        SU  SUR                   SUR                   S35      e[        R
                  " UR                  UR                  5      n[        U [        X5      [        X#5      [        R                  " 5       5      $ rr   )	r`   r*   r/   rM   r&   r   r    r1   r9   rf   s       r0   _equal_liker{   f  s    '4KDyy~~UZZ__,-bTdii[

|STUVV==EJJ/D "&t24DU4QSXS]S]S_``r2   c               J    [        [        R                  R                  X5      $ )a  Create an 'equal' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Equality between a classical register and an integer::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.equal(ClassicalRegister(3, "c"), 7)
        Binary(Binary.Op.EQUAL, Var(ClassicalRegister(3, "c"), Uint(3)), Value(7, Uint(3)), Uint(3))
)r{   r    r:   r+   rk   s     r0   r   r   p  s     vyy44r2   c               J    [        [        R                  R                  X5      $ )a  Create a 'not equal' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Inequality between a classical register and an integer::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.not_equal(ClassicalRegister(3, "c"), 7)
        Binary(Binary.Op.NOT_EQUAL, Var(ClassicalRegister(3, "c"), Uint(3)), Value(7, Uint(3)), Uint(3))
)r{   r    r:   	NOT_EQUALrk   s     r0   r   r     s     vyy**D88r2   c           	        [        X5      u  pUR                  R                  UR                  R                  Ld'  UR                  R                  [        R                  L a)  [        SU  SUR                   SUR                   S35      e[        R                  " UR                  UR                  5      n[        U [        X5      [        X#5      [        R                  " 5       5      $ rr   )	r`   r*   r/   r&   r9   rM   r   r    r1   rf   s       r0   _binary_relationr     s    '4KDyy~~UZZ__,		%**0L-bTdii[

|STUVV==EJJ/D "&t24DU4QSXS]S]S_``r2   c               J    [        [        R                  R                  X5      $ )a  Create a 'less than' expression node from the given value, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Query if a classical register is less than an integer::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.less(ClassicalRegister(3, "c"), 5)
        Binary(Binary.Op.LESS, Var(ClassicalRegister(3, "c"), Uint(3)), Value(5, Uint(3)), Uint(3))
)r   r    r:   LESSrk   s     r0   r   r     s     FIINND88r2   c               J    [        [        R                  R                  X5      $ )a.  Create a 'less than or equal to' expression node from the given value, resolving any implicit
casts and lifting the values into :class:`Value` nodes if required.

Examples:
    Query if a classical register is less than or equal to another::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.less(ClassicalRegister(3, "a"), ClassicalRegister(3, "b"))
        Binary(Binary.Op.LESS_EQUAL, Var(ClassicalRegister(3, "a"), Uint(3)), Var(ClassicalRegister(3, "b"), Uint(3)), Uint(3))
)r   r    r:   
LESS_EQUALrk   s     r0   r   r     s     FII00$>>r2   c               J    [        [        R                  R                  X5      $ )a  Create a 'greater than' expression node from the given value, resolving any implicit casts
and lifting the values into :class:`Value` nodes if required.

Examples:
    Query if a classical register is greater than an integer::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.less(ClassicalRegister(3, "c"), 5)
        Binary(Binary.Op.GREATER, Var(ClassicalRegister(3, "c"), Uint(3)), Value(5, Uint(3)), Uint(3))
)r   r    r:   GREATERrk   s     r0   r   r     s     FII--t;;r2   c               J    [        [        R                  R                  X5      $ )a7  Create a 'greater than or equal to' expression node from the given value, resolving any
implicit casts and lifting the values into :class:`Value` nodes if required.

Examples:
    Query if a classical register is greater than or equal to another::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.less(ClassicalRegister(3, "a"), ClassicalRegister(3, "b"))
        Binary(Binary.Op.GREATER_EQUAL, Var(ClassicalRegister(3, "a"), Uint(3)), Var(ClassicalRegister(3, "b"), Uint(3)), Uint(3))
)r   r    r:   GREATER_EQUALrk   s     r0   r   r     s     FII33TAAr2   c           	     4   Ub,  UR                   [        R                  La  [        SU S35      e[	        U[
        5      (       a0  Ub,  [        X5      nUc  [        SU SUR                   S35      eUnO[        X5      n[        U5      nUR                  R                   [        R                  :w  d(  UR                  R                   [        R                  :w  a)  [        SU  SUR                   SUR                   S35      e[        XX!R                  5      $ )Nztype 'z&' is not a valid bitshift operand typez' cannot losslessly represent 'rH   rc   rd   re   )
r/   r&   r<   rM   r8   r   r1   r*   r   r    )rg   rC   rD   r*   rs   s        r0   _shift_liker     s     DIIUZZ7&&LMNN$+D7L#&.Mdii[XY Z[[DDKEyy~~#uzz%**'D-bTdii[

|STUVV"E99--r2   c               L    [        [        R                  R                  XU5      $ )a  Create a 'bitshift left' expression node from the given two values, resolving any implicit
casts and lifting the values into :class:`Value` nodes if required.

If ``type`` is given, the ``left`` operand will be coerced to it (if possible).

Examples:
    Shift the value of a standalone variable left by some amount::

        >>> from qiskit.circuit.classical import expr, types
        >>> a = expr.Var.new("a", types.Uint(8))
        >>> expr.shift_left(a, 4)
        Binary(Binary.Op.SHIFT_LEFT, Var(<UUID>, Uint(8), name='a'), Value(4, Uint(3)), Uint(8))

    Shift an integer literal by a variable amount, coercing the type of the literal::

        >>> expr.shift_left(3, a, types.Uint(16))
        Binary(Binary.Op.SHIFT_LEFT, Value(3, Uint(16)), Var(<UUID>, Uint(8), name='a'), Uint(16))
)r   r    r:   
SHIFT_LEFTrC   rD   r*   s      r0   r   r     s    2 vyy++T$??r2   c               L    [        [        R                  R                  XU5      $ )aQ  Create a 'bitshift right' expression node from the given values, resolving any implicit casts
and lifting the values into :class:`Value` nodes if required.

If ``type`` is given, the ``left`` operand will be coerced to it (if possible).

Examples:
    Shift the value of a classical register right by some amount::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.shift_right(ClassicalRegister(8, "a"), 4)
        Binary(Binary.Op.SHIFT_RIGHT, Var(ClassicalRegister(8, "a"), Uint(8)), Value(4, Uint(3)), Uint(8))
)r   r    r:   SHIFT_RIGHTr   s      r0   r   r     s    " vyy,,d4@@r2   c               R   [        U 5      [        U5      pU R                  R                  [        R                  Ld'  UR                  R                  [        R                  La&  [        SU R                   SUR                   S35      e[        X[        R                  " 5       5      $ )a
  Index into the ``target`` with the given integer ``index``, lifting the values into
:class:`Value` nodes if required.

This can be used as the target of a :class:`.Store`, if the ``target`` is itself an lvalue.

Examples:
    Index into a classical register with a literal::

        >>> from qiskit.circuit import ClassicalRegister
        >>> from qiskit.circuit.classical import expr
        >>> expr.index(ClassicalRegister(8, "a"), 3)
        Index(Var(ClassicalRegister(8, "a"), Uint(8)), Value(3, Uint(2)), Bool())
zinvalid types for indexing: 're   rH   )r   r*   r/   r&   r<   rM   r"   r9   )r@   r   s     r0   r   r   )  ss     L$u+E{{uzz)UZZ__EJJ-N7}GEJJ<WXYZZ

--r2   c           	        [        X5      u  pUR                  R                  UR                  R                  L a  UR                  R                  [        R                  [        R
                  [        R                  1;   aK  [        R                  " UR                  UR                  5      n[        U [        X5      [        X#5      U5      $ [        SU  SUR                   SUR                   S35      err   )r`   r*   r/   r&   r<   rL   rG   r   r    r1   rM   rf   s       r0   _binary_sumr   =  s    '4KDyy~~(TYY^^

@ .
 }}TYY

3T(U)	
 	
 )"T$))GEJJ<qQ
RRr2   c               J    [        [        R                  R                  X5      $ )a  Create an addition expression node from the given values, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Addition of two floating point numbers::

        >>> from qiskit.circuit.classical import expr
        >>> expr.add(5.0, 2.0)
        Binary(Binary.Op.ADD, Value(5.0, Float()), Value(2.0, Float()), Float())

    Addition of two durations::

        >>> from qiskit.circuit import Duration
        >>> from qiskit.circuit.classical import expr
        >>> expr.add(Duration.dt(1000), Duration.dt(1000))
        Binary(Binary.Op.ADD, Value(Duration.dt(1000), Duration()), Value(Duration.dt(1000), Duration()), Duration())
    )r   r    r:   ADDrk   s     r0   r   r   N      4 vyy}}d22r2   c               J    [        [        R                  R                  X5      $ )a  Create a subtraction expression node from the given values, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

Examples:
    Subtraction of two floating point numbers::

        >>> from qiskit.circuit.classical import expr
        >>> expr.sub(5.0, 2.0)
        Binary(Binary.Op.SUB, Value(5.0, Float()), Value(2.0, Float()), Float())

    Subtraction of two durations::

        >>> from qiskit.circuit import Duration
        >>> from qiskit.circuit.classical import expr
        >>> expr.add(Duration.dt(1000), Duration.dt(1000))
        Binary(Binary.Op.SUB, Value(Duration.dt(1000), Duration()), Value(Duration.dt(1000), Duration()), Duration())
    )r   r    r:   SUBrk   s     r0   r   r   k  r   r2   c           	        [        X5      u  pU R                  R                  UR                  R                  s=L a  [        R                  L a  O  O[        S5      eU R                  R                  UR                  R                  L a{  U R                  R                  [        R                  [        R                  1;   aC  [        R                  " U R                  UR                  5      n[        X5      n [        X5      nGOU R                  R                  [        R                  L aE  UR                  R                  [        R                  [        R                  1;   a  U R                  nOUR                  R                  [        R                  L aE  U R                  R                  [        R                  [        R                  1;   a  UR                  nOA[        S[        R                  R                   SU R                   SUR                   S35      e[        [        R                  R                  U UU5      $ )a%  Create a multiplication expression node from the given values, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

This can be used to multiply numeric operands of the same type kind, or to multiply a duration
operand by a numeric operand.

Examples:
    Multiplication of two floating point numbers::

        >>> from qiskit.circuit.classical import expr
        >>> expr.mul(5.0, 2.0)
        Binary(Binary.Op.MUL, Value(5.0, Float()), Value(2.0, Float()), Float())

    Multiplication of a duration by a float::

        >>> from qiskit.circuit import Duration
        >>> from qiskit.circuit.classical import expr
        >>> expr.mul(Duration.dt(1000), 0.5)
        Binary(Binary.Op.MUL, Value(Duration.dt(1000), Duration()), Value(0.5, Float()), Duration())
zcannot multiply two durationsrc   rd   re   rH   )r`   r*   r/   r&   rG   rM   r<   rL   r   r1   r    r:   MULr   s      r0   r   r     sf   : (4KDyy~~:ENN:788yy~~(TYY^^

EKK?X-X}}TYY

3+ -	5>>	)ejjoo%**ekkAZ.Zyy	ENN	*tyy~~%**ekkAZ/Zzz-fiimm_D7SXS]S]R^^_`aa			 r2   c           	     8   [        X5      u  pU R                  R                  UR                  R                  L Ga  U R                  R                  [        R                  [        R
                  [        R                  1;   a  U R                  R                  [        R                  L a  [        R                  " 5       nGO5[        R                  " U R                  UR                  5      [        R                  R                  LaA  [        R                  " U R                  UR                  5      n[        X5      n [        X5      nOU R                  R                  [        R                  L aE  UR                  R                  [        R
                  [        R                  1;   a  U R                  nOA[        S[        R                  R                   SU R                   SUR                   S35      e[        [        R                  R                  U UW5      $ )a  Create a division expression node from the given values, resolving any implicit casts and
lifting the values into :class:`Value` nodes if required.

This can be used to divide numeric operands of the same type kind, to divide a
:class:`~.types.Duration` operand by a numeric operand, or to divide two
:class:`~.types.Duration` operands which yields an expression of type
:class:`~.types.Float`.

Examples:
    Division of two floating point numbers::

        >>> from qiskit.circuit.classical import expr
        >>> expr.div(5.0, 2.0)
        Binary(Binary.Op.DIV, Value(5.0, Float()), Value(2.0, Float()), Float())

    Division of two durations::

        >>> from qiskit.circuit import Duration
        >>> from qiskit.circuit.classical import expr
        >>> expr.div(Duration.dt(10000), Duration.dt(1000))
        Binary(Binary.Op.DIV, Value(Duration.dt(10000), Duration()), Value(Duration.dt(1000), Duration()), Float())


    Division of a duration by a float::

        >>> from qiskit.circuit import Duration
        >>> from qiskit.circuit.classical import expr
        >>> expr.div(Duration.dt(10000), 12.0)
        Binary(Binary.Op.DIV, Value(Duration.dt(10000), Duration()), Value(12.0, types.Float()), Duration())
rc   rd   re   rH   )r`   r*   r/   r&   rG   r<   rL   orderOrderingrR   r   r1   rM   r    r:   DIVr   s      r0   r   r     sV   V (4KDyy~~(TYY^^

@ .
 99>>U^^+;;=D[[EJJ/u~~7J7JJ==EJJ7D#D/D$U1E	5>>	)ejjoo%**ekkAZ.Zyy-fiimm_D7SXS]S]R^^_`aa			 r2   )r.   r   r*   
types.TypereturnzExpr | None)r?   zCtuple[qiskit.circuit.Clbit | qiskit.circuit.ClassicalRegister, int]r   r   )N)r*   types.Type | NonerA   
typing.Anyr   r   )rS   r   r*   r   r   r   )rS   r   r   r   )rC   r   rD   r   r   ztuple[Expr, Expr])rg   	Binary.OprC   r   rD   r   r   r   )rC   r   rD   r   r   r   )
rg   r   rC   r   rD   r   r*   r   r   r   )r*   r   rC   r   rD   r   r   r   )r@   r   r   r   r   r   )2__doc__
__future__r   __all__typingr.   r   r   r   r   r    r!   r"   r&   r$   r%    TYPE_CHECKINGqiskitr1   r   r   r   r   r   r`   rh   r   r	   r
   ru   r   r   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r2   r0   <module>r      s  
 #4  > > > ' 	
>R>	>";|$:$L.!H)";&:&;&:=<a5$9$a9$?$<$B$..#.,6.>O.	.&@8A(.(S"3:3:0fAr2   