The Basic Pattern
There is a basic pattern to building a constraint system. The pattern is one of composing "gadgets". Within each gadget there is also a basic pattern to follow, which we used on the previous page.
The pattern of function composition is invaluable in traditional programming. The "gadget" pattern plays an analogous role in constraint composition. When calling a function, we wish to provide the inputs and receive the outputs, without regard for how the function manages to yield the outputs given the inputs. Likewise, when proving a function, we wish to provide the oracles holding the inputs, and receive the oracles holding the outputs, without regard for what constraints must be in place to enforce correctness. To do this, we create a function that accepts a constraint system builder, the input oracles, any necessary metadata, and returns the output oracle(s). This is the gadget pattern.
Throughout the Binius circuit examples, you can spot the gadget pattern, and how it lets us build modular, composable constraint systems. While the gadget pattern is a fundamental pattern to follow, within gadgets there is another basic pattern to follow. The three subsections in this section explain this gadget-internal pattern.
Section Directory
This section contains the following subsections:
- Declaring Columns: To have columns they must first be declared.
- Populating Columns: To make columns available for proving, the prover must populate them with values.
- Constraining Columns: To impose ensure columns represent what the prover claims, we must impose constraints on them.