diff --git a/air-script/tests/aux_trace/aux_trace.air b/air-script/tests/aux_trace/aux_trace.air index d87e2786..7aafd2ee 100644 --- a/air-script/tests/aux_trace/aux_trace.air +++ b/air-script/tests/aux_trace/aux_trace.air @@ -1,36 +1,36 @@ def AuxiliaryAir trace_columns { - main: [a, b, c] - aux: [p0, p1] + main: [a, b, c], + aux: [p0, p1], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [2] + rand: [2], } boundary_constraints { - enf a.first = 1 - enf b.first = 1 + enf a.first = 1; + enf b.first = 1; - enf p0.first = 1 - enf p0.last = 1 + enf p0.first = 1; + enf p0.last = 1; # auxiliary boundary constraint with a random value - enf p1.first = $rand[0] - enf p1.last = 1 + enf p1.first = $rand[0]; + enf p1.last = 1; } integrity_constraints { - enf a' = b + a * b * c - enf b' = c + a' - enf c = a + b + enf a' = b + a * b * c; + enf b' = c + a'; + enf c = a + b; # integrity constraints against the auxiliary trace with random values - enf p0' = p0 * (a + $rand[0] + b + $rand[1]) - enf p1 = p1' * (c + $rand[0]) + enf p0' = p0 * (a + $rand[0] + b + $rand[1]); + enf p1 = p1' * (c + $rand[0]); } \ No newline at end of file diff --git a/air-script/tests/binary/binary.air b/air-script/tests/binary/binary.air index 96187d2c..50e21805 100644 --- a/air-script/tests/binary/binary.air +++ b/air-script/tests/binary/binary.air @@ -1,18 +1,18 @@ def BinaryAir trace_columns { - main: [a, b] + main: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a^2 - a = 0 - enf b^2 - b = 0 + enf a^2 - a = 0; + enf b^2 - b = 0; } \ No newline at end of file diff --git a/air-script/tests/bitwise/bitwise.air b/air-script/tests/bitwise/bitwise.air index c9ecdb12..2fc10366 100644 --- a/air-script/tests/bitwise/bitwise.air +++ b/air-script/tests/bitwise/bitwise.air @@ -1,58 +1,58 @@ def BitwiseAir public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [s, a, b, a0, a1, a2, a3, b0, b1, b2, b3, zp, z, dummy] + main: [s, a, b, a0, a1, a2, a3, b0, b1, b2, b3, zp, z, dummy], } periodic_columns { - k0: [1, 0, 0, 0, 0, 0, 0, 0] - k1: [1, 1, 1, 1, 1, 1, 1, 0] + k0: [1, 0, 0, 0, 0, 0, 0, 0], + k1: [1, 1, 1, 1, 1, 1, 1, 0], } boundary_constraints { # This is a dummy trace column to satisfy requirement of at least one boundary constraint. - enf dummy.first = 0 + enf dummy.first = 0; } integrity_constraints { # Enforce that selector must be binary - enf s^2 - s = 0 + enf s^2 - s = 0; # Enforce that selector should stay the same throughout the cycle. - enf k1 * (s' - s) = 0 + enf k1 * (s' - s) = 0; # Enforce that input is decomposed into valid bits - enf a0^2 - a0 = 0 - enf a1^2 - a1 = 0 - enf a2^2 - a2 = 0 - enf a3^2 - a3 = 0 - enf b0^2 - b0 = 0 - enf b1^2 - b1 = 0 - enf b2^2 - b2 = 0 - enf b3^2 - b3 = 0 + enf a0^2 - a0 = 0; + enf a1^2 - a1 = 0; + enf a2^2 - a2 = 0; + enf a3^2 - a3 = 0; + enf b0^2 - b0 = 0; + enf b1^2 - b1 = 0; + enf b2^2 - b2 = 0; + enf b3^2 - b3 = 0; # Enforce that the values in the column a in the first row should be the aggregation of the # decomposed bit columns a0..a3. - enf k0 * (a - (2^0 * a0 + 2^1 * a1 + 2^2 * a2 + 2^3 * a3)) = 0 + enf k0 * (a - (2^0 * a0 + 2^1 * a1 + 2^2 * a2 + 2^3 * a3)) = 0; # Enforce that the values in the column b in the first row should be the aggregation of the # decomposed bit columns b0..b3. - enf k0 * (b - (2^0 * b0 + 2^1 * b1 + 2^2 * b2 + 2^3 * b3)) = 0 + enf k0 * (b - (2^0 * b0 + 2^1 * b1 + 2^2 * b2 + 2^3 * b3)) = 0; # Enforce that for all rows in an 8-row cycle except for the last one, the values in a and b # columns are increased by the values contained in the individual bit columns a and b. - enf k1 * (a' - (a * 16 + 2^0 * a0 + 2^1 * a1 + 2^2 * a2 + 2^3 * a3)) = 0 - enf k1 * (b' - (b * 16 + 2^0 * b0 + 2^1 * b1 + 2^2 * b2 + 2^3 * b3)) = 0 + enf k1 * (a' - (a * 16 + 2^0 * a0 + 2^1 * a1 + 2^2 * a2 + 2^3 * a3)) = 0; + enf k1 * (b' - (b * 16 + 2^0 * b0 + 2^1 * b1 + 2^2 * b2 + 2^3 * b3)) = 0; # Enforce that in the first row, the aggregated output value of the previous row should be 0. - enf k0 * zp = 0 + enf k0 * zp = 0; # Enforce that for each row except the last, the aggregated output value must equal the # previous aggregated output value in the next row. - enf k1 * (z - zp') = 0 + enf k1 * (z - zp') = 0; # Enforce that for all rows the value in the z column is computed by multiplying the previous # output value (from the zp column in the current row) by 16 and then adding it to the bitwise @@ -62,5 +62,5 @@ integrity_constraints { # enforced when s = 1. Because the selectors for the AND and XOR operations are mutually # exclusive, the constraints for different operations can be aggregated into the same result # indices. - enf (1 - s) * (z - (zp * 16 + 2^0 * a0 * b0 + 2^1 * a1 * b1 + 2^2 * a2 * b2 + 2^3 * a3 * b3)) + s * (z - (zp * 16 + 2^0 * (a0 + b0 - 2 * a0 * b0) + 2^1 * (a1 + b1 - 2 * a1 * b1) + 2^2 * (a2 + b2 - 2 * a2 * b2) + 2^3 * (a3 + b3 - 2 * a3 * b3))) = 0 + enf (1 - s) * (z - (zp * 16 + 2^0 * a0 * b0 + 2^1 * a1 * b1 + 2^2 * a2 * b2 + 2^3 * a3 * b3)) + s * (z - (zp * 16 + 2^0 * (a0 + b0 - 2 * a0 * b0) + 2^1 * (a1 + b1 - 2 * a1 * b1) + 2^2 * (a2 + b2 - 2 * a2 * b2) + 2^3 * (a3 + b3 - 2 * a3 * b3))) = 0; } \ No newline at end of file diff --git a/air-script/tests/constants/constants.air b/air-script/tests/constants/constants.air index 239afd91..3601b7ff 100644 --- a/air-script/tests/constants/constants.air +++ b/air-script/tests/constants/constants.air @@ -1,34 +1,34 @@ def ConstantsAir -const A = 1 -const B = [0, 1] -const C = [[1, 2], [2, 0]] +const A = 1; +const B = [0, 1]; +const C = [[1, 2], [2, 0]]; trace_columns { - main: [a, b, c, d] - aux: [e, f, g] + main: [a, b, c, d], + aux: [e, f, g], } public_inputs { - program_hash: [4] - stack_inputs: [4] - stack_outputs: [20] - overflow_addrs: [4] + program_hash: [4], + stack_inputs: [4], + stack_outputs: [20], + overflow_addrs: [4], } boundary_constraints { - enf a.first = A - enf b.first = A + B[0] * C[0][1] - enf c.first = (B[0] - C[1][1]) * A - enf d.first = A + B[0] - B[1] + C[0][0] - C[0][1] + C[1][0] - C[1][1] - enf e.first = A + B[0] * C[0][1] - enf e.last = A - B[1] * C[0][0] + enf a.first = A; + enf b.first = A + B[0] * C[0][1]; + enf c.first = (B[0] - C[1][1]) * A; + enf d.first = A + B[0] - B[1] + C[0][0] - C[0][1] + C[1][0] - C[1][1]; + enf e.first = A + B[0] * C[0][1]; + enf e.last = A - B[1] * C[0][0]; } integrity_constraints { - enf a' = a + A - enf b' = B[0] * b - enf c' = (C[0][0] + B[0]) * c - enf e' = e + A + B[0] * C[0][1] - enf e = A + B[1] * C[1][1] + enf a' = a + A; + enf b' = B[0] * b; + enf c' = (C[0][0] + B[0]) * c; + enf e' = e + A + B[0] * C[0][1]; + enf e = A + B[1] * C[1][1]; } \ No newline at end of file diff --git a/air-script/tests/constraint_comprehension/cc_with_evaluators.air b/air-script/tests/constraint_comprehension/cc_with_evaluators.air index 7f68f975..003e020f 100644 --- a/air-script/tests/constraint_comprehension/cc_with_evaluators.air +++ b/air-script/tests/constraint_comprehension/cc_with_evaluators.air @@ -1,22 +1,22 @@ def ConstraintComprehensionAir ev are_equal([], [x, y]) { - enf x = y + enf x = y; } trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - enf are_equal([], [c, d]) for (c, d) in (c, d) + enf are_equal([], [c, d]) for (c, d) in (c, d); } \ No newline at end of file diff --git a/air-script/tests/constraint_comprehension/constraint_comprehension.air b/air-script/tests/constraint_comprehension/constraint_comprehension.air index e48eeb29..928fbf13 100644 --- a/air-script/tests/constraint_comprehension/constraint_comprehension.air +++ b/air-script/tests/constraint_comprehension/constraint_comprehension.air @@ -1,18 +1,18 @@ def ConstraintComprehensionAir trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - enf c = d for (c, d) in (c, d) + enf c = d for (c, d) in (c, d); } \ No newline at end of file diff --git a/air-script/tests/evaluators/evaluators.air b/air-script/tests/evaluators/evaluators.air index 6a206d31..9eb6270d 100644 --- a/air-script/tests/evaluators/evaluators.air +++ b/air-script/tests/evaluators/evaluators.air @@ -1,33 +1,33 @@ def EvaluatorsAir ev are_unchanged([x, y, z]) { - enf x' = x - enf y' = y - enf z' = z + enf x' = x; + enf y' = y; + enf z' = z; } ev is_binary([x]) { - enf x^2 = x + enf x^2 = x; } ev are_all_binary([c[3]]) { - enf is_binary([c]) for c in c + enf is_binary([c]) for c in c; } trace_columns { - main: [b, c[3], d[3]] + main: [b, c[3], d[3]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf b.first = 0 + enf b.first = 0; } integrity_constraints { - enf are_unchanged([b, c[1], d[2]]) - enf is_binary([b]) - enf are_all_binary([c]) + enf are_unchanged([b, c[1], d[2]]); + enf is_binary([b]); + enf are_all_binary([c]); } \ No newline at end of file diff --git a/air-script/tests/functions/functions_complex.air b/air-script/tests/functions/functions_complex.air index 192ed62d..fc877518 100644 --- a/air-script/tests/functions/functions_complex.air +++ b/air-script/tests/functions/functions_complex.air @@ -1,45 +1,45 @@ def FunctionsAir fn get_multiplicity_flags(s0: felt, s1: felt) -> felt[4] { - return [!s0 & !s1, s0 & !s1, !s0 & s1, s0 & s1] + return [!s0 & !s1, s0 & !s1, !s0 & s1, s0 & s1]; } fn fold_vec(a: felt[12]) -> felt { - return sum([x for x in a]) + return sum([x for x in a]); } fn fold_scalar_and_vec(a: felt, b: felt[12]) -> felt { - let m = fold_vec(b) - let n = m + 1 - let o = n * 2 - return o + let m = fold_vec(b); + let n = m + 1; + let o = n * 2; + return o; } trace_columns { - main: [t, s0, s1, v, b[12]] - aux: [b_range] + main: [t, s0, s1, v, b[12]], + aux: [b_range], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alpha: [16] + alpha: [16], } boundary_constraints { - enf v.first = 0 + enf v.first = 0; } integrity_constraints { - # let val = $alpha[0] + v - let f = get_multiplicity_flags(s0, s1) - let z = v^7 * f[3] + v^2 * f[2] + v * f[1] + f[0] - # let folded_value = fold_scalar_and_vec(v, b) - enf b_range' = b_range * (z * t - t + 1) - # enf b_range' = b_range * 2 - let y = fold_scalar_and_vec(v, b) - # let c = fold_scalar_and_vec(t, b) - enf v' = y + # let val = $alpha[0] + v; + let f = get_multiplicity_flags(s0, s1); + let z = v^7 * f[3] + v^2 * f[2] + v * f[1] + f[0]; + # let folded_value = fold_scalar_and_vec(v, b); + enf b_range' = b_range * (z * t - t + 1); + # enf b_range' = b_range * 2; + let y = fold_scalar_and_vec(v, b); + # let c = fold_scalar_and_vec(t, b); + enf v' = y; } diff --git a/air-script/tests/functions/functions_simple.air b/air-script/tests/functions/functions_simple.air index 2f93227b..faf33c17 100644 --- a/air-script/tests/functions/functions_simple.air +++ b/air-script/tests/functions/functions_simple.air @@ -1,90 +1,90 @@ def FunctionsAir fn fold_sum(a: felt[4]) -> felt { - return a[0] + a[1] + a[2] + a[3] + return a[0] + a[1] + a[2] + a[3]; } fn fold_vec(a: felt[4]) -> felt { - let m = a[0] * a[1] - let n = m * a[2] - let o = n * a[3] - return o + let m = a[0] * a[1]; + let n = m * a[2]; + let o = n * a[3]; + return o; } fn cube(base: felt) -> felt { - return base^3 + return base^3; } fn cube_vec(base: felt[4]) -> felt[4] { - let cubed_vec = [x^3 for x in base] - return cubed_vec + let cubed_vec = [x^3 for x in base]; + return cubed_vec; } fn func_return(a: felt[4]) -> felt { - return fold_sum(a) + return fold_sum(a); } fn func_func_return(a: felt[4]) -> felt { - return fold_sum(a) * fold_vec(a) + return fold_sum(a) * fold_vec(a); } fn bin_return(a: felt[4]) -> felt { - return fold_sum(a) * 4 + return fold_sum(a) * 4; } trace_columns { - main: [t, s0, s1, v, b[4]] - aux: [b_range] + main: [t, s0, s1, v, b[4]], + aux: [b_range], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alpha: [16] + alpha: [16], } boundary_constraints { - enf v.first = 0 + enf v.first = 0; } integrity_constraints { # -------- function call is assigned to a variable and used in a binary expression ------------ # binary expression invloving scalar expressions - let simple_expression = t * v - enf simple_expression = 1 + let simple_expression = t * v; + enf simple_expression = 1; # binary expression involving one function call - let folded_vec = fold_vec(b) * v - enf folded_vec = 1 + let folded_vec = fold_vec(b) * v; + enf folded_vec = 1; # binary expression involving two function calls - let complex_fold = fold_sum(b) * fold_vec(b) - enf complex_fold = 1 + let complex_fold = fold_sum(b) * fold_vec(b); + enf complex_fold = 1; # -------- function calls used in constraint ------------ - enf fold_vec(b) = 1 - enf t * fold_vec(b) = 1 - enf s0 + fold_sum(b) * fold_vec(b) = 1 + enf fold_vec(b) = 1; + enf t * fold_vec(b) = 1; + enf s0 + fold_sum(b) * fold_vec(b) = 1; # -------- functions with function calls as return statements ------------ - enf func_return(b) = 1 - enf func_func_return(b) = 1 - enf bin_return(b) = 1 + enf func_return(b) = 1; + enf func_func_return(b) = 1; + enf bin_return(b) = 1; # -------- different types of arguments in a function call ------------ # function call with a function call as an argument - # enf fold_vec(cube_vec(b)) = 1 + # enf fold_vec(cube_vec(b)) = 1; # function call as value in list comprehension - # let folded_vec = sum([cube(x) for x in b]) - # enf t * folded_vec = 1 + # let folded_vec = sum([cube(x) for x in b]); + # enf t * folded_vec = 1; # function call as iterable in list comprehension - # let folded_vec = sum([x + 1 for x in cube_vec(b)]) - # enf t * folded_vec = 1 + # let folded_vec = sum([x + 1 for x in cube_vec(b)]); + # enf t * folded_vec = 1; } diff --git a/air-script/tests/functions/inlined_functions_simple.air b/air-script/tests/functions/inlined_functions_simple.air index 4fcde262..fa9bb48d 100644 --- a/air-script/tests/functions/inlined_functions_simple.air +++ b/air-script/tests/functions/inlined_functions_simple.air @@ -3,50 +3,50 @@ def FunctionsAir trace_columns { - main: [t, s0, s1, v, b[4]] - aux: [b_range] + main: [t, s0, s1, v, b[4]], + aux: [b_range], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alpha: [16] + alpha: [16], } boundary_constraints { - enf v.first = 0 + enf v.first = 0; } integrity_constraints { # -------- function call is assigned to a variable and used in a binary expression ------------ # binary expression invloving scalar expressions - let simple_expression = t * v - enf simple_expression = 1 + let simple_expression = t * v; + enf simple_expression = 1; # binary expression involving one function call # fold_vec function body where o is the return value of the function - let m = b[0] * b[1] - let n = m * b[2] - let o = n * b[3] + let m = b[0] * b[1]; + let n = m * b[2]; + let o = n * b[3]; - let folded_vec = o * v - enf folded_vec = 1 + let folded_vec = o * v; + enf folded_vec = 1; # binary expression involving two function calls - let complex_fold = (b[0] + b[1] + b[2] + b[3]) * o - enf complex_fold = 1 + let complex_fold = (b[0] + b[1] + b[2] + b[3]) * o; + enf complex_fold = 1; # function calls used in constraints - enf o = 1 - enf t * o = 1 - enf s0 + (b[0] + b[1] + b[2] + b[3]) * o = 1 + enf o = 1; + enf t * o = 1; + enf s0 + (b[0] + b[1] + b[2] + b[3]) * o = 1; # -------- functions with function calls as return statements ------------ - enf b[0] + b[1] + b[2] + b[3] = 1 - enf (b[0] + b[1] + b[2] + b[3]) * o = 1 - enf (b[0] + b[1] + b[2] + b[3]) * 4 = 1 + enf b[0] + b[1] + b[2] + b[3] = 1; + enf (b[0] + b[1] + b[2] + b[3]) * o = 1; + enf (b[0] + b[1] + b[2] + b[3]) * 4 = 1; } diff --git a/air-script/tests/indexed_trace_access/indexed_trace_access.air b/air-script/tests/indexed_trace_access/indexed_trace_access.air index 8ac4dc13..4a047272 100644 --- a/air-script/tests/indexed_trace_access/indexed_trace_access.air +++ b/air-script/tests/indexed_trace_access/indexed_trace_access.air @@ -1,19 +1,19 @@ def TraceAccessAir trace_columns { - main: [a, b] - aux: [c, d] + main: [a, b], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } integrity_constraints { - enf $main[0]' = $main[1] + 1 - enf $aux[0]' = $aux[1] + 1 + enf $main[0]' = $main[1] + 1; + enf $aux[0]' = $aux[1] + 1; } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } \ No newline at end of file diff --git a/air-script/tests/list_comprehension/list_comprehension.air b/air-script/tests/list_comprehension/list_comprehension.air index 36bad15e..1ab5cb6e 100644 --- a/air-script/tests/list_comprehension/list_comprehension.air +++ b/air-script/tests/list_comprehension/list_comprehension.air @@ -1,31 +1,31 @@ def ListComprehensionAir trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b[3], c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b[3], c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = [fmp for fmp in fmp] - enf clk = x[1] + let x = [fmp for fmp in fmp]; + enf clk = x[1]; - let enumerate = [2^i * c for (i, c) in (0..4, c)] - enf a = clk * enumerate[3] + let enumerate = [2^i * c for (i, c) in (0..4, c)]; + enf a = clk * enumerate[3]; - let diff_ident_iterables = [x' - y' for (x, y) in (c, d)] - enf a = clk * diff_ident_iterables[0] + let diff_ident_iterables = [x' - y' for (x, y) in (c, d)]; + enf a = clk * diff_ident_iterables[0]; - let diff_slice_iterables = [x - y for (x, y) in (c[0..2], d[1..3])] - enf b[1] = clk * diff_slice_iterables[1] + let diff_slice_iterables = [x - y for (x, y) in (c[0..2], d[1..3])]; + enf b[1] = clk * diff_slice_iterables[1]; - let m = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])] - enf a = m[0] + m[1] + m[2] + let m = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])]; + enf a = m[0] + m[1] + m[2]; } \ No newline at end of file diff --git a/air-script/tests/list_folding/list_folding.air b/air-script/tests/list_folding/list_folding.air index 8b47372c..274aeb56 100644 --- a/air-script/tests/list_folding/list_folding.air +++ b/air-script/tests/list_folding/list_folding.air @@ -1,32 +1,32 @@ def ListFoldingAir trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b[4], c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b[4], c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x0 = sum(c) - let y0 = prod(d) - enf b[0]' = x0 + y0 + let x0 = sum(c); + let y0 = prod(d); + enf b[0]' = x0 + y0; - let x1 = sum([c[0], c[1], c[2], c[3]]) - let y1 = prod([d[0], d[1], d[2], d[3]]) - enf b[1]' = x1 + y1 + let x1 = sum([c[0], c[1], c[2], c[3]]); + let y1 = prod([d[0], d[1], d[2], d[3]]); + enf b[1]' = x1 + y1; - let x2 = sum([c * d for (c, d) in (c, d)]) - let y2 = prod([c + d for (c, d) in (c, d)]) - enf b[2]' = x2 + y2 + let x2 = sum([c * d for (c, d) in (c, d)]); + let y2 = prod([c + d for (c, d) in (c, d)]); + enf b[2]' = x2 + y2; - let x3 = sum([c * d for (c, d) in (c, d)]) - let y3 = [m + x3 for m in fmp] - enf b[3]' = y3[0] + x3 + let x3 = sum([c * d for (c, d) in (c, d)]); + let y3 = [m + x3 for m in fmp]; + enf b[3]' = y3[0] + x3; } \ No newline at end of file diff --git a/air-script/tests/periodic_columns/periodic_columns.air b/air-script/tests/periodic_columns/periodic_columns.air index 9605bff5..bbc7aa5c 100644 --- a/air-script/tests/periodic_columns/periodic_columns.air +++ b/air-script/tests/periodic_columns/periodic_columns.air @@ -1,23 +1,23 @@ def PeriodicColumnsAir trace_columns { - main: [a, b, c] + main: [a, b, c], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } periodic_columns { - k0: [1, 0, 0, 0] - k1: [1, 1, 1, 1, 1, 1, 1, 0] + k0: [1, 0, 0, 0], + k1: [1, 1, 1, 1, 1, 1, 1, 0], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf k0 * (b + c) = 0 - enf k1 * (a' - a) = 0 + enf k0 * (b + c) = 0; + enf k1 * (a' - a) = 0; } \ No newline at end of file diff --git a/air-script/tests/pub_inputs/pub_inputs.air b/air-script/tests/pub_inputs/pub_inputs.air index 0af31765..e25e8fed 100644 --- a/air-script/tests/pub_inputs/pub_inputs.air +++ b/air-script/tests/pub_inputs/pub_inputs.air @@ -1,28 +1,28 @@ def PubInputsAir trace_columns { - main: [a, b, c, d] + main: [a, b, c, d], } public_inputs { - program_hash: [4] - stack_inputs: [4] - stack_outputs: [20] - overflow_addrs: [4] + program_hash: [4], + stack_inputs: [4], + stack_outputs: [20], + overflow_addrs: [4], } boundary_constraints { - enf a.first = stack_inputs[0] - enf b.first = stack_inputs[1] - enf c.first = stack_inputs[2] - enf d.first = stack_inputs[3] + enf a.first = stack_inputs[0]; + enf b.first = stack_inputs[1]; + enf c.first = stack_inputs[2]; + enf d.first = stack_inputs[3]; - enf a.last = stack_outputs[0] - enf b.last = stack_outputs[1] - enf c.last = stack_outputs[2] - enf d.last = stack_outputs[3] + enf a.last = stack_outputs[0]; + enf b.last = stack_outputs[1]; + enf c.last = stack_outputs[2]; + enf d.last = stack_outputs[3]; } integrity_constraints { - enf a' = b + c + enf a' = b + c; } \ No newline at end of file diff --git a/air-script/tests/random_values/random_values_bindings.air b/air-script/tests/random_values/random_values_bindings.air index 6eddcfea..79c27446 100644 --- a/air-script/tests/random_values/random_values_bindings.air +++ b/air-script/tests/random_values/random_values_bindings.air @@ -1,23 +1,23 @@ def RandomValuesAir trace_columns { - main: [a, b] - aux: [c, d] + main: [a, b], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alphas: [x, y[14], z] + alphas: [x, y[14], z], } boundary_constraints { - enf c.first = $alphas[5] + y[2] + z - enf c.last = x + $alphas[15] + y[10] + enf c.first = $alphas[5] + y[2] + z; + enf c.last = x + $alphas[15] + y[10]; } integrity_constraints { - enf c' = z - $alphas[0] + y[2] + enf c' = z - $alphas[0] + y[2]; } \ No newline at end of file diff --git a/air-script/tests/random_values/random_values_simple.air b/air-script/tests/random_values/random_values_simple.air index 5e1a3d34..c8b2b8c4 100644 --- a/air-script/tests/random_values/random_values_simple.air +++ b/air-script/tests/random_values/random_values_simple.air @@ -1,23 +1,23 @@ def RandomValuesAir trace_columns { - main: [a, b] - aux: [c, d] + main: [a, b], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [16] + rand: [16], } boundary_constraints { - enf c.first = $rand[5] + $rand[3] + $rand[15] - enf c.last = $rand[0] + $rand[15] + $rand[11] + enf c.first = $rand[5] + $rand[3] + $rand[15]; + enf c.last = $rand[0] + $rand[15] + $rand[11]; } integrity_constraints { - enf c' = $rand[15] - $rand[0] + $rand[3] + enf c' = $rand[15] - $rand[0] + $rand[3]; } \ No newline at end of file diff --git a/air-script/tests/selectors/selectors.air b/air-script/tests/selectors/selectors.air index 4fca95c3..94ec3653 100644 --- a/air-script/tests/selectors/selectors.air +++ b/air-script/tests/selectors/selectors.air @@ -1,21 +1,21 @@ def SelectorsAir trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = 0 when s[0] & !s[1] + enf clk' = 0 when s[0] & !s[1]; enf match { case s[0] & s[1] & s[2]: clk' = clk case !s[1] & !s[2]: clk' = 1 - } + }; } \ No newline at end of file diff --git a/air-script/tests/selectors/selectors_with_evaluators.air b/air-script/tests/selectors/selectors_with_evaluators.air index 4a0bd992..607ada46 100644 --- a/air-script/tests/selectors/selectors_with_evaluators.air +++ b/air-script/tests/selectors/selectors_with_evaluators.air @@ -1,33 +1,33 @@ def SelectorsAir ev next_is_zero([clk]) { - enf clk' = 0 + enf clk' = 0; } ev is_unchanged([clk, s]) { - enf clk' = clk when s + enf clk' = clk when s; } ev next_is_one([clk]) { - enf clk' = 1 + enf clk' = 1; } trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf next_is_zero([clk]) when s[0] & !s[1] + enf next_is_zero([clk]) when s[0] & !s[1]; enf match { case s[1] & s[2]: is_unchanged([clk, s[0]]) case !s[1] & !s[2]: next_is_one([clk]) - } + }; } \ No newline at end of file diff --git a/air-script/tests/system/system.air b/air-script/tests/system/system.air index 01c0112b..e20b05ba 100644 --- a/air-script/tests/system/system.air +++ b/air-script/tests/system/system.air @@ -1,17 +1,17 @@ def SystemAir trace_columns { - main: [clk, fmp, ctx] + main: [clk, fmp, ctx], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } \ No newline at end of file diff --git a/air-script/tests/trace_col_groups/trace_col_groups.air b/air-script/tests/trace_col_groups/trace_col_groups.air index b7f46c57..67e7d6e0 100644 --- a/air-script/tests/trace_col_groups/trace_col_groups.air +++ b/air-script/tests/trace_col_groups/trace_col_groups.air @@ -1,19 +1,19 @@ def TraceColGroupAir trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[3]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[3]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } integrity_constraints { - enf fmp[1]' = fmp[1] + 1 - enf fmp[0]' = fmp[0] - 1 + enf fmp[1]' = fmp[1] + 1; + enf fmp[0]' = fmp[0] - 1; } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } \ No newline at end of file diff --git a/air-script/tests/variables/variables.air b/air-script/tests/variables/variables.air index fec65ae7..79b12536 100644 --- a/air-script/tests/variables/variables.air +++ b/air-script/tests/variables/variables.air @@ -3,46 +3,46 @@ def VariablesAir trace_columns { - main: [s, a, b, c] - aux: [p] + main: [s, a, b, c], + aux: [p], } public_inputs { - stack_inputs: [16] - stack_outputs: [16] + stack_inputs: [16], + stack_outputs: [16], } periodic_columns { - k0: [1, 1, 1, 1, 1, 1, 1, 0] + k0: [1, 1, 1, 1, 1, 1, 1, 0], } random_values { - rand: [1] + rand: [1], } boundary_constraints { - enf a.first = 0 - enf a.last = 1 + enf a.first = 0; + enf a.last = 1; } integrity_constraints { - let m = 0 + let m = 0; # the selector must be binary. - enf s^2 = s + enf s^2 = s; - let n = [2 * 3, s] - let o = [[s', 3], [4 - 2, 8 + 8]] + let n = [2 * 3, s]; + let o = [[s', 3], [4 - 2, 8 + 8]]; # selector should stay the same for all rows of an 8-row cycle. - enf k0 * (s' - s) = m + enf k0 * (s' - s) = m; # c = a + b when s = 0. - enf (1 - s) * (c - a - b) = n[0] - n[1] + enf (1 - s) * (c - a - b) = n[0] - n[1]; # c = a * b when s = 1. - enf s * (c - a * b) = o[0][0] - o[0][1] - o[1][0] + enf s * (c - a * b) = o[0][0] - o[0][1] - o[1][0]; # the auxiliary column contains the product of values of c offset by a random value. - enf p' = p * (c + $rand[0]) + enf p' = p * (c + $rand[0]); } \ No newline at end of file diff --git a/codegen/masm/tests/test_aux.rs b/codegen/masm/tests/test_aux.rs index 2455165e..6907d537 100644 --- a/codegen/masm/tests/test_aux.rs +++ b/codegen/masm/tests/test_aux.rs @@ -12,26 +12,26 @@ static SIMPLE_AUX_AIR: &str = " def SimpleAux trace_columns { - main: [a] - aux: [b] + main: [a], + aux: [b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a + a = 0 - enf a - a = 0 - enf a * a = 0 + enf a + a = 0; + enf a - a = 0; + enf a * a = 0; - enf b + a = 0 - enf b - a = 0 - enf b * a = 0 + enf b + a = 0; + enf b - a = 0; + enf b * a = 0; }"; #[test] diff --git a/codegen/masm/tests/test_basic_arithmetic.rs b/codegen/masm/tests/test_basic_arithmetic.rs index a546f74e..17572046 100644 --- a/codegen/masm/tests/test_basic_arithmetic.rs +++ b/codegen/masm/tests/test_basic_arithmetic.rs @@ -12,25 +12,25 @@ static ARITH_AIR: &str = " def SimpleArithmetic trace_columns { - main: [a, b] + main: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a + a = 0 - enf a - a = 0 - enf a * a = 0 + enf a + a = 0; + enf a - a = 0; + enf a * a = 0; - enf b + a = 0 - enf b - a = 0 - enf b * a = 0 + enf b + a = 0; + enf b - a = 0; + enf b * a = 0; }"; #[test] @@ -104,23 +104,23 @@ static EXP_AIR: &str = " def Exp trace_columns { - main: [a, b] + main: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf b^1 = 0 - enf b^2 = 0 - enf b^3 = 0 - enf b^4 = 0 - enf b^5 = 0 + enf b^1 = 0; + enf b^2 = 0; + enf b^3 = 0; + enf b^4 = 0; + enf b^5 = 0; }"; #[test] @@ -193,19 +193,19 @@ static LONG_TRACE: &str = " def LongTrace trace_columns { - main: [a, b, c, d, e, f, g, h, i] + main: [a, b, c, d, e, f, g, h, i], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a * b * c + d - e = 0 + enf a * b * c + d - e = 0; }"; #[test] @@ -275,19 +275,19 @@ static VECTOR: &str = " def Vector trace_columns { - main: [clk, fmp[2]] + main: [clk, fmp[2]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk - fmp[0] + fmp[1] = 0 + enf clk - fmp[0] + fmp[1] = 0; }"; #[test] @@ -355,20 +355,20 @@ static MULTIPLE_ROWS_AIR: &str = " def MultipleRows trace_columns { - main: [a, b] + main: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a' = a * 2 - enf b' = a + b + enf a' = a * 2; + enf b' = a + b; }"; #[test] diff --git a/codegen/masm/tests/test_boundary.rs b/codegen/masm/tests/test_boundary.rs index 5a18856f..bbe51765 100644 --- a/codegen/masm/tests/test_boundary.rs +++ b/codegen/masm/tests/test_boundary.rs @@ -12,24 +12,24 @@ static SIMPLE_BOUNDARY_AIR: &str = " def SimpleBoundary trace_columns { - main: [a, b, len] + main: [a, b, len], } public_inputs { - target: [1] + target: [1], } boundary_constraints { - enf a.first = 1 - enf b.first = 1 + enf a.first = 1; + enf b.first = 1; - enf len.first = 0 - enf len.last = target[0] + enf len.first = 0; + enf len.last = target[0]; } integrity_constraints { - enf a' = a + b - enf b' = a + enf a' = a + b; + enf b' = a; }"; #[test] @@ -107,42 +107,42 @@ fn test_simple_boundary() { static COMPLEX_BOUNDARY_AIR: &str = " def ComplexBoundary -const A = 1 -const B = [0, 1] -const C = [[1, 2], [2, 0]] +const A = 1; +const B = [0, 1]; +const C = [[1, 2], [2, 0]]; trace_columns { - main: [a, b, c, d, e[2]] - aux: [f] + main: [a, b, c, d, e[2]], + aux: [f], } public_inputs { - stack_inputs: [2] - stack_outputs: [2] + stack_inputs: [2], + stack_outputs: [2], } random_values { - rand: [2] + rand: [2], } boundary_constraints { - enf a.first = stack_inputs[0] - enf b.first = stack_inputs[1] - enf a.last = stack_outputs[0] - enf b.last = stack_outputs[1] + enf a.first = stack_inputs[0]; + enf b.first = stack_inputs[1]; + enf a.last = stack_outputs[0]; + enf b.last = stack_outputs[1]; - enf c.first = (B[0] - C[1][1]) * A - enf d.first = 1 + enf c.first = (B[0] - C[1][1]) * A; + enf d.first = 1; - enf e[0].first = 0 - enf e[1].first = 1 + enf e[0].first = 0; + enf e[1].first = 1; - enf f.first = $rand[0] - enf f.last = 1 + enf f.first = $rand[0]; + enf f.last = 1; } integrity_constraints { - enf a + b = 0 + enf a + b = 0; }"; #[test] diff --git a/codegen/masm/tests/test_constants.rs b/codegen/masm/tests/test_constants.rs index 4d81ac90..2d352aac 100644 --- a/codegen/masm/tests/test_constants.rs +++ b/codegen/masm/tests/test_constants.rs @@ -11,28 +11,28 @@ use utils::{codegen, test_code, to_stack_order, Data}; static CONSTANTS_AIR: &str = " def ConstantsAir -const A = 2 -const B = [3, 5] -const C = [[7, 11], [13, 17]] +const A = 2; +const B = [3, 5]; +const C = [[7, 11], [13, 17]]; trace_columns { - main: [a, b, c] + main: [a, b, c], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = A - enf b.first = A + B[0] * C[0][1] - enf c.last = A - B[1] * C[0][0] + enf a.first = A; + enf b.first = A + B[0] * C[0][1]; + enf c.last = A - B[1] * C[0][0]; } integrity_constraints { - enf a' = a + A - enf b' = B[0] * b - enf c' = (C[0][0] + B[0]) * c + enf a' = a + A; + enf b' = B[0] * b; + enf c' = (C[0][0] + B[0]) * c; }"; const A: QuadExtension = QuadExtension::new(Felt::new(2), Felt::ZERO); const B_0: QuadExtension = QuadExtension::new(Felt::new(3), Felt::ZERO); diff --git a/codegen/masm/tests/test_divisor.rs b/codegen/masm/tests/test_divisor.rs index 2d196b93..7d6a3d51 100644 --- a/codegen/masm/tests/test_divisor.rs +++ b/codegen/masm/tests/test_divisor.rs @@ -13,19 +13,19 @@ static SIMPLE_INTEGRITY_AIR: &str = " def SimpleIntegrityAux trace_columns { - main: [a] + main: [a], } public_inputs { - stack_inputs: [1] + stack_inputs: [1], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a = 0 + enf a = 0; }"; #[test] @@ -97,23 +97,23 @@ static SIMPLE_BOUNDARY_AIR: &str = " def SimpleBoundaryAux trace_columns { - main: [a] - aux: [b] + main: [a], + aux: [b], } public_inputs { - stack_inputs: [1] + stack_inputs: [1], } boundary_constraints { - enf a.first = 0 - enf a.last = 0 - enf b.first = 0 - enf b.last = 0 + enf a.first = 0; + enf a.last = 0; + enf b.first = 0; + enf b.last = 0; } integrity_constraints { - enf a = 0 + enf a = 0; }"; #[test] @@ -218,21 +218,21 @@ static MIXED_BOUNDARY_AIR: &str = " def MixedBoundaryAux trace_columns { - main: [a] - aux: [b] + main: [a], + aux: [b], } public_inputs { - stack_inputs: [1] + stack_inputs: [1], } boundary_constraints { - enf a.first = 3 - enf b.last = 5 + enf a.first = 3; + enf b.last = 5; } integrity_constraints { - enf a = 0 + enf a = 0; }"; #[test] diff --git a/codegen/masm/tests/test_exemption_points.rs b/codegen/masm/tests/test_exemption_points.rs index d5f46e9e..9fe61eaa 100644 --- a/codegen/masm/tests/test_exemption_points.rs +++ b/codegen/masm/tests/test_exemption_points.rs @@ -12,19 +12,19 @@ static SIMPLE_AIR: &str = " def Simple trace_columns { - main: [a] + main: [a], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a + a = 0 + enf a + a = 0; }"; #[test] diff --git a/codegen/masm/tests/test_periodic.rs b/codegen/masm/tests/test_periodic.rs index 3a77dfa2..666dddbc 100644 --- a/codegen/masm/tests/test_periodic.rs +++ b/codegen/masm/tests/test_periodic.rs @@ -12,23 +12,23 @@ static SIMPLE_AUX_AIR: &str = " def SimpleAux trace_columns { - main: [a] + main: [a], } periodic_columns { - k: [1, 1] + k: [1, 1], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a * k = 0 + enf a * k = 0; }"; #[test] @@ -99,27 +99,27 @@ static MULTIPLE_AUX_AIR: &str = " def MultipleAux trace_columns { - main: [a, b, c] + main: [a, b, c], } periodic_columns { - m: [1, 0] - n: [1, 1, 1, 0] - o: [1, 0, 0, 0] + m: [1, 0], + n: [1, 1, 1, 0], + o: [1, 0, 0, 0], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a * m = 0 - enf b * n = 0 - enf c * o = 0 + enf a * m = 0; + enf b * n = 0; + enf c * o = 0; }"; #[test] diff --git a/ir/src/tests/access.rs b/ir/src/tests/access.rs index f3fed195..5e4571fc 100644 --- a/ir/src/tests/access.rs +++ b/ir/src/tests/access.rs @@ -5,20 +5,20 @@ fn invalid_vector_access_in_boundary_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = A + B[3] - C[1][2] + enf clk.first = A + B[3] - C[1][2]; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -32,20 +32,20 @@ fn invalid_matrix_row_access_in_boundary_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = A + B[1] - C[3][2] + enf clk.first = A + B[1] - C[3][2]; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -59,20 +59,20 @@ fn invalid_matrix_column_access_in_boundary_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = A + B[1] - C[1][3] + enf clk.first = A + B[1] - C[1][3]; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -86,20 +86,20 @@ fn invalid_vector_access_in_integrity_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + A + B[3] - C[1][2] + enf clk' = clk + A + B[3] - C[1][2]; }"; expect_diagnostic( @@ -113,20 +113,20 @@ fn invalid_matrix_row_access_in_integrity_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + A + B[1] - C[3][2] + enf clk' = clk + A + B[1] - C[3][2]; }"; expect_diagnostic( @@ -140,20 +140,20 @@ fn invalid_matrix_column_access_in_integrity_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + A + B[1] - C[1][3] + enf clk' = clk + A + B[1] - C[1][3]; }"; expect_diagnostic( diff --git a/ir/src/tests/boundary_constraints.rs b/ir/src/tests/boundary_constraints.rs index a47b4cf0..efcfddb1 100644 --- a/ir/src/tests/boundary_constraints.rs +++ b/ir/src/tests/boundary_constraints.rs @@ -5,17 +5,17 @@ fn boundary_constraints() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 - enf clk.last = 1 + enf clk.first = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; assert!(compile(source).is_ok()); @@ -26,17 +26,17 @@ fn err_bc_duplicate_first() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 - enf clk.first = 1 + enf clk.first = 0; + enf clk.first = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "overlapping boundary constraints"); @@ -47,17 +47,17 @@ fn err_bc_duplicate_last() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.last = 0 - enf clk.last = 1 + enf clk.last = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "overlapping boundary constraints"); diff --git a/ir/src/tests/constant.rs b/ir/src/tests/constant.rs index 34711c58..167812fd 100644 --- a/ir/src/tests/constant.rs +++ b/ir/src/tests/constant.rs @@ -4,21 +4,21 @@ use super::{compile, expect_diagnostic}; fn boundary_constraint_with_constants() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = A - enf clk.last = B[0] + C[0][1] + enf clk.first = A; + enf clk.last = B[0] + C[0][1]; } integrity_constraints { - enf clk' = clk - 1 + enf clk' = clk - 1; }"; assert!(compile(source).is_ok()); @@ -28,20 +28,20 @@ fn boundary_constraint_with_constants() { fn integrity_constraint_with_constants() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + A + B[1] - C[1][2] + enf clk' = clk + A + B[1] - C[1][2]; }"; assert!(compile(source).is_ok()); @@ -51,19 +51,19 @@ fn integrity_constraint_with_constants() { fn invalid_matrix_constant() { let source = " def test - const A = [[2, 3], [1, 0, 2]] + const A = [[2, 3], [1, 0, 2]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 - enf clk.last = 1 + enf clk.first = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "invalid matrix literal: mismatched dimensions"); diff --git a/ir/src/tests/evaluators.rs b/ir/src/tests/evaluators.rs index 7efb15f6..1a3f3f4c 100644 --- a/ir/src/tests/evaluators.rs +++ b/ir/src/tests/evaluators.rs @@ -5,23 +5,23 @@ fn simple_evaluator() { let source = " def test ev advance_clock([clk]) { - enf clk' = clk + 1 + enf clk' = clk + 1; } trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf advance_clock([clk]) + enf advance_clock([clk]); }"; assert!(compile(source).is_ok()); @@ -32,24 +32,24 @@ fn evaluator_with_variables() { let source = " def test ev advance_clock([clk]) { - let z = clk + 1 - enf clk' = z + let z = clk + 1; + enf clk' = z; } trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf advance_clock([clk]) + enf advance_clock([clk]); }"; assert!(compile(source).is_ok()); @@ -60,26 +60,26 @@ fn evaluator_with_main_and_aux_cols() { let source = " def test ev enforce_constraints([clk], [a, b]) { - let z = a + b - enf clk' = clk + 1 - enf a' = a + z + let z = a + b; + enf clk' = clk + 1; + enf a' = a + z; } trace_columns { - main: [clk] - aux: [a, b] + main: [clk], + aux: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf enforce_constraints([clk], [a, b]) + enf enforce_constraints([clk], [a, b]); }"; assert!(compile(source).is_ok()); @@ -90,24 +90,24 @@ fn ev_call_with_aux_only() { let source = " def test ev enforce_a([], [a, b]) { - enf a' = a + 1 + enf a' = a + 1; } trace_columns { - main: [clk] - aux: [a, b] + main: [clk], + aux: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf enforce_a([], [a, b]) + enf enforce_a([], [a, b]); }"; assert!(compile(source).is_ok()); @@ -118,27 +118,27 @@ fn ev_call_inside_evaluator_with_main() { let source = " def test ev enforce_clk([clk]) { - enf clk' = clk + 1 + enf clk' = clk + 1; } ev enforce_all_constraints([clk]) { - enf enforce_clk([clk]) + enf enforce_clk([clk]); } trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf enforce_all_constraints([clk]) + enf enforce_all_constraints([clk]); }"; assert!(compile(source).is_ok()); @@ -149,33 +149,33 @@ fn ev_call_inside_evaluator_with_aux() { let source = " def test ev enforce_clk([clk]) { - enf clk' = clk + 1 + enf clk' = clk + 1; } ev enforce_a([], [a, b]) { - enf a' = a + 1 + enf a' = a + 1; } ev enforce_all_constraints([clk], [a, b]) { - enf enforce_clk([clk]) - enf enforce_a([], [a, b]) + enf enforce_clk([clk]); + enf enforce_a([], [a, b]); } trace_columns { - main: [clk] - aux: [a, b] + main: [clk], + aux: [a, b], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf enforce_all_constraints([clk], [a, b]) + enf enforce_all_constraints([clk], [a, b]); }"; assert!(compile(source).is_ok()); @@ -186,23 +186,23 @@ fn ev_fn_call_with_column_group() { let source = " def test ev clk_selectors([selectors[3], clk]) { - enf (clk' - clk) * selectors[0] * selectors[1] * selectors[2] = 0 + enf (clk' - clk) * selectors[0] * selectors[1] * selectors[2] = 0; } trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk_selectors([s, clk]) + enf clk_selectors([s, clk]); }"; assert!(compile(source).is_ok()); @@ -213,24 +213,24 @@ fn err_ev_fn_call_wrong_segment_columns() { let source = " def test ev is_binary([x]) { - enf x^2 = x + enf x^2 = x; } trace_columns { - main: [b] - aux: [c] + main: [b], + aux: [c], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf b.first = 0 + enf b.first = 0; } integrity_constraints { - enf is_binary([c]) + enf is_binary([c]); }"; expect_diagnostic(source, "callee expects columns from the $main trace"); diff --git a/ir/src/tests/integrity_constraints/comprehension/constraint_comprehension.rs b/ir/src/tests/integrity_constraints/comprehension/constraint_comprehension.rs index b4e43c83..f3ac6e40 100644 --- a/ir/src/tests/integrity_constraints/comprehension/constraint_comprehension.rs +++ b/ir/src/tests/integrity_constraints/comprehension/constraint_comprehension.rs @@ -5,17 +5,17 @@ fn constraint_comprehension() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - enf c = d for (c, d) in (c, d) + enf c = d for (c, d) in (c, d); }"; assert!(compile(source).is_ok()); @@ -26,17 +26,17 @@ fn ic_comprehension_with_selectors() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - enf c = d for (c, d) in (c, d) when !fmp[0] + enf c = d for (c, d) in (c, d) when !fmp[0]; }"; assert!(compile(source).is_ok()); diff --git a/ir/src/tests/integrity_constraints/comprehension/list_comprehension.rs b/ir/src/tests/integrity_constraints/comprehension/list_comprehension.rs index fb4ad4a2..1659fe42 100644 --- a/ir/src/tests/integrity_constraints/comprehension/list_comprehension.rs +++ b/ir/src/tests/integrity_constraints/comprehension/list_comprehension.rs @@ -5,18 +5,18 @@ fn list_comprehension() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = [fmp for fmp in fmp] - enf clk = x[1] + let x = [fmp for fmp in fmp]; + enf clk = x[1]; }"; assert!(compile(source).is_ok()); @@ -27,19 +27,19 @@ fn lc_with_const_exp() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let y = [col^7 for col in c] - let z = [col'^7 - col for col in c] - enf clk = y[1] + z[1] + let y = [col^7 for col in c]; + let z = [col'^7 - col for col in c]; + enf clk = y[1] + z[1]; }"; assert!(compile(source).is_ok()); @@ -50,18 +50,18 @@ fn lc_with_non_const_exp() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let enumerate = [2^c * c for (i, c) in (0..4, c)] - enf clk = enumerate[3] + let enumerate = [2^c * c for (i, c) in (0..4, c)]; + enf clk = enumerate[3]; }"; expect_diagnostic(source, "expected exponent to be a constant"); @@ -72,18 +72,18 @@ fn lc_with_two_lists() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let diff = [x - y for (x, y) in (c, d)] - enf clk = diff[0] + let diff = [x - y for (x, y) in (c, d)]; + enf clk = diff[0]; }"; assert!(compile(source).is_ok()); @@ -94,18 +94,18 @@ fn lc_with_two_slices() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let diff = [x - y for (x, y) in (c[0..2], d[1..3])] - enf clk = diff[1] + let diff = [x - y for (x, y) in (c[0..2], d[1..3])]; + enf clk = diff[1]; }"; assert!(compile(source).is_ok()); @@ -116,17 +116,17 @@ fn lc_with_multiple_lists() { let source = " def test trace_columns { - main: [a, b[3], c[4], d[4]] + main: [a, b[3], c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])] - enf a = x[0] + x[1] + x[2] + let x = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])]; + enf a = x[0] + x[1] + x[2]; }"; assert!(compile(source).is_ok()); @@ -137,19 +137,19 @@ fn err_index_out_of_range_lc_ident() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = [fmp for fmp in fmp] - enf clk = x[2] + let x = [fmp for fmp in fmp]; + enf clk = x[2]; }"; expect_diagnostic( @@ -163,20 +163,20 @@ fn err_index_out_of_range_lc_slice() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = [z for z in c[1..3]] - enf clk = x[3] + let x = [z for z in c[1..3]]; + enf clk = x[3]; }"; expect_diagnostic( @@ -190,20 +190,20 @@ fn err_non_const_exp_ident_iterable() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let invalid_exp_lc = [2^d * c for (d, c) in (d, c)] - enf clk = invalid_exp_lc[1] + let invalid_exp_lc = [2^d * c for (d, c) in (d, c)]; + enf clk = invalid_exp_lc[1]; }"; expect_diagnostic(source, "expected exponent to be a constant"); @@ -214,20 +214,20 @@ fn err_non_const_exp_slice_iterable() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let invalid_exp_lc = [2^d * c for (d, c) in (d[0..4], c)] - enf clk = invalid_exp_lc[1] + let invalid_exp_lc = [2^d * c for (d, c) in (d[0..4], c)]; + enf clk = invalid_exp_lc[1]; }"; expect_diagnostic(source, "expected exponent to be a constant"); @@ -238,20 +238,20 @@ fn err_duplicate_member() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let duplicate_member_lc = [c * d for (c, c) in (c, d)] - enf clk = duplicate_member_lc[1] + let duplicate_member_lc = [c * d for (c, c) in (c, d)]; + enf clk = duplicate_member_lc[1]; }"; expect_diagnostic(source, "this name is already bound in this comprehension"); diff --git a/ir/src/tests/integrity_constraints/mod.rs b/ir/src/tests/integrity_constraints/mod.rs index c98487e8..e38a1090 100644 --- a/ir/src/tests/integrity_constraints/mod.rs +++ b/ir/src/tests/integrity_constraints/mod.rs @@ -7,16 +7,16 @@ fn integrity_constraints() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; assert!(compile(source).is_ok()); @@ -27,16 +27,16 @@ fn ic_using_parens() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = (clk + 1) + enf clk' = (clk + 1); }"; assert!(compile(source).is_ok()); @@ -47,16 +47,16 @@ fn ic_op_mul() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' * clk = 1 + enf clk' * clk = 1; }"; assert!(compile(source).is_ok()); @@ -67,16 +67,16 @@ fn ic_op_exp() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk'^2 - clk = 1 + enf clk'^2 - clk = 1; }"; assert!(compile(source).is_ok()); @@ -88,17 +88,17 @@ fn err_non_const_exp_outside_lc() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - enf clk = 2^ctx + enf clk = 2^ctx; }"; expect_diagnostic(source, "expected exponent to be a constant"); diff --git a/ir/src/tests/list_folding.rs b/ir/src/tests/list_folding.rs index a7f15bac..4a3596fa 100644 --- a/ir/src/tests/list_folding.rs +++ b/ir/src/tests/list_folding.rs @@ -4,21 +4,21 @@ use super::compile; fn list_folding_on_const() { let source = " def test - const A = [1, 2, 3] + const A = [1, 2, 3]; trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = sum(A) - let y = prod(A) - enf clk = y - x + let x = sum(A); + let y = prod(A); + enf clk = y - x; }"; assert!(compile(source).is_ok()); @@ -29,20 +29,20 @@ fn list_folding_on_variable() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = [a + c[0], 1, c[2] * d[2]] - let y = sum(x) - let z = prod(x) - enf clk = z - y + let x = [a + c[0], 1, c[2] * d[2]]; + let y = sum(x); + let z = prod(x); + enf clk = z - y; }"; assert!(compile(source).is_ok()); @@ -53,19 +53,19 @@ fn list_folding_on_vector() { let source = " def test trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = sum([c[0], c[2], 2 * a]) - let y = prod([c[0], c[2], 2 * a]) - enf clk = y - x + let x = sum([c[0], c[2], 2 * a]); + let y = prod([c[0], c[2], 2 * a]); + enf clk = y - x; }"; assert!(compile(source).is_ok()); @@ -75,21 +75,21 @@ fn list_folding_on_vector() { fn list_folding_on_lc() { let source = " def test - const A = [1, 2, 3] + const A = [1, 2, 3]; trace_columns { - main: [clk, fmp[2], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[2], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = sum([c * d for (c, d) in (c, d)]) - let y = prod([c + d for (c, d) in (c, d)]) - enf clk = y - x + let x = sum([c * d for (c, d) in (c, d)]); + let y = prod([c + d for (c, d) in (c, d)]); + enf clk = y - x; }"; assert!(compile(source).is_ok()); @@ -100,19 +100,19 @@ fn list_folding_in_lc() { let source = " def test trace_columns { - main: [clk, fmp[4], ctx] - aux: [a, b, c[4], d[4]] + main: [clk, fmp[4], ctx], + aux: [a, b, c[4], d[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf c[2].first = 0 + enf c[2].first = 0; } integrity_constraints { - let x = sum([c * d for (c, d) in (c, d)]) - let y = [m + x for m in fmp] - enf clk = y[0] + let x = sum([c * d for (c, d) in (c, d)]); + let y = [m + x for m in fmp]; + enf clk = y[0]; }"; assert!(compile(source).is_ok()); diff --git a/ir/src/tests/pub_inputs.rs b/ir/src/tests/pub_inputs.rs index f8f0e425..f9268a95 100644 --- a/ir/src/tests/pub_inputs.rs +++ b/ir/src/tests/pub_inputs.rs @@ -5,16 +5,16 @@ fn bc_with_public_inputs() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = stack_inputs[0]^3 + enf clk.first = stack_inputs[0]^3; } integrity_constraints { - enf clk' = clk - 1 + enf clk' = clk - 1; }"; assert!(compile(source).is_ok()); diff --git a/ir/src/tests/random_values.rs b/ir/src/tests/random_values.rs index 99ef28c7..d507b979 100644 --- a/ir/src/tests/random_values.rs +++ b/ir/src/tests/random_values.rs @@ -5,21 +5,21 @@ fn random_values_indexed_access() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [16] + rand: [16], } boundary_constraints { - enf c.first = $rand[10] * 2 - enf c.last = 1 + enf c.first = $rand[10] * 2; + enf c.last = 1; } integrity_constraints { - enf c' = $rand[3] + 1 + enf c' = $rand[3] + 1; }"; assert!(compile(source).is_ok()); @@ -30,21 +30,21 @@ fn random_values_custom_name() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alphas: [16] + alphas: [16], } boundary_constraints { - enf c.first = $alphas[10] * 2 - enf c.last = 1 + enf c.first = $alphas[10] * 2; + enf c.last = 1; } integrity_constraints { - enf c' = $alphas[3] + 1 + enf c' = $alphas[3] + 1; }"; assert!(compile(source).is_ok()); @@ -55,21 +55,21 @@ fn random_values_named_access() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [m, n[4]] + rand: [m, n[4]], } boundary_constraints { - enf c.first = (n[1] - $rand[0]) * 2 - enf c.last = m + enf c.first = (n[1] - $rand[0]) * 2; + enf c.last = m; } integrity_constraints { - enf c' = m + n[2] + $rand[1] + enf c' = m + n[2] + $rand[1]; }"; assert!(compile(source).is_ok()); @@ -80,21 +80,21 @@ fn err_random_values_out_of_bounds_no_bindings() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [4] + rand: [4], } boundary_constraints { - enf a.first = $rand[10] * 2 - enf a.last = 1 + enf a.first = $rand[10] * 2; + enf a.last = 1; } integrity_constraints { - enf a' = $rand[4] + 1 + enf a' = $rand[4] + 1; }"; expect_diagnostic( @@ -108,21 +108,21 @@ fn err_random_values_out_of_bounds_binding_ref() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [m, n[4]] + rand: [m, n[4]], } boundary_constraints { - enf a.first = n[5] * 2 - enf a.last = 1 + enf a.first = n[5] * 2; + enf a.last = 1; } integrity_constraints { - enf a' = m + 1 + enf a' = m + 1; }"; expect_diagnostic( @@ -136,21 +136,21 @@ fn err_random_values_out_of_bounds_global_ref() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [m, n[4]] + rand: [m, n[4]], } boundary_constraints { - enf a.first = $rand[10] * 2 - enf a.last = 1 + enf a.first = $rand[10] * 2; + enf a.last = 1; } integrity_constraints { - enf a' = m + 1 + enf a' = m + 1; }"; expect_diagnostic( @@ -164,20 +164,20 @@ fn err_random_values_without_aux_cols() { let source = " def test trace_columns { - main: [a, b[12]] + main: [a, b[12]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [16] + rand: [16], } boundary_constraints { - enf a.first = 2 - enf a.last = 1 + enf a.first = 2; + enf a.last = 1; } integrity_constraints { - enf a' = a + 1 + enf a' = a + 1; }"; expect_diagnostic( @@ -191,21 +191,21 @@ fn err_random_values_in_bc_against_main_cols() { let source = " def test trace_columns { - main: [a, b[12]] - aux: [c, d] + main: [a, b[12]], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - rand: [16] + rand: [16], } boundary_constraints { - enf a.first = $rand[10] * 2 - enf b[2].last = 1 + enf a.first = $rand[10] * 2; + enf b[2].last = 1; } integrity_constraints { - enf c' = $rand[3] + 1 + enf c' = $rand[3] + 1; }"; expect_diagnostic(source, "Boundary constraints require both sides of the constraint to apply to the same trace segment"); diff --git a/ir/src/tests/selectors.rs b/ir/src/tests/selectors.rs index 1d5a440f..69c8458f 100644 --- a/ir/src/tests/selectors.rs +++ b/ir/src/tests/selectors.rs @@ -5,17 +5,17 @@ fn single_selector() { let source = " def test trace_columns { - main: [s[2], clk] + main: [s[2], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk when s[0] + enf clk' = clk when s[0]; }"; assert!(compile(source).is_ok()); @@ -26,17 +26,17 @@ fn chained_selectors() { let source = " def test trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk when (s[0] & !s[1]) | !s[2]' + enf clk' = clk when (s[0] & !s[1]) | !s[2]'; }"; assert!(compile(source).is_ok()); @@ -47,23 +47,23 @@ fn multiconstraint_selectors() { let source = " def test trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = 0 when s[0] & !s[1] + enf clk' = 0 when s[0] & !s[1]; enf match { case s[0] & s[1]: clk' = clk case !s[0] & !s[1]: clk' = 1 - } + }; }"; assert!(compile(source).is_ok()); @@ -74,23 +74,23 @@ fn selectors_in_evaluators() { let source = " def test ev evaluator_with_selector([selector, clk]) { - enf clk' - clk = 0 when selector + enf clk' - clk = 0 when selector; } trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf evaluator_with_selector([s[0], clk]) + enf evaluator_with_selector([s[0], clk]); }"; assert!(compile(source).is_ok()); @@ -101,23 +101,23 @@ fn multiple_selectors_in_evaluators() { let source = " def test ev evaluator_with_selector([s0, s1, clk]) { - enf clk' - clk = 0 when s0 & !s1 + enf clk' - clk = 0 when s0 & !s1; } trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf evaluator_with_selector([s[0], s[1], clk]) + enf evaluator_with_selector([s[0], s[1], clk]); }"; assert!(compile(source).is_ok()); @@ -128,23 +128,23 @@ fn selector_with_evaluator_call() { let source = " def test ev unchanged([clk]) { - enf clk' = clk + enf clk' = clk; } trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf unchanged([clk]) when s[0] & !s[1] + enf unchanged([clk]) when s[0] & !s[1]; }"; assert!(compile(source).is_ok()); @@ -155,35 +155,35 @@ fn selectors_inside_match() { let source = " def test ev next_is_zero([clk]) { - enf clk' = 0 + enf clk' = 0; } ev is_unchanged([clk, s]) { - enf clk' = clk when s + enf clk' = clk when s; } ev next_is_one([clk]) { - enf clk' = 1 + enf clk' = 1; } trace_columns { - main: [s[3], clk] + main: [s[3], clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf next_is_zero([clk]) when s[0] & !s[1] + enf next_is_zero([clk]) when s[0] & !s[1]; enf match { case s[1] & s[2]: is_unchanged([clk, s[0]]) case !s[1] & !s[2]: next_is_one([clk]) - } + }; }"; assert!(compile(source).is_ok()); diff --git a/ir/src/tests/source_sections.rs b/ir/src/tests/source_sections.rs index f4695c4e..50d35169 100644 --- a/ir/src/tests/source_sections.rs +++ b/ir/src/tests/source_sections.rs @@ -22,13 +22,13 @@ fn err_trace_cols_omitted() { let source = " def test public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "missing trace_columns section"); @@ -40,14 +40,14 @@ fn err_pub_inputs_empty() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs {} boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "expected one of: 'identifier'"); @@ -59,13 +59,13 @@ fn err_pub_inputs_omitted() { let source = " def test trace_columns { - main: [clk] + main: [clk], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "root module must contain a public_inputs section"); @@ -77,14 +77,14 @@ fn err_bc_empty() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints {} integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "expected one of: '\"enf\"', '\"let\"'"); @@ -96,13 +96,13 @@ fn err_bc_omitted() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -117,13 +117,13 @@ fn err_ic_empty() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints {}"; @@ -136,13 +136,13 @@ fn err_ic_omitted() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; }"; expect_diagnostic( diff --git a/ir/src/tests/trace.rs b/ir/src/tests/trace.rs index cc3f8c5b..a8beddd4 100644 --- a/ir/src/tests/trace.rs +++ b/ir/src/tests/trace.rs @@ -5,18 +5,18 @@ fn trace_columns_index_access() { let source = " def test trace_columns { - main: [a, b] - aux: [c, d] + main: [a, b], + aux: [c, d], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a.first = 1 + enf a.first = 1; } integrity_constraints { - enf $main[0]' - $main[1] = 0 - enf $aux[0]^3 - $aux[1]' = 0 + enf $main[0]' - $main[1] = 0; + enf $aux[0]^3 - $aux[1]' = 0; }"; assert!(compile(source).is_ok()); @@ -26,21 +26,21 @@ fn trace_columns_index_access() { fn trace_cols_groups() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk, a[4]] + main: [clk, a[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a[1].first = A - enf clk.last = B[0] + C[0][1] + enf a[1].first = A; + enf clk.last = B[0] + C[0][1]; } integrity_constraints { - enf a[0]' = a[1] - 1 + enf a[0]' = a[1] - 1; }"; assert!(compile(source).is_ok()); @@ -51,17 +51,17 @@ fn err_bc_column_undeclared() { let source = " def test trace_columns { - main: [ctx] + main: [ctx], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 - enf clk.last = 1 + enf clk.first = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "this variable is not defined"); @@ -72,16 +72,16 @@ fn err_ic_column_undeclared() { let source = " def test trace_columns { - main: [ctx] + main: [ctx], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf ctx.first = 0 + enf ctx.first = 0; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "this variable is not defined"); @@ -92,20 +92,20 @@ fn err_bc_trace_cols_access_out_of_bounds() { // out of bounds in boundary constraints let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk, a[4]] + main: [clk, a[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a[4].first = A + enf a[4].first = A; } integrity_constraints { - enf a[0]' = a[0] - 1 + enf a[0]' = a[0] - 1; }"; expect_diagnostic( @@ -119,21 +119,21 @@ fn err_ic_trace_cols_access_out_of_bounds() { // out of bounds in integrity constraints let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk, a[4]] + main: [clk, a[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a[1].first = A - enf clk.last = B[0] + C[0][1] + enf a[1].first = A; + enf clk.last = B[0] + C[0][1]; } integrity_constraints { - enf a[4]' = a[4] - 1 + enf a[4]' = a[4] - 1; }"; expect_diagnostic( @@ -147,16 +147,16 @@ fn err_ic_trace_cols_group_used_as_scalar() { let source = " def test trace_columns { - main: [clk, a[4]] + main: [clk, a[4]], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf a[1].first = 0 + enf a[1].first = 0; } integrity_constraints { - enf a[0]' = a + clk + enf a[0]' = a + clk; }"; expect_diagnostic(source, "type mismatch"); diff --git a/ir/src/tests/variables.rs b/ir/src/tests/variables.rs index f9be8e11..e9eaa3cd 100644 --- a/ir/src/tests/variables.rs +++ b/ir/src/tests/variables.rs @@ -5,17 +5,17 @@ fn let_scalar_constant_in_boundary_constraint() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = 1 + 8 - enf clk.first = a + let a = 1 + 8; + enf clk.first = a; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; assert!(compile(source).is_ok()); @@ -26,17 +26,17 @@ fn let_vector_constant_in_boundary_constraint() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let b = [1, 5] - enf clk.first = b[0] + let b = [1, 5]; + enf clk.first = b[0]; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; assert!(compile(source).is_ok()); @@ -47,21 +47,21 @@ fn multi_constraint_nested_let_with_expressions_in_boundary_constraint() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = 1 + 8 - let b = [a, a*a] - enf clk.first = a + b[0] + let a = 1 + 8; + let b = [a, a*a]; + enf clk.first = a + b[0]; - let c = [[b[0], b[1]], [clk, 2^2]] - enf clk.last = c[1][1] + let c = [[b[0], b[1]], [clk, 2^2]]; + enf clk.last = c[1][1]; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; assert!(compile(source).is_ok()); @@ -72,18 +72,18 @@ fn let_scalar_constant_in_boundary_constraint_both_domains() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = 1 + 8 - enf clk.first = a - enf clk.last = a + let a = 1 + 8; + enf clk.first = a; + enf clk.last = a; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; assert!(compile(source).is_ok()); @@ -94,18 +94,18 @@ fn invalid_column_offset_in_boundary_constraint() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = clk' - enf clk.first = 0 - enf clk.last = a + let a = clk'; + enf clk.first = 0; + enf clk.last = a; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "invalid access of a trace column with offset"); @@ -116,20 +116,20 @@ fn nested_let_with_expressions_in_integrity_constraint() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 - enf clk.last = 1 + enf clk.first = 0; + enf clk.last = 1; } integrity_constraints { - let a = 1 - let b = [a, a*a] - let c = [[clk' - clk, clk - a], [1 + 8, 2^2]] - enf c[0][0] = 1 + let a = 1; + let b = [a, a*a]; + let c = [[clk' - clk, clk - a], [1 + 8, 2^2]]; + enf c[0][0] = 1; }"; assert!(compile(source).is_ok()); @@ -140,22 +140,22 @@ fn nested_let_with_vector_access_in_integrity_constraint() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 7 - enf clk.last = 8 + enf clk.first = 7; + enf clk.last = 8; } integrity_constraints { - let a = [[1, 2], [3, 4]] - let b = a[1] - let c = b - let d = [a[0], a[1], b] - let e = d - enf clk' = c[0] + e[2][0] + e[0][1] + let a = [[1, 2], [3, 4]]; + let b = a[1]; + let c = b; + let d = [a[0], a[1], b]; + let e = d; + enf clk' = c[0] + e[2][0] + e[0][1]; }"; assert!(compile(source).is_ok()); @@ -168,19 +168,19 @@ fn invalid_matrix_literal_with_leading_vector_binding() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 7 - enf clk.last = 8 + enf clk.first = 7; + enf clk.last = 8; } integrity_constraints { - let a = [[1, 2], [3, 4]] - let d = [a[0], [3, 4]] - enf clk' = d[0][0] + let a = [[1, 2], [3, 4]]; + let d = [a[0], [3, 4]]; + enf clk' = d[0][0]; }"; expect_diagnostic(source, "expected one of: '\"!\"', '\"(\"', 'decl_ident_ref', 'function_identifier', 'identifier', 'int'"); @@ -193,19 +193,19 @@ fn invalid_matrix_literal_with_trailing_vector_binding() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 7 - enf clk.last = 8 + enf clk.first = 7; + enf clk.last = 8; } integrity_constraints { - let a = [[1, 2], [3, 4]] - let d = [[3, 4], a[0]] - enf clk' = d[0][0] + let a = [[1, 2], [3, 4]]; + let d = [[3, 4], a[0]]; + enf clk' = d[0][0]; }"; expect_diagnostic(source, "expected one of: '\"[\"'"); @@ -215,20 +215,20 @@ fn invalid_matrix_literal_with_trailing_vector_binding() { fn invalid_variable_access_before_declaration() { let source = " def test - const A = [[2, 3], [1, 0]] + const A = [[2, 3], [1, 0]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = a - let a = 0 - enf clk.last = 1 + enf clk.first = a; + let a = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic(source, "this variable is not defined"); @@ -238,20 +238,20 @@ fn invalid_variable_access_before_declaration() { fn invalid_trailing_let() { let source = " def test - const A = [[2, 3], [1, 0]] + const A = [[2, 3], [1, 0]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 - enf clk.last = 1 + enf clk.first = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + a - let a = 1 + enf clk' = clk + a; + let a = 1; }"; expect_diagnostic(source, "expected one of: '\"enf\"', '\"let\"'"); @@ -261,20 +261,20 @@ fn invalid_trailing_let() { fn invalid_reference_to_variable_defined_in_other_section() { let source = " def test - const A = [[2, 3], [1, 0]] + const A = [[2, 3], [1, 0]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = 1 - enf clk.first = 0 - enf clk.last = 1 + let a = 1; + enf clk.first = 0; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + a + enf clk' = clk + a; }"; expect_diagnostic(source, "this variable is not defined"); @@ -284,20 +284,20 @@ fn invalid_reference_to_variable_defined_in_other_section() { fn invalid_vector_variable_access_out_of_bounds() { let source = " def test - const A = [[2, 3], [1, 0]] + const A = [[2, 3], [1, 0]]; trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = [1, 2] - enf clk.first = a[2] - enf clk.last = 1 + let a = [1, 2]; + enf clk.first = a[2]; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -311,18 +311,18 @@ fn invalid_matrix_column_variable_access_out_of_bounds() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = [[1, 2, 3], [4, 5, 6]] - enf clk.first = a[1][3] - enf clk.last = 1 + let a = [[1, 2, 3], [4, 5, 6]]; + enf clk.first = a[1][3]; + enf clk.last = 1; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -336,18 +336,18 @@ fn invalid_matrix_row_variable_access_out_of_bounds() { let source = " def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } boundary_constraints { - let a = [[1, 2, 3], [4, 5, 6]] - enf clk.first = 0 - enf clk.last = a[2][0] + let a = [[1, 2, 3], [4, 5, 6]]; + enf clk.first = 0; + enf clk.last = a[2][0]; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; expect_diagnostic( @@ -360,25 +360,25 @@ fn invalid_matrix_row_variable_access_out_of_bounds() { fn invalid_index_into_scalar_variable() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk] - aux: [p] + main: [clk], + aux: [p], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alphas: [1] + alphas: [1], } boundary_constraints { - enf clk.first = 1 + enf clk.first = 1; } integrity_constraints { - let a = $alphas[0] - enf clk' = clk + a[0] + let a = $alphas[0]; + enf clk' = clk + a[0]; }"; expect_diagnostic(source, "attempted to index into a scalar value"); @@ -388,25 +388,25 @@ fn invalid_index_into_scalar_variable() { fn trace_binding_access_in_integrity_constraint() { let source = " def test - const A = 123 - const B = [1, 2, 3] - const C = [[1, 2, 3], [4, 5, 6]] + const A = 123; + const B = [1, 2, 3]; + const C = [[1, 2, 3], [4, 5, 6]]; trace_columns { - main: [clk, x[4]] - aux: [p] + main: [clk, x[4]], + aux: [p], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } random_values { - alphas: [1] + alphas: [1], } boundary_constraints { - enf clk.first = 1 + enf clk.first = 1; } integrity_constraints { - let a = x - enf clk' = clk + a[0] + let a = x; + enf clk' = clk + a[0]; }"; assert!(compile(source).is_ok()); diff --git a/parser/src/lexer/mod.rs b/parser/src/lexer/mod.rs index fe89b499..b957d917 100644 --- a/parser/src/lexer/mod.rs +++ b/parser/src/lexer/mod.rs @@ -168,6 +168,7 @@ pub enum Token { Bar, Bang, Arrow, + SemiColon, } impl Token { pub fn from_keyword_or_ident(s: &str) -> Self { @@ -291,6 +292,7 @@ impl fmt::Display for Token { Self::Bar => write!(f, "|"), Self::Bang => write!(f, "!"), Self::Arrow => write!(f, "->"), + Self::SemiColon => write!(f, ";"), } } } @@ -513,6 +515,7 @@ where '&' => pop!(self, Token::Ampersand), '|' => pop!(self, Token::Bar), '!' => pop!(self, Token::Bang), + ';' => pop!(self, Token::SemiColon), '$' => self.lex_special_identifier(), '0'..='9' => self.lex_number(), 'a'..='z' => self.lex_keyword_or_ident(), diff --git a/parser/src/parser/grammar.lalrpop b/parser/src/parser/grammar.lalrpop index 0e2dbf19..c7669bc0 100644 --- a/parser/src/parser/grammar.lalrpop +++ b/parser/src/parser/grammar.lalrpop @@ -83,8 +83,8 @@ Declaration: Declaration = { } Import: Span = { - "use" "::" "*" => Span::new(span!(l, r), Import::All { module: Identifier::new(span!(l, r), module.name()) }), - "use" "::" => { + "use" "::" "*" ";" => Span::new(span!(l, r), Import::All { module: Identifier::new(span!(l, r), module.name()) }), + "use" "::" ";" => { let mut items: HashSet = HashSet::default(); items.insert(item); Span::new(span!(l, r), Import::Partial { module, items }) @@ -125,12 +125,12 @@ AuxSegmentId: Identifier = { } MainTraceBindings: TraceSegment = { - ":" > => + ":" > "," => TraceSegment::new(span!(l, r), 0, name, bindings), } AuxTraceBindings: TraceSegment = { - ":" > => + ":" > "," => TraceSegment::new(span!(l, r), 1, name, bindings), } @@ -143,7 +143,7 @@ TraceBinding: Span<(Identifier, usize)> = { // ================================================================================================ Constant: Constant = { - "const" "=" + "const" "=" ";" => Constant::new(span!(l, r), name, value), } @@ -162,7 +162,7 @@ PublicInputs: Span> = { } PublicInput: PublicInput = { - ":" + ":" "," => PublicInput::new(span!(l, r), name, size), } @@ -176,7 +176,7 @@ PeriodicColumns: Span> = { } PeriodicColumn: PeriodicColumn = { - ":" > + ":" > "," => PeriodicColumn::new(span!(l, r), name, values), } @@ -196,18 +196,18 @@ RandomValues: RandomValues = { } RandValuesDef: RandomValues = { - ":" => { + ":" "," => { let name = Identifier::new(name.span(), Symbol::intern(format!("${}", &name))); RandomValues::with_size(span!(l, r), name, size as usize) }, - ":" "[" "]" =>? { + ":" "[" "]" "," =>? { diagnostics.diagnostic(Severity::Error) .with_message("random values cannot be empty") .with_primary_label(span!(l, r), "invalid declaration occurs here") .emit(); Err(ParseError::Failed.into()) }, - ":" > => { + ":" > "," => { let name = Identifier::new(name.span(), Symbol::intern(format!("${}", &name))); RandomValues::new(span!(l, r), name, bindings) }, @@ -327,7 +327,7 @@ StatementBlock: Vec = { } Let: Let = { - "let" "=" + "let" "=" ";" => Let::new(span!(l, r), name, value, body) } @@ -338,12 +338,12 @@ ConstraintStatements: Vec = { } ConstraintStatement: Vec = { - "enf" "match" "{" "}" => <>, - "enf" => vec![<>], + "enf" "match" "{" "}" ";" => <>, + "enf" ";" => vec![<>], } ReturnStatement: Expr = { - "return" => expr, + "return" ";" => expr, } MatchArm: Statement = { @@ -674,5 +674,6 @@ extern { "." => Token::Dot, ".." => Token::DotDot, "->" => Token::Arrow, + ";" => Token::SemiColon, } } diff --git a/parser/src/parser/tests/arithmetic_ops.rs b/parser/src/parser/tests/arithmetic_ops.rs index b07176bf..239d3fa2 100644 --- a/parser/src/parser/tests/arithmetic_ops.rs +++ b/parser/src/parser/tests/arithmetic_ops.rs @@ -14,7 +14,7 @@ fn single_addition() { mod test ev test([clk]) { - enf clk' + clk = 0 + enf clk' + clk = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -37,7 +37,7 @@ fn multi_addition() { mod test ev test([clk]) { - enf clk' + clk + 2 = 0 + enf clk' + clk + 2 = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -63,7 +63,7 @@ fn single_subtraction() { mod test ev test([clk]) { - enf clk' - clk = 0 + enf clk' - clk = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -86,7 +86,7 @@ fn multi_subtraction() { mod test ev test([clk]) { - enf clk' - clk - 1 = 0 + enf clk' - clk - 1 = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -112,7 +112,7 @@ fn single_multiplication() { mod test ev test([clk]) { - enf clk' * clk = 0 + enf clk' * clk = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -135,7 +135,7 @@ fn multi_multiplication() { mod test ev test([clk]) { - enf clk' * clk * 2 = 0 + enf clk' * clk * 2 = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -161,7 +161,7 @@ fn unit_with_parens() { mod test ev test([clk]) { - enf (2) + 1 = 3 + enf (2) + 1 = 3; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -184,7 +184,7 @@ fn ops_with_parens() { mod test ev test([clk]) { - enf (clk' + clk) * 2 = 4 + enf (clk' + clk) * 2 = 4; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -210,7 +210,7 @@ fn const_exponentiation() { mod test ev test([clk]) { - enf clk'^2 = 1 + enf clk'^2 = 1; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -233,7 +233,7 @@ fn non_const_exponentiation() { mod test ev test([clk]) { - enf clk'^(clk + 2) = 1 + enf clk'^(clk + 2) = 1; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -283,7 +283,7 @@ fn multi_arithmetic_ops_same_precedence() { mod test ev test([clk]) { - enf clk' - clk - 2 + 1 = 0 + enf clk' - clk - 2 + 1 = 0; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -309,7 +309,7 @@ fn multi_arithmetic_ops_different_precedence() { mod test ev test([clk]) { - enf clk'^2 - clk * 2 - 1 = 0 + enf clk'^2 - clk * 2 - 1 = 0; }"; // The precedence order of operations here is: @@ -344,7 +344,7 @@ fn multi_arithmetic_ops_different_precedence_w_parens() { mod test ev test([clk]) { - enf clk' - clk^2 * (2 - 1) = 0 + enf clk' - clk^2 * (2 - 1) = 0; }"; // The precedence order of operations here is: diff --git a/parser/src/parser/tests/boundary_constraints.rs b/parser/src/parser/tests/boundary_constraints.rs index 80bf2f6f..08ea2bb3 100644 --- a/parser/src/parser/tests/boundary_constraints.rs +++ b/parser/src/parser/tests/boundary_constraints.rs @@ -11,15 +11,15 @@ const BASE_MODULE: &str = r#" def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf clk = 0 + enf clk = 0; }"#; @@ -65,7 +65,7 @@ fn boundary_constraint_at_first() { {BASE_MODULE} boundary_constraints {{ - enf clk.first = 0 + enf clk.first = 0; }}" ); @@ -87,7 +87,7 @@ fn boundary_constraint_at_last() { {BASE_MODULE} boundary_constraints {{ - enf clk.last = 15 + enf clk.last = 15; }}" ); @@ -123,8 +123,8 @@ fn multiple_boundary_constraints() { {BASE_MODULE} boundary_constraints {{ - enf clk.first = 0 - enf clk.last = 1 + enf clk.first = 0; + enf clk.last = 1; }}" ); @@ -146,7 +146,7 @@ fn boundary_constraint_with_pub_input() { {BASE_MODULE} boundary_constraints {{ - enf clk.first = inputs[0] + enf clk.first = inputs[0]; }}" ); @@ -168,7 +168,7 @@ fn boundary_constraint_with_expr() { {BASE_MODULE} boundary_constraints {{ - enf clk.first = 5 + inputs[1] + 6 + enf clk.first = 5 + inputs[1] + 6; }}" ); @@ -189,12 +189,12 @@ fn boundary_constraint_with_const() { " {BASE_MODULE} - const A = 1 - const B = [0, 1] - const C = [[0, 1], [1, 0]] + const A = 1; + const B = [0, 1]; + const C = [[0, 1], [1, 0]]; boundary_constraints {{ - enf clk.first = A + B[1] - C[0][1] + enf clk.first = A + B[1] - C[0][1]; }}" ); @@ -221,10 +221,10 @@ fn boundary_constraint_with_variables() { {BASE_MODULE} boundary_constraints {{ - let a = 2^2 - let b = [a, 2 * a] - let c = [[a - 1, a^2], [b[0], b[1]]] - enf clk.first = 5 + a[3] + 6 + let a = 2^2; + let b = [a, 2 * a]; + let c = [[a - 1, a^2], [b[0], b[1]]]; + enf clk.first = 5 + a[3] + 6; }}" ); @@ -249,7 +249,7 @@ fn bc_comprehension_one_iterable_identifier() { {BASE_MODULE} boundary_constraints {{ - enf x.first = 0 for x in inputs + enf x.first = 0 for x in inputs; }}" ); @@ -270,7 +270,7 @@ fn bc_comprehension_one_iterable_range() { {BASE_MODULE} boundary_constraints {{ - enf x.first = 0 for x in (0..4) + enf x.first = 0 for x in (0..4); }}" ); @@ -291,7 +291,7 @@ fn bc_comprehension_one_iterable_slice() { {BASE_MODULE} boundary_constraints {{ - enf x.first = 0 for x in inputs[0..1] + enf x.first = 0 for x in inputs[0..1]; }}" ); @@ -312,7 +312,7 @@ fn bc_comprehension_two_iterable_identifiers() { {BASE_MODULE} boundary_constraints {{ - enf x.first = y for (x, y) in (inputs, inputs) + enf x.first = y for (x, y) in (inputs, inputs); }}" ); @@ -336,7 +336,7 @@ fn err_bc_comprehension_one_member_two_iterables() { {BASE_MODULE} boundary_constraints {{ - enf clk.first = c for c in (inputs, inputs) + enf clk.first = c for c in (inputs, inputs); }}" ); @@ -351,7 +351,7 @@ fn err_bc_comprehension_two_members_one_iterables() { {BASE_MODULE} boundary_constraints {{ - enf clk.first = c + d for (c, d) in inputs + enf clk.first = c + d for (c, d) in inputs; }}" ); @@ -369,7 +369,7 @@ fn err_invalid_variable() { {BASE_MODULE} boundary_constraints {{ - let a = 2^2 + [1] + let a = 2^2 + [1]; }}" ); ParseTest::new().expect_unrecognized_token(&source); @@ -382,9 +382,9 @@ fn err_missing_boundary_constraint() { {BASE_MODULE} boundary_constraints {{ - let a = 2^2 - let b = [a, 2 * a] - let c = [[a - 1, a^2], [b[0], b[1]]] + let a = 2^2; + let b = [a, 2 * a]; + let c = [[a - 1, a^2], [b[0], b[1]]]; }}" ); ParseTest::new().expect_module_diagnostic(&source, "expected one of: '\"enf\"', '\"let\"'"); diff --git a/parser/src/parser/tests/calls.rs b/parser/src/parser/tests/calls.rs index 1e47aed4..cb329b6a 100644 --- a/parser/src/parser/tests/calls.rs +++ b/parser/src/parser/tests/calls.rs @@ -10,9 +10,9 @@ fn call_fold_identifier() { mod test ev test([a, c[2]]) { - let x = sum(c) - let y = prod(c) - enf a = x + y + let x = sum(c); + let y = prod(c); + enf a = x + y; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -38,9 +38,9 @@ fn call_fold_vector_literal() { mod test ev test([a, b, c[4]]) { - let x = sum([a, b, c[0]]) - let y = prod([a, b, c[0]]) - enf a = x + y + let x = sum([a, b, c[0]]); + let y = prod([a, b, c[0]]); + enf a = x + y; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -68,9 +68,9 @@ fn call_fold_list_comprehension() { mod test ev test([a, b, c[4]]) { - let x = sum([col^7 for col in c]) - let y = prod([col^7 for col in c]) - enf a = x + y + let x = sum([col^7 for col in c]); + let y = prod([col^7 for col in c]); + enf a = x + y; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); diff --git a/parser/src/parser/tests/constant_propagation.rs b/parser/src/parser/tests/constant_propagation.rs index 4b50c346..7e705b0c 100644 --- a/parser/src/parser/tests/constant_propagation.rs +++ b/parser/src/parser/tests/constant_propagation.rs @@ -12,40 +12,40 @@ fn test_constant_propagation() { let root = r#" def root - use lib::* + use lib::*; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } - const A = [2, 4, 6, 8] - const B = [[1, 1], [2, 2]] + const A = [2, 4, 6, 8]; + const B = [[1, 1], [2, 2]]; integrity_constraints { - enf test_constraint(b) - let x = 2^EXP - let y = A[0..2] - enf a + y[1] = c + (x + 1) + enf test_constraint(b); + let x = 2^EXP; + let y = A[0..2]; + enf a + y[1] = c + (x + 1); } boundary_constraints { - let x = B[0] - enf a.first = x[0] + let x = B[0]; + enf a.first = x[0]; } "#; let lib = r#" mod lib - const EXP = 2 + const EXP = 2; ev test_constraint([b0, b1]) { - let x = EXP - let y = 2^x - enf b0 + x = b1 + y + let x = EXP; + let y = 2^x; + enf b0 + x = b1 + y; }"#; let test = ParseTest::new(); diff --git a/parser/src/parser/tests/constants.rs b/parser/src/parser/tests/constants.rs index a3e44989..60751091 100644 --- a/parser/src/parser/tests/constants.rs +++ b/parser/src/parser/tests/constants.rs @@ -12,8 +12,8 @@ fn constants_scalars() { let source = " mod test - const A = 1 - const B = 2"; + const A = 1; + const B = 2;"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); expected.constants.insert( @@ -32,8 +32,8 @@ fn constants_vectors() { let source = " mod test - const A = [1, 2, 3, 4] - const B = [5, 6, 7, 8]"; + const A = [1, 2, 3, 4]; + const B = [5, 6, 7, 8];"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); expected.constants.insert( @@ -60,8 +60,8 @@ fn constants_matrices() { let source = " mod test - const A = [[1, 2], [3, 4]] - const B = [[5, 6], [7, 8]]"; + const A = [[1, 2], [3, 4]]; + const B = [[5, 6], [7, 8]];"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); expected.constants.insert( @@ -90,7 +90,7 @@ fn err_const_matrix_unequal_number_of_cols() { let source = " mod test - const A = [[1, 2], [3, 4, 5]]"; + const A = [[1, 2], [3, 4, 5]];"; ParseTest::new() .expect_module_diagnostic(source, "invalid matrix literal: mismatched dimensions"); @@ -121,8 +121,8 @@ fn err_lowercase_constant_name() { let source = " mod test - const Ab = [[1, 2], [3, 4]] - const C = [[5, 6], [7, 8]]"; + const Ab = [[1, 2], [3, 4]]; + const C = [[5, 6], [7, 8]];"; ParseTest::new().expect_module_diagnostic(source, "constant identifiers must be uppercase"); } @@ -131,8 +131,8 @@ fn err_consts_with_non_int_values() { let source = " def test - const A = a - const B = 2"; + const A = a; + const B = 2;"; ParseTest::new().expect_unrecognized_token(source); } @@ -141,8 +141,8 @@ fn err_const_vectors_with_non_int_values() { let source = " def test - const A = [1, a] - const B = [2, 4]"; + const A = [1, a]; + const B = [2, 4];"; ParseTest::new().expect_unrecognized_token(source); } @@ -151,7 +151,7 @@ fn err_vector_with_trailing_comma() { let source = " def test - const A = [1, ]"; + const A = [1, ];"; ParseTest::new().expect_unrecognized_token(source); } @@ -160,7 +160,7 @@ fn err_matrix_with_trailing_comma() { let source = " def test - const A = [[1, 2], ]"; + const A = [[1, 2], ];"; ParseTest::new().expect_unrecognized_token(source); } @@ -169,7 +169,7 @@ fn err_matrix_mixed_element_types() { let source = " def test - const A = [1, [1, 2]]"; + const A = [1, [1, 2]];"; ParseTest::new().expect_unrecognized_token(source); } @@ -178,6 +178,6 @@ fn err_invalid_matrix_element() { let source = " def test - const A = [[1, 2], [3, [4, 5]]]"; + const A = [[1, 2], [3, [4, 5]]];"; ParseTest::new().expect_unrecognized_token(source); } diff --git a/parser/src/parser/tests/evaluators.rs b/parser/src/parser/tests/evaluators.rs index 645a8fc8..fc268e9e 100644 --- a/parser/src/parser/tests/evaluators.rs +++ b/parser/src/parser/tests/evaluators.rs @@ -13,7 +13,7 @@ fn ev_fn_main_cols() { mod test ev advance_clock([clk]) { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -35,7 +35,7 @@ fn ev_fn_aux_cols() { mod test ev foo([], [p]) { - enf p' = p + 1 + enf p' = p + 1; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -60,9 +60,9 @@ fn ev_fn_main_and_aux_cols() { mod test ev ev_func([clk], [a, b]) { - let z = a + b - enf clk' = clk + 1 - enf a' = a + z + let z = a + b; + enf clk' = clk + 1; + enf a' = a + z; }"; let body = vec![let_!(z = expr!(add!(access!(a), access!(b))) => @@ -89,19 +89,19 @@ fn ev_fn_call_simple() { def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf advance_clock([clk]) + enf advance_clock([clk]); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -130,19 +130,19 @@ fn ev_fn_call() { def test trace_columns { - main: [a[2], b[4], c[6]] + main: [a[2], b[4], c[6]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf advance_clock([a, b[1..3], c[2..4]]) + enf advance_clock([a, b[1..3], c[2..4]]); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -175,7 +175,7 @@ fn ev_fn_call_inside_ev_fn() { mod test ev ev_func([clk], [a, b]) { - enf advance_clock([clk]) + enf advance_clock([clk]); }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -202,19 +202,19 @@ fn ev_fn_call_with_more_than_two_args() { def test trace_columns { - main: [a, b, c] + main: [a, b, c], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf advance_clock([a], [b], [c]) + enf advance_clock([a], [b], [c]); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -261,7 +261,7 @@ fn ev_fn_call_with_no_args() { def test trace_columns { - main: [clk] + main: [clk], } integrity_constraints { diff --git a/parser/src/parser/tests/functions.rs b/parser/src/parser/tests/functions.rs index befa6411..f1da825d 100644 --- a/parser/src/parser/tests/functions.rs +++ b/parser/src/parser/tests/functions.rs @@ -13,7 +13,7 @@ fn fn_def_with_scalars() { mod test fn fn_with_scalars(a: felt, b: felt) -> felt { - return a + b + return a + b; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -36,7 +36,7 @@ fn fn_def_with_vectors() { mod test fn fn_with_vectors(a: felt[12], b: felt[12]) -> felt[12] { - return [x + y for (x, y) in (a, b)] + return [x + y for (x, y) in (a, b)]; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -62,23 +62,23 @@ fn fn_use_scalars_and_vectors() { def root public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [a, b[12]] + main: [a, b[12]], } fn fn_with_scalars_and_vectors(a: felt, b: felt[12]) -> felt { - return sum([a + x for x in b]) + return sum([a + x for x in b]); } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a' = fn_with_scalars_and_vectors(a, b) + enf a' = fn_with_scalars_and_vectors(a, b); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(root)); @@ -128,27 +128,27 @@ fn fn_call_in_fn() { def root public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [a, b[12]] + main: [a, b[12]], } fn fold_vec(a: felt[12]) -> felt { - return sum([x for x in a]) + return sum([x for x in a]); } fn fold_scalar_and_vec(a: felt, b: felt[12]) -> felt { - return a + fold_vec(b) + return a + fold_vec(b); } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a' = fold_scalar_and_vec(a, b) + enf a' = fold_scalar_and_vec(a, b); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(root)); @@ -211,31 +211,31 @@ fn fn_call_in_ev() { def root public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [a, b[12]] + main: [a, b[12]], } fn fold_vec(a: felt[12]) -> felt { - return sum([x for x in a]) + return sum([x for x in a]); } fn fold_scalar_and_vec(a: felt, b: felt[12]) -> felt { - return a + fold_vec(b) + return a + fold_vec(b); } ev evaluator([a, b[12]]) { - enf a' = fold_scalar_and_vec(a, b) + enf a' = fold_scalar_and_vec(a, b); } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf evaluator(a, b) + enf evaluator(a, b); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(root)); @@ -311,24 +311,24 @@ fn fn_as_lc_iterables() { def root public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [a[12], b[12]] + main: [a[12], b[12]], } fn operation(a: felt, b: felt) -> felt { - let x = a^b + 1 - return b^x + let x = a^b + 1; + return b^x; } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - enf a' = sum([operation(x, y) for (x, y) in (a, b)]) + enf a' = sum([operation(x, y) for (x, y) in (a, b)]); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(root)); @@ -384,24 +384,24 @@ fn fn_call_in_binary_ops() { def root public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [a[12], b[12]] + main: [a[12], b[12]], } fn operation(a: felt[12], b: felt[12]) -> felt { - return sum([x + y for (x, y) in (a, b)]) + return sum([x + y for (x, y) in (a, b)]); } boundary_constraints { - enf a[0].first = 0 + enf a[0].first = 0; } integrity_constraints { - enf a[0]' = a[0] * operation(a, b) - enf b[0]' = b[0] * operation(a, b) + enf a[0]' = a[0] * operation(a, b); + enf b[0]' = b[0] * operation(a, b); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(root)); @@ -468,25 +468,25 @@ fn fn_call_in_vector_def() { def root public_inputs { - stack_inputs: [16] + stack_inputs: [16], } trace_columns { - main: [a[12], b[12]] + main: [a[12], b[12]], } fn operation(a: felt[12], b: felt[12]) -> felt[12] { - return [x + y for (x, y) in (a, b)] + return [x + y for (x, y) in (a, b)]; } boundary_constraints { - enf a[0].first = 0 + enf a[0].first = 0; } integrity_constraints { - let d = [a[0] * operation(a, b), b[0] * operation(a, b)] - enf a[0]' = d[0] - enf b[0]' = d[1] + let d = [a[0] * operation(a, b), b[0] * operation(a, b)]; + enf a[0]' = d[0]; + enf b[0]' = d[1]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(root)); diff --git a/parser/src/parser/tests/identifiers.rs b/parser/src/parser/tests/identifiers.rs index 96fa8edb..6e611c2a 100644 --- a/parser/src/parser/tests/identifiers.rs +++ b/parser/src/parser/tests/identifiers.rs @@ -12,7 +12,7 @@ fn error_invalid_int() { def test trace_columns {{ - main: [clk] + main: [clk], }} integrity_constraints {{ diff --git a/parser/src/parser/tests/inlining.rs b/parser/src/parser/tests/inlining.rs index 08dc692b..d6c7670f 100644 --- a/parser/src/parser/tests/inlining.rs +++ b/parser/src/parser/tests/inlining.rs @@ -25,41 +25,41 @@ fn test_inlining_with_evaluator_split_input_binding() { let root = r#" def root - use lib::* + use lib::*; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } - const A = [2, 4, 6, 8] - const B = [[1, 1], [2, 2]] + const A = [2, 4, 6, 8]; + const B = [[1, 1], [2, 2]]; integrity_constraints { - enf test_constraint(b) - let x = 2^EXP - let y = A[0..2] - enf a + y[1] = c + (x + 1) + enf test_constraint(b); + let x = 2^EXP; + let y = A[0..2]; + enf a + y[1] = c + (x + 1); } boundary_constraints { - let x = B[0] - enf a.first = x[0] + let x = B[0]; + enf a.first = x[0]; } "#; let lib = r#" mod lib - const EXP = 2 + const EXP = 2; ev test_constraint([b0, b1]) { - let x = EXP - let y = 2^x - enf b0 + x = b1 + y + let x = EXP; + let y = 2^x; + enf b0 + x = b1 + y; }"#; let test = ParseTest::new(); @@ -150,22 +150,22 @@ fn test_inlining_with_vector_literal_binding_regrouped() { let root = r#" def root - use lib::* + use lib::*; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint([clk, b]) + enf test_constraint([clk, b]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; @@ -173,7 +173,7 @@ fn test_inlining_with_vector_literal_binding_regrouped() { mod lib ev test_constraint([pair[2], b1]) { - enf pair[0] + pair[1] = b1 + enf pair[0] + pair[1] = b1; }"#; let test = ParseTest::new(); @@ -240,29 +240,29 @@ fn test_inlining_with_vector_literal_binding_unordered() { let root = r#" def root - use lib::* + use lib::*; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint([b, clk]) + enf test_constraint([b, clk]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; let lib = r#" mod lib ev test_constraint([b0, pair[2]]) { - enf pair[1] + b0 = pair[0] + enf pair[1] + b0 = pair[0]; }"#; let test = ParseTest::new(); @@ -329,29 +329,29 @@ fn test_inlining_with_vector_literal_binding_different_arity_many_to_few() { let root = r#" def root - use lib::* + use lib::*; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint([clk, b, a]) + enf test_constraint([clk, b, a]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; let lib = r#" mod lib ev test_constraint([pair[3], foo]) { - enf pair[0] + pair[1] = foo + pair[2] + enf pair[0] + pair[1] = foo + pair[2]; }"#; let test = ParseTest::new(); @@ -418,29 +418,29 @@ fn test_inlining_with_vector_literal_binding_different_arity_few_to_many() { let root = r#" def root - use lib::* + use lib::*; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint([b, a]) + enf test_constraint([b, a]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; let lib = r#" mod lib ev test_constraint([x, y, z]) { - enf x + y = z + enf x + y = z; }"#; let test = ParseTest::new(); @@ -506,37 +506,37 @@ fn test_inlining_across_modules_with_nested_evaluators_variant1() { let root = r#" def root - use lib1::test_constraint + use lib1::test_constraint; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint([clk, b, a]) + enf test_constraint([clk, b, a]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; let lib1 = r#" mod lib1 - use lib2::* + use lib2::*; ev test_constraint([tuple[3], z]) { - enf helper_constraint([z, tuple[1..3]]) + enf helper_constraint([z, tuple[1..3]]); }"#; let lib2 = r#" mod lib2 ev helper_constraint([x[2], y]) { - enf x[0] + x[1] = y + enf x[0] + x[1] = y; }"#; let test = ParseTest::new(); @@ -618,37 +618,37 @@ fn test_inlining_across_modules_with_nested_evaluators_variant2() { let root = r#" def root - use lib1::test_constraint + use lib1::test_constraint; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint([clk, b[0..2], a]) + enf test_constraint([clk, b[0..2], a]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; let lib1 = r#" mod lib1 - use lib2::* + use lib2::*; ev test_constraint([tuple[3], z]) { - enf helper_constraint([z, tuple[1], tuple[2..3]]) + enf helper_constraint([z, tuple[1], tuple[2..3]]); }"#; let lib2 = r#" mod lib2 ev helper_constraint([x[2], y]) { - enf x[0] + x[1] = y + enf x[0] + x[1] = y; }"#; let test = ParseTest::new(); @@ -735,14 +735,14 @@ fn test_inlining_constraint_comprehensions_no_selector() { let root = r#" def root - const YS = [2, 4, 6, 8] + const YS = [2, 4, 6, 8]; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { @@ -751,11 +751,11 @@ fn test_inlining_constraint_comprehensions_no_selector() { # enf b[0]' = 2 # enf b[1]' = 4 # - enf x' = y for (x, y) in (b, YS[0..2]) + enf x' = y for (x, y) in (b, YS[0..2]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; @@ -813,14 +813,14 @@ fn test_inlining_constraint_comprehensions_with_selector() { let root = r#" def root - const YS = [2, 4, 6, 8] + const YS = [2, 4, 6, 8]; trace_columns { - main: [clk, a, b[2], c] + main: [clk, a, b[2], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { @@ -829,11 +829,11 @@ fn test_inlining_constraint_comprehensions_with_selector() { # enf b[0]' = 2 when c # enf b[1]' = 4 when c # - enf x' = y for (x, y) in (b, YS[0..2]) when c + enf x' = y for (x, y) in (b, YS[0..2]) when c; } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; @@ -893,14 +893,14 @@ fn test_inlining_constraint_comprehensions_with_constant_selector() { let root = r#" def root - const YS = [0, 4, 0, 8] + const YS = [0, 4, 0, 8]; trace_columns { - main: [clk, a, b[4], c] + main: [clk, a, b[4], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { @@ -909,11 +909,11 @@ fn test_inlining_constraint_comprehensions_with_constant_selector() { # enf b[1]' = 4 # enf b[3]' = 8 # - enf x' = y for (x, y) in (b, YS) when y + enf x' = y for (x, y) in (b, YS) when y; } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } "#; @@ -970,30 +970,30 @@ fn test_inlining_constraint_comprehensions_in_evaluator() { let root = r#" def root - const YS = [0, 4, 0, 8] + const YS = [0, 4, 0, 8]; trace_columns { - main: [clk, a, b[4], c] + main: [clk, a, b[4], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint(b[1..4]) + enf test_constraint(b[1..4]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } ev test_constraint([i, j[2]]) { - let ys = [x^2 for x in YS] - let k = j[0] - let l = j[1] - let xs = [i, k, l] - enf x' = y for (x, y) in (xs, ys[1..4]) when y + let ys = [x^2 for x in YS]; + let k = j[0]; + let l = j[1]; + let xs = [i, k, l]; + enf x' = y for (x, y) in (xs, ys[1..4]) when y; }"#; let test = ParseTest::new(); @@ -1070,25 +1070,25 @@ fn test_inlining_constraints_with_folded_comprehensions_in_evaluator() { def root trace_columns { - main: [clk, a, b[4], c] + main: [clk, a, b[4], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - enf test_constraint(b[1..4]) + enf test_constraint(b[1..4]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } ev test_constraint([x, ys[2]]) { - let y = sum([col^7 for col in ys]) - let z = prod([col^7 for col in ys]) - enf x = y + z + let y = sum([col^7 for col in ys]); + let z = prod([col^7 for col in ys]); + enf x = y + z; }"#; let test = ParseTest::new(); @@ -1171,31 +1171,31 @@ fn test_inlining_with_function_call_as_binary_operand() { def root trace_columns { - main: [clk, a, b[4], c] + main: [clk, a, b[4], c], } public_inputs { - inputs: [0] + inputs: [0], } integrity_constraints { - let complex_fold = fold_sum(b) * fold_vec(b) - enf complex_fold = 1 + let complex_fold = fold_sum(b) * fold_vec(b); + enf complex_fold = 1; } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } fn fold_sum(a: felt[4]) -> felt { - return a[0] + a[1] + a[2] + a[3] + return a[0] + a[1] + a[2] + a[3]; } fn fold_vec(a: felt[4]) -> felt { - let m = a[0] * a[1] - let n = m * a[2] - let o = n * a[3] - return o + let m = a[0] * a[1]; + let n = m * a[2]; + let o = n * a[3]; + return o; } "#; @@ -1295,46 +1295,46 @@ fn test_repro_issue340() { def root trace_columns { - main: [instruction_word, instruction_bits[32], immediate, s] + main: [instruction_word, instruction_bits[32], immediate, s], } public_inputs { - stack_inputs: [16] - stack_outputs: [16] + stack_inputs: [16], + stack_outputs: [16], } periodic_columns { - k0: [1, 1, 1, 1, 1, 1, 1, 0] + k0: [1, 1, 1, 1, 1, 1, 1, 0], } boundary_constraints { # define boundary constraints against the main trace at the first row of the trace. - enf instruction_word.first = 0 - enf instruction_word.last = 2 + enf instruction_word.first = 0; + enf instruction_word.last = 2; } integrity_constraints { # The instruction bit decomposition must be bits - enf b^2 = b for b in instruction_bits + enf b^2 = b for b in instruction_bits; # Ensure they add up to the instruction word: - let word_sum = sum([2^i * a for (i, a) in (0..32, instruction_bits)]) - enf instruction_word = word_sum + let word_sum = sum([2^i * a for (i, a) in (0..32, instruction_bits)]); + enf instruction_word = word_sum; enf match { case s: imm_reconstruction([instruction_bits, immediate]) case !s: immediate = 0 - } + }; } # The highest bit is a sign bit, so we sign extend then reconstruct from the other bits ev imm_reconstruction([instruction_bits[32], immediate]) { - let sign_bit = instruction_bits[31] - let high_bit_sum = sum([sign_bit*2^i for i in (11..32)]) - let immediate_bits = instruction_bits[20..31] - let low_bit_sum = sum([immediate_bit * 2^i for (i, immediate_bit) in (0..11, instruction_bits[20..31])]) - enf immediate = low_bit_sum + high_bit_sum - enf sign_bit = 1 + let sign_bit = instruction_bits[31]; + let high_bit_sum = sum([sign_bit*2^i for i in (11..32)]); + let immediate_bits = instruction_bits[20..31]; + let low_bit_sum = sum([immediate_bit * 2^i for (i, immediate_bit) in (0..11, instruction_bits[20..31])]); + enf immediate = low_bit_sum + high_bit_sum; + enf sign_bit = 1; }"#; let test = ParseTest::new(); diff --git a/parser/src/parser/tests/input/bar.air b/parser/src/parser/tests/input/bar.air index 1172c472..12400d97 100644 --- a/parser/src/parser/tests/input/bar.air +++ b/parser/src/parser/tests/input/bar.air @@ -5,9 +5,9 @@ periodic_columns { # This column has the same name as the one in `foo`, # but shouldn't conflict in `import_example` because it # is only referenced locally in this module - k0: [1, 0] + k0: [1, 0], } ev bar_constraint([clk]) { - enf clk' = clk + k0 when k0 + enf clk' = clk + k0 when k0; } diff --git a/parser/src/parser/tests/input/foo.air b/parser/src/parser/tests/input/foo.air index 77a186a9..7b25d9f1 100644 --- a/parser/src/parser/tests/input/foo.air +++ b/parser/src/parser/tests/input/foo.air @@ -2,13 +2,13 @@ mod foo periodic_columns { - k0: [1, 1, 0, 0] + k0: [1, 1, 0, 0], } ev foo_constraint([clk]) { - enf clk' = clk + 1 when k0 + enf clk' = clk + 1 when k0; } ev other_constraint([clk]) { - enf clk' = 0 when !k0 + enf clk' = 0 when !k0; } diff --git a/parser/src/parser/tests/input/import_example.air b/parser/src/parser/tests/input/import_example.air index 33e8f660..f63e5805 100644 --- a/parser/src/parser/tests/input/import_example.air +++ b/parser/src/parser/tests/input/import_example.air @@ -1,24 +1,24 @@ def import_example # Import all exported symbols from foo -use foo::* +use foo::*; # Import just `bar_constraint` from bar -use bar::bar_constraint +use bar::bar_constraint; trace_columns { - main: [clk, fmp, ctx] + main: [clk, fmp, ctx], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf foo_constraint([clk]) - enf bar_constraint([clk]) + enf foo_constraint([clk]); + enf bar_constraint([clk]); } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } \ No newline at end of file diff --git a/parser/src/parser/tests/input/system.air b/parser/src/parser/tests/input/system.air index ce3422ca..0acbeb06 100644 --- a/parser/src/parser/tests/input/system.air +++ b/parser/src/parser/tests/input/system.air @@ -1,17 +1,17 @@ def SystemAir trace_columns { - main: [clk, fmp, ctx] + main: [clk, fmp, ctx], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } diff --git a/parser/src/parser/tests/integrity_constraints.rs b/parser/src/parser/tests/integrity_constraints.rs index d7461903..b8707a73 100644 --- a/parser/src/parser/tests/integrity_constraints.rs +++ b/parser/src/parser/tests/integrity_constraints.rs @@ -13,19 +13,19 @@ fn integrity_constraints() { def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -80,20 +80,20 @@ fn multiple_integrity_constraints() { def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk + 1 - enf clk' - clk = 1 + enf clk' = clk + 1; + enf clk' - clk = 1; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -127,23 +127,23 @@ fn integrity_constraint_with_periodic_col() { def test trace_columns { - main: [b] + main: [b], } public_inputs { - inputs: [2] + inputs: [2], } periodic_columns { - k0: [1, 0] + k0: [1, 0], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf k0 + b = 0 + enf k0 + b = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -178,24 +178,24 @@ fn integrity_constraint_with_random_value() { def test trace_columns { - main: [a] - aux: [aux0[2]] + main: [a], + aux: [aux0[2]], } public_inputs { - inputs: [2] + inputs: [2], } random_values { - rand: [2] + rand: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf a + $rand[1] = 0 + enf a + $rand[1] = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -233,23 +233,23 @@ fn integrity_constraint_with_constants() { def test trace_columns { - main: [clk] + main: [clk], } - const A = 0 - const B = [0, 1] - const C = [[0, 1], [1, 0]] + const A = 0; + const B = [0, 1]; + const C = [[0, 1], [1, 0]]; public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk + A = B[1] + C[1][1] + enf clk + A = B[1] + C[1][1]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -288,22 +288,22 @@ fn integrity_constraint_with_variables() { def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - let a = 2^2 - let b = [a, 2 * a] - let c = [[a - 1, a^2], [b[0], b[1]]] - enf clk + a = b[1] + c[1][1] + let a = 2^2; + let b = [a, 2 * a]; + let c = [[a - 1, a^2], [b[0], b[1]]]; + enf clk + a = b[1] + c[1][1]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -337,21 +337,21 @@ fn integrity_constraint_with_indexed_trace_access() { def test trace_columns { - main: [a, b] - aux: [c, d] + main: [a, b], + aux: [c, d], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf $main[0]' = $main[1] + 1 - enf $aux[0]' - $aux[1] = 1 + enf $main[0]' = $main[1] + 1; + enf $aux[0]' - $aux[1] = 1; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -397,19 +397,19 @@ fn ic_comprehension_one_iterable_identifier() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf x = a + b for x in c + enf x = a + b for x in c; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -442,19 +442,19 @@ fn ic_comprehension_one_iterable_range() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf x = a + b for x in (1..4) + enf x = a + b for x in (1..4); }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -487,19 +487,19 @@ fn ic_comprehension_with_selectors() { def test trace_columns { - main: [s[2], a, b, c[4]] + main: [s[2], a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf x = a + b for x in c when s[0] & s[1] + enf x = a + b for x in c when s[0] & s[1]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -532,23 +532,23 @@ fn ic_comprehension_with_evaluator_call() { def test ev is_binary([x]) { - enf x^2 = x + enf x^2 = x; } trace_columns { - main: [a, b, c[4], d[4]] + main: [a, b, c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf is_binary([x]) for x in c + enf is_binary([x]) for x in c; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -590,23 +590,23 @@ fn ic_comprehension_with_evaluator_and_selectors() { def test ev is_binary([x]) { - enf x^2 = x + enf x^2 = x; } trace_columns { - main: [s[2], a, b, c[4], d[4]] + main: [s[2], a, b, c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf is_binary([x]) for x in c when s[0] & s[1] + enf is_binary([x]) for x in c when s[0] & s[1]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -650,26 +650,26 @@ fn ic_match_constraint() { def test ev is_binary([x]) { - enf x^2 = x + enf x^2 = x; } trace_columns { - main: [s[2], a, b, c[4], d[4]] + main: [s[2], a, b, c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { enf match { case s[0] & s[1]: is_binary([c[0]]) case s[0]: c[1] = c[2] - } + }; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -721,11 +721,11 @@ fn err_ic_comprehension_one_member_two_iterables() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } integrity_constraints { - enf a = c for c in (c, d) + enf a = c for c in (c, d); }"; ParseTest::new() @@ -738,11 +738,11 @@ fn err_ic_comprehension_two_members_one_iterable() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } integrity_constraints { - enf a = c + d for (c, d) in c + enf a = c + d for (c, d) in c; }"; ParseTest::new() @@ -758,13 +758,13 @@ fn err_missing_integrity_constraint() { def test trace_columns { - main: [clk] + main: [clk], } integrity_constraints { - let a = 2^2 - let b = [a, 2 * a] - let c = [[a - 1, a^2], [b[0], b[1]]] + let a = 2^2; + let b = [a, 2 * a]; + let c = [[a - 1, a^2], [b[0], b[1]]]; }"; ParseTest::new().expect_module_diagnostic(source, "expected one of: '\"enf\"', '\"let\"'"); } @@ -775,7 +775,7 @@ fn ic_invalid() { def test trace_columns { - main: [clk] + main: [clk], } integrity_constraints { @@ -790,7 +790,7 @@ fn error_invalid_next_usage() { def test trace_columns { - main: [clk] + main: [clk], } integrity_constraints { @@ -805,7 +805,7 @@ fn err_empty_integrity_constraints() { def test trace_columns { - main: [clk] + main: [clk], } integrity_constraints {} diff --git a/parser/src/parser/tests/list_comprehension.rs b/parser/src/parser/tests/list_comprehension.rs index 048ed2e7..c11474c1 100644 --- a/parser/src/parser/tests/list_comprehension.rs +++ b/parser/src/parser/tests/list_comprehension.rs @@ -13,22 +13,22 @@ fn bc_one_iterable_identifier_lc() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf a = 0 + enf a = 0; } boundary_constraints { # raise value in the current row to power 7 - let x = [col^7 for col in c] + let x = [col^7 for col in c]; - enf a.first = x[0] + x[1] + x[2] + x[3] + enf a.first = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -60,20 +60,20 @@ fn bc_identifier_and_range_lc() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf a = 0 + enf a = 0; } boundary_constraints { - let x = [2^i * c for (i, c) in (0..3, c)] - enf a.first = x[0] + x[1] + x[2] + x[3] + let x = [2^i * c for (i, c) in (0..3, c)]; + enf a.first = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -105,20 +105,20 @@ fn bc_iterable_slice_lc() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf a = 0 + enf a = 0; } boundary_constraints { - let x = [c for c in c[0..3]] - enf a.first = x[0] + x[1] + x[2] + x[3] + let x = [c for c in c[0..3]]; + enf a.first = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -150,20 +150,20 @@ fn bc_two_iterable_identifier_lc() { def test trace_columns { - main: [a, b, c[4], d[4]] + main: [a, b, c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf a = 0 + enf a = 0; } boundary_constraints { - let diff = [x - y for (x, y) in (c, d)] - enf a.first = x[0] + x[1] + x[2] + x[3] + let diff = [x - y for (x, y) in (c, d)]; + enf a.first = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -195,20 +195,20 @@ fn bc_multiple_iterables_lc() { def test trace_columns { - main: [a, b[3], c[4], d[4]] + main: [a, b[3], c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } integrity_constraints { - enf a = 0 + enf a = 0; } boundary_constraints { - let diff = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])] - enf a.first = x[0] + x[1] + x[2] + x[3] + let diff = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])]; + enf a.first = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -241,24 +241,24 @@ fn ic_one_iterable_identifier_lc() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { # raise value in the current row to power 7 - let x = [col^7 for col in c] + let x = [col^7 for col in c]; # raise value in the next row to power 7 - let y = [col'^7 for col in c] - enf a = x[0] + x[1] + x[2] + x[3] + let y = [col'^7 for col in c]; + enf a = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -291,20 +291,20 @@ fn ic_iterable_identifier_range_lc() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - let x = [2^i * c for (i, c) in (0..3, c)] - enf a = x[0] + x[1] + x[2] + x[3] + let x = [2^i * c for (i, c) in (0..3, c)]; + enf a = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -336,20 +336,20 @@ fn ic_iterable_slice_lc() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - let x = [c for c in c[0..3]] - enf a = x[0] + x[1] + x[2] + x[3] + let x = [c for c in c[0..3]]; + enf a = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -381,20 +381,20 @@ fn ic_two_iterable_identifier_lc() { def test trace_columns { - main: [a, b, c[4], d[4]] + main: [a, b, c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - let diff = [x - y for (x, y) in (c, d)] - enf a = x[0] + x[1] + x[2] + x[3] + let diff = [x - y for (x, y) in (c, d)]; + enf a = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -426,20 +426,20 @@ fn ic_multiple_iterables_lc() { def test trace_columns { - main: [a, b[3], c[4], d[4]] + main: [a, b[3], c[4], d[4]], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf a.first = 0 + enf a.first = 0; } integrity_constraints { - let diff = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])] - enf a = x[0] + x[1] + x[2] + x[3] + let diff = [w + x - y - z for (w, x, y, z) in (0..3, b, c[0..3], d[0..3])]; + enf a = x[0] + x[1] + x[2] + x[3]; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -475,12 +475,12 @@ fn err_bc_lc_one_member_two_iterables() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } boundary_constraints { - let x = [c for c in (c, d)] - enf a.first = x + let x = [c for c in (c, d)]; + enf a.first = x; }"; ParseTest::new() @@ -493,12 +493,12 @@ fn err_bc_lc_two_members_one_iterables() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } boundary_constraints { - let x = [c + d for (c, d) in c] - enf a.first = x + let x = [c + d for (c, d) in c]; + enf a.first = x; }"; ParseTest::new() @@ -511,12 +511,12 @@ fn err_ic_lc_one_member_two_iterables() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } integrity_constraints { - let x = [c for c in (c, d)] - enf a = x + let x = [c for c in (c, d)]; + enf a = x; }"; ParseTest::new() @@ -529,12 +529,12 @@ fn err_ic_lc_two_members_one_iterable() { def test trace_columns { - main: [a, b, c[4]] + main: [a, b, c[4]], } integrity_constraints { - let x = [c + d for (c, d) in c] - enf a = x + let x = [c + d for (c, d) in c]; + enf a = x; }"; ParseTest::new() diff --git a/parser/src/parser/tests/modules.rs b/parser/src/parser/tests/modules.rs index f8a307e8..f4fe8bef 100644 --- a/parser/src/parser/tests/modules.rs +++ b/parser/src/parser/tests/modules.rs @@ -9,7 +9,7 @@ fn use_declaration() { let source = " mod test - use foo::* + use foo::*; "; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); expected.imports.insert(ident!(foo), import_all!(foo)); @@ -21,7 +21,7 @@ fn import_declaration() { let source = " mod test - use foo::bar + use foo::bar; "; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); expected.imports.insert(ident!(foo), import!(foo, bar)); diff --git a/parser/src/parser/tests/periodic_columns.rs b/parser/src/parser/tests/periodic_columns.rs index 7e44e0ba..6b34673e 100644 --- a/parser/src/parser/tests/periodic_columns.rs +++ b/parser/src/parser/tests/periodic_columns.rs @@ -10,8 +10,8 @@ fn periodic_columns() { mod test periodic_columns { - k0: [1, 0, 0, 0] - k1: [0, 0, 0, 0, 0, 0, 0, 1] + k0: [1, 0, 0, 0], + k1: [0, 0, 0, 0, 0, 0, 0, 1], }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -47,7 +47,7 @@ fn err_periodic_columns_length() { mod test periodic_columns { - k0: [1, 0, 0] + k0: [1, 0, 0], }"; ParseTest::new().expect_module_diagnostic( diff --git a/parser/src/parser/tests/pub_inputs.rs b/parser/src/parser/tests/pub_inputs.rs index 12e07262..1197b543 100644 --- a/parser/src/parser/tests/pub_inputs.rs +++ b/parser/src/parser/tests/pub_inputs.rs @@ -13,20 +13,20 @@ fn public_inputs() { def test trace_columns { - main: [clk] + main: [clk], } public_inputs { - program_hash: [4] - stack_inputs: [16] + program_hash: [4], + stack_inputs: [16], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk = 0 + enf clk = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); diff --git a/parser/src/parser/tests/random_values.rs b/parser/src/parser/tests/random_values.rs index c848415a..815b5194 100644 --- a/parser/src/parser/tests/random_values.rs +++ b/parser/src/parser/tests/random_values.rs @@ -13,24 +13,24 @@ fn random_values_fixed_list() { def test trace_columns { - main: [clk] - aux: [a] + main: [clk], + aux: [a], } random_values { - rand: [15] + rand: [15], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk = 0 + enf clk = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -66,24 +66,24 @@ fn random_values_ident_vector() { def test trace_columns { - main: [clk] - aux: [aux0] + main: [clk], + aux: [aux0], } random_values { - rand: [a, b[12], c] + rand: [a, b[12], c], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk = 0 + enf clk = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -119,24 +119,24 @@ fn random_values_custom_name() { def test trace_columns { - main: [clk] - aux: [aux0] + main: [clk], + aux: [aux0], } random_values { - alphas: [14] + alphas: [14], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk = 0 + enf clk = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); @@ -172,15 +172,15 @@ fn err_random_values_empty_list() { def test trace_columns { - main: [clk] + main: [clk], } random_values { - rand: [] + rand: [], } integrity_constraints { - enf clk = 0 + enf clk = 0; }"; ParseTest::new().expect_module_diagnostic(source, "random values cannot be empty"); @@ -192,16 +192,16 @@ fn err_random_values_multiple_declaration() { def test trace_columns { - main: [clk] + main: [clk], } random_values { - rand: [12] - alphas: [a, b[2]] + rand: [12], + alphas: [a, b[2]], } integrity_constraints { - enf clk = 0 + enf clk = 0; }"; ParseTest::new() @@ -214,24 +214,24 @@ fn random_values_index_access() { def test trace_columns { - main: [clk] - aux: [aux0] + main: [clk], + aux: [aux0], } random_values { - rand: [12] + rand: [12], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk + $rand[1] = 0 + enf clk + $rand[1] = 0; }"; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); diff --git a/parser/src/parser/tests/selectors.rs b/parser/src/parser/tests/selectors.rs index 4332ff96..bbffc20d 100644 --- a/parser/src/parser/tests/selectors.rs +++ b/parser/src/parser/tests/selectors.rs @@ -13,19 +13,19 @@ fn single_selector() { def test trace_columns { - main: [clk, n1] + main: [clk, n1], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk when n1 + enf clk' = clk when n1; }"#; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); expected @@ -57,19 +57,19 @@ fn chained_selectors() { def test trace_columns { - main: [clk, n1, n2, n3] + main: [clk, n1, n2, n3], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk' = clk when (n1 & !n2) | !n3 + enf clk' = clk when (n1 & !n2) | !n3; }"#; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); expected.trace_columns.push(trace_segment!( diff --git a/parser/src/parser/tests/trace_columns.rs b/parser/src/parser/tests/trace_columns.rs index e5c0a278..ae2840e4 100644 --- a/parser/src/parser/tests/trace_columns.rs +++ b/parser/src/parser/tests/trace_columns.rs @@ -13,19 +13,19 @@ fn trace_columns() { def test trace_columns { - main: [clk, fmp, ctx] + main: [clk, fmp, ctx], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk = 0 + enf clk = 0; }"#; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); expected @@ -55,20 +55,20 @@ fn trace_columns_main_and_aux() { def test trace_columns { - main: [clk, fmp, ctx] - aux: [rc_bus, ch_bus] + main: [clk, fmp, ctx], + aux: [rc_bus, ch_bus], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf clk = 0 + enf clk = 0; }"#; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); expected @@ -101,21 +101,21 @@ fn trace_columns_groups() { def test trace_columns { - main: [clk, fmp, ctx, a[3]] - aux: [rc_bus, b[4], ch_bus] + main: [clk, fmp, ctx, a[3]], + aux: [rc_bus, b[4], ch_bus], } public_inputs { - inputs: [2] + inputs: [2], } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; } integrity_constraints { - enf a[1]' = 1 - enf clk' = clk - 1 + enf a[1]' = 1; + enf clk' = clk - 1; }"#; let mut expected = Module::new(ModuleType::Root, SourceSpan::UNKNOWN, ident!(test)); expected.trace_columns.push(trace_segment!( @@ -168,16 +168,16 @@ fn err_main_trace_cols_missing() { def test trace_columns { - aux: [clk] + aux: [clk], } public_inputs { - stack_inputs: [16] + stack_inputs: [16], } integrity_constraints { - enf clk' = clk + 1 + enf clk' = clk + 1; } boundary_constraints { - enf clk.first = 0 + enf clk.first = 0; }"#; ParseTest::new() diff --git a/parser/src/parser/tests/variables.rs b/parser/src/parser/tests/variables.rs index 70e9aff5..2005b2be 100644 --- a/parser/src/parser/tests/variables.rs +++ b/parser/src/parser/tests/variables.rs @@ -12,8 +12,8 @@ fn variables_with_and_operators() { mod test ev test([clk]) { - let flag = n1 & !n2 - enf clk' = clk + 1 when flag + let flag = n1 & !n2; + enf clk' = clk + 1 when flag; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -40,8 +40,8 @@ fn variables_with_or_operators() { mod test ev test([clk]) { - let flag = n1 | !n2' - enf clk' = clk + 1 when flag + let flag = n1 | !n2'; + enf clk' = clk + 1 when flag; }"; let mut expected = Module::new(ModuleType::Library, SourceSpan::UNKNOWN, ident!(test)); @@ -70,9 +70,9 @@ fn err_let_bound_variable_at_top_level() { let source = " def test - const A = 1 + const A = 1; - let a = 0"; + let a = 0;"; ParseTest::new().expect_unrecognized_token(source); } @@ -83,7 +83,7 @@ fn err_vector_variable_with_trailing_comma() { def test integrity_constraints { - let a = [1, ]"; + let a = [1, ];"; ParseTest::new().expect_unrecognized_token(source); } @@ -94,7 +94,7 @@ fn err_matrix_variable_with_trailing_comma() { def test integrity_constraints { - let a = [[1, 2], ]"; + let a = [[1, 2], ];"; ParseTest::new().expect_unrecognized_token(source); } @@ -104,7 +104,7 @@ fn err_matrix_variable_mixed_element_types() { def test integrity_constraints { - let a = [[1, 2], 1]"; + let a = [[1, 2], 1];"; ParseTest::new().expect_unrecognized_token(source); } @@ -114,7 +114,7 @@ fn err_invalid_matrix_element() { def test integrity_constraints { - let a = [[1, 2], [3, [4, 5]]]"; + let a = [[1, 2], [3, [4, 5]]];"; ParseTest::new().expect_unrecognized_token(source); } @@ -124,9 +124,9 @@ fn err_matrix_variable_from_vector_and_reference() { def test integrity_constraints { - let a = [[1, 2], [3, 4]] - let b = [5, 6] - let c = [b, [7, 8]] - let d = [[7, 8], a[0]]"; + let a = [[1, 2], [3, 4]]; + let b = [5, 6]; + let c = [b, [7, 8]]; + let d = [[7, 8], a[0]];"; ParseTest::new().expect_unrecognized_token(source); }