diff --git a/README.md b/README.md index 735f31d..f8778b2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ **Can quantum variance reduction return a genuine probability distribution in every run while remaining exactly unbiased?** This project gives a constructive answer for every finite output alphabet, including zero and arbitrarily rare probabilities. -Given a reversible source circuit and its inverse, the algorithm returns a classical random vector $`Z`$ satisfying, for $`d\ge2`$ outcomes and scale $`T\ge1`$, +With three outcomes, the [hard-cap estimator](science/hard-cap-estimator.md) returns a simplex vector with exact mean and at most $`48T`$ original source or inverse calls. Its covariance is at most $`100(\mathrm{diag}(p)-pp^{\mathsf T})/T^2`$, up to positive-semidefinite order. For $`p=(1-s,sq,s(1-q))`$, the mean-square error is $`O(s/T^2)`$ uniformly in $`q`$. A matching black-box lower bound gives the optimal dependence on the rare mass and the query budget. + +Given a reversible source circuit and its inverse, the conditional-tree algorithm returns a classical random vector $`Z`$ satisfying, for $`d\ge2`$ outcomes and scale $`T\ge1`$, ```math Z\in\Delta_d,\qquad @@ -16,7 +18,9 @@ Here $`\Delta_d`$ is the set of nonnegative $`d`$-coordinate vectors summing to At a fixed alphabet size, root mean squared error $`\varepsilon`$ needs $`O_d(\varepsilon^{-1})`$ expected source calls; ordinary categorical sampling needs $`\Theta(\varepsilon^{-2})`$ samples for the same worst-case objective. Quantum multivariate precision and exact unbiased vector estimation are already established. The addition is keeping **positivity, normalization and exact unbiasedness together**. The displayed dependence on $`d`$ is not optimal distribution-estimation complexity. -## How the construction works +## How the constructions work + +The hard-cap construction estimates the three unconditioned marginals with independent bounded sine clocks from [Bounded-Unbiased-Amplitude-Estimation](https://github.com/GoGoKo699/Bounded-Unbiased-Amplitude-Estimation/blob/main/science/simplex-application.md). Each round assigns one third of each clock readout to its label and carries the remaining mass forward. A fixed schedule of shorter clocks reduces the variance of one final categorical draw. A binary tree splits the total probability mass into label masses. Each node receives a random estimated global weight $`W`$ and chooses its scalar clock in proportion to $`TW`$. A conditional reflection of true subset mass $`s`$ costs $`O(1/s)`$ expected source calls, but exact unbiasedness gives $`\mathbb EW=s`$. The random budget cancels that inverse-mass cost. A minimum positive sine-clock readout separately pays for preparing the conditional specimen. The [proof](science/simplex-estimator.md) includes both parts. @@ -28,6 +32,7 @@ Start with the [scientific route](science/README.md) or the [model and exact the | To inspect | Read | | --- | --- | +| Hard query cap, rare-outcome covariance and matching lower bound | [Hard-cap estimator](science/hard-cap-estimator.md) | | Algorithm, boundary cases, minimum weights and martingale proof | [Simplex estimator](science/simplex-estimator.md) | | Exact conditional circuit, coherent controls and reference preservation | [Conditional reflection](science/conditional-reflection.md) | | Finite execution cap, gate synthesis, rounding, gates and workspace | [Precision and resources](science/precision-and-resources.md) | @@ -39,15 +44,16 @@ The convex-range consequence preserves known affine constraints and positivity i ## Learn the construction -The [learning route](learning/README.md) starts from Andrew M. Childs's *Lecture Notes on Quantum Algorithms*, 17 April 2025. The [source-to-project bridge](learning/anchor-bridge.md) identifies the relevant foundations and supplies the missing links to this construction. The [30-milestone map](learning/milestones.md) follows the argument from reversible sources to the full estimator and its limits. +The [learning route](learning/README.md) connects the hard-cap construction to Lin Lin's *Lecture Notes on Quantum Algorithms for Scientific Computation* and the conditional tree to Andrew M. Childs's *Lecture Notes on Quantum Algorithms*. The [30-milestone map](learning/milestones.md) links the underlying quantum operations to both guarantees. ## Reproduce the finite checks ```bash python3 verification/run_all.py +python3 verification/check_hard_cap.py ``` -The [verification guide](verification/README.md) lists dependencies and the finite scope. It checks scalar moments with complex source garbage, complete finite tree laws, the actual controlled LCU and retry Kraus maps, and fresh-versus-reused stochastic tables. Floating-point checks support their tested cases; analytical proofs establish the uniform theorems. +The [verification guide](verification/README.md) lists dependencies and the finite scope. It checks scalar moments with complex source garbage, complete finite tree laws, the actual controlled LCU and retry Kraus maps, fresh-versus-reused stochastic tables, and the hard-cap moments and query count. Floating-point checks support their tested cases; analytical proofs establish the uniform theorems. ## Scope diff --git a/learning/README.md b/learning/README.md index a8b6ecf..b2a38f1 100644 --- a/learning/README.md +++ b/learning/README.md @@ -2,7 +2,7 @@ The scientific question is how to estimate several outcome probabilities with quantum precision while returning a valid probability vector in every run. The construction joins a scalar sine-clock estimator, paid reflections about conditional states, and a probability tree whose random node weights determine its work. -The single educational anchor is **Andrew M. Childs, *Lecture Notes on Quantum Algorithms*, 17 April 2025**, available from the [official notes page](https://www.cs.umd.edu/~amchilds/qa/). The [anchor bridge](anchor-bridge.md) gives selective section readings, a notation dictionary, the steps supplied by this project, and a complete three-outcome example. The notes provide foundations rather than the simplex theorem. +The hard-cap route uses **Lin Lin, *Lecture Notes on Quantum Algorithms for Scientific Computation*, March 3, 2022**, the common source for the link to the bounded scalar clock. Start at the [fixed-budget bridge](anchor-bridge.md#5-a-fixed-budget-route). The conditional-tree route uses **Andrew M. Childs, *Lecture Notes on Quantum Algorithms*, 17 April 2025**, with [selective readings and a worked example](anchor-bridge.md). The [30-milestone map](milestones.md) has twelve background milestones and eighteen narrative milestones. The first phase connects source circuits, reflections, phase information and charged queries. The second builds the conditional operation and random-mass tree into the theorem, then connects it to convex constraints, stochastic evolution and implementation limits. These are common understanding targets for the project; they do not record an individual reader's assessment or progress. @@ -15,4 +15,4 @@ The [30-milestone map](milestones.md) has twelve background milestones and eight | The proofs without the learning route | [Science index](../science/README.md) | | What the finite checks establish | [Verification guide](../verification/README.md) | -Every route preserves the same qualifications: fixed-alphabet Heisenberg scaling concerns expected source/inverse work with unbounded stopping tails; exactness uses ideal operations; finite caps and synthesis introduce a separately controlled approximation. Positivity and normalization do not make nonlinear reuse of an estimate unbiased. +The three-outcome route gives exact ideal estimation under a hard cap. The conditional-tree route gives the general finite-alphabet result in expected work and handles synthesis and truncation separately. See [fresh and reused stochastic tables](../science/convex-composition.md#5-why-one-random-table-cannot-be-reused-without-analysis) for the role of independence in downstream uses. diff --git a/learning/anchor-bridge.md b/learning/anchor-bridge.md index 4a56422..3184a76 100644 --- a/learning/anchor-bridge.md +++ b/learning/anchor-bridge.md @@ -2,7 +2,7 @@ A source can produce three labels, but its probabilities are unknown. Measuring it repeatedly gives a frequency vector: every entry is nonnegative, the entries sum to one, and their means are correct. The aim here is to keep those properties while reducing the mean-square error quadratically with expected coherent source work. A small coordinate error alone does not ensure this: clipping or renormalizing estimates can change their means. -The single anchor is **Andrew M. Childs, *Lecture Notes on Quantum Algorithms*, 17 April 2025**. Use the [official notes page](https://www.cs.umd.edu/~amchilds/qa/) and its [dated document](https://www.cs.umd.edu/~amchilds/qa/qa.pdf). Page references below are the printed page numbers. The [milestones](milestones.md) organize this project's story; the notes are selective support, not a book-length prerequisite. +The educational anchor for the conditional-tree route is **Andrew M. Childs, *Lecture Notes on Quantum Algorithms*, 17 April 2025**. Use the [official notes page](https://www.cs.umd.edu/~amchilds/qa/) and its [dated document](https://www.cs.umd.edu/~amchilds/qa/qa.pdf). Page references below are the printed page numbers. The [milestones](milestones.md) organize this project's story; the notes are selective support, not a book-length prerequisite. ## 1. Selective readings @@ -118,3 +118,9 @@ The minimum positive weight is a second link. Every visited node has $`W_S\ge T^ The [convex-composition page](../science/convex-composition.md) translates the returned weights into known finite convex combinations and fresh stochastic transition tables. It also gives an explicit counterexample to reusing one table under powers. The [precision page](../science/precision-and-resources.md) explains why a finite execution cap and finite gate synthesis preserve a controlled approximation rather than the full exact ideal claim. These boundaries belong to the theorem's meaning, not to optional implementation details. Use the [milestones](milestones.md) for the full local-to-global route, or the [science index](../science/README.md) for direct access to the canonical statements and proofs. Research citations in [related work](../references/related-work.md) establish attribution; they are not additional educational anchors. + +## 5. A fixed-budget route + +For the three-outcome hard-cap result, use Lin Lin's [*Lecture Notes on Quantum Algorithms for Scientific Computation*](https://math.berkeley.edu/~linlin/qasc/qasc_notes.pdf), March 3, 2022. Sections 3.3–3.5 (printed pages 45–52) connect controlled powers to clock measurements. Section 4.2 (pages 57–58) turns the eigenphases of a Grover rotation into probabilities. Apply those operations to each singleton label using the same reversible source. The inherited [sine-clock proof](../science/scalar-clock.md) supplies the bounded readout, exact mean and variance used in the resulting construction. + +For [one worked round](https://github.com/GoGoKo699/Bounded-Unbiased-Amplitude-Estimation/blob/main/science/simplex-application.md), use scalar readouts $`X=(1,1/2,0)`$. The three labels receive masses $`(1/3,1/6,0)`$. If the suffix returns label three, it receives the remaining half, giving $`(1/3,1/6,1/2)`$. In the [hard-cap proof](../science/hard-cap-estimator.md), independence of the suffix gives the exact mean, and four rounds at each of the decreasing clock sizes control the squared residual. The [covariance lower bound](../science/hard-cap-estimator.md#black-box-lower-bound) uses a small rotation of the source and the paid query model to check that precision in every direction. diff --git a/learning/milestones.md b/learning/milestones.md index 9a0c7aa..46245fa 100644 --- a/learning/milestones.md +++ b/learning/milestones.md @@ -1,6 +1,6 @@ # Thirty milestones: from one source to a valid random probability vector -This is the common understanding map for Quantum Simplex Estimation. Its single educational anchor is Andrew M. Childs, *Lecture Notes on Quantum Algorithms*, **17 April 2025**, available from the [author's course page](https://www.cs.umd.edu/~amchilds/qa/). The source pointers below identify exact sections in that version. The anchor supplies quantum-circuit, amplification, phase-estimation and block-encoding foundations; the statistical argument, inherited sine measurement and present conditional tree are supplied by this repository and its credited research sources. +This is the common understanding map for Quantum Simplex Estimation. The conditional-tree anchor is Andrew M. Childs, *Lecture Notes on Quantum Algorithms*, **17 April 2025**, available from the [author's course page](https://www.cs.umd.edu/~amchilds/qa/). The source pointers below identify exact sections in that version. The anchor supplies quantum-circuit, amplification, phase-estimation and block-encoding foundations; the statistical argument, inherited sine measurement and present conditional tree are supplied by this repository and its credited research sources. The map has **12 background/preliminaries milestones, M01–M12, and 18 narrative/innovation milestones, M13–M30**. The first phase joins a labelled quantum experiment, a valid probability estimate and the operations that can be paid for. The second builds the conditional reflection and random-mass tree, proves their global statistical and resource guarantees, then explains composition and implementation limits. This allocation follows the two ingredients that must meet: a quantum operation must remain coherent inside a split, and its random classical output must remain a valid probability vector outside it. @@ -305,7 +305,7 @@ Each milestone has a conceptual target and earlier dependencies. The map covers **Phase:** narrative/innovation. - **Central question:** What can now be produced, after the inherited tools and all material qualifications are stated? -- **Understanding target:** Give one connected account from the original paid source to an unbiased feasible probability vector, its expected-work precision law, and its convex/stochastic uses. Credit existing scalar, multivariate and debiasing results, and retain the limits on dimension, stopping tails, finite precision, coherent multirow use and unrestricted classical advantage. +- **Understanding target:** Give one connected account from the original paid source to an unbiased feasible probability vector, the conditional-tree and hard-cap precision laws, and its convex/stochastic uses. Credit existing scalar, multivariate and debiasing results, and retain the limits on dimension, stopping tails, finite precision, coherent multirow use and unrestricted classical advantage. - **Dependencies and story role:** M12 and M23–M29. This integrates both phases into the complete scientific account rather than adding another extension. - **Conceptual connection:** The surviving addition is the simultaneous per-realization convex constraint and exact ideal mean, supported by an executable conditional construction and global cost proof. -- **Source pointers:** Childs §§19.3, 21.1–21.2, 28.3 and 29.1 for the assembled toolbox; [model theorem](../science/model.md#5-the-finite-alphabet-result), [operational contribution and attribution](../references/related-work.md#5-operational-scope), [convex/stochastic scope](../science/convex-composition.md#6-what-this-capability-adds) and [precision account](../science/precision-and-resources.md). +- **Source pointers:** Childs §§19.3, 21.1–21.2, 28.3 and 29.1 for the assembled toolbox; [model theorem](../science/model.md#5-the-finite-alphabet-result), [operational contribution and attribution](../references/related-work.md#5-operational-scope), [convex/stochastic scope](../science/convex-composition.md#6-what-this-capability-adds) and [precision account](../science/precision-and-resources.md). For the fixed-budget proof and its directional lower bound, use [Lin Lin §§3.3–3.5 and 4.2 through the fixed-budget bridge](anchor-bridge.md#5-a-fixed-budget-route). diff --git a/llms.txt b/llms.txt index 48300a1..e018163 100644 --- a/llms.txt +++ b/llms.txt @@ -1,11 +1,13 @@ # Quantum Simplex Estimation -This repository studies exactly unbiased classical probability-vector estimates whose every realization lies in the simplex. Fixed-alphabet mean squared error decreases quadratically with expected paid reversible-source queries. The algorithm has unbounded stopping-time tails; finite capped versions have controlled bias. Do not claim optimal dimension dependence or an end-to-end hardware advantage. +This repository studies exactly unbiased classical probability-vector estimates whose every realization lies in the simplex. The three-outcome fixed schedule has a hard original-source query cap and exact ideal unbiasedness. The conditional tree gives a general finite-alphabet result with an expected query bound and unbounded stopping-time tails; its truncated implementation has controlled bias. Do not claim optimal dimension dependence or an end-to-end hardware advantage. ## Reading by purpose +- Three outcomes under a hard query cap, with matching directional covariance: science/hard-cap-estimator.md and verification/check_hard_cap.py. + - Story and headline: README.md and science/README.md. -- Study route: learning/README.md, the Childs (17 April 2025) bridge in learning/anchor-bridge.md, and the fixed project map M01–M30 in learning/milestones.md. +- Study route: learning/README.md, the Lin Lin (March 3, 2022) and Childs (17 April 2025) sections in learning/anchor-bridge.md, and the fixed project map M01–M30 in learning/milestones.md. - Exact source/access/output model and theorem: science/model.md. - Full algorithm and unbiasedness, zero-mass, minimum-weight, martingale-error and expected-query proofs: science/simplex-estimator.md. - Inherited scalar sine-clock circuit and moment proof: science/scalar-clock.md. diff --git a/references/references.bib b/references/references.bib index f23bbe8..b1e5db3 100644 --- a/references/references.bib +++ b/references/references.bib @@ -138,3 +138,14 @@ @misc{Childs2025 note = {Version dated 17 April 2025; selected educational anchor}, url = {https://www.cs.umd.edu/~amchilds/qa/qa.pdf} } + +@inproceedings{schmon2019bernoullirace, + title = {Bernoulli Race Particle Filters}, + author = {Schmon, Sebastian M. and Doucet, Arnaud and Deligiannidis, George}, + booktitle = {Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics}, + series = {Proceedings of Machine Learning Research}, + volume = {89}, + pages = {2350--2358}, + year = {2019}, + url = {https://proceedings.mlr.press/v89/schmon19a.html} +} diff --git a/references/related-work.md b/references/related-work.md index e871693..5487594 100644 --- a/references/related-work.md +++ b/references/related-work.md @@ -56,4 +56,8 @@ The resulting capability is quantum variance reduction within a known finite cla These propagation identities are elementary consequences of conditional expectation and the simplex theorem. They do not assert a new mixing principle or an unrestricted trajectory-sampling speedup. Sampling a label directly from the supplied source already takes one source execution. Reusing the same random table in nonlinear powers can introduce bias. The algorithm has unbounded stopping tails, and finite precision or noise requires a separate approximation budget. The [lower-bound discussion](../science/lower-bounds.md) keeps the fixed-dimension precision conclusion separate from the unresolved optimal joint dependence on dimension. +## 6. Fixed clocks under a hard cap + +The [hard-cap construction](../science/hard-cap-estimator.md) inherits the scalar clock above and borrows the accept-and-repeat rule of a [Bernoulli race](https://proceedings.mlr.press/v89/schmon19a.html). Schmon, Doucet and Deligiannidis (AISTATS 2019) use that rule to sample a categorical label exactly from weights available through unbiased estimates. Here the algorithm averages the label choice and acceptance coin conditional on all three scalar readouts, returns the resulting probability vector, and terminates the race with one ordinary source draw. The dyadic precision schedule gives a hard original-source query cap and a covariance bound proportional to categorical covariance. Van Apeldoorn's simplex projection and Sidford–Zhang's exact vector debiasing give the different guarantees described in §§1–2. + Bibliographic data are collected in [references.bib](references.bib). diff --git a/science/README.md b/science/README.md index 30f9af6..a7adff8 100644 --- a/science/README.md +++ b/science/README.md @@ -2,18 +2,19 @@ An empirical probability vector is valid and unbiased, but its variance decreases inversely with the number of samples. Quantum mean estimation improves the precision exponent. This account asks whether the returned random vector can retain exact nonnegativity, normalization and unbiasedness at that quantum rate. -Read [the model and exact theorem](model.md), then [the probability tree](simplex-estimator.md). The tree's two ingredients are [the inherited bounded scalar clock](scalar-clock.md) and [paid exact conditional reflection](conditional-reflection.md). The proof pays for every rare conditional branch using a clock chosen from its random estimated mass. +Read [the hard-cap estimator](hard-cap-estimator.md) for three outcomes and the matching pointwise covariance lower bound. For the conditional-tree route, read [the model and exact theorem](model.md), then [the probability tree](simplex-estimator.md). The tree's two ingredients are [the inherited bounded scalar clock](scalar-clock.md) and [paid exact conditional reflection](conditional-reflection.md). The proof pays for every rare conditional branch using a clock chosen from its random estimated mass. | Question | Authoritative account | | --- | --- | | Which source, garbage, outputs and costs are allowed? | [Model](model.md) | +| How can three outcomes retain exactness under a hard cap? | [Hard-cap estimator](hard-cap-estimator.md) | | How do the split weights preserve the simplex and exact means? | [Tree estimator](simplex-estimator.md) | | What scalar measurement has the required moments? | [Scalar clock](scalar-clock.md) | | How is a conditional reflection implemented without a free conditional inverse? | [Conditional reflection](conditional-reflection.md) | -| What changes under a finite cap, approximate gates and rounding? | [Precision and resources](precision-and-resources.md) | +| How is the conditional tree capped under approximate gates and rounding? | [Precision and resources](precision-and-resources.md) | | Which fixed-alphabet precision exponents are matched? | [Lower bounds](lower-bounds.md) | | How do valid convex estimates and fresh stochastic matrices compose? | [Convex composition](convex-composition.md) | | What is inherited and what is added? | [Related work](../references/related-work.md) | | Which finite laws and circuits were checked? | [Verification](../verification/README.md) | -The principal statement is exact in an ideal, expected-work model. Its finite capped implementation has controlled bias, and its dimension dependence is not claimed optimal. These distinctions travel with every interpretation of the result. +Both exact guarantees use ideal gates and readouts. The conditional-tree implementation separately bounds the bias from capping, gate synthesis and rounding. diff --git a/science/hard-cap-estimator.md b/science/hard-cap-estimator.md new file mode 100644 index 0000000..85c9552 --- /dev/null +++ b/science/hard-cap-estimator.md @@ -0,0 +1,90 @@ +# Exact simplex estimation with a hard query cap + +Given the original reversible source $`U`$, its inverse and known label predicates from the [source model](model.md), this estimator returns a probability vector with exactly the correct mean on the closed three-outcome simplex. Its query budget is deterministic. + +## Result + +Write $`D_p=\mathrm{diag}(p)-pp^{\mathsf T}`$ for the covariance of one categorical draw. For an integer scale $`T\ge1`$, the ideal estimator satisfies + +```math +Z\in\Delta_3,\qquad +\mathbb E Z=p,\qquad +Q\lt48T,\qquad +\mathrm{Cov}(Z)\preceq\frac{100}{T^2}D_p . +``` + +Here $`\preceq`$ is positive-semidefinite order, and $`Q`$ counts every call to $`U`$ or $`U^\dagger`$. In the coherent black-box model, an estimator exactly unbiased for all admissible sources and using at most $`N`$ such calls satisfies $`\mathrm{Cov}(Z)\succeq D_p/N^2`$ at each source. The upper bound allows arbitrary source garbage on the complete source registers. + +For $`p=(1-s,sq,s(1-q))`$, the trace of $`D_p`$ equals $`2s-s^2[1+q^2+(1-q)^2]`$. The total Euclidean mean-square error therefore has order $`s/N^2`$ as $`s\to0`$ at hard budget $`N`$, uniformly in $`q\in[0,1]`$. A coordinate of probability zero is exactly zero. For the rare-outcome contrast $`w=(0,1-q,-q)`$, the directional factor $`w^{\mathsf T}D_pw=sq(1-q)`$ describes the accuracy of the split at the true $`q`$. The algorithm requires neither parameter. + +## Fixed schedule + +For $`T\lt4`$, measure one preparation of the source and return its one-hot label. Otherwise take the largest power of two $`K\le T`$. At each scale $`L=K,K/2,\ldots,4`$, perform four independent rounds. In each round, use three fresh [scalar sine clocks](scalar-clock.md) of size $`M=L-1`$. Clock $`i`$ marks the singleton label $`i`$ and returns $`X_i`$ with + +```math +0\le X_i\le1,\qquad +\mathbb E X_i=p_i,\qquad +\mathrm{Var}(X_i)=\kappa_{L-1}p_i(1-p_i),\qquad +\kappa_{L-1}=\frac{L-2}{L}\tan^2\!\frac{\pi}{L}. +``` + +Each clock uses the original source. Set $`Y=X/3`$ and $`r=1-\mathbf1^{\mathsf T}Y`$ in every round. After the final round, measure one fresh source preparation for label $`I`$ and set $`Z_{\rm end}=e_I`$. Compute the output backwards through the rounds by $`Z=Y+rZ'`$, with $`Z'`$ supplied by the later rounds. + +This recurrence averages the label choice and accept/reject coin of a finite Bernoulli race. Conditional on the three clock readouts, $`Y_i`$ is the probability of accepting label $`i`$ and $`r`$ is the probability of continuing. One exact source draw supplies the terminal label. The [Bernoulli race](https://proceedings.mlr.press/v89/schmon19a.html) supplies the accept-and-continue probabilities. The decreasing clock sizes make their variance contributions summable at fixed total query cost. + +Each scalar block uses one source preparation and $`L-1`$ controlled Grover steps. Each step uses one $`U^\dagger`$ and one $`U`$ around a controlled known reflection, plus a controlled label reflection. The source pair is counted even when the clock disables the known reflections. The total, including the final draw, is + +```math +Q=1+12\sum_{L=K,K/2,\ldots,4}(2L-1)\lt48K\le48T. +``` + +All stages have fixed length. Exactness uses ideal gates and exact readouts. The classical output can be encoded by the measured sine-transform indices and the stated arithmetic expression for each coordinate. Known gates, clock operations and output arithmetic are separate from source-query counts. + +## Unbiasedness and covariance + +Since $`Y\ge0`$, $`r\ge0`$ and $`\mathbf1^{\mathsf T}Y+r=1`$, the update preserves the simplex in every run. Each round is independent of its suffix. With $`\mathbb E Y=p/3`$ and $`\mathbb E r=2/3`$, backward induction from the final categorical draw gives $`\mathbb E Z=p`$. + +Fix a real weight vector $`w`$ and write $`\mu=w^{\mathsf T}p`$ and $`\sigma_w^2=w^{\mathsf T}D_p w`$. The round error equals $`B+r\,w^{\mathsf T}(Z'-p)`$, where $`B=\tfrac13\sum_i(w_i-\mu)(X_i-p_i)`$. The suffix is independent and centered, so + +```math +\begin{aligned} +\mathrm{Var}(w^{\mathsf T}Z) +&=\mathrm{Var}(B)+\mathbb E r^2\mathrm{Var}(w^{\mathsf T}Z'),\\ +\mathrm{Var}(B) +&=\frac{\kappa_{L-1}}9\sum_i p_i(1-p_i)(w_i-\mu)^2 +\le\frac{\kappa_{L-1}}9\sigma_w^2 . +\end{aligned} +``` + +Since $`0\le r\le1`$, $`\mathbb E r^2\le\mathbb E r=\beta=2/3`$. The exact multiplier is $`\mathbb E r^2=\beta^2+\kappa_{L-1}\mathrm{tr}(D_p)/9`$. For $`L\ge4`$, monotonicity of $`\tan(x)/x`$ on $`(0,\pi/4]`$ gives $`\kappa_{L-1}\le16/L^2`$. At level $`j`$, where $`L=K/2^j`$, the four rounds contribute at most + +```math +\frac{16\sigma_w^2}{9K^2} +(1+\beta+\beta^2+\beta^3)(4\beta^4)^j . +``` + +The sum over levels is at most $`(1040/51)\sigma_w^2/K^2`$, using $`4\beta^4=64/81`$. The terminal contribution is at most $`(\beta^4)^{\log_2 K-1}\sigma_w^2\le4\sigma_w^2/K^2`$. Together these give at most $`25\sigma_w^2/K^2\le100\sigma_w^2/T^2`$. The single-draw case also satisfies this bound. + +## Black-box lower bound + +Fix an admissible source $`U`$ with $`\psi=U|0\rangle`$ and known label projectors $`\Pi_i`$. For a fixed direction $`w`$, define $`H=\sum_i w_i\Pi_i`$. Then $`\mu=\langle\psi|H|\psi\rangle`$ and $`\lVert(H-\mu)\psi\rVert^2=\sigma_w^2`$. When $`\sigma_w>0`$, set $`v=(H-\mu)\psi/\sigma_w`$ and consider the unitary path + +```math +U_t=\exp\bigl(t[|v\rangle\langle\psi|-|\psi\rangle\langle v|]\bigr)U . +``` + +This path passes through the actual input oracle at $`t=0`$. Its prepared state has derivative $`v`$ there, so the true mean of $`w`$ has derivative $`2\sigma_w`$. The derivatives of $`U_t`$ and $`U_t^\dagger`$ each have operator norm one. + +For a protocol with at most $`N`$ queries on every execution, defer adaptive measurements and pad finished branches with identity slots. This mathematical representation allows coherent choice between $`U_t`$, its inverse and identity within a single slot. Each slot has derivative norm at most one. Differentiating the product of the slots and source-independent operations gives a normalized final state $`\Phi_t`$ with $`\lVert\dot\Phi_0\rVert\le N`$. Dilate the output measurement so $`w^{\mathsf T}Z`$ is a fixed observable $`F`$. Exact unbiasedness along the path gives + +```math +2\sigma_w +=2\mathrm{Re}\langle\dot\Phi_0,(F-\mu)\Phi_0\rangle +\le 2N\sqrt{\mathrm{Var}_{U}(w^{\mathsf T}Z)} . +``` + +The inequality proves the covariance lower bound in every direction, with a trivial lower bound when $`\sigma_w=0`$. The path can depend on $`w`$ because it passes through the same $`U`$. The black-box model charges all input dependence to invocations of the source and its inverse. Access to a source description that gives its probabilities for free would change that model. + +## Connection to the original estimator + +The [conditional-tree estimator](simplex-estimator.md) supplies an expected-work theorem for general label trees with explicit conditional specimens and controlled reflections. The hard-cap construction uses unconditioned singleton tests and an independent categorical draw. Its proof uses the boundedness, exact means and variance identities of the scalar clocks. See the [scalar repository's application note](https://github.com/GoGoKo699/Bounded-Unbiased-Amplitude-Estimation/blob/main/science/simplex-application.md) and the [related-work discussion](../references/related-work.md). diff --git a/science/lower-bounds.md b/science/lower-bounds.md index bbe05a4..126be82 100644 --- a/science/lower-bounds.md +++ b/science/lower-bounds.md @@ -1,5 +1,7 @@ # Matched precision bounds and comparison models +The [hard-cap covariance lower bound](hard-cap-estimator.md#black-box-lower-bound) applies pointwise to uniform exact unbiasedness. It bounds every linear contrast and gives the matching rate for the fixed-schedule estimator. This page treats expected work and the sample-only classical comparison. + The estimator's precision exponent is optimal for fixed output dimension in the declared expected-query model. The distinction from classical sampling is the available experiment: the quantum algorithm can run a source circuit and its inverse coherently, whereas the classical comparison receives independent categorical samples. The following bounds do not separate unrestricted classical and quantum algorithms for an explicitly supplied computational problem. ## Quantum lower bound with a uniform expected budget diff --git a/science/model.md b/science/model.md index 9f37691..5059fd3 100644 --- a/science/model.md +++ b/science/model.md @@ -2,7 +2,7 @@ An empirical frequency vector has three useful properties at once: its entries are nonnegative, they sum to one in every realization, and their expectations equal the underlying probabilities. Ordinary quantum probability estimation can improve precision, but clipping or renormalizing its output generally changes the expectation. The problem here is to retain all three properties while reducing the mean squared error quadratically in the expected coherent source work. -The [construction and proof](simplex-estimator.md) establish this for every finite output alphabet. The accounting includes the conditional states and conditional reflections needed inside the construction. A postselected specimen is never treated as a supplied reversible conditional sampler. +The [fixed-schedule construction](hard-cap-estimator.md) achieves this for three outcomes under a hard query cap, with a matching covariance lower bound in the black-box model. The [conditional-tree construction and proof](simplex-estimator.md) establish this for every finite output alphabet. The accounting includes the conditional states and conditional reflections needed inside the construction. A postselected specimen is never treated as a supplied reversible conditional sampler. ## 1. Source and labels diff --git a/verification/README.md b/verification/README.md index 0404615..814335f 100644 --- a/verification/README.md +++ b/verification/README.md @@ -5,11 +5,12 @@ Run from the repository root: ```bash python3 -m pip install -r verification/requirements.txt OPENBLAS_NUM_THREADS=1 python3 verification/run_all.py +python3 verification/check_hard_cap.py ``` The script writes [finite-report.json](finite-report.json), records its own SHA256 and the scientific files present at the run, and exits with an assertion failure if a checked statement fails. It uses NumPy only. The checked run used Python 3.12.14 and NumPy 2.3.5; exact runtime versions appear in the report. A different output path can be selected with `--output PATH`. -These are deterministic finite-dimensional floating-point calculations. They support the tested statements and detect several load-bearing implementation errors; they do not prove the general theorem, certify priority, establish finite gate synthesis, simulate hardware, or replace a scientific reading of the proofs. +The hard-cap check enumerates eight small-stage laws with exact rational arithmetic and verifies simplex membership, exact means and the covariance recurrence. It checks the sine-transform moments and recurrence on 480 rare-family cases, including exact zeros and masses down to $`10^{-14}`$, and checks the full fixed query count for all integer scales from 1 through 4096. The remaining checks are deterministic finite-dimensional floating-point calculations. They support the tested statements and detect several load-bearing implementation errors; they do not prove the general theorem, certify priority, establish finite gate synthesis, simulate hardware, or replace a scientific reading of the proofs. ## What is checked diff --git a/verification/check_hard_cap.py b/verification/check_hard_cap.py new file mode 100644 index 0000000..f513d17 --- /dev/null +++ b/verification/check_hard_cap.py @@ -0,0 +1,196 @@ +"""Finite checks for the hard-cap simplex estimator with three labels.""" + +from fractions import Fraction +from functools import lru_cache +from itertools import product +from math import asin, isclose, pi, sqrt, tan + +import numpy as np + + +ROUNDS_PER_LEVEL = 4 +LABELS = 3 +BETA = Fraction(2, 3) +DYADIC_MSE_CONSTANT = Fraction(16, 9) * sum( + BETA**j for j in range(ROUNDS_PER_LEVEL) +) / (1 - 4 * BETA**ROUNDS_PER_LEVEL) + 4 + + +def clock_schedule(scale): + top_exponent = scale.bit_length() - 1 + return tuple( + 1 << exponent + for exponent in range(top_exponent, 1, -1) + for _ in range(ROUNDS_PER_LEVEL) + ) + + +def query_count(schedule): + return 1 + LABELS * sum(2 * size - 1 for size in schedule) + + +def variance_factor(size): + return (size - 2) / size * tan(pi / size) ** 2 + + +@lru_cache(maxsize=None) +def sine_clock(size): + labels = np.arange(1, size) + alpha = pi / size + transform = sqrt(2 / size) * np.sin(alpha * np.outer(labels, labels)) + readouts = (1 - np.cos(alpha * labels) / np.cos(alpha)) / 2 + readouts[0] = 0 + readouts[-1] = 1 + return labels, transform, readouts + + +def clock_law(size, probability): + labels, transform, readouts = sine_clock(size) + small_probability = min(probability, 1 - probability) + phase = 2 * asin(sqrt(small_probability)) + # The unphased clock transforms exactly to the first basis vector. + # Isolating it keeps the check informative at small probabilities. + amplitude = transform @ (transform[0] * np.expm1(1j * phase * labels)) + amplitude[0] += 1 + weights = np.abs(amplitude) ** 2 + if probability > 0.5: + weights = weights[::-1] + return readouts, weights + + +def numeric_covariance(probabilities, scale): + schedule = clock_schedule(scale) + diagonal = probabilities * (1 - probabilities) + cov = np.diag(probabilities) - np.outer(probabilities, probabilities) + # The diagonal expression avoids cancellation in the nearly deterministic case. + np.fill_diagonal(cov, diagonal) + transform = np.eye(LABELS) - probabilities[:, None] + for size in reversed(schedule): + kappa = variance_factor(size) + assert kappa <= 16 / size**2 + variances = [] + for p in probabilities: + readouts, weights = clock_law(size, p) + measured_mean = np.dot(weights, readouts) + measured_variance = np.dot(weights, (readouts - p) ** 2) + assert isclose(np.sum(weights), 1, rel_tol=2e-12) + assert isclose(measured_mean, p, rel_tol=2e-11, abs_tol=0) + assert isclose(measured_variance, kappa * p * (1 - p), rel_tol=2e-10) + variances.append(measured_variance) + var = np.diag(variances) + residual_second_moment = float(BETA) ** 2 + sum(variances) / LABELS**2 + assert residual_second_moment <= float(BETA) + cov = transform @ var @ transform.T / LABELS**2 + residual_second_moment * cov + return cov + + +def fraction_clock_law(probability): + return ( + (Fraction(0), (1 - probability) ** 2), + (Fraction(1, 2), 2 * probability * (1 - probability)), + (Fraction(1), probability**2), + ) + + +def exact_covariance(probabilities, rounds): + indices = range(LABELS) + coordinate_variances = [p * (1 - p) / 2 for p in probabilities] + instantaneous_cov = tuple( + tuple( + sum( + (int(i == k) - probabilities[i]) + * (int(j == k) - probabilities[j]) + * coordinate_variances[k] + for k in indices + ) / LABELS**2 + for j in indices + ) + for i in indices + ) + residual_second_moment = BETA**2 + sum(coordinate_variances) / LABELS**2 + covariance = tuple( + tuple(int(i == j) * probabilities[i] - probabilities[i] * probabilities[j] for j in indices) + for i in indices + ) + for _ in range(rounds): + covariance = tuple( + tuple(instantaneous_cov[i][j] + residual_second_moment * covariance[i][j] for j in indices) + for i in indices + ) + return covariance + + +def check_exact_law(probabilities, rounds): + indices = range(LABELS) + atoms = [] + for choices in product(*(fraction_clock_law(p) for p in probabilities)): + values, weights = zip(*choices) + a, b, c = weights + if a * b * c: + atoms.append((tuple(value / LABELS for value in values), a * b * c)) + mass = Fraction(0) + mean = [Fraction(0) for _ in indices] + full_cov = [[Fraction(0) for _ in indices] for _ in indices] + for tail in indices: + if not probabilities[tail]: + continue + for record in product(atoms, repeat=rounds): + point = tuple(Fraction(int(i == tail)) for i in indices) + weight = probabilities[tail] + for allocation, stage_weight in reversed(record): + residual = 1 - sum(allocation) + point = tuple(allocation[i] + residual * point[i] for i in indices) + weight *= stage_weight + assert min(point) >= 0 and sum(point) == 1 + mass += weight + errors = [point[i] - probabilities[i] for i in indices] + for i in indices: + mean[i] += weight * point[i] + for j in indices: + full_cov[i][j] += weight * errors[i] * errors[j] + assert mass == 1 + assert tuple(mean) == probabilities + assert tuple(map(tuple, full_cov)) == exact_covariance(probabilities, rounds) + + +def main(): + exact_cases = ( + (Fraction(1, 2), Fraction(1, 3), Fraction(1, 6)), + (Fraction(127, 128), Fraction(3, 512), Fraction(1, 512)), + (Fraction(0), Fraction(1, 3), Fraction(2, 3)), + (Fraction(1), Fraction(0), Fraction(0)), + ) + for probabilities, rounds in product(exact_cases, (1, 2)): + check_exact_law(probabilities, rounds) + print(f"Exact rational enumeration passed for {2 * len(exact_cases)} small-stage laws.") + + scales = (1, 3, 4, 7, 8, 16, 31, 32, 64, 128) + rare_masses = (0, 1e-14, 1e-10, 1e-6, 0.01, 0.25, 0.5, 1) + splits = (0, 0.01, 0.25, 0.5, 0.99, 1) + max_ratio = 0 + for s, q, scale in product(rare_masses, splits, scales): + probabilities = np.array([1 - s, s * q, s * (1 - q)]) + coordinate_risks = np.diag(numeric_covariance(probabilities, scale)) + variances = probabilities * (1 - probabilities) + # Use the upper bound in terms of the requested scale, after dyadic rounding. + assert np.all(coordinate_risks * scale**2 <= 4 * float(DYADIC_MSE_CONSTANT) * variances) + if s > 0: + max_ratio = max(max_ratio, sum(coordinate_risks) * scale**2 / s) + print(f"DST-based variance recursion passed for {len(scales) * len(rare_masses) * len(splits)} cases.") + print(f"Largest observed MSE * T^2 / s on the nonzero rare grid: {max_ratio:.6g}.") + + for scale in range(1, 4097): + schedule = clock_schedule(scale) + count = query_count(schedule) + assert count < 48 * scale + if scale < 4: + assert not schedule and count == 1 + else: + size = schedule[0] + levels = size.bit_length() - 2 + assert count == 1 + 12 * (4 * size - 8 - levels) + print("Exact query formula and Q < 48T passed for all integer T from 1 through 4096.") + + +if __name__ == "__main__": + main()