§
    OŠtjˆ¸  ã                   óî  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ  G d„ d¦  «        Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zd„ Zd„ Z G d„ de	¦  «        Z G d„ d e¦  «        Z G d!„ d"e¦  «        Z G d#„ d$e¦  «        Z  G d%„ d&e¦  «        Z!d'S )(ao  
Computations with modules over polynomial rings.

This module implements various classes that encapsulate groebner basis
computations for modules. Most of them should not be instantiated by hand.
Instead, use the constructing routines on objects you already have.

For example, to construct a free module over ``QQ[x, y]``, call
``QQ[x, y].free_module(rank)`` instead of the ``FreeModule`` constructor.
In fact ``FreeModule`` is an abstract base class that should not be
instantiated, the ``free_module`` method instead returns the implementing class
``FreeModulePolyRing``.

In general, the abstract base classes implement most functionality in terms of
a few non-implemented methods. The concrete base classes supply only these
non-implemented methods. They may also supply new implementations of the
convenience methods, for example if there are faster algorithms available.
é    )Úcopy)Úreduce)ÚIdeal)ÚField)ÚProductOrderÚmonomial_key)ÚDMP)ÚCoercionFailed)Ú_aresame)Úiterablec                   ór   — e Zd ZdZd„ Zd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eZd„ ZdS )ÚModuleaí  
    Abstract base class for modules.

    Do not instantiate - use ring explicit constructors instead:

    >>> from sympy import QQ
    >>> from sympy.abc import x
    >>> QQ.old_poly_ring(x).free_module(2)
    QQ[x]**2

    Attributes:

    - dtype - type of elements
    - ring - containing ring

    Non-implemented methods:

    - submodule
    - quotient_module
    - is_zero
    - is_submodule
    - multiply_ideal

    The method convert likely needs to be changed in subclasses.
    c                 ó   — || _         d S ©N)Úring)Úselfr   s     úV/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/agca/modules.pyÚ__init__zModule.__init__G   s   € ØˆŒ	ˆ	ˆ	ó    Nc                 ó>   — t          || j        ¦  «        st          ‚|S )z“
        Convert ``elem`` into internal representation of this module.

        If ``M`` is not None, it should be a module containing it.
        )Ú
isinstanceÚdtyper
   ©r   ÚelemÚMs      r   ÚconvertzModule.convertJ   s#   € õ ˜$ ¤
Ñ+Ô+ð 	!Ý Ð Øˆr   c                 ó   — t           ‚)zGenerate a submodule.©ÚNotImplementedError©r   Úgenss     r   Ú	submodulezModule.submoduleT   ó   € å!Ð!r   c                 ó   — t           ‚)zGenerate a quotient module.r   ©r   Úothers     r   Úquotient_modulezModule.quotient_moduleX   r#   r   c                 ój   — t          |t          ¦  «        s
 | j        |Ž }|                      |¦  «        S r   )r   r   r"   r'   ©r   Úes     r   Ú__truediv__zModule.__truediv__\   s6   € Ý˜!�VÑ$Ô$ð 	#Ø�” Ð"ˆAØ×#Ò# AÑ&Ô&Ð&r   c                 óT   — 	 |                       |¦  «         dS # t          $ r Y dS w xY w)z5Return True if ``elem`` is an element of this module.TF)r   r
   ©r   r   s     r   ÚcontainszModule.containsa   s@   € ð	Ø�LŠL˜ÑÔÐØ�4øÝð 	ð 	ð 	Ø�5�5ð	øøøs   ‚ ™
'¦'c                 ó,   — |                       |¦  «        S r   ©r.   r-   s     r   Ú__contains__zModule.__contains__i   s   € Ø�}Š}˜TÑ"Ô"Ð"r   c                 ó:   ‡ — t          ˆ fd„|D ¦   «         ¦  «        S )aN  
        Returns True if ``other`` is is a subset of ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> F.subset([(1, x), (x, 2)])
        True
        >>> F.subset([(1/x, x), (x, 2)])
        False
        c              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S r   r0   ©Ú.0Úxr   s     €r   ú	<genexpr>z Module.subset.<locals>.<genexpr>{   s/   øè è € Ð3Ð3¨�4—=’= Ñ#Ô#Ð3Ð3Ð3Ð3Ð3Ð3r   ©Úallr%   s   ` r   ÚsubsetzModule.subsetl   s(   ø€ õ Ð3Ð3Ð3Ð3¨UÐ3Ñ3Ô3Ñ3Ô3Ð3r   c                 óV   — |                       |¦  «        o|                      | ¦  «        S r   )Úis_submoduler%   s     r   Ú__eq__zModule.__eq__}   s)   € Ø× Ò  Ñ'Ô'ÐD¨E×,>Ò,>¸tÑ,DÔ,DÐDr   c                 ó   — | |k     S r   © r%   s     r   Ú__ne__zModule.__ne__€   s   € Ø˜E’MÐ"Ð"r   c                 ó   — t           ‚)z*Returns True if ``self`` is a zero module.r   ©r   s    r   Úis_zerozModule.is_zeroƒ   r#   r   c                 ó   — t           ‚)z5Returns True if ``other`` is a submodule of ``self``.r   r%   s     r   r<   zModule.is_submodule‡   r#   r   c                 ó   — t           ‚)z;
        Multiply ``self`` by the ideal ``other``.
        r   r%   s     r   Úmultiply_idealzModule.multiply_ideal‹   s
   € õ "Ð!r   c                 óÊ   — t          |t          ¦  «        s:	 | j                             |¦  «        }n# t          t
          f$ r
 t          cY S w xY w|                      |¦  «        S r   )r   r   r   Úidealr
   r   ÚNotImplementedrF   r)   s     r   Ú__mul__zModule.__mul__‘   so   € Ý˜!�UÑ#Ô#ð 	&ð&Ø”I—O’O AÑ&Ô&��øÝ"Õ$7Ð8ð &ð &ð &Ý%Ð%Ð%Ð%ð&øøøà×"Ò" 1Ñ%Ô%Ð%s   —2 ²AÁAc                 ó   — t           ‚)z-Return the identity homomorphism on ``self``.r   rB   s    r   Úidentity_homzModule.identity_hom›   r#   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r"   r'   r+   r.   r1   r:   r=   r@   rC   r<   rF   rJ   Ú__rmul__rL   r?   r   r   r   r   ,   s  € € € € € ðð ð4ð ð ðð ð ð ð"ð "ð "ð"ð "ð "ð'ð 'ð 'ð
ð ð ð#ð #ð #ð4ð 4ð 4ð"Eð Eð Eð#ð #ð #ð"ð "ð "ð"ð "ð "ð"ð "ð "ð&ð &ð &ð €Hð"ð "ð "ð "ð "r   r   c                   óh   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	e	Z
d„ Zd	„ Zd
„ Zd„ ZeZd„ Zd„ Zd„ ZdS )ÚModuleElementa…  
    Base class for module element wrappers.

    Use this class to wrap primitive data types as module elements. It stores
    a reference to the containing module, and implements all the arithmetic
    operators.

    Attributes:

    - module - containing module
    - data - internal data

    Methods that likely need change in subclasses:

    - add
    - mul
    - div
    - eq
    c                 ó"   — || _         || _        d S r   )ÚmoduleÚdata)r   rU   rV   s      r   r   zModuleElement.__init__µ   s   € ØˆŒØˆŒ	ˆ	ˆ	r   c                 ó   — ||z   S )zAdd data ``d1`` and ``d2``.r?   ©r   Úd1Úd2s      r   ÚaddzModuleElement.add¹   s   € à�B‰wˆr   c                 ó   — ||z  S )z,Multiply module data ``m`` by coefficient d.r?   ©r   ÚmÚds      r   ÚmulzModuleElement.mul½   ó   € à�1‰uˆr   c                 ó   — ||z  S )z*Divide module data ``m`` by coefficient d.r?   r]   s      r   ÚdivzModuleElement.divÁ   ra   r   c                 ó   — ||k    S )z4Return true if d1 and d2 represent the same element.r?   rX   s      r   ÚeqzModuleElement.eqÅ   s   € à�RŠxˆr   c                 ó$  — t          || j        ¦  «        r|j        | j        k    r3	 | j                             |¦  «        }n# t          $ r
 t
          cY S w xY w|                      | j        |                      | j        |j        ¦  «        ¦  «        S r   )r   Ú	__class__rU   r   r
   rI   r[   rV   ©r   Úoms     r   Ú__add__zModuleElement.__add__É   s�   € Ý˜"˜dœnÑ-Ô-ð 	&°´¸d¼kÒ1IÐ1Ið&Ø”[×(Ò(¨Ñ,Ô,��øÝ!ð &ð &ð &Ý%Ð%Ð%Ð%ð&øøøà�~Š~˜dœk¨4¯8ª8°D´I¸r¼wÑ+GÔ+GÑHÔHÐHó   §A ÁAÁAc           	      ó¤   — |                       | j        |                      | j        | j        j                             d¦  «        ¦  «        ¦  «        S )Néÿÿÿÿ)rg   rU   r`   rV   r   r   rB   s    r   Ú__neg__zModuleElement.__neg__Ó   sF   € Ø�~Š~˜dœk¨4¯8ª8°D´IØ”{Ô'×/Ò/°Ñ3Ô3ñ,5ô ,5ñ 6ô 6ð 	6r   c                 óÞ   — t          || j        ¦  «        r|j        | j        k    r3	 | j                             |¦  «        }n# t          $ r
 t
          cY S w xY w|                      | ¦  «        S r   )r   rg   rU   r   r
   rI   rj   rh   s     r   Ú__sub__zModuleElement.__sub__×   s{   € Ý˜"˜dœnÑ-Ô-ð 	&°´¸d¼kÒ1IÐ1Ið&Ø”[×(Ò(¨Ñ,Ô,��øÝ!ð &ð &ð &Ý%Ð%Ð%Ð%ð&øøøà�|Š|˜R˜CÑ Ô Ð rk   c                 ó.   — |                        |¦  «        S r   )rj   rh   s     r   Ú__rsub__zModuleElement.__rsub__ß   s   € Ø��Š˜rÑ"Ô"Ð"r   c                 ó  — t          || j        j        j        ¦  «        s8	 | j        j                             |¦  «        }n# t
          $ r
 t          cY S w xY w|                      | j        |                      | j	        |¦  «        ¦  «        S r   )
