Lagrange Interpolation for MLEs Part II | ZKP
October 11th, 2024

Overview

If you’re familiar with the Lagrange interpolation, you may know that it is used to construct the interpolation polynomial for a set of points in one dimension and if you’re not, no worries you can just watch these two videos (Video 1, Video 2) before proceeding. Our main focus today is using Lagrange interpolation in multilinear extensions. Don’t be overwhelmed by the upcoming formulas, you only need to understand what they do. We will provide you with a much simpler formula to use when dealing with MLEs at the end of the article, after understanding everything.

Formulation :

The formulation of the multilinear extension can be thought of as a multi-dimensional extension of the Lagrange interpolation formula. The idea is to maintain the properties of the function at the vertices while allowing for interpolation within the entire hypercube.

Given as input all 2l2^l evaluations of a function f:{0,1}lFf: \{ 0,1 \}^l → \mathbb{F}, for any point rFlr \in \mathbb{F}^l there is an O(2l)O(2^l)-time algorithm for evaluating f~(r)\tilde{f}(r).

Multilinear Extension Formula:

f~(r)=w{0,1}lf(w)δ~w(r)\tilde{f}(r) = \sum_{w \in \{ 0,1 \}^l} f(w)⋅ \tilde{\delta}_w(r)

where δ~w(r)\tilde{\delta}_w(r) is the Multilinear Lagrange basis Polynomial corresponding to ww :

δ~w(r)=Πi=1l(riwi+(1ri)(1wi))\tilde{\delta}_w(r) = \Pi_{i=1}^l(r_iw_i + (1-r_i)(1-w_i))

The formula δ~w(r)\tilde{\delta}_w(r) is part of a multilinear extension (MLE), which allows us to extend a function defined on binary inputs to work with real inputs between 0 and 1.

It works by multiplying together simple terms that either "pick" rir_i​ or 1ri,1− r_i​, depending on whether the binary value wiw_i is 1 or 0. This product ensures a smooth transition between the values at each binary point. Essentially, it blends between these binary points based on the real values of rr, allowing us to interpolate the function over continuous inputs.

If you still don’t understand how it works, no worries you don’t need to. Just keep going and you’ll get a much simpler formula that you can use easily at the end.

How It Uses Lagrange Concepts

  • Basis Structure: δ~w(r)\tilde{\delta}_w(r)​, can be seen as a generalization of Lagrange basis polynomials. They ensure that at each vertex rr​, the extension matches the value of f(ri)f(r_i), similar to how Lagrange interpolation ensures the polynomial passes through each point.

  • Generalization: The multilinear extension extends the concept of interpolation from one dimension to multiple dimensions. The basis polynomials in both cases are structured to ensure that the extended function preserves the behavior of the original function at specified points (the vertices).

What is the Boolean Hypercube ?

A Boolean hypercube is a geometric representation of all possible binary values {0,1}\{0, 1\} in n-dimensional space. Each vertex of the hypercube corresponds to an n-length binary string, and there are 2𝑛2^𝑛 n vertices in total, representing all possible combinations of 0 and 1.

For example:

  • In a 1-dimensional Boolean hypercube, you have 2 vertices: 00 and 11, which is just a line.

  • In a 2-dimensional Boolean hypercube, you have 4 vertices: (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1), forming a square.

  • In a 3-dimensional Boolean hypercube, you have 8 vertices:(000),(001),(010),(011),(100),(101),(110),(111),(000),(001),(010),(011),(100),(101),(110),(111), forming a cube.

                 000---------001
                / |          / |
               /  |         /  |    3-Dimensional Boolean Hypercube:
              010--------011   |    {000,001,010,011,100,101,110,111}
              |   |        |   |
              |   100------|-101
              |  /         |  /
              | /          | /
              110--------111
    

In ZKPs, you often need to work with functions that are defined over binary inputs. For instance, a function ff might be defined on inputs of length nn that are either 0 or 1, meaning ff is naturally defined on the vertices of a Boolean hypercube of dimension nn. So a Boolean Hypercube is another way of describing our multivariate function.

Derivation of Multilinear Extension

  • Building the Formula

    • Choose the points for interpolation: For bilinear interpolation in two dimensions, you generally have four points:

      • v0=(xv0,yv0)v_0 = (x_{v_0},y_{v0})

      • v1=(𝑥𝑣1,𝑦𝑣1)v_1 = ( 𝑥_{𝑣 _1} , 𝑦_{𝑣 _1})

      • v2=(𝑥𝑣2,𝑦𝑣2)v_2 = ( 𝑥_{𝑣 _2} , 𝑦_{𝑣 _2})

      • v3=(𝑥𝑣3,𝑦𝑣3)v_3 = ( 𝑥_{𝑣_3} , 𝑦_{𝑣 _3})

    • Lagrange Basis Functions:

      • To construct the MLE, we first need to define the Lagrange basis functions. These functions will ensure that the MLE passes through the vertex values of ff.

      • The Lagrange basis functions for the vertices 𝑣0,𝑣1,𝑣_0, 𝑣_1,, v2v_2 and v3v_3 ​ are:

