ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACAD
1
Accumulator for Permutation Argument
2
3
A permutation argument is a method of showing that one vector is a permutation of another.
4
This sheet shows an example of a permutation argument, to demonstrate the technique behind memory consistency checks in RISC Zero.
5
6
Step 1: Prover commits to two sortings of the same data.
7
Time-Sorted Execution Trace
Address-Sorted Execution Trace
8
Clock CycleAddressValueRead=0; Write=1Clock CycleAddressValueRead=0; Write=1
9
0317103171
10
173123170
11
2317053170
12
37911731
13
47903791
14
531704790
15
16
To enable efficient memory checking, the witness for zkVM proofs include duplicate commitments for memory operations: memory operations are included both in a time-sorted fashion and in an address-sorted fashion.
17
To prove correctness, we must both:
18
(1) enforce correctness of the memory operations in the address-sorted trace
19
(2) enforce correctness of the sorting
20
The logic in the black-box labelled "Verifier Requirements" accomplishes (1). The permutation argument accomplishes (2).
21
For more on (1), see Jeremy's explanation at zk7.
22
23
Step 2: Generate randomness (from Verifier or Fiat-Shamir)
24
Random PLONK Mixing Parameters
25
abcd
26
14806043
27
28
Step 3: Use randomness to generate accumulators.
29
Accumulators for Time-Sorted Trace
30
Clock CycleAccumulated ValueAccumulation CalculationClock CycleAccumulated Value
Accumulation Calculation
31
013041+0a+3b+17c+1d013041+0a+3b+17c+1d
32
17981+1a+7b+3c+1d112891+2a+3b+17c+0d
33
212891+2a+3b+17c+0d213311+5a+3b+17c+0d
34
311861+3a+7b+9c+1d37981+1a+7b+3c+1d
35
411571+4a+7b+9c+0d411861+3a+7b+9c+1d
36
513311+5a+3b+17c+0d511571+4a+7b+9c+0d
37
Time-Sorted Accumulation2.44979E+18
Address-Sorted Accumulation
2.44979E+18
38
39
Key Idea
40
If the Address-Sorted Execution Trace is not a permutation of the rows of the Time-Sorted Execution Trace, the accumulators are highly unlikely to match.
41
42
Step 4: Use various constraints to check details.
43
Details include:
44
- Making sure accumulators match
45
- Making sure accumulators were constructed correctly
46
- Enforcing memory correctness on address-sorted trace, as described above
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100