Sum Check Protocol - part 1: Overview

Introduction

This is the part 1 of a blog post series about sum check protocol. The knowledge is mainly derived from the book Proofs, Arguments, and Zero-Knowledge by Justin Thaler and its study group.

The emphasis of this series is on the use case of triangle counting and benchmarks with different implementations at low level. So it could be served as another dimensions to understanding the protocol with counting triangles as the scene.

One of the goals is to iterate it into practical zero-knowledge use cases with implementations from scratch, such as algorithms for multilinear extension and univariate polynomial generation etc. I found working with these low level implementations is beneficial to digest the knowledge especially relating to maths, which seems very important when it comes to optimizing benchmarks, debugging or simplifying explanation for real world applications.

I hope it can provide a lower entry point for anyone interested in learning the basis of zero-knowledge techniques with various levels of math maturity, while it could become a long term side project for me to make continuous experiments or a framework easy for anyone who are intrigued to challenge my implementations for better benchmark performance.

In this article, it focuses on providing an overview to the sum check protocol with a diagram illustrating the workflow at high level, which aims to ease growing a mental model around the protocol in addition to 4.1 section in the book.

Part 2 will introduce how triangle counting can be done using adjacency matrix as a graph with diagrams for step by step illustration, and how to represent it into a polynomial, which then can be feed into the sum check protocol.

Part 3 will combine the concepts introduced from the prior parts, and brief how it structures the code for different implementations and makes it easier for benchmarking new implementations.

There are already a couple of articles with implementations, written by the community for the same topic. The accompany implementations of this blog post series got inspirations from both of them, and extend the implementation from 0xsage. I highly recommend checking them out as well.

Benefit

In short, sum check protocol aims to save verifier from re-calculating from scratch the truth claimed by prover.

In other words, the protocol is to guarantee prover tells the truth of a calculation result while the verifier only needs to spend significant less calculation resource to verify the truth.

Protocol workflow

In the implementation, there are two structs representing the roles of prover and verifier as illustrated in the diagram. Here is a test demonstrating the high level interactions between them.

Note that the test case involves triangle counting, which will be explained in Triangle counting. For now, the code references serve as a warm up for you to understand the protocol in different dimensions, which are the diagram, code and description in the post.

assets/Sum check - overview/sumcheck.drawio.png

First round

Middle rounds

Final round

For verifier, after done checking gj(0)+gj(1)=gj1(rj1) in the previous round, it checks gj(0)+gj(1)=G(r1,r2,...,rj), where G is the multilinear extension form of sumcheck polynomial b1{0,1}b2{0,1}bj{0,1}g(b1,,bj).

Note the reason to have "multilinear extension" transformation for the sum check polynomial is because it can evaluate random numbers other than {0,1} for each variable in the protocol.

Soundness

In other words, how does the protocol guarantee the prover tells the truth while having the performance gain in the verifier time?

Intuitively, as the workflow illustrates, the verifier does verifications that chain up between the facts represented by C, gj(Xj) and G(r1,r2,...,rj). To fake the soundness, the prover has to fake all the information provided to verifier. This is extremely unlikely to succeed when the random numbers belongs to a finite field where the size is much greater than the variable number.

As the soundness guarantees , the verifier only needs to evaluate low degree gj(xj) and evaluation over one point G(r1,r2,...,rj), the combination of both is still much faster than calculating from scratch.

For the mathematical proof of the soundness, please refer to the 4.1 in the book.

Use case

Sum check protocol is applicable to use cases in which the results requires summing up over all the possible domains. Triangle counting via adjacency graph requires thorough walk through all different paths, thus is an applicable use case for the protocol.

In the part 2, it will try to introduce the triangle counting problem in order to lay down a fundamental mental model for context of sum check protocol.