Skip to content

Commit

Permalink
Some changes to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brweisz committed Aug 29, 2024
1 parent 8af2f8b commit 41ff8fd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/opcodes/assertZero.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
### AssertZero
AssertZero is the main opcode in any program: it allows arithmetic operations over an arbitrary set of variables. This arithmetic operations are represented through equations that must hold throughout the program. For example: if we want to say
AssertZero is the main opcode in almost any circuit: it allows arithmetic operations over an arbitrary set of variables. This arithmetic operations are represented through equations that must hold throughout the program. For example, if we want to say

```x = y*y + z - 2```
```x := y*y + z - 2```

we should express it like
we should express it like an equation

```y*y + z - x - 2 == 0```

Expand All @@ -21,14 +21,14 @@ Any assignment of a variable done in Noir, or any comparison by equality will en

#### Equivalence in Plonky2

In Plonky2 we count with an ```ArithmeticGate``` that we can access through the CircuitBuilder API. There are some methods that we can use to facilitate the translation without the need of using the gate directly:
Plonky2 has an ```ArithmeticGate``` that we can access through the CircuitBuilder API. There are some methods that we can use to facilitate the translation without the need of using the gate directly:
* ```add(t1: Target, t2: Target)```
* ```mul(t1: Target, t2: Target)```
* ```mul_const(t1: Target, c: FieldElement)```
* ```assert_zero(t: Target)``` -> Restricts the value being held by the target to equal 0.

The ArithmeticGate accepts equations of the form
The ArithmeticGate accepts equations of the form

```k_0 * x * y + k_1 * z```

so to translate a single AssertZero we need to generate a Plonky2 circuit that potentially uses many Arithmetic Gates.
so to translate a single AssertZero we need to generate a Plonky2 circuit that potentially uses many Arithmetic Gates. So, to sum it up, a single AssertZero opcode might be translated to many arithmetic operations.

0 comments on commit 41ff8fd

Please sign in to comment.