L0(x1,x2)=(x1xv1)((x1xv2)(xv0xv1)(xv0xv2)(x2yv1)(x2yv2)(yv0yv1)((yv0yv2)L_0(\textcolor{skyblue}{x_1,x_2}) = \frac{(\textcolor{skyblue}{x_1}-x_{v_1})((\textcolor{skyblue}{x_1}-x_{v_2})}{(x_{v_0}-x_{v_1})(x_{v_0}-x_{v_2})} ⋅ \frac{(\textcolor{skyblue}{x_2} -y_{v_1})(\textcolor{skyblue}{x_2} -y_{v_2})}{(y_{v_0} -y_{v_1})((y_{v_0}-y_{v_2})}
L1(x1,x2)=(x1xv0)((x1xv2)(xv1xv0)(xv1xv2)(x2yv0)(x2yv2)(yv1yv0)((yv1yv2)L_1(\textcolor{skyblue}{x_1,x_2}) = \frac{(\textcolor{skyblue}{x_1}-x_{v_0})((\textcolor{skyblue}{x_1}-x_{v_2})}{(x_{v_1}-x_{v_0})(x_{v_1}-x_{v_2})} ⋅ \frac{(\textcolor{skyblue}{x_2} -y_{v_0})(\textcolor{skyblue}{x_2}-y_{v_2})}{(y_{v_1} -y_{v_0})((y_{v_1}-y_{v_2})}
L2(x1,x2)=(x1xv0)((x1xv1)(xv2xv0)(xv2xv1)(x2yv0)(x2yv1)(yv2yv0)((yv2yv1)L_2(\textcolor{skyblue}{x_1,x_2}) = \frac{(\textcolor{skyblue}{x_1}-x_{v_0})((\textcolor{skyblue}{x_1}-x_{v_1})}{(x_{v_2}-x_{v_0})(x_{v_2}-x_{v_1})} ⋅ \frac{(\textcolor{skyblue}{x_2} -y_{v_0})(\textcolor{skyblue}{x_2}-y_{v_1})}{(y_{v_2} -y_{v_0})((y_{v_2}-y_{v_1})}
L3(x1,x2)=(x1xv0)((x1xv1)(xv3xv0)(xv3xv1)(x2yv0)(x2yv1)(yv3yv0)((yv3yv1)L_3(\textcolor{skyblue}{x_1,x_2}) = \frac{(\textcolor{skyblue}{x_1}-x_{v_0})((\textcolor{skyblue}{x_1}-x_{v_1})}{(x_{v_3}-x_{v_0})(x_{v_3}-x_{v_1})} ⋅ \frac{(\textcolor{skyblue}{x_2} -y_{v_0})(\textcolor{skyblue}{x_2}-y_{v_1})}{(y_{v_3} -y_{v_0})((y_{v_3}-y_{v_1})}

Each Li(x,y)L_i(x,y) equals 1 at vertex viv_i and 0 at the other vertices meaning:

  • L0(x1,x2)L_0(x_1,x_2) is 1 when 𝑥1=xv0𝑥_1 ​ = x_{v_0} ​and 𝑥2=yv0𝑥_2 ​ = y_{v_0}, and 0 when either 𝑥1=xv1𝑥_1 ​ = x_{v_1} or 𝑥2=yv1𝑥_2 ​ = y_{v_1}

  • L1(x1,x2)L_1(x_1,x_2) is 1 when 𝑥1=xv1𝑥_1 ​ = x_{v_1} ​and 𝑥2=yv0𝑥_2 ​ = y_{v_0}, and 0 when either 𝑥1=xv0𝑥_1 ​ = x_{v_0} or 𝑥2=yv1𝑥_2 ​ = y_{v_1}

  • L2(x1,x2)L_2(x_1,x_2) is 1 when 𝑥1=xv0𝑥_1 ​ = x_{v_0} ​and 𝑥2=yv1𝑥_2 ​ = y_{v_1}, and 0 when either 𝑥1=xv1𝑥_1 ​ = x_{v_1} or 𝑥2=yv0𝑥_2 ​ = y_{v_0}

  • L3(x1,x2)L_3(x_1,x_2) is 1 when 𝑥1=xv1𝑥_1 ​ = x_{v_1} ​and 𝑥2=yv1𝑥_2 ​ = y_{v_1}, and 0 when either 𝑥1=xv0𝑥_1 ​ = x_{v_0} or 𝑥2=yv0𝑥_2 ​ = y_{v_0}

  • Formulating the Multilinear Extension:

    • Now, we can express the multilinear extension f~(x,y)\tilde{f}(x,y) using the function values at the vertices and the Lagrange basis functions:
f~(x1,x2)=f(v0)L0(x1,x2)+f(v1)L1(x1,x2)+f(v2)L2(x1,x2)+f(v3)L3(x1,x2)\tilde{f}(x_1,x_2) = \textcolor{skyblue}{f(v_0)}L_0(x_1,x_2) + \textcolor{skyblue}{f(v_1)}L_1(x_1,x_2) + \textcolor{skyblue}{f(v_2)}L_2(x_1,x_2) + \textcolor{skyblue}{f(v_3)}L_3(x_1,x_2)
  • Final Formula (Simplified):
f~(x1,x2)=f(v0)(1x1)(1x2)+f(v1)(1x1)x2+f(v2)x1(1x2)+f(v3)x1x2\tilde{f}(x_1,x_2) = \textcolor{skyblue}{f(v_0)}(1-x_1)(1-x_2) + \textcolor{skyblue}{f(v_1)}(1-x_1)x_2 + \textcolor{skyblue}{f(v_2)}x_1 (1-x_2) + \textcolor{skyblue}{f(v_3)}x_1x_2

You only need to understand this formula when dealing with MLEs without going through all of the math behind it.

f~(r)=w{0,1}lf(w)δ~w(r)\tilde{f}(r) = \sum_{w \in \{ 0,1 \}^l} f(w)⋅ \tilde{\delta}_w(r)

So the Final Formula is basically this formula but written in a more elegant way.

Example

We define a bivariate function over the domain {0,1}l\{ 0,1 \}^l :

f(0,0)=1    f(0,1)=2    f(1,0)=8    f(1,1)=10f(0,0)= 1 \space \space \space \space f(0,1) = 2 \space \space \space \space f(1,0) = 8 \space \space \space \space f(1,1) = 10

The MLE of the bivariate function will look like this:

f~(x1,x2)=1(1x1)(1x2)+2(1x1)x2+8x1(1x2)+10x1x2\tilde{f}(x_1,x_2) =\textcolor{skyblue}{1}(1-x_1)(1-x_2) + \textcolor{skyblue}{2}(1-x_1)x_2 + \textcolor{skyblue}{8}x_1 (1-x_2) + \textcolor{skyblue}{10}x_1x_2

which we can simplify it to:

f~(x1,x2)=1+7x1+x2+x1x2\tilde{f}(x_1,x_2) = 1+ 7x_1 + x_2 + x_1x_2

Notice that each of the four terms on the right hand side of the equation ensures that the MLE evaluates equally to our predefined values for the bivariate function:

f(0,0)=f~(0,0)=11+20+80+100=1f(0,0) = \tilde{f}(0,0) = \textcolor{skyblue}{1}⋅1 + 2⋅0 + 8⋅0 + 10⋅0 = \textcolor{skyblue}{1}
f(0,1)=f~(0,1)=10+21+80+100=2f(0,1) = \tilde{f}(0,1) = 1⋅0 + \textcolor{skyblue}{2}⋅1 + 8⋅0 + 10⋅0 = \textcolor{skyblue}{2}
f(1,0)=f~(1,0)=10+20+81+100=8f(1,0) = \tilde{f}(1,0) = 1⋅0 + 2⋅0 + \textcolor{skyblue}{8}⋅1 + 10⋅0 = \textcolor{skyblue}{8}
f(1,1)=f~(1,1)=10+20+80+101=10f(1,1) = \tilde{f}(1,1) = 1⋅0 + 2⋅0 + 8⋅0 + \textcolor{skyblue}{10}⋅1 = \textcolor{skyblue}{10}

So our MLE looks like this:

By replacing x1x_1 and x2x_2 in f~(x1,x2)\tilde{f}(x_1,x_2) by the indexes (4,5) we will get 54 which is the most bottom right cell.

f~(x1,x2)=1+7x1+x2+x1x2\tilde{f}(x_1,x_2) = 1+ 7x_1 + x_2 + x_1x_2
f~(5,5)=1+74+5+45=1+28+5+20=54\tilde{f}(5,5) = 1 + 7⋅4 + 5 + 4⋅5 = 1 + 28 + 5 + 20 = 54

Conclusion

Formula 1:    f~(r)=w{0,1}lf(w)δ~w(r)Formula \space 1: \space \space \space \space \tilde{f}(r) = \sum_{w \in \{ 0,1 \}^l} f(w)⋅ \tilde{\delta}_w(r)
Formula 2:    f~(x1,x2)=f(v0)(1x1)(1x2)+f(v1)(1x1)x2+f(v2)x1(1x2)+f(v3)x1x2Formula \space 2: \space \space \space \space \tilde{f}(x_1,x_2) = {f(v_0)}(1-x_1)(1-x_2) + {f(v_1)}(1-x_1)x_2 + {f(v_2)}x_1 (1-x_2) + {f(v_3)}x_1x_2

Both of these formulas represent multilinear extensions (MLE) of a Boolean function defined on binary points like {0,1}\{0,1\} to a continuous domain.

The first formula is the general case for an ll-dimensional Boolean function, where you're summing over all possible binary vectors 𝑤{0,1}l𝑤 ∈ \{0 , 1\}^l .

The second formula is the specific bivariate (2-dimensional) case, where l=2l=2, and you're interpolating between the four possible binary inputs (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1) as we saw in the previous example.

This is all you need to know about Multi-dimensional Lagrange Interpolation for Multilinear extensions. Hope this article was helpful. The next article will be a full guide on the sumcheck protocol. We’ll be applying everything we’ve learned so far.

Subscribe to FarFromAverage
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from FarFromAverage

Skeleton

Skeleton

Skeleton