r   rU   r   r   r   r
   rI   rg   r`   rV   ©r   Úos     r   rJ   zModuleElement.__mul__â   óˆ   € Ý˜!˜Tœ[Ô-Ô3Ñ4Ô4ð 	&ð&Ø”KÔ$×,Ò,¨QÑ/Ô/��øÝ!ð &ð &ð &Ý%Ð%Ð%Ð%ð&øøøà�~Š~˜dœk¨4¯8ª8°D´I¸qÑ+AÔ+AÑBÔBÐBó   ¡A ÁAÁAc                 ó  — t          || j        j        j        ¦  «        s8	 | j        j                             |¦  «        }n# t
          $ r
 t          cY S w xY w|                      | j        |                      | j	        |¦  «        ¦  «        S r   )
r   rU   r   r   r   r
   rI   rg   rc   rV   rt   s     r   r+   zModuleElement.__truediv__ì   rv   rw   c                 óæ   — t          || j        ¦  «        r|j        | j        k    r-	 | j                             |¦  «        }n# t          $ r Y dS w xY w|                      | j        |j        ¦  «        S ©NF)r   rg   rU   r   r
   re   rV   rh   s     r   r=   zModuleElement.__eq__ô   sz   € Ý˜"˜dœnÑ-Ô-ð 	°´¸d¼kÒ1IÐ1IðØ”[×(Ò(¨Ñ,Ô,��øÝ!ð ð ð Ø�u�uðøøøà�wŠw�t”y "¤'Ñ*Ô*Ð*s   §A Á
AÁAc                 ó   — | |k     S r   r?   rh   s     r   r@   zModuleElement.__ne__ü   s   € Ø˜2’:ˆ~Ðr   N)rM   rN   rO   rP   r   r[   r`   rc   re   rj   Ú__radd__rn   rp   rr   rJ   rQ   r+   r=   r@   r?   r   r   rS   rS       sø   € € € € € ðð ð(ð ð ðð ð ðð ð ðð ð ðð ð ðIð Ið Ið €Hð6ð 6ð 6ð!ð !ð !ð#ð #ð #ðCð Cð Cð €HðCð Cð Cð+ð +ð +ðð ð ð ð r   rS   c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚFreeModuleElementz1Element of a free module. Data stored as a tuple.c                 óP   — t          d„ t          ||¦  «        D ¦   «         ¦  «        S )Nc              3   ó&   K  — | ]\  }}||z   V — Œd S r   r?   )r5   r6   Úys      r   r7   z(FreeModuleElement.add.<locals>.<genexpr>  s*   è è € Ð3Ð3™t˜q !�Q˜‘UÐ3Ð3Ð3Ð3Ð3Ð3r   )ÚtupleÚziprX   s      r   r[   zFreeModuleElement.add  s'   € ÝÐ3Ð3¥s¨2¨r¡{¤{Ð3Ñ3Ô3Ñ3Ô3Ð3r   c                 ó:   ‡— t          ˆfd„|D ¦   «         ¦  «        S )Nc              3   ó"   •K  — | ]	}|‰z  V — Œ
d S r   r?   ©r5   r6   Úps     €r   r7   z(FreeModuleElement.mul.<locals>.<genexpr>  ó'   øè è € Ð&Ð&˜q�Q˜‘UÐ&Ð&Ð&Ð&Ð&Ð&r   ©r‚   ©r   r_   r‡   s     `r   r`   zFreeModuleElement.mul
  ó&   ø€ ÝÐ&Ð&Ð&Ð& AÐ&Ñ&Ô&Ñ&Ô&Ð&r   c                 ó:   ‡— t          ˆfd„|D ¦   «         ¦  «        S )Nc              3   ó"   •K  — | ]	}|‰z  V — Œ
d S r   r?   r†   s     €r   r7   z(FreeModuleElement.div.<locals>.<genexpr>  rˆ   r   r‰   rŠ   s     `r   rc   zFreeModuleElement.div  r‹   r   c                 ó¼   ‡ ‡— ddl mŠ ‰ j        }t          d„ |D ¦   «         ¦  «        rˆ fd„|D ¦   «         }dd                     ˆfd„|D ¦   «         ¦  «        z   dz   S )	Nr   )Ússtrc              3   ó@   K  — | ]}t          |t          ¦  «        V — Œd S r   )r   r	   ©r5   r6   s     r   r7   z-FreeModuleElement.__repr__.<locals>.<genexpr>  s,   è è € Ð0Ð0 a�z˜!�SÑ!Ô!Ð0Ð0Ð0Ð0Ð0Ð0r   c                 óN   •— g | ]!}‰j         j                             |¦  «        ‘Œ"S r?   )rU   r   Úto_sympyr4   s     €r   ú
<listcomp>z.FreeModuleElement.__repr__.<locals>.<listcomp>  s,   ø€ Ð?Ð?Ð?°Q�D”KÔ$×-Ò-¨aÑ0Ô0Ð?Ð?Ð?r   ú[ú, c              3   ó.   •K  — | ]} ‰|¦  «        V — Œd S r   r?   )r5   r6   r�   s     €r   r7   z-FreeModuleElement.__repr__.<locals>.<genexpr>  s+   øè è € Ð5Ð5¨1˜t˜t A™wœwÐ5Ð5Ð5Ð5Ð5Ð5r   ú])Úsympy.printing.strr�   rV   ÚanyÚjoin)r   rV   r�   s   ` @r   Ú__repr__zFreeModuleElement.__repr__  s‡   øø€ Ø+Ð+Ð+Ð+Ð+Ð+ØŒyˆÝÐ0Ð0¨4Ð0Ñ0Ô0Ñ0Ô0ð 	@Ø?Ð?Ð?Ð?¸$Ð?Ñ?Ô?ˆDØ�T—Y’YÐ5Ð5Ð5Ð5°Ð5Ñ5Ô5Ñ5Ô5Ñ5¸Ñ;Ð;r   c                 ó4   — | j                              ¦   «         S r   )rV   Ú__iter__rB   s    r   rž   zFreeModuleElement.__iter__  s   € ØŒy×!Ò!Ñ#Ô#Ð#r   c                 ó   — | j         |         S r   ©rV   )r   Úidxs     r   Ú__getitem__zFreeModuleElement.__getitem__  s   € ØŒy˜Œ~Ðr   N)
rM   rN   rO   rP   r[   r`   rc   rœ   rž   r¢   r?   r   r   r~   r~     st   € € € € € Ø;Ð;ð4ð 4ð 4ð'ð 'ð 'ð'ð 'ð 'ð<ð <ð <ð$ð $ð $ðð ð ð ð r   r~   c                   óN   — e Zd ZdZeZd„ Zd„ Zd„ Zdd„Z	d„ Z
d„ Zd	„ Zd
„ Zd„ ZdS )Ú
FreeModulez 
    Abstract base class for free modules.

    Additional attributes:

    - rank - rank of the free module

    Non-implemented methods:

    - submodule
    c                 óJ   — t                                | |¦  «         || _        d S r   )r   r   Úrank)r   r   r¦   s      r   r   zFreeModule.__init__-  s!   € Ý�Š˜˜dÑ#Ô#Ð#ØˆŒ	ˆ	ˆ	r   c                 óZ   — t          | j        ¦  «        dz   t          | j        ¦  «        z   S )Nú**©Úreprr   r¦   rB   s    r   rœ   zFreeModule.__repr__1  s"   € Ý�D”I‰Œ Ñ%­¨T¬Y©¬Ñ7Ð7r   c                 ó°   — t          |t          ¦  «        r|j        | k    S t          |t          ¦  «        r |j        | j        k    o|j        | j        k    S dS )a‰  
        Returns True if ``other`` is a submodule of ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> M = F.submodule([2, x])
        >>> F.is_submodule(F)
        True
        >>> F.is_submodule(M)
        True
        >>> M.is_submodule(F)
        False
        F)r   Ú	SubModuleÚ	containerr¤   r   r¦   r%   s     r   r<   zFreeModule.is_submodule4  sX   € õ$ �e�YÑ'Ô'ð 	+Ø”? dÒ*Ð*Ý�e�ZÑ(Ô(ð 	GØ”: ¤Ò*ÐF¨u¬z¸T¼YÒ/FÐFØˆur   Nc                 ó  ‡ ‡— t          ‰t          ¦  «        rV‰j        ‰ u r‰S ‰j        j        ‰ j        k    rt          ‚t          ‰ t          ˆˆ fd„‰j        D ¦   «         ¦  «        ¦  «        S t          ‰¦  «        rJt          ˆ fd„‰D ¦   «         ¦  «        }t          |¦  «        ‰ j        k    rt          ‚t          ‰ |¦  «        S t          ‰d¦  «        r1t          ‰ ‰ j
                             d¦  «        f‰ j        z  ¦  «        S t          ‚)aŠ  
        Convert ``elem`` into the internal representation.

        This method is called implicitly whenever computations involve elements
        not in the internal representation.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> F.convert([1, 0])
        [1, 0]
        c              3   ób   •K  — | ])}‰j                              |‰j        j         ¦  «        V — Œ*d S r   )r   r   rU   )r5   r6   r   r   s     €€r   r7   z%FreeModule.convert.<locals>.<genexpr>b  s:   øè è € ÐUÐUÀa˜4œ9×,Ò,¨Q°´Ô0@ÑAÔAÐUÐUÐUÐUÐUÐUr   c              3   óL   •K  — | ]}‰j                              |¦  «        V — Œd S r   )r   r   r4   s     €r   r7   z%FreeModule.convert.<locals>.<genexpr>d  s3   øè è € Ð;Ð;°˜œ	×)Ò)¨!Ñ,Ô,Ð;Ð;Ð;Ð;Ð;Ð;r   r   )r   r~   rU   r¦   r
   r‚   rV   r   Úlenr   r   r   )r   r   r   Útpls   ``  r   r   zFreeModule.convertL  s  øø€ õ  �dÕ-Ñ.Ô.ð 	!ØŒ{˜dÐ"Ð"Ø�ØŒ{Ô 4¤9Ò,Ð,Ý$Ð$Ý$ TÝÐUÐUÐUÐUÐUÈ4Ì9ÐUÑUÔUÑUÔUñWô Wð Wå�d‰^Œ^ð 	!ÝÐ;Ð;Ð;Ð;°dÐ;Ñ;Ô;Ñ;Ô;ˆCÝ�3‰xŒx˜4œ9Ò$Ð$Ý$Ð$Ý$ T¨3Ñ/Ô/Ð/Ý�d˜AÑÔð 	!Ý$ T¨D¬I×,=Ò,=¸aÑ,@Ô,@Ð+BÀ4Ä9Ñ+LÑMÔMÐMå Ð r   c                 ó   — | j         dk    S )aÄ  
        Returns True if ``self`` is a zero module.

        (If, as this implementation assumes, the coefficient ring is not the
        zero ring, then this is equivalent to the rank being zero.)

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(0).is_zero()
        True
        >>> QQ.old_poly_ring(x).free_module(1).is_zero()
        False
        r   )r¦   rB   s    r   rC   zFreeModule.is_zerom  s   € ð" Œy˜AŠ~Ðr   c                 óŽ   ‡ ‡— ddl m}  |‰ j        ¦  «        Št          ˆˆ fd„t	          ‰ j        ¦  «        D ¦   «         ¦  «        S )zû
        Return a set of basis elements.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(3).basis()
        ([1, 0, 0], [0, 1, 0], [0, 0, 1])
        r   )Úeyec              3   óh   •K  — | ],}‰                      ‰                     |¦  «        ¦  «        V — Œ-d S r   )r   Úrow)r5   Úir   r   s     €€r   r7   z#FreeModule.basis.<locals>.<genexpr>Ž  s9   øè è € ÐFÐF°�T—\’\ !§%¢%¨¡(¤(Ñ+Ô+ÐFÐFÐFÐFÐFÐFr   )Úsympy.matricesrµ   r¦   r‚   Úrange)r   rµ   r   s   ` @r   ÚbasiszFreeModule.basis€  sW   øø€ ð 	'Ð&Ð&Ð&Ð&Ð&ØˆC�”	‰NŒNˆÝÐFÐFÐFÐFÐFµU¸4¼9Ñ5EÔ5EÐFÑFÔFÑFÔFÐFr   c                 ó.   — t          | j        | |¦  «        S )aÎ  
        Return a quotient module.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> M = QQ.old_poly_ring(x).free_module(2)
        >>> M.quotient_module(M.submodule([1, x], [x, 2]))
        QQ[x]**2/<[1, x], [x, 2]>

        Or more conicisely, using the overloaded division operator:

        >>> QQ.old_poly_ring(x).free_module(2) / [[1, x], [x, 2]]
        QQ[x]**2/<[1, x], [x, 2]>
        )ÚQuotientModuler   )r   r"   s     r   r'   zFreeModule.quotient_module�  s   € õ$ ˜dœi¨¨yÑ9Ô9Ð9r   c                 ó`   —  | j         |                      ¦   «         Ž                      |¦  «        S )a=  
        Multiply ``self`` by the ideal ``other``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> I = QQ.old_poly_ring(x).ideal(x)
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> F.multiply_ideal(I)
        <[x, 0], [0, x]>
        )r"   r»   rF   r%   s     r   rF   zFreeModule.multiply_ideal¤  s)   € ð ˆtŒ~˜tŸzšz™|œ|Ð,×;Ò;¸EÑBÔBÐBr   c                 óL   — ddl m}  || | |                      ¦   «         ¦  «        S )a/  
        Return the identity homomorphism on ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(2).identity_hom()
        Matrix([
        [1, 0], : QQ[x]**2 -> QQ[x]**2
        [0, 1]])
        r   )Úhomomorphism)Úsympy.polys.agca.homomorphismsrÀ   r»   )r   rÀ   s     r   rL   zFreeModule.identity_hom´  s3   € ð 	@Ð?Ð?Ð?Ð?Ð?Øˆ|˜D $¨¯
