Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Superoperators, quantum channels in Kraus form, the erasure channel, achievable rates

Definition
QAlgorithms_Defs_Channel

by Goku · Oct 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

lecture-notesquantum-information

Superoperators, quantum channels in Kraus form, the erasure channel, achievable rates

QAlgorithms.Superop

For index types ι\iotaι and κ\kappaκ, Superop(ι,κ)\mathrm{Superop}(\iota,\kappa)Superop(ι,κ) is the type of all functions from complex ι×ι\iota\times\iotaι×ι matrices to complex κ×κ\kappa\times\kappaκ×κ matrices:

Φ:Cι×ι→Cκ×κ.\Phi : \mathbb{C}^{\iota\times\iota} \to \mathbb{C}^{\kappa\times\kappa}.Φ:Cι×ι→Cκ×κ.

Nothing else is required of such a map. It need not be linear, trace-preserving, positive, or completely positive. The index types need not be finite.

QAlgorithms.IsKrausFamily

Let KKK and κ\kappaκ be finite types, and let ι\iotaι be a type with decidable equality; ι\iotaι need not be finite. Let (Ej)j∈K(E_j)_{j\in K}(Ej​)j∈K​ be a family of complex κ×ι\kappa\times\iotaκ×ι matrices, so each EjE_jEj​ maps Cι\mathbb{C}^\iotaCι to Cκ\mathbb{C}^\kappaCκ.

The family is a Kraus family exactly when

∑j∈KEj†Ej=Iι,\sum_{j\in K} E_j^{\dagger} E_j = I_\iota,j∈K∑​Ej†​Ej​=Iι​,

where Ej†E_j^\daggerEj†​ is the conjugate transpose and IιI_\iotaIι​ is the ι×ι\iota\times\iotaι×ι identity matrix.

Edge cases:

  • If KKK is empty, the sum is the zero matrix. The condition then holds only when ι\iotaι is empty.
  • If κ\kappaκ is empty, every Ej†EjE_j^\dagger E_jEj†​Ej​ is zero, so again the condition holds only when ι\iotaι is empty.

QAlgorithms.krausApply

Let KKK and ι\iotaι be finite types, κ\kappaκ any type, and (Ej)j∈K(E_j)_{j\in K}(Ej​)j∈K​ a family of complex κ×ι\kappa\times\iotaκ×ι matrices. Then krausApply(E)\mathrm{krausApply}(E)krausApply(E) is the map in Superop(ι,κ)\mathrm{Superop}(\iota,\kappa)Superop(ι,κ) given by

ρ  ⟼  ∑j∈KEj ρ Ej†.\rho \;\longmapsto\; \sum_{j\in K} E_j\,\rho\,E_j^{\dagger}.ρ⟼j∈K∑​Ej​ρEj†​.

This is defined for every complex ι×ι\iota\times\iotaι×ι matrix ρ\rhoρ, not only density matrices. No condition is placed on the EjE_jEj​; in particular, the Kraus completeness relation is not assumed. If KKK is empty, the map is identically zero.

QAlgorithms.IsChannel

Let ι\iotaι and κ\kappaκ be finite types, with decidable equality on ι\iotaι. A map Φ∈Superop(ι,κ)\Phi\in\mathrm{Superop}(\iota,\kappa)Φ∈Superop(ι,κ) (an arbitrary function from ι×ι\iota\times\iotaι×ι to κ×κ\kappa\times\kappaκ×κ complex matrices) is a channel when the following holds.

There exist a natural number mmm and complex κ×ι\kappa\times\iotaκ×ι matrices E0,…,Em−1E_0,\dots,E_{m-1}E0​,…,Em−1​ such that:

  1. the Kraus completeness relation holds:
∑j=0m−1Ej†Ej=Iι;\sum_{j=0}^{m-1}E_j^\dagger E_j=I_\iota;j=0∑m−1​Ej†​Ej​=Iι​;
  1. Φ\PhiΦ agrees with the Kraus map on every complex ι×ι\iota\times\iotaι×ι matrix (not only density matrices):
Φ(ρ)=∑j=0m−1EjρEj†for all ρ.\Phi(\rho)=\sum_{j=0}^{m-1}E_j\rho E_j^\dagger \quad\text{for all } \rho.Φ(ρ)=j=0∑m−1​Ej​ρEj†​for all ρ.

Edge case: m=0m=0m=0 is allowed. It satisfies condition 1 only when ι\iotaι is empty. Hence for nonempty ι\iotaι, at least one Kraus operator is needed.

QAlgorithms.conjSuperop

Let ι\iotaι be a finite type, κ\kappaκ any type, and AAA a complex κ×ι\kappa\times\iotaκ×ι matrix. Then conjSuperop(A)∈Superop(ι,κ)\mathrm{conjSuperop}(A)\in\mathrm{Superop}(\iota,\kappa)conjSuperop(A)∈Superop(ι,κ) is the map

ρ⟼A ρ A†,\rho\longmapsto A\,\rho\,A^\dagger,ρ⟼AρA†,

defined on all complex ι×ι\iota\times\iotaι×ι matrices ρ\rhoρ. No unitarity, isometry, or norm condition is imposed on AAA.

