Relational verification of quantum programs has many potential applications in quantum and post-quantum security and other domains. We propose a relational program logic for quantum programs. The interpretation of our logic is based on a quantum analogue of probabilistic couplings. We use our logic to verify non-trivial relational properties of quantum programs, including uniformity for samples generated by the quantum Bernoulli factory, reliability of quantum teleportation against noise (bit and phase flip), security of quantum one-time pad and equivalence of quantum walks. 's theorem states that there exists a B-coupling between two distributions µ and µ ′ over sets X andIf ρ is a coupling for ρ 1 , ρ 2 , then they have the same trace: tr(ρ) = tr(ρ 1 ) = tr(ρ 2 ).The following are examples of quantum couplings. They are quantum generalisations of several typical examples of (discrete) probabilistic couplings (see [Barthe et al. 2019]). From these simple examples, we can see a close and natural correspondence as well as some essential differences between probabilistic coupling and their quantum counterparts. Our first example shows that couplings always exist.
E3.1. Let ρ 1 ∈ D(H 1 ) and ρ 2 ∈ D(H 2 ) be density operators. The tensor product ρ ⊗ = ρ 1 ⊗ ρ 2 is a coupling for ρ 1 , ρ 2 .Just like the case for probabilistic couplings, there can be more than one quantum coupling between two operators.The coupling ρ id(B) in Example 3.3 is a witness of the lifting ρ(= sym ) # ρ, defining = sym to be the symmetrisation operator, i.e. (= sym ) ≡ 1 2 (I ⊗ I + S), where S is the SWAP operator defined by S |φ,ψ = |ψ , φ for any |φ , |ψ ∈ H together with linearity. Operator S is independent of the basis, and given any orthonormal basis {|i } of H , S has the following form: S = i j |i j | ⊗ |j i |.(4) The coupling ρ 1 ⊗ ρ 2 in Example 3.1 is a witness of the lifting ρ 1 (H 1 ⊗ H 2 ) # ρ 2 .The two operators = B and = sym in the above example represents two different kind of symmetry between two quantum systems with the same state Hilbert space H . They will be used to describe relational properties of the two quantum programs P 1 , P 2 in Example 1.1. Liftings of equality are especially interesting for verification, since they can be interpreted as relating equivalent quantum systems. The following proposition characterizes these liftings.
P3.2. Let ρ 1 , ρ 2 ∈ D ≤ (H ). The following statements are equivalent: 1. ρ 1 = ρ 2 ; 2. there exists an orthonormal basis B s.t. ρ 1 (= B ) # ρ 2 ;