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)
:
Constants cost one gate.
theorem
Cslib.Circuits.Synthesis.not
{n : ℕ}
{s : Set (Boolean.BooleanFunction n)}
{a : ℕ}
{f : Boolean.BooleanFunction n}
(h : Synthesis Boolean.interpretation s {f} a)
:
Apply negation to a synthesized function.
theorem
Cslib.Circuits.Synthesis.and
{n : ℕ}
{s : Set (Boolean.BooleanFunction n)}
{a b : ℕ}
{f g : Boolean.BooleanFunction n}
(hf : Synthesis Boolean.interpretation s {f} a)
(hg : Synthesis Boolean.interpretation s {g} b)
:
Binary conjunction costs one gate beyond its arguments.
theorem
Cslib.Circuits.Synthesis.or
{n : ℕ}
{s : Set (Boolean.BooleanFunction n)}
{a b : ℕ}
{f g : Boolean.BooleanFunction n}
(hf : Synthesis Boolean.interpretation s {f} a)
(hg : Synthesis Boolean.interpretation s {g} b)
:
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 : ∀ i ∈ indices, Synthesis Boolean.interpretation s {f i} (cost i))
:
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 : ∀ i ∈ indices, Synthesis Boolean.interpretation s {f i} (cost i))
:
Conjoin a finite family of functions. The extra gate supplies the empty conjunction.