-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use semicolons as statement terminators (#353)
- Loading branch information
Showing
67 changed files
with
1,435 additions
and
1,431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]; | ||
} |
12 changes: 6 additions & 6 deletions
12
air-script/tests/constraint_comprehension/cc_with_evaluators.air
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
10 changes: 5 additions & 5 deletions
10
air-script/tests/constraint_comprehension/constraint_comprehension.air
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
Oops, something went wrong.