Transforming circuits line by line #
Program.mapLines f replaces every line of a program by its image under f, a map of lines over
one signature to lines over another that keeps the number of earlier gates, so the program keeps
its shape and its size. If f keeps the value of every line, the transformed program computes the
same gate values (Program.eval_mapLines), and if f never makes a line deeper, no gate becomes
deeper (Program.depths_mapLines_le); if it keeps the depth of every line, it keeps the depth of
every gate (Program.depths_mapLines). Translating the operations along a map of signatures
(Program.mapOp) is the special case changing only the operations; removing repeated arguments
of idempotent gates is another.
Main definitions #
Cslib.Circuits.Program.mapLines,Cslib.Circuits.Circuit.mapLines: the program or circuit with every line transformed.
Main results #
Cslib.Circuits.Program.eval_mapLines,Cslib.Circuits.Circuit.eval_mapLines: transforming lines that keep their values keeps the function computed. Their_atvariants need the line condition only at the given input, permitting interpretations with fixed context.Cslib.Circuits.Program.cost_mapLines: transforming lines with matching operation costs preserves total program cost.Cslib.Circuits.Program.depths_mapLines_le,Cslib.Circuits.Circuit.depth_mapLines_le: transforming lines that get no deeper keeps the depth bounded.Cslib.Circuits.Program.depths_mapLines,Cslib.Circuits.Circuit.depth_mapLines: transforming lines that keep their depth keeps the depth.
Transforming lines with matching operation costs preserves total cost.
At a fixed input, preserving every line value preserves every gate value.
Transforming lines that keep their values keeps the value of every gate.
At a fixed input, preserving every line value preserves every output value.
Transforming lines that keep their values keeps the function computed.
Transforming lines that get no deeper makes no gate deeper.
Transforming lines that get no deeper makes no wire deeper.
Transforming lines that get no deeper keeps the depth bounded.
Transforming lines that keep their depth keeps the depth of every gate.
Transforming lines that keep their depth keeps the depth of every wire.
Transforming lines that keep their depth keeps the depth of every output.
Transforming lines that keep their depth keeps the depth.