Gate inputization and projection-aware deduplication #
For a multi-output function g : (Fin n → U) → Fin k → U, the non-input components
nonInputComponents g are the distinct functions fun x => g x j that are not input projections
fun x => x i. Their number is the exact complexity of g whenever g lists the wire
functions of a program, and it is the price of computing g alongside any other function f:
- in every circuit computing
g(alongsidef), each non-input component is the function of some gate, because an output computing it cannot be an input wire; distinct functions are computed by distinct gates, so there are at least as many such gates as non-input components; - turning those gates into extra inputs, which carry the values
g x, leaves a circuit computingffromxandg x. So computinggandftogether costs at least#(nonInputComponents g) + C(f | g); - conversely, a program whose gate functions are components of
gcan be rebuilt with one gate per distinct non-projection gate function (Program.exists_irredundant_ne_input), which bounds the complexity ofgfrom above.
Repeated components are counted once and components that are input projections are not counted, since an output wire may be an input wire and designating outputs is free.
Main definitions #
Cslib.Circuits.nonInputComponents: the distinct components ofgthat are not input projections.Cslib.Circuits.Program.componentGates: the gates of a program computing a component ofg.
Main results #
Cslib.Circuits.Circuit.nonInputComponents_subset_image_componentGates,Cslib.Circuits.Circuit.card_nonInputComponents_le_card_componentGates: in a circuit whose outputs includeg, every non-input component ofgis the function of a component gate, so there are at least as many component gates as non-input components.Cslib.Circuits.Circuit.card_nonInputComponents_add_ecomplexityGiven_le,Cslib.Circuits.card_nonInputComponents_add_ecomplexityGiven_le: inputization,#(nonInputComponents g) + C(f | g) ≤ C(g, f).Cslib.Circuits.card_nonInputComponents_le_ecomplexity: the lower bound#(nonInputComponents g) ≤ C(g).Cslib.Circuits.ecomplexity_le_card_nonInputComponents,Cslib.Circuits.ecomplexity_eq_card_nonInputComponents,Cslib.Circuits.ecomplexity_eval_eq_card_nonInputComponents: whenglists wire functions of a program covering its gates,C(g) = #(nonInputComponents g).Cslib.Circuits.ecomplexity_append_eq_card_nonInputComponents_add_ecomplexityGiven: thenC(g, f) = #(nonInputComponents g) + C(f | g)for everyf.Cslib.Circuits.card_nonInputComponents_eq: pairwise distinct components, none a projection, are all counted.
References #
These are library generalizations, to arbitrary signatures and interpretations, of
Ilango, Loff and Oliveira, Proposition 14 (pp. 22:21–22:22), where g
lists the gates of De Morgan formulas, and of its use in the proof of Lemma 16 (p. 22:22), where
the gap between the complexities of T • g and of g measures the cost of computing T from the
components of g.
There are at most as many non-input components as components.
When the components of g are pairwise distinct and none is an input projection, all k of
them are counted.
A component gate is a gate whose function is some component of g.
Component gates #
In a circuit whose outputs include every component of g, each non-input component of g is
the function of a gate computing a component of g: an output computing it cannot be an input
wire.
A circuit whose outputs include every component of g has at least as many gates computing
components of g as g has non-input components (Ilango, Loff and
Oliveira, Proposition 14, first statement).
Computing g costs at least one gate for each non-input component of g.
Inputization #
Inputization (generalizing Ilango, Loff and Oliveira,
Proposition 14 and the proof of Lemma 16, p. 22:22). In a circuit computing g followed by f,
the gates computing components of g are at least as many as the non-input components of g, and
the remaining gates compute f from x and g x.
Inputization. Computing g followed by f costs at least one gate for each non-input
component of g, plus the complexity of f given g.
Exact complexity #
When every component of g is a wire function of p and every gate of p that is not an
input projection computes a component of g, computing g costs at most one gate per non-input
component (Ilango, Loff and Oliveira, Proposition 14, second
statement).
When g lists wire functions of p covering every gate of p that is not an input
projection, the complexity of g is its number of non-input components
(Ilango, Loff and Oliveira, Proposition 14).
Computing all gates of a program costs one gate per distinct gate function that is not an input projection.
When computing g costs only its non-input components, computing g followed by f costs
exactly those components plus the complexity of f given g.