Definitions for Characterization of non-local gates
DefinitionQAlgorithms_Papers_Independent_Intakethird100_P99The objects the formalized statements of Characterization of non-local gates (arXiv:quant-ph/0205100) are stated in. Each was checked against the paper by a blind read-back and a moderator.
OneMatrix: PDF p.2: operators on one qubit.TwoMatrix: PDF p.2: operators on the ordered tensor product A then B.OneGate: PDF pp.1–2: a bundled arbitrary one-qubit unitary control.Triple: PDF p.3: three real interaction coefficients, indexed from zero in Lean.OneState: PDF pp.8–9: one-qubit pure-state vectors; IsState supplies normalization.IsGate: PDF p.2, II.A: a two-qubit gate is unitary.localMatrix: PDF pp.1–2: instantaneous independent local gates on A and B.TwoQubitLocalEquivalent: PDF p.2, II.A: local equivalence; U(2) factors also absorb the global phase.canonicalPauliInteraction: PDF p.3, (3): the canonical interaction Hamiltonian, with no strength bound.contentGate: PDF pp.2–3: U_beta = exp(-i H_beta).SOrdered: PDF p.3, II.B: s-ordered coefficients (not ordinary decreasing order).GateChamber: PDF p.2, (1): the gate chamber, as distinguished from Hamiltonian strength.sOrder: PDF p.3, II.B: sort absolute values and give the least one the product's sign. If the product vanishes the least absolute value is zero, so the sign choice is harmless.SMajorized: PDF p.3, (5): b is s-majorized by a; both sides are s-ordered first.contentIntegerShift: PDF pp.4–6, (7): periodic shift by integer multiples of pi/2.secondShift: PDF p.6, Result 2: the only nonzero shift needed for the minimum.HasContent: PDF pp.2–3: an actual canonical-content witness for the given unitary.HasCanonicalHamiltonian: PDF p.4, III.A: the nonlocal part of H has canonical coefficients a after local conjugation. K and L include arbitrary local terms and the scalar identity term.PureInteraction: PDF p.6, III.C: a pure interaction has no scalar or one-body terms.PulseProtocol: PDF p.4, (6): initial local gates followed by evolution/local-control pairs. Nonnegative times are built into the type; the pulse list counts actual H applications.protocolTime: PDF p.4: only interaction intervals contribute to total duration.protocolMatrix: PDF p.4, (6): the earliest step acts on the right. This is an operator on every input, not a protocol chosen after seeing an input state.SamePhysicalGate: PDF pp.1–2: equality of physical gates disregards one scalar phase.IdealSimulates: PDF p.4: ideal fast-LU simulation, explicitly including the limit of arbitrarily fine pulses needed to eliminate local drift. Every approximant has exactly duration t. An operator-norm approximation is uniform over all input states.interactionCost: PDF pp.4,6: interaction cost as an extended nonnegative infimum, including impossible simulations with value infinity. Attainment is asserted in the result, not assumed here.branchCost: PDF p.6: cost of one unshifted s-majorization branch.MoreNonlocal: PDF pp.7–8, III.E: order by interaction cost for every Hermitian H, including zero interaction. This is a preorder on matrices; no antisymmetry on raw gates is claimed.dcnot: PDF p.7, III.D.2: DCNOT sends |i,j> to |j,i xor j>.reverseParties: PDF p.7: interchange Alice and Bob; first register remains the sender in the predicates.CanCbit: PDF pp.8–10, (11): one perfect classical bit, with fixed orthogonal encoding and a fixed pure receiver input chosen before the bit. The sender's residual states may differ. All states are normalized; no ancillary or prior entangled state occurs in the definition.CanTwoCbits: PDF pp.10–11, (16)–(18): two simultaneous perfect classical bits. Each receiving measurement may depend on that receiver's own sent bit, through the two orthogonality conditions. Inputs are fixed independent orthogonal encodings, not shared entanglement.CanQubit: PDF pp.8,11: unknown-qubit transmission preserves every normalized superposition with one fixed encoding, pure receiver input, recovery, and residual sender state.CanHybrid: PDF pp.11–12: a qubit A→B and a cbit B→A in the same use. Bob's recovery depends on his sent bit j, but the same recovery works for every unknown superposition.CanTwoQubits: PDF p.12, IV.B.4: simultaneous exchange of arbitrary qubits with fixed free local encoding and decoding, uniformly over both unknown states.taskCost: PDF pp.9–12: minimize interaction cost over every gate capable of the task P. The empty set has infimum infinity in ENNReal.OptimalTask: PDF pp.10–12: an explicit attaining gate and time, together with the lower bound against every capable gate. Simulation is ideal fast control as on p.4.optimalTransmissionContent: PDF p.11, Result 5: the minimizing interaction content (not necessarily unique).ControlPhase: PDF p.13, Appendix A: determinant phase of the controlled one-qubit unitary is free on the control. b is an eigenphase half-angle, before folding into the gate chamber.controlledContent: PDF p.13, Appendix A: fold b at pi/4 rather than selecting a principal argument.ChamberClass: PDF p.12, IV.C: four disjoint chamber strata; both signed SWAP endpoints are included.TransmissionProfile: PDF p.12, IV.C: operational profiles, including both orientations. "No capability" means no perfect full bit in this single-use model, not zero Shannon capacity.interactionPhases: PDF p.3, (4): interaction eigenvalues in the exact magic-basis order (2).magicBasis: PDF p.3, (2): columns are -i(|01>+|10>)/sqrt2, (|00>+|11>)/sqrt2, -i(|00>-|11>)/sqrt2, (|01>-|10>)/sqrt2, respectively.magicMatrix: PDF p.13, Appendix A: express a computational-basis matrix in basis (2).PhaseCompatibleContent: PDF p.13: a phase-compatible SU(2) local decomposition of the actual representative. This excludes assuming that an arbitrary projective phase has the same magic spectrum.
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Gates
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P10
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P32
/-!
Statements from Hammerer, Vidal and Cirac, arXiv:quant-ph/0205100v3.
Paper-specific definitions are confined to this paper; the accepted Pauli selector and
matrix evolution are imported from the pinned library. Source indices 1,2,3 are Lean indices 0,1,2.
Registers and Pauli gates use the frozen library: Bool for one qubit, Bool × Bool for A then B.
Local U(2) factors include physically irrelevant scalar phases. Appendix A instead explicitly
requires determinant-one local factors for the chosen representative.
General-H simulation is the ideal fast-control limit of finite protocols of exactly the stated
interaction duration (p.4). The norm used to take that limit is the frozen spectral norm.
Finite exact protocols are distinguished from this limit. Costs lie in ENNReal; an empty feasible
set has cost infinity. No gate-chamber bound is imposed on Hamiltonian strength.
-/
namespace QAlgorithms.Papers.Independent.Intakethird100.P99
open scoped Matrix Kronecker NNReal ENNReal
open QAlgorithms.Papers.Independent.Information100.P10 (pauli)
open QAlgorithms.Papers.Independent.Information100.P32 (evolution)
noncomputable section
/-- PDF p.2: operators on one qubit. -/
abbrev OneMatrix := Matrix Bool Bool ℂ
/-- PDF p.2: operators on the ordered tensor product A then B. -/
abbrev TwoMatrix := Matrix (Bool × Bool) (Bool × Bool) ℂ
/-- PDF pp.1–2: a bundled arbitrary one-qubit unitary control. -/
abbrev OneGate := Matrix.unitaryGroup Bool ℂ
/-- PDF p.3: three real interaction coefficients, indexed from zero in Lean. -/
abbrev Triple := Fin 3 → ℝ
/-- PDF pp.8–9: one-qubit pure-state vectors; IsState supplies normalization. -/
abbrev OneState := EuclideanSpace ℂ Bool
/-- PDF p.2, II.A: a two-qubit gate is unitary. -/
def IsGate (U : TwoMatrix) : Prop := U ∈ Matrix.unitaryGroup (Bool × Bool) ℂ
/-- PDF pp.1–2: instantaneous independent local gates on A and B. -/
def localMatrix (A B : OneGate) : TwoMatrix :=
(A : OneMatrix) ⊗ₖ (B : OneMatrix)
/-- PDF p.2, II.A: local equivalence; U(2) factors also absorb the global phase. -/
def TwoQubitLocalEquivalent (U V : TwoMatrix) : Prop :=
∃ A B C D : OneGate, U = localMatrix A B * V * localMatrix C D
/-- PDF p.3, (3): the canonical interaction Hamiltonian, with no strength bound. -/
def canonicalPauliInteraction (a : Triple) : TwoMatrix :=
∑ i : Fin 3, (a i : ℂ) • (pauli i ⊗ₖ pauli i)
/-- PDF pp.2–3: U_beta = exp(-i H_beta). -/
def contentGate (b : Triple) : TwoMatrix := evolution (canonicalPauliInteraction b) 1
/-- PDF p.3, II.B: s-ordered coefficients (not ordinary decreasing order). -/
def SOrdered (a : Triple) : Prop := a 1 ≤ a 0 ∧ |a 2| ≤ a 1
/-- PDF p.2, (1): the gate chamber, as distinguished from Hamiltonian strength. -/
def GateChamber (b : Triple) : Prop := SOrdered b ∧ b 0 ≤ Real.pi / 4
/-- PDF p.3, II.B: sort absolute values and give the least one the product's sign.
If the product vanishes the least absolute value is zero, so the sign choice is harmless. -/
def sOrder (a : Triple) : Triple :=
let hi := max |a 0| (max |a 1| |a 2|)
let lo := min |a 0| (min |a 1| |a 2|)
![hi, |a 0| + |a 1| + |a 2| - hi - lo,
if a 0 * a 1 * a 2 < 0 then -lo else lo]
/-- PDF p.3, (5): b is s-majorized by a; both sides are s-ordered first. -/
def SMajorized (b a : Triple) : Prop :=
let x := sOrder b
let y := sOrder a
x 0 ≤ y 0 ∧ x 0 + x 1 - x 2 ≤ y 0 + y 1 - y 2 ∧
x 0 + x 1 + x 2 ≤ y 0 + y 1 + y 2
/-- PDF pp.4–6, (7): periodic shift by integer multiples of pi/2. -/
def contentIntegerShift (b : Triple) (n : Fin 3 → ℤ) : Triple :=
fun i => b i + Real.pi / 2 * (n i : ℝ)
/-- PDF p.6, Result 2: the only nonzero shift needed for the minimum. -/
def secondShift (b : Triple) : Triple := contentIntegerShift b ![-1, 0, 0]
/-- PDF pp.2–3: an actual canonical-content witness for the given unitary. -/
def HasContent (U : TwoMatrix) (b : Triple) : Prop :=
IsGate U ∧ GateChamber b ∧ TwoQubitLocalEquivalent U (contentGate b)
/-- PDF p.4, III.A: the nonlocal part of H has canonical coefficients a after local
conjugation. K and L include arbitrary local terms and the scalar identity term. -/
def HasCanonicalHamiltonian (H : TwoMatrix) (a : Triple) : Prop :=
H.IsHermitian ∧ SOrdered a ∧
∃ A B : OneGate, ∃ K L : OneMatrix, K.IsHermitian ∧ L.IsHermitian ∧
localMatrix A B * H * star (localMatrix A B) =
canonicalPauliInteraction a + K ⊗ₖ (1 : OneMatrix) + (1 : OneMatrix) ⊗ₖ L
/-- PDF p.6, III.C: a pure interaction has no scalar or one-body terms. -/
def PureInteraction (H : TwoMatrix) : Prop :=
∃ c : Fin 3 → Fin 3 → ℝ,
H = ∑ i : Fin 3, ∑ j : Fin 3, (c i j : ℂ) • (pauli i ⊗ₖ pauli j)
/-- PDF p.4, (6): initial local gates followed by evolution/local-control pairs.
Nonnegative times are built into the type; the pulse list counts actual H applications. -/
structure PulseProtocol where
initialA : OneGate
initialB : OneGate
pulses : List (ℝ≥0 × (OneGate × OneGate))
/-- PDF p.4: only interaction intervals contribute to total duration. -/
def protocolTime (p : PulseProtocol) : ℝ≥0 := (p.pulses.map Prod.fst).sum
/-- PDF p.4, (6): the earliest step acts on the right. This is an operator on every input,
not a protocol chosen after seeing an input state. -/
def protocolMatrix (H : TwoMatrix) (p : PulseProtocol) : TwoMatrix :=
p.pulses.foldl (fun U s => localMatrix s.2.1 s.2.2 * evolution H (s.1 : ℝ) * U)
(localMatrix p.initialA p.initialB)
/-- PDF pp.1–2: equality of physical gates disregards one scalar phase. -/
def SamePhysicalGate (U V : TwoMatrix) : Prop :=
∃ z : ℂ, ‖z‖ = 1 ∧ U = z • V
/-- PDF p.4: ideal fast-LU simulation, explicitly including the limit of arbitrarily fine
pulses needed to eliminate local drift. Every approximant has exactly duration t.
An operator-norm approximation is uniform over all input states. -/
def IdealSimulates (H U : TwoMatrix) (t : ℝ) : Prop :=
H.IsHermitian ∧ IsGate U ∧ 0 ≤ t ∧
∀ e : ℝ, 0 < e → ∃ p : PulseProtocol, (protocolTime p : ℝ) = t ∧
∃ z : ℂ, ‖z‖ = 1 ∧ specNorm (protocolMatrix H p - z • U) < e
/-- PDF pp.4,6: interaction cost as an extended nonnegative infimum, including impossible
simulations with value infinity. Attainment is asserted in the result, not assumed here. -/
def interactionCost (H U : TwoMatrix) : ℝ≥0∞ :=
sInf ((fun t : ℝ≥0 => (t : ℝ≥0∞)) '' {t | IdealSimulates H U (t : ℝ)})
/-- PDF p.6: cost of one unshifted s-majorization branch. -/
def branchCost (a b : Triple) : ℝ≥0∞ :=
sInf ((fun t : ℝ≥0 => (t : ℝ≥0∞)) '' {t | SMajorized b ((t : ℝ) • a)})
/-- PDF pp.7–8, III.E: order by interaction cost for every Hermitian H, including zero
interaction. This is a preorder on matrices; no antisymmetry on raw gates is claimed. -/
def MoreNonlocal (U V : TwoMatrix) : Prop :=
∀ H : TwoMatrix, H.IsHermitian → interactionCost H V ≤ interactionCost H U
/-- PDF p.7, III.D.2: DCNOT sends |i,j> to |j,i xor j>. -/
def dcnot : TwoMatrix :=
Matrix.of fun p q => if p = (q.2, xor q.1 q.2) then 1 else 0
/-- PDF p.7: interchange Alice and Bob; first register remains the sender in the predicates. -/
def reverseParties (U : TwoMatrix) : TwoMatrix := swapGate * U * swapGate
/-- PDF pp.8–10, (11): one perfect classical bit, with fixed orthogonal encoding and a
fixed pure receiver input chosen before the bit. The sender's residual states may differ.
All states are normalized; no ancillary or prior entangled state occurs in the definition. -/
def CanCbit (U : TwoMatrix) : Prop :=
IsGate U ∧ ∃ E D : OneGate, ∃ v : OneState, ∃ w : Bool → OneState,
IsState v ∧ (∀ i, IsState (w i)) ∧
∀ i : Bool, act U (tensorVec (act (E : OneMatrix) (ket i)) v) =
tensorVec (w i) (act (D : OneMatrix) (ket i))
/-- PDF pp.10–11, (16)–(18): two simultaneous perfect classical bits. Each receiving
measurement may depend on that receiver's own sent bit, through the two orthogonality
conditions. Inputs are fixed independent orthogonal encodings, not shared entanglement. -/
def CanTwoCbits (U : TwoMatrix) : Prop :=
IsGate U ∧ ∃ E F : OneGate, ∃ a b : Bool → Bool → OneState,
(∀ i j, IsState (a i j) ∧ IsState (b i j)) ∧
(∀ i, inner ℂ (a i false) (a i true) = 0) ∧
(∀ j, inner ℂ (b false j) (b true j) = 0) ∧
∀ i j : Bool, act U (tensorVec (act (E : OneMatrix) (ket i))
(act (F : OneMatrix) (ket j))) = tensorVec (a i j) (b i j)
/-- PDF pp.8,11: unknown-qubit transmission preserves every normalized superposition
with one fixed encoding, pure receiver input, recovery, and residual sender state. -/
def CanQubit (U : TwoMatrix) : Prop :=
IsGate U ∧ ∃ E R : OneGate, ∃ v w : OneState,
IsState v ∧ IsState w ∧
∀ q : OneState, IsState q →
act (((1 : OneMatrix) ⊗ₖ (R : OneMatrix)) * U)
(tensorVec (act (E : OneMatrix) q) v) = tensorVec w q
/-- PDF pp.11–12: a qubit A→B and a cbit B→A in the same use. Bob's recovery depends
on his sent bit j, but the same recovery works for every unknown superposition. -/
def CanHybrid (U : TwoMatrix) : Prop :=
IsGate U ∧ ∃ E F : OneGate, ∃ R : Bool → OneGate, ∃ a : Bool → OneState,
(∀ j, IsState (a j)) ∧ inner ℂ (a false) (a true) = 0 ∧
∀ j : Bool, ∀ q : OneState, IsState q →
act (((1 : OneMatrix) ⊗ₖ (R j : OneMatrix)) * U)
(tensorVec (act (E : OneMatrix) q) (act (F : OneMatrix) (ket j))) =
tensorVec (a j) q
/-- PDF p.12, IV.B.4: simultaneous exchange of arbitrary qubits with fixed free local
encoding and decoding, uniformly over both unknown states. -/
def CanTwoQubits (U : TwoMatrix) : Prop :=
IsGate U ∧ ∃ E F R S : OneGate,
∀ q r : OneState, IsState q → IsState r →
act (localMatrix R S * U)
(tensorVec (act (E : OneMatrix) q) (act (F : OneMatrix) r)) = tensorVec r q
/-- PDF pp.9–12: minimize interaction cost over every gate capable of the task P.
The empty set has infimum infinity in ENNReal. -/
def taskCost (H : TwoMatrix) (P : TwoMatrix → Prop) : ℝ≥0∞ :=
sInf (interactionCost H '' {U | P U})
/-- PDF pp.10–12: an explicit attaining gate and time, together with the lower bound
against every capable gate. Simulation is ideal fast control as on p.4. -/
def OptimalTask (H : TwoMatrix) (P : TwoMatrix → Prop) (U : TwoMatrix) (t : ℝ) : Prop :=
P U ∧ IdealSimulates H U t ∧ interactionCost H U = ENNReal.ofReal t ∧
taskCost H P = ENNReal.ofReal t ∧
∀ V : TwoMatrix, P V → interactionCost H U ≤ interactionCost H V
/-- PDF p.11, Result 5: the minimizing interaction content (not necessarily unique). -/
def optimalTransmissionContent (a : Triple) : Triple :=
![Real.pi / 4, Real.pi / 4, Real.pi / 4 * (2 * a 2 / (a 0 + a 1))]
/-- PDF p.13, Appendix A: determinant phase of the controlled one-qubit unitary is
free on the control. b is an eigenphase half-angle, before folding into the gate chamber. -/
def ControlPhase (W : OneMatrix) (b : ℝ) : Prop :=
0 ≤ b ∧ b ≤ Real.pi / 2 ∧ ∃ z : ℂ, ‖z‖ = 1 ∧
(z • W).charpoly =
(Polynomial.X - Polynomial.C (Complex.exp (2 * Complex.I * (b : ℂ)))) *
(Polynomial.X - Polynomial.C (Complex.exp (-2 * Complex.I * (b : ℂ))))
/-- PDF p.13, Appendix A: fold b at pi/4 rather than selecting a principal argument. -/
def controlledContent (b : ℝ) : Triple := ![min b (Real.pi / 2 - b), 0, 0]
/-- PDF p.12, IV.C: four disjoint chamber strata; both signed SWAP endpoints are included. -/
def ChamberClass (b : Triple) (k : Fin 4) : Prop :=
if k = 0 then b 0 < Real.pi / 4
else if k = 1 then b 0 = Real.pi / 4 ∧ b 1 < Real.pi / 4
else if k = 2 then b 0 = Real.pi / 4 ∧ b 1 = Real.pi / 4 ∧ |b 2| < Real.pi / 4
else b 0 = Real.pi / 4 ∧ b 1 = Real.pi / 4 ∧ |b 2| = Real.pi / 4
/-- PDF p.12, IV.C: operational profiles, including both orientations. "No capability"
means no perfect full bit in this single-use model, not zero Shannon capacity. -/
def TransmissionProfile (U : TwoMatrix) (k : Fin 4) : Prop :=
if k = 0 then
¬ CanCbit U ∧ ¬ CanCbit (reverseParties U) ∧ ¬ CanTwoCbits U ∧
¬ CanQubit U ∧ ¬ CanQubit (reverseParties U) ∧
¬ CanHybrid U ∧ ¬ CanHybrid (reverseParties U) ∧ ¬ CanTwoQubits U
else if k = 1 then
CanCbit U ∧ CanCbit (reverseParties U) ∧ ¬ CanTwoCbits U ∧
¬ CanQubit U ∧ ¬ CanQubit (reverseParties U) ∧
¬ CanHybrid U ∧ ¬ CanHybrid (reverseParties U) ∧ ¬ CanTwoQubits U
else if k = 2 then
CanCbit U ∧ CanCbit (reverseParties U) ∧ CanTwoCbits U ∧
CanQubit U ∧ CanQubit (reverseParties U) ∧
CanHybrid U ∧ CanHybrid (reverseParties U) ∧ ¬ CanTwoQubits U
else
CanCbit U ∧ CanCbit (reverseParties U) ∧ CanTwoCbits U ∧
CanQubit U ∧ CanQubit (reverseParties U) ∧
CanHybrid U ∧ CanHybrid (reverseParties U) ∧ CanTwoQubits U
/-- PDF p.3, (4): interaction eigenvalues in the exact magic-basis order (2). -/
def interactionPhases (b : Triple) : Fin 4 → ℝ :=
![b 0 + b 1 - b 2, b 0 - b 1 + b 2, -b 0 + b 1 + b 2, -b 0 - b 1 - b 2]
/-- PDF p.3, (2): columns are -i(|01>+|10>)/sqrt2, (|00>+|11>)/sqrt2,
-i(|00>-|11>)/sqrt2, (|01>-|10>)/sqrt2, respectively. -/
def magicBasis : Matrix (Bool × Bool) (Fin 4) ℂ :=
fun p j =>
![if p.1 ≠ p.2 then -Complex.I / (Real.sqrt 2 : ℂ) else 0,
if p.1 = p.2 then 1 / (Real.sqrt 2 : ℂ) else 0,
if p.1 = p.2 then (if p.1 then Complex.I else -Complex.I) / (Real.sqrt 2 : ℂ)
else 0,
if p.1 ≠ p.2 then (if p.1 then -1 else 1) / (Real.sqrt 2 : ℂ) else 0] j
/-- PDF p.13, Appendix A: express a computational-basis matrix in basis (2). -/
def magicMatrix (U : TwoMatrix) : Matrix (Fin 4) (Fin 4) ℂ :=
magicBasis.conjTranspose * U * magicBasis
/-- PDF p.13: a phase-compatible SU(2) local decomposition of the actual representative.
This excludes assuming that an arbitrary projective phase has the same magic spectrum. -/
def PhaseCompatibleContent (U : TwoMatrix) (b : Triple) : Prop :=
GateChamber b ∧ ∃ A B C D : OneGate,
(A : OneMatrix).det = 1 ∧ (B : OneMatrix).det = 1 ∧
(C : OneMatrix).det = 1 ∧ (D : OneMatrix).det = 1 ∧
U = localMatrix A B * contentGate b * localMatrix C D
/-! Definition sanity checks; no paper theorem is proved here. -/
example : canonicalPauliInteraction (0 : Triple) = 0 := by
simp [canonicalPauliInteraction]
example (H : TwoMatrix) : evolution H 0 = 1 := by
simp [evolution]
example : GateChamber (0 : Triple) := by
refine ⟨?_, ?_⟩
· norm_num [SOrdered]
· exact div_nonneg Real.pi_pos.le (by norm_num)
example : sOrder (0 : Triple) = 0 := by
funext i
fin_cases i <;> norm_num [sOrder]
example : SMajorized (0 : Triple) 0 := by
norm_num [SMajorized, sOrder]
example (b : Triple) : contentIntegerShift b 0 = b := by
funext i
simp [contentIntegerShift]
example (A B : OneGate) : protocolTime ⟨A, B, []⟩ = 0 := rfl
example (A B : OneGate) (H : TwoMatrix) :
protocolMatrix H ⟨A, B, []⟩ = localMatrix A B := rfl
example : dcnot (true, true) (false, true) = 1 := by
simp [dcnot]
example (H : TwoMatrix) : taskCost H (fun _ => False) = ⊤ := by
simp [taskCost]
example (U : TwoMatrix) (h : CanCbit U) : IsGate U := h.1
example (U : TwoMatrix) (h : CanTwoCbits U) : IsGate U := h.1
example (U : TwoMatrix) (h : CanQubit U) : IsGate U := h.1
example (U : TwoMatrix) (h : CanHybrid U) : IsGate U := h.1
example (U : TwoMatrix) (h : CanTwoQubits U) : IsGate U := h.1
example (b : Triple) : interactionPhases b 3 = -b 0 - b 1 - b 2 := rfl
example : magicBasis (false, false) 0 = 0 := by simp [magicBasis]
example : magicBasis (false, true) 3 = 1 / (Real.sqrt 2 : ℂ) := by simp [magicBasis]
end
end QAlgorithms.Papers.Independent.Intakethird100.P99
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Intakethird100.P99.CanCbit
For a complex two-qubit matrix , this predicate says that is unitary and there exist single-qubit unitaries , a vector , and vectors in the same space for each Boolean , such that , for both , and
Here is the coordinate vector with value one at and zero at the other Boolean, matrix action is ordinary matrix-vector multiplication, and . All norms are Euclidean. The same must work for both values of ; may depend on .
QAlgorithms.Papers.Independent.Intakethird100.P99.CanHybrid
For a complex two-qubit matrix , this predicate says that is unitary and there exist fixed single-qubit unitaries , a single-qubit unitary for each Boolean , and single-qubit vectors such that for both , , and
The vectors lie in , norms are Euclidean, the inner product is the standard complex inner product conjugate-linear in its first argument, and is the coordinate basis vector. Matrix actions are ordinary multiplication and tensor-vector coordinates are products. Both and may depend on , but none of the chosen objects may depend on .
QAlgorithms.Papers.Independent.Intakethird100.P99.CanQubit
For a complex two-qubit matrix , this predicate says that is unitary and there exist fixed single-qubit unitaries and fixed single-qubit vectors of Euclidean norm one such that, for every single-qubit vector with ,
All single-qubit vectors belong to , is its identity matrix, and tensor-vector coordinates are products of coordinates. The equality is exact, and the same choices must work for every unit vector .
QAlgorithms.Papers.Independent.Intakethird100.P99.CanTwoCbits
For a complex two-qubit matrix , this predicate says that is unitary and there exist single-qubit unitaries and single-qubit vectors for every pair of Booleans , such that
and
The vectors lie in , with the Euclidean norm and the standard complex inner product, conjugate-linear in its first argument. The ket is the corresponding coordinate vector, matrix action is ordinary multiplication, and tensor-vector coordinates are products of coordinates. The unitaries are fixed across all four inputs.
QAlgorithms.Papers.Independent.Intakethird100.P99.CanTwoQubits
For a complex two-qubit matrix , this predicate says that is unitary and there exist fixed single-qubit unitaries such that
The single-qubit space is , the norms are Euclidean, matrix action is ordinary multiplication, and tensor-vector coordinates are products of coordinates. The equality is exact and the four unitaries must work simultaneously for every such pair .
QAlgorithms.Papers.Independent.Intakethird100.P99.ChamberClass
For every real triple and every index , this predicate is defined by
No additional inequalities on the coordinates are part of this predicate; in particular, it does not separately require or .
QAlgorithms.Papers.Independent.Intakethird100.P99.ControlPhase
For every complex matrix whose rows and columns are indexed by , and every real number , this predicate means that and there exists a complex number with such that the characteristic polynomial of the scalar multiple is
The endpoints and are included. The predicate imposes no separate unitarity or Hermiticity condition on .
QAlgorithms.Papers.Independent.Intakethird100.P99.GateChamber
For a real triple , this predicate means precisely that , , and . All boundary equalities are allowed.
QAlgorithms.Papers.Independent.Intakethird100.P99.HasCanonicalHamiltonian
For a complex matrix , indexed by pairs of Boolean values, and a real triple , this predicate holds precisely when is Hermitian, and , and there exist complex unitary matrices and complex Hermitian matrices satisfying
where are the usual Pauli matrices, is the identity matrix, and denotes conjugate transpose. No upper bound on , determinant-one restriction on , or trace restriction on is imposed.
QAlgorithms.Papers.Independent.Intakethird100.P99.HasContent
For a complex matrix , indexed by pairs of Boolean values, and a real triple , this predicate holds precisely when is unitary,
and there exist four complex unitary matrices such that
where are the usual Pauli matrices and denotes the Kronecker product. The equality is exact, and the four local unitary matrices have no determinant-one requirement.
QAlgorithms.Papers.Independent.Intakethird100.P99.IdealSimulates
For complex matrices , indexed by pairs of Boolean values, and a real number , this predicate holds precisely when is Hermitian, is unitary, , and for every real there exist a finite list , initial matrices , and a complex scalar , such that all , including the initial pair, are complex unitaries, every , , , and
Here is the operator norm induced by the Euclidean norm. The list and phase may depend on ; empty lists, zero durations, and total time are included.
QAlgorithms.Papers.Independent.Intakethird100.P99.IsGate
For any complex matrix indexed by pairs of Boolean values, this predicate means that is unitary: .
QAlgorithms.Papers.Independent.Intakethird100.P99.MoreNonlocal
For arbitrary complex two-qubit matrices , this predicate says that for every Hermitian complex two-qubit matrix , . Here is the infimum of all nonnegative real times such that is unitary and, for every , there exist a finite list of nonnegative durations summing exactly to , single-qubit unitaries , and with , for which
The norm is the Euclidean operator norm. The list may be empty, giving duration zero and matrix ; the protocol and phase may depend on . The infimum of an empty set is . Neither nor is assumed unitary in the predicate itself, and the comparison includes infinite costs, with allowed.
QAlgorithms.Papers.Independent.Intakethird100.P99.OneGate
This is the type of unitary complex matrices indexed by Boolean values: matrices satisfying . Their determinants are not required to equal .
QAlgorithms.Papers.Independent.Intakethird100.P99.OneMatrix
This is the type of all complex matrices whose rows and columns are indexed by , hence all complex matrices, with no further restrictions.
QAlgorithms.Papers.Independent.Intakethird100.P99.OneState
This is the complex Euclidean space of vectors indexed by Boolean values, namely with its Euclidean inner product. Vectors are not required to have norm ; the zero vector is included.
QAlgorithms.Papers.Independent.Intakethird100.P99.OptimalTask
For arbitrary complex two-qubit matrices , a predicate on such matrices, and a real number , this predicate asserts all of the following simultaneously: holds; is Hermitian, is unitary, and ; for every there exist a finite list of nonnegative durations summing exactly to , single-qubit unitaries , and with , such that
moreover,
Here is the infimum in of all nonnegative times admitting the same approximation condition with target , including the requirements that be Hermitian and unitary; an empty admissible set has cost . The operator norm is induced by the Euclidean norm. Empty pulse lists are allowed and give duration zero and matrix , while protocols and phases may vary with . Finally, is regarded as an extended nonnegative real, which here equals because nonnegativity is required.
QAlgorithms.Papers.Independent.Intakethird100.P99.PhaseCompatibleContent
For every complex matrix on two qubits and every real triple , this predicate means that
and there exist four complex unitary matrices , each with determinant , such that
where are the Pauli matrices
in Boolean basis order . The displayed equality is exact and contains no additional overall phase factor.
QAlgorithms.Papers.Independent.Intakethird100.P99.PulseProtocol
A pulse protocol consists of two initial complex unitary matrices and a finite ordered list of triples , where every is a nonnegative real number and every is a complex unitary matrix. The list may be empty, durations may be zero, and none of the unitary matrices is required to have determinant one.
QAlgorithms.Papers.Independent.Intakethird100.P99.PureInteraction
For a complex matrix , indexed by pairs of Boolean values, this predicate holds precisely when there exist nine real coefficients , for , such that
where are the usual Pauli matrices and is the Kronecker product. The coefficients are unrestricted real numbers, including zero, so the zero matrix is included.
QAlgorithms.Papers.Independent.Intakethird100.P99.SMajorized
For arbitrary real triples and , this predicate holds precisely when the following three inequalities hold. For each , put , , , and if , otherwise . The required inequalities are
No ordering or nonzero-coordinate assumptions are imposed on either input triple.
QAlgorithms.Papers.Independent.Intakethird100.P99.SOrdered
For a real triple , this predicate means precisely that and . Both inequalities allow equality, including the zero triple.
QAlgorithms.Papers.Independent.Intakethird100.P99.SamePhysicalGate
For any two complex matrices , indexed by pairs of Boolean values, this predicate holds precisely when there exists a complex scalar with such that
Neither matrix is assumed unitary; in particular, both may be zero.
QAlgorithms.Papers.Independent.Intakethird100.P99.TransmissionProfile
For every complex matrix on and every , define , where ; use the standard basis vectors , with and , and tensor coordinates . To state the predicate explicitly, let mean that is unitary and there exist single-qubit unitary matrices , a unit vector , and unit vectors for , such that for every . Let mean that is unitary and there exist single-qubit unitary matrices and unit vectors for every , such that for every , for every , and for every . Let mean that is unitary and there exist single-qubit unitary matrices and unit vectors such that for every unit vector . Let mean that is unitary and there exist single-qubit unitary matrices , single-qubit unitary matrices for , and orthogonal unit vectors , such that for every and every unit vector . Finally, let mean that is unitary and there exist single-qubit unitary matrices such that for every pair of unit vectors . The defined profile requires exactly the following truth values, where a false entry means the negation of the corresponding existential predicate:
There is no separate unitarity assumption on ; in particular, every nonunitary satisfies the branch.
QAlgorithms.Papers.Independent.Intakethird100.P99.Triple
This is the type of real triples , with no restrictions on their entries.
QAlgorithms.Papers.Independent.Intakethird100.P99.TwoMatrix
This is the type of all complex matrices whose rows and columns are indexed by ordered pairs of Boolean values, hence all complex matrices, with no further restrictions.
QAlgorithms.Papers.Independent.Intakethird100.P99.TwoQubitLocalEquivalent
For arbitrary complex matrices and indexed by Boolean pairs, this predicate means that there exist four unitary complex matrices such that . Neither nor is separately required to be unitary, and the equality is exact.
QAlgorithms.Papers.Independent.Intakethird100.P99.branchCost
For arbitrary real triples and , define, for each real triple ,
The branch cost is the infimum in of the nonnegative real numbers for which, writing and with ,
No ordering or nonzero assumptions are imposed on either triple, and is included among the candidate times. An empty set of candidate times has infimum ; an infimum is not required to be attained.
QAlgorithms.Papers.Independent.Intakethird100.P99.canonicalPauliInteraction
For every real triple , this defines the complex matrix , where, in Boolean order , , , and .
QAlgorithms.Papers.Independent.Intakethird100.P99.contentGate
For every real triple , this defines the matrix exponential , where , , and in Boolean order . No ordering or size restrictions are imposed on .
QAlgorithms.Papers.Independent.Intakethird100.P99.contentIntegerShift
For any real triple and any integer triple , this function returns the real triple whose coordinates are
Each integer coordinate may be positive, zero, or negative; no reduction modulo any period is performed.
QAlgorithms.Papers.Independent.Intakethird100.P99.controlledContent
For every real number , this defines the real triple
There is no restriction on ; in particular, the first coordinate can be negative when lies outside .
QAlgorithms.Papers.Independent.Intakethird100.P99.dcnot
This defines a complex matrix whose rows and columns are indexed by pairs of Booleans: for every row and column ,
where is exclusive-or. Equivalently, on coordinate basis vectors it sends to .
QAlgorithms.Papers.Independent.Intakethird100.P99.interactionCost
For arbitrary complex matrices acting on , the interaction cost is the infimum, in , of all nonnegative real times satisfying the following condition: is Hermitian, is unitary, and for every there exist a finite list of nonnegative durations , single-qubit unitaries , and a complex number with , such that
Here the norm is the operator norm for the Euclidean norm, and the tensor products are ordinary Kronecker products. The list may be empty, in which case its total duration is zero and its matrix is . The protocols and may depend on . The infimum need not be attained; if there are no admissible times, the cost is , including whenever is not Hermitian or is not unitary.
QAlgorithms.Papers.Independent.Intakethird100.P99.interactionPhases
For every real triple , this defines a function on with values, in that order,
There are no assumptions on , and no reduction of these real values modulo a period is performed.
QAlgorithms.Papers.Independent.Intakethird100.P99.localMatrix
For any unitary complex matrices and indexed by Boolean values, this defines their Kronecker product , whose entry at row and column is .
QAlgorithms.Papers.Independent.Intakethird100.P99.magicBasis
This defines the complex matrix with rows indexed by Boolean pairs and columns indexed by which, in row order , is
QAlgorithms.Papers.Independent.Intakethird100.P99.magicMatrix
For every complex matrix whose rows and columns are indexed by Boolean pairs, this defines the complex matrix on indices by
where the rows of are ordered as , its columns are ordered , and is its conjugate transpose. No unitarity assumption on is required.
QAlgorithms.Papers.Independent.Intakethird100.P99.optimalTransmissionContent
For every real triple , this defines the real triple
There are no ordering or nonzero-denominator assumptions on . Division is total: if , the third coordinate is .
QAlgorithms.Papers.Independent.Intakethird100.P99.protocolMatrix
For any complex matrix , indexed by pairs of Boolean values, and any pulse protocol with initial complex unitaries and ordered list , where and are complex unitaries, define
The protocol matrix is . For an empty list it is ; zero durations are allowed, and is not assumed Hermitian.
QAlgorithms.Papers.Independent.Intakethird100.P99.protocolTime
For any pulse protocol , consisting of initial complex unitaries and a finite ordered list of nonnegative real durations paired with two complex unitaries, its protocol time is the nonnegative real number
The initial unitary matrices do not contribute to this sum, and an empty list has protocol time zero.
QAlgorithms.Papers.Independent.Intakethird100.P99.reverseParties
For every complex matrix indexed by Boolean pairs, this defines , where is the matrix with entry when and entry zero otherwise. Thus the resulting entries are
for all Booleans . There is no unitarity assumption on .
QAlgorithms.Papers.Independent.Intakethird100.P99.sOrder
For any real triple , define and . The function returns the real triple
Thus the first two coordinates are the largest and middle absolute values; the third is the smallest absolute value with the indicated sign. Ties and zero coordinates are included, and a zero product takes the nonnegative branch.
QAlgorithms.Papers.Independent.Intakethird100.P99.secondShift
For any real triple , this function returns
There are no ordering or range restrictions on .
QAlgorithms.Papers.Independent.Intakethird100.P99.taskCost
For an arbitrary complex two-qubit matrix and an arbitrary predicate on complex two-qubit matrices, this defines in . Here is the infimum of the nonnegative real times for which is Hermitian, is unitary, and for every there exist nonnegative durations summing exactly to , single-qubit unitaries , and a complex number with , such that
The norm is the Euclidean operator norm; the list is finite and may be empty, yielding duration zero and matrix . The protocol and phase may depend on . Both infima use the convention , and neither infimum is required to be attained. There is no separate restriction on or on the matrices satisfying .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.