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

Master Tables #144

Merged
merged 140 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from 128 commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
7053a67
introduce master table, get some basic features down (WIP)
jan-ferdinand Nov 25, 2022
a27003a
incorporate randomizer polynomial, FRI domain base master table (WIP)
jan-ferdinand Nov 26, 2022
0e9a6b7
derive ”Copy“ for `ArithmeticDomain`
jan-ferdinand Nov 26, 2022
759ba44
factor out filling in trace of program table
jan-ferdinand Nov 26, 2022
e721f47
extend program table, move padding logic to program table
jan-ferdinand Nov 26, 2022
521f574
make trace randomization more explicit
jan-ferdinand Nov 27, 2022
4b2a6dd
derive some derivable `const`s instead of hardcoding them
jan-ferdinand Nov 27, 2022
ec81c44
create trait `MasterTable`, factor out trace randomization & LDE
jan-ferdinand Nov 27, 2022
8457e90
derive master-table indices from table columns
jan-ferdinand Nov 28, 2022
0f1e953
remove a bunch of legacy code
jan-ferdinand Nov 28, 2022
f3ddbe1
change traits for getting degree bounds and quotients
jan-ferdinand Nov 30, 2022
6f223ec
introduce “master quotient table”: store quotients in an Array2
jan-ferdinand Dec 2, 2022
35086aa
start treating grand cross-table argument as a first-class quotient
jan-ferdinand Dec 2, 2022
e4d5df1
actually return the quotients – sorted by type, not table
jan-ferdinand Dec 2, 2022
ed49d57
use ndarray, not vectors, in cross-table arguments
jan-ferdinand Dec 3, 2022
bf3ed3e
remove some cloning and explicit type annotations
jan-ferdinand Dec 3, 2022
8536afa
fill trace of Instruction Table
jan-ferdinand Dec 3, 2022
7b06aaa
fill trace of Op Stack Table
jan-ferdinand Dec 5, 2022
97d1438
fill trace of Jump Stack Table
jan-ferdinand Dec 5, 2022
ac5e01f
fill trace of Ram Table
jan-ferdinand Dec 5, 2022
abae0c3
fill trace of Processor Table
jan-ferdinand Dec 5, 2022
10808c9
fill trace of Hash Table
jan-ferdinand Dec 5, 2022
f9fedc6
remove `BaseMatrices`, `BaseTableCollection`, and `ExtTableCollection`
jan-ferdinand Dec 5, 2022
d20ab7b
move randomizer polynomials from master base to master extension table
jan-ferdinand Dec 5, 2022
499bd36
remove superfluous trait indirection
jan-ferdinand Dec 5, 2022
c544aee
refactor transition constraint test to actually use master tables
jan-ferdinand Dec 5, 2022
48d9d75
remove obsolete `extend` method in Program Table
jan-ferdinand Dec 5, 2022
4f72a6a
remove obsolete dummy constructors `for_verifier`
jan-ferdinand Dec 5, 2022
90f6d01
remove obsolete `impl Default for Ext*Table`
jan-ferdinand Dec 5, 2022
bc29366
pad Instruction Table in-place
jan-ferdinand Dec 6, 2022
0810cd0
pad Processor Table in-place
jan-ferdinand Dec 6, 2022
528698e
fix bug in verifier: randomizer codeword it at end of ext master table
jan-ferdinand Dec 6, 2022
1962dd2
make constraint circuits work with master table
jan-ferdinand Dec 6, 2022
b6fce7a
remove somewhat confusing in-place modification, turn into return value
jan-ferdinand Dec 6, 2022
aee6ded
generate constraints that use the master tables
jan-ferdinand Dec 7, 2022
4bb2e46
test consistency of `InputIndicator`'s `from()` and `into()`
jan-ferdinand Dec 7, 2022
59e0890
remove superfluous thin wrapper around usize
jan-ferdinand Dec 7, 2022
ec9d6a0
use master table index throughout
jan-ferdinand Dec 7, 2022
ca18c06
remove confusing conversion from `usize` to `InputIndicators`
jan-ferdinand Dec 7, 2022
54694d0
remove multivariate polynomials from multicircuits
jan-ferdinand Dec 7, 2022
6963eec
pad Op Stack Table in-place
jan-ferdinand Dec 8, 2022
6baf3d0
pad Jump Stack Table in-place
jan-ferdinand Dec 8, 2022
72247e4
pad Ram Table in-place
jan-ferdinand Dec 8, 2022
815b9db
“pad” Hash Table in-place
jan-ferdinand Dec 8, 2022
882461e
remove traits `Table`, `TableLike`, `InheritsFromTable`, `Extendable`
jan-ferdinand Dec 8, 2022
b390a4e
move declaration of AET to vm.rs, printing methods next to their tables
jan-ferdinand Dec 8, 2022
944fb8c
fix some out-of-bounds indexing during padding of memory-like tables
jan-ferdinand Dec 8, 2022
92cc7c0
use correct columns for Ram Table's Bézout coefficients
jan-ferdinand Dec 9, 2022
5c5e30f
derive table column index at compile time
jan-ferdinand Dec 9, 2022
10bb807
use trace table, not randomized trace table, for certain tests
jan-ferdinand Dec 9, 2022
f7f200e
check for correct number of extension columns instead of full width
jan-ferdinand Dec 9, 2022
b0df99b
use some line breaks in the crate's description
jan-ferdinand Dec 9, 2022
ddca5d2
auto-generate number of quotients for less ugly & faster derivation
jan-ferdinand Dec 9, 2022
3054a42
use correct indices for filling master quotient table
jan-ferdinand Dec 9, 2022
ae77f82
don't add randomizer polynomials to _weighted_ nonlinear combination
jan-ferdinand Dec 10, 2022
6448f66
remove multivariate polynomials from multicircuits harder
jan-ferdinand Dec 10, 2022
ecbe038
extend Instruction Table
jan-ferdinand Dec 10, 2022
5bf9375
de-duplicate some logic when extending Instruction Table
jan-ferdinand Dec 10, 2022
a72921a
extend Processor Table
jan-ferdinand Dec 10, 2022
8fbe1c9
use correct number of rows for master extension table
jan-ferdinand Dec 10, 2022
8a85e74
use master tables, not Processor Table, in test
jan-ferdinand Dec 10, 2022
f757301
actually pad the Processor Table according to specification
jan-ferdinand Dec 12, 2022
3fcf9b2
extend Op Stack Table
jan-ferdinand Dec 12, 2022
7775cf8
extend Ram Table
jan-ferdinand Dec 12, 2022
7da1b79
only bring extension row into scope just before it's needed
jan-ferdinand Dec 12, 2022
bc03e76
extend Jump Stack Table
jan-ferdinand Dec 12, 2022
ffd8351
extend Hash Table
jan-ferdinand Dec 12, 2022
f8d03ed
use trace table, not randomized trace table, in tests
jan-ferdinand Dec 12, 2022
66cd89c
add “test” to print & quickly match master table indices to columns
jan-ferdinand Dec 12, 2022
5cdba8f
better code formatting and less confusing indices in error messages
jan-ferdinand Dec 12, 2022
6caf820
de-duplicate some test code
jan-ferdinand Dec 12, 2022
896b273
remove obsolete row derivation methods
jan-ferdinand Dec 12, 2022
7d732cf
use the correct columns for Bézout coefficient polynomial's coefficients
jan-ferdinand Dec 12, 2022
33f4c39
add more extensive tests of all constraints
jan-ferdinand Dec 12, 2022
95e6728
remove unenforceable constraints
jan-ferdinand Dec 12, 2022
6ff9bf0
better readability of Ram Table transition constraints, fix bug therein
jan-ferdinand Dec 12, 2022
2b776d1
use quotient domain, not FRI domain, for debug degree checking
jan-ferdinand Dec 12, 2022
59ac718
rename `.master_table_index()` to clarify between base & extension table
jan-ferdinand Dec 12, 2022
8f962dd
use consistent naming for `master_base_table`
jan-ferdinand Dec 12, 2022
b8965cd
properly implement parallelized low-degree extension
jan-ferdinand Dec 12, 2022
1b6a935
replace difficult-to-read `par_azip!()` with `Zip::from().and()`
jan-ferdinand Dec 12, 2022
2709af8
add property test performing random RAM read & write access
jan-ferdinand Dec 13, 2022
097ebb4
improve error message for IP out of bounds
jan-ferdinand Dec 13, 2022
a92b9b8
fix some buggy Ram Table constraints and add back some removed ones
jan-ferdinand Dec 13, 2022
69e8bcb
add column `PreviousInstruction` to Processor and Ram Table
jan-ferdinand Dec 13, 2022
256585a
remove redundant tests
jan-ferdinand Dec 13, 2022
cf437a8
fix a bug in recording clock jump differences for the Processor Table
jan-ferdinand Dec 14, 2022
e6262c9
correctly accumulate Ram Table row in running product
jan-ferdinand Dec 14, 2022
95b5427
correctly absorb entire Ram Table row in relevant initial constraint
jan-ferdinand Dec 14, 2022
f1927f7
use “previous instruction next” not “current”
jan-ferdinand Dec 14, 2022
eda591e
improve debug output for failing transition constraints in test
jan-ferdinand Dec 15, 2022
e9631e3
improve property RAM access test to include reading uninitialized memory
jan-ferdinand Dec 15, 2022
8b28689
add clarifying comment regarding the setting of “previous instruction”
jan-ferdinand Dec 15, 2022
0888203
update the stack with the fetched RAM value when executing “read_mem”
jan-ferdinand Dec 15, 2022
f14b658
when debugging, use FRI domain to compute quotients and degree checking
jan-ferdinand Dec 15, 2022
41dcd78
also test all constraints for the simplest possible program: “halt”
jan-ferdinand Dec 15, 2022
a3e6481
parallelize filling of quotient table
jan-ferdinand Dec 15, 2022
7e9ad82
test correctness of zerofiers and make their method's interface cleaner
jan-ferdinand Dec 15, 2022
0ddecc5
remove placeholder “padded_height = 0” from Claim – only claim truth
jan-ferdinand Dec 15, 2022
e3e5243
improve readability of prover, add assert for `AllChallenge`s weights
jan-ferdinand Dec 15, 2022
74712b7
remove unused traits `ExtensionTable` and `QuotientableExtensionTable`
jan-ferdinand Dec 16, 2022
18b0257
implement `Evaluable` and `Quotientable` for `GrandCrossTableArgument`
jan-ferdinand Dec 16, 2022
f4a4a91
make `GrandCrossTableArg` a master-table first-class citizen
jan-ferdinand Dec 16, 2022
c34ca73
remove now-dead code in `GrandCrossTableArg`, `PermArg`, and `EvalArg`
jan-ferdinand Dec 16, 2022
66be909
move `cross_table_argument.rs` into folder `table`
jan-ferdinand Dec 16, 2022
ca627ce
use correct initial and terminal zerofiers in verifier
jan-ferdinand Dec 16, 2022
6554202
update spec: transition constraints for instruction `divine_sibling`
jan-ferdinand Dec 16, 2022
e6d158e
rename `.table_index()` to distinguish between base and extension tables
jan-ferdinand Dec 16, 2022
6351324
memoize, don't recompute `interpolation_degree`
jan-ferdinand Dec 16, 2022
5cece86
simplify and parallelize padding of Instruction Table
jan-ferdinand Dec 16, 2022
99ad5de
remove now-superfluous clippy exception
jan-ferdinand Dec 16, 2022
a33e3e6
update spec: Ram Table does not have to be sorted by `ramp`
jan-ferdinand Dec 16, 2022
f79f1d0
add missing initial constraint to Ram Table
jan-ferdinand Dec 16, 2022
024e486
add “test” to print an example interaction between Processor & Ram Table
jan-ferdinand Dec 16, 2022
9673977
update spec: new column “previous instruction” and its constraints
jan-ferdinand Dec 16, 2022
b9a382c
AET uses ndarrays
jan-ferdinand Dec 16, 2022
292a708
cleaner code flow for enriching a hash trace with constants for the AET
jan-ferdinand Dec 16, 2022
889242a
remove generator as argument to ArithmeticDomain, compute it instead
jan-ferdinand Dec 16, 2022
5b66247
make clippy 1.66 happy
jan-ferdinand Dec 16, 2022
efab08b
rename `table_collection.rs` to `master_table.rs`
jan-ferdinand Dec 16, 2022
385acd3
update comment regarding cross-table terminal quotient being filled in
jan-ferdinand Dec 16, 2022
fb940b1
read claimed padded height from correct position of the proof
jan-ferdinand Dec 16, 2022
5e19845
more aptly name some proof-stream methods, remove unneeded ones
jan-ferdinand Dec 16, 2022
ea225a0
less degree shifting, remove superfluous degree bound computations
jan-ferdinand Dec 16, 2022
abd307d
remove in-line todo currently being discussed in the issue tracker
jan-ferdinand Dec 16, 2022
c705b88
add clarity to number of non-linear codeword checks
jan-ferdinand Dec 16, 2022
83f76b7
docstring for an indexing method that might look weird but is kinda nice
jan-ferdinand Dec 16, 2022
ef4e70f
add documentation for master tables
jan-ferdinand Dec 17, 2022
73254e7
add or rephrase some miscellaneous comments
jan-ferdinand Dec 19, 2022
1dc7d4d
don't enforce underlying memory layout, use generic and safer methods
jan-ferdinand Dec 19, 2022
06bc2fd
add profilers to tests that prove correctness of a program
jan-ferdinand Dec 19, 2022
7808dfa
list number of constraints also for cross-table argument, profile malloc
jan-ferdinand Dec 19, 2022
5b309f6
store, don't recompute degree bounds in the verifier
jan-ferdinand Dec 19, 2022
87476bb
use ndarray's multiplication instead of trying to be smart
jan-ferdinand Dec 19, 2022
8033a12
memoize shifted FRI domain values in the verifier
jan-ferdinand Dec 19, 2022
a5602c5
describe verifier steps more accurately
jan-ferdinand Dec 19, 2022
5f8c4a3
over-engineer the crap out of degree-shifting FRI domain values
jan-ferdinand Dec 19, 2022
fd70732
update cheatsheet
jan-ferdinand Dec 20, 2022
fc96a47
cheatsheet: move tables to one page, create room for stack effects
jan-ferdinand Dec 20, 2022
78d2a78
cheatsheet: describe instructions' effects on stack
jan-ferdinand Dec 20, 2022
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
237 changes: 125 additions & 112 deletions constraint-evaluation-generator/src/main.rs

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions specification/src/instruction-specific-transition-constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,6 @@ Additionally, it defines the following transition constraints.
1. If `hv0` is 1, then `st2` is copied to `st7`.
1. If `hv0` is 1, then `st3` is copied to `st8`.
1. If `hv0` is 1, then `st4` is copied to `st9`.
1. The stack element in `st11` does not change.
1. The stack element in `st12` does not change.
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 OpStack underflow, i.e., `osv`, does not change.
1. The OpStack pointer does not change.
1. If `hv0` is 0, then the RAM value `ramv` does not change.

