plafer
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    In this note, we will explore two versions of the Sum-Check protocol: the vanilla protocol, as well as a useful generalization that we'll refer to as "Specialized Sum-Check". ## The Sum-Check problem statement Sum-check is an algorithm where the following statement is proven: $$ \sum_{x_1 \in \{0, 1\}} \dots \sum_{x_m \in \{0, 1\}} g(x_1, \dots, x_m) = C_1, $$ where $g: \mathbb{F}^m \rightarrow \mathbb{F}$ is any m-variate polynomial, and $C_1 \in \mathbb{F}$ is the result of computing the sum. The polynomial $g$ is public (*i.e.* known to both the prover and verifier). Hence, the verifier could compute that sum itself. However, we often don't want the verifier to have to do all this work. The main benefit of sum-check is that the verifier can be convinced that the statement is true with very little work, at the cost of more work for the prover. Throughout this note, we will use the following as a short-hand for the above statement: $$ \sum_{(x_1, \dots, x_m) \in \{0, 1\}^m} g(x_1, \dots, x_m) = C_1. $$ ## The Sum-Check Protocol In this section, we present the algorithm. We will show why the algorithm properly proves the sum-check statement in the next section. Sum-check is an interactive algorithm which can be made non-interactive using the Fiat-Shamir transform. The algorithm consists of $m$ rounds, where in round $i$, the prover sends a univariate polynomial $s_i: \mathbb{F} \rightarrow \mathbb{F}$ to the verifier, and the verifier responds with a field element $r_i \in_R \mathbb{F}$ sampled uniformly at random. After the last round, the verifier evaluates $g$ at a single point, runs a final check, after which it is convinced that the statement is true. Let's take a closer look at what happens in a round. ### round 1 #### Prover The prover constructs the univariate polynomial $$ s_1(x_1) = \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g(x_1, x_2, \dots, x_m). $$ In words, $s_1: \mathbb{F} \rightarrow \mathbb{F}$ is defined as the sum of $g$ over all variables except $x_1$. The prover sends $s_1$ to the verifier. #### Verifier The verifier checks $$ s_1(0) + s_1(1) = C_1. $$ Then, the verifier samples $r_1 \in_R \mathbb{F}$ uniformly at random and sends it to the prover. ### round 2 #### Prover The prover constructs the univariate polynomial $$ s_2(x_2) = \sum_{(x_3, \dots, x_m) \in \{0, 1\}^{m-2}} g(r_1, x_2, x_3, \dots, x_m). $$ The prover sends $s_2$ to the verifier. #### Verifier The verifier checks $$ s_2(0) + s_2(1) = s_1(r_1). $$ Then, the verifier samples $r_2 \in_R \mathbb{F}$ uniformly at random and sends it to the prover. ### round $i$, $3 \leq i \leq m$ #### Prover The prover constructs the univariate polynomial $$ s_i(x_i) = \sum_{(x_{i+1}, \dots, x_m) \in \{0, 1\}^{m-i}} g(r_1, \dots, r_{i-1}, x_i, x_{i+1}, \dots, x_m). $$ The prover sends $s_i$ to the verifier. #### Verifier The verifier checks $$ s_i(0) + s_i(1) = s_{i-1}(r_{i-1}). $$ Then, the verifier samples $r_i \in_R \mathbb{F}$ uniformly at random and sends it to the prover. ### Verifier last check In round $m$, the verifier received $s_m(x_m)$ from the prover, and sampled $r_m \in_R \mathbb{F}$. Now, the verifier checks $$ g(r_0, \dots, r_m) = s_m(r_m) $$ Note that this is the only evaluation of $g$ by the verifier in the entire protocol. This completes the protocol. If the check passes, then the verifier is convinced that the original statement is true. ## Sum-Check: Analysis In this section, we will show why the protocol as described in the previous section is sound. The first realization to make is that the protocol is recursive: each round *reduces* its statement to a new statement that can itself be proved using sum-check. That is, rounds are linked together by the following relationship: if the statement at round $i + 1$ is correct, then the statement at round $i$ is correct. Before we dive in further, let's introduce some useful notation. Given a function $f(x_1, x_2): \mathbb{F}^2 \rightarrow \mathbb{F}$, then the function $f_{r_1}(x_2)$ is a function such that $$ f_{r_1}(x_2) = f(r_1, x_2). $$ That is, $f_{r_1}: \mathbb{F} \rightarrow \mathbb{F}$ is a function of one less variable than $f$. We say that the variable $x_1$ is *bound* to $f$ (with value $r_1$) to yield the new function $f_{r_1}$. Intuitively, all this does is fix the evaluation of the variable $x_1$ to always be $r_1$. Naturally, this is not limited to functions of 2 variables. We are now ready to show why the sum-check protocol properly convinces the verifier that the sum-check problem statement being proved is true. Although not a formal proof, this will be in a format similar to a [proof by induction](https://en.wikipedia.org/wiki/Mathematical_induction): we will prove the recursive (or "inductive") case, and the base case. We move away from the formal proof format to help convey the intuition behind the proof rather than being formally correct. The recursive case covers how each round reduces its statement to a "smaller" statement, that is also provable using the sum-check protocol. The base case covers the part of the protocol after the last round is over. ### Recursive case To be more concrete, we will look at how the statement in round 1 is reduced to the statement in round 2. However, the idea is the same for every round. Recall that the statement to prove in round 1 is: $$ \sum_{(x_1, \dots, x_m) \in \{0, 1\}^m} g(x_1, \dots, x_m) = C_1, $$ while the statement to prove in round 2 is: $$ \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g_{r_1}(x_2, \dots, x_m) = s_1(r_1). $$ There are three key things to notice: 1. the sum is over one less variable in round 2 than it was in round 1, 2. $g$ has been replaced with $g_{r_1}$, 3. the right-hand side is a scalar value (*i.e.* $s_1(r_1) \in \mathbb{F}$), which we can name $C_2$. The statement in round 2 is a valid sum-check problem, to which we can apply the sum-check protocol! Now, crucially, let's see why the statement in round 1 *reduces* to the statement in round 2. That is, if the statement in round 2 is true, then the statement in round 1 is true. Assume that the second statement is true. That is, $$ \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g_{r_1}(x_2, \dots, x_m) = s_1(r_1). $$ Then, since $r_1$ was sampled uniformly at random, by the [Schwartz-Zippel lemma](https://en.wikipedia.org/wiki/Schwartz%E2%80%93Zippel_lemma), $$ \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g_{x_1}(x_2, \dots, x_m) = s_1(x_1) \quad \forall x_1 \in \mathbb{F}. $$ Or equivalently, $$ \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g(x_1, x_2, \dots, x_m) = s_1(x_1) \quad \forall x_1 \in \mathbb{F}. $$ That is, we can now treat the *entire polynomials* on the left-hand side and the right-hand side as equal. Then, $$ \begin{align} s_1(0) + s_1(1) &= (\sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g(0, x_2, \dots, x_m)) + (\sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g(1, x_2, \dots, x_m)) \\ &=\sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g(0, x_2, \dots, x_m) + g(1, x_2, \dots, x_m) \\ &= \sum_{(x_1, \dots, x_m) \in \{0, 1\}^m} g(x_1, \dots, x_m), \end{align} $$ which is the left-hand side of the statement in round 1! Hence, the statement in round 1 can be written as $s_1(0) + s_1(1) = C_1$. Unsurprisingly, this is exactly the check that the verifier does in the protocol! To recap, when we assume that the statement in round 2 is true, then the statement in round 1 can be rewritten as $s_1(0) + s_1(1) = C_1$. So after the verifier runs this check, all that is left to show is that the statement in round 2 is actually true (which will be carried out in the next round of the protocol). This is another way of saying that the statement in round 1 does indeed reduce to the statement in round 2, which was our initial goal. Next, we will look at the base case, which occurs after round $m$. ### Base case The statement left to prove after round $m$ is: $$ g_{r_1, \dots, r_m} = s_m(r_m) $$ That is, there is no more sum left, and all the variables are bound. Recall that in round $m$, the verifier received the polynomial $s_m$, and randomly sampled $r_m \in_R \mathbb{F}$. Now, this check is trivially done by the verifier. The verifier evaluates $g(r_1, \dots, r_m)$ to yield the left-hand side of the statement, and checks if it is equal to $s_m(r_m)$. Since this was the last statement to prove in the protocol, then the verifier is convinced that the original statement in round 1 is correct! ## The Specialized Sum-Check protocol We will now look at a specialization of the problem statement that turns out to be quite useful in practice. We call it a "specialization" because we make more assumptions about the structure of the inner sum than in the traditional sum-check protocol. ### Problem statement The sum-check problem statement can be specialized to: $$ \sum_{(x_1, \dots, x_m) \in \{0, 1\}^m} g(f_1(x_1, \dots, x_m), \dots, f_n(x_1, \dots, x_m)) = C_1, $$ where $f_1, \dots, f_n$ are multilinear polynomials. Notice that when $f_i(x_1, \dots, x_m) = x_i$, then we recover the vanilla problem statement explored in the previous sections. ### The protocol The protocol works exactly the same as the vanilla sum-check protocol. The $s_i$ polynomials are defined similarly: $$ s_1(x_1) = \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g(f_1(x_1, x_2, \dots, x_m), \dots, f_n(x_1, x_2, \dots, x_m)), $$ $$ s_2(x_2) = \sum_{(x_3, \dots, x_m) \in \{0, 1\}^{m-2}} g({f_1}_{r_1}(x_2, x_3, \dots, x_m), \dots, {f_n}_{r_1}(x_2, x_3, \dots, x_m)), $$ $$ \cdots $$ ### Analysis The argument for why the specialized sum-check protocol is sound is actually the same as for the previous one. We will briefly look at the recursive case, again by focusing on how the problem statement in round 1 reduces to the problem statement in round 2. Assume that the problem statement in round 2 is true. That is, $$ \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} g({f_1}_{r_1}(x_2, \dots, x_m), \dots, {f_n}_{r_1}(x_2, \dots, x_m)) = s_1(r_1), $$ This is actually the same state as in the vanilla problem. To make this a bit more clear, let's rewrite the summand slightly. We define $h_{r_1}(x_2, \dots, x_m)$ as $$ h_{r_1}(x_2, \dots, x_m) = g({f_1}_{r_1}(x_2, \dots, x_m), \dots, {f_n}_{r_1}(x_2, \dots, x_m)) $$ Notice that $h_{r_1}$ is nonlinear in all its variables. Then, we can rewrite the problem statement in round 2 as $$ \sum_{(x_2, \dots, x_m) \in \{0, 1\}^{m-1}} h_{r_1}(x_2, \dots, x_m) = s_1(r_1). $$ Hopefully, it is now clear that since this is the same form as in the vanilla sum-check problem, then the exact same argument for the recursive case applies. As for the base case, the verifier needs to check $$g(f_1(r_1, \dots, r_m), \dots, f_n(r_1, \dots, r_m)) = s_m(r_m).$$ ### Efficient evaluation of round polynomials $s_i$ This specialization is useful in practice, in part because there exists an efficient algorithm for the prover to construct the polynomials $s_i$ at each round. We go over the algorithm in great detail in [this note](https://hackmd.io/@plafer/HJ0Ae_BbA).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully