Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make Op Stack Table variable length #234

Merged
merged 27 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f295acb
refactor: handle multiple co-processor calls more easily
jan-ferdinand Oct 17, 2023
c8eaf8c
refactor: delegate instruction lookup recording to `AET`
jan-ferdinand Oct 17, 2023
546167e
doc: remove redundant comments and doc-comments
jan-ferdinand Oct 17, 2023
612714d
refactor(vm): rename `ramp` to `ram_pointer`
jan-ferdinand Oct 17, 2023
744086f
refactor(opstack): simpler type conversion from `OpStackElement`
jan-ferdinand Oct 18, 2023
c6e54d4
feat: add enum to record changes to op stack underflow
jan-ferdinand Oct 18, 2023
4323b20
chore(test): remove unnecessary paths
jan-ferdinand Oct 19, 2023
49424a6
feat: propagate opstack underflow read/write to VM
jan-ferdinand Oct 19, 2023
2aa72e7
fix: overflowing subtractions when accessing op stack underflow
jan-ferdinand Oct 19, 2023
3ee0a01
feat: propagate opstack underflow read/write to AET
jan-ferdinand Oct 19, 2023
a57ef7c
feat: record opstack underflow read/write in AET
jan-ferdinand Oct 20, 2023
a8e6966
feat: make op stack table variable length
jan-ferdinand Oct 20, 2023
2c2ade0
fix: processor's running product with op stack
jan-ferdinand Oct 23, 2023
7418502
test: op stack table row sorting
jan-ferdinand Oct 23, 2023
e84d6a0
fix: processor's lookup multiplicity of clock jump difference “1”
jan-ferdinand Oct 23, 2023
49fb63a
fix: record correct op stack pointers in co-processor call sequence
jan-ferdinand Oct 23, 2023
eea37ca
fix: delete spurious stack underflow write from `divine_sibling`
jan-ferdinand Oct 23, 2023
4efffde
test: stack underflow i/o sequence properties
jan-ferdinand Oct 23, 2023
224e792
test: factor for running product with Op Stack Table never panics
jan-ferdinand Oct 23, 2023
eb8dc84
doc: consistently use a space in “op stack” and “jump stack”
jan-ferdinand Oct 24, 2023
db01232
doc: prose and example for Op Stack Table behavior
jan-ferdinand Oct 24, 2023
f177d65
doc: update AET relations diagram
jan-ferdinand Oct 24, 2023
ad09b8d
doc: Op Stack Table padding
jan-ferdinand Oct 24, 2023
3fb003b
doc: update Op Stack Table's AIR
jan-ferdinand Oct 25, 2023
308d67f
fix: add missing transition constraint for instruction `swap`
jan-ferdinand Oct 25, 2023
4bbc2d2
fix(doc): correct explanations for previous designs
jan-ferdinand Oct 25, 2023
e59eede
doc: update Processor Table's AET and AIR
jan-ferdinand Oct 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions specification/src/instruction-groups.md
Original file line number Diff line number Diff line change
@@ -197,8 +197,8 @@ Contains all constraints from instruction group `keep_jump_stack`, and additiona
1. The stack element in `st12` is moved into `st13`.
1. The stack element in `st13` is moved into `st14`.
1. The stack element in `st14` is moved into `st15`.
1. The stack element in `st15` is moved to the top of op stack underflow, i.e., `osv`.
1. The op stack pointer is incremented by 1.
1. The running product for the Op Stack Table absorbs the current row with respect to challenges 🍋, 🍊, 🍉, and 🫒 and indeterminate 🪤.

### Polynomials

@@ -216,8 +216,8 @@ Contains all constraints from instruction group `keep_jump_stack`, and additiona
1. `st13' - st12`
1. `st14' - st13`
1. `st15' - st14`
1. `osv' - st15`
1. `osp' - (osp + 1)`
1. `op_stack_pointer' - (op_stack_pointer + 1)`
1. `RunningProductOpStackTable' - RunningProductOpStackTable·(🪤 - 🍋·clk - 🍊·ib1 - 🍉·op_stack_pointer - 🫒·st15)`

## Group `grow_stack`

@@ -240,8 +240,8 @@ Contains all constraints from instruction group `stack_grows_and_top_2_unconstra
1. The stack element in `st13` does not change.
1. The stack element in `st14` does not change.
1. The stack element in `st15` does not change.
1. The top of the op stack underflow, i.e., `osv`, does not change.
1. The op stack pointer does not change.
1. The running product for the Op Stack Table remains unchanged.

### Polynomials

@@ -250,8 +250,8 @@ Contains all constraints from instruction group `stack_grows_and_top_2_unconstra
1. `st13' - st13`
1. `st14' - st14`
1. `st15' - st15`
1. `osv' - osv`
1. `osp' - osp`
1. `op_stack_pointer' - op_stack_pointer`
1. `RunningProductOpStackTable' - RunningProductOpStackTable`

