Batched table lookup with one sort #
A fixed table is hardwired into one source record per address. Query addresses are input wires; queries and padding are destination records. Sort once, broadcast matching source values, and reverse the saved sorting decisions on the values alone. Selecting the original request positions then returns the answers in input order, including repeated addresses. No request identifiers or restoration ranks are used. Empty keys, empty values, and zero requests are allowed.
The circuit uses CSLib's native Circuit representation. Input preparation shares exactly two
constant gates, including when one or both are unused. The exact weighted cost and total gate count
include these constants; the polynomial gate bound does not certify constructor runtime.
Main definitions #
Cslib.Circuits.Boolean.batchLookupCircuit: lookup with inferred sorting depth and padding.Cslib.Circuits.Boolean.batchLookupCircuit.withPadding: lookup with a supplied record count.
Main results #
Cslib.Circuits.Boolean.eval_batchLookupCircuit: arbitrary repeated queries are answered exactly.Cslib.Circuits.Boolean.batchLookupCircuit.size_withPadding: exact total gate count.Cslib.Circuits.Boolean.size_batchLookupCircuit_le: a bound linear in table size plus request count and field width, and quadratic in sorting depth.
References #
Simplifies the nonuniform lookup construction in S. Schlesinger, Boolean circuit mass production formalization, using the sorting network of K. E. Batcher, Sorting Networks and Their Applications.
Batched lookup using a specified power-of-two record count and padding.
Instances For
Input preparation adds exactly two shared constant gates to the routing cost.
Exact total gate count, including all constants and negations.
A factored gate bound, linear in record count and field width and quadratic in depth.
The least sorting depth accommodating all requests and one source per address.
Instances For
The number of unused destinations filling the next power-of-two record count.
Instances For
The canonical padding fills its sorting network exactly.
Look up all input addresses in one hardwired table, preserving request order. Padding and sorting depth are inferred from the number of requests and the key width.
Instances For
Batched lookup uses at most the displayed bound in table size plus request count. This bounds circuit gates, not the running time of the circuit constructor.
Independent applications of any fixed table admit a shared lookup circuit.