ª
©¬Ñ5Ô5Ð5r   r   )rM   rN   rO   rP   r~   r   r   rœ   r<   r   rC   r»   r'   rF   rL   r?   r   r   r¤   r¤     s¸   € € € € € ð
ð 
ð €Eðð ð ð8ð 8ð 8ðð ð ð0!ð !ð !ð !ðBð ð ð&Gð Gð Gð :ð :ð :ð(Cð Cð Cð 6ð 6ð 6ð 6ð 6r   r¤   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚFreeModulePolyRingaw  
    Free module over a generalized polynomial ring.

    Do not instantiate this, use the constructor method of the ring instead:

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy import QQ
    >>> F = QQ.old_poly_ring(x).free_module(3)
    >>> F
    QQ[x]**3
    >>> F.contains([x, 1, 0])
    True
    >>> F.contains([1/x, 0, 1])
    False
    c                 óü   — ddl m} t                               | ||¦  «         t	          ||¦  «        st          dd|z  z   ¦  «        ‚t	          |j        t          ¦  «        st          dd|j        z  z   ¦  «        ‚d S )Nr   )ÚPolynomialRingBaseú$This implementation only works over zpolynomial rings, got %szGround domain must be a field, zgot %s)Ú&sympy.polys.domains.old_polynomialringrÅ   r¤   r   r   r   Údomr   )r   r   r¦   rÅ   s       r   r   zFreeModulePolyRing.__init__Ú  s¨   € ØMÐMÐMÐMÐMÐMÝ×Ò˜D $¨Ñ-Ô-Ð-Ý˜$Ð 2Ñ3Ô3ð 	KÝ%Ð&LØ(BÀTÑ(Iñ'Jñ Kô Kð Kå˜$œ(¥EÑ*Ô*ð 	=Ý%Ð&GØ(0°4´8Ñ(;ñ'<ñ =ô =ð =ð	=ð 	=r   c                 ó   — t          || fi |¤ŽS )ae  
        Generate a submodule.

        Examples
        ========

        >>> from sympy.abc import x, y
        >>> from sympy import QQ
        >>> M = QQ.old_poly_ring(x, y).free_module(2).submodule([x, x + y])
        >>> M
        <[x, x + y]>
        >>> M.contains([2*x, 2*x + 2*y])
        True
        >>> M.contains([x, y])
        False
        )ÚSubModulePolyRing©r   r!   Úoptss      r   r"   zFreeModulePolyRing.submoduleä  s   € õ" !  tÐ4Ð4¨tÐ4Ð4Ð4r   N)rM   rN   rO   rP   r   r"   r?   r   r   rÃ   rÃ   Æ  s<   € € € € € ðð ð&=ð =ð =ð5ð 5ð 5ð 5ð 5r   rÃ   c                   ó0   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚFreeModuleQuotientRingaŠ  
    Free module over a quotient ring.

    Do not instantiate this, use the constructor method of the ring instead:

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy import QQ
    >>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(3)
    >>> F
    (QQ[x]/<x**2 + 1>)**3

    Attributes

    - quot - the quotient module `R^n / IR^n`, where `R/I` is our ring
    c                 ó
  — ddl m} t                               | ||¦  «         t	          ||¦  «        st          dd|z  z   ¦  «        ‚| j        j                             | j        ¦  «        }|| j        j	        |z  z  | _
        d S )Nr   )ÚQuotientRingrÆ   zquotient rings, got %s)Ú sympy.polys.domains.quotientringrÐ   r¤   r   r   r   r   Úfree_moduler¦   Ú
base_idealÚquot)r   r   r¦   rÐ   ÚFs        r   r   zFreeModuleQuotientRing.__init__  s—   € ØAÐAÐAÐAÐAÐAÝ×Ò˜D $¨Ñ-Ô-Ð-Ý˜$ Ñ-Ô-ð 	@Ý%Ð&LØ7¸$Ñ>ñ'?ñ @ô @ð @àŒIŒN×&Ò& t¤yÑ1Ô1ˆØ˜œÔ-¨aÑ/Ñ0ˆŒ	ˆ	ˆ	r   c                 óf   — dt          | j        ¦  «        z   dz   dz   t          | j        ¦  «        z   S )Nú(ú)r¨   r©   rB   s    r   rœ   zFreeModuleQuotientRing.__repr__  s,   € Ø•T˜$œ)‘_”_Ñ$ sÑ*¨TÑ1µD¸¼±O´OÑCÐCr   c                 ó   — t          || fi |¤ŽS )a—  
        Generate a submodule.

        Examples
        ========

        >>> from sympy.abc import x, y
        >>> from sympy import QQ
        >>> M = (QQ.old_poly_ring(x, y)/[x**2 - y**2]).free_module(2).submodule([x, x + y])
        >>> M
        <[x + <x**2 - y**2>, x + y + <x**2 - y**2>]>
        >>> M.contains([y**2, x**2 + x*y])
        True
        >>> M.contains([x, y])
        False
        )ÚSubModuleQuotientRingrË   s      r   r"   z FreeModuleQuotientRing.submodule  s   € õ" % T¨4Ð8Ð8°4Ð8Ð8Ð8r   c                 óJ   — | j                              d„ |D ¦   «         ¦  «        S )ae  
        Lift the element ``elem`` of self to the module self.quot.

        Note that self.quot is the same set as self, just as an R-module
        and not as an R/I-module, so this makes sense.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(2)
        >>> e = F.convert([1, 0])
        >>> e
        [1 + <x**2 + 1>, 0 + <x**2 + 1>]
        >>> L = F.quot
        >>> l = F.lift(e)
        >>> l
        [1, 0] + <[x**2 + 1, 0], [0, x**2 + 1]>
        >>> L.contains(l)
        True
        c                 ó   — g | ]	}|j         ‘Œ
