assert_lt!
Fail compilation unless each element of a static vector is less than the matching element of another. Assertions
assert_lt! lhs, rhs[, "message"]
Checks lhs[i] < rhs[i] for every index while the program is compiled, comparing the canonical integer values of the field elements in [0, p). Nothing is added to the R1CS; to prove a comparison about witness values use the comparison functions of the standard library such as lt_bits.
Arguments
lhs,rhs- Static vectors (or scalars) of equal length. Witness values are an error.
"message"- Optional string literal appended to the error.
Returns
Nothing, it is used as a statement.
Constraints
None.
Example
(let x) static n = len! x assert_lt! 0, n, "need at least one input" assert_lt! [1 2], [2 3] n
assert_lt! 0 - 1, 0
Notes
Comparisons are on canonical values, so a "negative" value such as 0 - 1 is p - 1, the largest element, as the second example shows. See also assert_lte! and if_lt!.
Used in the standard library
bits/to_bits_exact, ext/ext_poly_eval, lattice/lattice_squeeze, mersenne61/mldsa/mldsa_reduce, mldsa/mldsa44_parse_sig, mldsa/mldsa_hint_unpack, mldsa/mldsa_rej_ntt_poly, mldsa/mldsa_sample_in_ball, mldsa/mldsa_use_hint, oraccle/oraccle_squeeze, slip/slip_r1cs_arg_verify, sym_mat_index, typed/typed_bytes_lattice, typed/typed_lex_chacha, typed/typed_lex_width, typed/typed_width