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

mulfib8 example circuit is underconstrained #229

Open
maltezellic opened this issue Nov 20, 2023 · 0 comments
Open

mulfib8 example circuit is underconstrained #229

maltezellic opened this issue Nov 20, 2023 · 0 comments

Comments

@maltezellic
Copy link

The mulfib8 example is supposed to compute the n-th term of the multiplicative Fibonacci sequence, but the sequence is underconstrained for this purpose.
The transition constraints

result[0] = are_equal(next[0], current[6] * current[7]);
result[1] = are_equal(next[1], current[7] * next[0]);
result[2] = are_equal(next[2], next[0] * next[1]);
result[3] = are_equal(next[3], next[1] * next[2]);
result[4] = are_equal(next[4], next[2] * next[3]);
result[5] = are_equal(next[5], next[3] * next[4]);
result[6] = are_equal(next[6], next[4] * next[5]);
result[7] = are_equal(next[7], next[5] * next[6]);

only ensure that the next line is computed correctly from the last two entries in the current line.
However, the assertions

        let last_step = self.trace_length() - 1;
        vec![
            Assertion::single(0, 0, BaseElement::new(1)),
            Assertion::single(1, 0, BaseElement::new(2)),
            Assertion::single(6, last_step, self.result),
        ]

only fix the first two entries of the first row. The prover can thus set the rest of the first row to arbitrary values, in particular the last two entries, and thus change the result that is supposed to be the n-th term of the multiplicative Fibonacci sequence.

The fix should probably be to add constraints for the rest of the first row:

        let last_step = self.trace_length() - 1;
        vec![
            Assertion::single(0, 0, BaseElement::new(1)),
            Assertion::single(1, 0, BaseElement::new(2)),
            Assertion::single(2, 0, BaseElement::new(2)),
            Assertion::single(3, 0, BaseElement::new(4)),
            Assertion::single(4, 0, BaseElement::new(8)),
            Assertion::single(5, 0, BaseElement::new(32)),
            Assertion::single(6, 0, BaseElement::new(256)),
            Assertion::single(7, 0, BaseElement::new(8192)),
            Assertion::single(6, last_step, self.result),
        ]

All code is from examples/src/fibonacci/mulfib8/air.rs.

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

No branches or pull requests

1 participant