# Singular          ### D.14.4 polybori_lib

Library:
polybori.lib
Purpose:
A Singular Library Interface for PolyBoRi
Authors:
Maximilian Kammermeier: Max0791@gmx.de
Susanne Scherer: sscherer90@yahoo.de

Overview:
A library for using `PolyBoRi` in the SINGULAR interface, with procedures that convert structures (polynomials, rings, ideals) in both directions. Therefore, it is possible to compute boolean groebner basis via boolean_std. Polynomials can be converted to zero-supressed decision diagrams (zdd) and vice versa.

For usability it defines the `PolyBoRi` types `bideal`, `bpoly`, and `bring` which are equivalent to Singular's `ideal`, `poly`, and `ring`, as well as `bset` which corresponds to the type `zdd` introduced here. In addition `bvar(i)` constructs the Boolean variable corresponding to `var(i)` from current `ring`;

For convenience, the corresponding types can be converted explictely or implicitely while assigning. Also several SINGULAR operators were overloaded: `bring` comes with `nvars`, `bpoly` implements `lead`, `leadmonom` and `leadcoef`. Objects of this type may be added and multiplied, too. Finally, `bideal` yields `std` and `size` as well as addition and element access.

Hence, by using these types `PolyBoRi` functionality can be carried out seamlessly in SINGULAR:

`> LIB "polybori.lib";`
`> ring r0=2,x(1..4),lp;`
`> def x=bvar; // enforce Boolean variables`

`> bpoly f1=x(1)+x(4);`
`> bpoly f2=x(1)+x(3)*x(1);`
`> bideal bI=list(f1,f2);`

`> std(bI);`
`_ = x(1) + x(4)`
`_ = x(3)*x(4) + x(4)`

Note:
For using this library SINGULAR's `python` interface must be available on your system. Please `./configure --with-python` when building SINGULAR for this purpose.

There are prebuilt binary packages for `PolyBoRi` available from http://polybori.sf.net/.

For building your own `PolyBoRi` please ensure that you have `scons` and a development version of the boost libaries installed on you system. Then you may execute the following commands in a `bash`-style shell to build `PolyBoRi` available to `python`:

`PBDIR=/path/to/custom/polybori`
`wget http://downloads.sf.net/project/polybori/polybori/\`
`0.8.2/polybori-0.8.2.tar.gz`
`tar -xvzf polybori-0.8.2.tar.gz`
`cd polybori-0.8.2`
`scons install PREFIX=\$PBDIR PYINSTALLPREFIX=\$PBDIR/python`
`export PYTHONPATH=\$PBDIR/python:\$PYTHONPATH`

References:
See http://polybori.sf.net for details about `PolyBoRi`.

Procedures:

 D.14.4.1 boolean_std Singular ideal of boolean groebner basis of I D.14.4.2 boolean_poly_ring convert ring D.14.4.3 boolean_constant convert constant D.14.4.4 boolean_poly convert polynomial D.14.4.5 direct_boolean_poly convert polynomial direct D.14.4.6 recursive_boolean_poly convert polynomial recursively D.14.4.7 boolean_ideal convert ideal D.14.4.8 boolean_set convert zdd D.14.4.9 from_boolean_constant convert boolean constant D.14.4.10 from_boolean_poly convert boolean polynomial D.14.4.11 direct_from_boolean_poly convert boolean polynomial direct D.14.4.12 recursive_from_boolean_poly convert boolean polynomial recursively D.14.4.13 from_boolean_ideal convert to ideal D.14.4.14 from_boolean_set convert to zdd D.14.4.15 bvar return i-th Boolean variable D.14.4.16 poly2zdd return zdd of a given polynomial D.14.4.17 zdd2poly return polynomial representation of a given zdd D.14.4.18 disp_zdd return string with a visualization of a given
See also: Libraries; User defined types; pyobject.

### Misc 