### Polynomials

Expand All @@ -408,14 +400,6 @@ Additionally, it defines the following transition constraints.
1. `(1 - hv0)·(st2' - st2) + hv0·(st7' - st2)`
1. `(1 - hv0)·(st3' - st3) + hv0·(st8' - st3)`
1. `(1 - hv0)·(st4' - st4) + hv0·(st9' - st4)`
1. `st11' - st11`
1. `st12' - st12`
1. `st13' - st13`
1. `st14' - st14`
1. `st15' - st15`
1. `osv' - osv`
1. `osp' - osp`
1. `(1 - hv0)·(ramv' - ramv)`

### Helper variable definitions for `divine_sibling`

Expand Down
12 changes: 8 additions & 4 deletions specification/src/processor-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ However, in order to verify the correctness of `RunningEvaluationFromHashTable`,
## Initial Constraints

1. The cycle counter `clk` is 0.
1. The previous instruction `previous_instruction` is 0.
1. The instruction pointer `ip` is 0.
1. The jump address stack pointer `jsp` is 0.
1. The jump address origin `jso` is 0.
Expand Down Expand Up @@ -93,7 +94,7 @@ However, in order to verify the correctness of `RunningEvaluationFromHashTable`,
1. `RunningEvaluationStandardOutput` is 1.
1. `RunningProductInstructionTable` 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. `RunningProductRamTable` has absorbed the first row with respect to challenges 🍍, 🍈, and 🍎 and indeterminate 🛋.
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. `RunningEvaluationToHashTable` has absorbed the first row with respect to challenges 🧄0 through 🧄9 and indeterminate 🪣 if the current instruction is `hash`. Otherwise, it is 1.
1. `RunningEvaluationFromHashTable` is 1.
Expand All @@ -106,6 +107,7 @@ However, in order to verify the correctness of `RunningEvaluationFromHashTable`,
### Initial Constraints as Polynomials

