Documentation

Cslib.Computability.Circuit.Boolean.Synthesis

Boolean synthesis #

The generic synthesis rules specialize to the De Morgan basis: constants, negation, conjunction, and disjunction. Finite conjunctions and disjunctions use the generic fold bound, and synthesis_minterm combines literals to test a specified tuple of input bits.

theorem Cslib.Circuits.Synthesis.const {n : } {s : Set (Boolean.BooleanFunction n)} (value : Bool) :
Synthesis Boolean.interpretation s {fun (x : Fin nBool) => value} 1

Constants cost one gate.

Apply negation to a synthesized function.

Binary conjunction costs one gate beyond its arguments.

Binary disjunction costs one gate beyond its arguments.

theorem Cslib.Circuits.Synthesis.exists_mem {n : } {ι : Type u} {s : Set (Boolean.BooleanFunction n)} (indices : Finset ι) (f : ιBoolean.BooleanFunction n) (cost : ι) (h : iindices, Synthesis Boolean.interpretation s {f i} (cost i)) :
Synthesis Boolean.interpretation s {fun (x : Fin nBool) => decide (∃ iindices, f i x = true)} (iindices, (cost i + 1) + 1)

Disjoin a finite family of functions. The extra gate supplies the empty disjunction.

theorem Cslib.Circuits.Synthesis.forall_mem {n : } {ι : Type u} {s : Set (Boolean.BooleanFunction n)} (indices : Finset ι) (f : ιBoolean.BooleanFunction n) (cost : ι) (h : iindices, Synthesis Boolean.interpretation s {f i} (cost i)) :
Synthesis Boolean.interpretation s {fun (x : Fin nBool) => decide (∀ iindices, f i x = true)} (iindices, (cost i + 1) + 1)

Conjoin a finite family of functions. The extra gate supplies the empty conjunction.

theorem Cslib.Circuits.Boolean.synthesis_minterm {n k : } (wires : Fin kFin n) (value : Fin kBool) :
Synthesis interpretation (inputs n) {fun (x : Fin nBool) => decide ((fun (i : Fin k) => x (wires i)) = value)} (2 * k + 1)

A conjunction testing a specified tuple of input bits.