Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit e7653a3

Browse files
committed
Replace "from brial" with "from sage.rings.polynomial.pbori.brial"
1 parent f947293 commit e7653a3

17 files changed

+151
-151
lines changed

src/sage/rings/polynomial/multi_polynomial_sequence.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,8 @@ def eliminate_linear_variables(self, maxlength=Infinity, skip=None, return_reduc
12491249
This is called "massaging" in [BCJ2007]_.
12501250
"""
12511251
from sage.rings.polynomial.pbori.pbori import BooleanPolynomialRing
1252-
from brial import gauss_on_polys
1253-
from brial.ll import eliminate,ll_encode,ll_red_nf_redsb
1252+
from sage.rings.polynomial.pbori.brial import gauss_on_polys
1253+
from sage.rings.polynomial.pbori.brial.ll import eliminate,ll_encode,ll_red_nf_redsb
12541254

12551255
R = self.ring()
12561256

@@ -1534,7 +1534,7 @@ def reduced(self):
15341534
R = self.ring()
15351535

15361536
if isinstance(R, BooleanPolynomialRing):
1537-
from brial.interred import interred as inter_red
1537+
from sage.rings.polynomial.pbori.brial.interred import interred as inter_red
15381538
l = [p for p in self if not p==0]
15391539
l = sorted(inter_red(l, completely=True), reverse=True)
15401540
return PolynomialSequence(l, R, immutable=True)

src/sage/rings/polynomial/pbori/PyPolyBoRi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
Examples:
1010
11-
>>> from brial.frontend import *
11+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
1212
>>> r=declare_ring(["x0","x1","x2","y0","y1","y2"], globals())
1313
>>> x0>x1
1414
True

src/sage/rings/polynomial/pbori/addition.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def add_bits_old(bits):
88
"""Adds n bits
9-
>>> from brial import *
9+
>>> from sage.rings.polynomial.pbori.brial import *
1010
>>> r=Ring(10)
1111
>>> add_bits_old([r.variable(i) for i in xrange(3)])
1212
[x(0) + x(1) + x(2), x(0)*x(1) + x(0)*x(2) + x(1)*x(2)]
@@ -33,7 +33,7 @@ def add_bits_old(bits):
3333

3434
def add_bits(bits):
3535
"""Adds n bit variables, by Lucas theorem
36-
>>> from brial import *
36+
>>> from sage.rings.polynomial.pbori.brial import *
3737
>>> r=Ring(10)
3838
>>> add_bits([r.variable(i) for i in xrange(3)])
3939
[x(0) + x(1) + x(2), x(0)*x(1) + x(0)*x(2) + x(1)*x(2)]
@@ -59,7 +59,7 @@ def add_bits(bits):
5959
def add_bit_expressions(bit_expressions):
6060
"""Adds n bits, which can be arbitrary expressions, the first n variables of the ring are reversed for usage in this function.
6161
62-
>>> from brial import *
62+
>>> from sage.rings.polynomial.pbori.brial import *
6363
>>> r=Ring(20)
6464
>>> add_bit_expressions([r.variable(i) for i in xrange(10,13)])
6565
[x(10) + x(11) + x(12), x(10)*x(11) + x(10)*x(12) + x(11)*x(12)]
@@ -85,7 +85,7 @@ def add_bit_expressions(bit_expressions):
8585

8686
def add_words(words):
8787
"""def adds n words, this words are supposed to consists of list of their bits.
88-
>>> from brial import *
88+
>>> from sage.rings.polynomial.pbori.brial import *
8989
>>> r=Ring(1000)
9090
>>> add_words([[r.variable(100+i*3+j) for i in xrange(2)] for j in xrange(3)])
9191
[x(100) + x(101) + x(102), x(100)*x(101) + x(100)*x(102) + x(101)*x(102) + x(103) + x(104) + x(105), x(100)*x(101)*x(103) + x(100)*x(101)*x(104) + x(100)*x(101)*x(105) + x(100)*x(102)*x(103) + x(100)*x(102)*x(104) + x(100)*x(102)*x(105) + x(101)*x(102)*x(103) + x(101)*x(102)*x(104) + x(101)*x(102)*x(105) + x(103)*x(104) + x(103)*x(105) + x(104)*x(105), x(100)*x(101)*x(103)*x(104)*x(105) + x(100)*x(102)*x(103)*x(104)*x(105) + x(101)*x(102)*x(103)*x(104)*x(105)]
@@ -112,7 +112,7 @@ def add_words(words):
112112

113113
def multiply_by_addition(word_a, word_b):
114114
"""Multiply two words
115-
>>> from brial import Ring
115+
>>> from sage.rings.polynomial.pbori.brial import Ring
116116
>>> r=Ring(1000)
117117
>>> x = r.variable
118118
>>> n=7

src/sage/rings/polynomial/pbori/cnf.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, r, random_seed=16):
1414

