Documentation

CslibFrontier.Computability.Circuit.Boolean.Word.Rewire

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 #

theorem Cslib.Circuits.Boolean.wordWires_subset_iff {n w : ℕ} {s : Set (BooleanFunction n)} {a : BitString n → BitVec w} :
wordWires a ⊆ s ↔ ∀ (i : Fin w), (fun (x : BitString n) => (a x).getLsbD ↑i) ∈ s

A word is available exactly when each of its bits is.

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_ushiftRight_subset {n w : ℕ} {s : Set (BooleanFunction n)} {k : ℕ} {g : BitString n → BitVec w} (hg : wordWires g ⊆ s) (hz : (fun (x : BitString n) => false) ∈ s) :
(wordWires fun (x : BitString n) => g x >>> k) ⊆ s

A logical right shift only rewires bits.

theorem Cslib.Circuits.Boolean.wordWires_shiftLeft_subset {n w : ℕ} {s : Set (BooleanFunction n)} {k : ℕ} {g : BitString n → BitVec w} (hg : wordWires g ⊆ s) (hz : (fun (x : BitString n) => false) ∈ s) :
(wordWires fun (x : BitString n) => g x <<< k) ⊆ s

A left shift only rewires bits.

theorem Cslib.Circuits.Boolean.wordWires_ofBool {n : ℕ} {s : Set (BooleanFunction n)} {f : BooleanFunction n} (hf : f ∈ s) :
(wordWires fun (x : BitString n) => BitVec.ofBool (f x)) ⊆ 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) :

Masking a word by an available bit costs one conjunction per bit.