Syntax.Poly
This module provides functionalities for representing polynomials.
In order to create a polynomial, we need a type for variables and numbers injection (since we have polynomials over integers.)
type name = PolV.t
Type alias for poly variable names.
The simplest form of polynomials: numbers and variables. The two values below injects the types int
and var
into the poly
type.
val num : int -> poly
num i
is the polynomial representing the integer i
.
equal p p'
returns whether the polynomials p
and p'
are syntactically equal.
val to_string : poly -> string
to_sring p
print the written human-readable representation of the polynomial p
.
var_occurs p x
returns whether the name x
occurs in the syntax of p
.
apply_poly_list p ps
is the polynomial p
, if ps
is empty; and it is the left-associated application of p
to each element of ps
.
Polynomial functions are expressions of the form: Lam x1, ..., xn
. P, where x1, ..., xn
are values of type name
and P is of type poly
. The internal type is abstract.
poly_fun_mk xs p
returns the polynomial expression representing the polynomial function over variables xs
and polynomial p
.
get_names pf
returns the list of names occurring in the syntax of pf
.