# 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.*

### First round

- Prover
- Calculates the result as
for the sumcheck function .

is the truth claimed by the prover. For the triangle counting, the can be calculated from anyways, either in hypercube sum or matrix multiplication. - According to the equation,
, generates the univariate polynomial from the multivariate sumcheck polynomial for the fixed variable with index based on the current round of the protocol interactions. *Note that it is in the 1st round, so is*. - Provides
for verifier to construct and to check.

- Calculates the result as
- Verifier

4. Checks

### Middle rounds

- Verifier
- Advances the current round flag and generate random number
.

- Advances the current round flag and generate random number
- Prover

2. Generates an univariate polynomialwith the set of and send it to verifier. - Verifier

3. Check

### Final round

For verifier, after done checking

*Note the reason to have "multilinear extension" transformation for the sum check polynomial is because it can evaluate random numbers other than 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

As the soundness guarantees , the verifier only needs to evaluate low degree

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.