Documentation

CslibFrontier.Computability.Circuit.Boolean.Zhegalkin.BlockCols

Internal full-block column encoding and block group-sum synthesis #

Internal block-sum combinators (all_group_subSums) and compressed full-block column helpers (fullBlockEmb, fullRowPattern, FullCol, hasFullCol, fullColVal, matrixTailSet, sum_fullCol_lt_eq, sum_row_eq_fullCol_add_tail) shared by AdditiveBound, StageParts, StageStep, and UpperBound; never re-exported through Zhegalkin.

Main definitions #

Main results #

theorem Cslib.Circuits.all_group_subSums {σ : Signature} {n : ℕ} {G : Type u} [AddCommMonoid G] {I : Interpretation σ G} {w : σ.Op → ℕ} {addOp : σ.Op} {k width : ℕ} (hw : 0 < width) (hArity : σ.Arity addOp = 2) (hEval : ∀ (args : Fin (σ.Arity addOp) → G), I addOp args = args ⟨0, ⋯⟩ + args ⟨1, ⋯⟩) (hZeroW : w addOp = 0) {s : Set ((Fin n → G) → G)} (v : Fin k → (Fin n → G) → G) (hv : ∀ (j : Fin k), v j ∈ s) :
CostSynthesis I w s {f : (Fin n → G) → G | ∃ (q : ℕ) (T : Finset (Fin k)), T.Nonempty ∧ (∀ j ∈ T, ↑j / width = q) ∧ f = fun (x : Fin n → G) => ∑ j ∈ T, v j x} (k * 2 ^ width / width) 0

All nonempty subset sums within each width-width block of v : Fin k → (Fin n → G) → G cost at most (k * 2 ^ width) / width binary addition gates.

def Cslib.Circuits.Additive.fullBlockEmb {n s : ℕ} (q : Fin (n / s)) :
Fin s ↪ Fin n

Injects within-block index a : Fin s into block q's global column index in Fin n.

theorem Cslib.Circuits.Additive.fullBlockEmb_div {n s : ℕ} (q : Fin (n / s)) (a : Fin s) :
↑((fullBlockEmb q) a) / s = ↑q
def Cslib.Circuits.Additive.fullRowPattern {m n : ℕ} (A : Matrix (Fin m) (Fin n) Bool) (s : ℕ) (r : Fin m) (q : Fin (n / s)) :

Subset of Fin s where row r of A has true in full width-s block q < n / s.

@[reducible, inline]

Columns of the compressed full-block matrix: pairs (q, T) with q < n / s and T a nonempty subset of Fin s.

@[reducible, inline]
abbrev Cslib.Circuits.Additive.FullCol.block {n s : ℕ} (c : FullCol n s) :
Fin (n / s)

Block index q : Fin (n / s) selected by full-block column c.

@[reducible, inline]

Nonempty set of local offsets within c.block selected by full-block column c.

def Cslib.Circuits.Additive.hasFullCol {m n : ℕ} (A : Matrix (Fin m) (Fin n) Bool) (s : ℕ) (r : Fin m) (c : FullCol n s) :

Boolean indicator that row r of A matches the nonempty full-block column c.

def Cslib.Circuits.Additive.fullColVal {G : Type u_1} [AddCommMonoid G] {n s : ℕ} (c : FullCol n s) (x : Fin n → G) :
G

Sum of inputs selected by the full-block column c under valuation x.

def Cslib.Circuits.Additive.matrixTailSet {m n : ℕ} (A : Matrix (Fin m) (Fin n) Bool) (s : ℕ) (r : Fin m) :

Trailing active column indices j of row r with j / s = n / s.

theorem Cslib.Circuits.Additive.div_eq_of_mem_matrixTailSet {m n : ℕ} {A : Matrix (Fin m) (Fin n) Bool} {s : ℕ} {r : Fin m} {j : Fin n} (hj : j ∈ matrixTailSet A s r) :
↑j / s = n / s
theorem Cslib.Circuits.Additive.sum_fullCol_lt_eq {G : Type u_1} [AddCommMonoid G] {m K s Q : ℕ} (A : Matrix (Fin m) (Fin K) Bool) (hs : 0 < s) (hQ : Q ≤ K / s) (r : Fin m) (v : Fin K → G) :
∑ c : FullCol K s with decide (↑c.block < Q ∧ fullRowPattern A s r c.block = c.subset) = true, fullColVal c v = ∑ j : Fin K with ↑j / s < Q ∧ A r j = true, v j
theorem Cslib.Circuits.Additive.sum_row_eq_fullCol_add_tail {G : Type u_1} [AddCommMonoid G] {m n : ℕ} (A : Matrix (Fin m) (Fin n) Bool) {s : ℕ} (hs : 0 < s) (r : Fin m) (x : Fin n → G) :
(∑ j : Fin n, if A r j = true then x j else 0) = ∑ c : FullCol n s with hasFullCol A s r c = true, fullColVal c x + ∑ j ∈ matrixTailSet A s r, x j