"""Tests for tools and arithmetics for monomials of distributed polynomials. """

from sympy.polys.monomialtools import (
    monomials, monomial_count,
    monomial_key, lex, grlex, grevlex,
    monomial_mul, monomial_div,
    monomial_gcd, monomial_lcm,
    monomial_max, monomial_min,
    monomial_divides,
    Monomial,
    InverseOrder, ProductOrder
)

from sympy.polys.polyerrors import ExactQuotientFailed

from sympy.abc import a, b, c, x, y, z
from sympy.utilities.pytest import raises

def test_monomials():
    assert sorted(monomials([], 0)) == [1]
    assert sorted(monomials([], 1)) == [1]
    assert sorted(monomials([], 2)) == [1]
    assert sorted(monomials([], 3)) == [1]

    assert sorted(monomials([x], 0)) == [1]
    assert sorted(monomials([x], 1)) == [1, x]
    assert sorted(monomials([x], 2)) == [1, x, x**2]
    assert sorted(monomials([x], 3)) == [1, x, x**2, x**3]

    assert sorted(monomials([x, y], 0)) == [1]
    assert sorted(monomials([x, y], 1)) == [1, x, y]
    assert sorted(monomials([x, y], 2)) == [1, x, y, x**2, y**2, x*y]
    assert sorted(monomials([x, y], 3)) == [1, x, y, x**2, x**3, y**2, y**3, x*y, x*y**2, y*x**2]

def test_monomial_count():
    assert monomial_count(2, 2) == 6
    assert monomial_count(2, 3) == 10

def test_lex_order():
    assert lex((1,2,3)) == (1,2,3)
    assert str(lex) == 'lex'

    assert lex((1,2,3)) == lex((1,2,3))

    assert lex((2,2,3)) > lex((1,2,3))
    assert lex((1,3,3)) > lex((1,2,3))
    assert lex((1,2,4)) > lex((1,2,3))

    assert lex((0,2,3)) < lex((1,2,3))
    assert lex((1,1,3)) < lex((1,2,3))
    assert lex((1,2,2)) < lex((1,2,3))

def test_grlex_order():
    assert grlex((1,2,3)) == (6, (1,2,3))
    assert str(grlex) == 'grlex'

    assert grlex((1,2,3)) == grlex((1,2,3))

    assert grlex((2,2,3)) > grlex((1,2,3))
    assert grlex((1,3,3)) > grlex((1,2,3))
    assert grlex((1,2,4)) > grlex((1,2,3))

    assert grlex((0,2,3)) < grlex((1,2,3))
    assert grlex((1,1,3)) < grlex((1,2,3))
    assert grlex((1,2,2)) < grlex((1,2,3))

    assert grlex((2,2,3)) > grlex((1,2,4))
    assert grlex((1,3,3)) > grlex((1,2,4))

    assert grlex((0,2,3)) < grlex((1,2,2))
    assert grlex((1,1,3)) < grlex((1,2,2))

def test_grevlex_order():
    assert grevlex((1,2,3)) == (6, (-3,-2,-1))
    assert str(grevlex) == 'grevlex'

    assert grevlex((1,2,3)) == grevlex((1,2,3))

    assert grevlex((2,2,3)) > grevlex((1,2,3))
    assert grevlex((1,3,3)) > grevlex((1,2,3))
    assert grevlex((1,2,4)) > grevlex((1,2,3))

    assert grevlex((0,2,3)) < grevlex((1,2,3))
    assert grevlex((1,1,3)) < grevlex((1,2,3))
    assert grevlex((1,2,2)) < grevlex((1,2,3))

    assert grevlex((2,2,3)) > grevlex((1,2,4))
    assert grevlex((1,3,3)) > grevlex((1,2,4))

    assert grevlex((0,2,3)) < grevlex((1,2,2))
    assert grevlex((1,1,3)) < grevlex((1,2,2))

    assert grevlex((0,1,1)) > grevlex((0,0,2))
    assert grevlex((0,3,1)) < grevlex((2,2,1))

def test_InverseOrder():
    ilex = InverseOrder(lex)
    igrlex = InverseOrder(grlex)

    assert ilex((1,2,3)) > ilex((2, 0, 3))
    assert igrlex((1, 2, 3)) < igrlex((0, 2, 3))
    assert str(ilex) == "ilex"
    assert str(igrlex) == "igrlex"

def test_ProductOrder():
    P = ProductOrder((grlex, lambda m: m[:2]), (grlex, lambda m: m[2:]))
    assert P((1, 3, 3, 4, 5)) > P((2, 1, 5, 5, 5))
    assert str(P) == "ProductOrder(grlex, grlex)"

def test_monomial_key():
    assert monomial_key() == lex

    assert monomial_key('lex') == lex
    assert monomial_key('grlex') == grlex
    assert monomial_key('grevlex') == grevlex

    raises(ValueError, "monomial_key('foo')")
    raises(ValueError, "monomial_key(1)")

def test_monomial_mul():
    assert monomial_mul((3,4,1), (1,2,0)) == (4,6,1)

def test_monomial_div():
    assert monomial_div((3,4,1), (1,2,0)) == (2,2,1)

def test_monomial_gcd():
    assert monomial_gcd((3,4,1), (1,2,0)) == (1,2,0)

def test_monomial_lcm():
    assert monomial_lcm((3,4,1), (1,2,0)) == (3,4,1)

