# HG changeset patch
# User Martin Albrecht <martinralbrecht@googlemail.com>
# Date 1358326333 0
# Node ID cb7a2ea0589d9b8abd4dc77172a2ce4ee1ca515f
# Parent af66881f97b3ebac2b500a5e3eb65ef0d5b7b268
#13849 deprecate degrevlex
diff --git a/sage/crypto/mq/sr.py b/sage/crypto/mq/sr.py
a
|
b
|
|
1671 | 1671 | sage: sr = mq.SR(2, 1, 1, 4) |
1672 | 1672 | sage: sr.block_order() |
1673 | 1673 | Block term order with blocks: |
1674 | | (Degree reverse lexicographic term order of length 16, |
1675 | | Degree reverse lexicographic term order of length 16, |
1676 | | Degree reverse lexicographic term order of length 4) |
| 1674 | (Degree lexicographic term order of length 16, |
| 1675 | Degree lexicographic term order of length 16, |
| 1676 | Degree lexicographic term order of length 4) |
1677 | 1677 | |
1678 | 1678 | :: |
1679 | 1679 | |
… |
… |
|
1682 | 1682 | Polynomial Ring |
1683 | 1683 | Base Ring : Finite Field in a of size 2^4 |
1684 | 1684 | Size : 36 Variables |
1685 | | Block 0 : Ordering : degrevlex |
| 1685 | Block 0 : Ordering : deglex |
1686 | 1686 | Names : k200, k201, k202, k203, x200, x201, x202, x203, w200, w201, w202, w203, s100, s101, s102, s103 |
1687 | | Block 1 : Ordering : degrevlex |
| 1687 | Block 1 : Ordering : deglex |
1688 | 1688 | Names : k100, k101, k102, k103, x100, x101, x102, x103, w100, w101, w102, w103, s000, s001, s002, s003 |
1689 | | Block 2 : Ordering : degrevlex |
| 1689 | Block 2 : Ordering : deglex |
1690 | 1690 | Names : k000, k001, k002, k003 |
1691 | 1691 | """ |
1692 | 1692 | r = self.r |
… |
… |
|
1696 | 1696 | |
1697 | 1697 | T = None |
1698 | 1698 | for _n in range(n): |
1699 | | T = TermOrder('degrevlex', r*e + 3*r*c*e ) + T |
1700 | | |
1701 | | T += TermOrder('degrevlex', r*c*e) |
| 1699 | T = TermOrder('deglex', r*e + 3*r*c*e ) + T |
| 1700 | |
| 1701 | T += TermOrder('deglex', r*c*e) |
1702 | 1702 | |
1703 | 1703 | return T |
1704 | 1704 | |
… |
… |
|
1738 | 1738 | Polynomial Ring |
1739 | 1739 | Base Ring : Finite Field in a of size 2^4 |
1740 | 1740 | Size : 36 Variables |
1741 | | Block 0 : Ordering : degrevlex |
| 1741 | Block 0 : Ordering : deglex |
1742 | 1742 | Names : k200, k201, k202, k203, x200, x201, x202, x203, w200, w201, w202, w203, s100, s101, s102, s103 |
1743 | | Block 1 : Ordering : degrevlex |
| 1743 | Block 1 : Ordering : deglex |
1744 | 1744 | Names : k100, k101, k102, k103, x100, x101, x102, x103, w100, w101, w102, w103, s000, s001, s002, s003 |
1745 | | Block 2 : Ordering : degrevlex |
| 1745 | Block 2 : Ordering : deglex |
1746 | 1746 | Names : k000, k001, k002, k003 |
1747 | 1747 | """ |
1748 | 1748 | r = self.r |
diff --git a/sage/rings/polynomial/multi_polynomial_sequence.py b/sage/rings/polynomial/multi_polynomial_sequence.py
a
|
b
|
|
377 | 377 | Polynomial Ring |
378 | 378 | Base Ring : Finite Field of size 2 |
379 | 379 | Size : 20 Variables |
380 | | Block 0 : Ordering : degrevlex |
| 380 | Block 0 : Ordering : deglex |
381 | 381 | Names : k100, k101, k102, k103, x100, x101, x102, x103, w100, w101, w102, w103, s000, s001, s002, s003 |
382 | | Block 1 : Ordering : degrevlex |
| 382 | Block 1 : Ordering : deglex |
383 | 383 | Names : k000, k001, k002, k003 |
384 | 384 | """ |
385 | 385 | return self._ring |
diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx
a
|
b
|
|
294 | 294 | |
295 | 295 | :: |
296 | 296 | |
297 | | sage: R = BooleanPolynomialRing(3,'x',order='degrevlex') |
| 297 | sage: R = BooleanPolynomialRing(3,'x',order='deglex') |
298 | 298 | sage: R.term_order() |
299 | | Degree reverse lexicographic term order |
| 299 | Degree lexicographic term order |
300 | 300 | |
301 | 301 | TESTS:: |
302 | 302 | |
303 | | sage: P.<x,y> = BooleanPolynomialRing(2,order='degrevlex') |
304 | | sage: x > y |
305 | | True |
306 | | |
307 | | :: |
308 | | |
309 | | sage: P.<x0, x1, x2, x3> = BooleanPolynomialRing(4,order='degrevlex(2),degrevlex(2)') |
| 303 | sage: P.<x0, x1, x2, x3> = BooleanPolynomialRing(4,order='deglex(2),deglex(2)') |
310 | 304 | sage: x0 > x1 |
311 | 305 | True |
312 | 306 | sage: x2 > x3 |
… |
… |
|
377 | 371 | raise ValueError, "Only order keys " + \ |
378 | 372 | ', '.join(order_mapping.keys()) + " are supported." |
379 | 373 | |
| 374 | |
| 375 | if pb_order_code in (pbdp, pbblock_dp): |
| 376 | from sage.misc.superseded import deprecation |
| 377 | deprecation(13849, "using 'degrevlex' in Boolean polynomial rings is deprecated. If needed, reverse the order of variables manually and use 'degneglex'") |
| 378 | |
380 | 379 | if order.is_block_order(): |
381 | 380 | if pb_order_code is pblp: |
382 | | raise ValueError, "Only deglex and degrevlex are supported for block orders." |
| 381 | raise ValueError, "Only deglex and degneglex are supported for block orders." |
383 | 382 | elif pb_order_code is pbdlex: |
384 | 383 | pb_order_code = pbblock_dlex |
385 | 384 | elif pb_order_code is pbdp_asc: |
… |
… |
|
389 | 388 | for i in range(1, len(order.blocks())): |
390 | 389 | if order[0].name() != order[i].name(): |
391 | 390 | raise ValueError, "Each block must have the same order " + \ |
392 | | "type (deglex, degneglex or degrevlex) for block orders." |
| 391 | "type (deglex and degneglex) for block orders." |
393 | 392 | |
394 | 393 | if pb_order_code is pbdp: |
395 | 394 | for i from 0 <= i < n: |
… |
… |
|
504 | 503 | |
505 | 504 | TESTS:: |
506 | 505 | |
507 | | sage: P.<x,y,z> = BooleanPolynomialRing(3, order='dp') |
| 506 | sage: P.<x,y,z> = BooleanPolynomialRing(3, order='deglex') |
508 | 507 | sage: P.gen(0) |
509 | 508 | x |
510 | 509 | """ |
… |
… |
|
534 | 533 | sage: P.gens() |
535 | 534 | (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) |
536 | 535 | |
537 | | TESTS:: |
538 | | |
539 | | sage: P.<x,y,z> = BooleanPolynomialRing(3,order='degrevlex') |
540 | | sage: P.gens() |
541 | | (x, y, z) |
542 | 536 | """ |
543 | 537 | return tuple([new_BP_from_PBVar(self, |
544 | 538 | self._pbring.variable(self.pbind[i])) \ |
… |
… |
|
758 | 752 | sage: P(x) |
759 | 753 | x |
760 | 754 | |
761 | | Test conversion between 'degrevlex' and 'lex':: |
762 | | |
763 | | sage: B.<a,b,c> = BooleanPolynomialRing(order='lex') |
764 | | sage: P.<a,b,c> = BooleanPolynomialRing(order='degrevlex') |
765 | | sage: B(P('a')) |
766 | | a |
767 | | sage: P(B('a')) |
768 | | a |
769 | | |
770 | 755 | Test that #10797 is really fixed:: |
771 | 756 | |
772 | 757 | sage: B.<a,b,c,d,e,f> = BooleanPolynomialRing() |
… |
… |
|
904 | 889 | sage: p = x^3+2*x^2+x+1 |
905 | 890 | sage: P(p) |
906 | 891 | x |
907 | | |
908 | | Check that trac ticket #13202 is fixed: |
909 | | |
910 | | sage: B.<a,b,c,d> = BooleanPolynomialRing(order='degrevlex') |
911 | | sage: P.<c,d> = BooleanPolynomialRing(order='lex') |
912 | | sage: P(B(c)) |
913 | | c |
914 | 892 | """ |
915 | 893 | cdef int i |
916 | 894 | |
… |
… |
|
1525 | 1503 | |
1526 | 1504 | TESTS:: |
1527 | 1505 | |
1528 | | sage: P.<x,y,z> = BooleanPolynomialRing(3, order='dp') |
| 1506 | sage: P.<x,y,z> = BooleanPolynomialRing(3, order='deglex') |
1529 | 1507 | sage: P.variable(0) |
1530 | 1508 | x |
1531 | 1509 | """ |
… |
… |
|
1792 | 1770 | [z, x] |
1793 | 1771 | sage: sage.rings.polynomial.pbori.get_var_mapping(P, x^2) |
1794 | 1772 | [None, x] |
1795 | | |
1796 | | Check that ticket #13202 is fixed:: |
1797 | | |
1798 | | sage: B.<a,b,c,d> = BooleanPolynomialRing(order='degrevlex') |
1799 | | sage: P.<c,d> = BooleanPolynomialRing(order='lex') |
1800 | | sage: sage.rings.polynomial.pbori.get_var_mapping(B, P) |
1801 | | [c, d] |
1802 | 1773 | """ |
1803 | 1774 | |
1804 | 1775 | my_names = list(ring._names) # we need .index(.) |
… |
… |
|
3187 | 3158 | |
3188 | 3159 | :: |
3189 | 3160 | |
3190 | | sage: P.<x,y,z> = BooleanPolynomialRing(3, order='degrevlex') |
| 3161 | sage: P.<x,y,z> = BooleanPolynomialRing(3, order='deglex') |
3191 | 3162 | sage: p = x + z + x*y + y*z + x*y*z |
3192 | 3163 | sage: list(iter(p)) |
3193 | | [z*y*x, y*x, z*y, x, z] |
| 3164 | [x*y*z, x*y, y*z, x, z] |
3194 | 3165 | |
3195 | 3166 | TESTS:: |
3196 | 3167 | |
… |
… |
|
3837 | 3808 | |
3838 | 3809 | :: |
3839 | 3810 | |
3840 | | sage: P.<a,b,c> = BooleanPolynomialRing(3,order='degrevlex') |
| 3811 | sage: P.<a,b,c> = BooleanPolynomialRing(3,order='deglex') |
3841 | 3812 | sage: f = a + c*b |
3842 | 3813 | sage: f.monomials() |
3843 | | [c*b, a] |
| 3814 | [b*c, a] |
3844 | 3815 | sage: P.zero().monomials() |
3845 | 3816 | [] |
3846 | 3817 | """ |
… |
… |
|
3876 | 3847 | sage: f.terms() |
3877 | 3848 | [a, b*c] |
3878 | 3849 | |
3879 | | sage: P.<a,b,c> = BooleanPolynomialRing(3,order='degrevlex') |
| 3850 | sage: P.<a,b,c> = BooleanPolynomialRing(3,order='deglex') |
3880 | 3851 | sage: f = a + c*b |
3881 | 3852 | sage: f.terms() |
3882 | | [c*b, a] |
| 3853 | [b*c, a] |
3883 | 3854 | """ |
3884 | 3855 | return list(self) |
3885 | 3856 | |
… |
… |
|
4460 | 4431 | |
4461 | 4432 | EXAMPLE:: |
4462 | 4433 | |
4463 | | sage: B.<a,b,c,d> = BooleanPolynomialRing(4,order='degrevlex') |
| 4434 | sage: B.<a,b,c,d> = BooleanPolynomialRing(4,order='deglex') |
4464 | 4435 | sage: f = (a*b + 1)*(c + 1) |
4465 | 4436 | sage: f.reducible_by(d) |
4466 | 4437 | False |
… |
… |
|
5064 | 5035 | |
5065 | 5036 | EXAMPLES:: |
5066 | 5037 | |
5067 | | sage: B.<x,y,z> = BooleanPolynomialRing(order='degrevlex') |
| 5038 | sage: B.<x,y,z> = BooleanPolynomialRing(order='deglex') |
5068 | 5039 | sage: id = B.ideal((x + y)*(y + z), x*y*z) |
5069 | 5040 | sage: id._groebner_basis() |
5070 | | [z*x, y*x + z*y + y] |
| 5041 | [x*z, x*y + y*z + y] |
5071 | 5042 | |
5072 | 5043 | sage: B.<x,y,z> = BooleanPolynomialRing(order='deglex') |
5073 | 5044 | sage: id = B.ideal((x + y)*(y + z), x*y*z) |
diff --git a/sage/rings/polynomial/polynomial_ring_constructor.py b/sage/rings/polynomial/polynomial_ring_constructor.py
a
|
b
|
|
622 | 622 | (Degree lexicographic term order of length 3, |
623 | 623 | Degree lexicographic term order of length 2) |
624 | 624 | |
625 | | sage: R = BooleanPolynomialRing(3,'x',order='degrevlex') |
| 625 | sage: R = BooleanPolynomialRing(3,'x',order='degneglex') |
626 | 626 | sage: R.term_order() |
627 | | Degree reverse lexicographic term order |
| 627 | Degree negative lexicographic term order |
628 | 628 | |
629 | 629 | sage: BooleanPolynomialRing(names=('x','y')) |
630 | 630 | Boolean PolynomialRing in x, y |
… |
… |
|
634 | 634 | |
635 | 635 | TESTS:: |
636 | 636 | |
637 | | sage: P.<x,y> = BooleanPolynomialRing(2,order='degrevlex') |
| 637 | sage: P.<x,y> = BooleanPolynomialRing(2,order='deglex') |
638 | 638 | sage: x > y |
639 | 639 | True |
640 | 640 | |
641 | | sage: P.<x0, x1, x2, x3> = BooleanPolynomialRing(4,order='degrevlex(2),degrevlex(2)') |
| 641 | sage: P.<x0, x1, x2, x3> = BooleanPolynomialRing(4,order='deglex(2),deglex(2)') |
642 | 642 | sage: x0 > x1 |
643 | 643 | True |
644 | 644 | sage: x2 > x3 |