Straight-line programs #
A program is a topologically ordered sequence of gates. Each Line records an
operation and its argument wires. The gate-count index ensures that wires refer
only to original inputs or earlier gates.
This file defines
- lines, their evaluation and depth, and
Line.mapWirestogether with the transport lemmasLine.eval_mapWiresandLine.eval_mapRenaming; - programs, their evaluation
Program.eval, the input-and-gate valuationProgram.trace, gate depths, and the bounded-fan-in predicateProgram.FanInAtMost; - folds over program lines in execution order (
Program.foldl) and reverse execution order (Program.foldr), withProgram.foldl_relandProgram.foldr_relfor proving that the steps preserve a relation between accumulators; - the scalar views
Program.gateFunctionandProgram.wireFunction, and the widened line collectionProgram.lineswithProgram.lines_eval.
Evaluation of lines and programs commutes with homomorphisms
(Line.map_eval, Program.map_eval, Program.map_trace).
One gate together with the wires supplying its arguments.
- op : σ.Op
The operation performed by the gate.
The wire supplying each argument of the operation.
Instances For
Apply a function to every wire read by a line.
Instances For
Fold the lines from the first gate to the last. The step accepts a line at any gate count, retaining its original bound on references to previous gates.
Instances For
Two left folds preserve a relation if their initial accumulators are related and each pair of steps preserves it. For example, use equality or an order relation.
Fold the lines from the last gate to the first. Each line retains its original bound on references to previous gates, and the step receives the line before the accumulator.
Instances For
Two right folds preserve a relation if their initial accumulators are related and each pair of steps preserves it.
Bounded fan-in is decidable for every concrete program.
Evaluate a line from the values of the inputs and preceding gates.
Instances For
Mapping a line's wires preserves evaluation when the new valuation agrees with the old valuation along the map. The source and target input namespaces may differ.
Specialization of Line.eval_mapWires to an input-fixing wire renaming.
Evaluating a line commutes with a homomorphism.
Evaluate every gate in a program, in program order.
Instances For
Evaluating a program commutes with a homomorphism.
The value of every input and gate wire.
Instances For
Evaluating every input and gate wire commutes with a homomorphism.
The scalar function computed by an internal gate.
Instances For
The scalar function carried by an input or internal-gate wire.
Instances For
A widened line evaluates to the value of its corresponding program gate.
A valuation satisfying every gate equation is the program's evaluation.