Skip to content

Commit

Permalink
test: Update test function_complex to have ^7 exponent
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Besancon committed Aug 9, 2024
1 parent bfdf6de commit 8277fe9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
2 changes: 1 addition & 1 deletion air-script/tests/functions/functions_complex.air
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ boundary_constraints {
integrity_constraints {
# let val = $alpha[0] + v
let f = get_multiplicity_flags(s0, s1)
let z = v^4 * f[3] + v^2 * f[2] + v * f[1] + f[0]
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
Expand Down
30 changes: 1 addition & 29 deletions air-script/tests/functions/functions_complex.masm
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,7 @@ proc.compute_integrity_constraints
# Multiply by the composition coefficient
padw mem_loadw.4294900200 movdn.3 movdn.3 drop drop ext2mul
# integrity constraint 0 for aux
padw mem_loadw.4294900072 drop drop padw mem_loadw.4294900072 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop
# push the accumulator to the stack
push.1 movdn.2 push.0 movdn.2
# => [b1, b0, r1, r0, ...]
# square 2 times
dup.1 dup.1 ext2mul dup.1 dup.1 ext2mul
# multiply
dup.1 dup.1 movdn.5 movdn.5
# => [b1, b0, r1, r0, b1, b0, ...] (4 cycles)
ext2mul movdn.3 movdn.3
# => [b1, b0, r1', r0', ...] (5 cycles)
# clean stack
drop drop
# => [r1, r0, ...] (2 cycles)
padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2mul ext2mul padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop
# push the accumulator to the stack
push.1 movdn.2 push.0 movdn.2
# => [b1, b0, r1, r0, ...]
# square 1 times
dup.1 dup.1 ext2mul
# multiply
dup.1 dup.1 movdn.5 movdn.5
# => [b1, b0, r1, r0, b1, b0, ...] (4 cycles)
ext2mul movdn.3 movdn.3
# => [b1, b0, r1', r0', ...] (5 cycles)
# clean stack
drop drop
# => [r1, r0, ...] (2 cycles)
push.1 push.0 padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop ext2sub padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2mul ext2mul ext2add padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop push.1 push.0 padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2sub ext2mul ext2mul ext2add push.1 push.0 padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop ext2sub push.1 push.0 padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2sub ext2mul ext2add padw mem_loadw.4294900000 movdn.3 movdn.3 drop drop ext2mul padw mem_loadw.4294900000 movdn.3 movdn.3 drop drop ext2sub push.1 push.0 ext2add ext2mul ext2sub
padw mem_loadw.4294900072 drop drop padw mem_loadw.4294900072 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop ext2mul padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop ext2mul padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop ext2mul ext2mul ext2mul ext2mul padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2mul ext2mul padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop ext2mul push.1 push.0 padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop ext2sub padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2mul ext2mul ext2add padw mem_loadw.4294900003 movdn.3 movdn.3 drop drop padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop push.1 push.0 padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2sub ext2mul ext2mul ext2add push.1 push.0 padw mem_loadw.4294900001 movdn.3 movdn.3 drop drop ext2sub push.1 push.0 padw mem_loadw.4294900002 movdn.3 movdn.3 drop drop ext2sub ext2mul ext2add padw mem_loadw.4294900000 movdn.3 movdn.3 drop drop ext2mul padw mem_loadw.4294900000 movdn.3 movdn.3 drop drop ext2sub push.1 push.0 ext2add ext2mul ext2sub
# Multiply by the composition coefficient
padw mem_loadw.4294900200 drop drop ext2mul
end # END PROC compute_integrity_constraints
Expand Down
4 changes: 2 additions & 2 deletions air-script/tests/functions/functions_complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Air for FunctionsAir {

fn new(trace_info: TraceInfo, public_inputs: PublicInputs, options: WinterProofOptions) -> Self {
let main_degrees = vec![TransitionConstraintDegree::new(1)];
let aux_degrees = vec![TransitionConstraintDegree::new(8)];
let aux_degrees = vec![TransitionConstraintDegree::new(11)];
let num_main_assertions = 1;
let num_aux_assertions = 0;

Expand Down Expand Up @@ -86,6 +86,6 @@ impl Air for FunctionsAir {
let main_next = main_frame.next();
let aux_current = aux_frame.current();
let aux_next = aux_frame.next();
result[0] = aux_next[0] - aux_current[0] * ((E::from(main_current[3]).exp(E::PositiveInteger::from(4_u64)) * E::from(main_current[1]) * E::from(main_current[2]) + E::from(main_current[3]).exp(E::PositiveInteger::from(2_u64)) * (E::ONE - E::from(main_current[1])) * E::from(main_current[2]) + E::from(main_current[3]) * E::from(main_current[1]) * (E::ONE - E::from(main_current[2])) + (E::ONE - E::from(main_current[1])) * (E::ONE - E::from(main_current[2]))) * E::from(main_current[0]) - E::from(main_current[0]) + E::ONE);
result[0] = aux_next[0] - aux_current[0] * ((E::from(main_current[3]) * E::from(main_current[3]) * E::from(main_current[3]) * E::from(main_current[3]) * E::from(main_current[3]) * E::from(main_current[3]) * E::from(main_current[3]) * E::from(main_current[1]) * E::from(main_current[2]) + E::from(main_current[3]) * E::from(main_current[3]) * (E::ONE - E::from(main_current[1])) * E::from(main_current[2]) + E::from(main_current[3]) * E::from(main_current[1]) * (E::ONE - E::from(main_current[2])) + (E::ONE - E::from(main_current[1])) * (E::ONE - E::from(main_current[2]))) * E::from(main_current[0]) - E::from(main_current[0]) + E::ONE);
}
}

0 comments on commit 8277fe9

Please sign in to comment.