1. `clk`
1. `previous_instruction`
1. `ip`
1. `jsp`
1. `jso`
Expand Down Expand Up @@ -134,7 +136,7 @@ However, in order to verify the correctness of `RunningEvaluationFromHashTable`,
1. `RunningEvaluationStandardOutput - 1`
1. `RunningProductInstructionTable - (🛁 - 🍓·ip - 🍒·ci - 🥭·nia)`
1. `RunningProductOpStackTable - (🪤 - 🍋·clk - 🍊·ib1 - 🍉·osp - 🫒·osv)`
1. `RunningProductRamTable - (🛋 - 🍍·clk - 🍈·ramp - 🍎·ramv)`
1. `RunningProductRamTable - (🛋 - 🍍·clk - 🍈·ramp - 🍎·ramv - 🌽·previous_instruction)`
1. `RunningProductJumpStackTable - (🧴 - 🍇·clk - 🍅·ci - 🍌·jsp - 🍏·jso - 🍐·jsd)`
1. `(ci - opcode(hash))·(RunningEvaluationToHashTable - 1) + hash_deselector·(RunningEvaluationToHashTable - 🪣 - 🧄0·st0 - 🧄1·st1 - 🧄2·st2 - 🧄3·st3 - 🧄4·st4 - 🧄5·st5 - 🧄6·st6 - 🧄7·st7 - 🧄8·st8 - 🧄9·st9)`
1. `RunningEvaluationFromHashTable - 1`
Expand Down Expand Up @@ -163,11 +165,12 @@ The following constraints apply to every pair of rows.

