Broadcast circuits for sorted records #
Each record has a retained header followed by a value. Keys and source/destination tags are selected from the header. False tags seed source values; equal-key links carry their bitwise OR forward. When records are sorted by key followed by tag, each destination receives the OR of all matching sources. A unique matching source is therefore copied exactly. All header bits, including routing metadata, are preserved even on unsorted inputs.
Adjacent-key tests are computed once and shared across the value-bit scans. The construction uses native circuit composition, replication and wiring. It allows any record count, repeated keys and selectors, and empty key or value fields. With zero records, each value scan still contains its initial false constant. With zero value width, the shared key-test gates remain. The constructor is executable; its gate bounds do not certify the constructor's running time.
Main definitions #
Cslib.Circuits.Boolean.broadcastCircuit: a full record scan preserving the header.Cslib.Circuits.Boolean.broadcastCircuit.values: scans with arbitrary input selectors.Cslib.Circuits.Boolean.broadcastCircuit.header,Cslib.Circuits.Boolean.broadcastCircuit.value: projections of row-major record fields.
Main results #
Cslib.Circuits.Boolean.eval_broadcastCircuit_header: every header is preserved.Cslib.Circuits.Boolean.eval_broadcastCircuit_value_eq_true_iff: sorted destination semantics.Cslib.Circuits.Boolean.eval_broadcastCircuit_value_of_unique_source: exact source copying.Cslib.Circuits.Boolean.cost_program_broadcastCircuit: exact arbitrary weighted cost.Cslib.Circuits.Boolean.size_broadcastCircuit: exact gate count.
References #
- Adapts MassProduction/Nonuniform/{BroadcastCircuit,BroadcastCorrectness,BroadcastRecords}.lean from S. Schlesinger, Boolean circuit mass production formalization, sharing the adjacent-key tests across value bits.
At a destination in sorted key/tag order, each output bit is the OR of all matching source bits. The selectors may overlap or repeat; source keys need not be unique.
Broadcast values in a record array, preserving the entire retained header. Keys and tags are selected from that header; the value field follows it. Sorted destination semantics is proved separately. Gate counts include unused work at zero output width or zero records.
Instances For
Every header bit is preserved, including keys, tags and arbitrary routing metadata.
The value field is supplied by the shared scans.
Each sorted destination receives the OR of all sources with its selected key.
A sorted destination copies its unique matching source value exactly.