1515
def zero_blocks(self, f):
1616
"""divides the zero set of f into blocks
17-
>>> from brial import *
17+
>>> from sage.rings.polynomial.pbori.brial import *
1818
>>> r = declare_ring(["x", "y", "z"], dict())
1919
>>> e = CNFEncoder(r)
2020
>>> e.zero_blocks(r.variable(0)*r.variable(1)*r.variable(2))
@@ -78,7 +78,7 @@ def get_val(var):
7878

7979
def clauses(self, f):
8080
"""
81-
>>> from brial import *
81+
>>> from sage.rings.polynomial.pbori.brial import *
8282
>>> r = declare_ring(["x", "y", "z"], dict())
8383
>>> e = CNFEncoder(r)
8484
>>> e.clauses(r.variable(0)*r.variable(1)*r.variable(2)) # doctest:+ELLIPSIS
@@ -102,7 +102,7 @@ def clauses(self, f):
102102

103103
def polynomial_clauses(self, f):
104104
"""
105-
>>> from brial import *
105+
>>> from sage.rings.polynomial.pbori.brial import *
106106
>>> r = declare_ring(["x", "y", "z"], dict())
107107
>>> e = CNFEncoder(r)
108108
>>> e.polynomial_clauses(r.variable(0)*r.variable(1)*r.variable(2))
@@ -141,7 +141,7 @@ def get_sign(val):
141141

142142
def dimacs_encode_polynomial(self, p):
143143
"""
144-
>>> from brial import *
144+
>>> from sage.rings.polynomial.pbori.brial import *
145145
>>> d=dict()
146146
>>> r = declare_ring(["x", "y", "z"], d)
147147
>>> e = CNFEncoder(r)
@@ -156,7 +156,7 @@ def dimacs_encode_polynomial(self, p):
156156

157157
def dimacs_cnf(self, polynomial_system):
158158
r"""
159-
>>> from brial import *
159+
>>> from sage.rings.polynomial.pbori.brial import *
160160
>>> r = declare_ring(["x", "y", "z"], dict())
161161
>>> e = CNFEncoder(r)
162162
>>> e.dimacs_cnf([r.variable(0)*r.variable(1)*r.variable(2)])
@@ -182,7 +182,7 @@ class CryptoMiniSatEncoder(CNFEncoder):
182182

183183
def dimacs_encode_polynomial(self, p):
184184
r"""
185-
>>> from brial import *
185+
>>> from sage.rings.polynomial.pbori.brial import *
186186
>>> d=dict()
187187
>>> r = declare_ring(["x", "y", "z"], d)
188188
>>> e = CryptoMiniSatEncoder(r)
@@ -216,7 +216,7 @@ def dimacs_encode_polynomial(self, p):
216216

