CSLib De Morgan circuits as Complexitylib circuits #
CSLib's circuit model (Cslib.Circuits.Circuit) is a straight-line program
over a signature, with designated output wires. Its De Morgan basis
(Cslib.Circuits.Boolean.signature) has constants, negation, and binary
conjunction and disjunction, and every gate counts toward size. A circuit
carries its gate count as the field size.
A CSLib wire (Cslib.Circuits.Wire N g) is either an input Wire.input i or
a gate Wire.gate j. Our circuits number their wires Fin (N + g), the inputs
first and gate j driving wire N + j, which is exactly CSLib's numbering
Wire.index. This file translates a CSLib De Morgan circuit gate for gate into
a fan-in-two AND/OR circuit over Basis.andOr2, whose negations are free:
- a negation
¬wbecomes¬w ∧ ¬w; - a constant becomes
x₀ ∧ ¬x₀orx₀ ∨ ¬x₀on the first input; - conjunction and disjunction are unchanged;
- an output wire
wbecomes the output gatew ∧ w.
So the translated circuit has exactly the CSLib circuit's gates as internal gates, plus one output gate per output.
Main definitions #
Complexity.Circuit.ofCslibGate— the gate simulating one CSLib lineComplexity.Circuit.ofCslib— the circuit simulating a CSLib circuit
The first input wire, read by the gates simulating constants.
Equations
Instances For
The fan-in-two AND/OR gate computing a CSLib De Morgan line.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The gate simulating a line reads only the first input and the line's own wires.
The fan-in-two AND/OR circuit simulating a CSLib De Morgan circuit. Its
internal gates are the CSLib circuit's gates, and output j is the gate
w ∧ w on CSLib's output wire w.
Equations
- One or more equations did not get rendered due to their size.