## Group `stack_remains_and_top_10_unconstrained`

@@ -317,7 +317,7 @@ Contains all constraints from instruction group `unary_operation`, and additiona

## Group `stack_shrinks_and_top_3_unconstrained`

This instruction group requires helper variable `hv0` to hold the multiplicative inverse of `(osp - 16)`.
This instruction group requires helper variable `hv0` to hold the multiplicative inverse of `(op_stack_pointer - 16)`.
In effect, this means that the op stack pointer can only be decremented if it is not 16, i.e., if op stack underflow memory is not empty.
Since the stack can only change by one element at a time, this prevents stack underflow.

@@ -335,9 +335,9 @@ Since the stack can only change by one element at a time, this prevents stack un
1. The stack element in `st13` is moved into `st12`.
1. The stack element in `st14` is moved into `st13`.
1. The stack element in `st15` is moved into `st14`.
1. The stack element at the top of op stack underflow, i.e., `osv`, is moved into `st15`.
1. The op stack pointer is decremented by 1.
1. The helper variable register `hv0` holds the inverse of `(osp - 16)`.
1. The helper variable register `hv0` holds the inverse of `(op_stack_pointer - 16)`.
1. The running product for the Op Stack Table absorbs clock cycle and instruction bit 1 from the current row as well as op stack pointer and stack element 15 from the next row with respect to challenges 🍋, 🍊, 🍉, and 🫒 and indeterminate 🪤.

### Polynomials

@@ -353,9 +353,9 @@ Since the stack can only change by one element at a time, this prevents stack un
1. `st12' - st13`
1. `st13' - st14`
1. `st14' - st15`
1. `st15' - osv`
1. `osp' - (osp - 1)`
1. `(osp - 16)·hv0 - 1`
1. `op_stack_pointer' - (op_stack_pointer - 1)`
1. `(op_stack_pointer - 16)·hv0 - 1`
1. `RunningProductOpStackTable' - RunningProductOpStackTable·(🪤 - 🍋·clk - 🍊·ib1 - 🍉·op_stack_pointer' - 🫒·st15')`

## Group `binary_operation`

Original file line number Diff line number Diff line change
@@ -134,8 +134,8 @@ Additionally, it defines the following transition constraints.
1. If `i` is not 13, then `st13` does not change.
1. If `i` is not 14, then `st14` does not change.
1. If `i` is not 15, then `st15` does not change.
1. The top of the op stack underflow, i.e., `osv`, does not change.
1. The op stack pointer does not change.
1. The running product for the Op Stack Table remains unchanged.

### Polynomials

@@ -185,8 +185,8 @@ Additionally, it defines the following transition constraints.
1. `(1 - ind_13(hv3, hv2, hv1, hv0))·(st13' - st13)`
1. `(1 - ind_14(hv3, hv2, hv1, hv0))·(st14' - st14)`
1. `(1 - ind_15(hv3, hv2, hv1, hv0))·(st15' - st15)`
1. `osv' - osv`
1. `osp' - osp`
1. `op_stack_pointer' - op_stack_pointer`
1. `RunningProductOpStackTable' - RunningProductOpStackTable`

### Helper variable definitions for `swap` + `i`