217217
def dimacs_cnf(self, polynomial_system):
218218
r"""
219-
>>> from brial import *
219+
>>> from sage.rings.polynomial.pbori.brial import *
220220
>>> r = declare_ring(["x", "y", "z"], dict())
221221
>>> e = CryptoMiniSatEncoder(r)
222222
>>> e.dimacs_cnf([r.variable(0)*r.variable(1)*r.variable(2)])

src/sage/rings/polynomial/pbori/context.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FactoryContext(object):
2525
2626
Example:
2727
>>> r = Ring(1000)
28-
>>> from brial import Variable
28+
>>> from sage.rings.polynomial.pbori.brial import Variable
2929
>>> def var(idx): return Variable(idx, r)
3030
>>> with FactoryContext(Variable, var):
3131
... print Variable(17)
@@ -65,7 +65,7 @@ class RingContext(object):
6565
6666
Example:
6767
>>> r = Ring(1000)
68-
>>> from brial import Variable
68+
>>> from sage.rings.polynomial.pbori.brial import Variable
6969
>>> print Variable(17, r)
7070
x(17)
7171
>>> with RingContext(r):

src/sage/rings/polynomial/pbori/easy_polynomials.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def easy_linear_polynomials(p):
66
""" Get linear polynomials implied by given polynomial.
77
8-
>>> from brial.frontend import *
8+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
99
>>> easy_linear_polynomials(x(1)*x(2) + 1)
1010
[x(1) + 1, x(2) + 1]
1111
>>> easy_linear_polynomials(x(1)*x(2) + 0)
@@ -28,7 +28,7 @@ def easy_linear_polynomials_via_interpolation(p):
2828
""" Get linear polynomials implied by given polynomial using interpolation
2929
of the variety.
3030
31-
>>> from brial.frontend import *
31+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
3232
>>> easy_linear_polynomials_via_interpolation(x(1)*x(2) + 1)
3333
[x(1) + 1, x(2) + 1]
3434
>>> easy_linear_polynomials_via_interpolation(x(1)*x(2) + 0)

src/sage/rings/polynomial/pbori/fglm.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def fglm(I, from_ring, to_ring):
2525
converts *reduced* Groebner Basis in from_ring to a GroebnerBasis in to_ring.
2626
It acts independend of the global ring, which is restored at the end of the
2727
computation,
28-
>>> from brial.PyPolyBoRi import OrderCode
28+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import OrderCode
2929
>>> dp_asc = OrderCode.dp_asc
3030
>>> r=declare_ring(['x','y','z'],dict())
3131
>>> old_ring = r
@@ -44,9 +44,9 @@ def fglm(I, from_ring, to_ring):
4444
def vars_real_divisors(monomial, monomial_set):
4545
"""
4646
returns all elements of of monomial_set, which result multiplied by a variable in monomial.
47-
>>> from brial.PyPolyBoRi import OrderCode
47+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import OrderCode
4848
>>> dp_asc = OrderCode.dp_asc
49-
>>> from brial.PyPolyBoRi import Ring
49+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import Ring
5050
>>> r=Ring(1000)
5151
>>> x = r.variable
5252
>>> b=BooleSet([x(1)*x(2),x(2)])
@@ -60,7 +60,7 @@ def vars_real_divisors(monomial, monomial_set):
6060
def m_k_plus_one(completed_elements, variables):
6161
""" calculates $m_{k+1}$ from the FGLM algorithm as described in Wichmanns diploma thesis
6262
It would be nice to be able to efficiently extract the smallest term of a polynomial
63-
>>> from brial.PyPolyBoRi import OrderCode
63+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import OrderCode
6464
>>> dp_asc = OrderCode.dp_asc
6565
>>> r=Ring(1000)
6666
>>> x = r.variable

src/sage/rings/polynomial/pbori/frontend.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
>>> x(9999) + x(9999)
1818
0
1919
20-
>>> from brial.frontend import *
20+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
2121
>>> context = dict(globals())
2222
>>> polybori_start(context) # doctest: +ELLIPSIS
2323
ipbori...

src/sage/rings/polynomial/pbori/gbcore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def variety_size_from_gb(I):
387387

388388
def other_ordering_pre(I, option_set, kwds):
389389
"""
390-
>>> from brial.blocks import declare_ring
390+
>>> from sage.rings.polynomial.pbori.brial.blocks import declare_ring
391391
>>> r = declare_ring(['x0', 'x1', 'x2', 'x3', 'x4'], globals())
392392
>>> id = [x1*x3 + x1 + x2*x3 + x3 + x4, x0*x3 + x0 + x1*x2 + x2 + 1, x1*x3 + x1*x4 + x3*x4 + x4 + 1, x0*x2 + x0*x4 + x1 + x3 + x4]
393393
>>> groebner_basis(id)

src/sage/rings/polynomial/pbori/intersect.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def intersect(i, j, **gb_opts):
1616
This functions intersects two ideals. The first ring variable is used as helper variable for this
1717
intersection. It is assumed, that it doesn't occur in the ideals, and that we have an elimination ordering
1818
for this variables. Both assumptions are checked.
19-
>>> from brial.frontend import declare_ring
20-
>>> from brial import Block
19+
>>> from sage.rings.polynomial.pbori.brial.frontend import declare_ring
20+
>>> from sage.rings.polynomial.pbori.brial import Block
2121
>>> r=declare_ring(Block("x", 1000), globals())
2222
>>> x = r.variable
2323
>>> intersect([x(1),x(2)+1],[x(1),x(2)])

