§
    ¹³Ùg¯3  ã                  óî  — d Z ddlmZ g d¢ZddlZddlZddlZddlZddlm	Z	 ej
        rddlZ ej        dd¬	¦  «        Z G d
„ dej        ¦  «        Zej         G d„ de¦  «        ¦   «         Zej         G d„ de¦  «        ¦   «         Zej         G d„ de¦  «        ¦   «         Zej         G d„ de¦  «        ¦   «         Zej         G d„ de¦  «        ¦   «         Zej         G d„ de¦  «        ¦   «         ZdS )zExpression-tree nodes.é    )Úannotations)ÚExprÚVarÚValueÚCastÚUnaryÚBinaryNé   )ÚtypesÚ_T_coT)Ú	covariantc                  óJ   — e Zd ZU dZdZded<   ej        d„ ¦   «         Zdd
„Z	dS )r   a¼  Root base class of all nodes in the expression tree.  The base case should never be
    instantiated directly.

    This must not be subclassed by users; subclasses form the internal data of the representation of
    expressions, and it does not make sense to add more outside of Qiskit library code.

    All subclasses are responsible for setting their ``type`` attribute in their ``__init__``, and
    should not call the parent initializer.)Útypeú
types.Typer   c                ó   — d S ©N© ©Úselfs    úX/granary/edev/quantum/lib/python3.11/site-packages/qiskit/circuit/classical/expr/expr.pyÚ__init__zExpr.__init__?   s   € àˆó    Úvisitorú0qiskit.circuit.classical.expr.ExprVisitor[_T_co]Úreturnr   c               ó,   — |                      | ¦  «        S )aè  Call the relevant ``visit_*`` method on the given :class:`ExprVisitor`.  The usual entry
        point for a simple visitor is to construct it, and then call :meth:`accept` on the root
        object to be visited.  For example::

            expr = ...
            visitor = MyVisitor()
            visitor.accept(expr)

        Subclasses of :class:`Expr` should override this to call the correct virtual method on the
        visitor.  This implements double dispatch with the visitor.)Úvisit_generic©r   r   s     r   ÚacceptzExpr.acceptC   s   € ð ×$Ò$ TÑ*Ô*Ð*r   N)r   r   r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Ú__annotations__ÚabcÚabstractmethodr   r   r   r   r   r   r   0   sf   € € € € € € ð/ð /ð €IàÐÐÑð 	Ôðð ñ Ôðð+ð +ð +ð +ð +ð +r   r   c                  ó2   — e Zd ZdZdZddd