S r?   r    r‘   s     r   r”   z/FreeModuleQuotientRing.lift.<locals>.<listcomp>B  s   € Ð!7Ð!7Ð!7¨Q !¤&Ð!7Ð!7Ð!7r   )rÔ   r   r-   s     r   ÚliftzFreeModuleQuotientRing.lift+  s)   € ð. Œy× Ò Ð!7Ð!7°$Ð!7Ñ!7Ô!7Ñ8Ô8Ð8r   c                 ó6   — |                       |j        ¦  «        S )a‹  
        Push down an element of self.quot to self.

        This undoes ``lift``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(2)
        >>> e = F.convert([1, 0])
        >>> l = F.lift(e)
        >>> e == l
        False
        >>> e == F.unlift(l)
        True
        )r   rV   r-   s     r   ÚunliftzFreeModuleQuotientRing.unliftD  s   € ð& �|Š|˜DœIÑ&Ô&Ð&r   N)	rM   rN   rO   rP   r   rœ   r"   rÝ   rß   r?   r   r   rÎ   rÎ   ø  sl   € € € € € ðð ð&1ð 1ð 1ðDð Dð Dð9ð 9ð 9ð&9ð 9ð 9ð2'ð 'ð 'ð 'ð 'r   rÎ   c                   ó¢   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd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eZd„ Zd„ Zd„ ZdS )r¬   a†  
    Base class for submodules.

    Attributes:

    - container - containing module
    - gens - generators (subset of containing module)
    - rank - rank of containing module

    Non-implemented methods:

    - _contains
    - _syzygies
    - _in_terms_of_generators
    - _intersect
    - _module_quotient

    Methods that likely need change in subclasses:

    - reduce_element
    c                 óÞ   ‡— t                                | ‰j        ¦  «         t          ˆfd„|D ¦   «         ¦  «        | _        ‰| _        ‰j        | _        ‰j        | _        ‰j        | _        d S )Nc              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S r   ©r   )r5   r6   r­   s     €r   r7   z%SubModule.__init__.<locals>.<genexpr>w  s1   øè è € Ð=Ð=°1˜)×+Ò+¨AÑ.Ô.Ð=Ð=Ð=Ð=Ð=Ð=r   )r   r   r   r‚   r!   r­   r¦   r   ©r   r!   r­   s     `r   r   zSubModule.__init__u  sc   ø€ Ý�Š˜˜iœnÑ-Ô-Ð-ÝÐ=Ð=Ð=Ð=¸Ð=Ñ=Ô=Ñ=Ô=ˆŒ	Ø"ˆŒØ”NˆŒ	Ø”NˆŒ	Ø”_ˆŒ
ˆ
ˆ
r   c                 óV   — dd                      d„ | j        D ¦   «         ¦  «        z   dz   S )Nú<r–   c              3   ó4   K  — | ]}t          |¦  «        V — Œd S r   )rª   r‘   s     r   r7   z%SubModule.__repr__.<locals>.<genexpr>~  s(   è è € Ð:Ð:¨1�t A™wœwÐ:Ð:Ð:Ð:Ð:Ð:r   ú>)r›   r!   rB   s    r   rœ   zSubModule.__repr__}  s/   € Ø�T—Y’YÐ:Ð:°´	Ð:Ñ:Ô:Ñ:Ô:Ñ:¸SÑ@Ð@r   c                 ó   — t           ‚)zVImplementation of containment.
           Other is guaranteed to be FreeModuleElement.r   r%   s     r   Ú	_containszSubModule._contains€  ó
   € õ "Ð!r   c                 ó   — t           ‚)z9Implementation of syzygy computation wrt self generators.r   rB   s    r   Ú	_syzygieszSubModule._syzygies…  r#   r   c                 ó   — t           ‚)z4Implementation of expression in terms of generators.r   r)   s     r   Ú_in_terms_of_generatorsz!SubModule._in_terms_of_generators‰  r#   r   Nc                 óæ   — t          || j        j        ¦  «        r|j        | u r|S t	          | j                             ||¦  «        ¦  «        }| |_        |                      |¦  «        st          ‚|S )aF  
        Convert ``elem`` into the internal represantition.

        Mostly called implicitly.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> M = QQ.old_poly_ring(x).free_module(2).submodule([1, x])
        >>> M.convert([2, 2*x])
        [2, 2*x]
        )r   r­   r   rU   r   r   rê   r
   )r   r   r   Úrs       r   r   zSubModule.convert�  sq   € õ �d˜DœNÔ0Ñ1Ô1ð 	°d´kÀTÐ6IÐ6IØˆKÝ�”×'Ò'¨¨aÑ0Ô0Ñ1Ô1ˆØˆŒØ�~Š~˜aÑ Ô ð 	!Ý Ð Øˆr   c                 ó   — t           ‚)zeImplementation of intersection.
           Other is guaranteed to be a submodule of same free module.r   r%   s     r   Ú
_intersectzSubModule._intersect¤  rë   r   c                 ó   — t           ‚)zaImplementation of quotient.
           Other is guaranteed to be a submodule of same free module.r   r%   s     r   Ú_module_quotientzSubModule._module_quotient©  rë   r   c                 ó°   — t          |t          ¦  «        st          d|z  ¦  «        ‚|j        | j        k    rt	          d|z  ¦  «        ‚ | j        |fi |¤ŽS )a¯  
        Returns the intersection of ``self`` with submodule ``other``.

        Examples
        ========

        >>> from sympy.abc import x, y
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x, y).free_module(2)
        >>> F.submodule([x, x]).intersect(F.submodule([y, y]))
        <[x*y, x*y]>

        Some implementation allow further options to be passed. Currently, to
        only one implemented is ``relations=True``, in which case the function
        will return a triple ``(res, rela, relb)``, where ``res`` is the
        intersection module, and ``rela`` and ``relb`` are lists of coefficient
        vectors, expressing the generators of ``res`` in terms of the
        generators of ``self`` (``rela``) and ``other`` (``relb``).

        >>> F.submodule([x, x]).intersect(F.submodule([y, y]), relations=True)
        (<[x*y, x*y]>, [(DMP_Python([[1, 0]], QQ),)], [(DMP_Python([[1], []], QQ),)])

        The above result says: the intersection module is generated by the
        single element `(-xy, -xy) = -y (x, x) = -x (y, y)`, where
        `(x, x)` and `(y, y)` respectively are the unique generators of
        the two modules being intersected.
        ú%s is not a SubModuleú*%s is contained in a different free module)r   r¬   Ú	TypeErrorr­   Ú
ValueErrorró   ©r   r&   Úoptionss      r   Ú	intersectzSubModule.intersect®  sp   € õ8 ˜%¥Ñ+Ô+ð 	=ÝÐ3°eÑ;Ñ<Ô<Ð<ØŒ?˜dœnÒ,Ð,ÝØ<¸uÑDñFô Fð FàˆtŒ˜uÐ0Ð0¨Ð0Ð0Ð0r   c                 ó°   — t          |t          ¦  «        st          d|z  ¦  «        ‚|j        | j        k    rt	          d|z  ¦  «        ‚ | j        |fi |¤ŽS )aö  
        Returns the module quotient of ``self`` by submodule ``other``.

        That is, if ``self`` is the module `M` and ``other`` is `N`, then
        return the ideal `\{f \in R | fN \subset M\}`.

        Examples
        ========

        >>> from sympy import QQ
        >>> from sympy.abc import x, y
        >>> F = QQ.old_poly_ring(x, y).free_module(2)
        >>> S = F.submodule([x*y, x*y])
        >>> T = F.submodule([x, x])
        >>> S.module_quotient(T)
        <y>

        Some implementations allow further options to be passed. Currently, the
        only one implemented is ``relations=True``, which may only be passed
        if ``other`` is principal. In this case the function
        will return a pair ``(res, rel)`` where ``res`` is the ideal, and
        ``rel`` is a list of coefficient vectors, expressing the generators of
        the ideal, multiplied by the generator of ``other`` in terms of
        generators of ``self``.

        >>> S.module_quotient(T, relations=True)
        (<y>, [[DMP_Python([[1]], QQ)]])

        This means that the quotient ideal is generated by the single element
        `y`, and that `y (x, x) = 1 (xy, xy)`, `(x, x)` and `(xy, xy)` being
        the generators of `T` and `S`, respectively.
        r÷   rø   )r   r¬   rù   r­   rú   rõ   rû   s      r   Úmodule_quotientzSubModule.module_quotientÑ  sr   € õB ˜%¥Ñ+Ô+ð 	=ÝÐ3°eÑ;Ñ<Ô<Ð<ØŒ?˜dœnÒ,Ð,ÝØ<¸uÑDñFô Fð Fà$ˆtÔ$ UÐ6Ð6¨gÐ6Ð6Ð6r   c                 óä   — t          |t          ¦  «        st          d|z  ¦  «        ‚|j        | j        k    rt	          d|z  ¦  «        ‚|                      | j        |j        z   | j        ¦  «        S )a–  
        Returns the module generated by the union of ``self`` and ``other``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(1)
        >>> M = F.submodule([x**2 + x]) # <x(x+1)>
        >>> N = F.submodule([x**2 - 1]) # <(x-1)(x+1)>
        >>> M.union(N) == F.submodule([x+1])
        True
        r÷   rø   )r   r¬   rù   r­   rú   rg   r!   r%   s     r   ÚunionzSubModule.unionù  su   € õ ˜%¥Ñ+Ô+ð 	=ÝÐ3°eÑ;Ñ<Ô<Ð<ØŒ?˜dœnÒ,Ð,ÝØ<¸uÑDñFô Fð Fà�~Š~˜dœi¨%¬*Ñ4°d´nÑEÔEÐEr   c                 ó>   — t          d„ | j        D ¦   «         ¦  «        S )aF  
        Return True if ``self`` is a zero module.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> F.submodule([x, 1]).is_zero()
        False
        >>> F.submodule([0, 0]).is_zero()
        True
        c              3   ó"   K  — | ]
}|d k    V — ŒdS )r   Nr?   r‘   s     r   r7   z$SubModule.is_zero.<locals>.<genexpr>  s&   è è € Ð-Ð-˜a�1˜’6Ð-Ð-Ð-Ð-Ð-Ð-r   )r9   r!   rB   s    r   rC   zSubModule.is_zero  s#   € õ Ð-Ð- 4¤9Ð-Ñ-Ô-Ñ-Ô-Ð-r   c                 óŠ   — |                       |¦  «        st          |›d| ›�¦  «        ‚|                      || j        ¦  «        S )a  
        Generate a submodule.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> M = QQ.old_poly_ring(x).free_module(2).submodule([x, 1])
        >>> M.submodule([x**2, x])
        <[x**2, x]>
        z not a subset of )r:   rú   rg   r­   r    s     r   r"   zSubModule.submodule   sH   € ð �{Š{˜4Ñ Ô ð 	EÝ¸¸¸¸d¸dÐCÑDÔDÐDØ�~Š~˜d D¤NÑ3Ô3Ð3r   c                 óh   ‡ — t          ˆ fd„‰ j                             ¦   «         D ¦   «         ¦  «        S )áe  
        Return True if ``self`` is the entire free module.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> F.submodule([x, 1]).is_full_module()
        False
        >>> F.submodule([1, 1], [1, 2]).is_full_module()
        True
        c              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S r   r0   r4   s     €r   r7   z+SubModule.is_full_module.<locals>.<genexpr>@  s/   øè è € ÐDÐD¨�4—=’= Ñ#Ô#ÐDÐDÐDÐDÐDÐDr   )r9   r­   r»   rB   s   `r   Úis_full_modulezSubModule.is_full_module1  s6   ø€ õ ÐDÐDÐDÐD¨T¬^×-AÒ-AÑ-CÔ-CÐDÑDÔDÑDÔDÐDr   c                 ó  ‡ — t          |t          ¦  «        r0‰ j        |j        k    ot          ˆ fd„|j        D ¦   «         ¦  «        S t          |t
          t          f¦  «        r‰ j        |k    o‰                      ¦   «         S dS )a�  
        Returns True if ``other`` is a submodule of ``self``.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> M = F.submodule([2, x])
        >>> N = M.submodule([2*x, x**2])
        >>> M.is_submodule(M)
        True
        >>> M.is_submodule(N)
        True
        >>> N.is_submodule(M)
        False
        c              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S r   r0   r4   s     €r   r7   z)SubModule.is_submodule.<locals>.<genexpr>T  s/   øè è € Ð9Ð9¨�D—M’M !Ñ$Ô$Ð9Ð9Ð9Ð9Ð9Ð9r   F)r   r¬   r­   r9   r!   r¤   r½   r  r%   s   ` r   r<   zSubModule.is_submoduleB  sŠ   ø€ õ  �e�YÑ'Ô'ð 	:Ø”> U¤_Ò4ð :ÝÐ9Ð9Ð9Ð9¨e¬jÐ9Ñ9Ô9Ñ9Ô9ð:å�e�j­.Ð9Ñ:Ô:ð 	EØ”> UÒ*ÐD¨t×/BÒ/BÑ/DÔ/DÐDØˆur   c                 ó²   ‡— | j                              t          | j        ¦  «        ¦  «        Š ‰j        ˆfd„|                      ¦   «         D ¦   «         i |¤ŽS )a‘  
        Compute the syzygy module of the generators of ``self``.

        Suppose `M` is generated by `f_1, \ldots, f_n` over the ring
        `R`. Consider the homomorphism `\phi: R^n \to M`, given by
        sending `(r_1, \ldots, r_n) \to r_1 f_1 + \cdots + r_n f_n`.
        The syzygy module is defined to be the kernel of `\phi`.

        Examples
        ========

        The syzygy module is zero iff the generators generate freely a free
        submodule:

        >>> from sympy.abc import x, y
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(2).submodule([1, 0], [1, 1]).syzygy_module().is_zero()
        True

        A slightly more interesting example:

        >>> M = QQ.old_poly_ring(x, y).free_module(2).submodule([x, 2*x], [y, 2*y])
        >>> S = QQ.old_poly_ring(x, y).free_module(2).submodule([y, -x])
        >>> M.syzygy_module() == S
        True
        c                 óF   •— g | ]}‰                      |¦  «        d k    ¯|‘ŒS ©r   rã   )r5   r6   rÕ   s     €r   r”   z+SubModule.syzygy_module.<locals>.<listcomp>x  s-   ø€ ÐNÐNÐN 1¸A¿IºIÀa¹L¼LÈAÒ<MÐ<M˜QÐ<MÐ<MÐ<Mr   )r   rÒ   r±   r!   r"   rí   )r   rÌ   rÕ   s     @r   Úsyzygy_modulezSubModule.syzygy_moduleY  sc   ø€ ð6 ŒI×!Ò!¥# d¤i¡.¤.Ñ1Ô1ˆð ˆqŒ{ÐNÐNÐNÐN¨¯ªÑ(8Ô(8ÐNÑNÔNð #Ø!ð#ð #ð 	#r   c                 óž   — 	 |                       |¦  «        }n"# t          $ r t          |›d| ›�¦  «        ‚w xY w|                      |¦  «        S )a™  
        Express element ``e`` of ``self`` in terms of the generators.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> M = F.submodule([1, 0], [1, 1])
        >>> M.in_terms_of_generators([x, x**2])  # doctest: +SKIP
        [DMP_Python([-1, 1, 0], QQ), DMP_Python([1, 0, 0], QQ)]
        z is not an element of )r   r
   rú   rï   r)   s     r   Úin_terms_of_generatorsz SubModule.in_terms_of_generators{  se   € ð	GØ—’˜Q‘”ˆAˆAøÝð 	Gð 	Gð 	GÝ¸Q¸Q¸QÀÀÐEÑFÔFÐFð	Gøøøà×+Ò+¨AÑ.Ô.Ð.s   ‚ ˜7c                 ó   — |S )zâ
        Reduce the element ``x`` of our ring modulo the ideal ``self``.

        Here "reduce" has no specific meaning, it could return a unique normal
        form, simplify the expression a bit, or just do nothing.
        r?   )r   r6   s     r   Úreduce_elementzSubModule.reduce_element�  s	   € ð ˆr   c                 óª   — |                       |¦  «        st          |›d| ›�¦  «        ‚t          | j        | j                             |¦  «        fi |¤ŽS )aI  
        Return a quotient module.

        This is the same as taking a submodule of a quotient of the containing
        module.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> S1 = F.submodule([x, 1])
        >>> S2 = F.submodule([x**2, x])
        >>> S1.quotient_module(S2)
        <[x, 1] + <[x**2, x]>>

        Or more coincisely, using the overloaded division operator:

        >>> F.submodule([x, 1]) / [(x**2, x)]
        <[x, 1] + <[x**2, x]>>
        z not a submodule of )r<   rú   ÚSubQuotientModuler!   r­   r'   )r   r&   rÌ   s      r   r'   zSubModule.quotient_module˜  sj   € ð. × Ò  Ñ'Ô'ð 	IÝ¸5¸5¸5À$À$ÐGÑHÔHÐHÝ  ¤Ø”×.Ò.¨uÑ5Ô5ð?ð ?Ø9=ð?ð ?ð 	?r   c                 ó\   — | j                              | ¦  «                             |¦  «        S r   )r­   r'   r   )r   Úoths     r   rj   zSubModule.__add__´  s&   € ØŒ~×-Ò-¨dÑ3Ô3×;Ò;¸CÑ@Ô@Ð@r   c                 óD   ‡ —  ‰ j         ˆ fd„|j        j        D ¦   «         Ž S )a<  
        Multiply ``self`` by the ideal ``I``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> I = QQ.old_poly_ring(x).ideal(x**2)
        >>> M = QQ.old_poly_ring(x).free_module(2).submodule([1, 1])
        >>> I*M
        <[x**2, x**2]>
        c                 ó2   •— g | ]\  }‰j         D ]}||z  ‘ŒŒS r?   )r!   )r5   r6   Úgr   s      €r   r”   z,SubModule.multiply_ideal.<locals>.<listcomp>Ç  s.   ø€ ÐQÐQÐQ©¨ÀtÄyÐQÐQÀ!  !¡ÐQÐQÐQÐQr   )r"   Ú_moduler!   )r   ÚIs   ` r   rF   zSubModule.multiply_ideal¹  s-   ø€ ð ˆtŒ~ÐQÐQÐQÐQ¨q¬y¬~ÐQÑQÔQÐRÐRr   c                 óZ   — | j                              ¦   «                              | ¦  «        S )a�  
        Return a homomorphism representing the inclusion map of ``self``.

        That is, the natural map from ``self`` to ``self.container``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(2).submodule([x, x]).inclusion_hom()
        Matrix([
        [1, 0], : <[x, x]> -> QQ[x]**2
        [0, 1]])
        )r­   rL   Úrestrict_domainrB   s    r   Úinclusion_homzSubModule.inclusion_homÉ  s&   € ð  Œ~×*Ò*Ñ,Ô,×<Ò<¸TÑBÔBÐBr   c                 ó€   — | j                              ¦   «                              | ¦  «                             | ¦  «        S )aA  
        Return the identity homomorphism on ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(2).submodule([x, x]).identity_hom()
        Matrix([
        [1, 0], : <[x, x]> -> <[x, x]>
        [0, 1]])
        )r­   rL   r  Úrestrict_codomainrB   s    r   rL   zSubModule.identity_homÛ  s;   € ð Œ~×*Ò*Ñ,Ô,×<Ò<Øñô ß#Ò# DÑ)Ô)ð	*r   r   )rM   rN   rO   rP   r   rœ   rê   rí   rï   r   ró   rõ   rý   rÿ   r  rC   r"   r  r<   r  r  r  r'   rj   r|   rF   r  rL   r?   r   r   r¬   r¬   ^  s˜  € € € € € ðð ð,%ð %ð %ðAð Að Að"ð "ð "ð
