package octez-plompiler

  1. Overview
  2. Docs
type scalar = scalar
type 'a repr = 'a repr
type 'a t = 'a t
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
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
val add_constant : ?ql:Csir.Scalar.t -> Csir.Scalar.t -> scalar repr -> scalar repr t
val mul : ?qm:Csir.Scalar.t -> scalar repr -> scalar repr -> scalar repr t
val div : ?den_coeff:Csir.Scalar.t -> scalar repr -> scalar repr -> scalar repr t
val pow5 : scalar repr -> scalar repr t
val is_zero : scalar repr -> bool repr t
val is_not_zero : scalar repr -> bool repr t
val assert_nonzero : scalar repr -> unit repr t
val assert_bool : scalar repr -> unit repr t
val square : scalar repr -> scalar repr t
val pow : scalar repr -> bool repr list -> scalar repr t
val add_list : ?qc:Csir.Scalar.t -> ?coeffs:Csir.Scalar.t list -> scalar list repr -> scalar repr t
val mul_list : scalar list repr -> scalar repr t
val mul_by_constant : Csir.Scalar.t -> scalar repr -> scalar repr t
val scalar_of_bytes : bool list repr -> scalar repr t
val is_eq_const : scalar repr -> Csir.Scalar.t -> bool repr t
val assert_eq_const : scalar repr -> Csir.Scalar.t -> unit repr t
val is_upper_bounded : bound:Z.t -> scalar repr -> bool repr t

is_upper_bounded ~bound x returns whether the scalar x is strictly lower than bound when x is interpreted as an integer from 0 to p-1 (being p the scalar field order). This circuit is total (and more expensive than our version below).

val is_upper_bounded_unsafe : ?nb_bits:int -> bound:Z.t -> scalar repr -> bool repr t

Same as is_upper_bounded but cheaper and partial. is_upper_bounded_unsafe ~bound l is unsatisfiable if l cannot be represented in binary with Z.numbits bound bits.

val geq : (scalar repr * Z.t) -> (scalar repr * Z.t) -> bool repr t

geq (a, bound_a) (b, bound_b) returns the boolean wire representing a >= b. Pre-condition: a ∈ 0, bound_a) ∧ b ∈ [0, bound_b)

OCaml

Innovation. Community. Security.