Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zac-williamson committed Jul 23, 2024
1 parent f26f5a5 commit f0d37e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ let add_flags = [true];
instance.evaluate_quadratic_expresson(lhs_terms, lhs_flags, rhs_terms, rhs_flags, linear_terms, linear_flags);
```

### Computing witness values

When computing inputs to `evaluate_quadratic_expresson` , unconstrained functions `__addmod`, `__submod`, `__mulmod`, `__divmod` can be used to compute witness values.

e.g. if we wanted to compute `(a + b) * c + (d - e) * f = g` by evaluating the above example, `g` can be derived via:

```
let bn: BigNumInstance<3, BNParams> = BNInstance();
let t0 = bn.__mulmod(bn.__addmod(a, b), c);
let t1 = bn.__mulmod(bn.__addmod(d, bn.__neg(e)), f);
let g = bn.__addmod(t0, t1);
```

# Deriving BNInstance parameters: `modulus`, `redc_param`

For common fields, the intention is that BNInstance parameters do not have to be derived; `BigNum::fields` contains `BigNumInstance` constructors for common fields (if you need a field that is missing, please create an issue).
Expand Down

0 comments on commit f0d37e0

Please sign in to comment.