"ð "ð "ð"ð "ð "ðð ð ð ð."ð "ð "ð
"ð "ð "ð
!1ð !1ð !1ðF&7ð &7ð &7ðPFð Fð Fð,.ð .ð .ð"4ð 4ð 4ð"Eð Eð Eð"ð ð ð. #ð  #ð  #ðD/ð /ð /ð(ð ð ð?ð ?ð ?ð8Að Að Að €HðSð Sð Sð Cð Cð Cð$*ð *ð *ð *ð *r   r¬   c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	r  a  
    Submodule of a quotient module.

    Equivalently, quotient module of a submodule.

    Do not instantiate this, instead use the submodule or quotient_module
    constructing methods:

    >>> from sympy.abc import x
    >>> from sympy import QQ
    >>> F = QQ.old_poly_ring(x).free_module(2)
    >>> S = F.submodule([1, 0], [1, x])
    >>> Q = F/[(1, 0)]
    >>> S/[(1, 0)] == Q.submodule([5, x])
    True

    Attributes:

    - base - base module we are quotient of
    - killed_module - submodule used to form the quotient
    c                 óæ   — t                                | ||¦  «         | j        j        | _         | j        j        j        d„ | j        D ¦   «         i |¤Ž                     | j        ¦  «        | _        d S )Nc                 ó   — g | ]	}|j         ‘Œ
S r?   r    r‘   s     r   r”   z.SubQuotientModule.__init__.<locals>.<listcomp>	  s   € Ð(Ð(Ð(˜ˆaŒfÐ(Ð(Ð(r   )r¬   r   r­   Úkilled_moduleÚbaser"   r!   r  )r   r!   r­   rÌ   s       r   r   zSubQuotientModule.__init__  sv   € Ý×Ò˜4  yÑ1Ô1Ð1Ø!œ^Ô9ˆÔð 2�D”NÔ'Ô1Ø(Ð(˜dœiÐ(Ñ(Ô(ð2Ø,0ð2ð 2ß27²%¸Ô8JÑ2KÔ2Kð 	Œ	ˆ	ˆ	r   c                 ó@   — | j                              |j        ¦  «        S r   )r%  r.   rV   r-   s     r   rê   zSubQuotientModule._contains  s   € ØŒy×!Ò! $¤)Ñ,Ô,Ð,r   c                 óN   ‡ — ˆ fd„‰ j                              ¦   «         D ¦   «         S )Nc                 óH   •— g | ]}|d t          ‰j        ¦  «        …         ‘ŒS r   )r±   r!   )r5   ÚXr   s     €r   r”   z/SubQuotientModule._syzygies.<locals>.<listcomp>  s*   ø€ ÐBÐBÐB q��/•3�t”y‘>”>�/Ô"ÐBÐBÐBr   )r%  rí   rB   s   `r   rí   zSubQuotientModule._syzygies  s.   ø€ ð CÐBÐBÐB¨D¬I×,?Ò,?Ñ,AÔ,AÐBÑBÔBÐBr   c                 ót   — | j                              |j        ¦  «        d t          | j        ¦  «        …         S r   )r%  rï   rV   r±   r!   r)   s     r   rï   z)SubQuotientModule._in_terms_of_generators  s+   € ØŒy×0Ò0°´Ñ8Ô8¸½#¸d¼i¹.¼.¸ÔIÐIr   c                 ó4   — | j                              ¦   «         S )r  )r%  r  rB   s    r   r  z SubQuotientModule.is_full_module  s   € ð Œy×'Ò'Ñ)Ô)Ð)r   c                 ód   — | j                              ¦   «                              | j        ¦  «        S )aË  
        Return the quotient homomorphism to self.

        That is, return the natural map from ``self.base`` to ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> M = (QQ.old_poly_ring(x).free_module(2) / [(1, x)]).submodule([1, 0])
        >>> M.quotient_hom()
        Matrix([
        [1, 0], : <[1, 0], [1, x]> -> <[1, 0] + <[1, x]>, [1, x] + <[1, x]>>
        [0, 1]])
        ©r%  rL   Úquotient_codomainr$  rB   s    r   Úquotient_homzSubQuotientModule.quotient_hom0  s)   € ð" Œy×%Ò%Ñ'Ô'×9Ò9¸$Ô:LÑMÔMÐMr   N)
rM   rN   rO   rP   r   rê   rí   rï   r  r/  r?   r   r   r  r  í  s†   € € € € € ðð ð*Lð Lð Lð-ð -ð -ðCð Cð CðJð Jð Jð*ð *ð *ð"Nð Nð Nð Nð Nr   r  c                 ó   — | d         S )Nr   r?   ©r6   s    r   ú<lambda>r2  D  s
   € �1�Q”4€ r   c                 ó   — | dd …         S )Né   r?   r1  s    r   r2  r2  E  s   € �1�Q�R�R”5€ r   c                   ó   — e Zd ZdZd„ ZdS )ÚModuleOrderz<A product monomial order with a zeroth term as module index.c                 óž   — |r&t          j        | |t          f|t          f¦  «         d S t          j        | |t          f|t          f¦  «         d S r   )r   r   Ú_subs1Ú_subs0)r   Úo1Úo2ÚTOPs       r   r   zModuleOrder.__init__K  sQ   € Øð 	DÝÔ! $¨­V¨°r½6°lÑCÔCÐCÐCÐCåÔ! $¨­V¨°r½6°lÑCÔCÐCÐCÐCr   N)rM   rN   rO   rP   r   r?   r   r   r6  r6  H  s.   € € € € € ØFÐFðDð Dð Dð Dð Dr   r6  c                   óZ   — e Zd ZdZdd„Zd„ Zdd„Zdd„Zd	„ Zd
„ Z	d„ Z
dd„Zdd„Zdd„ZdS )rÊ   ax  
    Submodule of a free module over a generalized polynomial ring.

    Do not instantiate this, use the constructor method of FreeModule instead:

    >>> from sympy.abc import x, y
    >>> from sympy import QQ
    >>> F = QQ.old_poly_ring(x, y).free_module(2)
    >>> F.submodule([x, y], [1, 0])
    <[x, y], [1, 0]>

    Attributes:

    - order - monomial order used
    ÚlexTc                 ó  — t                                | ||¦  «         t          |t          ¦  «        st	          dd|z  z   ¦  «        ‚t          t          |¦  «        | j        j        |¦  «        | _        d | _	        d | _
        d S )Nz)This implementation is for submodules of zFreeModulePolyRing, got %s)r¬   r   r   rÃ   r   r6  r   r   ÚorderÚ_gbÚ_gbe)r   r!   r­   r@  r<  s        r   r   zSubModulePolyRing.__init__f  s…   € Ý×Ò˜4  yÑ1Ô1Ð1Ý˜)Õ%7Ñ8Ô8ð 	IÝ%Ð&QØ;¸iÑGñ'Hñ Iô Ið Iå ¥¨eÑ!4Ô!4°d´i´oÀsÑKÔKˆŒ
ØˆŒØˆŒ	ˆ	ˆ	r   c                 ó†   — t          |t          ¦  «        r| j        |j        k    rdS t                               | |¦  «        S rz   )r   rÊ   r@  r¬   r=   r%   s     r   r=   zSubModulePolyRing.__eq__o  s>   € Ý�eÕ.Ñ/Ô/ð 	°D´JÀ%Ä+Ò4MÐ4MØ�5Ý×Ò  eÑ,Ô,Ð,r   Fc                 óš  ‡ — ddl m}m} ‰ j        €^|r\ |ˆ fd„‰ j        D ¦   «         |‰ j        ‰ j        j        d¬¦  «        \  }}t          |¦  «        t          |¦  «        c‰ _	        ‰ _        ‰ j	        €@t           |ˆ fd„‰ j        D ¦   «         |‰ j        ‰ j        j        ¦  «        ¦  «        ‰ _	        |r‰ j	        ‰ j        fS ‰ j	        S )z%Returns a standard basis in sdm form.r   )Úsdm_groebnerÚsdm_nf_moraNc                 óP   •— g | ]"}‰j                              |‰j        ¦  «        ‘Œ#S r?   ©r   Ú_vector_to_sdmr@  r4   s     €r   r”   z/SubModulePolyRing._groebner.<locals>.<listcomp>y  s-   ø€ ÐLÐLÐL¸Q�”×)Ò)¨!¨T¬ZÑ8Ô8ÐLÐLÐLr   T©Úextendedc                 óP   •— g | ]"}‰j                              |‰j        ¦  «        ‘Œ#S r?   rH  r4   s     €r   r”   z/SubModulePolyRing._groebner.<locals>.<listcomp>~  s-   ø€ ÐYÐYÐYÈ!˜dœi×6Ò6°q¸$¼*ÑEÔEÐYÐYÐYr   )
Úsympy.polys.distributedmodulesrE  rF  rB  r!   r@  r   rÈ   r‚   rA  )r   rK  rE  rF  ÚgbÚgbes   `     r   Ú	_groebnerzSubModulePolyRing._groebnert  sø   ø€ àLÐLÐLÐLÐLÐLÐLÐLØŒ9Ð ÐØ"�lØLÐLÐLÐLÀ$Ä)ÐLÑLÔLØ˜TœZ¨¬¬ÀðGñ Gô G‰GˆB�õ #(¨¡)¤)­U°3©Z¬ZÐˆDŒH�d”iØŒ8ÐÝ˜\˜\ØYÐYÐYÐYÈtÌyÐYÑYÔYØ˜DœJ¨¬	¬ñ7ô 7ñ 8ô 8ˆDŒHð ð 	Ø”8˜TœYÐ&Ð&à”8ˆOr   c                 ó²   ‡ — |s ˆ fd„‰                       ¦   «         D ¦   «         S ‰                       d¬¦  «        \  }}ˆ fd„|D ¦   «         ˆ fd„|D ¦   «         fS )z)Returns a standard basis in element form.c                 ó†   •— g | ]=}t          ‰t          ‰j                             |‰j        ¦  «        ¦  «        ¦  «        ‘Œ>S r?   )r~   r‚   r   Ú_sdm_to_vectorr¦   r4   s     €r   r”   z3SubModulePolyRing._groebner_vec.<locals>.<listcomp>ˆ  sV   ø€ ð /ð /ð /àõ & dÝ˜dœi×6Ò6°q¸$¼)ÑDÔDÑEÔEñGô Gð /ð /ð /r   TrJ  c                 óv   •— g | ]5}‰                      ‰j                             |‰j        ¦  «        ¦  «        ‘Œ6S r?   )r   r   rS  r¦   r4   s     €r   r”   z3SubModulePolyRing._groebner_vec.<locals>.<listcomp>Œ  sI   ø€ ð ð ð Øð —’˜dœi×6Ò6°q¸$¼)ÑDÔDÑEÔEð ð ð r   c                 ój   •— g | ]/}‰j                              |t          ‰j        ¦  «        ¦  «        ‘Œ0S r?   )r   rS  r±   r!   r4   s     €r   r”   z3SubModulePolyRing._groebner_vec.<locals>.<listcomp>Ž  s3   ø€ ÐJÐJÐJÀ�”×)Ò)¨!­S°´©^¬^Ñ<Ô<ÐJÐJÐJr   )rP  )r   rK  rN  rO  s   `   r   Ú_groebner_veczSubModulePolyRing._groebner_vec…  s¢   ø€ àð 	/ð/ð /ð /ð /à!Ÿ^š^Ñ-Ô-ð/ñ /ô /ð /ð —.’.¨$�.Ñ/Ô/‰ˆˆCðð ð ð Øðñ ô àJÐJÐJÐJÀcÐJÑJÔJðLð 	Lr   c                 óÄ   — ddl m}m}  || j                             || j        ¦  «        |                      ¦   «         | j        | j        j        ¦  «         |¦   «         k    S )Nr   )Úsdm_zerorF  )rM  rX  rF  r   rI  r@  rP  rÈ   )r   r6   rX  rF  s       r   rê   zSubModulePolyRing._contains�  sk   € ØHÐHÐHÐHÐHÐHÐHÐHØˆ{˜4œ9×3Ò3°A°t´zÑBÔBØŸ>š>Ñ+Ô+¨T¬Z¸¼¼ñHô HàˆH‰JŒJòð 	r   c                 ój  ‡‡— t          | j        ¦  «        }| j        Š| j                             d¦  «        Š| j                             d¦  «        }| j                             ‰|z   ¦  «        }g }t          | j        ¦  «        D ]|\  }}dg‰|z   z  }t          |¦  «        D ]
\  }}	|	||<   Œt          |¦  «        D ]}||k    r|n‰|‰|z   <   Œt          |t          |¦  «        ¦  «        }| 
                    |¦  «         Œ} |j        |dddœŽ}
