A circuit for one scheduler phase #
The phase function next is synthesized stage by stage, each stage reading wires built by the
earlier ones:
- candidate bits: the target bits plus fixed offsets, one negation per set offset bit;
- occupancy: one shared OR lookup of all candidates among the accepted line points
(
batchOrCircuit); - duplicates: for each menu entry, duplicate flags among its candidates
(
duplicateFlagsCircuit), with padding records marked by a tag bit; - clean flags, a disjunction over the scalars per request;
- success: the clean flags of each entry, sorted, read at position
⌈2 ^ p / 2⌉ - 1; - the first successful entry, from shared prefix disjunctions;
- the chosen clean flags and candidate lines, disjunctions over the entries;
- the enriched pending records, sorted with clean records first.
phaseCost is the exact sum of the stage budgets; it counts every gate, including constants. The
construction is existential and does not certify the running time of any constructor.
Main definitions #
Cslib.Circuits.Boolean.MassProduction.Scheduler.phaseCost: the phase gate budget.
Main results #
Cslib.Circuits.Boolean.MassProduction.Scheduler.exists_next_circuit: a circuit computingnextwithinphaseCostgates.
References #
- Adapted from MassProduction/Nonuniform/BufferedPhaseCost.lean, MassProduction/Nonuniform/BufferOccupancy.lean, MassProduction/Nonuniform/CandidateSelection.lean, MassProduction/Nonuniform/ConstantTranslations.lean and MassProduction/Nonuniform/MaskedOr.lean in S. Schlesinger, Boolean circuit mass production formalization, using the sorting network of K. E. Batcher, Sorting Networks and Their Applications.
Stage 1: each candidate bit is an input bit or its negation.
Stage 2: occupancy by one shared OR lookup among the accepted line points.
Stage 3: for each menu entry, duplicate flags among its candidates. Padding records carry a true tag bit, so they never repeat a candidate.
Stage 4: a request is clean when no candidate is occupied or a duplicate.
Stage 5: an entry succeeds when its sorted clean flags are true at position
⌈2 ^ p / 2⌉ - 1.
Stage 6: the first successful entry, from shared prefix disjunctions.
Stage 7: the clean flag of each request for the chosen entry.
Stage 7: the candidate line of each request for the chosen entry.
Stage 8: the enriched pending records, sorted with clean records first.
The phase output is available once the sorted pending records are.
The gate budget of one phase with 2 ^ p pending and a accepted records and a menu of r
entries: the sum of the eight stage budgets. It counts every gate, including constants.
Instances For
One scheduler phase. Some circuit computes next exactly, on every input, within
phaseCost gates; the size counts every gate, including constants.