Documentation

CslibFrontier.Computability.Circuit.CutProgram

Replacing circuit gates with inputs #

Replacing cut gates with extra inputs carrying their original values preserves the full wire trace. The rebuilt program preserves fan-in bounds and realizes the residual wire depths.

Main definitions #

Main results #

def Cslib.Circuits.Program.residualDepths {σ : Signature} {n g : ℕ} :
Program σ n g → Finset (Fin g) → Fin g → ℕ

Gate depths of p after turning every gate in cut into a depth-0 input.

def Cslib.Circuits.Program.residualWireDepths {σ : Signature} {n g : ℕ} (p : Program σ n g) (cut : Finset (Fin g)) :
Wire n g → ℕ

Wire depths of p after turning every gate in cut into a depth-0 input.

@[simp]
theorem Cslib.Circuits.Program.residualWireDepths_input {σ : Signature} {n g : ℕ} (p : Program σ n g) (cut : Finset (Fin g)) (i : Fin n) :

Every input wire has residual depth 0.

@[simp]
theorem Cslib.Circuits.Program.residualWireDepths_gateWire {σ : Signature} {n g : ℕ} (p : Program σ n g) (cut : Finset (Fin g)) (j : Fin g) :

Every gate wire's residual depth is given by Program.residualDepths.

theorem Cslib.Circuits.Program.residualWireDepths_gate {σ : Signature} {n g : ℕ} (p : Program σ n g) (cut : Finset (Fin g)) (j : Fin g) :

Gate equation for Program.residualWireDepths: cut gates have residual depth 0, while uncut gates evaluate Line.depth over residualWireDepths (charging 1 to 0-ary gates).

@[simp]

With an empty cut, residualWireDepths agrees identically with Program.wireDepths.

theorem Cslib.Circuits.Program.exists_cutProgram {σ : Signature} {n g : ℕ} (p : Program σ n g) (cut : Finset (Fin g)) :
∃ (q : Program σ (n + cut.card) (g - cut.card)) (wireMap : Wire n g → Wire (n + cut.card) (g - cut.card)) (cutGate : Fin cut.card → Fin g), (∀ (i : Fin cut.card), cutGate i ∈ cut) ∧ (∀ (r : ℕ), p.FanInAtMost r → q.FanInAtMost r) ∧ (∀ (w : Wire n g), q.wireDepths (wireMap w) = p.residualWireDepths cut w) ∧ (∀ (k : Fin (g - cut.card)), ∃ (j : Fin g), wireMap (Wire.gate j) = Wire.gate k) ∧ ∀ {U : Type u_1} (I : Interpretation σ U) (x : Fin n → U) (w : Wire n g), q.trace I (Fin.append x fun (i : Fin cut.card) => p.eval I x (cutGate i)) (wireMap w) = p.trace I x w

Turning the gates in cut into cut.card extra inputs yields a program of g - cut.card gates with the same bounded fan-in, wire depths equal to p.residualWireDepths cut, and identical traces on Fin.append x (cut gate values).