|
                     ¦   «         }ˆˆfd„|D ¦   «         }|S )z-Compute syzygies. See [SCA, algorithm 2.5.4].r   r4  ÚilexF©r@  r<  c                 ój   •— g | ]/}t          ˆfd „|d‰…         D ¦   «         ¦  «        ¯%|‰d…         ‘Œ0S )c              3   ó$   •K  — | ]
}|‰k    V — Œd S r   r?   )r5   r�   Úzeros     €r   r7   z9SubModulePolyRing._syzygies.<locals>.<listcomp>.<genexpr>²  s'   øè è € Ð%?Ð%?°A a¨4¢iÐ%?Ð%?Ð%?Ð%?Ð%?Ð%?r   Nr8   )r5   r6   rñ   r^  s     €€r   r”   z/SubModulePolyRing._syzygies.<locals>.<listcomp>²  sK   ø€ Ð@Ð@Ð@˜¥#Ð%?Ð%?Ð%?Ð%?¸¸2¸A¸2¼Ð%?Ñ%?Ô%?Ñ"?Ô"?Ð@ˆa���ŒeÐ@Ð@Ð@r   )r±   r!   r¦   r   r   rÒ   Ú	enumeraterº   r~   r‚   Úappendr"   rV  )r   ÚkÚoneÚRkrÚnewgensÚjÚfr^   r¸   ÚvrÕ   ÚGÚG0rñ   r^  s                @@r   rí   zSubModulePolyRing._syzygies–  s]  øø€ õ �”	‰NŒNˆØŒIˆØŒy× Ò  Ñ#Ô#ˆØŒi×Ò Ñ"Ô"ˆØŒi×#Ò# A¨¡EÑ*Ô*ˆØˆÝ˜dœiÑ(Ô(ð 	ð 	‰DˆAˆqØ��Q˜‘U‘ˆAÝ! !™œð ð ‘��1Ø��!‘�Ý˜1‘X”Xð 3ð 3�Ø"# q¢& &˜3˜3¨d��!�a‘%‘�Ý! #¥u¨Q¡x¤xÑ0Ô0ˆAØ�NŠN˜1ÑÔÐÐð ˆCŒM˜7¨&°eÐ<Ð<Ð<ˆð �OŠOÑÔˆð AÐ@Ð@Ð@Ð@˜QÐ@Ñ@Ô@ˆð ˆ	r   c                 ó  ‡ ‡—  ‰ j                              ‰ j        ¦  «        j        ‰f‰ j        z   Ž }|                     dd¬¦  «        }|                     ¦   «         }ˆ fd„|D ¦   «         d         Šˆfd„‰dd…         D ¦   «         S )	z4Expression in terms of generators. See [SCA, 2.8.1].rZ  Fr[  c                 óT   •— g | ]$}‰j                              |d          ¦  «        ¯"|‘Œ%S r  )r   Úis_unitr4   s     €r   r”   z=SubModulePolyRing._in_terms_of_generators.<locals>.<listcomp>¿  s2   ø€ Ð5Ð5Ð5�1˜TœY×.Ò.¨q°¬tÑ4Ô4Ð5ˆQÐ5Ð5Ð5r   r   c                 ó(   •— g | ]}| ‰d          z  ‘ŒS r  r?   )r5   r6   r*   s     €r   r”   z=SubModulePolyRing._in_terms_of_generators.<locals>.<listcomp>À  s#   ø€ Ð'Ð'Ð'˜A���1�Q”4‘Ð'Ð'Ð'r   r4  N)r   rÒ   r¦   r"   r!   r  rV  )r   r*   r   ÚSrh  s   ``   r   rï   z)SubModulePolyRing._in_terms_of_generators·  sœ   øø€ ð 7ˆDŒI×!Ò! $¤)Ñ,Ô,Ô6¸!¸ÀÄ	Ñ9IÐKˆØ�OŠOØ˜eð ñ %ô %ˆà�OŠOÑÔˆà5Ð5Ð5Ð5˜Ð5Ñ5Ô5°aÔ8ˆØ'Ð'Ð'Ð'  1 2 2¤Ð'Ñ'Ô'Ð'r   Nc           
      ó  — ddl m} |€|}| j                             | j                              || j                             || j        ¦  «        |                      ¦   «         | j        | j        j	        ¦  «        | j
        ¦  «        ¦  «        S )zå
        Reduce the element ``x`` of our container modulo ``self``.

        This applies the normal form ``NF`` to ``x``. If ``NF`` is passed
        as none, the default Mora normal form is used (which is not unique!).
        r   )rF  )rM  rF  r­   r   r   rS  rI  r@  rP  rÈ   r¦   )r   r6   ÚNFrF  s       r   r  z SubModulePolyRing.reduce_elementÂ  s“   € ð 	?Ð>Ð>Ð>Ð>Ð>Øˆ:ØˆBØŒ~×%Ò% d¤i×&>Ò&>¸r¸rØŒI×$Ò$ Q¨¬
