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

Support Interleaving Constraints #110

Closed
DavePearce opened this issue May 6, 2024 · 1 comment · Fixed by #205
Closed

Support Interleaving Constraints #110

DavePearce opened this issue May 6, 2024 · 1 comment · Fixed by #205

Comments

@DavePearce
Copy link
Collaborator

DavePearce commented May 6, 2024

Example:

(defcolumns X Y)
(definterleaved (Z) (X Y))

Generates the following Go output:

func ZkEVMDefine(build *Builder) {
        //
        // Corset-computed columns
        //
        _prelude___X := build.RegisterCommit("X", build.Settings.Traces.Prelude)
        _prelude___Y := build.RegisterCommit("Y", build.Settings.Traces.Prelude)


        //
        // Interleaved columns
        //
        _prelude___Z := Interleave(_prelude___X, _prelude___Y)


        //
        // Constraints
        //
}

So, we can see that interleaved is a fundamental constraint.

@DavePearce
Copy link
Collaborator Author

A more involved example:

(defcolumns X Y)
(definterleaved (Z) (X Y))
(defconstraint c1 () (vanishes! (* X Y)))
(defconstraint c2 () (vanishes! (- 1 (~ X))))

With the following trace:

{ "<prelude>": { "X": [1], "Y": [2] } }

Using the following command:

corset compute -eeeeeN --auto-constraints nhood,sorts --trace trace.in --out trace.out interleave.lisp

Gives the following trace.out file:

{"columns":{
"Y":{
"values":["0x00","0x02"],
"padding_strategy": {"action": "prepend", "value": "0"}
}
,"X":{
"values":["0x00","0x01"],
"padding_strategy": {"action": "prepend", "value": "0"}
}
,"Z":{
"values":["0x00","0x00","0x01","0x02"],
"padding_strategy": {"action": "prepend", "value": "0"}
}
,"C/INV[X]":{
"values":["0x00","0x01"],
"padding_strategy": {"action": "prepend", "value": "0"}
}
}}

An interesting question is what exactly the padding strategy is. Is this passed to the prover?

@DavePearce DavePearce linked a pull request Jul 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant