package smol
Library
Module
Module type
Parameter
Class
Class type
Parameters
Signature
The type of Monomials. They are mappings from literals to their non-negative exponent. We always ensure that exponents are positive.
exception Monomial_has_non_positive_exponent of Literal.t * int
This exception is raised if a non-positive exponent is found in a monomial.
exception Monomial_set_negative_exponent of Literal.t * int
This exception is raised when trying to set a negative exponent in a monomial.
val one : t
The unit monomial
val is_one : t -> bool
Check if the given monomial is one
val to_map : t -> int Map.Make(Literal).t
Returns a map from literals to their non-negative exponent
val of_map : int Map.Make(Literal).t -> t
Creates a monomial from a map m
.
Returns the list of literals occuring in the object, sorted in lexicographical order
Comparison bewteen monomials. Uses the lexicographical ordering on monomials, with lexicographical ordering on the literals. This order ensures that the unit monomial is the global minimum. This order is used in the implementation of polynomials.
deg x m
returns the largest integer n
such that xⁿ
divides m
. In particular, it returns 0 is x
is not present in m
.
set_exponent
ensures that, for all n >= 0
, deg x (set_exponent x n m) = n
.
Derivation of m
wrt x
If x
is not in the support of m
, returns None (an "empty" monomial). Otherwise, returns Some (i,r)
such that ∂m/∂x = i×r
, where r
is a monomial.
val apply :
(module Algebra.Mul_Monoid_S with type t = 'a) ->
t ->
'a Map.Make(Literal).t ->
'a * t
Partial application in a monomial. apply (module K) m v
returns (c,r)
such that the substitution of v
in m
equals c×r
, where r
is a monomial.
val to_string : t -> string
Conversion to printable strings.
module Infix : sig ... end
Infix operators
Mapping functions
val cardinal : t -> int
val map : (int -> 'b) -> t -> 'b Map.Make(Literal).t
val mapi : (Literal.t -> int -> 'b) -> t -> 'b Map.Make(Literal).t