Definitions for Classical Shadows for Quantum Process Tomography on Near-term Quantum Computers
DefinitionQAlgorithms_Papers_Independent_Intakethird100_P66The objects the formalized statements of Classical Shadows for Quantum Process Tomography on Near-term Quantum Computers (arXiv:2110.02965) are stated in. Each was checked against the paper by a blind read-back and a moderator.
appendMatrixTensor: Reference-first tensor product on the frozen bit-string register; p.2 Eq.(1).processChoi: Unnormalized Choi matrix, p.2 Eq.(1), constructed by matrix units.processChoiState: Trace-one Choi matrix rho_Lambda=Lambda/2^n, p.2; append-register adapter.processMarginal: Retain both copies of the same physical subsystem, pp.2,14. Summation strings are zero on retained coordinates, counting each outside configuration once. The induced environment is maximally mixed.embedProcessObservable: Extend a subsystem observable by identity on both complements, p.14 A7,A9.BasisChoiceFrame: Finite basis-choice frame, pp.2,4,15. OnlyPaperFrameconstructors supply frames in the named-ensemble claims; arbitrary projectors are not allowed.pauliFrame: Pauli-6, p.2, with redundant outcome relabeling bits for preparation. Averaging gives exactly (1/3)|v><v| on each wire. Fixed outcome zero then prepares all six eigenstates as in the two-sided circuit, p.4.globalFrame: Uniform global Clifford basis on all measured wires, pp.2,4. Finiteness enumerates the entire phase quotient, never a design subset.tensorFrame: Independent fixed blocks, pp.4,15; no gate crosses the block boundary.singleCliffordFrame: Product one-qubit Clifford measurement on m wires, pp.2,13.CliffordBlocks: Fixed partitions into Clifford blocks, pp.4,15. No Pauli/Clifford hybrid ensemble is introduced. The empty frame is the zero-block product.PaperFrame: Exactly Pauli-6 or a fixed Clifford-block partition, Appendix B. Reference and output use independent choices from the same named frame.basisBornWeight: One shot: uniform basis choice followed by its Born outcome, pp.2,4.recordProbability: N independent actual shots, without renormalizing arbitrary weights. For named frames on density matrices these are Born probabilities.basisMeasurementChannel: Constructed complex-linear measurement channel, pp.4,15: the finite coefficient version of the accepted measurement channel.frameInverse: Actual linear inverse, pp.4,15. Zero only totalizes incomplete frames; named PaperFrames are informationally complete. The inverse is linear (d+1)X-Tr(X)I, not the affine formula restricted to rank-one projectors.frameSnapshot: Normalized single-shot reconstruction, pp.4,15.choiSnapshot: Eq.(7): external scale is 2^n for n physical channel qubits.meanChoiSnapshot: Expectation of Eq.(7), permitting indefinite reconstructed matrices.ancillaReconstruction: Appendix B1 expectation, reference first; independent basis choices.twoSidedReconstruction: Appendix B2 expectation: prepare Ui†|0><0|Ui and transpose its reconstructed input factor. Every choice is followed by a fresh channel use.ErrorNorm: Source norms, pp.2,14; trace norm has no factor 1/2.matrixError: The two ordinary matrix norms in II.1/A.3.ReducedRecovers: Uniform recovery of every k-subsystem in one simultaneous event. The estimator precedes the unknown CPTP map and sees exactly N shots.sampleCount: Exact k=0 scalar uses no samples; other real sufficient counts are rounded upward.reducedLog: Common Frobenius logarithm, pp.2,14.traceSampleLog: Trace-norm logarithm: the exponent is 2k, pp.2,14.finiteMax: Finite real maximum, zero only for an empty index type. The theorem families are nonempty (M>0 or k<=n), with nonnegative entries.centeredVariance: Accepted centered shadow variance, extended to raw matrices without a proof binder. The non-Hermitian fallback is never used by a theorem observable. Centering divides by the full measured dimension, not by two.primitiveShotLaw: Frozen oneShotLaw without its unused density-proof parameter: this avoids assuming Choi normalization as a new theorem hypothesis. For CPTP E it is exactly the accepted law on processChoiState E, pp.2,13.primitiveRecordLaw: Independent fresh preparations, counted by actual record length N.PrimitiveReducedRecovers: Generic-primitive simultaneous reduced-process recovery, p.14. The estimator is measurable, as required for the statistical success event.reducedVariance: Full family of ambient embedded 2k-wire Paulis, p.14 A5,A7-A9. Identity coefficients are known exactly.pauliNormEnvelope: Retain the printed Pauli spectral-norm factor, p.14.overlapObservable: Proof-defined observable with transposed input, p.13 A4, fixing the p.2 shorthand.OverlapsRecover: One simultaneous event for all normalized overlaps, II.2. The physical process overlap is 2^n times this target.PrimitiveOverlapsRecover: Same simultaneous task for an arbitrary informationally complete fixed primitive. Measurability rules out interpreting nonmeasurable success sets by outer measure.
import Definitions.Def_QAlgorithms_Defs_ClassicalShadowPrediction
import Definitions.Def_QAlgorithms_Defs_LocalPauliShadows
import Definitions.Def_QAlgorithms_Defs_ProjectiveCliffords
import Definitions.Def_QAlgorithms_Defs_MatrixDistances
import Definitions.Def_QAlgorithms_Defs_QECC
/-!
Statements from Levy, Luo and Clark, arXiv:2110.02965v3.
Only the five nodes marked `state` have theorem declarations. Six deferred nodes
are inventoried in HARD.md. All new definitions are paper-local. Each sample
uses a fresh normalized Choi preparation. Compilation is pending batch handoff.
-/
noncomputable section
open MeasureTheory QAlgorithms ClassicalShadows
open scoped Matrix ComplexConjugate ENNReal
namespace QAlgorithms.Papers.Independent.Intakethird100.P66
attribute [local instance] Classical.propDecidable Classical.typeDecidableEq
/-- Reference-first tensor product on the frozen bit-string register; p.2 Eq.(1). -/
def appendMatrixTensor {a b : ℕ} (A : Space a) (B : Space b) : Space (a + b) :=
(Matrix.kronecker A B).submatrix (qubitsAppendEquiv a b) (qubitsAppendEquiv a b)
/-- Unnormalized Choi matrix, p.2 Eq.(1), constructed by matrix units. -/
def processChoi {n : ℕ} (E : Superop (Qubits n) (Qubits n)) : Space (n + n) :=
Matrix.of fun x y =>
E (Matrix.single (qubitsAppendEquiv n n x).1
(qubitsAppendEquiv n n y).1 1)
(qubitsAppendEquiv n n x).2 (qubitsAppendEquiv n n y).2
/-- Trace-one Choi matrix rho_Lambda=Lambda/2^n, p.2; append-register adapter. -/
def processChoiState {n : ℕ} (E : Superop (Qubits n) (Qubits n)) : Space (n + n) :=
((2 : ℂ) ^ n)⁻¹ • processChoi E
/-- Retain both copies of the same physical subsystem, pp.2,14.
Summation strings are zero on retained coordinates, counting each outside
configuration once. The induced environment is maximally mixed. -/
def processMarginal {n k : ℕ} (rho : Space (n + n)) (w : Fin k ↪ Fin n) : Space (k + k) :=
Matrix.of fun x y => ∑ a : Qubits n, ∑ b : Qubits n,
if (∀ i, a (w i) = false) ∧ (∀ i, b (w i) = false) then
rho (Fin.append (overwrite w a (qubitsAppendEquiv k k x).1)
(overwrite w b (qubitsAppendEquiv k k x).2))
(Fin.append (overwrite w a (qubitsAppendEquiv k k y).1)
(overwrite w b (qubitsAppendEquiv k k y).2))
else 0
/-- Extend a subsystem observable by identity on both complements, p.14 A7,A9. -/
def embedProcessObservable {n k : ℕ} (w : Fin k ↪ Fin n) (O : Space (k + k)) : Space (n + n) :=
Matrix.of fun x y =>
let a := qubitsAppendEquiv n n x
let b := qubitsAppendEquiv n n y
if ∀ j, (¬ ∃ i, w i = j) → a.1 j = b.1 j ∧ a.2 j = b.2 j then
O (Fin.append (a.1 ∘ w) (a.2 ∘ w)) (Fin.append (b.1 ∘ w) (b.2 ∘ w))
else 0
/-- Finite basis-choice frame, pp.2,4,15. Only `PaperFrame` constructors
supply frames in the named-ensemble claims; arbitrary projectors are not allowed. -/
structure BasisChoiceFrame (n : ℕ) where
Basis : Type
finite : Fintype Basis
inhabited : Nonempty Basis
projector : Basis → Qubits n → Space n
attribute [instance] BasisChoiceFrame.finite BasisChoiceFrame.inhabited
/-- Pauli-6, p.2, with redundant outcome relabeling bits for preparation.
Averaging gives exactly (1/3)|v><v| on each wire. Fixed outcome zero then
prepares all six eigenstates as in the two-sided circuit, p.4. -/
def pauliFrame (m : ℕ) : BasisChoiceFrame m where
Basis := GroundStateLearning.ShadowLabel m
finite := inferInstance
inhabited := ⟨fun _ => (.Z, true)⟩
projector a b := ((3 : ℂ) ^ m) • GroundStateLearning.pauliPOVM
(fun j => ((a j).1, if b j then !(a j).2 else (a j).2))
/-- Uniform global Clifford basis on all measured wires, pp.2,4.
Finiteness enumerates the entire phase quotient, never a design subset. -/
def globalFrame (m : ℕ) [Fintype (Clifford.ProjectiveGroup m)] : BasisChoiceFrame m where
Basis := Clifford.ProjectiveGroup m
finite := inferInstance
inhabited := inferInstance
projector a b :=
let U : Space m := (Clifford.representative a).val
Matrix.of fun x y => conj (U b x) * U b y
/-- Independent fixed blocks, pp.4,15; no gate crosses the block boundary. -/
def tensorFrame {a b : ℕ} (F : BasisChoiceFrame a) (G : BasisChoiceFrame b) : BasisChoiceFrame (a + b) where
Basis := F.Basis × G.Basis
finite := inferInstance
inhabited := inferInstance
projector u x := appendMatrixTensor (F.projector u.1 (qubitsAppendEquiv a b x).1)
(G.projector u.2 (qubitsAppendEquiv a b x).2)
/-- Product one-qubit Clifford measurement on m wires, pp.2,13. -/
def singleCliffordFrame [Fintype (Clifford.ProjectiveGroup 1)] : (m : ℕ) → BasisChoiceFrame m
| 0 => pauliFrame 0
| m + 1 => tensorFrame (singleCliffordFrame m) (globalFrame 1)
/-- Fixed partitions into Clifford blocks, pp.4,15. No Pauli/Clifford
hybrid ensemble is introduced. The empty frame is the zero-block product. -/
inductive CliffordBlocks : {m : ℕ} → BasisChoiceFrame m → Prop
| empty : CliffordBlocks (pauliFrame 0)
| global (m : ℕ) [Fintype (Clifford.ProjectiveGroup m)] :
CliffordBlocks (globalFrame m)
| blocks {a b : ℕ} {F : BasisChoiceFrame a} {G : BasisChoiceFrame b} :
CliffordBlocks F → CliffordBlocks G → CliffordBlocks (tensorFrame F G)
/-- Exactly Pauli-6 or a fixed Clifford-block partition, Appendix B.
Reference and output use independent choices from the same named frame. -/
inductive PaperFrame : {m : ℕ} → BasisChoiceFrame m → Prop
| pauli (m : ℕ) : PaperFrame (pauliFrame m)
| clifford {m : ℕ} {F : BasisChoiceFrame m} : CliffordBlocks F → PaperFrame F
/-- One shot: uniform basis choice followed by its Born outcome, pp.2,4. -/
def basisBornWeight {m : ℕ} (F : BasisChoiceFrame m) (rho : Space m) (s : F.Basis × Qubits m) : ℝ :=
(Fintype.card F.Basis : ℝ)⁻¹ * effectProb (F.projector s.1 s.2) rho
/-- N independent actual shots, without renormalizing arbitrary weights.
For named frames on density matrices these are Born probabilities. -/
def recordProbability {m N : ℕ} (F : BasisChoiceFrame m) (rho : Space m)
(event : (Fin N → F.Basis × Qubits m) → Prop) : ℝ :=
∑ r : Fin N → F.Basis × Qubits m,
if event r then ∏ j, basisBornWeight F rho (r j) else 0
/-- Constructed complex-linear measurement channel, pp.4,15:
the finite coefficient version of the accepted measurement channel. -/
def basisMeasurementChannel {m : ℕ} (F : BasisChoiceFrame m) : Space m →ₗ[ℂ] Space m where
toFun X := Matrix.of fun i j => ∑ k, ∑ l,
((Fintype.card F.Basis : ℂ)⁻¹ *
∑ a : F.Basis, ∑ b : Qubits m,
F.projector a b l k * F.projector a b i j) * X k l
map_add' X Y := by ext i j; simp [mul_add, Finset.sum_add_distrib]
map_smul' c X := by ext i j; simp [Finset.mul_sum, mul_left_comm]
/-- Actual linear inverse, pp.4,15. Zero only totalizes incomplete frames;
named PaperFrames are informationally complete. The inverse is linear
(d+1)X-Tr(X)I, not the affine formula restricted to rank-one projectors. -/
def frameInverse {m : ℕ} (F : BasisChoiceFrame m) : Space m →ₗ[ℂ] Space m :=
if h : Function.Injective (basisMeasurementChannel F) then
(LinearEquiv.ofBijective (basisMeasurementChannel F)
⟨h, LinearMap.injective_iff_surjective.mp h⟩).symm.toLinearMap
else 0
/-- Normalized single-shot reconstruction, pp.4,15. -/
def frameSnapshot {m : ℕ} (F : BasisChoiceFrame m) (s : F.Basis × Qubits m) : Space m :=
frameInverse F (F.projector s.1 s.2)
/-- Eq.(7): external scale is 2^n for n physical channel qubits. -/
def choiSnapshot {n : ℕ} (F : BasisChoiceFrame (n + n))
(s : F.Basis × Qubits (n + n)) : Space (n + n) :=
((2 : ℂ) ^ n) • frameSnapshot F s
/-- Expectation of Eq.(7), permitting indefinite reconstructed matrices. -/
def meanChoiSnapshot {n : ℕ} (F : BasisChoiceFrame (n + n))
(E : Superop (Qubits n) (Qubits n)) : Space (n + n) :=
∑ s : F.Basis × Qubits (n + n),
(basisBornWeight F (processChoiState E) s : ℂ) • choiSnapshot F s
/-- Appendix B1 expectation, reference first; independent basis choices. -/
def ancillaReconstruction {n : ℕ} (F : BasisChoiceFrame n)
(E : Superop (Qubits n) (Qubits n)) : Space (n + n) :=
((Fintype.card F.Basis : ℂ) ^ 2)⁻¹ •
∑ a : F.Basis, ∑ c : F.Basis, ∑ b : Qubits n, ∑ d : Qubits n,
(effectProb (appendMatrixTensor (F.projector a b) (F.projector c d))
(processChoiState E) : ℂ) •
appendMatrixTensor (frameInverse F (F.projector a b)) (frameInverse F (F.projector c d))
/-- Appendix B2 expectation: prepare Ui†|0><0|Ui and transpose its
reconstructed input factor. Every choice is followed by a fresh channel use. -/
def twoSidedReconstruction {n : ℕ} (F : BasisChoiceFrame n)
(E : Superop (Qubits n) (Qubits n)) : Space (n + n) :=
((Fintype.card F.Basis : ℂ) ^ 2)⁻¹ •
∑ a : F.Basis, ∑ c : F.Basis, ∑ d : Qubits n,
(effectProb (F.projector c d) (E (F.projector a (fun _ => false))) : ℂ) •
appendMatrixTensor (frameInverse F ((F.projector a (fun _ => false)).transpose))
(frameInverse F (F.projector c d))
/-- Source norms, pp.2,14; trace norm has no factor 1/2. -/
inductive ErrorNorm where
| frobenius | trace
/-- The two ordinary matrix norms in II.1/A.3. -/
def matrixError {m : ℕ} : ErrorNorm → Space m → ℝ
| .frobenius, X => frobNorm X
| .trace, X => traceNorm X
/-- Uniform recovery of every k-subsystem in one simultaneous event.
The estimator precedes the unknown CPTP map and sees exactly N shots. -/
def ReducedRecovers {n : ℕ} (F : BasisChoiceFrame (n + n)) (k N : ℕ)
(norm : ErrorNorm) (eps delta : ℝ) : Prop :=
∃ estimate : (Fin N → F.Basis × Qubits (n + n)) → (Fin k ↪ Fin n) → Space (k + k),
∀ E : Superop (Qubits n) (Qubits n), IsChannel E →
1 - delta ≤ recordProbability F (processChoiState E)
(fun r => ∀ w, matrixError norm (estimate r w - processMarginal (processChoiState E) w) ≤ eps)
/-- Exact k=0 scalar uses no samples; other real sufficient counts are rounded upward. -/
def sampleCount (k : ℕ) (B : ℝ) : ℕ := if k = 0 then 0 else ⌈B⌉₊
/-- Common Frobenius logarithm, pp.2,14. -/
def reducedLog (n k : ℕ) (delta : ℝ) : ℝ :=
Real.log (2 * (8 * (n : ℝ)) ^ (2 * k) / delta)
/-- Trace-norm logarithm: the exponent is 2k, pp.2,14. -/
def traceSampleLog (n k : ℕ) (delta : ℝ) : ℝ :=
Real.log ((24 * (n : ℝ)) ^ (2 * k) / delta)
/-- Finite real maximum, zero only for an empty index type.
The theorem families are nonempty (M>0 or k<=n), with nonnegative entries. -/
def finiteMax {A : Type*} [Fintype A] (f : A → ℝ) : ℝ :=
if h : (Finset.univ : Finset A).Nonempty then Finset.univ.sup' h f else 0
/-- Accepted centered shadow variance, extended to raw matrices without a
proof binder. The non-Hermitian fallback is never used by a theorem observable.
Centering divides by the full measured dimension, not by two. -/
def centeredVariance {m : ℕ} (P : MeasurementPrimitive m) (O : Space m) : ℝ :=
if h : O.IsHermitian then
shadowNorm P (tracelessPart O) (tracelessPart_hermitian O h) ^ 2
else 0
/-- Frozen oneShotLaw without its unused density-proof parameter: this avoids
assuming Choi normalization as a new theorem hypothesis. For CPTP E it is
exactly the accepted law on processChoiState E, pp.2,13. -/
def primitiveShotLaw {m : ℕ} (P : MeasurementPrimitive m) (rho : Space m) :
Measure (Matrix.unitaryGroup (Qubits m) ℂ × Qubits m) :=
∑ b : Qubits m,
(P.ensemble.withDensity (fun U => ENNReal.ofReal
(((U : Space m) * rho * star (U : Space m)) b b).re)).map (fun U => (U, b))
/-- Independent fresh preparations, counted by actual record length N. -/
def primitiveRecordLaw {m : ℕ} (P : MeasurementPrimitive m) (rho : Space m) (N : ℕ) :=
Measure.pi fun _ : Fin N => primitiveShotLaw P rho
/-- Generic-primitive simultaneous reduced-process recovery, p.14.
The estimator is measurable, as required for the statistical success event. -/
def PrimitiveReducedRecovers {n : ℕ} (P : MeasurementPrimitive (n + n))
(k N : ℕ) (eps delta : ℝ) : Prop :=
∃ estimate : (Fin N → Matrix.unitaryGroup (Qubits (n + n)) ℂ × Qubits (n + n)) →
(Fin k ↪ Fin n) → Space (k + k),
Measurable estimate ∧
∀ E : Superop (Qubits n) (Qubits n), IsChannel E →
ENNReal.ofReal (1 - delta) ≤ primitiveRecordLaw P (processChoiState E) N
{r | ∀ w, frobNorm (estimate r w - processMarginal (processChoiState E) w) ≤ eps}
/-- Full family of ambient embedded 2k-wire Paulis, p.14 A5,A7-A9.
Identity coefficients are known exactly. -/
def reducedVariance {n : ℕ} (P : MeasurementPrimitive (n + n)) (k : ℕ) : ℝ :=
finiteMax fun p : (Fin k ↪ Fin n) × (Fin (k + k) → Stabilizer.Pauli) =>
centeredVariance P (embedProcessObservable p.1 (pauliOps p.2))
/-- Retain the printed Pauli spectral-norm factor, p.14. -/
def pauliNormEnvelope (k : ℕ) : ℝ :=
finiteMax fun p : Fin (k + k) → Stabilizer.Pauli => specNorm (pauliOps p) ^ 2
/-- Proof-defined observable with transposed input, p.13 A4, fixing the p.2 shorthand. -/
def overlapObservable {n : ℕ} (rho sigma : Space n) : Space (n + n) :=
appendMatrixTensor rho.transpose sigma
/-- One simultaneous event for all normalized overlaps, II.2.
The physical process overlap is 2^n times this target. -/
def OverlapsRecover {n M : ℕ} (F : BasisChoiceFrame (n + n)) (O : Fin M → Space (n + n))
(N : ℕ) (eps delta : ℝ) : Prop :=
∃ estimate : (Fin N → F.Basis × Qubits (n + n)) → Fin M → ℝ,
∀ E : Superop (Qubits n) (Qubits n), IsChannel E →
1 - delta ≤ recordProbability F (processChoiState E)
(fun r => ∀ i, |estimate r i - (O i * processChoiState E).trace.re| ≤ eps)
/-- Same simultaneous task for an arbitrary informationally complete fixed primitive.
Measurability rules out interpreting nonmeasurable success sets by outer measure. -/
def PrimitiveOverlapsRecover {n M : ℕ} (P : MeasurementPrimitive (n + n))
(O : Fin M → Space (n + n)) (N : ℕ) (eps delta : ℝ) : Prop :=
∃ estimate : (Fin N → Matrix.unitaryGroup (Qubits (n + n)) ℂ × Qubits (n + n)) →
Fin M → ℝ,
Measurable estimate ∧
∀ E : Superop (Qubits n) (Qubits n), IsChannel E →
ENNReal.ofReal (1 - delta) ≤ primitiveRecordLaw P (processChoiState E) N
{r | ∀ i, |estimate r i - (O i * processChoiState E).trace.re| ≤ eps}
/-! Small boundary/structural sanity checks, not proofs of paper results. -/
example (B : ℝ) : sampleCount 0 B = 0 := by simp [sampleCount]
example (m : ℕ) (F : BasisChoiceFrame m) : frameInverse F 0 = 0 := map_zero _
example {m : ℕ} (P : MeasurementPrimitive m) (rho : Space m) (h : IsDensityMatrix rho) :
primitiveShotLaw P rho = oneShotLaw P rho h := rfl
example {a b : ℕ} (A : Space a) (B : Space b) (x y : Qubits (a + b)) :
appendMatrixTensor A B x y = A (qubitsAppendEquiv a b x).1 (qubitsAppendEquiv a b y).1 *
B (qubitsAppendEquiv a b x).2 (qubitsAppendEquiv a b y).2 := rfl
example (a : GroundStateLearning.ShadowLabel 0) (b : Qubits 0) :
(pauliFrame 0).projector a b = 1 := by
ext x y
simp [pauliFrame, GroundStateLearning.pauliPOVM, kronAll,
Matrix.one_apply, Subsingleton.elim x y]
example : finiteMax (fun _ : Fin 0 => (7 : ℝ)) = 0 := by simp [finiteMax]
example {n : ℕ} (F : BasisChoiceFrame (n + n)) (s : F.Basis × Qubits (n + n)) :
choiSnapshot F s = ((2 : ℂ) ^ n) • frameSnapshot F s := rfl
example {n : ℕ} (rho sigma : Space n) :
overlapObservable rho sigma = appendMatrixTensor rho.transpose sigma := rfl
/-- Identity-channel normalization sanity check, p.2 Eq.(1). -/
example (n : ℕ) (a b : Qubits n) :
processChoiState (fun X : Space n => X) (Fin.append a a) (Fin.append b b) =
((2 : ℂ) ^ n)⁻¹ := by
have ha : qubitsAppendEquiv n n (Fin.append a a) = (a, a) :=
(qubitsAppendEquiv n n).apply_symm_apply (a, a)
have hb : qubitsAppendEquiv n n (Fin.append b b) = (b, b) :=
(qubitsAppendEquiv n n).apply_symm_apply (b, b)
simp [processChoiState, processChoi, ha, hb, Matrix.single_apply]
/-- The zero-shot event is deterministic even when the matrix argument is not a state. -/
example {m : ℕ} (F : BasisChoiceFrame m) (rho : Space m) :
recordProbability (N := 0) F rho (fun _ => True) = 1 := by
simp [recordProbability]
/-- Invertibility is constructed, not replaced by an unrelated reconstruction map. -/
example {m : ℕ} (F : BasisChoiceFrame m) (h : Function.Injective (basisMeasurementChannel F)) (X : Space m) :
frameInverse F (basisMeasurementChannel F X) = X := by
unfold frameInverse
rw [dif_pos h]
exact (LinearEquiv.ofBijective (basisMeasurementChannel F)
⟨h, LinearMap.injective_iff_surjective.mp h⟩).symm_apply_apply X
/-- Empty tensor product is a legitimate zero-block Clifford frame. -/
example [Fintype (Clifford.ProjectiveGroup 1)] : PaperFrame (singleCliffordFrame 0) :=
PaperFrame.clifford CliffordBlocks.empty
end QAlgorithms.Papers.Independent.Intakethird100.P66
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Intakethird100.P66.BasisChoiceFrame
For each natural number , including zero, this defines a structure consisting of a type , a specified finite enumeration of , evidence that is nonempty, and a function assigning to every and every -bit string an arbitrary complex matrix indexed by -bit strings. No equations or positivity, Hermiticity, idempotence, orthogonality, or normalization conditions are required of these matrices. For , there is one bit string and each assigned matrix has one entry.
QAlgorithms.Papers.Independent.Intakethird100.P66.CliffordBlocks
This defines a proposition about frames on any natural number of bits, where a frame consists of a finite, nonempty choice set and assigned complex matrices for every choice and outcome string. It is generated by exactly three rules: the zero-bit frame with singleton choice set and matrix satisfies the proposition; for every natural number and specified finite enumeration of its projective group, the global frame satisfies it; and for all natural numbers and frames satisfying it on those respective lengths, their tensor frame satisfies it on bits. In the global rule, the projective group is the normalizer of the unitary subgroup generated by , with and , quotiented by equality of conjugation on every complex matrix; its assigned matrices have entries for the designated representative . In the tensor rule, choices are paired, outcomes and indices are split into consecutive blocks, and corresponding matrix entries are multiplied. Only frames obtainable by finitely many applications of these rules satisfy the proposition; zero-length global and tensor blocks are included.
QAlgorithms.Papers.Independent.Intakethird100.P66.ErrorNorm
This declaration defines a type with exactly two distinct values, named frobenius and trace, and no additional data attached to either value.
QAlgorithms.Papers.Independent.Intakethird100.P66.OverlapsRecover
For natural numbers , let , and let consist of a finite nonempty type and arbitrary complex matrices indexed by for and ; no projector, positivity, or normalization conditions are imposed on these matrices. Given matrices indexed by , a natural number , and real numbers , this predicate says that there exists a function such that, for every map on matrices indexed by having a finite representation with , the matrix
satisfies
where pairs of -bit strings index by concatenation, when , and the indicator equals one precisely when its condition holds. The same estimate must work for every such ; neither the nor the estimate has additional constraints. The displayed record weights are the specified real expressions and are not assumed nonnegative or normalized. Zero values of are included: makes the accuracy condition vacuous, and leaves one empty record with product weight one. There are no range assumptions on or .
QAlgorithms.Papers.Independent.Intakethird100.P66.PaperFrame
This defines a proposition about frames on any natural number of bits, generated by two rules. First, for every , it holds for the frame whose choices are functions and whose matrix for outcome has entries , with when and otherwise, using the usual Pauli matrices. Second, it holds for any frame obtained by finitely combining the singleton zero-bit frame with matrix and global frames by appended tensor products. Each global block of length requires a specified finite enumeration of the quotient of the normalizer of the unitary subgroup generated by , for and , where two normalizer elements are identified when their conjugation functions agree on every complex matrix; its matrices have entries for designated representatives. Tensor products pair choice sets and multiply matrix entries after splitting outcomes and indices into consecutive blocks. These are the only generating rules, and they include .
QAlgorithms.Papers.Independent.Intakethird100.P66.PrimitiveOverlapsRecover
For any natural numbers , real numbers , measurement primitive on qubits, and family of arbitrary complex matrices indexed by , this proposition asserts the existence of a measurable estimator, independent of the channel, that returns real numbers from recorded pairs of a unitary matrix and a bit string. Here , including the singleton , and consists of a Borel probability measure on unitary matrices indexed by , together with injectivity of the complex linear map
Specifically, there must exist a measurable function assigning a real number to every record and every , such that the following holds for every channel . A channel here means a function on complex matrices indexed by for which there exist a natural number and matrices satisfying and for every . Identify concatenated -bit strings with pairs and define
where is the matrix with its sole nonzero entry, equal to , at . Define the one-shot measure on pairs by
and use its -fold product as the record measure. Then
with the left side viewed as an extended nonnegative real number. The matrices need not be Hermitian, positive, or norm bounded; only the real parts of the displayed traces are estimated. All natural-number values, including , , and , and all real values of , are included. When , the simultaneous accuracy condition is vacuous. When , there is a unique empty record with product-measure mass , so the estimator has no recorded observations on which to depend.
QAlgorithms.Papers.Independent.Intakethird100.P66.PrimitiveReducedRecovers
For any natural numbers , real numbers , and measurement primitive on qubits, this proposition asserts the existence of a measurable estimator, independent of the channel, with the following property. Write , including the singleton . The primitive consists of a Borel probability measure on the unitary matrices indexed by , together with injectivity of the complex linear map
The estimator takes a record and any injection , and returns a complex matrix indexed by . For every function from complex matrices indexed by to such matrices that is a channel—meaning that there exist a natural number and matrices satisfying and for every —define the matrix , using concatenated bit strings as pairs, by
where has entry at and elsewhere. Define a one-shot measure on pairs by
and let the record measure be the -fold product . For each injection , define by the following entries: for ,
where replaces by and leaves all other coordinates unchanged. The required bound is
The left side is regarded as an extended nonnegative real number. No sign or range restrictions on , or positivity restrictions on , are imposed. If , there are no such injections and the condition inside the event is vacuous; if , the unique empty injection is still included. If , the record is the unique empty record and its product measure has mass .
QAlgorithms.Papers.Independent.Intakethird100.P66.ReducedRecovers
For every natural number , let and let supply a finite nonempty type and arbitrary complex matrices on . For every pair of natural numbers , either choice of Frobenius or trace norm, and arbitrary real numbers , this predicate asserts that there exists one estimator assigning a complex matrix on to each record and each injection , such that the following inequality holds for every function on complex matrices on admitting a finite Kraus representation with and :
Here, under the identification of a concatenated bit string with its two halves, , with the matrix unit, and
where replaces the bits of at positions by and leaves all other bits unchanged. The chosen error is or . The estimator is chosen before , and the error requirement is simultaneous over all injections . No conditions on the frame matrices ensure that the displayed record weights are probabilities, and no sign or range restrictions are imposed on . All of may be zero; for the unique empty record has weight , and for there are no injections , so the record condition is vacuous.
QAlgorithms.Papers.Independent.Intakethird100.P66.ancillaReconstruction
For every natural number , including , let , let supply a finite nonempty type and arbitrary matrices on , and let be any function from complex matrices on to themselves. Identify with , define , where is the corresponding matrix unit, and write for the matrix whose entry at is . Set and let when this map is injective, or the zero map otherwise. The defined reconstruction is
where real coefficients act as complex scalars. No channel assumption on or projector conditions on the frame matrices are imposed, and the result is zero if is not injective.
QAlgorithms.Papers.Independent.Intakethird100.P66.appendMatrixTensor
For all natural numbers , including zero, and arbitrary complex matrices and indexed respectively by -bit and -bit strings, this defines a complex matrix on -bit strings. Writing and for concatenations with first blocks of length and second blocks of length , its entries are
No conditions on or are required. A zero-length block has exactly one bit string, so its matrix is a scalar factor.
QAlgorithms.Papers.Independent.Intakethird100.P66.basisBornWeight
For every natural number , including , let , and let consist of a finite nonempty type and matrices for every and . For every matrix and pair , this definition assigns the real number
The data defining impose no projector, positivity, or completeness conditions on the matrices , and is arbitrary, so these numbers need not be nonnegative or sum to . When , contains the single empty bit string.
QAlgorithms.Papers.Independent.Intakethird100.P66.basisMeasurementChannel
For every natural number , including , let and let consist of a finite nonempty type and arbitrary matrices . This definition constructs the complex-linear map given, for every matrix and every , by
The displayed products contain no complex conjugation. The frame data impose no further conditions ensuring positivity, trace preservation, or injectivity of this map.
QAlgorithms.Papers.Independent.Intakethird100.P66.centeredVariance
For every natural number , write , and let consist of a probability measure on unitary matrices indexed by , with the requirement that the linear map
is injective; its inverse is therefore defined on all matrices of this size. For every complex matrix indexed by , this defines if is not Hermitian. If is Hermitian, put ; the value is
The supremum and square root are the total real operations used in the definition. The case is included, with consisting of the unique empty bit string.
QAlgorithms.Papers.Independent.Intakethird100.P66.choiSnapshot
For every natural number , including , let , and let supply a finite nonempty type and arbitrary matrices . Define
For every , this definition assigns the matrix if is injective, and the zero matrix otherwise. The inverse is the inverse complex-linear endomorphism, and is regarded as a complex scalar. At , the scaling factor is and the matrices have one row and one column.
QAlgorithms.Papers.Independent.Intakethird100.P66.embedProcessObservable
For all natural numbers , an injection , and an arbitrary complex matrix on -bit strings, this defines a matrix on -bit strings. For -bit strings , its entries are
Here concatenation joins the indicated bit strings, and the injection entails . There is no Hermiticity assumption on . If , the result is the sole entry of times the identity; if covers every position, the condition outside its image is vacuous.
QAlgorithms.Papers.Independent.Intakethird100.P66.finiteMax
For every type equipped with a finite enumeration and every function , this defines to be when is nonempty, and zero when is empty. In the nonempty case the maximum may be negative; zero is only the specified value for the empty case.
QAlgorithms.Papers.Independent.Intakethird100.P66.frameInverse
For every natural number , including , let , and let supply a finite nonempty type and arbitrary complex matrices indexed by and . Define the complex-linear map
This definition assigns a complex-linear map on the same matrix space: if is injective, then , using the fact that an injective linear endomorphism of this finite-dimensional space is bijective; otherwise is the zero map. Injectivity is tested in the definition and is not assumed of .
QAlgorithms.Papers.Independent.Intakethird100.P66.frameSnapshot
For every natural number , including , let , and let supply a finite nonempty type and arbitrary matrices . Form the complex-linear map
For every pair , the defined snapshot is if is injective, and is the zero matrix otherwise; the inverse exists in the injective case because the domain and codomain are the same finite-dimensional complex vector space. No projector or normalization conditions on are assumed.
QAlgorithms.Papers.Independent.Intakethird100.P66.globalFrame
For every natural number , assuming a specified finite enumeration of the projective group described below, this defines a frame with that group as its basis-choice set. Start with the subgroup of unitary matrices on -bit strings generated by all matrices , where and each is one of the usual matrices ; take its normalizer in the full unitary group, and identify two normalizer elements exactly when for every complex matrix . The resulting quotient is the basis-choice set, which is nonempty because it contains the identity class. For a class , choose its designated quotient representative ; for every outcome -bit string , the assigned matrix is
The definition includes , where the outcome and matrix index sets each contain one empty bit string.
QAlgorithms.Papers.Independent.Intakethird100.P66.matrixError
For every natural number , including , every complex matrix indexed by the bit strings , and either choice frobenius or trace, this definition returns respectively
where is the conjugate transpose and the square root is the positive semidefinite square root supplied by continuous functional calculus. No Hermitian or positivity assumption on is required. When , is a one-by-one matrix.
QAlgorithms.Papers.Independent.Intakethird100.P66.meanChoiSnapshot
For every natural number , including , write and identify a -bit string with its ordered pair of -bit halves. Let supply a finite nonempty type and arbitrary matrices on , and let be any function from complex matrices on to complex matrices on , without a linearity or channel assumption. Define the matrix by
where has entry at and elsewhere. Also set , and let if is injective and otherwise. This definition assigns
with the real coefficients regarded as complex scalars. The expression is zero when is not injective; its coefficients are not assumed to form a probability distribution.
QAlgorithms.Papers.Independent.Intakethird100.P66.overlapObservable
For every natural number and arbitrary complex matrices indexed by , this defines a complex matrix indexed by -bit strings through
where and denotes concatenation. Equivalently, it is expressed in concatenated-bit coordinates; the transpose does not conjugate entries. Neither input is required to be a density matrix or Hermitian, and is allowed.
QAlgorithms.Papers.Independent.Intakethird100.P66.pauliFrame
For every natural number , this defines a frame whose finite, nonempty basis-choice set consists of all functions , with the constant choice witnessing nonemptiness. For an outcome bit string , write and let if , and otherwise. The assigned matrix is
with rows and columns ordered as false, true. This expands the factor multiplying the defined Pauli measurement matrix, whose factor is . When , both the choice set and the outcome set are singletons, and the empty product gives the one-entry matrix .
QAlgorithms.Papers.Independent.Intakethird100.P66.pauliNormEnvelope
For every natural number , this defines
where is the operator norm for Euclidean norms, and the four matrices, in bit order , are
The maximum uses zero as its default for an empty indexing type, although this particular indexing type is always nonempty. When , it contains the unique empty assignment, and its empty product is the identity matrix.
QAlgorithms.Papers.Independent.Intakethird100.P66.primitiveRecordLaw
For every natural number , write , and let specify a probability measure on unitary matrices indexed by for which the map is injective. For every complex matrix indexed by and every natural number , this defines the product measure on records , where
There are no density-matrix assumptions on . When , the record space consists of the unique empty record and the product measure assigns it mass one.
QAlgorithms.Papers.Independent.Intakethird100.P66.primitiveShotLaw
For every natural number , let , and let specify a probability measure on unitary matrices indexed by such that
is injective. For any complex matrix indexed by , this defines a measure on pairs by
Thus each summand weights by the nonnegative part of the indicated real diagonal entry and then attaches the fixed outcome . No assumption says that is Hermitian, positive semidefinite, or trace one, so the definition does not require this measure to be a probability measure. The case is included.
QAlgorithms.Papers.Independent.Intakethird100.P66.processChoi
For every natural number , including zero, and every function from complex matrices on -bit strings to complex matrices on -bit strings, this defines a matrix on -bit strings by
where are -bit strings and is the matrix whose only nonzero entry is at row , column . There is no assumption that is linear or is a channel. When , the sole entry is the sole entry of .
QAlgorithms.Papers.Independent.Intakethird100.P66.processChoiState
For every natural number , including zero, and arbitrary function from complex matrices on -bit strings to themselves, this defines the matrix with entries
where concatenation places the first -bit string before the second, and has entry at and zero elsewhere. No linearity, positivity, or trace condition is imposed on or the resulting matrix. For , the scaling factor is .
QAlgorithms.Papers.Independent.Intakethird100.P66.processMarginal
For all natural numbers , an arbitrary complex matrix on -bit strings, and an injection , this defines a matrix on -bit strings as follows. For an -bit string and a -bit string , let have value at position and value at every position outside the image of . Then
The injection entails . No density-matrix assumption is imposed on . For , this is the one-entry matrix containing ; when covers all positions, only the all-zero choices of contribute.
QAlgorithms.Papers.Independent.Intakethird100.P66.recordProbability
For every pair of natural numbers , let , let consist of a finite nonempty type and arbitrary complex matrices indexed by and , and let be any complex matrix indexed by . For every predicate on records , this definition assigns
No assumptions ensure that this expression is a probability. For , there is one empty record and its product is , so the result is if that record satisfies and otherwise; is also allowed.
QAlgorithms.Papers.Independent.Intakethird100.P66.reducedLog
For all natural numbers and every real number , this defines
Here the real logarithm is total: , and for a negative argument it equals the logarithm of its absolute value; division by zero gives zero. Consequently gives zero. The exponent is zero when , including when , so that case gives ; when and , the result is zero. There are no positivity assumptions on .
QAlgorithms.Papers.Independent.Intakethird100.P66.reducedVariance
For every natural number , let , and let specify a probability measure on unitary matrices indexed by with injective linear map
For each natural number , this defines the maximum of the following quantity over all injections and all choices . Here
and is the matrix with entries . Define , indexed by pairs of -bit strings, by
For any matrix , the quantity being maximized is zero if is not Hermitian; otherwise, with , it is
evaluated at . If the indexing set is empty, the value is defined to be zero; in particular this happens when . The case includes the unique empty injection and empty Pauli assignment, whose matrix product is the scalar identity.
QAlgorithms.Papers.Independent.Intakethird100.P66.sampleCount
For every natural number and real number , this defines the natural number
Thus gives zero regardless of , and gives zero for every .
QAlgorithms.Papers.Independent.Intakethird100.P66.singleCliffordFrame
Assuming a specified finite enumeration of the one-qubit projective group, this recursively defines a frame for every natural number . This projective group is obtained by taking the normalizer, within the one-qubit unitary group, of the subgroup generated by for and , and identifying when for every complex matrix . The zero-bit frame has a singleton choice set and assigned matrix . At each successor, its choice set is the previous choice set times this projective group, and its matrices are the appended tensor products of the previous matrices with , where is the designated representative of the new class and is the new outcome bit. Thus, identifying choices with successive classes , the assigned matrix for outcome has entries
At , the product is empty and equals .
QAlgorithms.Papers.Independent.Intakethird100.P66.tensorFrame
For all natural numbers and arbitrary frames and on respectively and bits, this defines a frame on bits. A frame here supplies a finite, nonempty choice set and an arbitrary complex matrix for each choice and outcome bit string. The new choice set is the Cartesian product of the two supplied choice sets, with its induced finite enumeration and nonemptiness. For choices , outcome , and matrix indices and , the assigned matrix has entry
No additional matrix conditions are assumed. Either block length may be zero, in which case that block contributes its one-entry matrix as a scalar factor.
QAlgorithms.Papers.Independent.Intakethird100.P66.traceSampleLog
For all natural numbers and every real number , this defines
The real logarithm is total, with and for , and division by zero gives zero. Thus gives zero; , including , gives ; and with gives zero. No positivity assumptions are imposed.
QAlgorithms.Papers.Independent.Intakethird100.P66.twoSidedReconstruction
For every natural number , including , let , let be its all-false string, let supply a finite nonempty type and arbitrary complex matrices on , and let be any function from complex matrices on to themselves. Define and let be its inverse complex-linear map if it is injective, or the zero map otherwise. With represented on concatenated bit strings by , this definition assigns
Here denotes ordinary transpose without conjugation, and the real coefficients act as complex scalars. Only the outcome is used for the first frame matrix. No channel assumption on or projector conditions on the frame are imposed; if is not injective, the result is zero.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.