1. The cycle counter `clk` increases by 1.
1. The padding indicator `IsPadding` is 0 or remains unchanged.
1. The current instruction `ci` in the current row is copied into `previous_instruction` in the next row or the next row is a padding row.
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 running product for the Instruction Table absorbs the next row with respect to challenges 🍓, 🍒, and 🥭 and indeterminate 🛁. Otherwise, it remains unchanged.
1. The running product for the OpStack 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 RAM Table absorbs the next row with respect to challenges 🍍, 🍈, 🍎, and 🌽 and indeterminate 🛋.
1. The running product for the JumpStack 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 “to Hash Table” absorbs the next row with respect to challenges 🧄0 through 🧄9 and indeterminate 🪣. Otherwise, it remains unchanged.
1. If the current instruction is `hash`, the running evaluation “from Hash Table” absorbs the next row with respect to challenges 🫑0 through 🫑4 and indeterminate 🪟. Otherwise, it remains unchanged.
Expand All @@ -181,11 +184,12 @@ The following constraints apply to every pair of rows.

1. `clk' - (clk + 1)`
1. `IsPadding·(IsPadding' - IsPadding)`
1. `(1 - IsPadding')·(previous_instruction' - ci)`
1. `(ci - opcode(read_io))·(RunningEvaluationStandardInput' - RunningEvaluationStandardInput) + read_io_deselector·(RunningEvaluationStandardInput' - 🛏·RunningEvaluationStandardInput - st0')`
1. `(ci' - opcode(write_io))·(RunningEvaluationStandardOutput' - RunningEvaluationStandardOutput) + write_io_deselector'·(RunningEvaluationStandardOutput' - 🧯·RunningEvaluationStandardOutput - st0')`
1. `(1 - IsPadding')·(RunningProductInstructionTable' - RunningProductInstructionTable(🛁 - 🍓·ip' - 🍒·ci' - 🥭·nia')) + IsPadding'·(RunningProductInstructionTable' - RunningProductInstructionTable)`
1. `RunningProductOpStackTable' - RunningProductOpStackTable·(🪤 - 🍋·clk' - 🍊·ib1' - 🍉·osp' - 🫒·osv')`
1. `RunningProductRamTable' - RunningProductRamTable·(🛋 - 🍍·clk' - 🍈·ramp' - 🍎·ramv')`
1. `RunningProductRamTable' - RunningProductRamTable·(🛋 - 🍍·clk' - 🍈·ramp' - 🍎·ramv' - 🌽·previous_instruction')`
1. `RunningProductJumpStackTable' - RunningProductJumpStackTable·(🧴 - 🍇·clk' - 🍅·ci' - 🍌·jsp' - 🍏·jso' - 🍐·jsd')`
1. `(ci' - opcode(hash))·(RunningEvaluationToHashTable' - RunningEvaluationToHashTable) + hash_deselector'·(RunningEvaluationToHashTable' - 🪣·RunningEvaluationToHashTable - 🧄0·st0' - 🧄1·st1' - 🧄2·st2' - 🧄3·st3' - 🧄4·st4' - 🧄5·st5' - 🧄6·st6' - 🧄7·st7' - 🧄8·st8' - 🧄9·st9')`
1. `(ci - opcode(hash))·(RunningEvaluationFromHashTable' - RunningEvaluationFromHashTable) + hash_deselector·(RunningEvaluationFromHashTable' - 🪟·RunningEvaluationFromHashTable - 🫑0·st5' - 🫑1·st6' - 🫑2·st7' - 🫑3·st8' - 🫑4·st9')`
Expand Down
Loading