Depth of composed circuits #
Continuing a program does not change the depths of its wires (Program.wireDepths_append_castAdd),
and the wires of the continuation are at most as deep as in the continuation alone, plus the depth
of the wires feeding it (Program.wireDepths_append_appendedWire_le). So sequential composition
adds depths (Circuit.depth_comp_le) and parallel composition takes their maximum
(Circuit.depth_append_le).
Main results #
Cslib.Circuits.Program.wireDepths_append_castAdd,Cslib.Circuits.Program.wireDepths_append_appendedWire_le: depths in a continued program.Cslib.Circuits.Circuit.depth_comp_le:depth (d.comp c) ≤ depth d + depth c.Cslib.Circuits.Circuit.depth_append_le:depth (c.append d) ≤ max (depth c) (depth d).Cslib.Circuits.Circuit.depthWith_comp_le,Cslib.Circuits.Circuit.depthWith_append_le: the same for depths with costs.
theorem Cslib.Circuits.Program.wireDepthsWith_append_appendedWire_le {σ : Signature} {n k g₁ g₂ : ℕ} (P : Program σ n g₁) (feed : Fin k → Wire n g₁) (cost : σ.Op → ℕ) {D : ℕ} (hD : ∀ (i : Fin k), wireDepthsWith cost P (feed i) ≤ D) (q : Program σ k g₂) (w : Wire k g₂) :
With costs, a wire of the continuation is at most as deep as in the continuation alone, plus the depth of the wires feeding it.
theorem Cslib.Circuits.Program.wireDepths_append_appendedWire_le {σ : Signature} {n k g₁ g₂ : ℕ} (P : Program σ n g₁) (feed : Fin k → Wire n g₁) {D : ℕ} (hD : ∀ (i : Fin k), P.wireDepths (feed i) ≤ D) (q : Program σ k g₂) (w : Wire k g₂) :
A wire of the continuation is at most as deep as in the continuation alone, plus the depth of the wires feeding it.