Documentation

CslibFrontier.Computability.Circuit.DecomposableGates

Decomposable gates #

The gates of a chosen kind in a straight-line program are decomposable when distinct arguments of each of them are reached by disjoint sets of inputs (Cslib.Circuits.Program.wireSupport). This is a syntactic condition on the program. For the AND gates of a Boolean circuit it is the decomposability of d-DNNFs and of deterministic decomposable circuits Monet and Olteanu, Definition 3, and for the multiplications of an arithmetic circuit it is syntactic multilinearity.

The condition is stated gate by gate on the lines of the program (Cslib.Circuits.Program.lines), so it is decidable, and it splits along the last gate (Cslib.Circuits.Program.isDecomposableAt_gate_iff).

When a program q reads its inputs from wires with given supports S, as it does after being appended to another program (Cslib.Circuits.Program.append), its decomposability is measured on those supports (Cslib.Circuits.Program.DecomposesOver): the support of a wire of q is the union of the supports S i of the inputs i reaching it (Cslib.Circuits.Program.wireSupport_append_appendedWire). Replacing every gate by a circuit (Cslib.Circuits.Program.simulateProgram) keeps the input supports of the original wires (Cslib.Circuits.Program.wireSupport_simulateRenaming) and so keeps a program decomposable when each replacement circuit decomposes over the supports of the arguments it is given (Cslib.Circuits.Program.isDecomposableAt_simulateProgram).

Main definitions #

Main results #

References #

def Cslib.Circuits.Program.IsDecomposableAt {σ : Signature} {n g : ℕ} (p : Program σ n g) (product : σ.Op → Prop) :

The gates of p whose operation satisfies product are decomposable: distinct arguments of each of them are reached by disjoint sets of inputs (Program.wireSupport). For Boolean AND gates this is the decomposability of d-DNNFs and d-Ds, and for multiplications of arithmetic circuits it is syntactic multilinearity.

