spec: Field VM - #971
spec: Field VM#971RobinJadoul wants to merge 22 commits into
Conversation
Kimi Code ReviewAutomated review by Kimi (Moonshot AI) |
Codex Code ReviewFound five issues in the changed specification/tooling:
|
|
Getting the typechecker to be happy with ExtField elements is one of the next steps ;) |
erik-3milabs
left a comment
There was a problem hiding this comment.
Summary:
- instruction and constraints are similar, but not the same. Sketching the right mental model is informative.
- an instruction spans multiple states, which is a new concept in this spec. The reader is not helped to understand this. Sketching the right mental model is informative.
- the concepts of input hinting, output hinting and register hinting and their relation is unclear.
- have another look at the lower and upper bounds of sum. There seem to be some issues with that.
- minor notes/rephrase proposals
Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com> Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>
| [[variables.input]] | ||
| name = "hint_input" | ||
| type = ["Bit", 5] # PARAM: ["Bit", N] | ||
| desc = "Whether each input register is hinted this cycle" |
There was a problem hiding this comment.
| desc = "Whether each input register is hinted this cycle" | |
| desc = "Whether each general purpose register is input hinted this cycle" |
?
There was a problem hiding this comment.
consider adding
#show math.equation.where(block: false): boxas I find equations line breaking, which is rather annoying imo.
| The `ZERO` register indicates whether the previous instruction had a zero result, | ||
| i.e. $next("ZERO") <=> #`d` = 0$. | ||
| The `PC` register stores the program counter: the address of the current instruction, | ||
| and --- except when branches are taken, through register hinting --- is incremented by one |
There was a problem hiding this comment.
| and --- except when branches are taken, through register hinting --- is incremented by one | |
| and --- except when branches are taken, through register hinting --- is incremented by $1$ |
?
| == Register hinting | ||
|
|
||
| Each general-purpose register in the current state can be marked as _hinted_ by the acting instruction. | ||
| This means that from the current state onwards, the register can take a value |
There was a problem hiding this comment.
why are you choosing "onwards" here? It suggests that if for one instruction you set a register to hintable, and it remains that way for the rest of the execution trace. Perhaps worth clarifying that this is a way for the transition constraint not to hold for that particular instruction.
|
|
||
| In contrast, input hinting does not look like any traditional model of execution, | ||
| instead allowing to update one or more values in the state, as long as the resulting state still satisfies | ||
| the FMA constraint. |
There was a problem hiding this comment.
| the FMA constraint. | |
| the `FMA` constraint. |
| and used through the `MUX` constant columns. | ||
| In this way, $f_(i, 0)$ can have degree at most $d - 2$, as it gets multiplied with $#`imm`_0$ and the register value, | ||
| and the other $f_(i, k)$ can have degree at most $d - 3$, as they also get multiplied with the appropriate power of $x$. | ||
| This leads to a total degree of $op("deg") f_(i) = d - 1 + t dot (d - 2) - 1$ for a maximal number of registers $N + 2 <= op("deg") f_(i) + 1$. |
There was a problem hiding this comment.
is there a reason you're not simplifying this to (t+1)(d-2)?
| For `argument_registers` however, which should be in the range $[0, N + 1]$, | ||
| which upon first attempt cannot be checked with a constraint of degree $<= d$. |
There was a problem hiding this comment.
this double "which" is confusing
| the decoding table to reduce its number of columns. | ||
| Doing so would require the elements being combined into one column to be range checked on this side | ||
| of the interaction, ideally without needing any extra interactions or committed columns. | ||
| For `Bit` variables, this is no problem with the `IS_BIT` template from @isbit. |
There was a problem hiding this comment.
Does 1 not have different square roots in the extension field other than itself?
| the decoding table to reduce its number of columns. | ||
| Doing so would require the elements being combined into one column to be range checked on this side | ||
| of the interaction, ideally without needing any extra interactions or committed columns. | ||
| For `Bit` variables, this is no problem with the `IS_BIT` template from @isbit. |
There was a problem hiding this comment.
does 1 not have another square root in the extension field?
|
|
||
| Besides enforcing the FMA constraints and the correct transitions between states, we also need to ensure that execution | ||
| starts at the correct instruction and ends with a halting instruction. | ||
| This means that the verifier must check that the first row of the table corresponds to a state at `PC = 1` and all other variables set to $0$; |
There was a problem hiding this comment.
Shouldn't we introduce a "first-row" indicator row to make this a constraints? Otherwise, how is the verifier going to do this? The prover can only open elements in the codeword, but that is blown-up + shifted compared to the original table.
No description provided.