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; - 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
Every gate in a program has at most r arguments.
Equations
- Cslib.Circuits.Program.empty.FanInAtMost x✝ = True
- (program.gate line).FanInAtMost x✝ = (program.FanInAtMost x✝ ∧ σ.Arity line.op ≤ x✝)
Instances For
Bounded fan-in is decidable for every concrete program.
Equations
Evaluate a line from the values of the inputs and preceding gates.
Equations
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.
Equations
Instances For
The depth of every gate in a program. Inputs have implicit depth zero.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.Circuits.Program.empty.depths = Fin.elim0
Instances For
The depth of every input or gate wire in a program.
Equations
- p.wireDepths i = Fin.addCases (fun (x : Fin inputCount) => 0) p.depths i
Instances For
Evaluating a program commutes with a homomorphism.
The input values followed by all gate values, in program order.
Equations
- p.trace i✝ x i = Fin.addCases x (p.eval i✝ x) i
Instances For
Evaluating every input and gate wire commutes with a homomorphism.
The scalar function computed by an internal gate.
Equations
- program.gateFunction interpretation gate input = program.eval interpretation input gate
Instances For
The scalar function carried by an input or internal-gate wire.
Equations
- program.wireFunction interpretation wire input = program.trace interpretation input wire
Instances For
The program's lines, each widened to the final wire namespace.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.Circuits.Program.empty.lines = Fin.elim0
Instances For
A widened line evaluates to the value of its corresponding program gate.