started reading about Halo2 which is used in zk-email for creating RSA, sha and regex verification chips.

Main architecture is UltraPLONK which is PLONK + custom gates (TurboPLONK) + Lookup arguments (Plookup) but simpler than original plookup.

**Arithmetization**(encode computation in form of provable circuits, interpolated as polynomial)**Polynomial**Commitment (create commitment to polynomials)**Accumulation**(efficiently combine opening proofs)

Then went ahead and gained some context on what Lookup tables are and how they are used in current programming paradigm. Good optimisation for compute heavy task and quite old technique.

So, here is the summary of my understanding of Halo2 as of now:

## Arithmetization

- circuit represented in terms of matrix.
- Rows and columns
- Columns of three types: fixed, advice, instance
- fixed: general circuit representation based on wires (fixed wires)
- advice: witness used in circuit
- instance: public inputs
- More columns, require new commitment, scalar mult increases,
**proof size**increases.

- Rows:
~~arithmetic gates~~domain at which columns are evaluated. More rows, FFT increases,**proving time**increases

- Columns of three types: fixed, advice, instance
- Divides the circuit in chips and gadgets.
- A circuit is divided into disjoint related cells as
**regions**. Relative constrains are set in regions only. **Floor planner**is used to decide where to put each region.- Must include all local constraints, i.e. the checks on gates involved in the region. simple or custom.
- need not have all global constraints.

- High level APIs are made accessible using already validated
**gadgets**. For example: creating halo2 circuit for verifying a hash function would require many several independent chips, which can be integrated as gadgets and directly used, instead of making another implementation. - relative constrains reduce the number of columns required, and thus reduces proof size. If not for relative constraints, you would have to prove each output of a gate, and thus would increase the proof size of, let’s say a custom gate, much higher.
- Chips also define lookup tables, and if more than one lookup argument is used, then tag column is used to specify which table to use. don’t understand this as of the moment. will look back on it.

## Commitment

Uses Inner Product Argument as commitment scheme to prove polynomials. Requires no trusted setup.

- roots of unity are chosen as the evaluation domain. the polynomial constructed should vanish, i.e. evaluate to 0 at evaluation domain.
- single point opening or multi point opening.
- single point opening: let’s say: column $A_{0},A_{1}$ is being proven at $x$.
- multi point opening: column $A_{2},A_{3}$ are being proven at $x,ωx$.
- group columns by their set of query points.
- accumulate polynomials in $q_{i}$ according to their set.
- $q_{1}(X)=A_{0}(X)+x_{1}A_{1}(X)$
- $q_{2}(X)=A_{2}(X)+x_{2}A_{3}(X)$

- evaluate at the points in the set at $x,ωx$, to get $q_{1}(x),q_{2}(x),q_{2}(ωx)$.
- interpolate the evaluations at the specified set.
- create quotient polynomials to check correctness of evaluation, $f_{i}(x)$
- $f_{1}(x)=X−xq_{1}(x)−r_{1}(x) $
- $f_{2}(x)=(X−x)(X−ωx)q_{2}(x)−r_{2}(x) $

- construct $f(x)$ as one large quotient polynomial.
- create
`final_poly(X)`

with $f(x),q_{i}(x)$.

### Steps to write a circuit

- create
`Config`

- create
`Chip`

- define
`Circuit`