Definitions for Reversing Unknown Quantum Transformations: Universal Quantum Circuit for Inverting General Unitary Operations
DefinitionQAlgorithms_Papers_Independent_Extend50_P26The objects the formalized statements of Reversing Unknown Quantum Transformations: Universal Quantum Circuit for Inverting General Unitary Operations (arXiv:1810.06944) are stated in. Each was checked against the paper by a blind read-back and a moderator.
InversionBasis: PDF p.4, Eq.(4): n teeth ordered newest output/input first; order zero is scalar.unitaryChoi: PDF p.4, Choi definition: unnormalized |A>> <<A| in output-first coordinates.inverseChoi: PDF p.4, Eq.(4): Choi operator of the inverse channel, never inverse of a Choi matrix.slotTensor: PDF p.4, Eq.(4): tensor of k independently specified slot Choi operators. Slot zero is the newest slot; identical forward calls are obtained by a constant family.endpoints: PDF p.4: insert external output/input endpoints around the k open channel slots.inversionLink: PDF p.4, link product: contract slot indices with the slot Choi operator. The two identical index orders implement the partial transpose in the link product.InversionComb: PDF p.4, quantum-comb constraints: positive recursive prefixes and causal traces. The k-use circuit is a (k+1)-comb; its fixed channels may retain finite memory.groupSlotPairs: PDF p.3, Fig.4: regroup the k slot outputs and inputs into two collective wires.CollectiveChannel: PDF p.3, Fig.4: a CPTP channel on the collective k-qudit slot.Parallel: PDF pp.3–4: parallel superchannel, with arbitrary memory and pre/postprocessing. Positivity and normalization on every collective CPTP slot describe a single channel supermap; splitting that collective slot into k tensor factors leaves no intervening gates.GeneralProcess: PDF pp.3–4: the general process-matrix class, including indefinite causal order. Normalization is tested on arbitrary independent CPTP channels in all k slots. Positivity is the complete-positivity requirement, also with ancillary extensions.CircuitClass: PDF p.4, Table I: the three classes of deterministic completions.InversionCompletion: PDF p.4: deterministic admissibility in the specified circuit class.HeraldedInversionBranch: PDF p.4, Eq.(4): a heralded positive branch dominated by a deterministic completion. The complementary branch C-S is positive; no success or invertibility is assumed.UniversalInverseBranch: PDF pp.1–4: a fixed branch inverts every SU(d) oracle with the same input-independent p. Choi equality includes arbitrary reference-entangled inputs. Only forward U is inserted.Attainable: PDF p.4: the attainable success probabilities. The protocol is chosen before U. The budget counts k open forward-call slots; unused calls can be discarded.FiniteFeasible: PDF p.4, Eq.(4): success constraints at an explicitly specified finite family.adaptiveInversionProbability: PDF p.3, Theorem 1: number of complete attempts, with d-1 calls in the last attempt.
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Information
import Definitions.Def_QAlgorithms_Papers_Independent_Dependency50_P26
/-!
Exact heralded universal inversion, arXiv:1810.06944v3, PDF pp.1–5.
The paper-local Choi coordinates are output first. Recursive comb coordinates are
newest output/input first. A k-query protocol has k+1 teeth; its k open slots
are filled only with forward channels. The general-process class is normalized
on arbitrary independent CPTP slot channels, not just on repeated unitaries.
No numerical Table I cell is promoted to an exact value.
-/
noncomputable section
open QAlgorithms
open scoped BigOperators Matrix ComplexConjugate ComplexOrder
attribute [local instance] Classical.decEq Classical.propDecidable
namespace QAlgorithms.Papers.Independent.Extend50.P26
-- Reuse the accepted unnormalized output-first CPTP predicate, without an alias.
open QAlgorithms.Papers.Independent.Dependency50.P26 (ChannelChoi)
/-- PDF p.4, Eq.(4): n teeth ordered newest output/input first; order zero is scalar. -/
def InversionBasis (d : ℕ) : ℕ → Type
| 0 => Unit
| n + 1 => Fin d × (Fin d × InversionBasis d n)
/-- Finite coordinate bases, including the scalar empty prefix. -/
instance inversionBasisFintype (d : ℕ) : (n : ℕ) → Fintype (InversionBasis d n)
| 0 => inferInstanceAs (Fintype Unit)
| n + 1 => letI := inversionBasisFintype d n
inferInstanceAs (Fintype (Fin d × (Fin d × InversionBasis d n)))
/-- PDF p.4, Choi definition: unnormalized |A>> <<A| in output-first coordinates. -/
def unitaryChoi {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : (Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ) :=
fun a b => A a.1 a.2 * conj (A b.1 b.2)
/-- PDF p.4, Eq.(4): Choi operator of the inverse channel, never inverse of a Choi matrix. -/
def inverseChoi {d : ℕ} (U : (Matrix.specialUnitaryGroup (Fin d) ℂ)) : (Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ) := unitaryChoi U.valᴴ
/-- PDF p.4, Eq.(4): tensor of k independently specified slot Choi operators.
Slot zero is the newest slot; identical forward calls are obtained by a constant family. -/
def slotTensor (d : ℕ) : (k : ℕ) → (Fin k → (Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ)) → (Matrix (InversionBasis d k) (InversionBasis d k) ℂ)
| 0, _ => 1
| n + 1, J => fun a b =>
J 0 (a.1, a.2.1) (b.1, b.2.1) *
slotTensor d n (fun j => J j.succ) a.2.2 b.2.2
/-- PDF p.4: insert external output/input endpoints around the k open channel slots. -/
def endpoints (d : ℕ) : (k : ℕ) → Fin d → Fin d → InversionBasis d k → InversionBasis d (k+1)
| 0, o, i, _ => (o, i, ())
| n + 1, o, i, x => (o, x.1, endpoints d n x.2.1 i x.2.2)
/-- PDF p.4, link product: contract slot indices with the slot Choi operator.
The two identical index orders implement the partial transpose in the link product. -/
def inversionLink {d k : ℕ} (S : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ)) (J : (Matrix (InversionBasis d k) (InversionBasis d k) ℂ)) : (Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ) :=
fun a b => ∑ u, ∑ v,
S (endpoints d k a.1 a.2 u) (endpoints d k b.1 b.2 v) * J u v
/-- PDF p.4, quantum-comb constraints: positive recursive prefixes and causal traces.
The k-use circuit is a (k+1)-comb; its fixed channels may retain finite memory. -/
def InversionComb (d : ℕ) : (n : ℕ) → (Matrix (InversionBasis d n) (InversionBasis d n) ℂ) → Prop
| 0, C => C = 1
| n + 1, C => C.PosSemidef ∧ ∃ B : (Matrix (InversionBasis d n) (InversionBasis d n) ℂ),
InversionComb d n B ∧ traceLeft C = Matrix.kronecker (1 : Matrix (Fin d) _ ℂ) B
/-- PDF p.3, Fig.4: regroup the k slot outputs and inputs into two collective wires. -/
def groupSlotPairs (d : ℕ) : (k : ℕ) → (Fin k → Fin d) → (Fin k → Fin d) → InversionBasis d k
| 0, _, _ => ()
| n + 1, o, i => (o 0, i 0, groupSlotPairs d n (fun j => o j.succ) (fun j => i j.succ))
/-- PDF p.3, Fig.4: a CPTP channel on the collective k-qudit slot. -/
def CollectiveChannel {d k : ℕ} (J : (Matrix (InversionBasis d k) (InversionBasis d k) ℂ)) : Prop :=
J.PosSemidef ∧ ∀ a b : Fin k → Fin d,
(∑ o : Fin k → Fin d, J (groupSlotPairs d k o a) (groupSlotPairs d k o b)) =
if a = b then 1 else 0
/-- PDF pp.3–4: parallel superchannel, with arbitrary memory and pre/postprocessing.
Positivity and normalization on every collective CPTP slot describe a single channel
supermap; splitting that collective slot into k tensor factors leaves no intervening gates. -/
def Parallel {d k : ℕ} (C : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ)) : Prop :=
C.PosSemidef ∧ ∀ J : (Matrix (InversionBasis d k) (InversionBasis d k) ℂ), CollectiveChannel J → ChannelChoi (inversionLink C J)
/-- PDF pp.3–4: the general process-matrix class, including indefinite causal order.
Normalization is tested on arbitrary independent CPTP channels in all k slots.
Positivity is the complete-positivity requirement, also with ancillary extensions. -/
def GeneralProcess {d k : ℕ} (C : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ)) : Prop :=
C.PosSemidef ∧ ∀ J : Fin k → (Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ),
(∀ j, ChannelChoi (J j)) → ChannelChoi (inversionLink C (slotTensor d k J))
/-- PDF p.4, Table I: the three classes of deterministic completions. -/
inductive CircuitClass where
| parallel
| adaptive
| indefinite
/-- PDF p.4: deterministic admissibility in the specified circuit class. -/
def InversionCompletion (c : CircuitClass) (d k : ℕ) (C : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ)) : Prop :=
match c with
| .parallel => Parallel C
| .adaptive => InversionComb d (k+1) C
| .indefinite => GeneralProcess C
/-- PDF p.4, Eq.(4): a heralded positive branch dominated by a deterministic completion.
The complementary branch C-S is positive; no success or invertibility is assumed. -/
def HeraldedInversionBranch (c : CircuitClass) (d k : ℕ) (S : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ)) : Prop :=
S.PosSemidef ∧ ∃ C, InversionCompletion c d k C ∧ (C-S).PosSemidef
/-- PDF pp.1–4: a fixed branch inverts every SU(d) oracle with the same input-independent p.
Choi equality includes arbitrary reference-entangled inputs. Only forward U is inserted. -/
def UniversalInverseBranch {d k : ℕ} (S : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ)) (p : ℝ) : Prop :=
∀ U : (Matrix.specialUnitaryGroup (Fin d) ℂ),
inversionLink S (slotTensor d k (fun _ => unitaryChoi U.val)) = (p : ℂ) • inverseChoi U
/-- PDF p.4: the attainable success probabilities. The protocol is chosen before U.
The budget counts k open forward-call slots; unused calls can be discarded. -/
def Attainable (c : CircuitClass) (d k : ℕ) (p : ℝ) : Prop :=
0 ≤ p ∧ p ≤ 1 ∧ ∃ S : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ), HeraldedInversionBranch c d k S ∧ UniversalInverseBranch S p
/-- PDF p.4, Eq.(4): success constraints at an explicitly specified finite family. -/
def FiniteFeasible (c : CircuitClass) (d k m : ℕ) (U : Fin m → (Matrix.specialUnitaryGroup (Fin d) ℂ)) (p : ℝ) : Prop :=
0 ≤ p ∧ p ≤ 1 ∧ ∃ S : (Matrix (InversionBasis d (k+1)) (InversionBasis d (k+1)) ℂ), HeraldedInversionBranch c d k S ∧
∀ j, inversionLink S (slotTensor d k (fun _ => unitaryChoi (U j).val)) =
(p : ℂ) • inverseChoi (U j)
/-- PDF p.3, Theorem 1: number of complete attempts, with d-1 calls in the last attempt. -/
def adaptiveInversionProbability (d k : ℕ) : ℝ :=
1 - (1 - 1 / (d : ℝ)^2)^((k+1)/d)
/-! Sanity examples pin the scalar prefix, tensor convention, inversionLink, and query accounting. -/
example (d : ℕ) : InversionComb d 0 (1 : (Matrix (InversionBasis d 0) (InversionBasis d 0) ℂ)) := rfl
example (d : ℕ) : slotTensor d 0 (fun j => Fin.elim0 j) = 1 := rfl
example {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) (a b : (Fin d × Fin d)) :
unitaryChoi A a b = A a.1 a.2 * conj (A b.1 b.2) := rfl
example {d : ℕ} (C : (Matrix (InversionBasis d 1) (InversionBasis d 1) ℂ)) (a b : (Fin d × Fin d)) :
inversionLink C (1 : (Matrix (InversionBasis d 0) (InversionBasis d 0) ℂ)) a b = C (a.1,a.2,()) (b.1,b.2,()) := by
letI : Unique (InversionBasis d 0) := inferInstanceAs (Unique Unit)
simp only [inversionLink, Fintype.sum_unique]
simp [endpoints, Matrix.one_apply]
example : adaptiveInversionProbability 2 0 = 0 ∧ adaptiveInversionProbability 2 1 = 1/4 ∧
adaptiveInversionProbability 2 2 = 1/4 ∧ adaptiveInversionProbability 2 3 = 7/16 := by
norm_num [adaptiveInversionProbability]
example {d : ℕ} (U : (Matrix.specialUnitaryGroup (Fin d) ℂ)) (a b : (Fin d × Fin d)) :
inverseChoi U a b = conj (U.val a.2 a.1) * U.val b.2 b.1 := by
simp [inverseChoi, unitaryChoi, Matrix.conjTranspose_apply]
end QAlgorithms.Papers.Independent.Extend50.P26
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Extend50.P26.Attainable
For a class , natural numbers , and , the condition says that and there exist complex matrices on such that and are positive semidefinite, satisfies the class-specific normalization below, and
Here , ,
and
where endpoint insertion means concatenating , the coordinates of , and , with the recursive grouping of . A matrix on is normalized precisely when it is positive semidefinite and its trace over the first coordinate is the identity. For parallel, is positive semidefinite and is normalized for every positive semidefinite matrix on whose trace over all output coordinates is the identity on all input coordinates. For adaptive, satisfies recursive normalization: the level-zero matrix is , and at each level a matrix is positive semidefinite with
for a recursively normalized matrix one level lower. For indefinite, is positive semidefinite and is normalized for every family of normalized matrices , with tensor entries given by the product of the corresponding paired entries. The same must work for every . The definition includes and , using empty index sets and empty products as applicable; it does not require .
QAlgorithms.Papers.Independent.Extend50.P26.CircuitClass
This declaration defines a type with exactly three distinct values, named parallel, adaptive, and indefinite. The declaration itself attaches no mathematical conditions or properties to these values.
QAlgorithms.Papers.Independent.Extend50.P26.CollectiveChannel
For all natural numbers and every complex matrix on the set of nested sequences of ordered pairs from , with , this condition means that is positive semidefinite and
for every pair of functions , where groups the pairs in increasing order with right nesting. At , this condition requires the sole entry of to be . When , there are no functions , the displayed requirement is vacuous, and the unique empty matrix satisfies the condition.
QAlgorithms.Papers.Independent.Extend50.P26.FiniteFeasible
For a class , natural numbers , a specified family indexed by , and a real number , the condition says that and there exist complex matrices on such that and are positive semidefinite, satisfies the class-specific normalization below, and
Here , , and
where is concatenation with the recursive grouping of . A matrix on is normalized when it is positive semidefinite and its trace over the first coordinate is the identity. For parallel, is positive semidefinite and is normalized for every positive semidefinite whose trace over all output coordinates is the identity on the input coordinates. For adaptive, normalization is recursive: the level-zero matrix equals , and a matrix at level is positive semidefinite and satisfies for some normalized level- matrix . For indefinite, is positive semidefinite and is normalized for every family of normalized matrices , using the paired-coordinate tensor product. No distinctness, independence, or spanning condition on the supplied is part of this definition. In particular, makes all inversion tests vacuous while retaining the bounds on and the existence and completion conditions; and are also permitted.
QAlgorithms.Papers.Independent.Extend50.P26.GeneralProcess
For all natural numbers and every complex matrix on , where is the set of right-nested sequences of ordered pairs from and , this condition requires to be positive semidefinite and quantifies over every family of complex matrices indexed by pairs from . If each is positive semidefinite and satisfies for all , then the matrix
must be positive semidefinite and satisfy for every . Here denote the coordinates of the -th pair of , and inserts before the flattened coordinates of and after them, then regroups consecutive coordinates into pairs. No conjugation is applied to the factor entries in this contraction. For , the family condition is vacuous and the product and singleton tensor entry are . When , the unique empty matrix satisfies the condition.
QAlgorithms.Papers.Independent.Extend50.P26.HeraldedInversionBranch
For a class , natural numbers , and a complex matrix on , the condition says that is positive semidefinite and there exists a matrix on the same index set such that is positive semidefinite and satisfies the class-specific condition described here. The index sets are and , and the contraction of with a matrix on is
with denoting concatenation followed by the recursive grouping of . A matrix on is normalized here precisely when is positive semidefinite and . For parallel, must be positive semidefinite and must be normalized for every positive semidefinite whose trace over all output coordinates is the identity on the input coordinates. For adaptive, must satisfy recursive normalization: the level-zero matrix equals , and a level- matrix is positive semidefinite and has
for some recursively normalized level- matrix . For indefinite, must be positive semidefinite and must be normalized for every -tuple of normalized matrices on ; this tensor has entries . Both and are included; the latter uses the empty tensor product . This condition imposes no inversion identity or success parameter on .
QAlgorithms.Papers.Independent.Extend50.P26.InversionBasis
For every natural number , this defines sets , for all natural numbers , recursively by and . Thus an element consists of ordered pairs of indices, stored with the indicated nesting. The case has exactly one element, including when ; if and , the set is empty.
QAlgorithms.Papers.Independent.Extend50.P26.InversionComb
For every natural number , every natural number , and every complex matrix on , where and , this defines a recursive condition. At , it requires , the singleton identity matrix. At , it requires to be positive semidefinite and requires a matrix satisfying the same condition at level , such that
Thus the partial trace over the first, outermost index is the identity on the next index tensored with . Zero is allowed for both and ; when , the unique empty matrix satisfies this recursive condition.
QAlgorithms.Papers.Independent.Extend50.P26.InversionCompletion
For a class , natural numbers , and a complex matrix indexed by , define the condition as follows. Here is a singleton and , where ; thus elements of can be written as tuples of length . For matrices on , write
where means the tuple obtained by placing before all coordinates of and after them, with the recursive grouping prescribed by . Call a matrix on normalized when it is positive semidefinite and . If is parallel, the condition says that is positive semidefinite and is normalized for every positive semidefinite matrix on satisfying
If is adaptive, the condition is the following recursive normalization at level : at level zero the matrix must equal the scalar matrix ; at level , a matrix must be positive semidefinite and there must be a matrix satisfying the level- condition such that
If is indefinite, the condition says that is positive semidefinite and is normalized for every family of normalized matrices on , where the tensor matrix has entries . There is no positivity assumption on or : uses empty index sets, and uses a singleton and the empty tensor product .
QAlgorithms.Papers.Independent.Extend50.P26.Parallel
For all natural numbers and every complex matrix on , where is the set of right-nested sequences of ordered pairs of indices from and , this condition requires to be positive semidefinite and imposes the following requirement on every complex matrix on : if is positive semidefinite and for all length- index functions , where groups the pairs , then the matrix
is positive semidefinite and satisfies for every . Here inserts before the flattened coordinates of and after them, then regroups consecutive coordinates into pairs; the contraction uses the entries of without conjugation. For , the permitted is the singleton matrix with entry . When , the condition holds for the unique empty matrix , since the resulting matrix and its normalization equality have empty index sets.
QAlgorithms.Papers.Independent.Extend50.P26.UniversalInverseBranch
For arbitrary natural numbers , a complex matrix on , and a real number , the condition says that the following entrywise identity holds for every special unitary matrix , meaning every unitary with determinant , and every :
Here , , , and is the tuple formed by adjoining and to the ends of the coordinates of , with the prescribed recursive grouping. The sums use the displayed entries without an additional conjugation or transpose. No positive semidefiniteness or completion condition on , and no bound or sign condition on , is included. When , the product is and both sums have singleton index sets; when , the asserted equality is an equality of empty matrices.
QAlgorithms.Papers.Independent.Extend50.P26.adaptiveInversionProbability
For every pair of natural numbers , this declaration defines the real number
where the exponent is natural-number division, rather than a real quotient. At , natural-number division by zero and real division by zero both evaluate to zero, so the defined value is ; at , it is . For positive with , the exponent is zero and the value is , including the convention that a zeroth power equals . No restriction on or is a hypothesis of this definition.
QAlgorithms.Papers.Independent.Extend50.P26.endpoints
For every natural number , every natural number , indices , and , where and , this defines recursively by
Thus, if has flattened coordinates , the result has flattened coordinates , regrouped into consecutive pairs. When , there are no choices of the required endpoint indices .
QAlgorithms.Papers.Independent.Extend50.P26.groupSlotPairs
For every natural number , every natural number , and every two functions , this defines an element of the recursively nested set , , by
It therefore groups the coordinates into the nested sequence , in increasing order. At , both input functions are empty and the output is the singleton element, including when ; when , no such input functions exist.
QAlgorithms.Papers.Independent.Extend50.P26.inverseChoi
For every natural number and every special unitary complex matrix , meaning is unitary and has determinant , this defines the matrix indexed by pairs of indices whose entries are
Here is the conjugate transpose, and there is no dimension-dependent normalization factor. The definition includes , where the resulting matrix has an empty index set.
QAlgorithms.Papers.Independent.Extend50.P26.inversionBasisFintype
For every natural number and every natural number , this supplies a finite enumeration of the recursively defined set , . At it uses the singleton enumeration; at each successor it uses the product enumeration built from the preceding enumeration and the two finite index sets. Its cardinality is ; in particular, the enumeration has one element when , and no elements when .
QAlgorithms.Papers.Independent.Extend50.P26.inversionLink
For all natural numbers , every complex matrix on , and every complex matrix on , this defines a matrix indexed by , with entries
Here , , and inserts before the flattened coordinates of and after them, then regroups consecutive coordinates into pairs. The summand uses directly, without conjugating or transposing it. No positivity or normalization assumptions are imposed. For , the sum has one term and multiplies the corresponding entry of by ; for , the output matrix has an empty index set.
QAlgorithms.Papers.Independent.Extend50.P26.slotTensor
For every natural number , every natural number , and every family of arbitrary complex matrices indexed by , this defines a matrix on , where and . Writing its row and column indices as nested pairs and , its entry is
For , the result is the identity matrix on the singleton set, with sole entry . No positivity or normalization is required of the factors; if , the resulting matrix has an empty index set.
QAlgorithms.Papers.Independent.Extend50.P26.unitaryChoi
For every natural number and every complex matrix , this defines a matrix indexed by pairs from , with entries
There is no hypothesis that is unitary and no dimension-dependent normalization factor. When , this is the unique matrix on the empty index set.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.