# Lookup Argument

The Lookup Argument establishes that all elements of list $A=(a_{0},…,a_{ℓ})$ also occur in list $B=(b_{0},…,b_{n})$.
In this context, $A$ contains the values that are being looked up, while $B$ is the lookup table.^{1}
Both lists $A$ and $B$ may contain duplicates.
However, it is inefficient if $B$ does, and is therefor assumed not to.

The example at the end of this section summarizes the necessary computations for the Lookup Argument. The rest of the section derives those computations. The first step is to interpret both lists' elements as the roots of polynomials $f_{A}(X)$ and $f_{B}(X)$, respectively:

$f_{A}(X)f_{B}(X) =i=0∏ℓ X−a_{i}=i=0∏n X−b_{i} $

By counting the number of occurrences $m_{i}$ of unique elements $a_{i}∈A$ and eliminating duplicates, $f_{A}(X)$ can equivalently be expressed as:

$f_{A}(X)=i=0∏n (X−a_{i})_{m_{i}}$

The next step uses

- the formal derivative $f_{A}(X)$ of $f_{A}(X)$, and
- the multiplicity-weighted formal derivative $f_{B}(X)$ of $f_{B}(X)$.

The former is the familiar formal derivative:

$f_{A}(X)=i=0∑n m_{i}(X−a_{i})_{m_{i}−1}j=i∏ (X−a_{j})_{m_{j}}$

The multiplicity-weighted formal derivative uses the lookup-multiplicities $m_{i}$ as additional factors:

$f_{B}(X)=i=0∑n m_{i}j=i∏ (X−b_{j})$

Let $g(X)$ the greatest common divisor of $f_{A}(X)$ and $f_{A}(X)$. The polynomial $f_{A}(X)/g(X)$ has the same roots as $f_{A}(X)$, but all roots have multiplicity 1. This polynomial is identical to $f_{B}(X)$ if and only if all elements in list $A$ also occur in list $B$.

A similar property holds for the formal derivatives: The polynomial $f_{A}(x)/g(X)$ is identical to $f_{B}(X)$ if and only if all elements in list $A$ also occur in list $B$. By solving for $g(X)$ and equating, the following holds:

$f_{A}(X)⋅f_{B}(X)=f_{A}(X)⋅f_{B}(X)$

## Optimization through Logarithmic Derivatives

The logarithmic derivative of $f(X)$ is defined as $f_{′}(X)/f(X)$.
Furthermore, the equality of monic polynomials $f(X)$ and $g(X)$ is equivalent to the equality of their logarithmic derivatives.^{2}
This allows rewriting above equation as:

$f_{A}(X)f_{A}(X) =f_{B}(X)f_{B}(X) $

Using logarithmic derivatives for the equality check decreases the computational effort for both prover and verifier.
Concretely, instead of four running products – one each for $f_{A}$, $f_{A}$, $f_{B}$, and $f_{B}$ – only two logarithmic derivatives are needed.
Namely, considering once again list $A$ *containing* duplicates, above equation can be written as:

$i=0∑ℓ X−a_{i}1 =i=0∑n X−b_{i}m_{i} $

To compute the sums, the lists $A$ and $B$ are base columns in the two respective tables. Additionally, the lookup multiplicity is recorded explicitly in a base column of the lookup table.

## Example

In Table A:

base column A | extension column A: logarithmic derivative |
---|---|

0 | $α−01 $ |

2 | $α−01 +α−21 $ |

2 | $α−01 +α−22 $ |

1 | $α−01 +α−22 +α−11 $ |

2 | $α−01 +α−23 +α−11 $ |

And in Table B:

base column B | multiplicity | extension column B: logarithmic derivative |
---|---|---|

0 | 1 | $α−01 $ |

1 | 1 | $α−01 +α−11 $ |

2 | 3 | $α−01 +α−11 +α−23 $ |

It is possible to establish a subset relation by skipping over certain elements when computing the logarithmic derivative. The logarithmic derivative must incorporate the same elements with the same multiplicity in both tables. Otherwise, the Lookup Argument will fail.

An example for a Lookup Argument can be found between the Program Table and the Processor Table.

^{1}

The lookup table may represent a mapping from one or more “input” elements to one or more “output” elements – see “Compressing Multiple Elements.”

^{2}

See Lemma 3 in this paper for a proof.