Independent block evaluation #
This file formalizes the direct-product operation used by circuit mass production. Inputs are stored as consecutive row-major blocks. It also builds the naive circuit obtained by placing independent copies of one circuit side by side, with exact semantic and cost accounting.
The construction is generic in the signature, interpretation, carrier, and number of outputs. Boolean mass-production theorems specialize the scalar case later.
Regard a scalar function as a one-output target.
Equations
- Algebraic.MassProduction.scalarTarget function input x✝ = function input
Instances For
Embed an index from the initial copies blocks into a layout with one
additional final block.
Equations
- Algebraic.MassProduction.blockPrefixIndex index = Fin.cast ⋯ (Fin.castAdd width index)
Instances For
Embed an index from the final block into a layout with copies preceding
blocks.
Equations
- Algebraic.MassProduction.blockSuffixIndex index = Fin.cast ⋯ (Fin.natAdd (copies * width) index)
Instances For
Select one row-major input block.
Equations
- Algebraic.MassProduction.directProductInput input copy index = input (finProdFinEquiv (copy, index))
Instances For
Evaluate one scalar function independently on copies row-major input
blocks and return all answers. This is the target denoted f^{× copies} in
the mass-production manuscript.
Equations
- Algebraic.MassProduction.directProduct function copies input copy = function (Algebraic.MassProduction.directProductInput input copy)
Instances For
Place copies independent, disjoint-input copies of one circuit side by
side. Sharing internal to the original circuit is preserved within each copy.
Equations
- One or more equations did not get rendered due to their size.
- circuit.replicate 0 = Cslib.Circuits.Circuit.castCounts ⋯ ⋯ (Cslib.Circuits.Circuit.id σ 0)
Instances For
Replication evaluates one selected copy exactly as the original circuit on the corresponding row-major input block.
Replication applies the original circuit independently to all consecutive input blocks.
Replication has exactly multiplicative weighted cost.
A scalar circuit replicated on disjoint inputs has the manuscript's
direct-product semantics after removing the trivial Fin 1 output factor.
Equations
- circuit.replicateScalar copies = (circuit.replicate copies).mapOutputs fun (copy : Fin copies) => finProdFinEquiv (copy, 0)
Instances For
The concrete naive upper bound: copies disjoint copies of a scalar
circuit compute the direct product at exactly multiplicative cost.
Computation of a one-output target identifies its scalar output function.
Retaining an initial sub-batch #
Send a copy of a larger batch to the same copy of a smaller batch when it exists, and to copy zero otherwise. The positivity premise is explicit rather than hidden in an instance.
Equations
Instances For
Rewire the inputs expected by a larger batch circuit onto a smaller batch. Inputs belonging to discarded copies are harmlessly redirected to the first retained block.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A circuit for large independent copies yields, without adding gates, a
circuit for every positive initial batch of at most large copies.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Minimum direct-product complexity is monotone in the number of positive copies. This is the formal version of fixing unused inputs and discarding unused outputs.
The naive direct-product upper bound for minimum weighted complexity. It
is valid even when the one-copy function is not representable, in which case
the right side may be ⊤.
The naive direct-product upper bound for minimum gate count.