package octez-libs
Numeric operations over the native field.
val constant : Csir.Scalar.t -> scalar repr t
constant s
returns the constant value s
.
range_check ~nb_bits s
asserts that s
is in the range [0, 2^nb_bits).
val custom :
?qc:Csir.Scalar.t ->
?ql:Csir.Scalar.t ->
?qr:Csir.Scalar.t ->
?qo:Csir.Scalar.t ->
?qm:Csir.Scalar.t ->
?qx2b:Csir.Scalar.t ->
?qx5a:Csir.Scalar.t ->
scalar repr ->
scalar repr ->
scalar repr t
custom ~qc ~ql ~qr ~qo ~qm ~qx2b ~qx5a a b
returns a value c
for which the following arithmetic constraint is added: qc + ql * a + qr * b + qo * c + qm * a * b +
qx2b * b^2 + qx5a * a^5 = 0
Manually adding constraints can be error-prone. Handle with care.
val assert_custom :
?qc:Csir.Scalar.t ->
?ql:Csir.Scalar.t ->
?qr:Csir.Scalar.t ->
?qo:Csir.Scalar.t ->
?qm:Csir.Scalar.t ->
scalar repr ->
scalar repr ->
scalar repr ->
unit repr t
assert_custom ~qc ~ql ~qr ~qo ~qm a b c
asserts the following arithmetic constraint: qc + ql * a + qr * b + qo * c + qm * a * b +
qx2b * b^2 + qx5a * a^5 = 0
Manually adding constraints can be error-prone. Handle with care.
val add :
?qc:Csir.Scalar.t ->
?ql:Csir.Scalar.t ->
?qr:Csir.Scalar.t ->
scalar repr ->
scalar repr ->
scalar repr t
add ~qc ~ql ~qr a b
returns a value c
such that ql * a + qr * b + qc = c
.
val add_constant :
?ql:Csir.Scalar.t ->
Csir.Scalar.t ->
scalar repr ->
scalar repr t
add_constant ~ql k a
returns a value c
such that ql * a + k = c
.
mul ~qm a b
returns a value c
such that qm * a * b = c
.
div ~den_coeff a b
asserts b
is non-zero and returns a value c
such that a / (b * den_coeff) = c
.
is_zero a
returns a boolean c
representing whether a
is zero.