Evaluation of circuit codes #
The signature and interpretation are arbitrary. Gate lists are evaluated in program order, appending one value per gate. Missing arguments and out-of-range wire indices read a supplied default. This total semantics agrees with typed circuit evaluation on actual circuit codes. Runtime certificates belong to the interpretation-specific modules.
Main definitions #
evalCode: total evaluation of a gate list.
Main results #
length_evalCode,prefix_evalCode: the evaluator appends one value per gate.getD_evalCode: gate equations on well-formed codes.Program.evalCode_code: the input values followed by the complete program trace.Circuit.eval_eq_getD: typed circuit outputs are lookups in that trace.
These are original implementation lemmas for the existing circuit semantics.
Evaluate the list of gates gates on the input values x: start from x and append the value
of each gate in turn, reading wire i at position i of the values computed so far. An argument
missing from a gate, or a wire not yet computed, reads d; on the code of a program neither
happens (Program.evalCode_code).
Instances For
Evaluating an empty gate list returns the initial wire values unchanged.
Evaluating a concatenation of gate lists evaluates the second list starting from the wire values produced by the first.
The value of a gate of a well-formed gate list is its operation applied to the values of its arguments.
Evaluation through the code. On the code of a program, evalCode lists the inputs and then
the values of the gates.
Evaluation through the code. Output j of a circuit is the value at the number of its
output wire after evaluating the gate list.