From ef71efb5b3a446be281c4e6d223466916585cb06 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Wed, 29 Nov 2023 21:54:46 +0100 Subject: [PATCH 1/6] Fix some old statements about lookup tables --- book/src/kimchi/lookup.md | 3 ++- kimchi/src/circuits/lookup/tables/mod.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/book/src/kimchi/lookup.md b/book/src/kimchi/lookup.md index a261672716..14a31be896 100644 --- a/book/src/kimchi/lookup.md +++ b/book/src/kimchi/lookup.md @@ -57,7 +57,8 @@ $$ ### Lookup tables -Kimchi uses a single **lookup table** at the moment of this writing; the XOR table. The XOR table for values of 1 bit is the following: + +Kimchi uses different lookup tables, including RangeCheck and XOR. The XOR table for values of 1 bit is the following: | l | r | o | diff --git a/kimchi/src/circuits/lookup/tables/mod.rs b/kimchi/src/circuits/lookup/tables/mod.rs index d6be11f9bd..09ed562c91 100644 --- a/kimchi/src/circuits/lookup/tables/mod.rs +++ b/kimchi/src/circuits/lookup/tables/mod.rs @@ -5,6 +5,9 @@ use serde::{Deserialize, Serialize}; pub mod range_check; pub mod xor; +// If you add new tables, update ../../../../../book/src/kimchi/lookup.md +// accordingly + //~ spec:startcode /// The table ID associated with the XOR lookup table. pub const XOR_TABLE_ID: i32 = 0; From b47a5f09a35cbc6ac88e529b4eab82030f6568f2 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Wed, 29 Nov 2023 22:59:57 +0100 Subject: [PATCH 2/6] Add some comments regarding ChaCha20 gates --- book/src/kimchi/lookup.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/book/src/kimchi/lookup.md b/book/src/kimchi/lookup.md index 14a31be896..c67b675bf1 100644 --- a/book/src/kimchi/lookup.md +++ b/book/src/kimchi/lookup.md @@ -105,7 +105,7 @@ The associated **query selector** tells us on which rows the query into the XOR | 1 | 0 | -Both the (XOR) lookup table and the query are built-ins in kimchi. The query selector is derived from the circuit at setup time. Currently only the ChaCha gates make use of the lookups. +Both the (XOR) lookup table and the query are built-ins in kimchi. The query selector is derived from the circuit at setup time. With the selectors, the grand product argument for the lookup constraint has the following form: @@ -126,7 +126,10 @@ $$ Since we would like to allow multiple table lookups per row, we define multiple **queries**, where each query is associated with a **lookup selector**. -At the moment of this writing, the `ChaCha` gates all perform $4$ queries in a row. Thus, $4$ is trivially the largest number of queries that happen in a row. +Previously, ChaCha20 was implemented in Kimchi but has been removed as unneeded. +You can still find the implementation +[here](https://github.com/o1-labs/proof-systems/blob/601e0adb2a4ba325c9a76468b091ded2bc7b0f70/kimchi/src/circuits/polynomials/chacha.rs). +The `ChaCha` gates all perform $4$ queries in a row. Thus, $4$ is trivially the largest number of queries that happen in a row. **Important**: to make constraints work, this means that each row must make $4$ queries. Potentially some or all of them are dummy queries. From 086c9a935d33655418a622e96ac0a6653fe720b9 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Wed, 29 Nov 2023 23:41:33 +0100 Subject: [PATCH 3/6] Update old statements regarding available tables --- book/src/kimchi/lookup.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/book/src/kimchi/lookup.md b/book/src/kimchi/lookup.md index c67b675bf1..dc5badf39a 100644 --- a/book/src/kimchi/lookup.md +++ b/book/src/kimchi/lookup.md @@ -10,7 +10,8 @@ We integrate plookup in kimchi with the following differences: * we snake-ify the sorted table instead of wrapping it around (see later) * we allow fixed-ahead-of-time linear combinations of columns of the queries we make -* we only use a single table (XOR) at the moment of this writing + +* we implemented different tables, like RangeCheck and XOR. * we allow several lookups (or queries) to be performed within the same row * zero-knowledgeness is added in a specific way (see later) From 5a96228db0f6d3883352d72cb1162ef3116327f1 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Wed, 29 Nov 2023 23:43:17 +0100 Subject: [PATCH 4/6] Add comment on same line to fix rendering --- book/src/kimchi/lookup.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/src/kimchi/lookup.md b/book/src/kimchi/lookup.md index dc5badf39a..7b899402f9 100644 --- a/book/src/kimchi/lookup.md +++ b/book/src/kimchi/lookup.md @@ -10,8 +10,7 @@ We integrate plookup in kimchi with the following differences: * we snake-ify the sorted table instead of wrapping it around (see later) * we allow fixed-ahead-of-time linear combinations of columns of the queries we make - -* we implemented different tables, like RangeCheck and XOR. +* we implemented different tables, like RangeCheck and XOR. * we allow several lookups (or queries) to be performed within the same row * zero-knowledgeness is added in a specific way (see later) From 95713257b0dcd0af206cebcf932fdb9b79619a7b Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Thu, 30 Nov 2023 00:09:05 +0100 Subject: [PATCH 5/6] Remove old statement saying XOR is the only table --- book/src/kimchi/lookup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/kimchi/lookup.md b/book/src/kimchi/lookup.md index 7b899402f9..cad88e2769 100644 --- a/book/src/kimchi/lookup.md +++ b/book/src/kimchi/lookup.md @@ -200,7 +200,7 @@ The denominator thus becomes $\prod_{k=1}^{5} (\gamma (1+\beta) + s_{kn+i-1} + \ There are two things that we haven't touched on: -* The vector $t$ representing the **combined lookup table** (after its columns have been combined with a joint combiner $j$). The **non-combined loookup table** is fixed at setup time and derived based on the lookup tables used in the circuit (for now only one, the XOR lookup table, can be used in the circuit). +* The vector $t$ representing the **combined lookup table** (after its columns have been combined with a joint combiner $j$). The **non-combined loookup table** is fixed at setup time and derived based on the lookup tables used in the circuit. * The vector $s$ representing the sorted multiset of both the queries and the lookup table. This is created by the prover and sent as commitment to the verifier. The first vector $t$ is quite straightforward to think about: From 2c6f26101b877317d63f93bd64db549ceb7aaffa Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Thu, 30 Nov 2023 09:49:31 +0100 Subject: [PATCH 6/6] Update book/src/kimchi/lookup.md --- book/src/kimchi/lookup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/kimchi/lookup.md b/book/src/kimchi/lookup.md index cad88e2769..326b93dadd 100644 --- a/book/src/kimchi/lookup.md +++ b/book/src/kimchi/lookup.md @@ -126,7 +126,7 @@ $$ Since we would like to allow multiple table lookups per row, we define multiple **queries**, where each query is associated with a **lookup selector**. -Previously, ChaCha20 was implemented in Kimchi but has been removed as unneeded. +Previously, ChaCha20 was implemented in Kimchi but has been removed as it has become unneeded. You can still find the implementation [here](https://github.com/o1-labs/proof-systems/blob/601e0adb2a4ba325c9a76468b091ded2bc7b0f70/kimchi/src/circuits/polynomials/chacha.rs). The `ChaCha` gates all perform $4$ queries in a row. Thus, $4$ is trivially the largest number of queries that happen in a row.