|
5 | 5 | A _custom predicate_ can be defined in one of two ways: |
6 | 6 |
|
7 | 7 | - Directly, as either the AND or OR of two pre-existing predicates, or |
8 | | -- Recursively, in a _batch_ of up to 10 custom predicates. Each custom predicate in the batch is either the AND or OR of five predicates which are either pre-existing, or defined in the same batch. |
| 8 | +- Recursively, in a _group_ of up to 10 custom predicates. Each custom predicate in the group is either the AND or OR of five predicates which are either pre-existing, or defined in the same group. |
9 | 9 |
|
10 | 10 | [Note: We could potentially allow the AND or OR of, say, two predicates instead of five. To make this work, we might need to have access to pod ID as a virtual key, see github issue #60] |
11 | 11 |
|
12 | 12 | ## Arguments of custom predicates |
13 | 13 |
|
14 | | -The definition of a custom predicate might also be called an _operation_ or _deduction rule_. It includes two (or, potentially, say, five) input statements. The arguments to the input statements are decomposed as (origin, key) pairs: if statements are allowed to have arity at most 4, then the input statements in a deduction rule will have at most 8 arguments (4 origins and 4 keys). The same holds for the output statement. |
| 14 | +The definition of a custom predicate might also be called an _operation_ or _deduction rule_. It includes two (or, potentially, say, five) statement templates as conditions. The arguments to the statement templates are decomposed as (origin, key) pairs: if statements are allowed to have arity at most 4, then the statement templates in a deduction rule will have at most 8 arguments (4 origins and 4 keys). The same holds for the output statement. |
15 | 15 |
|
16 | | -Each argument (origin or key) to an input statement is either a wildcard or a literal. In the backend, the wildcard arguments will be identified as *1, *2, *3, .... |
| 16 | +Each argument (origin or key) to an statement template is either a wildcard or a literal. In the backend, the wildcard arguments will be identified as *1, *2, *3, .... |
17 | 17 |
|
18 | 18 | ## Examples |
19 | 19 |
|
20 | 20 | See [examples](./customexample.md) |
21 | 21 |
|
22 | 22 | ## Hashing and predicate IDs |
23 | 23 |
|
24 | | -Each custom predicate is assigned a cryptographic ID as follows: |
25 | | - |
26 | | -If it is defined directly: its ID is simply a zk-friendly hash of its definition. The definition is serialized as it will appear in circuit (see below) and hashed. |
27 | | - |
28 | | -If it is defined in a batch: The definitions of all statements in the batch are laid out consecutively (see [examples](./customexample.md)) and hashed. |
| 24 | +Each custom predicate is defined as part of a _group_ of predicates. The definitions of all statements in the group are laid out consecutively (see [examples](./customexample.md)) and hashed. |
29 | 25 |
|
30 | 26 | ## How to prove an application of an operation |
31 | 27 |
|
32 | 28 | A POD contains a "tabular proof", in which each row includes a "statement" and a "reason". The "reason" is everything the circuit needs as a witness to verify the statement. |
33 | 29 |
|
34 | 30 | For a custom statement, the "reason" includes the following witnesses and verifications: |
35 | 31 | - the definition of the statement, serialized (see [examples](./customexample.md)) |
36 | | - - if the statement is part of a batch, the definition of the full batch, serialized |
| 32 | + - if the statement is part of a group, the definition of the full group, serialized |
37 | 33 | - verify that the hash of the definition is the statement ID |
38 | | -- the definition will have some number of "wildcards" (*1, *2, ...) as arguments to input statements; a value for each wildcard must be provided as a witness (each will be either an origin ID or key) |
| 34 | +- the definition will have some number of "wildcards" (*1, *2, ...) as arguments to statement templates; a value for each wildcard must be provided as a witness (each will be either an origin ID or key) |
39 | 35 | - the circuit must substitute the claimed values for the wildcards, and the resulting statements (true statements with origins and keys) will appear as witnesses |
40 | | -- the circuit must verify that all the input statements (with origins and keys) appear in the previous statements (in higher rows of the table) |
| 36 | +- the circuit must verify that all the input statement templates (with origins and keys) appear in the previous statements (in higher rows of the table) |
41 | 37 | - the circuit also substitutes the claimed values for the wildcards in the output statement, and verifies that it matches the claimed output statement |
0 commit comments