Shared pattern tables #
A Boolean matrix is synthesized by sharing its column patterns across rows. The leading cost is one OR per selected pattern; input tests and the pattern bank are built only once. This is the elementary table construction used in the sparse and partial-function specializations of local coding.
Binary numbering of all assignments to width input bits.
Equations
Instances For
Column index selected by the first k input bits.
Equations
- Complexity.CircuitSparseSynthesis.Internal.columnAt x = (Complexity.CircuitSparseSynthesis.Internal.assignmentIndex k) fun (i : Fin k) => x (Fin.castAdd l i)
Instances For
Row index selected by the remaining l input bits.
Equations
- Complexity.CircuitSparseSynthesis.Internal.rowAt x = (Complexity.CircuitSparseSynthesis.Internal.assignmentIndex l) fun (i : Fin l) => x (Fin.natAdd k i)
Instances For
@[simp]
theorem
Complexity.CircuitSparseSynthesis.Internal.matrixInput_rowAt_columnAt
{k l : ℕ}
(x : Fin (k + l) → Bool)
:
def
Complexity.CircuitSparseSynthesis.Internal.rowDomain
{k l : ℕ}
(domain : Finset (Fin (k + l) → Bool))
(r : Fin (2 ^ l))
:
Columns of one row whose corresponding inputs belong to the domain.
Equations
- Complexity.CircuitSparseSynthesis.Internal.rowDomain domain r = {c : Fin (2 ^ k) | Complexity.CircuitSparseSynthesis.Internal.matrixInput r c ∈ domain}
Instances For
Shared equality tests for every column and row index.
Equations
- Complexity.CircuitSparseSynthesis.Internal.matrixMinterm (Sum.inl c) = fun (x : Cslib.BitString (k + l)) => decide (Complexity.CircuitSparseSynthesis.Internal.columnAt x = c)
- Complexity.CircuitSparseSynthesis.Internal.matrixMinterm (Sum.inr r) = fun (x : Cslib.BitString (k + l)) => decide (Complexity.CircuitSparseSynthesis.Internal.rowAt x = r)
Instances For
theorem
Complexity.CircuitSparseSynthesis.Internal.matrixMinterms_synthesis
(k l : ℕ)
:
Cslib.Circuits.Synthesis Cslib.Circuits.Boolean.interpretation (Cslib.Circuits.inputs (k + l)) (Set.range matrixMinterm)
((2 ^ k + 2 ^ l) * (2 * (k + l) + 1))
theorem
Complexity.CircuitSparseSynthesis.Internal.pattern_synthesis
{k l : ℕ}
(pattern : Fin (2 ^ k) → Bool)
:
theorem
Complexity.CircuitSparseSynthesis.Internal.matrix_synthesis
{k l : ℕ}
{B : Type}
[Fintype B]
(patterns : B → Fin (2 ^ k) → Bool)
(patternSize : ℕ)
(small : ∀ (b : B), {c : Fin (2 ^ k) | patterns b c = true}.card ≤ patternSize)
(count : Fin (2 ^ l) → ℕ)
(chosen : (row : Fin (2 ^ l)) → Fin (count row) → B)
:
Cslib.Circuits.Synthesis Cslib.Circuits.Boolean.interpretation (Cslib.Circuits.inputs (k + l))
{fun (x : Fin (k + l) → Bool) =>
decide (∃ (j : Fin (count (rowAt x))), patterns (chosen (rowAt x) j) (columnAt x) = true)}
((2 ^ k + 2 ^ l) * (2 * (k + l) + 1) + Fintype.card B * (patternSize + 1) + ∑ row : Fin (2 ^ l), count row + 3 * 2 ^ l + 1)