From 48a282836abfa62f09e4bafedba1dc871d2d793b Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 17 May 2024 16:52:45 -0300 Subject: [PATCH 1/2] add doc about degree 3 folding --- folding/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/folding/src/lib.rs b/folding/src/lib.rs index 3f4caaa0c8..52bfa85de5 100644 --- a/folding/src/lib.rs +++ b/folding/src/lib.rs @@ -15,6 +15,11 @@ //! After that, the user can provide folding compatible expressions and build a //! folding scheme [FoldingScheme]. The process is described in the module //! [expressions]. +//! ## Degree 3 folding +//! While mostly hidden from the interface, internally folding supports degree 3 +//! expressions in orther to support multiple constraints. +//! That results in 2 errors terms t_0 and t_1 and a slightly different computation +//! of E than in Nova (E' + rt_0 + r^2t_1 + r^3E'') // TODO: the documentation above might need more descriptions. use ark_ec::AffineCurve; From 208f980a3bc57bc7961ee34ae928597767ab9645 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Tue, 28 May 2024 16:38:18 -0300 Subject: [PATCH 2/2] doc t_0 and t_1 computation --- folding/src/lib.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/folding/src/lib.rs b/folding/src/lib.rs index 52bfa85de5..a3d7516099 100644 --- a/folding/src/lib.rs +++ b/folding/src/lib.rs @@ -20,7 +20,37 @@ //! expressions in orther to support multiple constraints. //! That results in 2 errors terms t_0 and t_1 and a slightly different computation //! of E than in Nova (E' + rt_0 + r^2t_1 + r^3E'') -// TODO: the documentation above might need more descriptions. +//! ### Computing t_0 and t_1 +//! Given a constraint C as multivariate polynomial with n terms of +//! folding degree exactly 3, we separate variables into 2 sets, S for +//! those of folding degree 0, and W for those of folding degree 1. +//! ```text +//! +//! T_i = a_i * b_i * c_i * ∏ s +//! s∊S_i +//! +//! for a_i, b_i, c_i ∈ W and S_i ∈ S +//! ``` +//! +//! Then we can compute t_0 +//! ```text +//! n-1 +//! t_0 = ∑ (a_i' * b_i' * c_i'' + c_i' * (a_i * 'b_i'' + a_i' * 'b_i')) * ∏ s +//! i=0 s∊S_i +//! ``` +//! And t_1 +//! ```text +//! n-1 +//! t_1 = ∑ (c_i' * '(a_i' * b_i'' + a_i'' * b_i') + a_i'' * b_i'' * c_i') * ∏ s +//! i=0 s∊S_i +//! ``` +//! where a_i' and a_i'' for example are the same column, one from +//! each of the 2 witnesses being folded. +//! ```text +//! folding degree: +//! 1 for variables tied to a pair : witness columns, challenges, dynamic selectors, .. +//! 0 for pair independent or fixed variables : static selectors, constants, .. +//! ``` use ark_ec::AffineCurve; use ark_ff::{Field, Zero};