Instances For
    @[instance_reducible]
    instance Cslib.Circuits.instDecidableIsDecomposableAtOfDecidablePredOp {σ : Signature} {n g : ℕ} (p : Program σ n g) (product : σ.Op → Prop) [DecidablePred product] :
    @[simp]

    The empty program is decomposable.

    Programs reading inputs with given supports #

    def Cslib.Circuits.Program.DecomposesOver {σ : Signature} {n g k : ℕ} (q : Program σ k g) (product : σ.Op → Prop) (S : Fin k → Finset (Fin n)) :

    The gates of q whose operation satisfies product are decomposable when each input i of q has the support S i: distinct arguments of each of them are reached by disjoint unions of input supports. With singleton supports this is Program.IsDecomposableAt.

    @[simp]
    theorem Cslib.Circuits.Program.decomposesOver_empty {σ : Signature} {n k : ℕ} (product : σ.Op → Prop) (S : Fin k → Finset (Fin n)) :

    The empty program decomposes over any supports.

    @[simp]
    theorem Cslib.Circuits.Program.decomposesOver_gate_iff {σ : Signature} {n g k : ℕ} (q : Program σ k g) (line : Line σ k g) (product : σ.Op → Prop) (S : Fin k → Finset (Fin n)) :
    (q.gate line).DecomposesOver product S ↔ q.DecomposesOver product S ∧ (product line.op → Pairwise fun (a b : Fin (σ.Arity line.op)) => Disjoint ((q.wireSupport (line.wires a)).biUnion S) ((q.wireSupport (line.wires b)).biUnion S))

    A program with one more gate decomposes over S when the earlier gates do and, if the new gate is of the given kind, its distinct arguments are reached by disjoint unions of input supports.

    theorem Cslib.Circuits.Program.isDecomposableAt_iff_decomposesOver {σ : Signature} {n g : ℕ} (p : Program σ n g) (product : σ.Op → Prop) :
    p.IsDecomposableAt product ↔ p.DecomposesOver product fun (i : Fin n) => {i}

    Decomposability is decomposability over the singleton supports {i} of the inputs.

    @[simp]
    theorem Cslib.Circuits.Program.isDecomposableAt_gate_iff {σ : Signature} {n g : ℕ} (p : Program σ n g) (line : Line σ n g) (product : σ.Op → Prop) :
    (p.gate line).IsDecomposableAt product ↔ p.IsDecomposableAt product ∧ (product line.op → Pairwise fun (a b : Fin (σ.Arity line.op)) => Disjoint (p.wireSupport (line.wires a)) (p.wireSupport (line.wires b)))

    A program with one more gate is decomposable when the earlier gates are and, if the new gate is of the given kind, its distinct arguments are reached by disjoint sets of inputs.

    theorem Cslib.Circuits.Program.trace_supportInterpretation {σ : Signature} {n g k : ℕ} (q : Program σ k g) (S : Fin k → Finset (Fin n)) (w : Wire k g) :

    The support interpretation of a program run on any input supports S unions the supports of the inputs reaching each wire.

    @[simp]
    theorem Cslib.Circuits.Program.wireSupport_append_castAdd {σ : Signature} {n g k m : ℕ} (p : Program σ n g) (feed : Fin k → Wire n g) (q : Program σ k m) (w : Wire n g) :

    The wires of p keep their supports after p is continued.

    theorem Cslib.Circuits.Program.wireSupport_append_appendedWire {σ : Signature} {n g k m : ℕ} (p : Program σ n g) (feed : Fin k → Wire n g) (q : Program σ k m) (w : Wire k m) :
    (p.append feed q).wireSupport (appendedWire feed w) = (q.wireSupport w).biUnion fun (i : Fin k) => p.wireSupport (feed i)

    A wire of q, continuing p, is reached by the inputs reaching the wires of p that feed the inputs of q reaching it.

    theorem Cslib.Circuits.Program.isDecomposableAt_append_iff {σ : Signature} {n g k m : ℕ} (p : Program σ n g) (feed : Fin k → Wire n g) (q : Program σ k m) (product : σ.Op → Prop) :
    (p.append feed q).IsDecomposableAt product ↔ p.IsDecomposableAt product ∧ q.DecomposesOver product fun (i : Fin k) => p.wireSupport (feed i)

    Decomposability of a continued program. Continuing p by q gives a decomposable program exactly when p is decomposable and q decomposes over the supports of the wires feeding it.

    Simulation #

    theorem Cslib.Circuits.Program.wireSupport_simulateRenaming {σ : Signature} {n g : ℕ} {τ : Signature} (p : Program σ n g) (impl : (op : σ.Op) → Circuit τ (σ.Arity op) 1) (h : ∀ (op : σ.Op), (impl op).Computes (supportInterpretation τ n) (single (supportInterpretation σ n op))) (w : Wire n g) :

    Replacing every gate by a circuit that, as a function of input supports, unions the supports of all its arguments keeps the support of every original wire.

    theorem Cslib.Circuits.Program.isDecomposableAt_simulateProgram {σ : Signature} {n g : ℕ} {τ : Signature} (p : Program σ n g) (impl : (op : σ.Op) → Circuit τ (σ.Arity op) 1) {product : σ.Op → Prop} {product' : τ.Op → Prop} (hsupport : ∀ (op : σ.Op), (impl op).Computes (supportInterpretation τ n) (single (supportInterpretation σ n op))) (himpl : ∀ (op : σ.Op) (S : Fin (σ.Arity op) → Finset (Fin n)), (product op → Pairwise fun (a b : Fin (σ.Arity op)) => Disjoint (S a) (S b)) → (impl op).program.DecomposesOver product' S) (hp : p.IsDecomposableAt product) :

    Simulation keeps programs decomposable. Replace every gate of a program decomposable at product by a circuit that unions the supports of all its arguments. If each replacement circuit decomposes at product' over any supports of its arguments, pairwise disjoint when the replaced gate is of kind product, then the simulated program is decomposable at product'.