package tezos-plonk

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Polynomials are maps from monomials to their coefficient. These coefficients should be non-zero. An empty map is the zero polynomial.

val zero : t

The zero polynomial

val one : t

The unit polynomial

The "variable" polynomial

val of_monomial : Monomial.t -> t

Builds a polynomial with a single monomial

val of_list : (Monomial.t * scalar) list -> t

Builds a polynomial from a list of monomials

Returns the sorted list of variables occuring in the object

val equal : t -> t -> bool

Equality between polynomials. Assuming monomials do not contain zero exponents, and the polynomials do not contain zero coefficients, the polynomial representation is unique, so equality is the equality of the coefficients for each of their monomial.

Returns the maximum degree of the given variable in the given polynomial

val add : t -> t -> t

Adds two polynomials

val neg : t -> t

Negation of a polynomial

val sub : t -> t -> t

Substraction of two polynomials

val mul_scalar : scalar -> t -> t

Multiplies a polynomial by a scalar

val normalize : t -> scalar * t

normalize_poly p = (k,q) verifies scalar_poly k q = p and q is normalized such that its smallest monomial has coef 1. The monomial ordering makes so that the constant term is always the smallest (if it exists). Also, the scalar K.zero is returned only if p is zero, in which case q will also be equal to zero.

val mul : t -> t -> t

Polynomial multiplication

group_by p var returns a list p_0,p_1,...,p_k such that p = \sum var^i * p_i p = p_0 + var * (p_1 + var * ( ... + var * ( p_{k-1} + var * p_k ) ... ) )

val substitution : t -> Bls12_381_polynomial.Multivariate.variable -> t -> t

substitution p x q replaces the variable x in p by q

val substitution_comp : t -> Bls12_381_polynomial.Multivariate.variable -> t -> t -> t

substitution_comp p x a b replaces the variables x and y (a fresh variable) in y^n.p(x/y) (where n = deg(x)) by a and b respectively.

val leading_coef : t -> Bls12_381_polynomial.Multivariate.variable -> t * int

Returns the leading coefficient of p in the variable x, with the degree of x

val partial_div_euclid : t -> t -> Bls12_381_polynomial.Multivariate.variable -> t * t * t * int

partial_div_euclid p1 p2 y returns (q,r,d,n) st:

  • p1 = (q/d^n) * p2 + (r/d^n)
  • if p1 and p2 are polynomials in Qx_i,y, where the x_i are other variables, then q and r are polynomials in y, with coefficients in Qx_i, and d is a polynomial in Qx_i.
  • deg_y(r) < deg_y(p2)
val partial_gcd : t -> t -> Bls12_381_polynomial.Multivariate.variable -> t

partial_gcd p1 p2 y returns the gcd of p1 and p2 wrt the variable y

val apply : t -> spec -> scalar

Partial application for polynomials

val fast_apply : t -> spec -> scalar
val partial_apply : t -> spec -> t

Extract the constant value of the given polynomial

val to_ascii : t -> string

Conversion to printable strings

module PolynomialOperators : sig ... end

Prefix and infix operators

OCaml

Innovation. Community. Security.