Documentation

Kraus.Basic

Kraus operator automata and projection-valued measures #

We define the language accepted by a measure-once Kraus operator automaton, and a family of examples due to Grudka et al.

References:

def krausApply {R : Type u_1} [Mul R] [Star R] [AddCommMonoid R] {q : Type u_2} {r : Type u_3} [Fintype q] [Fintype r] [DecidableEq q] [DecidableEq r] (K : rMatrix q q R) (ρ : Matrix q q R) :
Matrix q q R

Completely positive map given by a (not necessarily minimal) Kraus family.

Equations
Instances For
    theorem krausApply_psd {R : Type u_1} [Ring R] [PartialOrder R] [StarRing R] [AddLeftMono R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) (ρ : Matrix (Fin q) (Fin q) R) ( : ρ.PosSemidef) :

    Kraus operator preserves PSD property.

    def quantumChannel {R : Type u_1} [Mul R] [One R] [Star R] [AddCommMonoid R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) :
    Equations
    Instances For
      def quantumOperation {R : Type u_1} [RCLike R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) :
      Equations
      Instances For
        def densityMatrix {R : Type u_1} [Ring R] [PartialOrder R] [StarRing R] (q : ) :
        Type u_1
        Equations
        Instances For
          def subNormalizedDensityMatrix {R : Type u_1} [Ring R] [PartialOrder R] [StarRing R] (q : ) :
          Type u_1
          Equations
          Instances For
            def quantum_channel {R : Type u_1} [Ring R] [PartialOrder R] [StarRing R] (q r : ) :
            Type u_1
            Equations
            Instances For
              theorem quantumChannel_preserves_trace {R : Type u_1} [CommRing R] [PartialOrder R] [StarRing R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) (hq : quantumChannel K) (ρ : Matrix (Fin q) (Fin q) R) :
              theorem quantum_channel_preserves_trace {R : Type u_1} [CommRing R] [PartialOrder R] [StarRing R] {q r : } (K : quantum_channel q r) (ρ : Matrix (Fin q) (Fin q) R) :
              (krausApply (↑K) ρ).trace = ρ.trace
              theorem quantumChannel_preserves_trace_one {R : Type u_1} [CommRing R] [PartialOrder R] [StarRing R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) (hq : quantumChannel K) (ρ : Matrix (Fin q) (Fin q) R) ( : ρ.trace = 1) :
              (krausApply K ρ).trace = 1
              def krausApply_densityMatrix {R : Type u_1} [CommRing R] [PartialOrder R] [StarRing R] [AddLeftMono R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) (hq : quantumChannel K) (ρ : densityMatrix q) :

              Realizing a quantumChannel as a map on densityMatrices.

              Equations
              Instances For
                def krausApplyWord {α : Type u_1} {R : Type u_2} [Mul R] [Star R] [AddCommMonoid R] {n q r : } (word : Fin nα) (𝓚 : αFin rMatrix (Fin q) (Fin q) R) (ρ : Matrix (Fin q) (Fin q) R) :
                Matrix (Fin q) (Fin q) R

                Transition function δ^* corresponding to a word word over an alphabet α, where each symbol a:α is mapped to a completely positive map in Kraus form, of rank at most r.

                Equations
                Instances For
                  theorem krausApplyWord_densityMatrix {α : Type u_1} {R : Type u_2} [CommRing R] [StarRing R] [PartialOrder R] [AddLeftMono R] {n q r : } (word : Fin nα) {𝓚 : αFin rMatrix (Fin q) (Fin q) R} (hq : ∀ (a : α), quantumChannel (𝓚 a)) (ρ : densityMatrix q) :
                  (krausApplyWord word 𝓚 ρ).PosSemidef (krausApplyWord word 𝓚 ρ).trace = 1

                  As long as we have a quantum channel, we can iterate over a word and stay within the density matrices.

                  def krausApplyWord_map {α : Type u_1} {R : Type u_2} [CommRing R] [StarRing R] [PartialOrder R] [AddLeftMono R] {n q r : } (word : Fin nα) (𝓚 : αFin rMatrix (Fin q) (Fin q) R) (hq : ∀ (a : α), quantumChannel (𝓚 a)) (ρ : densityMatrix q) :

                  If each letter is a quantum channel then the whole word maps density matrices to density matrices.

                  Equations
                  Instances For
                    def krausApplyWord_channel {α : Type u_1} {R : Type u_2} [CommRing R] [StarRing R] [PartialOrder R] [AddLeftMono R] {n q r : } (word : Fin nα) (𝓚 : αquantum_channel q r) (ρ : densityMatrix q) :
                    Equations
                    Instances For
                      def grudka_Z :
                      Fin 2Fin 2Matrix (Fin 3) (Fin 3)

                      The example Kraus operators from QCNC submission.

                      Equations
                      • grudka_Z = ![![!![0, 0, 0; 1, 0, 0; 0, 0, 0], !![0, 0, 0; 0, 0, -1; 0, 1, 0]], ![!![0, -1, 0; 1, 0, 0; 0, 0, 1], 0]]
                      Instances For
                        def grudka_R₀ {R : Type u_1} [RCLike R] :
                        Fin 2Fin 2Matrix (Fin 3) (Fin 3) R
                        Equations
                        Instances For
                          noncomputable def grudka_R (θ : ) :
                          Fin 2Fin 2Matrix (Fin 3) (Fin 3)
                          Equations
                          Instances For
                            noncomputable def grudka_C (θ : ) :
                            Fin 2Fin 2Matrix (Fin 3) (Fin 3)
                            Equations
                            Instances For
                              noncomputable def grudka_map (θ : ) {n : } (word : Fin nFin 2) :

                              Grudka et al.' map does indeed map density matrices to density matrices.

                              Equations
                              Instances For
                                def e₁ {R : Type u_1} [One R] [Zero R] :
                                Matrix (Fin 3) (Fin 1) R
                                Equations
                                Instances For
                                  def e₂ {R : Type u_1} [One R] [Zero R] :
                                  Matrix (Fin 3) (Fin 1) R
                                  Equations
                                  Instances For
                                    def e₃ {R : Type u_1} [One R] [Zero R] :
                                    Matrix (Fin 3) (Fin 1) R
                                    Equations
                                    Instances For
                                      def e {R : Type u_1} [One R] [Zero R] {k : } :
                                      Fin kMatrix (Fin k) (Fin 1) R
                                      Equations
                                      Instances For
                                        def pureState {R : Type u_1} [Mul R] [Add R] [Zero R] {k : } (e : Matrix (Fin k) (Fin 1) R) :
                                        Matrix (Fin k) (Fin k) R
                                        Equations
                                        Instances For
                                          def pureState_C {R : Type u_1} [Mul R] [Add R] [Zero R] [Star R] {k : } (e : Matrix (Fin k) (Fin 1) R) :
                                          Matrix (Fin k) (Fin k) R
                                          Equations
                                          Instances For
                                            theorem pureState_selfAdjoint_C {R : Type u_1} [Ring R] [StarRing R] {k : } (e : Matrix (Fin k) (Fin 1) R) :
                                            def pureState_projection'_C {R : Type u_1} [RCLike R] {k : } (e : EuclideanSpace R (Fin k)) (he : e = 1) :
                                            IsStarProjection (pureState_C fun (i : Fin k) (x : Fin 1) => e.ofLp i)
                                            Equations
                                            • =
                                            Instances For
                                              def pureState_projection' {k : } (e : EuclideanSpace (Fin k)) (he : e = 1) :
                                              IsStarProjection (pureState fun (i : Fin k) (x : Fin 1) => e.ofLp i)
                                              Equations
                                              • =
                                              Instances For
                                                theorem pureState_projection_C {R : Type u_1} [Ring R] [StarRing R] {k : } (i : Fin k) :

                                                Projection onto span ⟨e₁, e₂⟩ is indeed a star-projection. So we could form a PMF with two outcomes (e₁,e₂) vs. e₃.

                                                theorem psd_versions_general {R : Type u_1} [Ring R] [StarRing R] [PartialOrder R] {k : } (e : Matrix (Fin k) (Fin k) R) (x : Fin k →₀ R) (this : 0 star x ⬝ᵥ e.mulVec x) :
                                                0 x.sum fun (i : Fin k) (xi : R) => x.sum fun (j : Fin k) (xj : R) => star xi * e i j * xj
                                                theorem psd_versions {k : } (e : Matrix (Fin k) (Fin k) ) (x : Fin k →₀ ) (this : 0 x ⬝ᵥ e.mulVec x) :
                                                0 x.sum fun (i : Fin k) (xi : ) => x.sum fun (j : Fin k) (xj : ) => star xi * e i j * xj
                                                theorem pureState_psd {k : } (e : Matrix (Fin k) (Fin 1) ) :
                                                theorem matrix_identity_general {R : Type u_1} [RCLike R] (k : ) (e : Matrix (Fin k) (Fin 1) R) (α : Fin kR) :
                                                theorem pureState_psd_C {R : Type u_1} [RCLike R] [PartialOrder R] [StarOrderedRing R] {k : } (e : Matrix (Fin k) (Fin 1) R) :
                                                theorem pureState_probability_one {ρ : Matrix (Fin 3) (Fin 3) } ( : ρ.trace = 1) :

                                                The positive operator pureState e₁ is chosen with probability (pureState e₁ * ρ).trace.

                                                theorem pureState_probability_one_C {R : Type u_1} [RCLike R] {ρ : Matrix (Fin 3) (Fin 3) R} ( : ρ.trace = 1) :
                                                theorem pure_state_eq_C {R : Type u_1} [RCLike R] {k : } (i : Fin k) :
                                                theorem matrix_posSemidef_eq_star_mul_self' {n : } (P : Matrix (Fin n) (Fin n) ) (hP : 0 P) :
                                                ∃ (B : Matrix (Fin n) (Fin n) ), P = star B * B

                                                Jireh recommends this approach.

                                                theorem matrix_posSemidef_eq_star_mul_self'_C {R : Type u_1} [RCLike R] {n : } (P : Matrix (Fin n) (Fin n) R) (hP : 0 P) :
                                                ∃ (B : Matrix (Fin n) (Fin n) R), P = star B * B
                                                theorem trace_mul_posSemidef_nonneg {n : } {ρ P : Matrix (Fin n) (Fin n) } ( : ρ.PosSemidef) (hP : P.PosSemidef) :
                                                0 (P * ρ).trace
                                                theorem trace_mul_posSemidef_nonneg_general {R : Type u_1} [RCLike R] {n : } {ρ P : Matrix (Fin n) (Fin n) R} ( : ρ 0) (hP : P 0) :
                                                0 (P * ρ).trace
                                                theorem quantumOperation_reduces_trace {R : Type u_1} [RCLike R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) (hq : quantumOperation K) (ρ : Matrix (Fin q) (Fin q) R) ( : 0 ρ) :

                                                Feb 1, 2026

                                                theorem quantumOperation_preserves_trace_le_one {R : Type u_1} [RCLike R] {q r : } (K : Fin rMatrix (Fin q) (Fin q) R) (hq : quantumOperation K) (ρ : Matrix (Fin q) (Fin q) R) ( : 0 ρ) (hρ₁ : ρ.trace 1) :

                                                Feb 1, 2026 Realizing a quantumChannel as a map on densityMatrices.

                                                Equations
                                                Instances For
                                                  theorem krausApplyWord_subNormalizedDensityMatrix {α : Type u_1} {R : Type u_2} [RCLike R] {n q r : } (word : Fin nα) {𝓚 : αFin rMatrix (Fin q) (Fin q) R} (hq : ∀ (a : α), quantumOperation (𝓚 a)) (ρ : subNormalizedDensityMatrix q) :
                                                  (krausApplyWord word 𝓚 ρ).PosSemidef (krausApplyWord word 𝓚 ρ).trace 1
                                                  def krausApplyWord_map_sub {α : Type u_1} {R : Type u_2} [RCLike R] {n q r : } (word : Fin nα) (𝓚 : αFin rMatrix (Fin q) (Fin q) R) (hq : ∀ (a : α), quantumOperation (𝓚 a)) (ρ : subNormalizedDensityMatrix q) :

                                                  If each letter is a quantum channel then the whole word maps density matrices to density matrices.

                                                  Equations
                                                  Instances For
                                                    theorem posSemidef_of_isStarProjection_C {R : Type u_1} [RCLike R] {n : } (P : Matrix (Fin n) (Fin n) R) (hP : IsStarProjection P) :
                                                    theorem trace_mul_nonneg {n : } {ρ P : Matrix (Fin n) (Fin n) } (hρ' : ρ.PosSemidef) (hP : IsStarProjection P) :
                                                    0 (P * ρ).trace
                                                    theorem trace_mul_nonneg_C {R : Type u_1} [RCLike R] {n : } {ρ P : Matrix (Fin n) (Fin n) R} (hρ' : ρ.PosSemidef) (hP : IsStarProjection P) :
                                                    0 (P * ρ).trace
                                                    theorem nonneg_trace' {n : } {ρ : Matrix (Fin n) (Fin n) } (hρ' : ρ.PosSemidef) (e : Matrix (Fin n) (Fin 1) ) (he : WithLp.toLp 2 fun (i : Fin n) => e i 0 = 1) :
                                                    0 (pureState e * ρ).trace

                                                    A general reason why nonneg_trace below holds. Can be generalized to let (e * eᵀ) be any projection, see above ^^.

                                                    theorem nonneg_trace'_C {R : Type u_1} [RCLike R] {n : } {ρ : Matrix (Fin n) (Fin n) R} (hρ' : ρ.PosSemidef) (e : Matrix (Fin n) (Fin 1) R) (he : WithLp.toLp 2 fun (i : Fin n) => e i 0 = 1) :
                                                    theorem nonneg_trace_of_posSemidef {n : } {ρ : Matrix (Fin n) (Fin n) } (hρ' : ρ.PosSemidef) (i : Fin n) :
                                                    0 (pureState (e i) * ρ).trace
                                                    theorem nonneg_trace_of_posSemidef_C {R : Type u_1} [RCLike R] {n : } {ρ : Matrix (Fin n) (Fin n) R} (hρ' : ρ.PosSemidef) (i : Fin n) :
                                                    0 (pureState_C (e i) * ρ).trace
                                                    theorem sum_rows {k : } (ρ : Matrix (Fin k) (Fin k) ) :
                                                    x : Fin k, Matrix.of (Function.update 0 x (ρ.row x)) = ρ
                                                    theorem sum_rows_C {R : Type u_1} [RCLike R] {k : } (ρ : Matrix (Fin k) (Fin k) R) :
                                                    x : Fin k, Matrix.of (Function.update 0 x (ρ.row x)) = ρ
                                                    theorem single_row {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (x : Fin k) :
                                                    theorem combined_rows {k : } (ρ : Matrix (Fin k) (Fin k) ) :
                                                    x : Fin k, Matrix.single x x 1 * ρ = ρ
                                                    theorem POVM_PMF.aux₀ {k : } {ρ : Matrix (Fin k) (Fin k) } ( : ρ.trace = 1) (hρ' : ρ.PosSemidef) :
                                                    a : Fin k, (pureState (e a) * ρ).trace, = ENNReal.toNNReal 1
                                                    theorem standard_basis_probability_one {k : } {ρ : Matrix (Fin k) (Fin k) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                    a : Fin k, (pureState (e a) * ρ).trace, = 1
                                                    theorem standard_basis_probability_one_C {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) :
                                                    a : Fin k, (pureState_C (e a) * ρ).trace = 1

                                                    Unlike standard_basis_probability_one this one does not require PSD.

                                                    theorem standard_basis_probability_general {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} :
                                                    a : Fin k, (pureState_C (e a) * ρ).trace = ρ.trace
                                                    def subPMF (α : Type u_1) :
                                                    Type u_1
                                                    Equations
                                                    Instances For
                                                      def subPMF.ofFinset (α : Type u_1) (f : αENNReal) (s : Finset α) (h : as, f a 1) (h' : as, f a = 0) :
                                                      Equations
                                                      Instances For
                                                        def subPMF.ofFintype (α : Type u_1) [Fintype α] (f : αENNReal) (h : a : α, f a 1) :
                                                        Equations
                                                        Instances For
                                                          noncomputable def POVM_PMF {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) (hPS : 0 ρ) :
                                                          PMF (Fin k)

                                                          Positive operator (or projection) valued measure as a probability mass function. Technically the measure is valued in Fin k although pureState (e i) can stand for i. Could be generalized to let e be any orthonormal basis.

                                                          pureState_psd shows that it is a POVM. pureState_projection shows that it is in fact a PVM for the standard basis. In fact pureState_projection' shows it's a projection whenever the vectors have length 1.

                                                          Equations
                                                          Instances For
                                                            noncomputable def POVM_subPMF {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace 1) (hPS : 0 ρ) :

                                                            Feb 1, 2026

                                                            Equations
                                                            Instances For
                                                              noncomputable def POVM_PMF' {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                              PMF (Fin k)
                                                              Equations
                                                              Instances For
                                                                noncomputable def POVM_subPMF' {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace 1) (hPS : ρ.PosSemidef) :
                                                                Equations
                                                                Instances For
                                                                  theorem PMF₂₃help {R : Type u_1} [RCLike R] {ρ : Matrix (Fin 3) (Fin 3) R} (hPS : ρ.PosSemidef) :
                                                                  0 ((pureState_C (e 0) + pureState_C (e 1)) * ρ).trace
                                                                  def PVM_PMF₂₃ {ρ : Matrix (Fin 3) (Fin 3) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                  PMF (Fin 2)

                                                                  A probability measure that gives the probability of being in the xy-plane, or the z-axis, for a given PSD trace-one matrix ρ. See myPVM₂₃ below.

                                                                  Equations
                                                                  Instances For
                                                                    theorem one_eq_sum_pureState {R : Type u_1} [RCLike R] {k : } :
                                                                    1 = i : Fin k, pureState_C (e i)
                                                                    theorem one_eq_sum_pureState_R {k : } :
                                                                    1 = i : Fin k, pureState (e i)
                                                                    theorem sum_one_sub₀ {R : Type u_1} [Ring R] {k : } (acc : Fin k) (f : Fin kMatrix (Fin k) (Fin k) R) :
                                                                    i : Fin k, f i - f acc = i : Fin k, if i = acc then 0 else f i
                                                                    theorem trace_one_sub_C {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hPS : ρ.PosSemidef) :
                                                                    0 ((1 - pureState_C (e acc)) * ρ).trace
                                                                    theorem trace_one_sub {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) } (hPS : ρ.PosSemidef) :
                                                                    0 ((1 - pureState (e acc)) * ρ).trace
                                                                    theorem PMF_of_state.sum_one {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                    i : Fin 2, ↑(if i = 0 then ((1 - pureState (e acc)) * ρ).trace, else (pureState (e acc) * ρ).trace, ) = 1
                                                                    theorem ofReal_inj_aux {k : } (J : Fin k) (hnn : ∀ (a : Fin k), J a 0) :
                                                                    a : Fin k, J a, = a : Fin k, J a,
                                                                    theorem RCLike.re_sum {R : Type u_1} [RCLike R] {α : Type u_2} (s : Finset α) (f : αR) :
                                                                    re (∑ is, f i) = is, re (f i)

                                                                    Had to make this lemma as it seems missing in Mathlib.

                                                                    theorem RCLike.sub_re {R : Type u_1} [RCLike R] (z w : R) :
                                                                    re (z - w) = re z - re w

                                                                    Had to make this lemma as it seems missing in Mathlib.

                                                                    theorem PMF_of_state.sum_one_general {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                    i : Fin 2, ↑(if i = 0 then RCLike.re ((1 - pureState_C (e acc)) * ρ).trace, else RCLike.re (pureState_C (e acc) * ρ).trace, ) = 1
                                                                    theorem pure_trace_one_sub_re {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hPS : ρ.PosSemidef) :
                                                                    0 RCLike.re ((1 - pureState_C (e acc)) * ρ).trace
                                                                    theorem pure_trace_nonneg_re {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hPS : ρ.PosSemidef) :
                                                                    theorem trace_nonneg_re {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hPS : ρ.PosSemidef) :
                                                                    theorem PMF_of_state.sum_one_general_general {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hPS : ρ.PosSemidef) :
                                                                    i : Fin 2, ↑(if i = 0 then RCLike.re ((1 - pureState_C (e acc)) * ρ).trace, else RCLike.re (pureState_C (e acc) * ρ).trace, ) = RCLike.re ρ.trace,
                                                                    def PMF_of_state {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                    PMF (Fin 2)

                                                                    Defining a Bernoulli probability measure by declaring that e_{acc} is the accepted subspace.

                                                                    Equations
                                                                    Instances For
                                                                      noncomputable def PMF_of_state_general {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                      PMF (Fin 2)
                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        noncomputable def subPMF_of_state_general {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace 1) (hPS : ρ.PosSemidef) :

                                                                        To use conditional computability here we would need to know the state had positive trace.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          noncomputable def PMF_of_state_bern {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace 1) (hPS : ρ.PosSemidef) :

                                                                          Feb 1, 2026: nonincreasing trace operators and a PMF.

                                                                          Equations
                                                                          Instances For
                                                                            structure PVM :

                                                                            Projection-valued measure.

                                                                            Instances For
                                                                              structure PVM_C {R : Type u_1} [RCLike R] :
                                                                              Type u_1
                                                                              Instances For
                                                                                theorem trace_real_of_projection_and_pos_semidef {R : Type u_1} [RCLike R] {k : } (ρ O : Matrix (Fin k) (Fin k) R) (g₀ : ρ.IsHermitian) (g₁ : O.IsHermitian) :
                                                                                (O * ρ).trace = star (O * ρ).trace
                                                                                theorem im_zero_PVM {R : Type u_1} [RCLike R] (M : PVM_C) (i : Fin M.t) :
                                                                                RCLike.im (M.op i * M.ρ).trace = 0

                                                                                The probability is given as a real part of a complex number. Fortunately, the imaginary part is zero.

                                                                                noncomputable def myPVM {k : } {ρ : Matrix (Fin k) (Fin k) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                                Equations
                                                                                Instances For
                                                                                  noncomputable def myPVM_C {R : Type u_1} [RCLike R] {k : } {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                                  Equations
                                                                                  Instances For
                                                                                    def myPVM₂₃ {ρ : Matrix (Fin 3) (Fin 3) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      def PVM_of_state {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) } (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        noncomputable def PVM_of_state_C {R : Type u_1} [RCLike R] {k : } (acc : Fin k) {ρ : Matrix (Fin k) (Fin k) R} (hUT : ρ.trace = 1) (hPS : ρ.PosSemidef) :
                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For
                                                                                          def languageAcceptedBy {α : Type u_1} {q r : } (acceptStateIndex : Fin q.succ) (𝓚 : αFin rMatrix (Fin q.succ) (Fin q.succ) ) :
                                                                                          Set ((n : ) × (Fin nα))

                                                                                          1/24/26

                                                                                          Equations
                                                                                          Instances For
                                                                                            def languageAcceptedBy_C {R : Type u_1} [RCLike R] {α : Type u_2} {q r : } (acceptStateIndex : Fin q.succ) (𝓚 : αFin rMatrix (Fin q.succ) (Fin q.succ) R) :
                                                                                            Set ((n : ) × (Fin nα))
                                                                                            Equations
                                                                                            Instances For
                                                                                              theorem grudka_helper :
                                                                                              Matrix.mulᵣ ![1, 0, 0] (Matrix.transpose ![1, 0, 0]) = !![1, 0, 0; 0, 0, 0; 0, 0, 0]
                                                                                              theorem basisState_trace_one {k : } {i : Fin k.succ} :
                                                                                              (pureState (e i)).trace = 1
                                                                                              theorem basisState_trace_one_C {R : Type u_1} [RCLike R] {k : } {i : Fin k.succ} :
                                                                                              def PVM_of_word_of_channel {α : Type u_1} {r k : } (acc : Fin k.succ) (𝓚 : αFin rMatrix (Fin k.succ) (Fin k.succ) ) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) (word : (n : ) × (Fin nα)) :

                                                                                              The projection-valued measure corresponding to word belong to the measure-once language of KOA 𝓚.

                                                                                              Equations
                                                                                              Instances For
                                                                                                noncomputable def PVM_of_word_of_channel_C {R : Type u_1} [RCLike R] {α : Type u_2} {r k : } (acc : Fin k.succ) (𝓚 : αFin rMatrix (Fin k.succ) (Fin k.succ) R) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) (word : (n : ) × (Fin nα)) :
                                                                                                Equations
                                                                                                Instances For
                                                                                                  def getPVM₃ {α : Type u_1} {r : } (𝓚 : αFin rMatrix (Fin (Nat.succ 2)) (Fin (Nat.succ 2)) ) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) (word : (n : ) × (Fin nα)) :
                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    def MOlanguageAcceptedBy {α : Type u_1} {r k : } (acc : Fin k.succ) (𝓚 : αFin rMatrix (Fin k.succ) (Fin k.succ) ) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) :
                                                                                                    Set ((n : ) × (Fin nα))

                                                                                                    1/25/26 We accept word if starting in e₀ we end up in e₁ with probability at least 1/2.

                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      def MOlanguageAcceptedBy_C {R : Type u_1} [RCLike R] {α : Type u_2} {r k : } (acc : Fin k.succ) (𝓚 : αFin rMatrix (Fin k.succ) (Fin k.succ) R) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) :
                                                                                                      Set ((n : ) × (Fin nα))
                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        theorem MO_language_nonempty {α : Type u_1} {r k : } (𝓚 : αFin rMatrix (Fin k.succ) (Fin k.succ) ) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) :

                                                                                                        If the start and accept states are the same then the empty string is accepted in the measure-once setting.

                                                                                                        For the Grudka channel with start state 0, the probability of accepting the empty word is 1 > 1/2 hence ![] is in the corresponding measure-once language. This can be generalized to any quantum channel.

                                                                                                        def MOlanguageAcceptedBy₃ {α : Type u_1} {r : } (𝓚 : αFin rMatrix (Fin 3) (Fin 3) ) (h𝓚 : ∀ (a : α), quantumChannel (𝓚 a)) :
                                                                                                        Set ((n : ) × (Fin nα))

                                                                                                        Measure-Once language accepted by 𝓚 is {word | Probability that we are in state e₃, and not in the span of e₁,e₂, > 1/2}. q = 2 because we haven't generalized myPVM₂₃ yet

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          def MOlanguageAcceptedBy' {α : Type u_1} {r : } (𝓚 : αquantum_channel 3 r) :
                                                                                                          Set ((n : ) × (Fin nα))
                                                                                                          Equations
                                                                                                          Instances For