Skip to content

Commit c2894c8

Browse files
last bunch
1 parent 66cb090 commit c2894c8

File tree

8 files changed

+27
-25
lines changed

8 files changed

+27
-25
lines changed

docs/miden/vm/design/decoder/constraints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AIR constraints for the decoder involve operations listed in the table below. Fo
2323
| `HALT` | $f_{halt}$ | 4 | Stack remains unchanged. |
2424
| `PUSH` | $f_{push}$ | 4 | An immediate value is pushed onto the stack. |
2525

26-
We also use the [control flow flag](../stack/op_constraints.md#control-flow-flag) $f_{ctrl}$ exposed by the VM, which is set when any one of the above control flow operations is being executed. It has degree $5$.
26+
We also use the [control flow flag](../stack/op-constraints.md#control-flow-flag) $f_{ctrl}$ exposed by the VM, which is set when any one of the above control flow operations is being executed. It has degree $5$.
2727

2828
As described [previously](index.md#program-decoding), the general idea of the decoder is that the prover provides the program to the VM by populating some of cells in the trace non-deterministically. Values in these are then used to update virtual tables (represented via multiset checks) such as block hash table, block stack table etc. Transition constraints are used to enforce that the tables are updates correctly, and we also apply boundary constraints to enforce the correct initial and final states of these tables. One of these boundary constraints binds the execution trace to the hash of the program being executed. Thus, if the virtual tables were updated correctly and boundary constraints hold, we can be convinced that the prover executed the claimed program on the VM.
2929

docs/miden/vm/design/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The system component does not yet have a dedicated documentation section, since
4646
* `clk` which is used to keep track of the current VM cycle. Values in this column start out at $0$ and are incremented by $1$ with each cycle.
4747
* `fmp` which contains the value of the free memory pointer used for specifying the region of memory available to procedure locals.
4848

49-
AIR constraints for the `fmp` column are described in [system operations](./stack/system_ops.md) section. For the `clk` column, the constraints are straightforward:
49+
AIR constraints for the `fmp` column are described in [system operations](./stack/system-ops.md) section. For the `clk` column, the constraints are straightforward:
5050

5151
$$
5252
clk' - (clk + 1) = 0 \text{ | degree} = 1

docs/miden/vm/design/lookups/logup.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# LogUp: multivariate lookups with logarithmic derivatives
1+
## Multivariate lookups with logarithmic derivatives
22

33
The description of LogUp can be found [here](https://eprint.iacr.org/2022/1530.pdf). In MidenVM, LogUp is used to implement efficient [communication buses](./index.md#communication-buses-in-miden-vm).
44

@@ -9,6 +9,7 @@ $$
99
$$
1010

1111
In the above:
12+
1213
- $l$ is the number of values in $a$, which must be smaller than the size of the field. (The prime field used for Miden VM has modulus $p = 2^{64} - 2^{32} + 1$, so $l < p$ must be true.)
1314
- $n$ is the number of values in $b$, which must be smaller than the size of the field. ($n < p$, for Miden VM)
1415
- $m_i$ is the multiplicity of $b_i$, which is expected to match the number of times the value $b_i$ is duplicated in column $a$. It must be smaller than the size of the set of lookup values. ($m_i < n$)
@@ -20,9 +21,9 @@ Thus, instead of needing to compute running products, we are able to assert corr
2021

2122
The generalized trace columns and constraints for this construction are as follows, where component $X$ is some component in the trace and lookup table $T$ contains the values $v$ which need to be looked up from $X$ and how many times they are looked up (the multiplicity $m$).
2223

23-
![logup_component_x](../../../img/miden/vm/design/lookups/logup_component.png)
24+
![logup_component_x](../../../../img/miden/vm/design/lookups/logup_component.png)
2425

25-
![logup_table_t](../../../img/miden/vm/design/lookups/logup_table.png)
26+
![logup_table_t](../../../../img/miden/vm/design/lookups/logup_table.png)
2627

2728
### Constraints
2829

docs/miden/vm/design/range.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Thus, it is very important for the VM to be able to perform a large number of 16
66

77
First, let's define a construction for the simplest possible 8-bit range-check. This can be done with a single column as illustrated below.
88

9-
![rc_8_bit_range_check](../../../../img/miden/vm/design/range/rc_8_bit_range_check.png)
9+
![rc_8_bit_range_check](../../../img/miden/vm/design/range/rc_8_bit_range_check.png)
1010

1111
For this to work as a range-check we need to enforce a few constraints on this column:
1212

@@ -47,7 +47,7 @@ We can get rid of both requirements by including the _multiplicity_ of the value
4747

4848
Let's add one more column $m$ to our table to keep track of how many times each value should be range-checked.
4949

50-
![rc_8_bit_logup](../../../../img/miden/vm/design/range/rc_8_bit_logup.png)
50+
![rc_8_bit_logup](../../../img/miden/vm/design/range/rc_8_bit_logup.png)
5151

5252
The transition constraint for $b$ is now as follows:
5353

@@ -66,7 +66,7 @@ Additionally, the constraint degree has not increased versus the naive approach,
6666

6767
To support 16-bit range checks, let's try to extend the idea of the 8-bit table. Our 16-bit table would look like so (the only difference is that column $v$ now has to end with value $65535$):
6868

69-
![rc_16_bit_logup](../../../../img/miden/vm/design/range/rc_16_bit_logup.png)
69+
![rc_16_bit_logup](../../../img/miden/vm/design/range/rc_16_bit_logup.png)
7070

7171
While this works, it is rather wasteful. In the worst case, we'd need to enumerate over 65K values, most of which we may not actually need. It would be nice if we could "skip over" the values that we don't want. One way to do this could be to add bridge rows between two values to be range checked and add constraints to enforce the consistency of the gap between these bridge rows.
7272

@@ -139,12 +139,12 @@ In addition to the transition constraints described above, we also need to enfor
139139

140140
### Communication bus
141141

142-
$b_{range}$ is the [bus](./lookups/index.md#communication-buses-in-miden-vm) that connects components which require 16-bit range checks to the values in the range checker. The bus constraints are defined by the components that use it to communicate.
142+
$b_{range}$ is the [bus](lookups/index.md#communication-buses-in-miden-vm) that connects components which require 16-bit range checks to the values in the range checker. The bus constraints are defined by the components that use it to communicate.
143143

144144
Requests are sent to the range checker bus by the following components:
145145

146-
- The Stack sends requests for 16-bit range checks during some [`u32` operations](./stack/u32-ops.md#range-checks).
147-
- The [Memory chiplet](./chiplets/memory.md) sends requests for 16-bit range checks against the values in the $d_0$ and $d_1$ trace columns to enforce internal consistency.
146+
- The Stack sends requests for 16-bit range checks during some [`u32` operations](stack/u32-ops.md#range-checks).
147+
- The [Memory chiplet](chiplets/memory.md) sends requests for 16-bit range checks against the values in the $d_0$ and $d_1$ trace columns to enforce internal consistency.
148148

149149
Responses are provided by the range checker using the transition constraint for the LogUp construction described above.
150150

docs/miden/vm/design/stack/field-ops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In this section we describe the AIR constraints for Miden VM field operations (i
44

55
Assume $a$ and $b$ are the elements at the top of the stack. The `ADD` operation computes $c \leftarrow (a + b)$. The diagram below illustrates this graphically.
66

7-
![add](../../../../../img/miden/vm/design/stack/field-operations/ADD.png)
7+
![add](../../../../img/miden/vm/design/stack/field-operations/ADD.png)
88

99
Stack transition for this operation must satisfy the following constraints:
1010

docs/miden/vm/design/stack/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ To simplify constraint descriptions, we'll assume that the VM exposes two binary
129129
| $f_{shr}$ | 6 | When this flag is set to $1$, the instruction executing on the VM is performing a "right shift". |
130130
| $f_{shl}$ | 5 | When this flag is set to $1$, the instruction executing on the VM is performing a "left shift". |
131131

132-
These flags are mutually exclusive. That is, if $f_{shl}=1$, then $f_{shr}=0$ and vice versa. However, both flags can be set to $0$ simultaneously. This happens when the executed instruction does not shift the stack. How these flags are computed is described [here](./op_constraints.md).
132+
These flags are mutually exclusive. That is, if $f_{shl}=1$, then $f_{shr}=0$ and vice versa. However, both flags can be set to $0$ simultaneously. This happens when the executed instruction does not shift the stack. How these flags are computed is described [here](./op-constraints.md).
133133

134134
### Stack overflow flag
135135

docs/miden/vm/design/stack/op-constraints.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ This group contains $32$ operations which do not shift the stack (this is almost
6969
| Operation | Opcode value | Binary encoding | Operation group | Flag degree |
7070
| ------------ | :----------: | :-------------: | :---------------------------: | :---------: |
7171
| `NOOP` | $0$ | `000_0000` | [System ops](system-ops.md) | $7$ |
72-
| `EQZ ` | $1$ | `000_0001` | [Field ops](field_ops.md) | $7$ |
73-
| `NEG` | $2$ | `000_0010` | [Field ops](field_ops.md) | $7$ |
74-
| `INV` | $3$ | `000_0011` | [Field ops](field_ops.md) | $7$ |
75-
| `INCR` | $4$ | `000_0100` | [Field ops](field_ops.md) | $7$ |
76-
| `NOT` | $5$ | `000_0101` | [Field ops](field_ops.md) | $7$ |
72+
| `EQZ ` | $1$ | `000_0001` | [Field ops](field-ops.md) | $7$ |
73+
| `NEG` | $2$ | `000_0010` | [Field ops](field-ops.md) | $7$ |
74+
| `INV` | $3$ | `000_0011` | [Field ops](field-ops.md) | $7$ |
75+
| `INCR` | $4$ | `000_0100` | [Field ops](field-ops.md) | $7$ |
76+
| `NOT` | $5$ | `000_0101` | [Field ops](field-ops.md) | $7$ |
7777
| `FMPADD` | $6$ | `000_0110` | [System ops](system-ops.md) | $7$ |
7878
| `MLOAD` | $7$ | `000_0111` | [I/O ops](io-ops.md) | $7$ |
7979
| `SWAP` | $8$ | `000_1000` | [Stack ops](stack-ops.md) | $7$ |
@@ -83,7 +83,7 @@ This group contains $32$ operations which do not shift the stack (this is almost
8383
| `MOVUP3` | $12$ | `000_1100` | [Stack ops](stack-ops.md) | $7$ |
8484
| `MOVDN3` | $13$ | `000_1101` | [Stack ops](stack-ops.md) | $7$ |
8585
| `ADVPOPW` | $14$ | `000_1110` | [I/O ops](io-ops.md) | $7$ |
86-
| `EXPACC` | $15$ | `000_1111` | [Field ops](field_ops.md) | $7$ |
86+
| `EXPACC` | $15$ | `000_1111` | [Field ops](field-ops.md) | $7$ |
8787
| `MOVUP4` | $16$ | `001_0000` | [Stack ops](stack-ops.md) | $7$ |
8888
| `MOVDN4` | $17$ | `001_0001` | [Stack ops](stack-ops.md) | $7$ |
8989
| `MOVUP5` | $18$ | `001_0010` | [Stack ops](stack-ops.md) | $7$ |
@@ -93,7 +93,7 @@ This group contains $32$ operations which do not shift the stack (this is almost
9393
| `MOVUP7` | $22$ | `001_0110` | [Stack ops](stack-ops.md) | $7$ |
9494
| `MOVDN7` | $23$ | `001_0111` | [Stack ops](stack-ops.md) | $7$ |
9595
| `SWAPW` | $24$ | `001_1000` | [Stack ops](stack-ops.md) | $7$ |
96-
| `EXT2MUL` | $25$ | `001_1001` | [Field ops](field_ops.md) | $7$ |
96+
| `EXT2MUL` | $25$ | `001_1001` | [Field ops](field-ops.md) | $7$ |
9797
| `MOVUP8` | $26$ | `001_1010` | [Stack ops](stack-ops.md) | $7$ |
9898
| `MOVDN8` | $27$ | `001_1011` | [Stack ops](stack-ops.md) | $7$ |
9999
| `SWAPW2` | $28$ | `001_1100` | [Stack ops](stack-ops.md) | $7$ |
@@ -108,11 +108,11 @@ This group contains $16$ operations which shift the stack to the left (i.e., rem
108108
| Operation | Opcode value | Binary encoding | Operation group | Flag degree |
109109
| ------------ | :----------: | :-------------: | :---------------------------: | :---------: |
110110
| `ASSERT` | $32$ | `010_0000` | [System ops](system-ops.md) | $7$ |
111-
| `EQ` | $33$ | `010_0001` | [Field ops](field_ops.md) | $7$ |
112-
| `ADD` | $34$ | `010_0010` | [Field ops](field_ops.md) | $7$ |
113-
| `MUL` | $35$ | `010_0011` | [Field ops](field_ops.md) | $7$ |
114-
| `AND` | $36$ | `010_0100` | [Field ops](field_ops.md) | $7$ |
115-
| `OR` | $37$ | `010_0101` | [Field ops](field_ops.md) | $7$ |
111+
| `EQ` | $33$ | `010_0001` | [Field ops](field-ops.md) | $7$ |
112+
| `ADD` | $34$ | `010_0010` | [Field ops](field-ops.md) | $7$ |
113+
| `MUL` | $35$ | `010_0011` | [Field ops](field-ops.md) | $7$ |
114+
| `AND` | $36$ | `010_0100` | [Field ops](field-ops.md) | $7$ |
115+
| `OR` | $37$ | `010_0101` | [Field ops](field-ops.md) | $7$ |
116116
| `U32AND` | $38$ | `010_0110` | [u32 ops](u32-ops.md) | $7$ |
117117
| `U32XOR` | $39$ | `010_0111` | [u32 ops](u32-ops.md) | $7$ |
118118
| `FRIE2F4` | $40$ | `010_1000` | [Crypto ops](crypto-ops.md) | $7$ |

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ nav:
419419
- Lookups:
420420
- miden/vm/design/lookups/index.md
421421
- Multiset checks: miden/vm/design/lookups/multiset.md
422+
- LogUp: miden/vm/design/lookups/logup.md
422423
- Background material: miden/vm/background.md
423424
- Developer tools:
424425
- Developer tools: tools/index.md

0 commit comments

Comments
 (0)