passagemath-brial 10.8.1a3__cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.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.
Files changed (39) hide show
  1. passagemath_brial/__init__.py +3 -0
  2. passagemath_brial-10.8.1a3.dist-info/METADATA +96 -0
  3. passagemath_brial-10.8.1a3.dist-info/RECORD +39 -0
  4. passagemath_brial-10.8.1a3.dist-info/WHEEL +6 -0
  5. passagemath_brial-10.8.1a3.dist-info/top_level.txt +3 -0
  6. passagemath_brial.libs/libbrial-a2b87c7c.so.3.0.7 +0 -0
  7. passagemath_brial.libs/libbrial_groebner-607bf574.so.3.0.7 +0 -0
  8. passagemath_brial.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
  9. passagemath_brial.libs/libm4ri-4311ab86.so.2.0.1 +0 -0
  10. passagemath_brial.libs/libpng16-5d944a30.so.16.54.0 +0 -0
  11. sage/all__sagemath_brial.py +9 -0
  12. sage/libs/all__sagemath_brial.py +1 -0
  13. sage/libs/polybori/__init__.pxd +2 -0
  14. sage/libs/polybori/decl.pxd +401 -0
  15. sage/libs/polybori/pb_wrap.h +133 -0
  16. sage/rings/all__sagemath_brial.py +1 -0
  17. sage/rings/polynomial/all__sagemath_brial.py +1 -0
  18. sage/rings/polynomial/pbori/PyPolyBoRi.py +124 -0
  19. sage/rings/polynomial/pbori/__init__.py +46 -0
  20. sage/rings/polynomial/pbori/blocks.py +499 -0
  21. sage/rings/polynomial/pbori/cnf.py +241 -0
  22. sage/rings/polynomial/pbori/easy_polynomials.py +59 -0
  23. sage/rings/polynomial/pbori/fglm.py +93 -0
  24. sage/rings/polynomial/pbori/frontend.py +70 -0
  25. sage/rings/polynomial/pbori/gbcore.py +644 -0
  26. sage/rings/polynomial/pbori/gbrefs.py +129 -0
  27. sage/rings/polynomial/pbori/heuristics.py +35 -0
  28. sage/rings/polynomial/pbori/interpolate.py +122 -0
  29. sage/rings/polynomial/pbori/interred.py +34 -0
  30. sage/rings/polynomial/pbori/ll.py +302 -0
  31. sage/rings/polynomial/pbori/nf.py +671 -0
  32. sage/rings/polynomial/pbori/parallel.py +308 -0
  33. sage/rings/polynomial/pbori/pbori.cpython-314-aarch64-linux-gnu.so +0 -0
  34. sage/rings/polynomial/pbori/pbori.pxd +127 -0
  35. sage/rings/polynomial/pbori/pbori.pyx +8103 -0
  36. sage/rings/polynomial/pbori/randompoly.py +111 -0
  37. sage/rings/polynomial/pbori/rank.py +27 -0
  38. sage/rings/polynomial/pbori/specialsets.py +119 -0
  39. sage/rings/polynomial/pbori/statistics.py +35 -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,124 @@
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
+ import weakref
71
+
72
+ from sage.rings.polynomial.pbori.pbori import (
73
+ BooleanPolynomialRing,
74
+ BooleanPolynomialVector,
75
+ TermOrder_from_pb_order,
76
+ add_up_polynomials,
77
+ )
78
+
79
+ # The following imports are necessary to make these objects available for backward compatibility
80
+ from sage.rings.polynomial.pbori.pbori import Monomial as Monomial # noqa: PLC0414
81
+ from sage.rings.polynomial.pbori.pbori import OrderCode as OrderCode # noqa: PLC0414
82
+ from sage.rings.polynomial.pbori.pbori import Polynomial as Polynomial # noqa: PLC0414
83
+ from sage.rings.polynomial.pbori.pbori import Variable as Variable # noqa: PLC0414
84
+ from sage.rings.polynomial.pbori.pbori import gauss_on_polys as _gauss_on_polys
85
+
86
+
87
+ def Ring(n, order='lp', names=None, blocks=None):
88
+ if blocks is None:
89
+ blocks = []
90
+ pbnames = names
91
+ if pbnames is None:
92
+ pbnames = ['x(' + str(idx) + ')' for idx in range(n)]
93
+ order = TermOrder_from_pb_order(n, order, blocks)
94
+ return BooleanPolynomialRing(n, names=pbnames, order=order)
95
+
96
+
97
+ BoolePolynomialVector = BooleanPolynomialVector
98
+
99
+
100
+ # todo: PolyBoRi's original interface uses its WeakRingPtr here
101
+ def WeakRingRef(ring):
102
+ return weakref.weakref(ring)
103
+
104
+
105
+ _add_up_polynomials = add_up_polynomials
106
+
107
+
108
+ def add_up_polynomials(polys, init):
109
+ r"""
110
+ Add up the polynomials in polys (which should be a
111
+ ``BoolePolynomialVector`` or a sequence of ???
112
+ """
113
+ if not isinstance(polys, BoolePolynomialVector):
114
+ vec = BoolePolynomialVector
115
+ for p in polys:
116
+ vec.append(p)
117
+ polys = vec
118
+
119
+ return _add_up_polynomials(polys, init)
120
+
121
+
122
+ def gauss_on_polys(l):
123
+ vec = BoolePolynomialVector(l)
124
+ return list(_gauss_on_polys(vec))
@@ -0,0 +1,46 @@
1
+ # sage_setup: distribution = sagemath-brial
2
+ """
3
+ PolyBoRi package: Polynomials in Boolean Ring
4
+
5
+ The PolyBoRi package implements a framework for computations with Polynomials in Boolean Ring.
6
+
7
+ The core of PolyBoRi is a C++ library, which provides high-level data types for Boolean polynomials and monomials,
8
+ exponent vectors, as well as for the underlying polynomial rings and subsets of the powerset of the Boolean variables.
9
+ The description of the latter can be found in the description of the 'dynamic' submodule, as well as in the doxygen-based documentation.
10
+
11
+ As a unique approach, binary decision diagrams are used as internal storage type for polynomial structures.
12
+ On top of this C++-library we provide a Python interface. This allows parsing of complex polynomial systems,
13
+ as well as sophisticated and extendable strategies for Groebner base computation.
14
+ PolyBoRi features a powerful reference implementation for Groebner basis computation.
15
+
16
+ AUTHOR:
17
+
18
+ The PolyBoRi Team, 2007-2011
19
+
20
+ REFERENCES:
21
+
22
+ M. Brickenstein, A. Dreyer, G. Greuel, M. Wedler, O. Wienand,
23
+ *New developments in the theory of Groebner bases and applications
24
+ to formal Verification*, Preprint at :arxiv:`0801.1177`
25
+
26
+ M. Brickenstein, A. Dreyer, PolyBoRi:
27
+ *A Groebner Basis Framework for Boolean Polynomials*,
28
+ Reports of Fraunhofer ITWM, No. 122, Kaiserslautern, Germany, 2007.
29
+ http://www.itwm.fraunhofer.de/zentral/download/berichte/bericht122.pdf
30
+
31
+ M. Brickenstein, A. Dreyer, PolyBoRi:
32
+ *A framework for Groebner basis computations with Boolean polynomials*,
33
+ Electronic Proceedings of the MEGA 2007 - Effective Methods in Algebraic Geometry, Strobl, Austria, June 2007.
34
+ http://www.ricam.oeaw.ac.at/mega2007/electronic/electronic.html
35
+ """
36
+ from .PyPolyBoRi import Ring, Polynomial, Monomial, Variable
37
+
38
+ # Get all-inclusive groebner routine
39
+ from .gbcore import groebner_basis
40
+ from .nf import normal_form
41
+
42
+ # Import some high-level modelling functionality
43
+ from .blocks import declare_ring
44
+ from .blocks import HigherOrderBlock, AlternatingBlock, Block
45
+ from .gbrefs import load_file
46
+ from .specialsets import all_monomials_of_degree_d, power_set