passagemath-brial 10.6.31rc3__cp314-cp314-macosx_13_0_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-brial might be problematic. Click here for more details.
- passagemath_brial-10.6.31rc3.dist-info/METADATA +97 -0
- passagemath_brial-10.6.31rc3.dist-info/RECORD +39 -0
- passagemath_brial-10.6.31rc3.dist-info/WHEEL +6 -0
- passagemath_brial-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_brial.dylibs/libbrial.3.0.7.dylib +0 -0
- passagemath_brial.dylibs/libbrial_groebner.3.0.7.dylib +0 -0
- passagemath_brial.dylibs/libgmp.10.dylib +0 -0
- passagemath_brial.dylibs/libm4ri.1.dylib +0 -0
- passagemath_brial.dylibs/libpng16.16.dylib +0 -0
- passagemath_brial.dylibs/libz.1.3.1.dylib +0 -0
- sage/all__sagemath_brial.py +9 -0
- sage/libs/all__sagemath_brial.py +1 -0
- sage/libs/polybori/__init__.pxd +2 -0
- sage/libs/polybori/decl.pxd +401 -0
- sage/libs/polybori/pb_wrap.h +133 -0
- sage/rings/all__sagemath_brial.py +1 -0
- sage/rings/polynomial/all__sagemath_brial.py +1 -0
- sage/rings/polynomial/pbori/PyPolyBoRi.py +123 -0
- sage/rings/polynomial/pbori/__init__.py +44 -0
- sage/rings/polynomial/pbori/blocks.py +443 -0
- sage/rings/polynomial/pbori/cnf.py +241 -0
- sage/rings/polynomial/pbori/easy_polynomials.py +56 -0
- sage/rings/polynomial/pbori/fglm.py +93 -0
- sage/rings/polynomial/pbori/frontend.py +70 -0
- sage/rings/polynomial/pbori/gbcore.py +634 -0
- sage/rings/polynomial/pbori/gbrefs.py +127 -0
- sage/rings/polynomial/pbori/heuristics.py +35 -0
- sage/rings/polynomial/pbori/interpolate.py +115 -0
- sage/rings/polynomial/pbori/interred.py +35 -0
- sage/rings/polynomial/pbori/ll.py +292 -0
- sage/rings/polynomial/pbori/nf.py +662 -0
- sage/rings/polynomial/pbori/parallel.py +298 -0
- sage/rings/polynomial/pbori/pbori.cpython-314-darwin.so +0 -0
- sage/rings/polynomial/pbori/pbori.pxd +127 -0
- sage/rings/polynomial/pbori/pbori.pyx +8107 -0
- sage/rings/polynomial/pbori/randompoly.py +105 -0
- sage/rings/polynomial/pbori/rank.py +27 -0
- sage/rings/polynomial/pbori/specialsets.py +112 -0
- sage/rings/polynomial/pbori/statistics.py +31 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* sage_setup: distribution = sagemath-brial
|
|
2
|
+
*/
|
|
3
|
+
#include <polybori/BoolePolynomial.h>
|
|
4
|
+
#include <polybori/BoolePolyRing.h>
|
|
5
|
+
#include <polybori/factories/VariableBlock.h>
|
|
6
|
+
#include <polybori/factories/VariableFactory.h>
|
|
7
|
+
#include <polybori/groebner/add_up.h>
|
|
8
|
+
#include <polybori/groebner/contained_variables.h>
|
|
9
|
+
#include <polybori/groebner/FGLMStrategy.h>
|
|
10
|
+
#include <polybori/groebner/groebner_alg.h>
|
|
11
|
+
#include <polybori/groebner/interpolate.h>
|
|
12
|
+
#include <polybori/groebner/linear_algebra_step.h>
|
|
13
|
+
#include <polybori/groebner/LiteralFactorization.h>
|
|
14
|
+
#include <polybori/groebner/ll_red_nf.h>
|
|
15
|
+
#include <polybori/groebner/nf.h>
|
|
16
|
+
#include <polybori/groebner/red_tail.h>
|
|
17
|
+
#include <polybori/groebner/minimal_elements.h>
|
|
18
|
+
#include <polybori/groebner/randomset.h>
|
|
19
|
+
#include <polybori.h>
|
|
20
|
+
#include <polybori/iterators/COrderedIter.h>
|
|
21
|
+
#include <polybori/orderings/pbori_order.h>
|
|
22
|
+
#include <polybori/pbori_defs.h>
|
|
23
|
+
|
|
24
|
+
#include <sstream>
|
|
25
|
+
#include <vector>
|
|
26
|
+
|
|
27
|
+
USING_NAMESPACE_PBORI
|
|
28
|
+
USING_NAMESPACE_PBORIGB
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
static int pairs_top_sugar(const GroebnerStrategy& strat){
|
|
32
|
+
if (strat.pairs.pairSetEmpty())
|
|
33
|
+
return -1;
|
|
34
|
+
else
|
|
35
|
+
return (strat.pairs.queue.top().sugar);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static std::vector<BoolePolynomial> someNextDegreeSpolys(GroebnerStrategy& strat, size_t n){
|
|
39
|
+
std::vector<BoolePolynomial> res;
|
|
40
|
+
assert(!(strat.pairs.pairSetEmpty()));
|
|
41
|
+
strat.pairs.cleanTopByChainCriterion();
|
|
42
|
+
deg_type deg=strat.pairs.queue.top().sugar;
|
|
43
|
+
|
|
44
|
+
while((!(strat.pairs.pairSetEmpty())) && \
|
|
45
|
+
(strat.pairs.queue.top().sugar<=deg) && (res.size()<n)){
|
|
46
|
+
assert(strat.pairs.queue.top().sugar==deg);
|
|
47
|
+
res.push_back(strat.nextSpoly());
|
|
48
|
+
strat.pairs.cleanTopByChainCriterion();
|
|
49
|
+
}
|
|
50
|
+
return res;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static std::vector<Polynomial> nextDegreeSpolys(GroebnerStrategy& strat){
|
|
54
|
+
std::vector<Polynomial> res;
|
|
55
|
+
assert(!(strat.pairs.pairSetEmpty()));
|
|
56
|
+
strat.pairs.cleanTopByChainCriterion();
|
|
57
|
+
deg_type deg=strat.pairs.queue.top().sugar;
|
|
58
|
+
|
|
59
|
+
while((!(strat.pairs.pairSetEmpty())) &&
|
|
60
|
+
(strat.pairs.queue.top().sugar<=deg)){
|
|
61
|
+
|
|
62
|
+
assert(strat.pairs.queue.top().sugar==deg);
|
|
63
|
+
res.push_back(strat.nextSpoly());
|
|
64
|
+
strat.pairs.cleanTopByChainCriterion();
|
|
65
|
+
}
|
|
66
|
+
return res;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static std::vector<Polynomial> small_next_degree_spolys(GroebnerStrategy& strat,
|
|
70
|
+
double f, size_t n){
|
|
71
|
+
std::vector<Polynomial> res;
|
|
72
|
+
assert(!(strat.pairs.pairSetEmpty()));
|
|
73
|
+
strat.pairs.cleanTopByChainCriterion();
|
|
74
|
+
deg_type deg=strat.pairs.queue.top().sugar;
|
|
75
|
+
wlen_type wlen=strat.pairs.queue.top().wlen;
|
|
76
|
+
while((!(strat.pairs.pairSetEmpty())) &&
|
|
77
|
+
(strat.pairs.queue.top().sugar<=deg) &&
|
|
78
|
+
(strat.pairs.queue.top().wlen<=wlen*f+2)&& (res.size()<n)){
|
|
79
|
+
|
|
80
|
+
assert(strat.pairs.queue.top().sugar==deg);
|
|
81
|
+
res.push_back(strat.nextSpoly());
|
|
82
|
+
strat.pairs.cleanTopByChainCriterion();
|
|
83
|
+
}
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ring_singleton{
|
|
89
|
+
public:
|
|
90
|
+
static BoolePolyRing instance() {
|
|
91
|
+
static BoolePolyRing ring(1);
|
|
92
|
+
return ring;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
template <class ValueType>
|
|
99
|
+
class DefaultRinged:
|
|
100
|
+
public ValueType {
|
|
101
|
+
typedef DefaultRinged self;
|
|
102
|
+
|
|
103
|
+
public:
|
|
104
|
+
typedef ValueType value_type;
|
|
105
|
+
typedef value_type base;
|
|
106
|
+
|
|
107
|
+
// Default constructor allocated memory
|
|
108
|
+
DefaultRinged();
|
|
109
|
+
|
|
110
|
+
DefaultRinged(const value_type& rhs): base(rhs) {}
|
|
111
|
+
|
|
112
|
+
DefaultRinged(const self& rhs): base(rhs) {}
|
|
113
|
+
|
|
114
|
+
~DefaultRinged() { }
|
|
115
|
+
|
|
116
|
+
self& operator=(const self& rhs) {
|
|
117
|
+
return operator=(static_cast<const value_type&>(rhs));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
self& operator=(const value_type& rhs) {
|
|
121
|
+
base::operator=(rhs);
|
|
122
|
+
return *this;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
template <class ValueType>
|
|
127
|
+
DefaultRinged<ValueType>::DefaultRinged():
|
|
128
|
+
base(ring_singleton::instance()) { }
|
|
129
|
+
|
|
130
|
+
template <>
|
|
131
|
+
DefaultRinged<FGLMStrategy>::DefaultRinged():
|
|
132
|
+
base(ring_singleton::instance(), ring_singleton::instance(),
|
|
133
|
+
PolynomialVector()) { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
2
|
+
# sage.doctest: needs sage.rings.polynomial.pbori
|
|
3
|
+
r"""
|
|
4
|
+
PolyBoRi's interface to libpolybori/BRiAL
|
|
5
|
+
|
|
6
|
+
This file makes interfaces to PolyBoRi's runtime libraries available in Python via sage.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
AUTHOR:
|
|
10
|
+
|
|
11
|
+
- The PolyBoRi Team, 2007-2012
|
|
12
|
+
|
|
13
|
+
EXAMPLES::
|
|
14
|
+
|
|
15
|
+
sage: from sage.rings.polynomial.pbori.pbori import *
|
|
16
|
+
sage: from sage.rings.polynomial.pbori.blocks import declare_ring
|
|
17
|
+
sage: r=declare_ring(["x0","x1","x2","y0","y1","y2"], globals())
|
|
18
|
+
sage: x0>x1
|
|
19
|
+
True
|
|
20
|
+
sage: x0>x1*x2
|
|
21
|
+
True
|
|
22
|
+
sage: y0>y1
|
|
23
|
+
True
|
|
24
|
+
sage: y0>y1*y2
|
|
25
|
+
True
|
|
26
|
+
|
|
27
|
+
sage: r = r.clone(ordering=dlex)
|
|
28
|
+
sage: r(x0) > r(x1)
|
|
29
|
+
True
|
|
30
|
+
sage: r(x0) > r(x1*x2)
|
|
31
|
+
False
|
|
32
|
+
|
|
33
|
+
sage: r = r.clone(ordering=dp_asc)
|
|
34
|
+
sage: r(x0) > r(x1)
|
|
35
|
+
False
|
|
36
|
+
sage: r(x0) > r(x1*x2)
|
|
37
|
+
False
|
|
38
|
+
|
|
39
|
+
sage: r = r.clone(ordering=block_dlex, blocks=[3])
|
|
40
|
+
sage: r(x0) > r(x1)
|
|
41
|
+
True
|
|
42
|
+
sage: r(x0) > r(x1*x2)
|
|
43
|
+
False
|
|
44
|
+
sage: r(x0) > r(y0*y1*y2)
|
|
45
|
+
True
|
|
46
|
+
|
|
47
|
+
sage: r = r.clone(ordering=block_dp_asc)
|
|
48
|
+
sage: r(x0) > r(x1)
|
|
49
|
+
False
|
|
50
|
+
sage: r(x0) > r(y0)
|
|
51
|
+
False
|
|
52
|
+
sage: r(x0) > r(x1*x2)
|
|
53
|
+
False
|
|
54
|
+
|
|
55
|
+
sage: r = r.clone(ordering=block_dp_asc, blocks=[3])
|
|
56
|
+
sage: r(x0) > r(y0)
|
|
57
|
+
True
|
|
58
|
+
|
|
59
|
+
sage: r(x0) > r(y0*y1)
|
|
60
|
+
True
|
|
61
|
+
|
|
62
|
+
sage: r = r.clone(names=["z17", "z7"])
|
|
63
|
+
sage: [r.variable(idx) for idx in range(3)]
|
|
64
|
+
[z17, z7, x2]
|
|
65
|
+
sage: r = r.clone(names='abcde')
|
|
66
|
+
sage: [r.variable(idx) for idx in range(6)]
|
|
67
|
+
[a, b, c, d, e, y2]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
from .pbori import (order_dict, TermOrder_from_pb_order, BooleanPolynomialRing,
|
|
71
|
+
BooleanPolynomialVector, MonomialFactory,
|
|
72
|
+
PolynomialFactory, VariableFactory, add_up_polynomials)
|
|
73
|
+
from .pbori import gauss_on_polys as _gauss_on_polys
|
|
74
|
+
|
|
75
|
+
import weakref
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
OrderCode = type('OrderCode', (object,), order_dict)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def Ring(n, order='lp', names=None, blocks=None):
|
|
82
|
+
if blocks is None:
|
|
83
|
+
blocks = []
|
|
84
|
+
pbnames = names
|
|
85
|
+
if pbnames is None:
|
|
86
|
+
pbnames = ['x(' + str(idx) + ')' for idx in range(n)]
|
|
87
|
+
order = TermOrder_from_pb_order(n, order, blocks)
|
|
88
|
+
return BooleanPolynomialRing(n, names=pbnames, order=order)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
BoolePolynomialVector = BooleanPolynomialVector
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# todo: PolyBoRi's original interface uses its WeakRingPtr here
|
|
95
|
+
def WeakRingRef(ring):
|
|
96
|
+
return weakref.weakref(ring)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
Monomial = MonomialFactory()
|
|
100
|
+
Polynomial = PolynomialFactory()
|
|
101
|
+
Variable = VariableFactory()
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
_add_up_polynomials = add_up_polynomials
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def add_up_polynomials(polys, init):
|
|
108
|
+
r"""
|
|
109
|
+
Add up the polynomials in polys (which should be a
|
|
110
|
+
``BoolePolynomialVector`` or a sequence of ???
|
|
111
|
+
"""
|
|
112
|
+
if not isinstance(polys, BoolePolynomialVector):
|
|
113
|
+
vec = BoolePolynomialVector
|
|
114
|
+
for p in polys:
|
|
115
|
+
vec.append(p)
|
|
116
|
+
polys = vec
|
|
117
|
+
|
|
118
|
+
return _add_up_polynomials(polys, init)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def gauss_on_polys(l):
|
|
122
|
+
vec = BoolePolynomialVector(l)
|
|
123
|
+
return list(_gauss_on_polys(vec))
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
2
|
+
"""The PolyBoRi package implements a framework for computations with Polynomials in Boolean Ring.
|
|
3
|
+
|
|
4
|
+
The core of PolyBoRi is a C++ library, which provides high-level data types for Boolean polynomials and monomials,
|
|
5
|
+
exponent vectors, as well as for the underlying polynomial rings and subsets of the powerset of the Boolean variables.
|
|
6
|
+
The description of the latter can be found in the description of the 'dynamic' submodule, as well as in the doxygen-based documentation.
|
|
7
|
+
|
|
8
|
+
As a unique approach, binary decision diagrams are used as internal storage type for polynomial structures.
|
|
9
|
+
On top of this C++-library we provide a Python interface. This allows parsing of complex polynomial systems,
|
|
10
|
+
as well as sophisticated and extendable strategies for Groebner base computation.
|
|
11
|
+
PolyBoRi features a powerful reference implementation for Groebner basis computation.
|
|
12
|
+
|
|
13
|
+
AUTHOR:
|
|
14
|
+
|
|
15
|
+
The PolyBoRi Team, 2007-2011
|
|
16
|
+
|
|
17
|
+
REFERENCES:
|
|
18
|
+
|
|
19
|
+
M. Brickenstein, A. Dreyer, G. Greuel, M. Wedler, O. Wienand,
|
|
20
|
+
*New developments in the theory of Groebner bases and applications
|
|
21
|
+
to formal Verification*, Preprint at :arxiv:`0801.1177`
|
|
22
|
+
|
|
23
|
+
M. Brickenstein, A. Dreyer, PolyBoRi:
|
|
24
|
+
*A Groebner Basis Framework for Boolean Polynomials*,
|
|
25
|
+
Reports of Fraunhofer ITWM, No. 122, Kaiserslautern, Germany, 2007.
|
|
26
|
+
http://www.itwm.fraunhofer.de/zentral/download/berichte/bericht122.pdf
|
|
27
|
+
|
|
28
|
+
M. Brickenstein, A. Dreyer, PolyBoRi:
|
|
29
|
+
*A framework for Groebner basis computations with Boolean polynomials*,
|
|
30
|
+
Electronic Proceedings of the MEGA 2007 - Effective Methods in Algebraic Geometry, Strobl, Austria, June 2007.
|
|
31
|
+
http://www.ricam.oeaw.ac.at/mega2007/electronic/electronic.html
|
|
32
|
+
"""
|
|
33
|
+
from sage.misc.lazy_import import lazy_import
|
|
34
|
+
from .PyPolyBoRi import Ring, Polynomial, Monomial, Variable
|
|
35
|
+
|
|
36
|
+
# Get all-inclusive groebner routine
|
|
37
|
+
from .gbcore import groebner_basis
|
|
38
|
+
from .nf import normal_form
|
|
39
|
+
|
|
40
|
+
# Import some high-level modelling functionality
|
|
41
|
+
from .blocks import declare_ring
|
|
42
|
+
from .blocks import HigherOrderBlock, AlternatingBlock, Block
|
|
43
|
+
from .gbrefs import load_file
|
|
44
|
+
from .specialsets import all_monomials_of_degree_d, power_set
|