Skip to content

Commit a37b456

Browse files
author
Matthias Koeppe
committed
More # optional
1 parent cc1307b commit a37b456

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/sage/sat/boolean_polynomials.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# sage.doctest: optional - sage.rings.polynomial.pbori
12
"""
23
SAT Functions for Boolean Polynomials
34
@@ -71,8 +72,8 @@ def solve(F, converter=None, solver=None, n=1, target_variables=None, **kwds):
7172
7273
We construct a very small-scale AES system of equations::
7374
74-
sage: sr = mq.SR(1,1,1,4,gf2=True,polybori=True) # optional - sage.modules
75-
sage: while True: # workaround (see :trac:`31891`) # optional - sage.modules
75+
sage: sr = mq.SR(1, 1, 1, 4, gf2=True, polybori=True) # optional - sage.modules sage.rings.finite_rings
76+
sage: while True: # workaround (see :trac:`31891`) # optional - sage.modules sage.rings.finite_rings
7677
....: try:
7778
....: F, s = sr.polynomial_system()
7879
....: break
@@ -82,14 +83,14 @@ def solve(F, converter=None, solver=None, n=1, target_variables=None, **kwds):
8283
and pass it to a SAT solver::
8384
8485
sage: from sage.sat.boolean_polynomials import solve as solve_sat
85-
sage: s = solve_sat(F) # optional - pycryptosat sage.modules
86-
sage: F.subs(s[0]) # optional - pycryptosat sage.modules
86+
sage: s = solve_sat(F) # optional - pycryptosat sage.modules sage.rings.finite_rings
87+
sage: F.subs(s[0]) # optional - pycryptosat sage.modules sage.rings.finite_rings
8788
Polynomial Sequence with 36 Polynomials in 0 Variables
8889
8990
This time we pass a few options through to the converter and the solver::
9091
91-
sage: s = solve_sat(F, c_max_vars_sparse=4, c_cutting_number=8) # optional - pycryptosat sage.modules
92-
sage: F.subs(s[0]) # optional - pycryptosat sage.modules
92+
sage: s = solve_sat(F, c_max_vars_sparse=4, c_cutting_number=8) # optional - pycryptosat sage.modules sage.rings.finite_rings
93+
sage: F.subs(s[0]) # optional - pycryptosat sage.modules sage.rings.finite_rings
9394
Polynomial Sequence with 36 Polynomials in 0 Variables
9495
9596
We construct a very simple system with three solutions
@@ -126,7 +127,7 @@ def solve(F, converter=None, solver=None, n=1, target_variables=None, **kwds):
126127
127128
Now we are only interested in the solutions of the variables a and b::
128129
129-
sage: solve_sat(F,n=infinity,target_variables=[a,b]) # optional - pycryptosat sage.modules
130+
sage: solve_sat(F, n=infinity, target_variables=[a,b]) # optional - pycryptosat sage.modules
130131
[{b: 0, a: 0}, {b: 1, a: 1}]
131132
132133
Here, we generate and solve the cubic equations of the AES SBox (see :trac:`26676`)::
@@ -136,7 +137,7 @@ def solve(F, converter=None, solver=None, n=1, target_variables=None, **kwds):
136137
sage: sr = sage.crypto.mq.SR(1, 4, 4, 8, # long time, optional - pycryptosat sage.modules
137138
....: allow_zero_inversions=True)
138139
sage: sb = sr.sbox() # long time, optional - pycryptosat sage.modules
139-
sage: eqs = sb.polynomials(degree = 3) # long time, optional - pycryptosat sage.modules
140+
sage: eqs = sb.polynomials(degree=3) # long time, optional - pycryptosat sage.modules
140141
sage: eqs = PolynomialSequence(eqs) # long time, optional - pycryptosat sage.modules
141142
sage: variables = map(str, eqs.variables()) # long time, optional - pycryptosat sage.modules
142143
sage: variables = ",".join(variables) # long time, optional - pycryptosat sage.modules
@@ -343,11 +344,11 @@ def learn(F, converter=None, solver=None, max_learnt_length=3, interreduction=Fa
343344
344345
We construct a simple system and solve it::
345346
346-
sage: set_random_seed(2300) # optional - pycryptosat
347-
sage: sr = mq.SR(1,2,2,4,gf2=True,polybori=True) # optional - pycryptosat
348-
sage: F,s = sr.polynomial_system() # optional - pycryptosat
349-
sage: H = learn_sat(F) # optional - pycryptosat
350-
sage: H[-1] # optional - pycryptosat
347+
sage: set_random_seed(2300)
348+
sage: sr = mq.SR(1, 2, 2, 4, gf2=True, polybori=True) # optional - pycryptosat sage.modules sage.rings.finite_rings
349+
sage: F,s = sr.polynomial_system() # optional - pycryptosat sage.modules sage.rings.finite_rings
350+
sage: H = learn_sat(F) # optional - pycryptosat sage.modules sage.rings.finite_rings
351+
sage: H[-1] # optional - pycryptosat sage.modules sage.rings.finite_rings
351352
k033 + 1
352353
"""
353354
try:

0 commit comments

Comments
 (0)