12 changes: 4 additions & 8 deletions specification/src/processor-table.md
Original file line number Diff line number Diff line change
@@ -99,13 +99,12 @@ However, in order to verify the correctness of `RunningEvaluationHashDigest`, th
1. The operational stack element `st10` is 0.
1. The [Evaluation Argument](evaluation-argument.md) of operational stack elements `st11` through `st15` with respect to indeterminate 🥬 equals the public part of program digest challenge, 🫑.
See [program attestation](program-attestation.md) for more details.
1. The operational stack pointer `osp` is 16.
1. The operational stack value `osv` is 0.
1. The `op_stack_pointer` is 16.
1. The RAM pointer `ramp` is 0.
1. `RunningEvaluationStandardInput` is 1.
1. `RunningEvaluationStandardOutput` is 1.
1. `InstructionLookupClientLogDerivative` has absorbed the first row with respect to challenges 🥝, 🥥, and 🫐 and indeterminate 🪥.
1. `RunningProductOpStackTable` has absorbed the first row with respect to challenges 🍋, 🍊, 🍉, and 🫒 and indeterminate 🪤.
1. `RunningProductOpStackTable` is 1.
1. `RunningProductRamTable` has absorbed the first row with respect to challenges 🍍, 🍈, 🍎, and 🌽 and indeterminate 🛋.
1. `RunningProductJumpStackTable` has absorbed the first row with respect to challenges 🍇, 🍅, 🍌, 🍏, and 🍐 and indeterminate 🧴.
1. `RunningEvaluationHashInput` has absorbed the first row with respect to challenges 🧄₀ through 🧄₉ and indeterminate 🚪 if the current instruction is `hash`. Otherwise, it is 1.
@@ -134,13 +133,12 @@ See [program attestation](program-attestation.md) for more details.
1. `st9`
1. `st10`
1. `🥬^5 + st11·🥬^4 + st12·🥬^3 + st13·🥬^2 + st14·🥬 + st15 - 🫑`
1. `osp`
1. `osv`
1. `op_stack_pointer - 16`
1. `ramp`
1. `RunningEvaluationStandardInput - 1`
1. `RunningEvaluationStandardOutput - 1`
1. `InstructionLookupClientLogDerivative · (🪥 - 🥝·ip - 🥥·ci - 🫐·nia) - 1`
1. `RunningProductOpStackTable - (🪤 - 🍋·clk - 🍊·ib1 - 🍉·osp - 🫒·osv)`
1. `RunningProductOpStackTable - 1`
1. `RunningProductRamTable - (🛋 - 🍍·clk - 🍈·ramp - 🍎·ramv - 🌽·previous_instruction)`
1. `RunningProductJumpStackTable - (🧴 - 🍇·clk - 🍅·ci - 🍌·jsp - 🍏·jso - 🍐·jsd)`
1. `(ci - opcode(hash))·(RunningEvaluationHashInput - 1)`<br />
@@ -189,7 +187,6 @@ The following additional constraints also apply to every pair of rows.
1. The running evaluation for standard input absorbs `st0` of the next row with respect to 🛏 if the current instruction is `read_io`, and remains unchanged otherwise.
1. The running evaluation for standard output absorbs `st0` of the next row with respect to 🧯 if the current instruction in the next row is `write_io`, and remains unchanged otherwise.
1. If the next row is not a padding row, the logarithmic derivative for the Program Table absorbs the next row with respect to challenges 🥝, 🥥, and 🫐 and indeterminate 🪥. Otherwise, it remains unchanged.
1. The running product for the Op Stack Table absorbs the next row with respect to challenges 🍋, 🍊, 🍉, and 🫒 and indeterminate 🪤.
1. The running product for the RAM Table absorbs the next row with respect to challenges 🍍, 🍈, 🍎, and 🌽 and indeterminate 🛋.
1. The running product for the Jump Stack Table absorbs the next row with respect to challenges 🍇, 🍅, 🍌, 🍏, and 🍐 and indeterminate 🧴.
1. If the current instruction in the next row is `hash`, the running evaluation “Hash Input” absorbs the next row with respect to challenges 🧄₀ through 🧄₉ and indeterminate 🚪. Otherwise, it remains unchanged.
@@ -218,7 +215,6 @@ Otherwise, the running evaluation remains unchanged.
`+ write_io_deselector'·(RunningEvaluationStandardOutput' - 🧯·RunningEvaluationStandardOutput - st0')`
1. `(1 - IsPadding') · ((InstructionLookupClientLogDerivative' - InstructionLookupClientLogDerivative) · (🛁 - 🥝·ip' - 🥥·ci' - 🫐·nia') - 1)`<br />
`+ IsPadding'·(RunningProductInstructionTable' - RunningProductInstructionTable)`
1. `RunningProductOpStackTable' - RunningProductOpStackTable·(🪤 - 🍋·clk' - 🍊·ib1' - 🍉·osp' - 🫒·osv')`
1. `RunningProductRamTable' - RunningProductRamTable·(🛋 - 🍍·clk' - 🍈·ramp' - 🍎·ramv' - 🌽·previous_instruction')`
1. `RunningProductJumpStackTable' - RunningProductJumpStackTable·(🧴 - 🍇·clk' - 🍅·ci' - 🍌·jsp' - 🍏·jso' - 🍐·jsd')`
1. `(ci' - opcode(hash))·(RunningEvaluationHashInput' - RunningEvaluationHashInput)`<br />
1 change: 0 additions & 1 deletion specification/src/registers.md
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ the remaining registers exist only to enable an efficient arithmetization and ar
| `jsd` | jump stack destination | contains the argument of the last `call` |
| `st0` through `st15` | operational stack registers | contain explicit operational stack values |
| *`op_stack_pointer` | operational stack pointer | the current size of the operational stack |
| *`osv` | operational stack value | contains the (stack) memory value at the given address |
| *`hv0` through `hv6` | helper variable registers | helper variables for some arithmetic operations |
| *`ramp` | RAM pointer | contains an address pointing into the RAM |
| *`ramv` | RAM value | contains the value of the RAM element at the address currently held in `ramp` |