Documentation

CslibFrontier.Computability.Circuit.Quantum.Input

Quantum states embedded in larger input registers #

Cslib.Quantum.embedState places a state on selected qubits of a larger register and fixes the remaining qubits to a basis string. It is a linear isometry: superpositions and norms are preserved. On a basis state it writes the basis string on the selected qubits. Any state is the corresponding linear combination of those embedded basis states.

Running a circuit on the selected qubits commutes with this embedding (Cslib.Quantum.Circuit.eval_mapWires_embedState), leaving the other qubits fixed. Classical reversible circuits can move the embedded state by acting on each basis string (Cslib.Quantum.Circuit.eval_ofCodes_embedState). Codes that avoid its qubits commute with writing bits there (Cslib.Quantum.GateCode.classicalRun_glue). For a contiguous block following a classical input, writing a basis string agrees with initializing the concatenated input word (Cslib.Quantum.glue_blockEmb_inputState).

Main definitions #

Main results #

Classical codes and glued bits #

theorem Cslib.Quantum.GateCode.readBit_glue_of_forall_ne {ι : Type u_1} {N : ℕ} [Fintype ι] (e : ι ↪ Fin N) (z : ι → Bool) (x : Fin N → Bool) {c : ℕ} (hc : ∀ (i : ι), ↑(e i) ≠ c) :
readBit (glue e z x) c = readBit x c

Bit c of glue e z x, off the qubits e, is bit c of x.

theorem Cslib.Quantum.GateCode.classicalRun_glue {ι : Type u_1} {N : ℕ} [Fintype ι] {gs : List GateCode} (e : ι ↪ Fin N) (ht : ∀ g ∈ gs, ∀ (i : ι), ↑(e i) ≠ g.2.1) (hc : ∀ g ∈ gs, ∀ (i : ι), ↑(e i) ∉ g.2.2) (z : ι → Bool) (x : Fin N → Bool) :
classicalRun gs (glue e z x) = glue e z (classicalRun gs x)

Classical codes that neither write nor read the qubits e commute with writing bits on them.

States on part of a register #

noncomputable def Cslib.Quantum.embedState {p N : ℕ} (e : Fin p ↪ Fin N) (x : Fin N → Bool) :

The state ψ on the qubits e of an N-qubit register whose other qubits hold x.

theorem Cslib.Quantum.embedState_apply {p N : ℕ} (e : Fin p ↪ Fin N) (x : Fin N → Bool) (ψ : Qubits p) (y : Fin N → Bool) :
((embedState e x) ψ).ofLp y = if AgreeOff e y x then ψ.ofLp (y ∘ ⇑e) else 0
@[simp]
theorem Cslib.Quantum.embedState_ket {p N : ℕ} (e : Fin p ↪ Fin N) (x : Fin N → Bool) (z : Fin p → Bool) :
(embedState e x) (ket z) = ket (glue e z x)

On a basis state, the embedding writes the basis string on the qubits e.

theorem Cslib.Quantum.embedState_eq_sum {p N : ℕ} (e : Fin p ↪ Fin N) (x : Fin N → Bool) (ψ : Qubits p) :
(embedState e x) ψ = ∑ z : Fin p → Bool, ψ.ofLp z • ket (glue e z x)
theorem Cslib.Quantum.Circuit.eval_mapWires_embedState {p N : ℕ} (C : Circuit p) (e : Fin p ↪ Fin N) (x : Fin N → Bool) (ψ : Qubits p) :
(mapWires e C).eval ((embedState e x) ψ) = (embedState e x) (C.eval ψ)

Running a circuit on selected qubits commutes with embedding its input state; the other qubits retain their fixed basis string.

theorem Cslib.Quantum.Circuit.eval_ofCodes_embedState {p N : ℕ} {gs : List GateCode} (h : GateCode.IsClassical N gs) (e e' : Fin p ↪ Fin N) (x x' : Fin N → Bool) (hrun : ∀ (z : Fin p → Bool), GateCode.classicalRun gs (glue e z x) = glue e' z x') (ψ : Qubits p) :
(ofCodes N gs).eval ((embedState e x) ψ) = (embedState e' x') ψ

A classical circuit mapping |glue e z x⟩ to |glue e' z x'⟩ for every z maps the state ψ on the qubits e to ψ on the qubits e'.

theorem Cslib.Quantum.glue_blockEmb_inputState {p n m : ℕ} (h : n + p ≤ m) (x : List Bool) (hx : x.length = n) (z : Fin p → Bool) :

The first n qubits of a register hold x and the next p hold z: writing z on the block after the input is the input state of x ++ z.

The input basis state as a bit string: the input word padded with zeros.