Documentation

CslibFrontier.Computability.Circuit.Quantum.OutputSupport

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 #

Main results #

Distinct target wires, in order of their first occurrence in the circuit.

A circuit's target list has no duplicates.

There are at most as many distinct target wires as gates.

@[simp]
theorem Cslib.Quantum.GateCode.mem_targets_iff {gs : List GateCode} {j : ℕ} :
j ∈ targets gs ↔ ∃ g ∈ gs, g.target = j

A wire occurs in the target list exactly when some gate targets it.

Every gate's target belongs to the target list of its circuit.

theorem Cslib.Quantum.GateCode.lt_of_mem_targets {m : ℕ} {gs : List GateCode} (hgs : ∀ g ∈ gs, WellFormed m g) {j : ℕ} (hj : j ∈ targets gs) :
j < m

Every target of a well-formed circuit is a valid register position.

theorem Cslib.Quantum.getD_pathRun_of_not_mem_targets (gs : List GateCode) (x path : List Bool) (j : ℕ) (hj : j ∉ GateCode.targets gs) :
(pathRun gs x path).1.getD j false = x.getD j false

A path preserves every input bit that no gate targets, for arbitrary path words and codes.

theorem Cslib.Quantum.pathTerm_eq_zero_of_not_mem_targets (gs : List GateCode) (x y path : List Bool) (j : ℕ) (hj : j ∉ GateCode.targets gs) (hne : y.getD j false ≠ x.getD j false) :
pathTerm gs x y path = 0

A path contributes zero to an output that disagrees with an untargeted input bit.

theorem Cslib.Quantum.run_ofCodes_apply_eq_zero_of_not_mem_targets {m : ℕ} {gs : List GateCode} (hgs : ∀ g ∈ gs, GateCode.WellFormed m g) (x y : Fin m → Bool) (j : Fin m) (hj : ↑j ∉ GateCode.targets gs) (hne : y j ≠ x j) :
((Circuit.ofCodes m gs).run x).ofLp y = 0

An amplitude is zero when an untargeted output wire differs from the input basis state.

theorem Cslib.Quantum.eq_of_mem_support_measure_of_not_mem_targets {m : ℕ} {gs : List GateCode} (hgs : ∀ g ∈ gs, GateCode.WellFormed m g) {x y : Fin m → Bool} (hy : y ∈ ((Circuit.ofCodes m gs).measure x).support) (j : Fin m) (hj : ↑j ∉ GateCode.targets gs) :
y j = x j

Every supported measurement outcome agrees with the input at an untargeted wire.

theorem Cslib.Quantum.measure_map_restorePositions {gs : List GateCode} (X : List Bool) (hgs : ∀ g ∈ gs, GateCode.WellFormed X.length g) (positions : List ℕ) (hcover : GateCode.targets gs ⊆ positions) :

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.