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

U8Air Extended #115

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

U8Air Extended #115

wants to merge 5 commits into from

Conversation

hecmas
Copy link
Contributor

@hecmas hecmas commented Nov 22, 2024

A new air has been added:

airtemplate U8AirExtended(const int N = 2**16) {
    // The same as U8Air, but with the cartisian product of U8 with itself to allow for lookups from two to two

    if (N != 2**16) {
        error(`The number of rows N should be 2**16 to use the predefined range U8xU8, got N=${N} instead`);
    }

    col witness mul;

    col fixed U8_A = [0..BYTE]...;
    col fixed U8_B = [0:P2_8..BYTE:P2_8];
    lookup_proves(DEFAULT_OPIDS[2], [U8_A, U8_B], mul, PIOP_NAME_RANGE_CHECK);
}

that allows to optimize multiple range checks to the range $[0,2^8-1]$ by a factor of two.

  • Used for the case where the the range is of the form $[a,b]$, with $a \geq 0$ and $b \leq 2^8-1$, except for the range $[0,2^8-1]$.
  • Used to divide the number of assumes to the exact range $[0,2^8-1]$ by a factor of two, since two range checks to the range $[0,2^8-1]$ can be compressed to a single range check to the (cartesian product) range $[0,2^8-1] \times [0,2^8-1]$.
Type #RangeChecks #Cols #Const #Evals
Old 1 11 3 8
Old 2 16 4 11
Old 4 23 4 16
Old 8 37 6 26
Old 16 65 10 46
New 1 10 3 8
New 2 11 3 8
New 4 13 3 10
New 8 20 3 15
New 16 31 4 24

@hecmas hecmas mentioned this pull request Nov 25, 2024
7 tasks
@hecmas hecmas marked this pull request as ready for review November 26, 2024 07:48
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 this pull request may close these issues.

1 participant