„Zd„ Zd„ Zd„ ZdS )r   z`A cast from one type to another, implied by the use of an expression in a different
    context.)ÚoperandÚimplicitFr)   r   r   r   r*   Úboolc                ó0   — || _         || _        || _        d S r   )r   r)   r*   )r   r)   r   r*   s       r   r   zCast.__init__Z   s   € ØˆŒ	ØˆŒØ ˆŒˆˆr   c               ó,   — |                      | ¦  «        S r   )Ú
visit_castr   s     r   r   zCast.accept_   s   € Ø×!Ò! $Ñ'Ô'Ð'r   c                óŒ   — t          |t          ¦  «        o/| j        |j        k    o| j        |j        k    o| j        |j        k    S r   )Ú
isinstancer   r   r)   r*   ©r   Úothers     r   Ú__eq__zCast.__eq__b   sI   € å�u�dÑ#Ô#ð 0Ø”	˜UœZÒ'ð0à” ¤Ò-ð0ð ” ¤Ò/ð		
r   c                ó8   — d| j         › d| j        › d| j        › d�S )NzCast(ú, z, implicit=ú))r)   r   r*   r   s    r   Ú__repr__zCast.__repr__j   s)   € ØM�t”|ÐMÐM t¤yÐMÐM¸T¼]ÐMÐMÐMÐMr   N)F)r)   r   r   r   r*   r+   ©	r    r!   r"   r#   r$   r   r   r3   r7   r   r   r   r   r   S   sp   € € € € € ðð ð (€Ið!ð !ð !ð !ð !ð
(ð (ð (ð
ð 
ð 
ðNð Nð Nð Nð Nr   r   c                  ó²   ‡ — e Zd ZU dZdZded<   	 ded<   	 ddœdˆ fd„Zedd„¦   «         Ze	dd„¦   «         Z
d„ Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ fd„Zd„ Zd„ Zˆ xZS )r   aö  A classical variable.

    These variables take two forms: a new-style variable that owns its storage location and has an
    associated name; and an old-style variable that wraps a :class:`.Clbit` or
    :class:`.ClassicalRegister` instance that is owned by some containing circuit.  In general,
    construction of variables for use in programs should use :meth:`Var.new` or
    :meth:`.QuantumCircuit.add_var`.

    Variables are immutable after construction, so they can be used as dictionary keys.)ÚvarÚnameúCqiskit.circuit.Clbit | qiskit.circuit.ClassicalRegister | uuid.UUIDr:   ú
str | Noner;   N©r;   r   r   c               óÔ   •— t          ¦   «                              d|¦  «         t          ¦   «                              d|¦  «         t          ¦   «                              d|¦  «         d S ©Nr   r:   r;   ©ÚsuperÚ__setattr__)r   r:   r   r;   Ú	__class__s       €r   r   zVar.__init__ˆ   sY   ø€ õ 	‰Œ×Ò˜F DÑ)Ô)Ð)Ý‰Œ×Ò˜E 3Ñ'Ô'Ð'Ý‰Œ×Ò˜F DÑ)Ô)Ð)Ð)Ð)r   Ústrr   útyping.Selfc                ó@   —  | t          j        ¦   «         ||¬¦  «        S )z@Generate a new named variable that owns its own backing storage.r>   )ÚuuidÚuuid4)Úclsr;   r   s      r   ÚnewzVar.new“   s!   € ð ˆs•4”:‘<”< ¨DÐ1Ñ1Ô1Ð1r   r+   c                ó@   — t          | j        t          j        ¦  «        S )zªWhether this :class:`Var` is a standalone variable that owns its storage location.  If
        false, this is a wrapper :class:`Var` around a pre-existing circuit object.)r0   r:   rH   ÚUUIDr   s    r   Ú
standalonezVar.standalone˜   s   € õ ˜$œ(¥D¤IÑ.Ô.Ð.r   c               ó,   — |                      | ¦  «        S r   )Ú	visit_varr   s     r   r   z
Var.acceptž   s   € Ø× Ò  Ñ&Ô&Ð&r   c                ón   — t          | |¦  «        rt          d|› d�¦  «        ‚t          d|› d�¦  «        ‚)Nz'Var' object attribute 'z' is read-onlyz'Var' object has no attribute 'ú')ÚhasattrÚAttributeError)r   ÚkeyÚvalues      r   rC   zVar.__setattr__¡   sI   € Ý�4˜ÑÔð 	QÝ Ð!O¸CÐ!OÐ!OÐ!OÑPÔPÐPÝÐE¸sÐEÐEÐEÑFÔFÐFr   c                óD   — t          | j        | j        | j        f¦  «        S r   )Úhashr   r:   r;   r   s    r   Ú__hash__zVar.__hash__¦   s   € Ý�T”Y ¤¨$¬)Ð4Ñ5Ô5Ð5r   c                óŒ   — t          |t          ¦  «        o/| j        |j        k    o| j        |j        k    o| j        |j        k    S r   )r0   r   r   r:   r;   r1   s     r   r3   z
Var.__eq__©   sI   € å�u�cÑ"Ô"ð (Ø”	˜UœZÒ'ð(à”˜EœIÒ%ð(ð ”	˜UœZÒ'ð		
r   c                ól   — | j         €d| j        › d| j        › d�S d| j        › d| j        › d| j         › d�S )NzVar(r5   r6   z, name='z'))r;   r:   r   r   s    r   r7   zVar.__repr__±   sN   € ØŒ9ÐØ2˜$œ(Ð2Ð2 d¤iÐ2Ð2Ð2Ð2ØB�d”hÐBÐB $¤)ÐBÐB°T´YÐBÐBÐBÐBr   c                ó*   — | j         | j        | j        fS r   )r:   r   r;   r   s    r   Ú__getstate__zVar.__getstate__¶   s   € Ø”˜$œ) T¤YÐ/Ð/r   c                óà   •— |\  }}}t          ¦   «                              d|¦  «         t          ¦   «                              d|¦  «         t          ¦   «                              d|¦  «         d S r@   rA   )r   Ústater:   r   r;   rD   s        €r   Ú__setstate__zVar.__setstate__¹   sb   ø€ Ø‰ˆˆT�4Ý‰Œ×Ò˜F DÑ)Ô)Ð)Ý‰Œ×Ò˜E 3Ñ'Ô'Ð'Ý‰Œ×Ò˜F DÑ)Ô)Ð)Ð)Ð)r   c                ó   — | S r   r   r   s    r   Ú__copy__zVar.__copy__¿   ó   € àˆr   c                ó   — | S r   r   )r   Úmemos     r   Ú__deepcopy__zVar.__deepcopy__Ã   rc   r   )r:   r<   r   r   r;   r=   )r;   rE   r   r   r   rF   )r   r+   )r    r!   r"   r#   r$   r%   r   ÚclassmethodrK   ÚpropertyrN   r   rC   rY   r3   r7   r]   r`   rb   rf   Ú__classcell__©rD   s   @r   r   r   n   s\  ø€ € € € € € ð[ð [ð  €IàLÐLÐLÑLð ð ÐÐÑðð  ð	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð ð2ð 2ð 2ñ „[ð2ð ð/ð /ð /ñ „Xð/ð
'ð 'ð 'ðGð Gð Gð
6ð 6ð 6ð
ð 
ð 
ðCð Cð Cð
0ð 0ð 0ð*ð *ð *ð *ð *ðð ð ðð ð ð ð ð ð r   r   c                  ó0   — e Zd ZdZdZdd„Zd„ Zd	„ Zd
„ ZdS )r   zA single scalar value.)rV   rV   ú
typing.Anyr   r   c                ó"   — || _         || _        d S r   )r   rV   )r   rV   r   s      r   r   zValue.__init__Î   s   € ØˆŒ	ØˆŒ
ˆ
ˆ
r   c               ó,   — |                      | ¦  «        S r   )Úvisit_valuer   s     r   r   zValue.acceptÒ   ó   € Ø×"Ò" 4Ñ(Ô(Ð(r   c                ól   — t          |t          ¦  «        o| j        |j        k    o| j        |j        k    S r   )r0   r   r   rV   r1   s     r   r3   zValue.__eq__Õ   s0   € Ý˜%¥Ñ'Ô'Ða¨D¬I¸¼Ò,CÐaÈÌ
ÐV[ÔVaÒHaÐar   c                ó(   — d| j         › d| j        › d�S )NzValue(r5   r6   )rV   r   r   s    r   r7   zValue.__repr__Ø   s   € Ø2˜œ
Ð2Ð2 d¤iÐ2Ð2Ð2Ð2r   N)rV   rl   r   r   r8   r   r   r   r   r   È   sc   € € € € € à Ð à€Iðð ð ð ð)ð )ð )ðbð bð bð3ð 3ð 3ð 3ð 3r   r   c                  óV   — e Zd ZdZdZ G d„ dej        ¦  «        Zdd„Zd„ Z	d„ Z
d„ ZdS )r   zÂA unary expression.

    Args:
        op: The opcode describing which operation is being done.
        operand: The operand of the operation.
        type: The resolved type of the result.
    )Úopr)   c                  ó8   ‡ — e Zd ZdZdZ	 dZ	 ˆ fd„Zˆ fd„Zˆ xZS )úUnary.OpaV  Enumeration of the opcodes for unary operations.

        The bitwise negation :data:`BIT_NOT` takes a single bit or an unsigned integer of known
        width, and returns a value of the same type.

        The logical negation :data:`LOGIC_NOT` takes an input that is implicitly coerced to a
        Boolean, and returns a Boolean.
        é   r
   c                óJ   •— dt          ¦   «                              ¦   «         › �S ©NzUnary.©rB   Ú__str__©r   rD   s    €r   r{   zUnary.Op.__str__ú   s   ø€ Ø/�E™GœGŸOšOÑ-Ô-Ð/Ð/Ð/r   c                óJ   •— dt          ¦   «                              ¦   «         › �S ry   ©rB   r7   r|   s    €r   r7   zUnary.Op.__repr__ý   s!   ø€ Ø0�E™GœG×,Ò,Ñ.Ô.Ð0Ð0Ð0r   )	r    r!   r"   r#   ÚBIT_NOTÚ	LOGIC_NOTr{   r7   ri   rj   s   @r   ÚOprv   è   sm   ø€ € € € € ð	ð 	ð ˆØ-Øˆ	Ø-ð	0ð 	0ð 	0ð 	0ð 	0ð	1ð 	1ð 	1ð 	1ð 	1ð 	1ð 	1ð 	1ð 	1r   r�   rt   rv   r)   r   r   r   c                ó0   — || _         || _        || _        d S r   ©rt   r)   r   )r   rt   r)   r   s       r   r   zUnary.__init__   s   € ØˆŒØˆŒØˆŒ	ˆ	ˆ	r   c               ó,   — |                      | ¦  «        S r   )Úvisit_unaryr   s     r   r   zUnary.accept  rp   r   c                óˆ   — t          |t          ¦  «        o-| j        |j        k    o| j        |j        u o| j        |j        k    S r   )r0   r   r   rt   r)   r1   s     r   r3   zUnary.__eq__  sI   € å�u�eÑ$Ô$ð .Ø”	˜UœZÒ'ð.à”˜5œ8Ð#ð.ð ” ¤Ò-ð		
