Shared OR lookup over dynamic records #
Sources supply keys and value fields; queries supply keys. One source array serves every query, including repeated queries. A query receives the bitwise OR of all matching source values; missing keys receive zero. The circuit sorts once and reverses saved swaps on the answer fields, so it needs neither request identifiers nor a second sort.
Inputs are ordinary variables or Boolean constants, using the existing substitute interface.
All constants and negations are charged. Input preparation uses two shared constant gates even
when unused. Sources, queries, keys, and values may all be empty. Padding records are destinations
and cannot introduce a spurious source. These gate bounds do not certify constructor runtime.
Main definitions #
Cslib.Circuits.Boolean.batchOrCircuit: shared OR lookup with automatic padding.Cslib.Circuits.Boolean.batchOrCircuit.withPadding: the same construction with supplied padding.
Main results #
Cslib.Circuits.Boolean.eval_batchOrCircuit_iff: exact matching-source semantics.Cslib.Circuits.Boolean.batchOrCircuit.cost_program_withPadding: arbitrary weighted cost.Cslib.Circuits.Boolean.batchOrCircuit.size_withPadding: exact gate count.Cslib.Circuits.Boolean.size_batchOrCircuit_le: a factored bound for canonical padding.
References #
Simplifies MassProduction/Nonuniform/BatchOrCircuit.lean in S. Schlesinger, Boolean circuit mass production formalization.
Symbolic request records, source records, and padding destinations.
Instances For
Flatten symbolic records into variables and constants for the padded network.
Instances For
The original position of a request in the padded layout.
Instances For
Select the values at the original request positions by free wiring.
Instances For
Shared OR lookup with a supplied power-of-two record count.
Instances For
A query bit is true exactly when some matching source bit is true.
Input preparation adds one shared gate for each Boolean constant.
Exact gate count, including constants and negations, independent of the selectors.
A bound linear in the record count and field width, and quadratic in sorting depth.
The least sorting depth accommodating the requests and sources; zero records use depth zero.
Instances For
Unused destination slots filling the next power-of-two record count.
Instances For
Padding fills the network exactly, also for an empty batch.
Canonical padding is linear in the total record count, including the empty batch.
Look up bitwise ORs of dynamic source values with automatic padding. Source and query keys may repeat, and absent keys return false.
Instances For
An output bit is true exactly when a matching source bit is true.
Canonical shared OR lookup has linear record-count cost up to the displayed factors. This is a circuit gate bound, not a certificate of constructor runtime.