module Monomial:sig..end
Monomials of multiple variables (e.g., x^2 y z^3).
type t
Type of monomials.
val of_list : int list -> tof_list l produces the monomial corresponding to list l. For
instance, considering the variables x0, x1, x2 and x3,
of_list[3; 4; 0; 1] gives the monomial x0^3 x x1^4 x x3. All
elements of the list must be non negative.
val to_list : t -> int listThe returned list contains only non negative values and its last element is non zero (or the list is empty).
val one : tEquivalent to of_list [].
val var : ?d:int -> int -> tvar ?d i returns xi^d, this is equivalent to of_list [0;...; O;
d] with i zeros. d is 1 by default. i and d must be non
negative. var ~d:0 i is equivalent to one.
val mult : t -> t -> tmult m1 m2 multiplies the two monomials m1 and m2. If one of
them is defined on less variables, the undefined exponents are
considered as 0 (for instance mult (of_list [1; 2]) (of_list
[3; 4; 5]) returns m such that to_list m = [4; 6; 5]).
val lcm : t -> t -> tlcm m1 m2 returns the Least Common Multiple of m1 and m2
(i.e., the maximum of degrees for each variable).
val gcd : t -> t -> tgcd m1 m2 returns the Greatest Common Divisor of m1 and m2
(i.e., the minimum of degrees for each variable).
val divide : t -> t -> booldivide m1 m2 returns true iff m1 divides m2 (i.e., when lcm
m1 m2 = m2 or equivalently gcd m1 m2 = m1). This can be seen as
a pointwise less or equal on degrees.
exception Not_divisible
val div : t -> t -> tdiv m1 m2 divides m1 by m2.
Not_divisible if divide m2 m1 is false.val derive : t -> int -> int * tderive m i returns j_i, x_0^{j_0} ... x_i^{j_i - 1}
... x_n^{j_n}) if the degree j_i of variable i is positive in
the monomial m and 0, one otherwise. i must be non
negative.
val compare : t -> t -> int
val nb_vars : t -> intnb_vars m returns the largest index (starting from 0) of a
variable appearing in m plus one (0 if none). For instance,
nb_var m returns 4 if m is the monomial x_0 x_3^2 (even if
variables x_1 and x_2 don't actually appear in m)
val degree : t -> int
val is_var : t -> (int * int) optionis_var m returns Some (d, i) if m is the monomial xi^d and
None otherwise.
val list_eq : int -> int -> t listlist_eq n d provides the list of all monomials with n
variables of degree equal d (for instance, list_eq 3 2 can
return [x0^2; x0 x1; x0 x2; x1^2; x1 x2; x2^2]). n and d
must be non negative.
val list_le : int -> int -> t listlist_le n d provides the list of all monomials with n
variables of degree less or equal d (for instance, list_le 3 2
can return [1; x0; x1; x2; x0^2; x0 x1; x0 x2; x1^2; x1 x2;
x2^2]). n and d must be non negative.
val pp : Stdlib.Format.formatter -> t -> unitPretty printing. Variables will be printed as x0, x1,...
val pp_names : string list -> Stdlib.Format.formatter -> t -> unitPretty printing. If names is to short, variables will be printed
as x0, x1,... Providing a too short names list is not advisable
however, as the generated names may collide with the provided
ones.
module Set:Set.Swith type elt = t
module Map:Map.Swith type key = t