r   c                ó8   — d| j         › d| j        › d| j        › d�S )NzUnary(r5   r6   rƒ   r   s    r   r7   zUnary.__repr__  s)   € Ø?˜œÐ?Ð? 4¤<Ð?Ð?°4´9Ð?Ð?Ð?Ð?r   N)rt   rv   r)   r   r   r   ©r    r!   r"   r#   r$   ÚenumÚEnumr�   r   r   r3   r7   r   r   r   r   r   Ü   s—   € € € € € ðð ð "€Ið1ð 1ð 1ð 1ð 1ˆTŒYñ 1ô 1ð 1ð0ð ð ð ð
)ð )ð )ð
ð 
ð 
ð@ð @ð @ð @ð @r   r   c                  óV   — e Zd ZdZdZ G d„ dej        ¦  «        Zdd„Zd„ Z	d„ Z
d„ ZdS )r	   zàA binary expression.

    Args:
        op: The opcode describing which operation is being done.
        left: The left-hand operand.
        right: The right-hand operand.
        type: The resolved type of the result.
    )rt   ÚleftÚrightc                  óz   ‡ — e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Z	 d
Z	 dZ	 dZ	 dZ	 dZ	 ˆ fd„Zˆ fd„Zˆ xZS )ú	Binary.Opam  Enumeration of the opcodes for binary operations.

        The bitwise operations :data:`BIT_AND`, :data:`BIT_OR` and :data:`BIT_XOR` apply to two
        operands of the same type, which must be a single bit or an unsigned integer of fixed width.
        The resultant type is the same as the two input types.

        The logical operations :data:`LOGIC_AND` and :data:`LOGIC_OR` first implicitly coerce their
        arguments to Booleans, and then apply the logical operation.  The resultant type is always
        Boolean.

        The binary mathematical relations :data:`EQUAL`, :data:`NOT_EQUAL`, :data:`LESS`,
        :data:`LESS_EQUAL`, :data:`GREATER` and :data:`GREATER_EQUAL` take unsigned integers
        (with an implicit cast to make them the same width), and return a Boolean.

        The bitshift operations :data:`SHIFT_LEFT` and :data:`SHIFT_RIGHT` can take bit-like
        container types (e.g. unsigned integers) as the left operand, and any integer type as the
        right-hand operand.  In all cases, the output bit width is the same as the input, and zeros
        fill in the "exposed" spaces.
        rw   r
   é   é   é   é   é   é   é	   é
   é   é   é   c                óJ   •— dt          ¦   «                              ¦   «         › �S ©NzBinary.rz   r|   s    €r   r{   zBinary.Op.__str__T  s   ø€ Ø0�U™WœWŸ_š_Ñ.Ô.Ð0Ð0Ð0r   c                óJ   •— dt          ¦   «                              ¦   «         › �S rœ   r~   r|   s    €r   r7   zBinary.Op.__repr__W  s!   ø€ Ø1�U™WœW×-Ò-Ñ/Ô/Ð1Ð1Ð1r   )r    r!   r"   r#   ÚBIT_ANDÚBIT_ORÚBIT_XORÚ	LOGIC_ANDÚLOGIC_ORÚEQUALÚ	NOT_EQUALÚLESSÚ
