Rewiring words over the De Morgan basis #
Shifts, truncations, zero extensions, and one-bit words only rewire bits. If a word's bits are
available, then so are the bits of these derived words, once the false constant is available.
No gates are needed. Masking a word by one available bit costs one conjunction per bit.
Main results #
Cslib.Circuits.Boolean.wordWires_subset_iff: available words in the bitwise form used bySynthesis.word_add.Cslib.Circuits.Boolean.wordWires_subset_of_forall: a word whose bits arefalseor bits of an available word is available.Cslib.Circuits.Boolean.wordWires_ushiftRight_subset,Cslib.Circuits.Boolean.wordWires_shiftLeft_subset,Cslib.Circuits.Boolean.wordWires_ofBool: shifts and one-bit words.Cslib.Circuits.Synthesis.word_mask: masking by an available bit, one gate per bit.
theorem Cslib.Circuits.Boolean.wordWires_subset_of_forall {n v w : ℕ} {s : Set (BooleanFunction n)} {f : BitString n → BitVec v} {g : BitString n → BitVec w} (hg : wordWires g ⊆ s) (hz : (fun (x : BitString n) => false) ∈ s) (h :
∀ (i : Fin v),
(∀ (x : BitString n), (f x).getLsbD ↑i = false) ∨ ∃ (j : Fin w), ∀ (x : BitString n), (f x).getLsbD ↑i = (g x).getLsbD ↑j) :
wordWires f ⊆ s
A word each of whose bits is constantly false or a fixed bit of an available word is
available, provided false is.
theorem Cslib.Circuits.Boolean.wordWires_ofBool {n : ℕ} {s : Set (BooleanFunction n)} {f : BooleanFunction n} (hf : f ∈ s) :
An available bit is an available one-bit word.
theorem Cslib.Circuits.Synthesis.word_mask {n w : ℕ} {s : Set (BooleanFunction n)} {f : BooleanFunction n} {b : BitString n → BitVec w} (hf : f ∈ s) (hb : Boolean.wordWires b ⊆ s) :
Synthesis Boolean.interpretation s (Boolean.wordWires fun (x : BitString n) => if f x = true then b x else 0) w
Masking a word by an available bit costs one conjunction per bit.