Skip to main content

Crate groebner

Crate groebner 

Source
Expand description

Groebner basis algorithms for multivariate polynomial ideals.

The crate provides two public computation paths:

Polynomials can be built from strings using PolynomialRing, where the variable list also defines the lexicographic variable order.

§Buchberger Example

use groebner::{groebner_basis, is_groebner_basis, MonomialOrder, PolynomialRing};
use num_rational::BigRational;

let ring = PolynomialRing::<BigRational>::new(["x", "y"], MonomialOrder::Lex)?;
let f1 = ring.parse("x^2 - y")?;
let f2 = ring.parse("x*y - 1")?;
let basis_result = groebner_basis(vec![f1, f2], MonomialOrder::Lex, true);
match basis_result {
    Ok(basis) => {
        assert!(!basis.is_empty());
        match is_groebner_basis(&basis) {
            Ok(true) => {}
            Ok(false) => panic!("Basis is not a Groebner basis!"),
            Err(e) => panic!("Groebner basis check failed: {}", e),
        }
    }
    Err(e) => panic!("Groebner basis computation failed: {}", e),
}

§F4 Example

use groebner::{groebner_basis_f4_mod, MonomialOrder, PolynomialRing, PrimeField};

type F32003 = PrimeField<32003>;

let ring = PolynomialRing::<F32003>::new(["x", "y"], MonomialOrder::Lex)?;
let f1 = ring.parse("x^2 - y")?;
let f2 = ring.parse("x*y - 1")?;
let basis = groebner_basis_f4_mod(vec![f1, f2], F32003::modulus(), ring.order())?;

assert!(!basis.is_empty());

Re-exports§

pub use f4::groebner_basis_f4_mod;
pub use field::Field;
pub use finite_field::PrimeField;
pub use finite_field::PrimeFieldParseError;
pub use grebauer_moller::filter_gm_pairs;
pub use groebner::groebner_basis;
pub use groebner::groebner_basis_with_strategy;
pub use groebner::is_groebner_basis;
pub use groebner::GroebnerError;
pub use groebner::SelectionStrategy;
pub use monomial::Monomial;
pub use monomial::MonomialOrder;
pub use polynomial::Polynomial;
pub use polynomial::Term;
pub use ring::ParsePolynomialError;
pub use ring::PolynomialRing;

Modules§

f4
Sparse F4-style Groebner basis computation over prime fields.
field
Field trait and Rational number implementation
finite_field
Prime finite fields for modular Groebner basis computations.
grebauer_moller
The selection strategy of Gebauer and Möller
groebner
Buchberger-style Groebner basis algorithms.
monomial
Monomial types and orderings for Groebner basis computations
polynomial
Multivariate polynomial types and operations.
ring
Polynomial ring helpers for parsing and formatting user-facing polynomials.
sugar
Sugar strategy for Groebner basis computation