LESS_EQUALÚGREATERÚGREATER_EQUALÚ
SHIFT_LEFTÚSHIFT_RIGHTr{   r7   ri   rj   s   @r   r�   r�   !  sÅ   ø€ € € € € ð	ð 	ð. ˆØ+ØˆØ*ØˆØ4Øˆ	Ø,ØˆØ+ØˆØ/Øˆ	Ø1ØˆØ/Øˆ
Ø;ØˆØ2ØˆØ?Øˆ
ØAØˆØBð	1ð 	1ð 	1ð 	1ð 	1ð	2ð 	2ð 	2ð 	2ð 	2ð 	2ð 	2ð 	2ð 	2r   r�   rt   r�   rŒ   r   r�   r   r   c                ó>   — || _         || _        || _        || _        d S r   ©rt   rŒ   r�   r   )r   rt   rŒ   r�   r   s        r   r   zBinary.__init__Z  s"   € ØˆŒØˆŒ	ØˆŒ
ØˆŒ	ˆ	ˆ	r   c               ó,   — |                      | ¦  «        S r   )Úvisit_binaryr   s     r   r   zBinary.accept`  s   € Ø×#Ò# DÑ)Ô)Ð)r   c                ó¨   — t          |t          ¦  «        o=| j        |j        k    o-| j        |j        u o| j        |j        k    o| j        |j        k    S r   )r0   r	   r   rt   rŒ   r�   r1   s     r   r3   zBinary.__eq__c  s\   € å�u�fÑ%Ô%ð *Ø”	˜UœZÒ'ð*à”˜5œ8Ð#ð*ð ”	˜UœZÒ'ð*ð ”
˜eœkÒ)ð	
r   c           	     óH   — d| j         › d| j        › d| j        › d| j        › d�	S )NzBinary(r5   r6   r¬   r   s    r   r7   zBinary.__repr__l  s3   € ØK˜œÐKÐK D¤IÐKÐK°´ÐKÐK¸t¼yÐKÐKÐKÐKr   N)rt   r�   rŒ   r   r�   r   r   r   rˆ   r   r   r   r	   r	     s˜   € € € € € ðð ð (€Ið72ð 72ð 72ð 72ð 72ˆTŒYñ 72ô 72ð 72ðrð ð ð ð*ð *ð *ð
ð 
ð 
ðLð Lð Lð Lð Lr   r	   c                  ó0   — e Zd ZdZdZdd„Zd	„ Zd
„ Zd„ ZdS )ÚIndexz²An indexing expression.

    Args:
        target: The object being indexed.
        index: The expression doing the indexing.
        type: The resolved type of the result.
    )ÚtargetÚindexr³   r   r´   r   r   c                ó0   — || _         || _        || _        d S r   ©r³   r´   r   )r   r³   r´   r   s       r   r   zIndex.__init__|  s   € ØˆŒØˆŒ
ØˆŒ	ˆ	ˆ	r   c               ó,   — |                      | ¦  «        S r   )Úvisit_indexr   s     r   r   zIndex.accept�  rp   r   c                óŒ   — t          |t          ¦  «        o/| j        |j        k    o| j        |j        k    o| j        |j        k    S r   )r0   r²   r   r³   r´   r1   s     r   r3   zIndex.__eq__„  sI   € å�u�eÑ$Ô$ð *Ø”	˜UœZÒ'ð*à”˜uœ|Ò+ð*ð ”
˜eœkÒ)ð		
r   c                ó8   — d| j         › d| j        › d| j        › d�S )NzIndex(r5   r6   r¶   r   s    r   r7   zIndex.__repr__Œ  s)   € ØA˜œÐAÐA t¤zÐAÐA°T´YÐAÐAÐAÐAr   N)r³   r   r´   r   r   r   r8   r   r   r   r²   r²   p  sk   € € € € € ðð ð $€Iðð ð ð ð
)ð )ð )ð
ð 
ð 
ðBð Bð Bð Bð Br   r²   )r#   Ú
__future__r   Ú__all__r&   r‰   ÚtypingrH   Ú r   ÚTYPE_CHECKINGÚqiskitÚTypeVarr   ÚABCr   Úfinalr   r   r   r   r	   r²   r   r   r   ú<module>rÄ      sR  ðð Ð ð #Ð "Ð "Ð "Ð "Ð "ðð ð €ð €
€
€
Ø €€€Ø €€€Ø €€€à Ð Ð Ð Ð Ð à	Ôð Ø€M€M€Mð 	ˆŒ�w¨$Ð/Ñ/Ô/€ð +ð  +ð  +ð  +ð  +ˆ3Œ7ñ  +ô  +ð  +ðF „ðNð Nð Nð Nð Nˆ4ñ Nô Nñ „ðNð4 „ðVð Vð Vð Vð Vˆ$ñ Vô Vñ „ðVðr „ð3ð 3ð 3ð 3ð 3ˆDñ 3ô 3ñ „ð3ð& „ð4@ð 4@ð 4@ð 4@ð 4@ˆDñ 4@ô 4@ñ „ð4@ðn „ðXLð XLð XLð XLð XLˆTñ XLô XLñ „ðXLðv „ðBð Bð Bð Bð BˆDñ Bô Bñ „ðBð Bð Br   