Skip to content

Commit

Permalink
use same order of terms in eq' constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Mar 3, 2024
1 parent 5ef3117 commit c3e9053
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions triton-vm/src/table/processor_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1917,20 +1917,20 @@ impl ExtProcessorTable {
circuit_builder.input(NextBaseRow(col.master_base_table_index()))
};

let st0_eq_st1 = || one() - curr_base_row(HV0) * (curr_base_row(ST1) - curr_base_row(ST0));

// Helper variable hv0 is the inverse-or-zero of the difference of the stack's two top-most
// elements: `hv0·(hv0·(st1 - st0) - 1)`
let hv0_is_inverse_of_diff_or_hv0_is_0 = curr_base_row(HV0)
* (curr_base_row(HV0) * (curr_base_row(ST1) - curr_base_row(ST0)) - one());
// elements: `hv0·(1 - hv0·(st1 - st0))`
let hv0_is_inverse_of_diff_or_hv0_is_0 = curr_base_row(HV0) * st0_eq_st1();

// Helper variable hv0 is the inverse-or-zero of the difference of the stack's two
// top-most elements: `(st1 - st0)·(hv0·(st1 - st0) - 1)`
let hv0_is_inverse_of_diff_or_diff_is_0 = (curr_base_row(ST1) - curr_base_row(ST0))
* (curr_base_row(HV0) * (curr_base_row(ST1) - curr_base_row(ST0)) - one());
// top-most elements: `(st1 - st0)·(1 - hv0·(st1 - st0))`
let hv0_is_inverse_of_diff_or_diff_is_0 =
(curr_base_row(ST1) - curr_base_row(ST0)) * st0_eq_st1();

// The new top of the stack is 1 if the difference between the stack's two top-most
// elements is not invertible, 0 otherwise: `st0' - (1 - hv0·(st1 - st0))`
let st0_becomes_1_if_diff_is_not_invertible = next_base_row(ST0)
- (one() - curr_base_row(HV0) * (curr_base_row(ST1) - curr_base_row(ST0)));
let st0_becomes_1_if_diff_is_not_invertible = next_base_row(ST0) - st0_eq_st1();

let specific_constraints = vec![
hv0_is_inverse_of_diff_or_hv0_is_0,
Expand Down

0 comments on commit c3e9053

Please sign in to comment.