src/sage/rings/polynomial/pbori/intpolys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __coerce__(self, other):
3333

3434
def __add__(self, other):
3535
"""
36-
>>> from brial import *
36+
>>> from sage.rings.polynomial.pbori.brial import *
3737
>>> r= declare_ring([Block("x",1000)], globals()) # doctest: +ELLIPSIS
3838
>>> p=IntegerPolynomial(x(1))
3939
>>> p

src/sage/rings/polynomial/pbori/ll.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def llnf(p):
209209
class RingMap(object):
210210
"""Define a mapping between two rings by common variable names.
211211
212-
>>> from brial.frontend import *
212+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
213213
>>> to_ring = declare_ring([Block("x", 10)], globals())
214214
>>> from_ring = declare_ring([Block("y", 5), Block("x", 10)], globals())
215215
>>> mapping = RingMap(to_ring, from_ring)
@@ -232,7 +232,7 @@ class RingMap(object):
232232
def __init__(self, to_ring, from_ring):
233233
"""Initialize map by two given rings.
234234
235-
>>> from brial.frontend import *
235+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
236236
>>> to_ring = declare_ring([Block("x", 10)], globals())
237237
>>> from_ring = declare_ring([Block("y", 5), Block("x", 10)], globals())
238238
>>> mapping = RingMap(to_ring, from_ring)
@@ -268,7 +268,7 @@ def indices(vars):
268268
def __call__(self, poly):
269269
"""Execute the map to change rings.
270270
271-
>>> from brial.frontend import *
271+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
272272
>>> to_ring = declare_ring([Block("x", 10)], globals())
273273
>>> from_ring = declare_ring([Block("y", 5), Block("x", 10)], globals())
274274
>>> mapping = RingMap(to_ring, from_ring)
@@ -280,7 +280,7 @@ def __call__(self, poly):
280280
def invert(self, poly):
281281
"""Inverted map to initial ring.
282282
283-
>>> from brial.frontend import *
283+
>>> from sage.rings.polynomial.pbori.brial.frontend import *
284284
>>> to_ring = declare_ring([Block("x", 10)], globals())
285285
>>> from_ring = declare_ring([Block("y", 5), Block("x", 10)], globals())
286286
>>> mapping = RingMap(to_ring, from_ring)

src/sage/rings/polynomial/pbori/nf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def symmGB_F2_C(G, opt_exchange=True,
643643

644644
def normal_form(poly, ideal, reduced=True):
645645
""" Simple normal form computation of a polynomial against an ideal.
646-
>>> from brial import declare_ring, normal_form
646+
>>> from sage.rings.polynomial.pbori.brial import declare_ring, normal_form
647647
>>> r=declare_ring(['x','y'], globals())
648648
>>> normal_form(x+y, [y],reduced=True)
649649
x

src/sage/rings/polynomial/pbori/parallel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def to_fast_pickable(l):
4040
Each code c refers to the c-2-th position in the conversion list, if c >=2, else to
4141
the corresponding Boolean constant if c in {0, 1}
4242
EXAMPLES:
43-
>>> from brial.PyPolyBoRi import Ring
43+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import Ring
4444
>>> r=Ring(1000)
4545
>>> x=r.variable
4646
>>> to_fast_pickable([Polynomial(1, r)])
@@ -109,7 +109,7 @@ def from_fast_pickable(l, r):
109109
OUTPUT:
110110
a list of Boolean polynomials
111111
EXAMPLES:
112-
>>> from brial.PyPolyBoRi import Ring
112+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import Ring
113113
>>> r=Ring(1000)
114114
>>> x = r.variable
115115
>>> from_fast_pickable([[1], []], r)
@@ -257,7 +257,7 @@ def groebner_basis_first_finished(I, *l):
257257
- tries to compute groebner_basis(I, **kwd) for kwd in l
258258
- returns the result of the first terminated computation
259259
EXAMPLES:
260-
>>> from brial.PyPolyBoRi import Ring
260+
>>> from sage.rings.polynomial.pbori.brial.PyPolyBoRi import Ring
261261
>>> r=Ring(1000)
262262
>>> ideal = [r.variable(1)*r.variable(2)+r.variable(2)+r.variable(1)]
263263
>>> #groebner_basis_first_finished(ideal, dict(heuristic=True), dict(heuristic=False))

0 commit comments

Comments
 (0)