def test_monomial_max():
    assert monomial_max((3,4,5), (0,5,1), (6,3,9)) == (6,5,9)

def test_monomial_min():
    assert monomial_min((3,4,5), (0,5,1), (6,3,9)) == (0,3,1)

def test_monomial_divides():
    assert monomial_divides((1,2,3), (4,5,6)) is True
    assert monomial_divides((1,2,3), (0,5,6)) is False

def test_Monomial():
    m = Monomial((3, 4, 1), (x, y, z))
    n = Monomial((1, 2, 0), (x, y, z))

    assert m.as_expr() == x**3*y**4*z
    assert n.as_expr() == x**1*y**2

    assert m.as_expr(a, b, c) == a**3*b**4*c
    assert n.as_expr(a, b, c) == a**1*b**2

    assert m.exponents == (3, 4, 1)
    assert m.gens == (x, y, z)

    assert n.exponents == (1, 2, 0)
    assert n.gens == (x, y, z)

    assert m == (3, 4, 1)
    assert n != (3, 4, 1)
    assert m != (1, 2, 0)
    assert n == (1, 2, 0)

    assert m[0] == m[-3] == 3
    assert m[1] == m[-2] == 4
    assert m[2] == m[-1] == 1

    assert n[0] == n[-3] == 1
    assert n[1] == n[-2] == 2
    assert n[2] == n[-1] == 0

    assert m[:2] == (3, 4)
    assert n[:2] == (1, 2)

    assert m*n == Monomial((4, 6, 1))
    assert m/n == Monomial((2, 2, 1))

    assert m*(1, 2, 0) == Monomial((4, 6, 1))
    assert m/(1, 2, 0) == Monomial((2, 2, 1))

    assert m.gcd(n) == Monomial((1, 2, 0))
    assert m.lcm(n) == Monomial((3, 4, 1))

    assert m.gcd((1, 2, 0)) == Monomial((1, 2, 0))
    assert m.lcm((1, 2, 0)) == Monomial((3, 4, 1))

    assert m**0 == Monomial((0, 0, 0))
    assert m**1 == m
    assert m**2 == Monomial((6, 8, 2))
    assert m**3 == Monomial((9,12, 3))

    raises(ExactQuotientFailed, "m/Monomial((5, 2, 0))")

[(97, 'sympy.polys.monomialtools.InverseOrder', 'InverseOrder', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (98, 'sympy.polys.monomialtools.InverseOrder', 'InverseOrder', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (106, 'sympy.polys.monomialtools.ProductOrder', 'ProductOrder', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (117, 'sympy.utilities.pytest.raises', 'raises', False, 'from sympy.utilities.pytest import raises\n'), (118, 'sympy.utilities.pytest.raises', 'raises', False, 'from sympy.utilities.pytest import raises\n'), (143, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (144, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (191, 'sympy.utilities.pytest.raises', 'raises', False, 'from sympy.utilities.pytest import raises\n'), (36, 'sympy.polys.monomialtools.monomial_count', 'monomial_count', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (37, 'sympy.polys.monomialtools.monomial_count', 'monomial_count', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (40, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (43, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (43, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (45, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (45, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (46, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (46, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (47, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (47, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (49, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (49, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (50, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (50, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (51, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (51, 'sympy.polys.monomialtools.lex', 'lex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (54, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (57, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (57, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (59, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (59, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (60, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (60, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (61, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (61, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (63, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (63, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (64, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (64, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (65, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (65, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (67, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (67, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (68, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (68, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (70, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (70, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (71, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (71, 'sympy.polys.monomialtools.grlex', 'grlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (74, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (77, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (77, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (79, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (79, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (80, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (80, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (81, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (81, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (83, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (83, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (84, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (84, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (85, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (85, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (87, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (87, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (88, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (88, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (90, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (90, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (91, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (91, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (93, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (93, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (94, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (94, 'sympy.polys.monomialtools.grevlex', 'grevlex', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (111, 'sympy.polys.monomialtools.monomial_key', 'monomial_key', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (113, 'sympy.polys.monomialtools.monomial_key', 'monomial_key', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (114, 'sympy.polys.monomialtools.monomial_key', 'monomial_key', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (115, 'sympy.polys.monomialtools.monomial_key', 'monomial_key', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (121, 'sympy.polys.monomialtools.monomial_mul', 'monomial_mul', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (124, 'sympy.polys.monomialtools.monomial_div', 'monomial_div', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (127, 'sympy.polys.monomialtools.monomial_gcd', 'monomial_gcd', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (130, 'sympy.polys.monomialtools.monomial_lcm', 'monomial_lcm', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (133, 'sympy.polys.monomialtools.monomial_max', 'monomial_max', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (136, 'sympy.polys.monomialtools.monomial_min', 'monomial_min', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (139, 'sympy.polys.monomialtools.monomial_divides', 'monomial_divides', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (140, 'sympy.polys.monomialtools.monomial_divides', 'monomial_divides', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (174, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (175, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (177, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (178, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (180, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (181, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (183, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (184, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (186, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (188, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (189, 'sympy.polys.monomialtools.Monomial', 'Monomial', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (20, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (21, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (22, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (23, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (25, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (26, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (27, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (28, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (30, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (31, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (32, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n'), (33, 'sympy.polys.monomialtools.monomials', 'monomials', False, 'from sympy.polys.monomialtools import monomials, monomial_count, monomial_key, lex, grlex, grevlex, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, Monomial, InverseOrder, ProductOrder\n')]