Ñ3Ô3°T·^²^Ñ5EÔ5EØŒJ˜œ	œñ@'ô @'ð ŒIñ'ô 'ñ ô ð 	r   c                 ó  ‡ ‡‡— ‰ j         Š|j         }‰ j        Šˆfd„t          ‰¦  «        D ¦   «         }t          ‰¦  «        D ]}d||         |<   d||         ‰|z   <   Œˆfd„‰D ¦   «         }ˆfd„|D ¦   «         } ‰ j                             d‰z  ¦  «        j        ||z   |z   Ž                      ¦   «         }ˆˆ fd„|D ¦   «         }	 ‰ j        j        ˆfd„|	D ¦   «         Ž }
ˆˆfd„|	D ¦   «         }ˆˆfd	„|	D ¦   «         }|r|
||fS |
S )
Nc                 ó"   •— g | ]}d gd‰z  z  ‘ŒS )r   é   r?   )r5   Ú_rñ   s     €r   r”   z0SubModulePolyRing._intersect.<locals>.<listcomp>Ö  s#   ø€ Ð*Ð*Ð*˜Aˆqˆc�1�Q‘3‰iÐ*Ð*Ð*r   r4  c                 ó<   •— g | ]}t          |¦  «        d g‰z  z   ‘ŒS r  ©Úlist)r5   rf  rñ   s     €r   r”   z0SubModulePolyRing._intersect.<locals>.<listcomp>Ú  s)   ø€ Ð*Ð*Ð* !�d�1‰gŒg˜˜˜A™‰oÐ*Ð*Ð*r   c                 ó<   •— g | ]}d g‰z  t          |¦  «        z   ‘ŒS r  rv  )r5   Úhrñ   s     €r   r”   z0SubModulePolyRing._intersect.<locals>.<listcomp>Û  s)   ø€ Ð*Ð*Ð* !ˆqˆc�!‰e•d˜1‘g”g‰oÐ*Ð*Ð*r   rs  c                 óZ   •— g | ]'}t          ˆfd „|d‰…         D ¦   «         ¦  «        ¯%|‘Œ(S )c              3   ó8   •K  — | ]}|‰j         j        k    V — Œd S r   ©r   r^  ©r5   r�   r   s     €r   r7   z:SubModulePolyRing._intersect.<locals>.<listcomp>.<genexpr>Ý  s,   øè è € Ð(LÐ(LÀ¨¨d¬i¬nÒ)<Ð(LÐ(LÐ(LÐ(LÐ(LÐ(Lr   N)rš   )r5   r6   rñ   r   s     €€r   r”   z0SubModulePolyRing._intersect.<locals>.<listcomp>Ý  sC   ø€ ÐMÐMÐM˜¥SÐ(LÐ(LÐ(LÐ(LÀaÈÈÈÄeÐ(LÑ(LÔ(LÑ%LÔ%LÐM�1ÐMÐMÐMr   c              3   ó@   •K  — | ]}d „ |d‰…         D ¦   «         V — ŒdS )c                 ó   — g | ]}| ‘ŒS r?   r?   )r5   r�   s     r   r”   z:SubModulePolyRing._intersect.<locals>.<genexpr>.<listcomp>Þ  s   € Ð)<Ð)<Ð)<°¨1¨"Ð)<Ð)<Ð)<r   Nr?   )r5   r6   rñ   s     €r   r7   z/SubModulePolyRing._intersect.<locals>.<genexpr>Þ  s:   øè è € Ð(NÐ(NÀÐ)<Ð)<°a¸¸¸´eÐ)<Ñ)<Ô)<Ð(NÐ(NÐ(NÐ(NÐ(NÐ(Nr   c                 óD   •— g | ]}|‰‰t          ‰¦  «        z   …         ‘ŒS r?   ©r±   ©r5   r6   Úfirñ   s     €€r   r”   z0SubModulePolyRing._intersect.<locals>.<listcomp>ß  s,   ø€ Ð3Ð3Ð3 a��1�Q�˜R™œ‘[�=Ô!Ð3Ð3Ð3r   c                 óD   •— g | ]}|‰t          ‰¦  «        z   d …         ‘ŒS r   r�  r‚  s     €€r   r”   z0SubModulePolyRing._intersect.<locals>.<listcomp>à  s+   ø€ Ð2Ð2Ð2 Q��1•s˜2‘w”w‘;�<�<”Ð2Ð2Ð2r   )r!   r¦   rº   r   rÒ   r"   rí   r­   )r   r&   Ú	relationsÚhiÚcira  ÚdiÚeiÚsyzÚnonzeroÚresÚreln1Úreln2rƒ  rñ   s   `            @@r   ró   zSubModulePolyRing._intersectÑ  sk  øøø€ àŒYˆØŒZˆØŒIˆØ*Ð*Ð*Ð*¥ q¡¤Ð*Ñ*Ô*ˆÝ�q‘”ð 	ð 	ˆAØˆBˆqŒE�!‰HØˆBˆqŒE�!�a‘%‰LˆLØ*Ð*Ð*Ð* rÐ*Ñ*Ô*ˆØ*Ð*Ð*Ð* rÐ*Ñ*Ô*ˆØ2ˆdŒi×#Ò# A a¡CÑ(Ô(Ô2°R¸"±W¸r±\ÐC×MÒMÑOÔOˆØMÐMÐMÐMÐM˜cÐMÑMÔMˆØ&ˆdŒnÔ&Ð(NÐ(NÐ(NÐ(NÀgÐ(NÑ(NÔ(NÐOˆØ3Ð3Ð3Ð3Ð3¨7Ð3Ñ3Ô3ˆØ2Ð2Ð2Ð2Ð2¨'Ð2Ñ2Ô2ˆØð 	%Ø˜˜uÐ$Ð$Øˆ
r   c                 óü  ‡ ‡‡— |rt          |j        ¦  «        dk    rt          ‚t          |j        ¦  «        dk    r‰ j                             d¦  «        S t          |j        ¦  «        dk    rít          |j        d         ¦  «        dgz   }d„ ‰ j        D ¦   «         } ‰ j                             ‰ j        dz   ¦  «        j        |g|z   dddœŽ}|s- ‰ j        j        ˆ fd„| 	                    ¦   «         D ¦   «         Ž S | 	                    d¬	¦  «        \  ŠŠˆ fd
„t          ‰¦  «        D ¦   «         } ‰ j        j        ˆfd„|D ¦   «         Ž ˆfd„|D ¦   «         fS t          d„ ˆ fd„|j        D ¦   «         ¦  «        S )Nr4  r   c                 ó4   — g | ]}t          |¦  «        d gz   ‘ŒS r  rv  r‘   s     r   r”   z6SubModulePolyRing._module_quotient.<locals>.<listcomp>ò  s$   € Ð3Ð3Ð3 A•$�q‘'”'˜Q˜C‘-Ð3Ð3Ð3r   rZ  Fr[  c                 óf   •— g | ]-}t          ˆfd „|dd…         D ¦   «         ¦  «        ¯%|d         ‘Œ.S )c              3   ó8   •K  — | ]}|‰j         j        k    V — Œd S r   r|  r}  s     €r   r7   z@SubModulePolyRing._module_quotient.<locals>.<listcomp>.<genexpr>ø  s,   øè è € Ð,QÐ,QÀQ¨Q°$´)´.Ò-@Ð,QÐ,QÐ,QÐ,QÐ,QÐ,Qr   Nrm   r8   r4   s     €r   r”   z6SubModulePolyRing._module_quotient.<locals>.<listcomp>÷  s]   ø€ ð )Sð )Sð )S°1Ý),Ð,QÐ,QÐ,QÐ,QÈ!ÈCÈRÈCÌ&Ð,QÑ,QÔ,QÑ)QÔ)Qð)S¨¨2¬ð )Sð )Sð )Sr   TrJ  c                 ó`   •— g | ]*\  }}t          ˆfd „|dd…         D ¦   «         ¦  «        ¯(|‘Œ+S )c              3   ó8   •K  — | ]}|‰j         j        k    V — Œd S r   r|  r}  s     €r   r7   z@SubModulePolyRing._module_quotient.<locals>.<listcomp>.<genexpr>ü  s,   øè è € ÐCÐC°q˜q D¤I¤NÒ2ÐCÐCÐCÐCÐCÐCr   Nrm   r8   )r5   r¸   r6   r   s      €r   r”   z6SubModulePolyRing._module_quotient.<locals>.<listcomp>û  s]   ø€ ð Eð Eð E¡  AÝÐCÐCÐCÐC¸A¸c¸r¸c¼FÐCÑCÔCÑCÔCðE˜1ð Eð Eð Er   c                 ó,   •— g | ]}‰|         d          ‘ŒS )rm   r?   )r5   r¸   rh  s     €r   r”   z6SubModulePolyRing._module_quotient.<locals>.<listcomp>ý  s!   ø€ Ð)DÐ)DÐ)D°q¨!¨A¬$¨r¬(Ð)DÐ)DÐ)Dr   c                 óD   •— g | ]}d „ ‰|         dd…         D ¦   «         ‘ŒS )c                 ó   — g | ]}| ‘ŒS r?   r?   r‘   s     r   r”   zASubModulePolyRing._module_quotient.<locals>.<listcomp>.<listcomp>þ  s   € Ð/Ð/Ð/ ˜1˜"Ð/Ð/Ð/r   r4  Nr?   )r5   r¸   ÚRs     €r   r”   z6SubModulePolyRing._module_quotient.<locals>.<listcomp>þ  s4   ø€ ÐAÐAÐA°AÐ/Ð/ a¨¤d¨1¨2¨2¤hÐ/Ñ/Ô/ÐAÐAÐAr   c                 ó,   — |                       |¦  «        S r   )rý   )r6   r�   s     r   r2  z4SubModulePolyRing._module_quotient.<locals>.<lambda>  s   €  1§;¢;¨q¡>¤>€ r   c              3   ór   •K  — | ]1}‰                      ‰j                             |¦  «        ¦  «        V — Œ2d S r   )rõ   r­   r"   r4   s     €r   r7   z5SubModulePolyRing._module_quotient.<locals>.<genexpr>  sA   øè è € ÐTÐTÀAˆT×"Ò" 4¤>×#;Ò#;¸AÑ#>Ô#>Ñ?Ô?ÐTÐTÐTÐTÐTÐTr   )r±   r!   r   r   rH   rw  rÒ   r¦   r"   rV  r_  r   )	r   r&   r…  Úg1Úgir   Úindicesrh  r˜  s	   `      @@r   rõ   z"SubModulePolyRing._module_quotientå  sì  øøø€ àð 	&�˜UœZ™œ¨AÒ-Ð-Ý%Ð%ÝˆuŒz‰?Œ?˜aÒÐØ”9—?’? 1Ñ%Ô%Ð%Ý�”‰_Œ_ Ò!Ð!õ �e”j ”mÑ$Ô$¨ sÑ*ˆBØ3Ð3¨¬Ð3Ñ3Ô3ˆBà>�”	×%Ò% d¤i°!¡mÑ4Ô4Ô>À"ÀÈÁØ28¸eðEð Eð EˆAàð CØ&�t”y”ð )Sð )Sð )Sð )S¸¿ºÑ8IÔ8Ið )Sñ )Sô )Sð Tð Tð —’°�Ñ5Ô5‘��1ðEð Eð Eð E­°1©¬ð Eñ Eô E�à'˜œ	œÐ)DÐ)DÐ)DÐ)D¸GÐ)DÑ)DÔ)DÐEØAÐAÐAÐA¸ÐAÑAÔAðCð Cõ
 Ð1Ð1ØTÐTÐTÐTÈÌÐTÑTÔTñVô Vð 	Vr   )r>  T)Fr   )rM   rN   rO   rP   r   r=   rP  rV  rê   rí   rï   r  ró   rõ   r?   r   r   rÊ   rÊ   R  sÝ   € € € € € ðð ð&ð ð ð ð-ð -ð -ð
