Computational-basis output patterns #
An output pattern specifies the bits on a list of wires. Its probability uses the existing
computational-basis measurement. Flipping the wires specified as zero converts a pattern on
distinct wires into the all-one event of onesProb, without adding Hadamard gates.
The partition identities below are the elementary measurement facts used by exact output sampling. These are original implementation lemmas for the circuit model, not a new simulation algorithm.
Main definitions #
Cslib.Quantum.patternAt: measurement outcomes agreeing with a wire-bit pattern.Cslib.Quantum.patternProb: the probability of an output pattern.Cslib.Quantum.GateCode.flipCodes: terminal NOT gates on a list of wires.
Main results #
Cslib.Quantum.GateCode.readBit_classicalRun_flipCodes: distinct terminal NOTs flip exactly the selected wires.Cslib.Quantum.onesProb_append_flipCodes_eq_patternProb: convert a pattern to an all-one event.Cslib.Quantum.hadamardCount_append_flipCodes: the conversion preserves the denominator.Cslib.Quantum.patternProb_partition: the next bit partitions a prefix event.Cslib.Quantum.measure_map_readBit_apply: pattern probabilities are measurement marginals.Cslib.Quantum.patternProb_eq_onesGap: pattern probabilities use the existing signed gap.
Flipping valid wires is a well-formed classical circuit.
Appending NOT gates on valid wires keeps every gate well formed.
Terminal NOT gates use no Hadamards.
The zero wires form a sublist of the pattern's wires.
Converting a pattern to all-one form adds at most one gate per specified bit.
Zero wires are distinct when the pattern's wires are distinct.
Appending a list of NOT gates does not change the Hadamard denominator.
Flipping each desired-zero wire converts a valid pattern with distinct wires to an all-one event.
The probability of an arbitrary pattern is the existing all-one probability after terminal NOTs on its desired-zero wires.
The marginal of the existing measurement on a list of valid wires agrees with the pattern probability.
An arbitrary valid pattern has the existing projected signed-gap representation. Its terminal NOT gates leave the denominator unchanged.