QAlgorithms.piSuperop

Let ι\iotaι be a finite type with decidable equality, κ\kappaκ any type, and k∈Nk\in\mathbb{N}k∈N. Let Φ0,…,Φk−1\Phi_0,\dots,\Phi_{k-1}Φ0​,…,Φk−1​ be arbitrary maps in Superop(ι,κ)\mathrm{Superop}(\iota,\kappa)Superop(ι,κ).

piSuperop(Φ)\mathrm{piSuperop}(\Phi)piSuperop(Φ) is a map from matrices indexed by tuples x=(x0,…,xk−1)∈ιkx=(x_0,\dots,x_{k-1})\in\iota^kx=(x0​,…,xk−1​)∈ιk to matrices indexed by tuples y∈κky\in\kappa^ky∈κk. For an input XXX and output indices y,y′∈κky,y'\in\kappa^ky,y′∈κk, its entries are

(piSuperop(Φ)(X))y,y′=∑x∈ιk∑x′∈ιkXx,x′∏i=0k−1(Φi(Exi,xi′))yi, yi′.\big(\mathrm{piSuperop}(\Phi)(X)\big)_{y,y'} =\sum_{x\in\iota^k}\sum_{x'\in\iota^k} X_{x,x'}\prod_{i=0}^{k-1}\Big(\Phi_i\big(\mathbf{E}_{x_i,x'_i}\big)\Big)_{y_i,\,y'_i}.(piSuperop(Φ)(X))y,y′​=x∈ιk∑​x′∈ιk∑​Xx,x′​i=0∏k−1​(Φi​(Exi​,xi′​​))yi​,yi′​​.

Here Ea,b\mathbf{E}_{a,b}Ea,b​ is the ι×ι\iota\times\iotaι×ι matrix unit: entry 111 at position (a,b)(a,b)(a,b) and 000 elsewhere.

So the output is obtained by applying each Φi\Phi_iΦi​ only to matrix units and extending linearly in XXX. Consequences:

  • The result is always linear in XXX, even when the Φi\Phi_iΦi​ are not linear.
  • If the Φi\Phi_iΦi​ are linear, it coincides with Φ0⊗⋯⊗Φk−1\Phi_0\otimes\cdots\otimes\Phi_{k-1}Φ0​⊗⋯⊗Φk−1​.

Edge case: for k=0k=0k=0, both index sets are a single point and the empty product is 111. The output's single entry then equals XXX's single entry, so the map is the identity on 1×11\times11×1 matrices.

QAlgorithms.idTensorSuperop

Let RRR, ι\iotaι, κ\kappaκ be arbitrary types (no finiteness required) and Φ∈Superop(ι,κ)\Phi\in\mathrm{Superop}(\iota,\kappa)Φ∈Superop(ι,κ) an arbitrary map. Then idTensorSuperop(Φ)\mathrm{idTensorSuperop}(\Phi)idTensorSuperop(Φ) maps (R×ι)(R\times\iota)(R×ι)-indexed matrices to (R×κ)(R\times\kappa)(R×κ)-indexed matrices. The first factor RRR is untouched and Φ\PhiΦ acts on the second.

Take a matrix XXX and output indices (r,j)(r,j)(r,j), (r′,j′)(r',j')(r′,j′) with r,r′∈Rr,r'\in Rr,r′∈R and j,j′∈κj,j'\in\kappaj,j′∈κ. Form the (r,r′)(r,r')(r,r′) block of XXX, the ι×ι\iota\times\iotaι×ι matrix

Xi,i′(r,r′)=X(r,i),(r′,i′).X^{(r,r')}_{i,i'} = X_{(r,i),(r',i')}.Xi,i′(r,r′)​=X(r,i),(r′,i′)​.

Then

(idTensorSuperop(Φ)(X))(r,j),(r′,j′)=(Φ(X(r,r′)))j,j′.\big(\mathrm{idTensorSuperop}(\Phi)(X)\big)_{(r,j),(r',j')}=\Big(\Phi\big(X^{(r,r')}\big)\Big)_{j,j'}.(idTensorSuperop(Φ)(X))(r,j),(r′,j′)​=(Φ(X(r,r′)))j,j′​.

That is, Φ\PhiΦ is applied separately to each block X(r,r′)X^{(r,r')}X(r,r′). When Φ\PhiΦ is linear this is idR⊗Φ\mathrm{id}_R\otimes\PhiidR​⊗Φ. For nonlinear Φ\PhiΦ it is still literally this blockwise application.

QAlgorithms.overwrite

Let α\alphaα be any type, k,N∈Nk,N\in\mathbb{N}k,N∈N, and w:{0,…,k−1}→{0,…,N−1}w:\{0,\dots,k-1\}\to\{0,\dots,N-1\}w:{0,…,k−1}→{0,…,N−1} an injective map (an ordered choice of kkk distinct wires). Let y:{0,…,N−1}→αy:\{0,\dots,N-1\}\to\alphay:{0,…,N−1}→α and z:{0,…,k−1}→αz:\{0,\dots,k-1\}\to\alphaz:{0,…,k−1}→α.

The result is the function on {0,…,N−1}\{0,\dots,N-1\}{0,…,N−1} that writes zzz onto the wires of www and keeps yyy elsewhere:

overwritew(y,z)(a)={ziif a=w(i) for some i,yaif a∉range⁡(w).\mathrm{overwrite}_w(y,z)(a)=\begin{cases} z_i & \text{if } a=w(i) \text{ for some } i,\\ y_a & \text{if } a\notin\operatorname{range}(w).\end{cases}overwritew​(y,z)(a)={zi​ya​​if a=w(i) for some i,if a∈/range(w).​

The index iii in the first case is unique because www is injective.

QAlgorithms.liftSuperop

Let α\alphaα and EEE be arbitrary types, k,N∈Nk,N\in\mathbb{N}k,N∈N, and www an injective map from {0,…,k−1}\{0,\dots,k-1\}{0,…,k−1} into {0,…,N−1}\{0,\dots,N-1\}{0,…,N−1}. Let Ψ\PsiΨ be an arbitrary map from matrices indexed by αk×E\alpha^{k}\times Eαk×E to matrices with the same index set. The result is a map on matrices indexed by αN×E\alpha^{N}\times EαN×E.

Fix an input matrix XXX and output indices p=(y,e)p=(y,e)p=(y,e), q=(y′,e′)q=(y',e')q=(y′,e′), where y,y′∈αNy,y'\in\alpha^Ny,y′∈αN and e,e′∈Ee,e'\in Ee,e′∈E.

First form the (αk×E)(\alpha^k\times E)(αk×E)-indexed matrix Mp,qM^{p,q}Mp,q. For a,b∈αka,b\in\alpha^ka,b∈αk and f,g∈Ef,g\in Ef,g∈E:

M(a,f),(b,g)p,q=X(overwritew(y,a), f), (overwritew(y′,b), g).M^{p,q}_{(a,f),(b,g)} = X_{(\mathrm{overwrite}_w(y,a),\,f),\ (\mathrm{overwrite}_w(y',b),\,g)}.M(a,f),(b,g)p,q​=X(overwritew​(y,a),f), (overwritew​(y′,b),g)​.

In words: the wires outside the range of www are frozen to their values in yyy (row side) and y′y'y′ (column side). The wires in the range of www are replaced by aaa and bbb. The EEE components range freely.

Then

(liftSuperopw(Ψ)(X))p,q=Ψ(Mp,q)(y∘w, e), (y′∘w, e′),\big(\mathrm{liftSuperop}_w(\Psi)(X)\big)_{p,q}=\Psi\big(M^{p,q}\big)_{(y\circ w,\ e),\ (y'\circ w,\ e')},(liftSuperopw​(Ψ)(X))p,q​=Ψ(Mp,q)(y∘w, e), (y′∘w, e′)​,

where y∘w∈αky\circ w\in\alpha^ky∘w∈αk is the restriction of yyy to the wires of www, in the order given by www.

So Ψ\PsiΨ is applied to the block of XXX selected by the complement-wire values of ppp and qqq, and the result is read off at the www-wire and EEE coordinates of ppp and qqq. No linearity or channel property of Ψ\PsiΨ is assumed.

QAlgorithms.maxEntangled

For k∈Nk\in\mathbb{N}k∈N, maxEntangled(k)\mathrm{maxEntangled}(k)maxEntangled(k) is the vector ∣Φk⟩|\Phi_k\rangle∣Φk​⟩ in the Euclidean space C{0,1}k×{0,1}k\mathbb{C}^{\{0,1\}^k\times\{0,1\}^k}C{0,1}k×{0,1}k (two kkk-qubit registers). Its coordinates are

∣Φk⟩(a,b)={12ka=b,0a≠b,i.e.∣Φk⟩=12k∑a∈{0,1}k∣a⟩∣a⟩.|\Phi_k\rangle_{(a,b)}=\begin{cases} \dfrac{1}{\sqrt{2^k}} & a=b,\\[4pt] 0 & a\neq b,\end{cases} \qquad\text{i.e.}\qquad |\Phi_k\rangle=\frac{1}{\sqrt{2^k}}\sum_{a\in\{0,1\}^k}|a\rangle|a\rangle .∣Φk​⟩(a,b)​=⎩⎨⎧​2k​1​0​a=b,a=b,​i.e.∣Φk​⟩=2k​1​a∈{0,1}k∑​∣a⟩∣a⟩.

For k=0k=0k=0 it is the single coordinate 111.

QAlgorithms.entanglementFidelity

Let k∈Nk\in\mathbb{N}k∈N and let Φ∈Superop({0,1}k,{0,1}k)\Phi\in\mathrm{Superop}(\{0,1\}^k,\{0,1\}^k)Φ∈Superop({0,1}k,{0,1}k) be an arbitrary map on 2k×2k2^k\times2^k2k×2k complex matrices; it is not assumed to be a channel.

Let ∣Φk⟩=2−k/2∑a∣a⟩∣a⟩|\Phi_k\rangle=2^{-k/2}\sum_a|a\rangle|a\rangle∣Φk​⟩=2−k/2∑a​∣a⟩∣a⟩ be the vector above. Let ρΦk\rho_{\Phi_k}ρΦk​​ be its outer product, with entries

(ρΦk)a,b=(Φk)a (Φk)b‾.(\rho_{\Phi_k})_{a,b}=(\Phi_k)_a\,\overline{(\Phi_k)_b}.(ρΦk​​)a,b​=(Φk​)a​(Φk​)b​​.

Let id⊗Φ\mathrm{id}\otimes\Phiid⊗Φ denote the blockwise map described under idTensorSuperop. The first (reference) register is left alone and Φ\PhiΦ is applied to each (r,r′)(r,r')(r,r′) block on the second register.

The entanglement fidelity is the real number

Fe(Φ)=Re⁡∑a∑b(Φk)a‾ [(id⊗Φ)(ρΦk)]a,b (Φk)b=Re⁡ ⟨Φk∣ (id⊗Φ)(∣Φk⟩⟨Φk∣) ∣Φk⟩.F_e(\Phi)=\operatorname{Re}\sum_{a}\sum_{b}\overline{(\Phi_k)_a}\,\Big[(\mathrm{id}\otimes\Phi)(\rho_{\Phi_k})\Big]_{a,b}\,(\Phi_k)_b =\operatorname{Re}\,\langle\Phi_k|\,(\mathrm{id}\otimes\Phi)(|\Phi_k\rangle\langle\Phi_k|)\,|\Phi_k\rangle .Fe​(Φ)=Rea∑​b∑​(Φk​)a​​[(id⊗Φ)(ρΦk​​)]a,b​(Φk​)b​=Re⟨Φk​∣(id⊗Φ)(∣Φk​⟩⟨Φk​∣)∣Φk​⟩.

Here aaa and bbb range over pairs in {0,1}k×{0,1}k\{0,1\}^k\times\{0,1\}^k{0,1}k×{0,1}k. The real part is taken explicitly, so any imaginary part is discarded.

QAlgorithms.erasureKraus

For a real parameter ppp, erasureKraus(p)\mathrm{erasureKraus}(p)erasureKraus(p) is a list of five complex 4×24\times24×2 matrices E0,…,E4E_0,\dots,E_4E0​,…,E4​. Each maps a qubit C{0,1}\mathbb{C}^{\{0,1\}}C{0,1} into C{0,1}×{0,1}\mathbb{C}^{\{0,1\}\times\{0,1\}}C{0,1}×{0,1}, where an output index is a pair (bit, flag).

  • E0E_0E0​, no erasure. It keeps the bit and sets the flag to 000:
E0=1−p ∑b∈{0,1}∣b,0⟩⟨b∣.E_0=\sqrt{1-p}\,\sum_{b\in\{0,1\}}|b,0\rangle\langle b|.E0​=1−p​b∈{0,1}∑​∣b,0⟩⟨b∣.
  • E1,…,E4E_1,\dots,E_4E1​,…,E4​, erasure. For (a,c)(a,c)(a,c) taken in the order (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1):
E(a,c)=p/2  ∣a,1⟩⟨c∣.E_{(a,c)}=\sqrt{p/2}\;|a,1\rangle\langle c|.E(a,c)​=p/2​∣a,1⟩⟨c∣.

Each has the single nonzero entry p/2\sqrt{p/2}p/2​ at row (a,1)(a,1)(a,1), column ccc. It sends input ∣c⟩|c\rangle∣c⟩ to output bit aaa with flag 111.

No range restriction is placed on ppp. The square roots are real square roots truncated at 000:

  • for p>1p>1p>1, 1−p\sqrt{1-p}1−p​ is taken to be 000, so E0=0E_0=0E0​=0;
  • for p<0p<0p<0, p/2\sqrt{p/2}p/2​ is taken to be 000, so E1=⋯=E4=0E_1=\dots=E_4=0E1​=⋯=E4​=0.

QAlgorithms.erasureChannel

This definition takes a number of qubits n∈Nn \in \mathbb{N}n∈N and a real parameter ppp, with no hypothesis on ppp. It returns a map En,p\mathcal{E}_{n,p}En,p​ from complex matrices indexed by {0,1}n\{0,1\}^n{0,1}n (the nnn-qubit input space) to complex matrices indexed by ({0,1}×{0,1})n(\{0,1\}\times\{0,1\})^n({0,1}×{0,1})n. Each output wire qqq carries a pair (aq,fq)(a_q, f_q)(aq​,fq​): aqa_qaq​ is a data bit and fqf_qfq​ a flag bit.

The map is built from five single-qubit operators K0,…,K4K_0,\dots,K_4K0​,…,K4​, each a 4×24\times 24×2 matrix with rows indexed by pairs (a,f)(a,f)(a,f) and columns indexed by a bit bbb:

  • K0(a,f; b)=1−pK_0(a,f;\,b) = \sqrt{1-p}K0​(a,f;b)=1−p​ if (a,f)=(b,0)(a,f) = (b,0)(a,f)=(b,0), and 000 otherwise. So K0K_0K0​ sends ∣b⟩↦1−p ∣b,0⟩|b\rangle \mapsto \sqrt{1-p}\,|b,0\rangle∣b⟩↦1−p​∣b,0⟩.
  • For (a,c)∈{(0,0),(0,1),(1,0),(1,1)}(a,c) \in \{(0,0),(0,1),(1,0),(1,1)\}(a,c)∈{(0,0),(0,1),(1,0),(1,1)}, giving K1,K2,K3,K4K_1,K_2,K_3,K_4K1​,K2​,K3​,K4​ in that order:
K(a,f; b)=p/2 if (a,f)=(a,1) and b=c, and 0 otherwise.K(a,f;\,b) = \sqrt{p/2} \text{ if } (a,f)=(a,1) \text{ and } b = c, \text{ and } 0 \text{ otherwise}.K(a,f;b)=p/2​ if (a,f)=(a,1) and b=c, and 0 otherwise.

So ∣c⟩↦p/2 ∣a,1⟩|c\rangle \mapsto \sqrt{p/2}\,|a,1\rangle∣c⟩↦p/2​∣a,1⟩, and KKK kills ∣1−c⟩|1-c\rangle∣1−c⟩.

Here ⋅\sqrt{\cdot}⋅​ is the real square root, which returns 000 on negative arguments. Thus for p<0p<0p<0 all of K1,…,K4K_1,\dots,K_4K1​,…,K4​ are zero, and for p>1p>1p>1 the operator K0K_0K0​ is zero.

For each assignment j:{1,…,n}→{0,…,4}j : \{1,\dots,n\} \to \{0,\dots,4\}j:{1,…,n}→{0,…,4}, define the nnn-fold product operator

Ej(y,z)=∏qKjq(yq, zq),E_j(y, z) = \prod_{q} K_{j_q}(y_q,\, z_q),Ej​(y,z)=q∏​Kjq​​(yq​,zq​),

where y∈({0,1}2)ny \in (\{0,1\}^2)^ny∈({0,1}2)n and z∈{0,1}nz \in \{0,1\}^nz∈{0,1}n. The map is then, for every complex matrix ρ\rhoρ (not only density matrices),

En,p(ρ)=∑j∈{0,…,4}nEj ρ Ej†.\mathcal{E}_{n,p}(\rho) = \sum_{j \in \{0,\dots,4\}^n} E_j\,\rho\,E_j^{\dagger}.En,p​(ρ)=j∈{0,…,4}n∑​Ej​ρEj†​.

The definition does not assert that this is trace preserving. The completeness relation ∑jEj†Ej=I\sum_j E_j^\dagger E_j = I∑j​Ej†​Ej​=I is not part of the definition.

QAlgorithms.IsAchievableQRate

The data are:

  • a family of finite index types Outn\mathrm{Out}_nOutn​ with decidable equality, one for each n∈Nn\in\mathbb{N}n∈N;
  • a family of maps Nn\mathcal{N}_nNn​, each sending complex matrices indexed by {0,1}n\{0,1\}^n{0,1}n to complex matrices indexed by Outn\mathrm{Out}_nOutn​. These are arbitrary functions on matrices, not assumed linear, completely positive or trace preserving;
  • a real number RRR.

The predicate says that RRR is an achievable rate for (Nn)(\mathcal{N}_n)(Nn​), meaning: for every ε>0\varepsilon>0ε>0 and every δ>0\delta>0δ>0 there is N0∈NN_0\in\mathbb{N}N0​∈N such that for every n≥N0n \ge N_0n≥N0​ there exist a natural number kkk with

(R−δ) n≤k(R-\delta)\,n \le k(R−δ)n≤k

and two maps Enc\mathrm{Enc}Enc and Dec\mathrm{Dec}Dec with the following properties.

  • Encoder. Enc\mathrm{Enc}Enc maps kkk-qubit matrices to nnn-qubit matrices and is a channel. Here "is a channel" means there exist m∈Nm\in\mathbb{N}m∈N and matrices A1,…,AmA_1,\dots,A_mA1​,…,Am​ of size 2n×2k2^n\times 2^k2n×2k such that ∑iAi†Ai=I2k\sum_i A_i^\dagger A_i = I_{2^k}∑i​Ai†​Ai​=I2k​ and Enc(ρ)=∑iAiρAi†\mathrm{Enc}(\rho)=\sum_i A_i\rho A_i^\daggerEnc(ρ)=∑i​Ai​ρAi†​ for all ρ\rhoρ.
  • Decoder. Dec\mathrm{Dec}Dec maps matrices indexed by Outn\mathrm{Out}_nOutn​ to kkk-qubit matrices and is a channel in the same sense.
  • Fidelity. The composite Φ=Dec∘Nn∘Enc\Phi = \mathrm{Dec}\circ\mathcal{N}_n\circ\mathrm{Enc}Φ=Dec∘Nn​∘Enc satisfies
1−ε≤F(Φ).1-\varepsilon \le F(\Phi).1−ε≤F(Φ).

The entanglement fidelity FFF is defined as follows. Let

∣Φk⟩=2−k/2∑x∈{0,1}k∣x⟩∣x⟩|\Phi_k\rangle = 2^{-k/2}\sum_{x\in\{0,1\}^k}|x\rangle|x\rangle∣Φk​⟩=2−k/2x∈{0,1}k∑​∣x⟩∣x⟩

on two kkk-qubit registers. Let (id⊗Φ)(\mathrm{id}\otimes\Phi)(id⊗Φ) act on the second register only; its ((p1,p2),(q1,q2))((p_1,p_2),(q_1,q_2))((p1​,p2​),(q1​,q2​)) entry is Φ\PhiΦ applied to the block X(p1,⋅),(q1,⋅)X_{(p_1,\cdot),(q_1,\cdot)}X(p1​,⋅),(q1​,⋅)​, evaluated at (p2,q2)(p_2,q_2)(p2​,q2​). Then

F(Φ)=Re⁡ ⟨Φk∣ (id⊗Φ)(∣Φk⟩⟨Φk∣) ∣Φk⟩.F(\Phi)=\operatorname{Re}\,\langle\Phi_k|\,(\mathrm{id}\otimes\Phi)\big(|\Phi_k\rangle\langle\Phi_k|\big)\,|\Phi_k\rangle.F(Φ)=Re⟨Φk​∣(id⊗Φ)(∣Φk​⟩⟨Φk​∣)∣Φk​⟩.

Edge cases:

  • kkk has no upper bound, so k>nk>nk>n is allowed.
  • When R−δ≤0R-\delta\le 0R−δ≤0, the choice k=0k=0k=0 (a one-dimensional space) is permitted.
  • Nn\mathcal{N}_nNn​ is applied as an arbitrary function.
Definition code
import Definitions.Def_QAlgorithms_Defs_LearningHardInstances
/-!
# Superoperators, quantum channels in Kraus form, the erasure channel, achievable rates
(shared definition layer)

D. Gottesman, *An introduction to quantum error correction and fault-tolerant quantum
computation* (arXiv:0904.2557), cited "Gottesman intro p.N", and D. Gottesman, *Stabilizer
codes and quantum error correction* (PhD thesis, 1997), cited "Gottesman thesis p.N" (PDF pages).

A superoperator is a plain function on matrices (`Superop ι κ`); a quantum operation in the
sources' sense (intro eq. (23), p.4–5: "ρ → Σ_i E_i ρ E_i†, where the E_i s are normalized so
Σ E_i† E_i = I") is a superoperator with a finite normalized Kraus family (`IsChannel`). Equality
of superoperators is equality on every operator, hence (by linearity) on every input state,
superpositions and parts of entangled states included.
-/

namespace QAlgorithms

open scoped ComplexConjugate Matrix

/-- Gottesman intro p.5, eq. (23), and p.20 (§4.2): a superoperator, i.e. a map from operators on
the space indexed by `ι` to operators on the space indexed by `κ`. Unbundled: linearity is
supplied by `IsChannel` or by construction. -/
abbrev Superop (ι κ : Type*) := Matrix ι ι ℂ → Matrix κ κ ℂ

/-- Gottesman intro p.5, eq. (23) (thesis p.90, §7.5): the Kraus operators `E j : κ × ι` are
normalized, `Σ_j E_j† E_j = I`. -/
def IsKrausFamily {K ι κ : Type*} [Fintype K] [Fintype κ] [DecidableEq ι]
    (E : K → Matrix κ ι ℂ) : Prop :=
  ∑ j, (E j)ᴴ * E j = 1

/-- Gottesman intro p.5, eq. (23): the map `ρ ↦ Σ_j E_j ρ E_j†`. -/
noncomputable def krausApply {K ι κ : Type*} [Fintype K] [Fintype ι]
    (E : K → Matrix κ ι ℂ) : Superop ι κ :=
  fun ρ => ∑ j, E j * ρ * (E j)ᴴ

/-- Gottesman intro pp.4–5, eq. (23) (thesis p.90): `Φ` is a quantum operation ("the most
general quantum operation, including decoherence"): it is given by some finite normalized Kraus
family. In finite dimension these are exactly the trace-preserving completely positive maps. -/
def IsChannel {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] (Φ : Superop ι κ) : Prop :=
  ∃ (m : ℕ) (E : Fin m → Matrix κ ι ℂ), IsKrausFamily E ∧ ∀ ρ, Φ ρ = krausApply E ρ

/-- Gottesman intro p.19 (Def. 1) and p.37 (the *-decoder): the single-Kraus map
`ρ ↦ A ρ A†` (a unitary gate, an isometry, a projector such as an r-filter). -/
def conjSuperop {ι κ : Type*} [Fintype ι] (A : Matrix κ ι ℂ) : Superop ι κ :=
  fun ρ => A * ρ * Aᴴ

/-- Gottesman intro p.21 (Def. 4) and p.35 (Def. 8): the tensor product
`Φ_0 ⊗ ⋯ ⊗ Φ_{k−1}` of superoperators acting on `k` registers (a separate filter, decoder or EC
on each block), defined on every operator through the matrix-unit expansion
`X = Σ_{x,x'} X_{x x'} ⊗_i |x_i⟩⟨x'_i|`, so entangled inputs are included. -/
noncomputable def piSuperop {ι κ : Type*} [Fintype ι] [DecidableEq ι] {k : ℕ}
    (Φ : Fin k → Superop ι κ) : Superop (Fin k → ι) (Fin k → κ) :=
  fun X => Matrix.of fun y y' =>
    ∑ x : Fin k → ι, ∑ x' : Fin k → ι,
      X x x' * ∏ i, Φ i (Matrix.single (x i) (x' i) 1) (y i) (y' i)

/-- Gottesman thesis p.90 (§7.4–7.5, the 1-EPP picture): `id_R ⊗ Φ`, with the reference `R` the
first factor: `Φ` is applied to every block `X_{a a'} = (X_{(a,i),(a',i')})_{i,i'}`. -/
def idTensorSuperop {R ι κ : Type*} (Φ : Superop ι κ) : Superop (R × ι) (R × κ) :=
  fun X => Matrix.of fun p q => Φ (Matrix.of fun i i' => X (p.1, i) (q.1, i')) p.2 q.2

/-- Overwrite the registers in the range of `w` of the configuration `y` by `z` (helper for
`liftSuperop`). -/
noncomputable def overwrite {α : Type*} {k N : ℕ} (w : Fin k ↪ Fin N) (y : Fin N → α)
    (z : Fin k → α) : Fin N → α :=
  open Classical in
  fun a => if h : ∃ i, w i = a then z h.choose else y a

/-- Gottesman intro p.18 (§4.1: "an error that can affect all of the qubits involved in the
action") and p.40 (Def. 12): the superoperator `Ψ`, acting on the `k` registers in the range of
`w` together with an extra factor `E` (the environment), lifted to `N` registers, the identity on
the registers outside the range of `w`. Entry `((y, e), (y', e'))` is `Ψ` applied to the block of
`X` with the outside configurations of `y` and `y'` held fixed, evaluated at the inside
configurations `y ∘ w`, `y' ∘ w`; this is `id_outside ⊗ Ψ` (off-diagonal outside blocks are kept,
as for any superoperator that is the identity on a factor). -/
noncomputable def liftSuperop {α E : Type*} {k N : ℕ} (w : Fin k ↪ Fin N)
    (Ψ : Superop ((Fin k → α) × E) ((Fin k → α) × E)) :
    Superop ((Fin N → α) × E) ((Fin N → α) × E) :=
  fun X => Matrix.of fun p q =>
    Ψ (Matrix.of fun a b => X (overwrite w p.1 a.1, a.2) (overwrite w q.1 b.1, b.2))
      (p.1 ∘ w, p.2) (q.1 ∘ w, q.2)

/-- Gottesman thesis pp.89–90 (§7.4–7.5): `k` EPR pairs, the maximally entangled state
`|Φ_k⟩ = 2^{−k/2} Σ_{x ∈ {0,1}^k} |x⟩|x⟩` on `Qubits k × Qubits k`, reference register first. -/
noncomputable def maxEntangled (k : ℕ) : EuclideanSpace ℂ (Qubits k × Qubits k) :=
  WithLp.toLp 2 fun p => if p.1 = p.2 then ((Real.sqrt ((2 : ℝ) ^ k))⁻¹ : ℂ) else 0

/-- Gottesman thesis pp.89–90 (§7.4: a 1-EPP succeeds when Bob's pairs are good EPR pairs): the
entanglement fidelity `⟨Φ_k| (id ⊗ Φ)(|Φ_k⟩⟨Φ_k|) |Φ_k⟩` of a superoperator `Φ` on `k` qubits
(real part; it is real for a channel). -/
noncomputable def entanglementFidelity {k : ℕ} (Φ : Superop (Qubits k) (Qubits k)) : ℝ :=
  (∑ a, ∑ b, conj (maxEntangled k a) *
    (idTensorSuperop (R := Qubits k) Φ (pureDensity (maxEntangled k))) a b *
      maxEntangled k b).re

/-- Gottesman thesis p.90 (§7.5): the Kraus operators of the qubit erasure channel with erasure
probability `p` and an erasure flag (output `(qubit, flag)`). Index `0` is `√(1−p) |ψ⟩ ↦ |ψ⟩|0⟩`;
indices `1, …, 4` are `√(p/2) |a⟩|1⟩⟨c|` for `(a, c) = (0,0), (0,1), (1,0), (1,1)`. The channel is
`ρ ↦ (1 − p) ρ ⊗ |0⟩⟨0| + p Tr(ρ) (I/2) ⊗ |1⟩⟨1|`: with probability `p` the qubit is replaced by
the maximally mixed state ("totally randomized") and the receiver learns which qubit it was.
Normalized for `0 ≤ p ≤ 1`, the source's range (a hypothesis of the statements). -/
noncomputable def erasureKraus (p : ℝ) : Fin 5 → Matrix (Bool × Bool) Bool ℂ :=
  let flip : Bool → Bool → Matrix (Bool × Bool) Bool ℂ := fun a c =>
    Matrix.of fun o b => if o = (a, true) ∧ b = c then (Real.sqrt (p / 2) : ℂ) else 0
  ![Matrix.of fun o b => if o = (b, false) then (Real.sqrt (1 - p) : ℂ) else 0,
    flip false false, flip false true, flip true false, flip true true]

/-- Gottesman thesis p.90 (§7.5): the erasure channel applied independently to each of `n`
qubits, with product Kraus operators; output register `q` holds `(qubit q, flag q)`. -/
noncomputable def erasureChannel (n : ℕ) (p : ℝ) : Superop (Qubits n) (Fin n → Bool × Bool) :=
  krausApply fun j : Fin n → Fin 5 => Matrix.of fun y z => ∏ q, erasureKraus p (j q) (y q) (z q)

/-- Gottesman thesis p.80 (§7.1: capacity in the limit of infinitely many qubits sent, rate
`k/n`), p.89 (§7.4: quantum codes = 1-EPPs, success = good EPR pairs) and p.91 (§7.5): `R` is an
achievable rate of unassisted quantum communication over the family `Nch n` of `n`-use channels:
for every `ε, δ > 0`, for all large `n` there are `k ≥ (R − δ) n` and an encoding channel and a
decoding channel (arbitrary quantum operations; no back communication) with entanglement fidelity
at least `1 − ε`. The capacity is the supremum of the achievable rates; statements give it as a
two-sided threshold. -/
def IsAchievableQRate {Out : ℕ → Type*} [∀ n, Fintype (Out n)] [∀ n, DecidableEq (Out n)]
    (Nch : (n : ℕ) → Superop (Qubits n) (Out n)) (R : ℝ) : Prop :=
  ∀ ε > (0 : ℝ), ∀ δ > (0 : ℝ), ∃ N₀ : ℕ, ∀ n ≥ N₀, ∃ k : ℕ, (R - δ) * n ≤ k ∧
    ∃ Enc : Superop (Qubits k) (Qubits n), IsChannel Enc ∧
      ∃ Dec : Superop (Out n) (Qubits k), IsChannel Dec ∧
        1 - ε ≤ entanglementFidelity (Dec ∘ Nch n ∘ Enc)

/-! ### Sanity tests -/

example {ι : Type*} [Fintype ι] [DecidableEq ι] : IsChannel (fun ρ : Matrix ι ι ℂ => ρ) :=
  ⟨1, fun _ => 1, by simp [IsKrausFamily], fun ρ => by simp [krausApply]⟩

example {ι κ : Type*} [Fintype ι] (A : Matrix κ ι ℂ) (ρ : Matrix ι ι ℂ) :
    conjSuperop A ρ = krausApply (fun _ : Fin 1 => A) ρ := by
  simp [conjSuperop, krausApply]

example {R ι : Type*} (X : Matrix (R × ι) (R × ι) ℂ) :
    idTensorSuperop (R := R) (fun ρ : Matrix ι ι ℂ => ρ) X = X := by
  ext p q; rfl

example : maxEntangled 0 (fun _ => false, fun _ => false) = 1 := by
  simp [maxEntangled]

example (k : ℕ) (x : Qubits k) :
    maxEntangled k (x, x) = ((Real.sqrt ((2 : ℝ) ^ k))⁻¹ : ℂ) := by
  simp [maxEntangled]

example : erasureKraus 0 0 (true, false) true = 1 ∧ erasureKraus 0 1 (false, true) false = 0 := by
  simp [erasureKraus]

theorem erasureKraus_isKraus {p : ℝ} (h0 : 0 ≤ p) (h1 : p ≤ 1) : IsKrausFamily (erasureKraus p) := by
  have ha : ((Real.sqrt (1 - p) : ℂ)) * (Real.sqrt (1 - p) : ℂ) = ((1 - p : ℝ) : ℂ) := by
    rw [← Complex.ofReal_mul, Real.mul_self_sqrt (by linarith)]
  have hb : ((Real.sqrt (p / 2) : ℂ)) * (Real.sqrt (p / 2) : ℂ) = ((p / 2 : ℝ) : ℂ) := by
    rw [← Complex.ofReal_mul, Real.mul_self_sqrt (by linarith)]
  ext b c
  simp only [IsKrausFamily, Fin.sum_univ_five, Matrix.add_apply, Matrix.mul_apply,
    Matrix.conjTranspose_apply, Fintype.sum_prod_type, Fintype.sum_bool, erasureKraus,
    Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.cons_val_three,
    Matrix.cons_val_four, Matrix.head_cons, Matrix.of_apply]
  have hp2 : ((Real.sqrt p : ℝ) : ℂ) ^ 2 = (p : ℂ) := by
    rw [← Complex.ofReal_pow, Real.sq_sqrt h0]
  have h22 : ((Real.sqrt 2 : ℝ) : ℂ) ^ 2 = 2 := by
    rw [← Complex.ofReal_pow, Real.sq_sqrt (by norm_num)]; norm_num
  have key : ((Real.sqrt p : ℝ) : ℂ) / ((Real.sqrt 2 : ℝ) : ℂ) *
      (((Real.sqrt p : ℝ) : ℂ) / ((Real.sqrt 2 : ℝ) : ℂ)) = (p : ℂ) / 2 := by
    rw [div_mul_div_comm, ← sq, ← sq, hp2, h22]
  cases b <;> cases c <;> simp [Matrix.one_apply, Complex.conj_ofReal, ha, hb] <;>
    rw [key] <;> ring

end QAlgorithms
Source
https://github.com/shiy1022/lean-quantum-complexity/blob/main/algorithms/QAlgorithms/Defs/Channel.lean . Exact primary-source page locators are preserved in the declaration docstrings.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me