ð ð ð ð"	Lð 	Lð 	Lð 	Lðð ð ðð ð ðB	(ð 	(ð 	(ðð ð ð ðð ð ð ð(Vð Vð Vð Vð Vð Vr   rÊ   c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )rÚ   a  
    Class for submodules of free modules over quotient rings.

    Do not instantiate this. Instead use the submodule methods.

    >>> from sympy.abc import x, y
    >>> from sympy import QQ
    >>> M = (QQ.old_poly_ring(x, y)/[x**2 - y**2]).free_module(2).submodule([x, x + y])
    >>> M
    <[x + <x**2 - y**2>, x + y + <x**2 - y**2>]>
    >>> M.contains([y**2, x**2 + x*y])
    True
    >>> M.contains([x, y])
    False

    Attributes:

    - quot - the subquotient of `R^n/IR^n` generated by lifts of our generators
    c                 ó”   ‡ — t                                ‰ ||¦  «          ‰ j        j        j        ˆ fd„‰ j        D ¦   «         Ž ‰ _        d S )Nc                 óD   •— g | ]}‰j                              |¦  «        ‘ŒS r?   )r­   rÝ   r4   s     €r   r”   z2SubModuleQuotientRing.__init__.<locals>.<listcomp>  s)   ø€ Ð8Ð8Ð8¨ˆdŒn×!Ò! !Ñ$Ô$Ð8Ð8Ð8r   )r¬   r   r­   rÔ   r"   r!   rä   s   `  r   r   zSubModuleQuotientRing.__init__  sN   ø€ Ý×Ò˜4  yÑ1Ô1Ð1Ø1�D”NÔ'Ô1Ø8Ð8Ð8Ð8¨d¬iÐ8Ñ8Ô8ð:ˆŒ	ˆ	ˆ	r   c                 óf   — | j                              | j                             |¦  «        ¦  «        S r   )rÔ   rê   r­   rÝ   r-   s     r   rê   zSubModuleQuotientRing._contains   s(   € ØŒy×"Ò" 4¤>×#6Ò#6°tÑ#<Ô#<Ñ=Ô=Ð=r   c                 óN   ‡ — ˆ fd„‰ j                              ¦   «         D ¦   «         S )Nc                 óF   •— g | ]}t          ˆfd „|D ¦   «         ¦  «        ‘ŒS )c              3   ób   •K  — | ])}‰j                              |‰j        j         ¦  «        V — Œ*d S r   ©r   r   rÔ   r}  s     €r   r7   z=SubModuleQuotientRing._syzygies.<locals>.<listcomp>.<genexpr>$  s9   øè è € ÐFÐF¸q�d”i×'Ò'¨¨4¬9¬>Ñ:Ô:ÐFÐFÐFÐFÐFÐFr   r‰   r4   s     €r   r”   z3SubModuleQuotientRing._syzygies.<locals>.<listcomp>$  sF   ø€ ð 0ð 0ð 0Øõ ÐFÐFÐFÐFÀAÐFÑFÔFÑFÔFð 0ð 0ð 0r   )rÔ   rí   rB   s   `r   rí   zSubModuleQuotientRing._syzygies#  s<   ø€ ð0ð 0ð 0ð 0Øœ×,Ò,Ñ.Ô.ð0ñ 0ô 0ð 	0r   c                 ó€   ‡ — ˆ fd„‰ j                              ‰ j                             |¦  «        ¦  «        D ¦   «         S )Nc                 óZ   •— g | ]'}‰j                              |‰j        j         ¦  «        ‘Œ(S r?   r¥  r4   s     €r   r”   zASubModuleQuotientRing._in_terms_of_generators.<locals>.<listcomp>(  sA   ø€ ð Jð Jð J¸�”	×!Ò! ! T¤Y¤^Ñ4Ô4ð Jð Jð Jr   )rÔ   rï   r­   rÝ   r-   s   ` r   rï   z-SubModuleQuotientRing._in_terms_of_generators'  sV   ø€ ðJð Jð Jð JØŒI×-Ò-¨d¬n×.AÒ.AÀ$Ñ.GÔ.GÑHÔHðJñ Jô Jð 	Jr   N)rM   rN   rO   rP   r   rê   rí   rï   r?   r   r   rÚ   rÚ     s_   € € € € € ðð ð(:ð :ð :ð
>ð >ð >ð0ð 0ð 0ðJð Jð Jð Jð Jr   rÚ   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚQuotientModuleElementzElement of a quotient module.c                 óF   — | j         j                             ||z
  ¦  «        S )zEquality comparison.)rU   r$  r.   rX   s      r   re   zQuotientModuleElement.eq3  s   € àŒ{Ô(×1Ò1°"°r±'Ñ:Ô:Ð:r   c                 ód   — t          | j        ¦  «        dz   t          | j        j        ¦  «        z   S )Nz + )rª   rV   rU   r$  rB   s    r   rœ   zQuotientModuleElement.__repr__7  s'   € Ý�D”I‰Œ Ñ&­¨d¬kÔ.GÑ)HÔ)HÑHÐHr   N)rM   rN   rO   rP   re   rœ   r?   r   r   r©  r©  0  s=   € € € € € Ø'Ð'ð;ð ;ð ;ðIð Ið Ið Ið Ir   r©  c                   óH   — e Zd ZdZeZd„ Zd„ Zd„ Zd„ Z	d„ Z
dd„Zd	„ Zd
„ ZdS )r½   a  
    Class for quotient modules.

    Do not instantiate this directly. For subquotients, see the
    SubQuotientModule class.

    Attributes:

    - base - the base module we are a quotient of
    - killed_module - the submodule used to form the quotient
    - rank of the base
    c                 óÂ   — t                                | |¦  «         |                     |¦  «        st          |›d|›�¦  «        ‚|| _        || _        |j        | _        d S )Nz is not a submodule of )r   r   r<   rú   r%  r$  r¦   )r   r   r%  r"   s       r   r   zQuotientModule.__init__K  sb   € Ý�Š˜˜dÑ#Ô#Ð#Ø× Ò  Ñ+Ô+ð 	PÝ¸i¸i¸iÈÈÐNÑOÔOÐOØˆŒ	Ø&ˆÔØ”IˆŒ	ˆ	ˆ	r   c                 óZ   — t          | j        ¦  «        dz   t          | j        ¦  «        z   S )Nú/)rª   r%  r$  rB   s    r   rœ   zQuotientModule.__repr__S  s%   € Ý�D”I‰Œ Ñ$¥t¨DÔ,>Ñ'?Ô'?Ñ?Ð?r   c                 ó"   — | j         | j        k    S )a¨  
        Return True if ``self`` is a zero module.

        This happens if and only if the base module is the same as the
        submodule being killed.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2)
        >>> (F/[(1, 0)]).is_zero()
        False
        >>> (F/[(1, 0), (0, 1)]).is_zero()
        True
        )r%  r$  rB   s    r   rC   zQuotientModule.is_zeroV  s   € ð$ Œy˜DÔ.Ò.Ð.r   c                 óÎ   — t          |t          ¦  «        r/| j        |j        k    o| j                             |j        ¦  «        S t          |t
          ¦  «        r|j        | k    S dS )ah  
        Return True if ``other`` is a submodule of ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> Q = QQ.old_poly_ring(x).free_module(2) / [(x, x)]
        >>> S = Q.submodule([1, 0])
        >>> Q.is_submodule(S)
        True
        >>> S.is_submodule(Q)
        False
        F)r   r½   r$  r%  r<   r  r­   r%   s     r   r<   zQuotientModule.is_submodulej  sh   € õ  �e�^Ñ,Ô,ð 	3ØÔ%¨Ô)<Ò<ð 3Ø”	×&Ò& u¤zÑ2Ô2ð3å�eÕ.Ñ/Ô/ð 	+Ø”? dÒ*Ð*Øˆur   c                 ó   — t          || fi |¤ŽS )ad  
        Generate a submodule.

        This is the same as taking a quotient of a submodule of the base
        module.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> Q = QQ.old_poly_ring(x).free_module(2) / [(x, x)]
        >>> Q.submodule([x, 0])
        <[x, 0] + <[x, x]>>
        )r  rË   s      r   r"   zQuotientModule.submodule�  s   € õ  !  tÐ4Ð4¨tÐ4Ð4Ð4r   Nc                 óB  — t          |t          ¦  «        rc|j        | u r|S | j                             |j        j        ¦  «        r-t          | | j                             |j        ¦  «        ¦  «        S t          ‚t          | | j                             |¦  «        ¦  «        S )a°  
        Convert ``elem`` into the internal representation.

        This method is called implicitly whenever computations involve elements
        not in the internal representation.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> F = QQ.old_poly_ring(x).free_module(2) / [(1, 2), (1, x)]
        >>> F.convert([1, 0])
        [1, 0] + <[1, 2], [1, x]>
        )	r   r©  rU   r$  r<   r%  r   rV   r
   r   s      r   r   zQuotientModule.convert“  s�   € õ  �dÕ1Ñ2Ô2ð 	!ØŒ{˜dÐ"Ð"Ø�ØÔ!×.Ò.¨t¬{Ô/HÑIÔIð QÝ,¨T°4´9×3DÒ3DÀTÄYÑ3OÔ3OÑPÔPÐPÝ Ð Ý$ T¨4¬9×+<Ò+<¸TÑ+BÔ+BÑCÔCÐCr   c                 ó”   — | j                              ¦   «                              | j        ¦  «                             | j        ¦  «        S )av  
        Return the identity homomorphism on ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> M = QQ.old_poly_ring(x).free_module(2) / [(1, 2), (1, x)]
        >>> M.identity_hom()
        Matrix([
        [1, 0], : QQ[x]**2/<[1, 2], [1, x]> -> QQ[x]**2/<[1, 2], [1, x]>
        [0, 1]])
        )r%  rL   r.  r$  Úquotient_domainrB   s    r   rL   zQuotientModule.identity_hom«  sA   € ð Œy×%Ò%Ñ'Ô'×9Ò9ØÔñ ô  ß /¢°Ô0BÑ CÔ Cð	Dr   c                 ód   — | j                              ¦   «                              | j        ¦  «        S )aÒ  
        Return the quotient homomorphism to ``self``.

        That is, return a homomorphism representing the natural map from
        ``self.base`` to ``self``.

        Examples
        ========

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> M = QQ.old_poly_ring(x).free_module(2) / [(1, 2), (1, x)]
        >>> M.quotient_hom()
        Matrix([
        [1, 0], : QQ[x]**2 -> QQ[x]**2/<[1, 2], [1, x]>
        [0, 1]])
        r-  rB   s    r   r/  zQuotientModule.quotient_hom½  s0   € ð$ Œy×%Ò%Ñ'Ô'×9Ò9ØÔñ ô  ð 	 r   r   )rM   rN   rO   rP   r©  r   r   rœ   rC   r<   r"   r   rL   r/  r?   r   r   r½   r½   ;  s¬   € € € € € ðð ð "€Eðð ð ð@ð @ð @ð/ð /ð /ð(ð ð ð.5ð 5ð 5ð$Dð Dð Dð Dð0Dð Dð Dð$ ð  ð  ð  ð  r   r½   N)"rP   r   Ú	functoolsr   Úsympy.polys.agca.idealsr   Úsympy.polys.domains.fieldr   Úsympy.polys.orderingsr   r   Úsympy.polys.polyclassesr	   Úsympy.polys.polyerrorsr
   Úsympy.core.basicr   Úsympy.utilities.iterablesr   r   rS   r~   r¤   rÃ   rÎ   r¬   r  r9  r8  r6  rÊ   rÚ   r©  r½   r?   r   r   ú<module>r¿     sd  ððð ð( Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à )Ð )Ð )Ð )Ð )Ð )Ø +Ð +Ð +Ð +Ð +Ð +Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø %Ð %Ð %Ð %Ð %Ð %Ø .Ð .Ð .Ð .Ð .Ð .ðq"ð q"ð q"ð q"ð q"ñ q"ô q"ð q"ðh]ð ]ð ]ð ]ð ]ñ ]ô ]ð ]ðHð ð ð ð ˜ñ ô ð ð4e6ð e6ð e6ð e6ð e6�ñ e6ô e6ð e6ðP/5ð /5ð /5ð /5ð /5˜ñ /5ô /5ð /5ðd_'ð _'ð _'ð _'ð _'˜Zñ _'ô _'ð _'ðLL*ð L*ð L*ð L*ð L*�ñ L*ô L*ð L*ð^TNð TNð TNð TNð TN˜	ñ TNô TNð TNðn 
ˆ€Ø	ˆ€ðDð Dð Dð Dð D�,ñ Dô Dð DðqVð qVð qVð qVð qV˜	ñ qVô qVð qVðh#Jð #Jð #Jð #Jð #J˜Iñ #Jô #Jð #JðTIð Ið Ið Ið I˜Mñ Iô Ið IðU ð U ð U ð U ð U �Vñ U ô U ð U ð U ð U r   