Definitions for Efficient quantum tomography II
DefinitionQAlgorithms_Papers_Independent_Extend50_P32The objects the formalized statements of Efficient quantum tomography II (arXiv:1612.00034) are stated in. Each was checked against the paper by a blind read-back and a moderator.
insertRow: Bump the first strictly greater letter, retaining original occurrence IDs; equality does not bump (PDF pp.2,28-29).insertRows: Propagate insertion. Each log entry records row exited, input time, and bumped occurrence (PDF pp.4,28-29).rskRun: Execute actual RSK from the empty tableau; bump logs are chronological and carry original occurrence identities (PDF pp.2,4,28).shape: Computed Young row list, padded by zero viarow(PDF p.2).row: Zero-padded real row length (PDF p.2).rowPrefix: First k row total (PDF p.11).WeakDominates: Prefix comparison of sorted Young rows, not containment (PDF p.4).shapeDominates: Dominance includes equal total size (PDF p.4).bumpedTokens: Chronological occurrences bumped out of zero-based row j (PDF pp.4,28).bumpedWord: Bump-order word, forgetting IDs after selection (PDF pp.4,28).originalBumpedWord: Stable original-word restriction to bumped occurrence IDs; equal values are never conflated (PDF pp.4,28).wordMean: Finite iid expectation, including the unique empty word (PDF p.2).swMean: Combinatorial SW expectation: pushforward of iid words by computed RSK, independent of physical weak-Schur probabilities (PDF p.2).swMeanExt: Extended SW expectation; zero-weight impossible words contribute zero even if their loss is infinite (PDF pp.2,12).iidWordEventProbability: Finite word-event probability (PDF pp.2,19).prefixMass: Prefix mass without renormalization (PDF p.11).tail: Mass strictly after the first k entries (PDF pp.7,11).normalizedShapeRows: Normalized padded rows; all normalized-diagram statements require n>0 (PDF pp.3-4).h2: Truncated classical Hellinger squared, no factor 1/2 (PDF p.12).l2: Truncated squared Euclidean loss (PDF p.12).chiTerm: Chi-squared summand: 0/0 contributes zero; a positive estimate at zero true probability contributes infinity (PDF p.12).chi2: Truncated chi-squared, estimate first and truth second (PDF p.12).kl: KL in nats: support violations give infinity and zero estimated mass gives zero. Signed summands are summed BEFORE conversion, not individually clipped (PDF p.12).FullMetric: Full loss choices (PDF pp.4,6).fullLoss: Source full losses, with their specified argument order (PDF p.12).WeightedMetric: Weighted truncated loss choices (PDF pp.4,7).weightedLoss: Already-truncated weighted loss (PDF p.4).truncatedTV: Truncated TV: half the first-k absolute differences, no tail bin. OW16, arXiv:1508.01907v2 PDF p.3, Theorem 1.7 explicitly defines this convention; this paper's PDF p.4 uses it by reference.prefixExcess: Unnormalized expected prefix excess (PDF pp.5,11,13).normalizedExcess: Normalized expected prefix excess (PDF p.22).spectralPrefixExcessLimit: Excess is infinite at any tied cutoff, including tied zero, following the p.15 proof. The sum is empty at k=d (PDF pp.14-15).rowScale: Uniform row scale nu_k (PDF p.3).rowMSE: Unnormalized row mean squared error (PDF pp.3,20).rowVariance: Variance about the row's own mean (PDF p.19).histogram: Word histogram (PDF pp.13-14).modifiedDensity: Relative SIGNED density phi, with alpha_j cancelled before evaluation at zero last mass. Used only with n>0 and distinct probabilities (PDF pp.13-15).modifiedMean: Modified multinomial signed expectation, not a probability measure (PDF p.14).prefixWord: Stable word restriction to the first k letters (PDF p.16).suffixWord: Stable word restriction to source letters >=k (PDF p.16).quantumH2: Quantum Hellinger squared for PSD matrices, including subnormalized reports, with no factor 1/2 (PDF pp.13,25).affinity: Quantum affinity, distinct from root fidelity (PDF p.13).truncatedReport: Rank-k Keyl report, WITHOUT renormalizing the truncated rows (PDF pp.22,25).keylRisk: Extended Hellinger risk under the concrete Keyl joint Born law, not Haar alone or a law chosen for accuracy (PDF pp.22-27).keylSuccess: Success under the same public Keyl decoder (PDF pp.6-7).copyBudget: Integer copy budget, rounding a real bound upward (PDF pp.6-7).InducedPermutation: Any measurable Birkhoff decomposition of |V_(a,i)|^2, with pi(i)=a. No accuracy property is assumed; the theorem is independent of the choice (PDF p.23).keylMean: Keyl real expectation. All uses below are bounded continuous statistics or bounded measurable permutation mixtures, hence integrable (PDF p.23).permutationMean: Conditional permutation expectation in eigenbasis B; weights use B dagger V, rather than a unitary in an unrelated basis (PDF pp.23,25).eydRisk: Physical EYD risk; weak-Schur projectors and decoder are fixed before the unknown state. The law depends only on its spectrum (PDF pp.5-6).eydSuccess: Success event for the same physical EYD experiment (PDF pp.6-7).ProperIncreasingCurve: Proper increasing graphs; no smoothness restriction (PDF p.30).wordPoints: Original-word graph points (PDF p.29).firstBumpPoints: Black skeleton points keep the input TIME of the bump as horizontal coordinate, rather than being reindexed in the shorter word (PDF p.29). This coordinate differs from the bumped occurrence's own original position.IsChains: Disjoint increasing chains as sets of occurrence indices; empty chains and the empty family are allowed (PDF pp.2,28).CurvesThrough: Proper graphs pass through every selected occurrence and are pairwise disjoint on the whole real line (PDF p.30).AdmissibleChains: Full admissibility invariant (19): chains are admissible and every inadmissible point is strictly southeast of the southeasternmost curve. No output-existence certificate is built into this predicate (PDF pp.28-30).adjacentProbabilityMultiplier: Adjacent multiplier in Lemmas 5.3-5.4; defined only for an actual pair of consecutive indices (PDF p.24).flooredEntry: Floored list from the proof of Corollary 5.5; its first k entries stay unchanged and the next entry is zeta under the cutoff assumptions (PDF p.25).
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Learning
import Definitions.Def_QAlgorithms_Defs_QuantumInformation
import Definitions.Def_QAlgorithms_Defs_KeylTomography
import Definitions.Def_QAlgorithms_Defs_SchurWeylMeasurements
import Definitions.Def_QAlgorithms_Papers_Independent_Support50_P38
import Definitions.Def_QAlgorithms_Papers_Independent_Gap20_P17
/-! O'Donnell--Wright, Efficient quantum tomography II, arXiv:1612.00034v1.
All citations use PDF pages. Internal letter/row indices are zero based;
a prefix parameter k counts k entries. New definitions belong only to this paper. -/
noncomputable section
open MeasureTheory Filter
open scoped BigOperators ENNReal Matrix ComplexOrder Topology
namespace QAlgorithms.Papers.Independent.Extend50.P32
-- Reuse exact iid product mass and half-l1 TV from the pinned accepted library.
open QAlgorithms.Papers.Independent.Support50.P38 (wordMass tv)
-- For the density matrices below, the characteristic-polynomial identity
-- preserves all eigenvalues with multiplicity and is equivalent to unitary
-- diagonalization with these real eigenvalues. No accuracy is assumed.
open QAlgorithms.Papers.Independent.Gap20.P17 (HasSpectrum)
/-- Bump the first strictly greater letter, retaining original occurrence IDs;
equality does not bump (PDF pp.2,28-29). -/
def insertRow {A : Type*} [LinearOrder A] (a : A × ℕ) :
List (A × ℕ) → List (A × ℕ) × Option (A × ℕ)
| [] => ([a], none)
| b :: row => if a.1 < b.1 then (a :: row, some b)
else let r := insertRow a row; (b :: r.1, r.2)
/-- Propagate insertion. Each log entry records row exited, input time,
and bumped occurrence (PDF pp.4,28-29). -/
def insertRows {A : Type*} [LinearOrder A] (j t : ℕ) (a : A × ℕ) :
List (List (A × ℕ)) → List (List (A × ℕ)) × List (ℕ × ℕ × (A × ℕ))
| [] => ([[a]], [])
| row :: rows =>
let r := insertRow a row
match r.2 with
| none => (r.1 :: rows, [])
| some b =>
let s := insertRows (j + 1) t b rows
(r.1 :: s.1, (j, t, b) :: s.2)
/-- Execute actual RSK from the empty tableau; bump logs are chronological
and carry original occurrence identities (PDF pp.2,4,28). -/
def rskRun {A : Type*} [LinearOrder A] (w : List A) :
List (List (A × ℕ)) × List (ℕ × ℕ × (A × ℕ)) :=
w.zipIdx.foldl (fun st a =>
let r := insertRows 0 a.2 a st.1
(r.1, st.2 ++ r.2)) ([], [])
/-- Computed Young row list, padded by zero via `row` (PDF p.2). -/
def shape {A : Type*} [LinearOrder A] (w : List A) : List ℕ :=
(rskRun w).1.map List.length
/-- Zero-padded real row length (PDF p.2). -/
def row (s : List ℕ) (i : ℕ) : ℝ := ((s[i]?).getD 0 : ℕ)
/-- First k row total (PDF p.11). -/
def rowPrefix (s : List ℕ) (k : ℕ) : ℝ := (s.take k).sum
/-- Prefix comparison of sorted Young rows, not containment (PDF p.4). -/
def WeakDominates (s t : List ℕ) : Prop := ∀ k : ℕ, (t.take k).sum ≤ (s.take k).sum
/-- Dominance includes equal total size (PDF p.4). -/
def shapeDominates (s t : List ℕ) : Prop := s.sum = t.sum ∧ WeakDominates s t
/-- Chronological occurrences bumped out of zero-based row j (PDF pp.4,28). -/
def bumpedTokens {A : Type*} [LinearOrder A] (w : List A) (j : ℕ) : List (A × ℕ) :=
((rskRun w).2.filter (fun e => e.1 = j)).map (fun e => e.2.2)
/-- Bump-order word, forgetting IDs after selection (PDF pp.4,28). -/
def bumpedWord {A : Type*} [LinearOrder A] (w : List A) (j : ℕ) : List A :=
(bumpedTokens w j).map Prod.fst
/-- Stable original-word restriction to bumped occurrence IDs; equal values
are never conflated (PDF pp.4,28). -/
def originalBumpedWord {A : Type*} [LinearOrder A] (w : List A) (j : ℕ) : List A :=
(w.zipIdx.filter (fun a => a.2 ∈ (bumpedTokens w j).map Prod.snd)).map Prod.fst
/-- Finite iid expectation, including the unique empty word (PDF p.2). -/
def wordMean {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (F : List (Fin d) → ℝ) : ℝ :=
∑ w : Fin n → Fin d, wordMass alpha w * F (List.ofFn w)
/-- Combinatorial SW expectation: pushforward of iid words by computed RSK,
independent of physical weak-Schur probabilities (PDF p.2). -/
def swMean {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (F : List ℕ → ℝ) : ℝ :=
wordMean alpha n (fun w => F (shape w))
/-- Extended SW expectation; zero-weight impossible words contribute zero
even if their loss is infinite (PDF pp.2,12). -/
def swMeanExt {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (F : List ℕ → ℝ≥0∞) : ℝ≥0∞ :=
∑ w : Fin n → Fin d, ENNReal.ofReal (wordMass alpha w) * F (shape (List.ofFn w))
/-- Finite word-event probability (PDF pp.2,19). -/
def iidWordEventProbability {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (P : List (Fin d) → Prop) : ℝ := by
classical
exact wordMean alpha n (fun w => if P w then 1 else 0)
/-- Prefix mass without renormalization (PDF p.11). -/
def prefixMass {d : ℕ} (alpha : Fin d → ℝ) (k : ℕ) : ℝ :=
∑ i, if i.val < k then alpha i else 0
/-- Mass strictly after the first k entries (PDF pp.7,11). -/
def tail {d : ℕ} (alpha : Fin d → ℝ) (k : ℕ) : ℝ :=
∑ i, if k ≤ i.val then alpha i else 0
/-- Normalized padded rows; all normalized-diagram statements require n>0 (PDF pp.3-4). -/
def normalizedShapeRows {d : ℕ} (n : ℕ) (s : List ℕ) : Fin d → ℝ := fun i => row s i.val / n
/-- Truncated classical Hellinger squared, no factor 1/2 (PDF p.12). -/
def h2 {d : ℕ} (k : ℕ) (a b : Fin d → ℝ) : ℝ :=
∑ i, if i.val < k then (Real.sqrt (a i) - Real.sqrt (b i)) ^ 2 else 0
/-- Truncated squared Euclidean loss (PDF p.12). -/
def l2 {d : ℕ} (k : ℕ) (a b : Fin d → ℝ) : ℝ :=
∑ i, if i.val < k then (a i - b i) ^ 2 else 0
/-- Chi-squared summand: 0/0 contributes zero; a positive estimate at zero
true probability contributes infinity (PDF p.12). -/
def chiTerm (a b : ℝ) : ℝ≥0∞ :=
if b = 0 then (if a = 0 then 0 else ⊤) else ENNReal.ofReal ((a - b) ^ 2 / b)
/-- Truncated chi-squared, estimate first and truth second (PDF p.12). -/
def chi2 {d : ℕ} (k : ℕ) (a b : Fin d → ℝ) : ℝ≥0∞ :=
∑ i, if i.val < k then chiTerm (a i) (b i) else 0
/-- KL in nats: support violations give infinity and zero estimated mass gives
zero. Signed summands are summed BEFORE conversion, not individually clipped (PDF p.12). -/
def kl {d : ℕ} (a b : Fin d → ℝ) : ℝ≥0∞ := by
classical
exact if ∃ i, a i ≠ 0 ∧ b i = 0 then ⊤ else ENNReal.ofReal
(∑ i, if a i = 0 then 0 else a i * Real.log (a i / b i))
/-- Full loss choices (PDF pp.4,6). -/
inductive FullMetric where
| hellinger | kullbackLeibler | chiSquared
deriving DecidableEq
/-- Source full losses, with their specified argument order (PDF p.12). -/
def fullLoss {d : ℕ} (metric : FullMetric) (a b : Fin d → ℝ) : ℝ≥0∞ :=
match metric with
| .hellinger => ENNReal.ofReal (h2 d a b)
| .kullbackLeibler => kl a b
| .chiSquared => chi2 d a b
/-- Weighted truncated loss choices (PDF pp.4,7). -/
inductive WeightedMetric where
| hellinger | chiSquared
deriving DecidableEq
/-- Already-truncated weighted loss (PDF p.4). -/
def weightedLoss {d : ℕ} (metric : WeightedMetric) (k : ℕ) (a b : Fin d → ℝ) : ℝ≥0∞ :=
match metric with
| .hellinger => ENNReal.ofReal (h2 k a b)
| .chiSquared => chi2 k a b
/-- Truncated TV: half the first-k absolute differences, no tail bin.
OW16, arXiv:1508.01907v2 PDF p.3, Theorem 1.7 explicitly defines this
convention; this paper's PDF p.4 uses it by reference. -/
def truncatedTV {d : ℕ} (k : ℕ) (a b : Fin d → ℝ) : ℝ :=
(∑ i, if i.val < k then |a i - b i| else 0) / 2
/-- Unnormalized expected prefix excess (PDF pp.5,11,13). -/
def prefixExcess {d : ℕ} (alpha : Fin d → ℝ) (k n : ℕ) : ℝ :=
swMean alpha n (fun s => rowPrefix s k) - prefixMass alpha k * n
/-- Normalized expected prefix excess (PDF p.22). -/
def normalizedExcess {d : ℕ} (alpha : Fin d → ℝ) (k n : ℕ) : ℝ := prefixExcess alpha k n / n
/-- Excess is infinite at any tied cutoff, including tied zero, following
the p.15 proof. The sum is empty at k=d (PDF pp.14-15). -/
def spectralPrefixExcessLimit {d : ℕ} (alpha : Fin d → ℝ) (k : ℕ) : ℝ≥0∞ :=
∑ i, ∑ j, if i.val < k ∧ k ≤ j.val then
(if alpha i = alpha j then ⊤ else ENNReal.ofReal (alpha j / (alpha i - alpha j))) else 0
/-- Uniform row scale nu_k (PDF p.3). -/
def rowScale {d : ℕ} (alpha : Fin d → ℝ) (k : Fin d) : ℝ := min 1 (alpha k * d)
/-- Unnormalized row mean squared error (PDF pp.3,20). -/
def rowMSE {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (k : Fin d) : ℝ :=
swMean alpha n (fun s => (row s k.val - alpha k * n) ^ 2)
/-- Variance about the row's own mean (PDF p.19). -/
def rowVariance {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (k : Fin d) : ℝ :=
swMean alpha n (fun s => (row s k.val - swMean alpha n (fun t => row t k.val)) ^ 2)
/-- Word histogram (PDF pp.13-14). -/
def histogram {d : ℕ} (w : List (Fin d)) : Fin d → ℝ := fun i => (w.count i : ℕ)
/-- Relative SIGNED density phi, with alpha_j cancelled before evaluation at
zero last mass. Used only with n>0 and distinct probabilities (PDF pp.13-15). -/
def modifiedDensity {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (h : Fin d → ℝ) : ℝ :=
1 + ∑ i, ∑ j, if i < j then
(alpha j * h i / alpha i - h j) / ((alpha i - alpha j) * n) else 0
/-- Modified multinomial signed expectation, not a probability measure (PDF p.14). -/
def modifiedMean {d : ℕ} (alpha : Fin d → ℝ) (n : ℕ) (F : (Fin d → ℝ) → ℝ) : ℝ :=
wordMean alpha n (fun w => modifiedDensity alpha n (histogram w) * F (histogram w))
/-- Stable word restriction to the first k letters (PDF p.16). -/
def prefixWord {d : ℕ} (w : List (Fin d)) (k : ℕ) : List (Fin d) := w.filter (fun a => a.val < k)
/-- Stable word restriction to source letters >=k (PDF p.16). -/
def suffixWord {d : ℕ} (w : List (Fin d)) (k : ℕ) : List (Fin d) := w.filter (fun a => k - 1 ≤ a.val)
/-- Quantum Hellinger squared for PSD matrices, including subnormalized
reports, with no factor 1/2 (PDF pp.13,25). -/
def quantumH2 {d : ℕ} (rho sigma : Matrix (Fin d) (Fin d) ℂ) : ℝ :=
((cfc Real.sqrt rho - cfc Real.sqrt sigma) ^ 2).trace.re
/-- Quantum affinity, distinct from root fidelity (PDF p.13). -/
def affinity {d : ℕ} (rho sigma : Matrix (Fin d) (Fin d) ℂ) : ℝ :=
(cfc Real.sqrt rho * cfc Real.sqrt sigma).trace.re
/-- Rank-k Keyl report, WITHOUT renormalizing the truncated rows (PDF pp.22,25). -/
def truncatedReport {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (k : ℕ)
(s : Schur.Partition d n) (U : Matrix.unitaryGroup (Fin d) ℂ) : Matrix (Fin d) (Fin d) ℂ :=
(U : Matrix _ _ ℂ) * Matrix.diagonal (fun i =>
if i.val < k then (Schur.normalizedRows hd hn s i : ℂ) else 0) * star (U : Matrix _ _ ℂ)
/-- Extended Hellinger risk under the concrete Keyl joint Born law, not Haar
alone or a law chosen for accuracy (PDF pp.22-27). -/
def keylRisk {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (k : ℕ)
(rho : Matrix (Fin d) (Fin d) ℂ) (hRho : IsDensityMatrix rho) : ℝ≥0∞ :=
∫⁻ o, ENNReal.ofReal (quantumH2 (truncatedReport hd hn k o.1 o.2) rho)
∂Tomography.keylJointLaw hd hn rho hRho
/-- Success under the same public Keyl decoder (PDF pp.6-7). -/
def keylSuccess {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (k : ℕ)
(rho : Matrix (Fin d) (Fin d) ℂ) (hRho : IsDensityMatrix rho) (epsilon : ℝ) : ℝ≥0∞ :=
Tomography.keylJointLaw hd hn rho hRho
{o | quantumH2 (truncatedReport hd hn k o.1 o.2) rho ≤ epsilon}
/-- Integer copy budget, rounding a real bound upward (PDF pp.6-7). -/
def copyBudget (C rate : ℝ) : ℕ := ⌈C * rate⌉₊
/-- Any measurable Birkhoff decomposition of |V_(a,i)|^2, with pi(i)=a.
No accuracy property is assumed; the theorem is independent of the choice (PDF p.23). -/
structure InducedPermutation (d : ℕ) where
weight : Matrix.unitaryGroup (Fin d) ℂ → Equiv.Perm (Fin d) → ℝ
nonneg : ∀ U pi, 0 ≤ weight U pi
total : ∀ U, ∑ pi, weight U pi = 1
measurable : ∀ pi, Measurable (fun U => weight U pi)
marginal : ∀ U i a, (∑ pi, if pi i = a then weight U pi else 0) =
Complex.normSq ((U : Matrix _ _ ℂ) a i)
/-- Keyl real expectation. All uses below are bounded continuous statistics
or bounded measurable permutation mixtures, hence integrable (PDF p.23). -/
def keylMean {d n : ℕ} (hd : 0 < d) (hn : 0 < n)
(rho : Matrix (Fin d) (Fin d) ℂ) (hRho : IsDensityMatrix rho)
(F : Matrix.unitaryGroup (Fin d) ℂ → ℝ) : ℝ :=
∫ o, F o.2 ∂Tomography.keylJointLaw hd hn rho hRho
/-- Conditional permutation expectation in eigenbasis B; weights use
B dagger V, rather than a unitary in an unrelated basis (PDF pp.23,25). -/
def permutationMean {d n : ℕ} (hd : 0 < d) (hn : 0 < n)
(rho : Matrix (Fin d) (Fin d) ℂ) (hRho : IsDensityMatrix rho)
(B : Matrix.unitaryGroup (Fin d) ℂ) (P : InducedPermutation d)
(F : Equiv.Perm (Fin d) → ℝ) : ℝ :=
keylMean hd hn rho hRho (fun V => ∑ pi, P.weight (star B * V) pi * F pi)
/-- Physical EYD risk; weak-Schur projectors and decoder are fixed before
the unknown state. The law depends only on its spectrum (PDF pp.5-6). -/
def eydRisk {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (alpha : Fin d → ℝ)
(hAlpha : Learning.IsDistribution alpha) (hSorted : Antitone alpha)
(loss : (Fin d → ℝ) → (Fin d → ℝ) → ℝ≥0∞) : ℝ≥0∞ :=
∫⁻ s, loss (Schur.normalizedRows hd hn s) alpha
∂Schur.weakSamplingLaw hd hn alpha hAlpha hSorted
/-- Success event for the same physical EYD experiment (PDF pp.6-7). -/
def eydSuccess {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (alpha : Fin d → ℝ)
(hAlpha : Learning.IsDistribution alpha) (hSorted : Antitone alpha)
(loss : (Fin d → ℝ) → (Fin d → ℝ) → ℝ≥0∞) (epsilon : ℝ) : ℝ≥0∞ :=
Schur.weakSamplingLaw hd hn alpha hAlpha hSorted
{s | loss (Schur.normalizedRows hd hn s) alpha ≤ ENNReal.ofReal epsilon}
/-- Proper increasing graphs; no smoothness restriction (PDF p.30). -/
def ProperIncreasingCurve (f : ℝ → ℝ) : Prop :=
Continuous f ∧ StrictMono f ∧ Tendsto f atTop atTop ∧ Tendsto f atBot atBot
/-- Original-word graph points (PDF p.29). -/
def wordPoints {A : Type*} (w : List A) : List (ℝ × A) :=
w.zipIdx.map (fun a => ((a.2 : ℝ), a.1))
/-- Black skeleton points keep the input TIME of the bump as horizontal
coordinate, rather than being reindexed in the shorter word (PDF p.29).
This coordinate differs from the bumped occurrence's own original position. -/
def firstBumpPoints {A : Type*} [LinearOrder A] (w : List A) : List (ℝ × A) :=
((rskRun w).2.filter (fun e => e.1 = 0)).map (fun e => ((e.2.1 : ℝ), e.2.2.1))
/-- Disjoint increasing chains as sets of occurrence indices; empty chains
and the empty family are allowed (PDF pp.2,28). -/
def IsChains {A : Type*} [LinearOrder A] (w : List (ℝ × A)) {c : ℕ}
(I : Fin c → Finset (Fin w.length)) : Prop :=
(∀ j, ∀ u ∈ I j, ∀ v ∈ I j, u < v → (w.get u).2 ≤ (w.get v).2) ∧
∀ i j, i ≠ j → Disjoint (I i) (I j)
/-- Proper graphs pass through every selected occurrence and are pairwise
disjoint on the whole real line (PDF p.30). -/
def CurvesThrough {A : Type*} (e : A → ℝ) (w : List (ℝ × A)) {c : ℕ}
(I : Fin c → Finset (Fin w.length)) (f : Fin c → ℝ → ℝ) : Prop :=
(∀ j, ProperIncreasingCurve (f j)) ∧
(∀ j, ∀ u ∈ I j, f j (w.get u).1 = e (w.get u).2) ∧
∀ i j, i ≠ j → ∀ x, f i x ≠ f j x
/-- Full admissibility invariant (19): chains are admissible and every
inadmissible point is strictly southeast of the southeasternmost curve.
No output-existence certificate is built into this predicate (PDF pp.28-30). -/
def AdmissibleChains {A : Type*} [LinearOrder A] (e : A → ℝ)
(w : List (ℝ × A)) (admissible : Finset A) {c : ℕ}
(I : Fin c → Finset (Fin w.length)) : Prop :=
IsChains w I ∧ (∀ j, ∀ u ∈ I j, (w.get u).2 ∈ admissible) ∧
∃ f : Fin c → ℝ → ℝ, CurvesThrough e w I f ∧
∃ first : Fin c, (∀ j x, f first x ≤ f j x) ∧
∀ u : Fin w.length, (w.get u).2 ∉ admissible → e (w.get u).2 < f first (w.get u).1
/-! Sanity examples pin definitions, rather than proving the paper's results. -/
example : shape ([] : List ℕ) = [] := by rfl
example : shape ([1, 1] : List ℕ) = [2] := by rfl
example : bumpedWord ([2, 1] : List ℕ) 0 = [2] := by rfl
example : originalBumpedWord ([2, 1] : List ℕ) 0 = [2] := by rfl
example : firstBumpPoints ([2, 1] : List ℕ) = [(1, 2)] := by
norm_num [firstBumpPoints, rskRun, insertRows, insertRow]
example : bumpedWord ([2, 3, 1, 0, 2] : List ℕ) 0 = [2, 1, 3] := by rfl
example : originalBumpedWord ([2, 3, 1, 0, 2] : List ℕ) 0 = [2, 3, 1] := by rfl
example {d : ℕ} (alpha : Fin d → ℝ) (F : List ℕ → ℝ) :
swMean alpha 0 F = F [] := by
simp [swMean, wordMean, wordMass, shape, rskRun]
example {d : ℕ} (a : Fin d → ℝ) : l2 d a a = 0 := by simp [l2]
example {d : ℕ} (rho : Matrix (Fin d) (Fin d) ℂ) : quantumH2 rho rho = 0 := by
simp [quantumH2]
example : row [] 0 = 0 := by simp [row]
example : chiTerm 0 0 = 0 := by simp [chiTerm]
example : chiTerm 1 0 = ⊤ := by simp [chiTerm]
example {d : ℕ} (a : Fin d → ℝ) : h2 0 a a = 0 := by simp [h2]
example {d : ℕ} (a : Fin d → ℝ) : spectralPrefixExcessLimit a d = 0 := by simp [spectralPrefixExcessLimit]
example : ProperIncreasingCurve (fun x : ℝ => x) :=
⟨continuous_id, strictMono_id, tendsto_id, tendsto_id⟩
example {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (s : Schur.Partition d n)
(U : Matrix.unitaryGroup (Fin d) ℂ) :
truncatedReport hd hn d s U = Schur.estimate hd hn s U := by
simp [truncatedReport, Schur.estimate, Schur.normalizedDiagram]
example {d n : ℕ} (hd : 0 < d) (hn : 0 < n) (s : Schur.Partition d n)
(U : Matrix.unitaryGroup (Fin d) ℂ) : truncatedReport hd hn 0 s U = 0 := by
simp [truncatedReport]
/-- Adjacent multiplier in Lemmas 5.3-5.4; defined only for an actual pair
of consecutive indices (PDF p.24). -/
def adjacentProbabilityMultiplier {d : ℕ} (alpha : Fin d → ℝ) (j : Fin (d - 1)) : ℝ :=
(alpha ⟨j.val, by omega⟩ - alpha ⟨j.val + 1, by omega⟩) / alpha ⟨j.val, by omega⟩
/-- Floored list from the proof of Corollary 5.5; its first k entries stay
unchanged and the next entry is zeta under the cutoff assumptions (PDF p.25). -/
def flooredEntry {d : ℕ} (alpha : Fin d → ℝ) (zeta : ℝ) (j : ℕ) : ℝ :=
if h : j < d then max (alpha ⟨j, h⟩) zeta else zeta
end QAlgorithms.Papers.Independent.Extend50.P32
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Extend50.P32.AdmissibleChains
For any linearly ordered type , function , list , finite set , natural number , and finite index sets indexed by , this predicate means that the sets are pairwise disjoint, that whenever and , and that every selected label , , belongs to . It further requires functions , each continuous and strictly increasing with limits and at the respective ends of the real line, such that on and for every real whenever . There must also be an index with for every and real , and every list entry whose label is outside must satisfy . Entries with labels in need not be selected; the index sets may be empty. The required index makes this predicate impossible when , including for an empty list.
QAlgorithms.Papers.Independent.Extend50.P32.CurvesThrough
For any type , function , list , natural number , finite index sets , and functions indexed by , this predicate means that every is continuous and strictly increasing, tends to at and to at , satisfies for every , and satisfies for every real whenever . No ordering or injectivity assumption is imposed on , and no disjointness condition is directly imposed on the sets . Empty sets impose no interpolation requirements, and for the entire predicate is vacuous.
QAlgorithms.Papers.Independent.Extend50.P32.FullMetric
This declares a type with exactly three distinct values, named hellinger, kullbackLeibler, and chiSquared, and supplies decidable equality between its values. The declaration itself assigns no numerical formula to these values.
QAlgorithms.Papers.Independent.Extend50.P32.InducedPermutation
For any natural number , this structure consists of real weights , indexed by complex unitary matrices and permutations of , together with the requirements that , for every , and is measurable for every fixed . For every and indices , it additionally requires
No uniqueness of these weights is required. The case is included: the unique empty permutation has weight one, and the marginal requirements have no indices to check.
QAlgorithms.Papers.Independent.Extend50.P32.IsChains
For any linearly ordered type , any list in , any natural number , and finite sets indexed by , this predicate means that whenever and , and that whenever . The ordering condition uses list positions, with no condition on the real coordinates . The sets may be empty, need not cover the list, and all conditions are vacuous when .
QAlgorithms.Papers.Independent.Extend50.P32.ProperIncreasingCurve
For any function , this predicate means that is continuous, strictly increasing— implies —and satisfies as and as .
QAlgorithms.Papers.Independent.Extend50.P32.WeakDominates
For arbitrary finite lists of natural numbers, this predicate means that, for every , the sum of the first entries of is at most the sum of the first entries of , taking the entire list whenever exceeds its length. The condition at is , and indices beyond both lengths require . No sorting, equal-length, or equal-total assumption is imposed, and either list may be empty.
QAlgorithms.Papers.Independent.Extend50.P32.WeightedMetric
This defines a type with exactly two distinct choices, named hellinger and chiSquared, and supplies a decision procedure for equality between its elements.
QAlgorithms.Papers.Independent.Extend50.P32.adjacentProbabilityMultiplier
For every natural number , every real-valued sequence indexed by , and every , this defines the real number
No positivity, ordering, or normalization of is required. Division by zero has value , so the defined number is when . The index set has size ; consequently there are no admissible when or .
QAlgorithms.Papers.Independent.Extend50.P32.affinity
For every natural number and arbitrary complex matrices , this defines
Here the real continuous functional calculus replaces each eigenvalue of a Hermitian matrix by , with for , and takes value zero on non-Hermitian matrices. No positivity or trace normalization is assumed. The product has the displayed order, and gives zero.
QAlgorithms.Papers.Independent.Extend50.P32.bumpedTokens
For any linearly ordered type , finite word over , and row index , this function returns the tagged tokens displaced from row in the following procedure, preserving their event order. Tag the letters of by their original positions starting at , and process them from left to right into initially empty rows. Insert each token into row , replacing the first token with strictly greater letter and passing that displaced token to the next row; append and stop if no such token exists, creating a singleton row if needed. Record every displacement with its row index, insertion position, and displaced token. Retain precisely the events whose row index is and return their displaced tokens, including their original-position labels. If no displacement occurs from that row, including when is empty, the result is empty.
QAlgorithms.Papers.Independent.Extend50.P32.bumpedWord
For any linearly ordered type , finite word over , and row index , this function returns the letters displaced from row , in displacement order, with their original-position labels removed. The procedure tags each input letter by its position starting at and inserts the tokens in word order into initially empty rows: in each row, replace the first token with strictly greater letter and pass it to the next row, or append and stop if there is no such token, creating a singleton row when necessary. Only displacements from row contribute to the output; repeated letters are retained with their multiplicities. If there are no such displacements, the output is empty.
QAlgorithms.Papers.Independent.Extend50.P32.chi2
For every natural number , natural number , and arbitrary functions , this defines the sum in over coordinates of the following quantity: if , if , and if . No positivity or normalization is assumed; a negative contributes . The sum is if or , and includes every coordinate if .
QAlgorithms.Papers.Independent.Extend50.P32.chiTerm
For arbitrary real numbers , this defines an extended nonnegative real number by
In particular, negative is permitted and gives value .
QAlgorithms.Papers.Independent.Extend50.P32.copyBudget
For arbitrary real numbers and , this defines the natural-number ceiling : the least natural number at least . In particular, it is zero whenever . Neither argument is assumed nonnegative.
QAlgorithms.Papers.Independent.Extend50.P32.eydRisk
For positive natural numbers , let be a nonincreasing real vector with and , and let be any function. This definition returns , where ranges over Young diagrams with cells and at most rows, and , with the length of row , including zero lengths for absent rows. The measure is counting measure weighted at by , where , , and
Here is the range of the matrix with entries ; are the permutations preserving, respectively, the row and column of every cell under the fixed cell numbering used by the definition. Finally, , where and is orthogonal projection onto . The integral is the nonnegative extended integral and may equal ; no measurability, finiteness, or other condition is imposed on .
QAlgorithms.Papers.Independent.Extend50.P32.eydSuccess
For positive natural numbers , a nonincreasing real vector satisfying and , any function , and any real , this definition returns
Here ranges over Young diagrams with cells and at most rows, with absent rows assigned length zero, and is counting measure weighted at by , where and the tensor matrix has entries . Explicitly, , with . To define , fix the cell numbering used in the code, let be the permutations preserving each cell’s row and column respectively, and take the range in of the matrix with entries . Then , where and projects orthogonally onto . In particular, a negative still selects outcomes with loss zero; it does not automatically give an empty event.
QAlgorithms.Papers.Independent.Extend50.P32.firstBumpPoints
For any linearly ordered type and finite word , process the tagged letters in increasing order of , starting with no rows. To insert a tagged letter into a row, replace the first entry whose letter is strictly greater than the incoming letter, passing the displaced tagged entry to the next row; if no such entry exists, append the incoming entry and stop, and if no row exists, create a singleton row. Each displacement from row records , where is the current input position and is the displaced tagged entry; records are accumulated in insertion order, with the current displacement preceding any displacement it causes in later rows. This definition retains exactly the records with and returns, in their recorded order, the pairs , with regarded as real. Thus the first coordinate is the input position that caused the displacement, while the second is the displaced letter; the displaced token’s original position is discarded. The result is empty when no displacement from row zero occurs.
QAlgorithms.Papers.Independent.Extend50.P32.flooredEntry
For every natural number , every real-valued sequence indexed by , every real , and every natural number , this defines
There are no positivity, ordering, or normalization assumptions on or . Out-of-range indices return ; in particular, when , every index returns .
QAlgorithms.Papers.Independent.Extend50.P32.fullLoss
For every natural number , choice of metric among Hellinger, Kullback–Leibler, and chi-squared, and arbitrary real vectors indexed by , this defines a value in . Write , regarded as an extended nonnegative real. The Hellinger choice gives . The Kullback–Leibler choice gives if some has and ; otherwise it gives . The chi-squared choice gives , where when , when , and when . No nonnegativity or normalization assumptions are imposed on either vector: real square roots of negative numbers are , and the real logarithm uses and for . When , every choice gives .
QAlgorithms.Papers.Independent.Extend50.P32.h2
For every natural number , natural number , and arbitrary functions , this defines
No positivity or normalization is assumed; the real square-root function used here is on negative arguments. The sum is if or , and includes every coordinate if .
QAlgorithms.Papers.Independent.Extend50.P32.histogram
For every natural number and finite list of elements of , this defines the real vector whose coordinate is the number of occurrences of in , converted from a natural number to a real number. These are counts without normalization by the list length. The empty list gives the zero vector; when , the list must be empty and the resulting vector has no coordinates.
QAlgorithms.Papers.Independent.Extend50.P32.iidWordEventProbability
For every natural number , arbitrary , natural number , and predicate on finite lists of elements of , this defines the real number
There are no nonnegativity or normalization assumptions on , and no additional assumption on . For , this is if holds and otherwise; for , it is .
QAlgorithms.Papers.Independent.Extend50.P32.insertRow
For any linearly ordered type , token , and finite list of tokens, this function scans the list from left to right, comparing only the components. It replaces the first token whose component is strictly greater than by , leaves all other tokens in their original order, and returns the resulting list together with as the displaced token. If no such token exists, it appends and returns no displaced token; in particular, the empty list becomes . Equal components do not cause displacement. The natural-number labels are carried along without comparison, and the input list need not be sorted.
QAlgorithms.Papers.Independent.Extend50.P32.insertRows
For any linearly ordered type , natural numbers , token , and finite list of token lists, this function inserts into the first list by replacing its first token with strictly greater component, or appending if no such token exists. If insertion appends, it returns that updated first list followed by the unchanged remaining lists, together with an empty event list. If a token is displaced, it recursively inserts into the remaining lists with row counter and unchanged , and prepends the event to the recursively produced events. If there are no lists, it creates the single list and records no event. Thus events describe displacements in successive lists, including the full displaced token; neither sorting nor any relationship between and the token labels is required.
QAlgorithms.Papers.Independent.Extend50.P32.keylMean
For natural numbers , a complex positive semidefinite matrix of trace one, and any real-valued function on the unitary matrices, this defines the real integral
The measure is on pairs consisting of a Young diagram with cells and at most rows and a unitary matrix . Relative to diagram counting measure times normalized unitary Haar measure, its density is
where is row 's length and denotes the first indices. The number counts fillings by weakly increasing along rows and strictly increasing down columns; is the rank of the matrix indexed by cell permutations with entry , where preserves rows and preserves columns under the fixed numbering used in the definition. No measurability or integrability hypothesis on is supplied; this is the total real-valued integral, which is zero when its integrand is not integrable.
QAlgorithms.Papers.Independent.Extend50.P32.keylRisk
For natural numbers , any natural number , and a complex matrix assumed positive semidefinite with trace one, this defines the extended nonnegative integral
The outcomes are Young diagrams with cells and at most rows, together with unitary matrices . Relative to counting measure on these diagrams times normalized Haar measure on the unitary group, has density
Here denotes the first indices, counts fillings of the cells by that are weakly increasing along rows and strictly increasing down columns, and is the rank of the matrix indexed by permutations of the cells whose entry is , where preserves rows and preserves columns under the fixed cell numbering used by the definition. Matrix square roots use the real continuous functional calculus. The result may be ; and are included.
QAlgorithms.Papers.Independent.Extend50.P32.keylSuccess
For natural numbers , any natural number , a complex positive semidefinite matrix of trace one, and any real , this defines
Here ranges over Young diagrams with cells and at most rows, is row 's length, and ranges over unitary matrices. The measure , relative to diagram counting measure times normalized unitary Haar measure, has density
The submatrix uses the first indices; counts cell fillings by weakly increasing along rows and strictly increasing down columns; and is the rank of the permutation-indexed matrix with entry at , with row preserving and column preserving under the definition's fixed cell numbering. Square roots use the real continuous functional calculus. The result lies in , the event uses a non-strict inequality, and no restriction is imposed on or on .
QAlgorithms.Papers.Independent.Extend50.P32.kl
For every natural number and arbitrary functions , this defines if some coordinate satisfies and ; otherwise it defines
as an extended nonnegative real number. No positivity or normalization is assumed. The logarithm is the total real natural logarithm, which equals for nonzero negative and is at zero; clipping at zero applies to the entire sum. For , the value is .
QAlgorithms.Papers.Independent.Extend50.P32.l2
For every natural number , natural number , and arbitrary functions , this defines . No positivity or normalization is assumed. The sum is if or , and includes every coordinate if .
QAlgorithms.Papers.Independent.Extend50.P32.modifiedDensity
For every natural number , arbitrary real vectors indexed by , and natural number , this defines the real number
There are no positivity, normalization, ordering, distinctness, or nonzero-coordinate assumptions on , and no restrictions on . All divisions use the total real-field convention that division by zero equals : thus a pair with contributes , and makes the inner quotient equal to . The value is when or , and no nonnegativity of the result is asserted.
QAlgorithms.Papers.Independent.Extend50.P32.modifiedMean
For any natural numbers , any function , and any function , this defines
where is the number of positions of containing . No positivity, normalization, or distinctness assumptions are imposed on . Every division is total, with division by zero equal to zero; in particular, a summand whose displayed denominator vanishes contributes zero. When , the value is , using the unique empty word and empty product ; when , the sum is empty and equals zero.
QAlgorithms.Papers.Independent.Extend50.P32.normalizedExcess
For every natural number , arbitrary real vector indexed by , and natural numbers , this defines
The list consists of row lengths produced from the letters of in order: insertion into a row replaces its first strictly larger letter and passes that displaced letter to the next row; if no strictly larger letter exists, insertion appends the letter and stops, creating a row when needed. Only existing rows among the first are summed. The vector need not be nonnegative, normalized, or sorted. Division is total, with division by zero equal to , so the defined value at is ; it is also when or .
QAlgorithms.Papers.Independent.Extend50.P32.normalizedShapeRows
For every natural number , natural number , and arbitrary finite list of natural numbers, this defines a function on whose value at is , with interpreted as when the list has no entry at index , and with numerator and denominator interpreted as real numbers. No condition requires to be a partition or to sum to . When , every value is under the total real-division convention; when , the resulting function has empty domain.
QAlgorithms.Papers.Independent.Extend50.P32.originalBumpedWord
For any linearly ordered type , finite word over , and row index , this function selects the original positions of tokens displaced from row and returns the letters at those positions in their original order in . To determine these positions, tag letters by their positions starting at and insert them in word order into initially empty rows: replace the first token with strictly greater letter in each row and pass the displaced token to the next row, or append and stop if no such token exists, creating a singleton row if needed. Collect the original-position labels of tokens displaced from row , then filter the original tagged word by membership in that collection and remove the labels. Each original position is retained at most once, regardless of its multiplicity in the collected labels; the empty word or an empty collection gives an empty output.
QAlgorithms.Papers.Independent.Extend50.P32.permutationMean
For natural numbers , a complex positive semidefinite matrix of trace one, a unitary matrix , an induced-permutation structure , and any real-valued function on permutations of , this defines
The supplied structure assigns nonnegative weights summing to one for each unitary argument, each weight is measurable in that argument, and for every . The measure is on diagrams with cells and at most rows and unitary matrices ; relative to diagram counting measure times normalized unitary Haar measure, its density is
Here is row 's length, denotes the first indices, counts fillings by weakly increasing along rows and strictly increasing down columns, and is the rank of the cell-permutation matrix with entry at , using row-preserving , column-preserving , and the definition's fixed cell numbering.
QAlgorithms.Papers.Independent.Extend50.P32.prefixExcess
For every natural number , arbitrary real vector indexed by , and natural numbers , this defines
Here is the list of row lengths obtained by processing in order, starting with no rows: insert a letter into the first row by replacing its first strictly larger letter and inserting the displaced letter into the next row by the same rule; if there is no strictly larger letter, append the inserted letter and stop, creating a row if necessary. The sum over means the sum of the first existing row lengths, so missing rows contribute . No nonnegativity, normalization, or ordering assumption is imposed on ; the displayed sum is therefore a weighted sum without any assertion that its weights form a probability law. The value is if , , or .
QAlgorithms.Papers.Independent.Extend50.P32.prefixMass
For every natural number , arbitrary , and natural number , this defines . No nonnegativity or normalization is assumed. The value is when or , and is the sum of all entries when .
QAlgorithms.Papers.Independent.Extend50.P32.prefixWord
For every natural number , every finite list with entries in , and every natural number , this defines the list obtained by retaining exactly those entries of whose numerical values are strictly less than , preserving their order and repetitions. For the result is empty, and for it is ; is allowed, in which case is necessarily empty.
QAlgorithms.Papers.Independent.Extend50.P32.quantumH2
For every natural number and arbitrary complex matrices , this defines the real number
where uses the real continuous functional calculus. For Hermitian , it replaces each eigenvalue by the real square root , which is zero for ; for a non-Hermitian matrix the functional calculus takes its totalized value zero. There are no assumptions that the matrices are positive semidefinite or have trace one. The square is matrix multiplication, and the value is zero when .
QAlgorithms.Papers.Independent.Extend50.P32.row
For any finite list of natural numbers and any natural-number index , this function returns the entry at position , counting from , as a real number. If is at least the length of , it returns ; consequently, every index gives for the empty list.
QAlgorithms.Papers.Independent.Extend50.P32.rowMSE
For every natural number , arbitrary real vector indexed by , natural number , and index with , this defines
Here is the length of row , counting from , and is if that row is absent. The rows are built by processing the letters of in order: insertion replaces the first strictly larger letter in the current row and passes the displaced letter to the next row; if none exists, it appends the letter and stops, creating a row if necessary. No nonnegativity, normalization, or sorting assumption is imposed on , so the weighted sum is not asserted to be nonnegative or to be an expectation under a probability law. For it equals ; for no index exists.
QAlgorithms.Papers.Independent.Extend50.P32.rowPrefix
For any finite list of natural numbers and any , this function returns, as a real number, the sum of the first entries of . It returns when or is empty, and the sum of the entire list when exceeds its length.
QAlgorithms.Papers.Independent.Extend50.P32.rowScale
For every natural number , arbitrary real vector indexed by , and index with , this defines . No positivity or normalization assumption is imposed on , so the value may be negative. The index argument cannot exist when .
QAlgorithms.Papers.Independent.Extend50.P32.rowVariance
For every natural number , arbitrary real vector indexed by , natural number , and index with , let
This defines . Here is the length of row , counting from , with absent rows assigned length . To build the rows, process in order: replace the first strictly larger letter in a row and insert the displaced letter into the next row, or append and stop if no strictly larger letter exists, creating rows as needed. Neither the center nor the outer sum is divided by the total weight. No nonnegativity, normalization, or sorting assumption is imposed on , so the value is not asserted to be a probability variance or to be nonnegative. It is at , and no index exists at .
QAlgorithms.Papers.Independent.Extend50.P32.rskRun
For any linearly ordered type and finite word over , this function processes its letters from left to right, tagging each letter with its original position, starting at . It starts with no rows and no events. At position , it inserts the tagged letter into row : within each row, it replaces the first token whose letter is strictly greater than the incoming letter, passing the displaced token to the next row, or appends the incoming token and stops if no such token exists. Reaching beyond the existing rows creates a new singleton row. Each displacement from row records , where is the displaced tagged token. Events are retained in processing order, with successive displacements from one insertion recorded in increasing row order. The result is the final list of token rows and the complete event list; the empty word produces two empty lists.
QAlgorithms.Papers.Independent.Extend50.P32.shape
For any linearly ordered type and finite word over , this function returns the list of row lengths obtained by the following procedure. Tag each letter by its original position, starting at , and insert the tagged letters in word order into initially empty rows. In each row, replace the first token whose letter is strictly greater than the incoming letter and insert the displaced token into the next row; if no such token exists, append the incoming token and stop, creating a singleton row if necessary. The output lists the lengths of the final rows in their existing order, discarding token contents and displacement events. The empty word gives the empty list.
QAlgorithms.Papers.Independent.Extend50.P32.shapeDominates
For arbitrary finite lists of natural numbers, this predicate means both that their total sums are equal and that, for every , the sum of the first entries of is at most the sum of the first entries of . A prefix extending beyond a list contains the whole list. Empty lists and are included; no sorting or equality of list lengths is required.
QAlgorithms.Papers.Independent.Extend50.P32.spectralPrefixExcessLimit
For every natural number , arbitrary real vector indexed by , and natural number , this defines the extended nonnegative sum
where finite terms are embedded into . There are no positivity, normalization, or sorting assumptions on . In particular, an included pair with both entries zero contributes , while a negative quotient contributes . The sum is when , , or .
QAlgorithms.Papers.Independent.Extend50.P32.suffixWord
For every natural number , every finite list with entries in , and every natural number , this defines the list obtained by retaining exactly those entries whose numerical values are at least , preserving their order and repetitions. The subtraction is natural-number subtraction, so both and retain all entries; if , the result is empty. The case , where is empty, is included.
QAlgorithms.Papers.Independent.Extend50.P32.swMean
For every natural number , arbitrary function , natural number , and function from finite lists of natural numbers to , this defines
Here is the list of row lengths obtained by processing in order, starting with no rows: insert a letter into the first row by replacing its first strictly greater letter and inserting the displaced letter into the next row recursively; if there is no strictly greater letter, append the inserted letter to that row, creating a row if necessary. Letters carry their original position labels, which do not affect comparisons. No nonnegativity or normalization is required of . For , the value is ; for , it is .
QAlgorithms.Papers.Independent.Extend50.P32.swMeanExt
For every natural number , arbitrary , natural number , and function from finite lists of natural numbers to , this defines
in the extended nonnegative reals. To obtain , process the letters in order, initially with no rows: replace the first strictly greater letter in a row and insert that displaced letter into the next row recursively, or append if no strictly greater letter exists; record the resulting row lengths. Letters carry their original position labels, but comparisons use only the letters. The entire product of weights is clipped at zero; individual weights need not be nonnegative or sum to one. Extended multiplication uses . For , the value is ; for , it is .
QAlgorithms.Papers.Independent.Extend50.P32.tail
For every natural number , arbitrary , and natural number , this defines . No nonnegativity or normalization is assumed. For it sums all entries, and for , including , it is .
QAlgorithms.Papers.Independent.Extend50.P32.truncatedReport
For natural numbers with supplied hypotheses and , any natural number , any Young diagram having exactly cells and at most rows, and any complex unitary matrix , this defines
where is the length of row , with rows indexed from zero. The parameter need not be positive or bounded by : gives the zero matrix, and retains every indexed row.
QAlgorithms.Papers.Independent.Extend50.P32.truncatedTV
For every natural number , natural number , and arbitrary real vectors indexed by , this defines the real number . No probability-distribution assumptions are imposed. The value is when or , and all coordinates are included when .
QAlgorithms.Papers.Independent.Extend50.P32.weightedLoss
For every natural number , choice of metric among hellinger and chiSquared, natural number , and arbitrary real vectors indexed by , this defines an extended nonnegative loss using only indices . The Hellinger choice gives . The chi-squared choice gives , where for , for , and for , with finite values embedded into . Neither vector is required to be nonnegative or normalized, and square roots of negative reals are . If or , the loss is ; if , all coordinates are included.
QAlgorithms.Papers.Independent.Extend50.P32.wordMean
For any natural numbers , arbitrary real weights , and real-valued function on finite lists with entries in , this function is the finite weighted sum
No nonnegativity or normalization assumption is imposed on . When , the unique empty word has empty-product weight , so the value is , including when ; when and , there are no words and the value is .
QAlgorithms.Papers.Independent.Extend50.P32.wordPoints
For any type and finite list of elements of , this definition returns the list , with the indices regarded as real numbers and the original list order preserved. For an empty input list, the result is empty.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.