pub fn ++
[
@D
]
( x : string $pre @D,
y : string $pre @D
)
-> string $pre @D
Synonym for string append.
pub fn all
[
$S,
@D,
N : Nat
]
( xs : list[bool[N] $S @D] $pre @public
)
-> bool[N] $S @D
True iff all elements of the given list with boolean elements are true.
pub fn all_pre
[
@D,
@D1,
N : Nat
]
( xs : list[bool[N] $pre @D] $pre @D1
)
-> bool[N] $pre @D
where
@D1 <= @D
True iff all elements of the given list with boolean elements in
$pre
are true.
pub fn any
[
$S,
@D,
N : Nat
]
( xs : list[bool[N] $S @D] $pre @public
)
-> bool[N] $S @D
True iff at least one element of the given list with boolean elements is true.
pub fn any_pre
[
@D,
@D1,
N : Nat
]
( xs : list[bool[N] $pre @D] $pre @D1
)
-> bool[N] $pre @D
where
@D1 <= @D
True iff at least one element of the given list with boolean elements in
$pre
is true.
pub fn append
[
T : Qualified
]
( x : list[T] $pre @public,
y : list[T] $pre @public
)
-> list[T] $pre @public
Concatenating of two lists.
unchecked eff * -> * -> * -> * ! <$S>
pub fn bool_cond
[
M : Nat,
N : Nat,
$S,
@D
]
( b : bool[M] $S @D,
x : bool[N] $S @D,
y : bool[N] $S @D
)
-> bool[N] $S @D
where
Field[N],
Convertible[M,N]
Choice between two booleans. Oblivious in
$post @prover
, evaluating both branches.
unchecked eff * -> * ! <$S>
pub fn bool_downcast
[
N : Nat,
$S,
@D
]
( b : bool[N] $pre @D
)
-> bool[N] $S @D
where
Field[N]
Downcasting the elements of the given list of booleans in the stage
$pre
into the given stage. If the given stage is$pre
then does nothing, otherwise applieswire
.
pub fn bool_ensure_post
[
N : Nat,
$S,
@D
]
( x : bool[N] $S @D
)
-> bool[N] $post @D
where
Field[N]
Ensuring that the elements of the given list of booleans are in
$post
. If they are then does nothing, otherwise applieswire
.
pub fn bool_list_to_post
[
N : Nat,
@D
]
( xs : list[bool[N] $pre @D] $pre @public
)
-> list[bool[N] $post @D] $pre @public
where
Field[N]
Putting the elements of the given list with boolean elements in
$pre
on wires.
pub fn bool_list_to_pre
[
N : Nat,
$S,
@D
]
( xs : list[bool[N] $S @D] $pre @public
)
-> list[bool[N] $pre @D] $pre @public
Converting the elements of the given list of booleans to the stage
$pre
.
pub fn bool_list_to_prover
[
N : Nat,
$S,
@D
]
( xs : list[bool[N] $S @D] $pre @public
)
-> list[bool[N] $S @prover] $pre @public
Converting the elements of the given list of booleans to the domain
@prover
.
pub fn bool_list_to_uint
[
N : Nat,
$S,
@D
]
( xs : list[bool[N] $S @D] $pre @public
)
-> list[uint[N] $S @D] $pre @public
Converting the elements of the given list of booleans to integers.
pub fn concat
[
T : Qualified
]
( xss : list[list[T] $pre @public] $pre @public
)
-> list[T] $pre @public
Concatenating of all element lists of the given list of lists. Assumes that all element lists have the same length.
pub fn concat_non_rectangle
[
T : Qualified
]
( xss : list[list[T] $pre @public] $pre @public
)
-> list[T] $pre @public
Concatenating of all element lists of the given list of lists.
pub fn conditional_assert
[
@D,
N : Nat
]
( c : bool[N] $post @D,
b : bool[N] $post @D
)
-> () $pre @public
where
Field[N]
Assertion, provided that the given condition is true.
pub fn conditional_assert_zero
[
@D,
N : Nat
]
( c : bool[N] $post @D,
x : uint[N] $post @D
)
-> () $pre @public
where
Field[N]
Assertion of equality to zero, provided that the given condition is true.
pub fn count
[
$S,
@D,
X : Qualified,
N : Nat
]
( l : list[X] $pre @public,
p : X -> bool[N] $S @D
)
-> uint[N] $S @D
The number of elements satisfying the given predicate in the given list.
pub fn count_pre
[
T : Unqualified,
N : Nat,
@D,
@D1
]
( l : list[T $pre @D] $pre @D,
p : T $pre @D -> bool[N] $pre @D1
)
-> uint[N] $pre @D1
The number of elements satisfying the given predicate in the given list with elements in
$pre
.
pub fn duplicate_indices
( amounts : list[uint[18446744073709551616] $pre @public] $pre @public
)
-> list[uint[18446744073709551616] $pre @public] $pre @public
Replacing of each element of the given list of numbers with the corresponding index replicated that many times.
pub fn equiv
[
$S,
@D,
N : Nat
]
( a : bool[N] $S @D,
b : bool[N] $S @D
)
-> bool[N] $S @D
Logical equivalence.
pub fn error
[
@D
]
( msg : string $pre @D
)
-> () $pre @public
Halting immediately with an assertion failure.
pub fn foldl
[
A : Qualified,
B : Qualified
]
( f : B -> A -> B,
x : B,
xs : list[A] $pre @public
)
-> B
The polymorphic left fold of the given list with the given operation and the given initial value.
pub fn foldl_pre
[
B : Unqualified,
$SB,
@DB,
T : Unqualified,
@D,
@D1
]
( f : B $SB @DB -> T $pre @D -> B $SB @DB,
x : B $SB @DB,
xs : list[T $pre @D] $pre @D1
)
-> B $SB @DB
where
@D1 <= @D
The polymorphic left fold of list with elements in
$pre
.
pub fn foldr
[
A : Qualified,
B : Qualified
]
( f : A -> B -> B,
x : B,
xs : list[A] $pre @public
)
-> B
The polymorphic right fold of the given list with the given operation and the given initial value.
pub fn foldr_pre
[
B : Qualified,
T : Unqualified,
@D,
@D1
]
( f : T $pre @D -> B -> B,
x : B,
xs : list[T $pre @D] $pre @D1
)
-> B
where
@D1 <= @D
The polymorphic right fold of list with elements in
$pre
.
pub fn group
[
T : Qualified
]
( xs : list[T] $pre @public,
l : uint[18446744073709551616] $pre @public
)
-> list[list[T] $pre @public] $pre @public
Splitting of elements of the given list into groups of the given length.
pub fn id
[
T : Qualified
]
( x : T
)
-> T
The polymorphic identity function.
pub fn impli
[
$S,
@D,
N : Nat
]
( a : bool[N] $S @D,
b : bool[N] $S @D
)
-> bool[N] $S @D
Logical implication.
unchecked eff [*] -> * -> * ! <@D>
pub extern fn list_push
[
Q : Qualified,
@D
]
( ref xs : list[Q] $pre @D,
x : Q
)
-> () $pre @public
Appending the given element to the end of the given list.
pub fn list_to_public_length
[
T : Unqualified,
@D
]
( xs : list[T $pre @D] $pre @D,
n : uint[18446744073709551616] $pre @public
)
-> list[T $pre @D] $pre @public
Truncating the given list at the given public length.
pub fn map
[
T : Qualified,
U : Qualified
]
( f : T -> U,
l : list[T] $pre @public
)
-> list[U] $pre @public
The polymorphic map of elements of the given list with the given function.
pub fn merge
[
N : Nat,
@D
]
( xs : list[uint[N] $pre @D] $pre @public,
ys : list[uint[N] $pre @D] $pre @public
)
-> list[uint[N] $pre @D] $pre @public
Merging two lists that are assumed to be sorted into a new sorted list.
unchecked eff * -> [*] ! <@public>
pub fn nonzero_challenge
[
P : Nat
]
( n : uint $pre @public
)
-> list[uint[P] $pre @verifier] $pre @public
where
Field[P],
Challenge[P]
Generating a list of the given length and consisting of random non-zero field elements.
pub fn pre_uint_list_to_post_array
[
N : Nat,
@D
]
( xs : list[uint[N] $pre @D] $pre @D,
n : uint[18446744073709551616] $pre @public
)
-> arr[uint[N] $post @D] $pre @public
where
Field[N],
Vectorization
Truncating the given list with elements in
$pre
at the given public length and converting the result to a vector on wires.
pub fn prod
[
$S,
@D,
N : Nat,
A : Qualified -> Unqualified
]
( xs : A[uint[N] $S @D] $pre @public
)
-> uint[N] $S @D
where
Array[A]
Product of all elements of the given list or vector.
pub fn prod_pre
[
@D,
@D1,
N : Nat,
A : Qualified -> Unqualified
]
( xs : A[uint[N] $pre @D] $pre @D1
)
-> uint[N] $pre @D
where
@D1 <= @D,
Array[A]
Product of all elements of the given list or vector with elements in
$pre
.
pub fn reverse
[
X : Qualified
]
( l : list[X] $pre @public
)
-> list[X] $pre @public
The given list reversed.
pub fn reverse_pre
[
T : Unqualified,
@D,
@D1
]
( l : list[T $pre @D] $pre @D1
)
-> list[T $pre @D] $pre @D1
where
@D1 <= @D
The given list with elements in
$pre
reversed.
pub fn scalar_prod
[
$S,
@D,
N : Nat
]
( xs : list[uint[N] $S @D] $pre @public,
ys : list[uint[N] $S @D] $pre @public,
lim : uint[18446744073709551616] $pre @public
)
-> uint[N] $S @D
Scalar (dot) product of the initial parts of the given two lists up to the given position.
pub fn sort
[
@D,
N : Nat
]
( xs : list[uint[N] $pre @D] $pre @public
)
-> list[uint[N] $pre @D] $pre @public
Merge sort of the given list.
pub fn sq_sum
[
$S,
@D,
N : Nat
]
( xs : list[uint[N] $S @D] $pre @public
)
-> uint[N] $S @D
Sum of squares of all elements of the given list.
pub fn sum
[
$S,
@D,
N : Nat,
A : Qualified -> Unqualified
]
( xs : A[uint[N] $S @D] $pre @public
)
-> uint[N] $S @D
where
Array[A]
Sum of all elements of the given list or vector.
pub fn sum_pre
[
@D,
@D1,
N : Nat,
A : Qualified -> Unqualified
]
( xs : A[uint[N] $pre @D] $pre @D1
)
-> uint[N] $pre @D
where
@D1 <= @D,
Array[A]
Sum of all elements of the given list or vector with elements in
$pre
.
unchecked eff * -> * -> * -> * ! <$S>
pub fn uint_cond
[
M : Nat,
N : Nat,
$S,
@D
]
( b : bool[M] $S @D,
x : uint[N] $S @D,
y : uint[N] $S @D
)
-> uint[N] $S @D
where
Field[N],
Convertible[M,N]
Choice between two integers. Oblivious in
$post @prover
, evaluating both branches.
unchecked eff * -> * ! <$S>
pub fn uint_downcast
[
N : Nat,
$S,
@D
]
( n : uint[N] $pre @D
)
-> uint[N] $S @D
where
Field[N]
Downcasting the elements of the given list of integers in the stage
$pre
into the given stage. If the given stage is$pre
then does nothing, otherwise applieswire
.
pub fn uint_ensure_post
[
N : Nat,
$S,
@D
]
( x : uint[N] $S @D
)
-> uint[N] $post @D
where
Field[N]
Ensuring that the elements of the given list of integers are in
$post
. If they are then does nothing, otherwise applieswire
.
pub fn uint_list_to_post
[
N : Nat,
@D
]
( xs : list[uint[N] $pre @D] $pre @public
)
-> list[uint[N] $post @D] $pre @public
where
Field[N]
Putting the elements of the given list with integral elements in
$pre
on wires.
pub fn uint_list_to_pre
[
N : Nat,
$S,
@D
]
( xs : list[uint[N] $S @D] $pre @public
)
-> list[uint[N] $pre @D] $pre @public
Converting the elements of the given list of integers to the stage
$pre
.
pub fn uint_list_to_prover
[
N : Nat,
$S,
@D
]
( xs : list[uint[N] $S @D] $pre @public
)
-> list[uint[N] $S @prover] $pre @public
Converting the elements of the given list of integers to the domain
@prover
.
pub fn undefined
[
T : Unqualified,
$S,
@D
]
()
-> T $S @D
An assertion failure along with an infinite loop.
unchecked eff * -> * ! <$S>
pub fn univ_assert
[
N : Nat,
$S,
@D
]
( x : bool[N] $S @D
)
-> () $pre @public
where
Field[N]
Assertion that does not depend on stage.
unchecked eff * -> * ! <$S>
pub fn univ_assert_zero
[
N : Nat,
$S,
@D
]
( x : uint[N] $S @D
)
-> () $pre @public
where
Field[N]
Assertion of equality to zero that does not depend on stage.
pub fn univ_conditional_assert
[
@D,
$S,
N : Nat
]
( c : bool[N] $S @D,
b : bool[N] $S @D
)
-> () $pre @public
where
Field[N]
Assertion, provided that the given condition is true. Does not depend on stage.
pub fn univ_conditional_assert_zero
[
@D,
$S,
N : Nat
]
( c : bool[N] $S @D,
x : uint[N] $S @D
)
-> () $pre @public
where
Field[N]
Assertion of equality to zero, provided that the given condition is true. Does not depend on stage.
pub fn zip_with
[
T1 : Qualified,
T2 : Qualified,
T3 : Qualified,
@D
]
( f : T1 -> T2 -> T3,
xs : list[T1] $pre @D,
ys : list[T2] $pre @D
)
-> list[T3] $pre @D
The polymorphic zip of corresponding elements of two lists with the given operation. The lists must be of the same length.
pub fn zip_with_upto
[
T1 : Qualified,
T2 : Qualified,
T3 : Qualified,
@D
]
( f : T1 -> T2 -> T3,
xs : list[T1] $pre @D,
ys : list[T2] $pre @D,
lim : uint[18446744073709551616] $pre @D
)
-> list[T3] $pre @D
The polymorphic zip of corresponding elements of two lists with the given operation, up to the given position.