Quantum output support on target wires #
Hadamard, NOT, CNOT and Toffoli gates change only their target bit along each computational path. Every wire never targeted by a circuit therefore retains its computational-basis input bit on the support of the final measurement. The number of distinct target wires is at most the number of gates; a wire used only as a control does not need to be sampled.
Reading the measurement on any list covering the target wires and restoring all other bits from the explicit input register recovers the complete joint output distribution. This identity includes circuits with no gates, registers of width zero, and registers with arbitrarily many untargeted wires.
Main definitions #
Cslib.Quantum.GateCode.targets: distinct target wires in order of first occurrence.
Main results #
Cslib.Quantum.GateCode.targets_length_le: at most one distinct target per gate.Cslib.Quantum.getD_pathRun_of_not_mem_targets: paths preserve untargeted input bits.Cslib.Quantum.run_ofCodes_apply_eq_zero_of_not_mem_targets: an amplitude vanishes when an untargeted output bit differs from its input bit.Cslib.Quantum.eq_of_mem_support_measure_of_not_mem_targets: measurement support preserves untargeted bits.Cslib.Quantum.measure_map_restorePositions: target marginals reconstruct the full output law.
Every target of a well-formed circuit is a valid register position.
An amplitude is zero when an untargeted output wire differs from the input basis state.
Every supported measurement outcome agrees with the input at an untargeted wire.
Reading any positions covering all gate targets and restoring the remaining input bits recovers the entire joint measurement law as a list. The input register is explicitly supplied.