diff --git a/.github/workflows/hosted-math.yml b/.github/workflows/hosted-math.yml new file mode 100644 index 0000000..9404f38 --- /dev/null +++ b/.github/workflows/hosted-math.yml @@ -0,0 +1,58 @@ +name: Hosted mathematics + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: hosted-math-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + inspect-github: + runs-on: ubuntu-24.04 + timeout-minutes: 25 + env: + HOSTED_REVISION: ${{ github.event.pull_request.head.sha || github.sha }} + steps: + - name: Check out the exact source revision + uses: actions/checkout@v4 + with: + ref: ${{ env.HOSTED_REVISION }} + fetch-depth: 1 + persist-credentials: false + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install the pinned read-only browser dependencies + run: | + npm install --prefix "$RUNNER_TEMP/hosted-math-deps" playwright@1.56.1 mathjax-full@3.2.1 + "$RUNNER_TEMP/hosted-math-deps/node_modules/.bin/playwright" install --with-deps chromium + - name: Inspect all tracked Markdown on the pinned GitHub host + env: + NODE_PATH: ${{ runner.temp }}/hosted-math-deps/node_modules + run: | + node verification/hosted/capture_hosted_math.cjs \ + --root "$GITHUB_WORKSPACE" \ + --repository "$GITHUB_REPOSITORY" \ + --revision "$HOSTED_REVISION" \ + --output "$RUNNER_TEMP/hosted-math-evidence" + - name: Upload the report, captures and screenshots + if: always() + uses: actions/upload-artifact@v4 + with: + name: hosted-math-${{ env.HOSTED_REVISION }} + path: ${{ runner.temp }}/hosted-math-evidence/ + if-no-files-found: warn + retention-days: 14 diff --git a/README.md b/README.md index 1a486dc..574d314 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ The access model supplies phase-referenced controlled unitary oracles, known jump rates, and a known horizon. The Hamiltonian parameter of the dilation is zero. The error is half diamond distance, so the field simulation preserves correlations with any untouched input reference. Digital field encodings and their known-gate costs are stated explicitly. +**Sister project: [Quantum Dephasing Threshold](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold).** That repository establishes the one/two/three-reflection threshold for the reduced system and supplies its reflection-word geometry. Here the [field-only theorem](science/reflection_threshold.md) establishes the corresponding coherent-field threshold with separate field measurements: a qubit dark-port witness for two reflections and a modified leaf coupling for three. The original system parity witness becomes exactly field-blind when the system is discarded; its replacement and phase-reference limitation are part of the field proof. Each repository retains its own model, assumptions and scientific reading route. + ## Principal results At a fixed error of $`0.1`$, the worst-case query costs have the following time dependence. The single unknown jump has unit rate, and the first three rows concern the same single-jump dynamics. @@ -56,15 +58,32 @@ with the continuous value $`p_0(t)=e^{-1}`$. Choosing $`\theta=\tfrac12\arcsin(2 The exact measurement also has a finite circuit. Conditional on $`n`$ main photons and one observer photon, its effect on the observer's insertion position is $`(I+\mathbf J)/(n+2)`$, where $`\mathbf J`$ is the all-ones matrix. Sampling the count and coherently inserting the known $`Z`$ among $`n`$ forward calls yields the matching upper bound for the bit itself. +### Reflection jumps: constant, square-root and linear cost + +Restrict the supplied jumps to Hermitian involutions $`R_j=R_j^\dagger`$, $`R_j^2=I`$, with $`L_j=R_j/\sqrt{k}`$. The total rate is one, each coupling phase is fixed, and a phase-referenced controlled SELECT of the $`k`$ reflections costs one query. For $`t\geq1`$ and half diamond error $`0.1`$, the dimension-uniform worst-case costs of the complete coherent field are + +| Supplied reflections | Field-only query cost | Lower-bound mechanism and dimension | +|---|---:|---| +| One | $`1`$ | Coherent parity suffices; a qubit excludes zero queries. | +| Two | $`\Theta(\sqrt t)`$ | Coherent word reduction gives the upper bound; a qubit dark-port count gives the lower bound. | +| Three | $`\Theta(t)`$ | Known leaf-$`Z`$ couplings make tree parity visible in the field; the hard dimension is $`\exp(\Theta(t))`$. | + +The upper bounds are routine coherent uses of the sister project's word cancellation and established Poisson trajectory preparation. A classical reduced-word sample would erase required field coherence. The new [pair witness](science/reflection_pair.md) mixes the two baths by a fixed beamsplitter; its dark count has mean $`t\sin^2\theta`$ for reflections $`R_\pm=\cos\theta Z\pm\sin\theta X`$. The [three-reflection proof](science/reflection_tree.md) changes unused leaf transitions to known $`Z`$ actions, while keeping exactly three jumps at fixed rates $`1/3`$. + +This triple witness requires coherence between total photon numbers: its two parity fields become identical after total-number dephasing. The pair's dark-count witness survives that dephasing. The theorem counts supplied reflection primitives, not an intrinsic Lindblad rank, and proves no fixed-dimension linear law. The two-reflection result also differs from the observer example above, whose unknown jump is a general unitary rather than a reflection. + ## Read the science -Start with the [model and output contract](science/model.md), then follow [count centering](science/centered_environment.md) and the [noncommuting observer](science/noncommuting_observer.md). The [resource account](science/resources.md) specifies preparation, storage and encoding costs. The [interpretation](science/interpretation.md) connects the results and the reduced-system benchmark. +Start with the [model and output contract](science/model.md), then follow [count centering](science/centered_environment.md), the [noncommuting observer](science/noncommuting_observer.md), or the [reflection threshold](science/reflection_threshold.md). The [resource account](science/resources.md) specifies preparation, storage and encoding costs. The [interpretation](science/interpretation.md) connects the results and the reduced-system benchmark. | To inspect | Authoritative account | |---|---| | Fixed dilation, oracle phases, reference systems and exact word code | [Model](science/model.md) | | Uniform truncation proof, commuting extension and square-root lower bound | [Centered environment](science/centered_environment.md) | | One-photon kernel, constant gap, linear lower bound and direct sampler | [Noncommuting observer](science/noncommuting_observer.md) | +| Fixed-rate one/two/three-reflection field theorem and coherent upper bounds | [Reflection threshold](science/reflection_threshold.md) | +| Qubit dark-port field witness | [Two reflections](science/reflection_pair.md) | +| Field-blind original tree, leaf-$`Z`$ replacement, parity and number coherence | [Three reflections](science/reflection_tree.md) | | Known gates, classical compilation, storage and SELECT access | [Resources](science/resources.md) | | Physical meaning, measured records and the system-output comparison | [Interpretation](science/interpretation.md) | | Inherited ingredients and closest prior results | [Related work](references/RELATED_WORK.md) and [bibliography](references/references.bib) | @@ -76,7 +95,7 @@ The square-root scale, phase estimation, and typical-window compression have clo The single educational anchor is **John Watrous, *The Theory of Quantum Information* (2018)**. The [Watrous bridge](learning/watrous_bridge.md) connects channels, discarded systems, reference-preserving error and measurement distinguishability to the field-output problem. It translates the notation and supplies the steps from the book's finite-dimensional framework to the project's declared field encodings and finite truncations. -The [30-milestone map](learning/milestones.md) follows the project's scientific story. Its **12 background/preliminaries milestones** assemble the output and resource contract; its **18 narrative/innovation milestones** connect count centering, the observer measurement and the resulting complexity separation. Each milestone records its central question, understanding target, dependencies, conceptual connection and source pointers. +The [30-milestone map](learning/milestones.md) follows the project's scientific story. Its **12 background/preliminaries milestones** assemble the output and resource contract; its **18 narrative/innovation milestones** connect count centering, the observer measurement, and the reflection-field threshold. Each milestone records its central question, understanding target, dependencies, conceptual connection and source pointers. Watrous is the common anchor for both sister projects, with a distinct bridge and learning route in each. Start with the [learning overview](learning/README.md), use the bridge alongside the milestone map, or take the direct scientific route above. The [LLM reading guide](llms.txt) maps reader intentions to the authoritative account. @@ -89,7 +108,7 @@ python -m pip install -r verification/requirements.txt python verification/audit_environment.py --output verification/audit_results.json ``` -The suite compares full collision states with a separate recurrence, exact simplex integrals with finite-bin projections, the direct measurement circuit with its reference-preserving channel, and the centered field with its uncentered Choi matrix. Negative controls exercise the assumptions that make the proofs work. These finite checks supplement the analytical arguments; they do not prove the asymptotic bounds. +The suite compares full collision states with a separate recurrence, exact simplex integrals with finite-bin projections, the direct measurement circuit with its reference-preserving channel, and the centered field with its uncentered Choi matrix. The [verification guide](verification/README.md) also gives the reflection-field checks for dark counts, finite field matrices, the modified tree and number-dephasing controls. These finite checks supplement the analytical arguments; they do not prove the asymptotic bounds. ## Scope @@ -97,6 +116,8 @@ The field target is fixed by its microscopic vacuum dilation, including coupling The global chronological-word code generally does not factor into separate bath registers. Deleting labels is not a physical bath trace. The one-bit algorithm implements its specific measurement directly. Encoded simulation also does not reduce the energy or elapsed time needed to emit a physical field; physical production and arbitrary decoding have separate costs. +For the reflection pair, an explicit chronological-word implementation still has $`O(t)`$ output slots and roughly linear known preparation and processing work at fixed error, despite its $`O(\sqrt t)`$ oracle count. A compressed endpoint code must separately pay for its embedding into the physical field. The three-reflection lower bound uses a growing system and a phase-referenced coherent field; it is not a linear lower bound for a fixed-dimensional or number-dephased target. + ## Purpose and contact This repository serves as a record of the work and a guide for the author’s self-directed learning. For discussion or potential collaboration, please contact Ruge Lin at [gogoko699@gmail.com](mailto:gogoko699@gmail.com). diff --git a/learning/README.md b/learning/README.md index fb1f919..c158092 100644 --- a/learning/README.md +++ b/learning/README.md @@ -1,6 +1,6 @@ # Learning route -The project studies a concrete distinction: an open quantum process can be expensive to simulate when its system is retained, cheaper when only one coherent output field is retained, and cheap again when that field is reduced to a classical counting record. A known noncommuting observer can make even one measurement bit linearly hard in the evolution time. The [scientific entrypoint](../README.md) states the exact results and assumptions. +The project studies a concrete distinction: an open quantum process can be expensive to simulate when its system is retained, cheaper when only one coherent output field is retained, and cheap again when that field is reduced to a classical counting record. A known noncommuting observer can make even one measurement bit linearly hard in the evolution time. Restricting the jump unitaries to reflections gives another precise boundary: one, two and three supplied reflections have constant, square-root and linear worst-case field-query cost. The [scientific entrypoint](../README.md) states the exact results and assumptions. The single educational anchor is **John Watrous, *The Theory of Quantum Information* (Cambridge University Press, 2018)**. Its [official author page](https://cs.uwaterloo.ca/~watrous/TQI/) provides the accessible prepublication manuscript. The relevant foundations are channels, reductions, measurements and channel distance in Chapters 2 and 3. The [Watrous bridge](watrous_bridge.md) specifies the sections, translates notation and explains the additional steps supplied by this project. @@ -10,13 +10,14 @@ The single educational anchor is **John Watrous, *The Theory of Quantum Informat |---|---| | Understand the whole scientific story | Follow the [30-milestone map](milestones.md), using the bridge and its canonical source pointers where needed. | | Understand the main mechanism first | Read the bridge's [two-count example](watrous_bridge.md#a-two-count-example), then the [centering lemma](../science/centered_environment.md#centering-lemma) and [observer measurement](watrous_bridge.md#the-observer-measurement-as-a-finite-effect). | +| Understand the sister-project exchange | Read the bridge's [reflection-field comparison](watrous_bridge.md#reflection-jumps-and-the-sister-project), then the [reflection theorem](../science/reflection_threshold.md), [pair witness](../science/reflection_pair.md) and [modified tree](../science/reflection_tree.md). | | Inspect the exact task and guarantees | Start with the [model](../science/model.md), then the [centered-field proof](../science/centered_environment.md) and [observer proof](../science/noncommuting_observer.md). | | Check resource and novelty claims | Read [resources](../science/resources.md), [interpretation](../science/interpretation.md), the [Gaussian comparison](../science/gaussian_connection.md) and [related work](../references/RELATED_WORK.md). | | Reproduce finite checks | Follow the commands and validation boundaries in [verification](../verification/README.md). | ## The milestone structure -The common map contains **exactly 30 milestones**: M01–M12 cover background and preliminaries, and M13–M30 develop the narrative and innovation. The background moves from individual registers and measurements to the full simulation contract. The narrative moves from removing a common system rotation to the observer obstruction and the final output comparison. Each milestone has a central question, an understanding target, dependencies and story role, a conceptual connection, and source pointers. +The common map contains **exactly 30 milestones**: M01–M12 cover background and preliminaries, and M13–M30 develop the narrative and innovation. The background moves from individual registers and measurements to the full simulation contract. The narrative joins count centering and its observer boundary to coherent reflection-word reduction, the field-only pair and tree witnesses, and the final output/resource comparison. Each milestone has a central question, an understanding target, dependencies and story role, a conceptual connection, and source pointers. The allocation reflects the need to connect finite-dimensional quantum information with a specified continuous vacuum field. It is a map of the project's central understanding targets, rather than every technical calculation or every chapter of the anchor. The bridge gives a small worked example and distinguishes the textbook foundation, locally supplied derivations and primary research dependencies. @@ -24,6 +25,8 @@ The allocation reflects the need to connect finite-dimensional quantum informati The input system may be entangled with an untouched reference, so the simulator's accuracy is a channel guarantee. The field is specified by its microscopic coupling, including phases; its reduced Lindblad generator alone is insufficient. A finite digital field encoding requires an explicit embedding and error bound. For noncommuting jumps, the chronological-word code generally does not factor across physical baths, so a physical measurement must be represented correctly within it. -The query upper bounds count forward controlled calls to an unknown unitary. Known gates, classical compilation and storage, and physical field production remain separate costs. The lower bounds use specified discrimination examples. In particular, the observer rate is inversely proportional to the requested horizon, and the general result does not classify all noncommuting jump families. These qualifications stay attached to the scientific reading route. +The single-unitary upper bounds count forward controlled calls. The reflection theorem supplies controlled SELECT access at fixed rates. Known gates, classical compilation and storage, and physical field production remain separate costs. The lower bounds use specified discrimination examples. The observer's rate is inversely proportional to the requested horizon; the reflection tree instead has fixed rates and growing dimension. Its parity signal disappears under total-photon-number dephasing, whereas the pair dark-port witness survives that dephasing. These qualifications stay attached to the scientific reading route. + +The sister [Quantum Dephasing Threshold](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold) owns the reflection-word geometry and reduced-system theorem. This repository owns the field-only proof and physical measurement constructions. Watrous is their common educational anchor; each project supplies its own bridge and 30-target map. The field witness must be proved separately: hardness of a measured system output does not transfer automatically after that system is discarded. Return to the [repository overview](../README.md) for the principal results, or begin with the [Watrous bridge](watrous_bridge.md). diff --git a/learning/milestones.md b/learning/milestones.md index 5b223a5..48e7369 100644 --- a/learning/milestones.md +++ b/learning/milestones.md @@ -2,7 +2,7 @@ This map follows the scientific question: how does the requested output change the cost of simulating the same open quantum dynamics? It contains exactly 30 understanding targets, independent of any reader's prior knowledge or progress. The selected educational anchor is John Watrous, *The Theory of Quantum Information* (2018). The [source bridge](watrous_bridge.md) translates its notation and identifies the additional field and oracle arguments supplied by this project. -The allocation is **12 background/preliminary milestones and 18 narrative/innovation milestones**. The background joins finite quantum registers, channel accuracy and the specified continuous field into one operational contract. The narrative starts with a removable common system rotation, then develops the observer obstruction and ends with the global comparison of outputs. This allocation reflects the project's two interfaces, quantum information and vacuum-field simulation. It does not follow the textbook's chapter count or claim to cover every technical lemma. +The allocation is **12 background/preliminary milestones and 18 narrative/innovation milestones**. The background joins finite quantum registers, channel accuracy and the specified continuous field into one operational contract. The narrative starts with count centering and its observer obstruction, then follows coherent reflection-word reduction to separate pair and tree field witnesses, ending with the global output and resource comparison. This allocation reflects the project's two interfaces, quantum information and vacuum-field simulation. It does not follow the textbook's chapter count or claim to cover every technical lemma. Dependencies refer only to earlier milestones. Scientific equation labels identify the authoritative statements; the map explains their roles without replacing their proofs. Watrous section links refer to the author's freely accessible prepublication chapter files, linked from the [official book page][W]. @@ -50,7 +50,7 @@ Dependencies refer only to earlier milestones. Scientific equation labels identi - **Central question:** How can one bounded measurement event certify that two output states differ? - **Understanding target:** Interpret an effect between zero and identity, its acceptance probability, and the relation between an event-probability gap and trace distance. - **Dependencies and story role:** M02–M04. Prepare the operational lower-bound witness. -- **Conceptual connection:** The observer result will concern a specific projector and ultimately a classical output bit, so an unbounded field observable is unnecessary. +- **Conceptual connection:** The observer, dark-port and modified-tree results use bounded field effects or observables; their lower bounds do not rely on an unbounded readout. - **Source pointers:** Watrous [§2.3.1][W2] and [§3.1.1][W3]; [observer, (O2), (O9)](../science/noncommuting_observer.md). ### M06 · Overlap, trace distance and discarded outputs @@ -78,7 +78,7 @@ Dependencies refer only to earlier milestones. Scientific equation labels identi - **Understanding target:** Distinguish controlled forward calls, inverse calls, supplied powers and SELECT access, and explain why the field requires a fixed phase convention. - **Dependencies and story role:** M04 and M07. Make the input interface precise before counting operations. - **Conceptual connection:** Channel distinguishability constrains an algorithm only after its allowed queries are specified; an uncontrolled oracle does not automatically supply a controlled one. -- **Source pointers:** Watrous [§3.3][W3] for channel comparison; the project supplies the oracle convention in [model, (M5)](../science/model.md#oracle-and-accuracy-conventions) and [resources, general word code](../science/resources.md#general-exact-word-code). +- **Source pointers:** Watrous [§3.3][W3] for channel comparison; the project supplies the oracle conventions in [model, (M5)](../science/model.md#oracle-and-accuracy-conventions), [reflection model](../science/reflection_threshold.md) and [resources, general word code](../science/resources.md#general-exact-word-code). ### M09 · Unitary jumps and Poisson activity @@ -113,172 +113,172 @@ Dependencies refer only to earlier milestones. Scientific equation labels identi - **Central question:** Which assumptions must remain fixed for two simulation costs to be comparable? - **Understanding target:** State the input system/reference, vacuum coupling, known rates and horizon, controlled oracle, retained output, fixed encoding, error criterion and charged resources as one task. - **Dependencies and story role:** M01–M11. Synthesize the background from individual objects into the operational problem. -- **Conceptual connection:** Keeping the system, keeping the field and reporting one measured bit can now be compared without silently changing access or accuracy. +- **Conceptual connection:** Keeping the system, keeping the field and reporting one measured bit can now be compared without silently changing access, the unitary/reflection promise or accuracy. - **Source pointers:** Watrous [§§2.2 and 3.3][W2W3]; [model](../science/model.md); [resource boundaries](../science/resources.md#resource-boundaries). ## Narrative and innovation: M13–M30 -### M13 · The single-jump field isometry +### M13 · Photon counts and a removable system factor - **Phase:** Narrative/innovation. -- **Central question:** How does the unknown unitary become correlated with photon number? -- **Understanding target:** Read the coherent Poisson expansion and identify the power applied on each number branch, including its off-diagonal field/reference blocks. -- **Dependencies and story role:** M02, M09–M12. Begin the narrative with the exact object that the algorithm must reproduce. -- **Conceptual connection:** An eigenstate of the unitary emits a coherent mode state, while a general input requires a channel construction that preserves reference correlations. -- **Source pointers:** Watrous [§§2.1.2–2.2.2][W2] for the state/channel language; [centered environment, (C1)–(C2), (C14)](../science/centered_environment.md). +- **Central question:** How does the single-jump field encode powers of the unknown unitary? +- **Understanding target:** Read the coherent Poisson isometry, factor a common power from a count window, and explain why discarding the system removes that factor even with a reference. +- **Dependencies and story role:** M02–M04 and M09–M12. Start from the exact field and isolate count centering. +- **Conceptual connection:** Different joint states can have the same retained marginal; count coherence must remain. +- **Source pointers:** Watrous [§§2.1.2–2.2.2][W2W3] for the relevant channel, measurement or distance foundation; [centering, (C1)–(C5)](../science/centered_environment.md); [two-count example](watrous_bridge.md#a-two-count-example). -### M14 · Removing a common system rotation +### M14 · A uniform coherent error budget - **Phase:** Narrative/innovation. -- **Central question:** Why does a count window cost its width rather than its largest count? -- **Understanding target:** Factor the same power from all retained branches, use partial-trace invariance, and count the remaining forward calls without implementing an inverse. -- **Dependencies and story role:** M03, M08 and M13. Isolate the constructive mechanism. -- **Conceptual connection:** The freedom to discard the final system converts a large absolute count into a smaller relative-count task. -- **Source pointers:** Watrous [§2.1.3][W2]; [centering lemma, (C3)–(C5)](../science/centered_environment.md#centering-lemma); [two-count example](watrous_bridge.md#a-two-count-example). +- **Central question:** Why does a concentrated count window approximate every input? +- **Understanding target:** Relate omitted Poisson mass to the input-independent overlap and its square-root error bound, then connect concentration to time and precision dependence. +- **Dependencies and story role:** M06–M07 and M13. Turn an exact window identity into a channel guarantee. +- **Conceptual connection:** Amplitudes govern coherent tail error; normalized preparation avoids input-dependent postselection. +- **Source pointers:** Watrous [§§3.1–3.3][W2W3] for the relevant channel, measurement or distance foundation; [truncation and concentration, (C6)–(C10)](../science/centered_environment.md#reference-uniform-truncation-error). -### M15 · A tail bound valid for every input +### M15 · Preparation and the commuting extension - **Phase:** Narrative/innovation. -- **Central question:** Why does normalization of the retained Poisson window give a uniform channel guarantee? -- **Understanding target:** Explain the input-independent overlap and the square-root omitted-probability bound, including mixed inputs and untouched references. -- **Dependencies and story role:** M06–M07 and M14. Turn an exact identity on a window into an approximation to the full target. -- **Conceptual connection:** Directly preparing normalized amplitudes avoids input-dependent postselection; purification and contractivity transfer the guarantee to the requested output. -- **Source pointers:** Watrous [§§3.1–3.3][W3]; [reference-uniform truncation, (C6)–(C7)](../science/centered_environment.md#reference-uniform-truncation-error). +- **Central question:** How are known amplitudes paid for, and when does centering extend to several fields? +- **Understanding target:** Explain the compiled finite-list preparation and threshold controls, then identify why commuting jumps permit independent product-mode count offsets. +- **Dependencies and story role:** M08, M10–M11 and M14. Close the construction and expose its extension's hypothesis. +- **Conceptual connection:** Known amplitude data still requires compilation; commutativity permits removing the product of count offsets. +- **Source pointers:** Watrous [§§2.1–2.2 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [resources, (R1)–(R3)](../science/resources.md#compiled-count-state-preparation-without-qram); [commuting jumps, (C11)–(C13)](../science/centered_environment.md#commuting-unitary-jumps). -### M16 · Concentration sets the query width +### M16 · The single-unitary output comparison - **Phase:** Narrative/innovation. -- **Central question:** How do mean count and target error determine the retained interval? -- **Understanding target:** Connect Poisson concentration to the explicit integer window, its square-root mean dependence and its logarithmic precision terms, including the separate preparation-error allowance. -- **Dependencies and story role:** M09 and M15. Derive the algorithm's scaling from the mechanism and its error budget. -- **Conceptual connection:** Fluctuations around the mean determine the number of required powers after the common rotation has been removed. -- **Source pointers:** Watrous [§3.3.2][W3] for composition of channel errors; the concentration argument is supplied in [centered environment, (C8)–(C10)](../science/centered_environment.md#explicit-concentration-window). +- **Central question:** Why can the field cost square-root time while the system costs linear time? +- **Understanding target:** Connect the qubit field gap and query hybrid to the square-root lower bound, then explain the separate same-oracle system witness and accumulated phase. +- **Dependencies and story role:** M05, M08 and M13–M15. Match constructive and converse time exponents. +- **Conceptual connection:** The common power is irrelevant only when the final system is discarded; one input suffices for a lower bound within an all-input task. +- **Source pointers:** Watrous [§§3.1 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [field optimality, (C14)–(C15)](../science/centered_environment.md#constant-error-optimality-for-one-jump); [system comparison, (P4)–(P10)](../science/interpretation.md#reduced-system-output-has-linear-query-complexity-in-the-same-model). -### M17 · Compiling the centered algorithm +### M17 · A mean-one observer and temporal coherence - **Phase:** Narrative/innovation. -- **Central question:** How are the count amplitudes and query controls implemented without a loading oracle? -- **Understanding target:** Follow the mode-centered probability recurrence, finite-list rotation preparation and reversible threshold controls, and distinguish their gate/storage costs from oracle calls. -- **Dependencies and story role:** M08, M11 and M16. Close the resource account for the upper bound. -- **Conceptual connection:** A query advantage becomes a complete algorithm only after its known input data and preparation procedures have been specified and charged. -- **Source pointers:** Watrous [§2.2][W2] for channel composition; the circuit and arithmetic ingredients are supplied and attributed in [resources, (R1)–(R3)](../science/resources.md#compiled-count-state-preparation-without-qram). +- **Central question:** How can a weak known observer retain information absent from total count? +- **Understanding target:** Specify the horizon-indexed family, inverse-time observer rate and mean-one activity, and follow the one-photon kernel to the uniform-mode event. +- **Dependencies and story role:** M05, M09–M10 and M16. Introduce a concrete physical obstruction. +- **Conceptual connection:** A concentrated count can coexist with broad coherent insertion positions of a noncommuting jump. +- **Source pointers:** Watrous [§§2.1–2.3][W2W3] for the relevant channel, measurement or distance foundation; [observer model, kernel and gap, (O1)–(O9)](../science/noncommuting_observer.md). -### M18 · The commuting extension +### M18 · A linear bit lower bound and its finite effect - **Phase:** Narrative/innovation. -- **Central question:** When can one remove a separate count offset for each field? -- **Understanding target:** Use commutativity to obtain the product-mode code and common system factor, combine tail and preparation errors, and interpret the sum of window widths. -- **Dependencies and story role:** M10 and M14–M17. Extend the mechanism while keeping its algebraic requirement visible. -- **Conceptual connection:** Independent Poisson counts and commuting operator products jointly permit local count registers; the upper bound does not establish optimal dependence on the number of fields. -- **Source pointers:** Watrous [§§2.1.1 and 3.3.2][W2W3]; [commuting jumps, (C11)–(C13)](../science/centered_environment.md#commuting-unitary-jumps). +- **Central question:** Why is the observer event hard even when only one bit is requested? +- **Understanding target:** Combine inverse-time oracle separation with the event gap, then explain why the exact position-register effect represents a physical measurement. +- **Dependencies and story role:** M07–M08 and M17. Connect the witness to query complexity and encoded readout. +- **Conceptual connection:** The lower bound does not require a large output; pulling back an effect differs from deleting a bath label. +- **Source pointers:** Watrous [§§2.3 and 3.1–3.3][W2W3] for the relevant channel, measurement or distance foundation; [observer lower bound and finite effect, (O10)–(O14)](../science/noncommuting_observer.md#query-lower-bound). -### M19 · Why the square-root exponent is necessary +### M19 · The bit sampler and full-field baseline - **Phase:** Narrative/innovation. -- **Central question:** Can a simulator use substantially fewer calls than the count-window algorithm at fixed error? -- **Understanding target:** Compare two nearby determinant-one qubit oracles, their separated coherent outputs and the query-by-query hybrid bound. -- **Dependencies and story role:** M05, M07–M08 and M16. Match the upper bound's time exponent with an operational lower bound. -- **Conceptual connection:** A constant output distinction produced by oracles separated by inverse square-root mean requires proportionally many queries; the claim concerns fixed error, not optimal precision dependence. -- **Source pointers:** Watrous [§§3.1.1 and 3.3][W3]; [single-jump optimality, (C14)–(C15)](../science/centered_environment.md#constant-error-optimality-for-one-jump). +- **Central question:** How do concrete upper bounds match the observer task? +- **Understanding target:** Explain classical count sampling, coherent insertion, the position test and residual coin, then distinguish that sampler from coherent full-word preparation. +- **Dependencies and story role:** M11, M15 and M18. Complete the observer result and retain a general baseline. +- **Conceptual connection:** Classical count sampling is valid for this count-diagonal effect; the full field still requires trajectory coherence. +- **Source pointers:** Watrous [§§2.2–2.3 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [direct sampler, (O15)–(O16)](../science/noncommuting_observer.md#matching-upper-bound-for-the-one-bit-task); [full-word construction, (R4)](../science/resources.md#general-exact-word-code). -### M20 · Keeping the system changes the task +### M20 · The reflection promise and one-query endpoint - **Phase:** Narrative/innovation. -- **Central question:** Why does the same single-jump dynamics require linear query cost when its system output is retained? -- **Understanding target:** Connect accumulated phase in the reduced-system channel to the exact qubit discrimination pair and its truncated Poisson simulation upper bound. -- **Dependencies and story role:** M12, M14 and M19. Establish the same-oracle baseline for output-dependent complexity. -- **Conceptual connection:** Removing the common system factor was legitimate because that system was discarded; the system-output task retains the phase information that made that factor large. -- **Source pointers:** Watrous [§§3.1.1 and 3.3][W3]; [reduced-system comparison, (P4)–(P10)](../science/interpretation.md#reduced-system-output-has-linear-query-complexity-in-the-same-model). +- **Central question:** What changes when every supplied unitary squares to identity? +- **Understanding target:** State the fixed rates, phases, controlled SELECT, half-diamond error and dimension-uniform quantifiers, then explain the coherent parity construction for one reflection. +- **Dependencies and story role:** M08–M12 and M16. Begin the restricted reflection story with its input promise. +- **Conceptual connection:** A reflection is a special unitary; its constant-query parity endpoint does not contradict the generic single-unitary theorem. +- **Source pointers:** Watrous [§§2.2 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [reflection model and theorem](../science/reflection_threshold.md); [bridge comparison](watrous_bridge.md#reflection-jumps-and-the-sister-project). -### M21 · A known observer records insertion position +### M21 · Coherent word reduction for a pair - **Phase:** Narrative/innovation. -- **Central question:** What extra information can a noncommuting observer place in a weak field? -- **Understanding target:** Describe the qubit jump and known Pauli observer, explain the rate $`1/t`$ and mean-one activity, and identify its coherent positions among the main jumps. -- **Dependencies and story role:** M09–M10, M12 and M18. Introduce the family that tests the limit of count centering. -- **Conceptual connection:** A concentrated total count can coexist with a broad set of noncommuting insertion positions. The family changes with the requested horizon. -- **Source pointers:** Watrous [§§2.1–2.3][W2] for the state and measurement language; [observer, (O1)–(O3)](../science/noncommuting_observer.md). +- **Central question:** Why does the sister project's line geometry also give a field upper bound? +- **Understanding target:** Explain reflection cancellation, the signed endpoint and diffusive width, while retaining chronological amplitudes and uncomputing reduction work. +- **Dependencies and story role:** M02, M06 and M20. Transfer a constructive identity with its coherence condition. +- **Conceptual connection:** A per-word identity lifts routinely to the field; a classical endpoint sample would change its coherences. +- **Source pointers:** Watrous [§§2.1–2.2][W2W3] for the relevant channel, measurement or distance foundation; [coherent reflection upper bounds](../science/reflection_threshold.md); [sister geometry](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/blob/549582272ce6f5a3274be12de1bc5b2f16ed290e/science/pair-simulation.md). -### M22 · Temporal coherence produces a finite event gap +### M22 · The qubit dark-port lower bound - **Phase:** Narrative/innovation. -- **Central question:** How can a field with mean count one distinguish two nearby unknown unitaries? -- **Understanding target:** Follow the one-photon kernel to the uniform-mode event and its explicit constant probability gap, while distinguishing that event from total one-photon counting. -- **Dependencies and story role:** M05–M06 and M21. Construct a bounded observable witness rather than relying only on a sensitivity heuristic. -- **Conceptual connection:** Coherence between emission times within one photon-number sector remains accessible even when coherence between different count sectors is removed. -- **Source pointers:** Watrous [§§2.3.1 and 3.1.1][W2W3]; [observer probability and gap, (O4)–(O9)](../science/noncommuting_observer.md#exact-probability-of-the-temporal-mode-event). +- **Central question:** What field-only event prevents a better pair exponent? +- **Understanding target:** Transform tilted-reflection couplings by the beamsplitter, interpret the Poisson dark count, and combine its constant gap with inverse-square-root oracle separation. +- **Dependencies and story role:** M05, M08 and M20–M21. Match the pair upper bound without the final system. +- **Conceptual connection:** Bath-label coherence becomes a count difference after a known mixer; this witness does not need cross-number coherence. +- **Source pointers:** Watrous [§§2.3 and 3.1–3.3][W2W3] for the relevant channel, measurement or distance foundation; [pair field proof](../science/reflection_pair.md); [dark-port bridge](watrous_bridge.md#a-dark-port-qubit-example). -### M23 · One bit can require linearly many queries +### M23 · A system-hard tree with a field-blind input - **Phase:** Narrative/innovation. -- **Central question:** Why does the observer lower bound survive when the output is only its event bit? -- **Understanding target:** Combine the constant event gap, inverse-time oracle separation and two approximation errors to obtain the linear query requirement at error below half the gap. -- **Dependencies and story role:** M08, M19 and M22. Convert the physical witness into an output-size-independent computational obstruction. -- **Conceptual connection:** The lower bound follows from a binary statistical distinction, so it does not rely on emitting many photons or choosing a costly field decoder. -- **Source pointers:** Watrous [§§3.1.1 and 3.3.2–3.3.3][W3]; [observer query bound, (O10)–(O11)](../science/noncommuting_observer.md#query-lower-bound). +- **Central question:** Why does the original parity witness fail after discarding the system? +- **Understanding target:** Describe the prefix-parity coordinate change, explain why it fixes the root input, and use partial-trace invariance to remove all bit dependence from that field. +- **Dependencies and story role:** M03–M04 and M20–M22. Test the proposed converse transfer. +- **Conceptual connection:** System distinguishability need not survive the required marginal; the exact failed witness identifies a missing operational ingredient. +- **Source pointers:** Watrous [§2.1.3][W2W3] for the relevant channel, measurement or distance foundation; [original-tree field blindness](../science/reflection_tree.md); [sister system converse](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/blob/549582272ce6f5a3274be12de1bc5b2f16ed290e/science/lower-bounds.md). -### M24 · Pulling the physical measurement into the word code +### M24 · Known leaf couplings make parity visible - **Phase:** Narrative/innovation. -- **Central question:** How can a physical observer measurement be represented when bath labels are not tensor factors? -- **Understanding target:** Connect integration over the main-photon time gaps to the exact position-register effect, and distinguish a pulled-back measurement from an unjustified bath trace. -- **Dependencies and story role:** M05, M10 and M21–M22. Resolve the interface between the physical witness and a finite algorithm. -- **Conceptual connection:** The effect is the uniform-position projector plus a weighted orthogonal complement; its explicit form permits a known circuit despite the encoding's nonlocality across baths. -- **Source pointers:** Watrous [§2.3.1][W2]; [exact finite-register witness, (O12)–(O14)](../science/noncommuting_observer.md#an-exact-finite-register-implementation-of-the-witness). +- **Central question:** How can three fixed-rate reflections put the answer into the field? +- **Understanding target:** Explain the leaf-Z replacement, the coordinate change leaving full parity on leaf emissions, and the orthogonal endpoint decomposition of the field states. +- **Dependencies and story role:** M06 and M23. Construct a field-sensitive family with exactly three involutions. +- **Conceptual connection:** Known endpoint supports make the retained phase distinction measurable through pure-state overlaps. +- **Source pointers:** Watrous [§§2.1.3 and 3.1–3.2][W2W3] for the relevant channel, measurement or distance foundation; [modified tree and field decomposition](../science/reflection_tree.md). -### M25 · The matching direct bit sampler +### M25 · Leaf occupation and linear query cost - **Phase:** Narrative/innovation. -- **Central question:** How is the hard bit sampled with a matching linear upper bound? -- **Understanding target:** Explain classical count sampling, coherent insertion of the known Pauli, the uniform-position test and residual coin, and the reference-uniform error from conditioning the Poisson count. -- **Dependencies and story role:** M07, M11, M17 and M24. Complete the observer result with a concrete construction. -- **Conceptual connection:** Count coherence may be discarded because this effect is block diagonal in counts; position coherence must remain. Only the sampled count's loader is compiled. -- **Source pointers:** Watrous [§§2.1.2, 2.3.1 and 3.3][W2W3]; [matching bit upper bound, (O15)–(O16)](../science/noncommuting_observer.md#matching-upper-bound-for-the-one-bit-task); [resource account](../science/resources.md#the-observer-event-is-efficiently-measurable-in-the-word-code). +- **Central question:** Why is the modified tree's distinction uniformly large? +- **Understanding target:** Connect leaf hitting, conditional loop counts and occupation time to a constant field-distance gap, then explain the two-bit-query SELECT compiler and parity reduction. +- **Dependencies and story role:** M05–M08 and M24. Complete the converse's physical and oracle steps. +- **Conceptual connection:** Outward motion reaches a parity-bearing boundary; the charged compiler turns a field distinction into the established parity obstruction. +- **Source pointers:** Watrous [§§3.1–3.3][W2W3] for the relevant channel, measurement or distance foundation; [three-reflection proof](../science/reflection_tree.md). -### M26 · The general full-field baseline +### M26 · Which coherence survives measurement? - **Phase:** Narrative/innovation. -- **Central question:** What upper bound remains when count centering is unavailable? -- **Understanding target:** Describe coherent total-count and chronological-label preparation, its Poisson cutoff, and the different query costs of SELECT and individual controlled oracles. -- **Dependencies and story role:** M08–M11 and M23–M25. Place the observer bit inside the complete two-field simulation task. -- **Conceptual connection:** The established coherent trajectory construction yields a linear-query full-field upper bound in the declared global code; it does not automatically give an efficient reduced-bath decoder. -- **Source pointers:** Watrous [§2.2.2][W2] for isometric representations; [general exact word code, (R4)](../science/resources.md#general-exact-word-code); [attribution to Shang–An–Shao](../references/RELATED_WORK.md#lindbladian-simulation-and-phase-estimation). +- **Central question:** Why does number dephasing erase the triple witness but preserve the pair and observer events? +- **Understanding target:** Distinguish total-number phase, bath-label coherence, within-sector temporal coherence and fully counted records, including the exact number-phase relation between the triple parity fields. +- **Dependencies and story role:** M02, M17–M18, M22 and M25. State each witness's physical boundary. +- **Conceptual connection:** Different measurements erase different information; the coherent-field triple result cannot be transferred to a number-superselected target. +- **Source pointers:** Watrous [§§2.2.3 and 2.3][W2W3] for the relevant channel, measurement or distance foundation; [tree number-dephasing limit](../science/reflection_tree.md); [pair count](../science/reflection_pair.md); [observer event](../science/noncommuting_observer.md). -### M27 · Which measurements erase the oracle information? +### M27 · Oracle savings and paid output work - **Phase:** Narrative/innovation. -- **Central question:** Why do classical counting records cost zero queries while the observer bit is hard? -- **Understanding target:** Distinguish complete single-mode number dephasing, multi-bath count-sector dephasing and fully measured time-resolved records, including their effects on reference correlations. -- **Dependencies and story role:** M02, M07, M10 and M22–M26. Connect the quantum and classical output tasks without conflating their measurements. -- **Conceptual connection:** The single-jump number basis is complete for its encoded mode; general number sectors still contain temporal coherence, which the observer projector detects. -- **Source pointers:** Watrous [§§2.2.3 and 2.3][W2]; [number dephasing, (P1)–(P3)](../science/interpretation.md#number-dephasing-removes-all-single-jump-field-information); [counting records](../science/model.md#counting-records). +- **Central question:** What remains to be implemented after an oracle saving? +- **Understanding target:** Compare chronological-word, compressed-endpoint and physical-field representations, charging compilation, output slots, encoding conversion and measurement work separately. +- **Dependencies and story role:** M10–M11, M15, M19 and M21–M26. Complete the common resource account. +- **Conceptual connection:** An oracle-independent embedding is not a free physical implementation; photon count and output writing need not shrink with queries. +- **Source pointers:** Watrous [§§2.1–2.2][W2W3] for the relevant channel, measurement or distance foundation; [resources](../science/resources.md); [reflection resource account](../science/reflection_threshold.md); [tree time-split measurement](../science/reflection_tree.md). -### M28 · Coherent drift inside a unitary jump +### M28 · Time, dimension and microscopic representation - **Phase:** Narrative/innovation. -- **Central question:** What does zero explicit Hamiltonian mean for the hard family? -- **Understanding target:** Interpret the exact decomposition of a near-identity unitary jump into coherent drift and Pauli dissipation, and explain why changing the jump representation changes the specified output dilation. -- **Dependencies and story role:** M04, M08 and M21–M23. Clarify the physical mechanism behind the inverse-time oracle comparison. -- **Conceptual connection:** A finite accumulated rotation can be transferred to observer temporal coherence even though the given microscopic representation has no separate Hamiltonian term. -- **Source pointers:** Watrous [§2.2.2][W2] for representation language; the generator identities and field qualification are supplied in [interpretation, (P11)–(P12)](../science/interpretation.md#zero-explicit-hamiltonian-does-not-remove-coherent-drift). +- **Central question:** Which qualifications prevent an unsupported general law? +- **Understanding target:** Separate the horizon-indexed observer from the fixed-rate reflection family; explain growing triple dimension, supplied primitive count, fixed field phases and possible coherent drift in general unitary jumps. +- **Dependencies and story role:** M04, M08, M17, M20 and M25–M27. Interpret the exact physical and asymptotic promises. +- **Conceptual connection:** Zero explicit Hamiltonian does not imply Hermitian jumps; primitive count is not intrinsic Lindblad rank, and growing-dimensional hardness is not a fixed-dimensional theorem. +- **Source pointers:** Watrous [§§2.2.2 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [drift and representation](../science/interpretation.md#zero-explicit-hamiltonian-does-not-remove-coherent-drift); [reflection limits](../science/reflection_threshold.md). -### M29 · Prior mechanisms and the surviving contribution +### M29 · Inherited mechanisms and shared-result ownership - **Phase:** Narrative/innovation. -- **Central question:** Which parts of the construction follow familiar simulation and estimation ideas, and which distinctions require the project's arguments? -- **Understanding target:** Credit ordinary phase estimation for fixed-error square-root scaling, typical-window centering and coherent trajectory preparation; identify the direct precision bound, specified field conversion and observer boundary separately. -- **Dependencies and story role:** M16–M20 and M23–M28. Integrate the comparison with prior work before assessing the result's scope. -- **Conceptual connection:** Equality of reduced channels does not by itself identify a physical complementary output or pay for its digital implementation. Research citations support attribution without adding another educational anchor. -- **Source pointers:** Watrous [§§2.2.2 and 3.3][W2W3]; [Gaussian and phase-estimation comparison](../science/gaussian_connection.md); [related work](../references/RELATED_WORK.md). +- **Central question:** Which steps are inherited, and which establish the field boundary? +- **Understanding target:** Credit phase estimation, typical windows, Poisson preparation, word cancellation and parity methods, then identify the pair witness, failed tree transfer and modified field construction. +- **Dependencies and story role:** M13–M28. Integrate attribution before the final synthesis. +- **Conceptual connection:** The sister owns the reduced-system geometry and original theorem; this repository owns the field-only proof. Equal exponents do not make their output witnesses interchangeable. +- **Source pointers:** Watrous [§§2.2 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [related work](../references/RELATED_WORK.md); [Gaussian comparison](../science/gaussian_connection.md); [reflection theorem](../science/reflection_threshold.md). ### M30 · The complete output-dependent boundary - **Phase:** Narrative/innovation. -- **Central question:** What changes when the requested output is a record, a coherent field, the system, or the observer bit? -- **Understanding target:** Reconstruct the zero, square-root and linear worst-case query comparison at fixed small error, identify its matching constructions and witnesses, and retain the digital-record resolution, horizon-indexed observer, oracle, reference and encoding qualifications. -- **Dependencies and story role:** M12 and M13–M29. Synthesize the narrative into one operational explanation. -- **Conceptual connection:** Information discarded by the task can remove a common accumulated rotation; retained temporal coherence can restore linear query cost. Query savings remain distinct from physical emission time, energy and arbitrary decoding cost. -- **Source pointers:** Watrous [§§2.2–2.3 and 3.3][W2W3]; [principal results](../README.md#principal-results), [interpretation](../science/interpretation.md), [resource boundaries](../science/resources.md#resource-boundaries) and [verification limits](../verification/README.md). +- **Central question:** How do the requested output and supplied jump promise determine cost? +- **Understanding target:** Reconstruct the unitary system/field/record comparison, mean-one observer obstruction and one/two/three-reflection field hierarchy, including witnesses, constructions, output charges and limits. +- **Dependencies and story role:** M12 and M13–M29. Synthesize the account into one operational explanation. +- **Conceptual connection:** Discarding the system can remove an accumulated rotation, while retained field coherence can preserve an answer; charged access and retained information determine the conclusion. +- **Source pointers:** Watrous [§§2.2–2.3 and 3.3][W2W3] for the relevant channel, measurement or distance foundation; [principal results](../README.md#principal-results); [reflection theorem](../science/reflection_threshold.md); [interpretation](../science/interpretation.md); [verification boundaries](../verification/README.md). ## Further detail within this route diff --git a/learning/watrous_bridge.md b/learning/watrous_bridge.md index 4288559..cc2c255 100644 --- a/learning/watrous_bridge.md +++ b/learning/watrous_bridge.md @@ -16,8 +16,10 @@ Use these sections as needed for the indicated project step. Reading the entire | [§3.1.1][W3] | Binary state discrimination | [Finite event gap, (O9)](../science/noncommuting_observer.md#a-uniform-constant-gap) | | [§3.2.1][W3] | Fidelity and pure-state overlap | [Truncation estimate, (C6)–(C7)](../science/centered_environment.md#reference-uniform-truncation-error) | | [§§3.3.1–3.3.3][W3] | Channel discrimination and completely bounded trace norm | [Reference-uniform accuracy, (M6)](../science/model.md#oracle-and-accuracy-conventions) | +| [§§2.1.3 and 3.1.1][W2W3] | Partial-trace invariance and a measurable output distinction | [Field-blind tree and modified field witness](../science/reflection_tree.md) | +| [§§2.3.1 and 3.3][W2W3] | Pulling known effects back to encoded channels | [Dark-port count and query hybrid](../science/reflection_pair.md) | -Watrous develops the finite-dimensional channel language used by the algorithms. The vacuum-field dynamics, Poisson concentration, query model and observer calculation are supplied in the project's scientific pages, with their own primary references. Their presence in the bridge does not attribute them to the textbook. +Watrous develops the finite-dimensional channel language used by the algorithms. The vacuum-field dynamics, Poisson concentration, query model, reflection-word geometry and field-witness calculations are supplied in the scientific pages, with their own primary references. Their presence in the bridge does not attribute them to the textbook. ## Notation and error conventions @@ -118,14 +120,78 @@ For one main photon there are two positions. The effect has eigenvalue one on th This yields the matching bit sampler. Sample the main count, prepare a uniform position register, coherently insert the known Pauli among exactly that many forward calls, and perform the effect. Count sampling is legitimate because this particular measurement is block diagonal in counts. The position superposition remains coherent. With a finite conditioned Poisson law, the omitted tail enters as a mixture of channels, giving a bound linear in its probability; it is a different error argument from coherent field truncation. The [direct sampler](../science/noncommuting_observer.md#matching-upper-bound-for-the-one-bit-task) proves the reference-uniform guarantee and its resource bounds. +## Reflection jumps and the sister project + +A reflection is a Hermitian unitary: $`R=R^\dagger`$ and $`R^2=I`$. It has only the two possible eigenvalues plus and minus one. A long sequence of identical reflection jumps therefore depends only on whether its count is even or odd. This restriction changes the generic single-unitary field cost from square-root time to one controlled call. The general unitary theorem and the reflection theorem concern different promised inputs. + +The sister [Quantum Dephasing Threshold](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold) establishes the constant/square-root/linear threshold when the reduced **system** channel is requested. Its [word reduction](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/blob/549582272ce6f5a3274be12de1bc5b2f16ed290e/science/pair-simulation.md) supplies the geometry used here. This repository owns the [field-only theorem](../science/reflection_threshold.md), including the physical field embedding and the separate field witnesses. The same educational anchor leads to different project-specific routes. + +### Which system simplifications preserve the field? + +With $`k`$ supplied reflections, fix $`L_j=R_j/\sqrt{k}`$, total rate one, zero explicit Hamiltonian, identity scattering and zero coupling phases. A phase-referenced controlled SELECT is supplied. The target retains every labelled field and discards the system, with arbitrary input references and half diamond error $`0.1`$. The [reflection theorem](../science/reflection_threshold.md) keeps this contract distinct from the single-unitary forward-oracle model. + +For one reflection, prepare the known coherent even/odd count amplitudes and apply $`R`$ on the odd branch. For two reflections, cancelling adjacent equal letters reduces each chronological word to an alternating word. The signed reduced endpoint behaves as a diffusive walk on a line, so a typical reduced length is of order $`\sqrt t`$. These operator identities apply separately to every trajectory amplitude. Retaining the original trajectory labels coherently preserves their interference; sampling the reduced endpoint would generally erase it. The lift of the sister's word identity is routine, rather than a new fast-forwarding primitive. + +Watrous supplies the distinction between an isometric representation and a classical mixture. The extra algorithmic step here is reversible word processing: compute the endpoint, apply its reduced word, then erase the endpoint work register. Truncating a coherent endpoint tail requires a square-root probability bound, just as in count centering. Known state preparation, output registers and embedding conversion are still charged separately. + +### A dark-port qubit example + +For two reflections, set + +```math +R_\pm=\cos\theta\,Z\pm\sin\theta\,X, +\qquad L_1=R_+/\sqrt2,\quad L_2=R_-/\sqrt2. +``` + +A known 50:50 mixing of the bath labels changes the couplings to + +```math +L_b=\cos\theta\,Z,\qquad L_d=\sin\theta\,X. +``` + +The dark bath is empty at $`\theta=0`$. Its photon count is Poisson with mean $`t\sin^2\theta`$ for every input; this follows because $`L_d^\dagger L_d=\sin^2\theta I`$. At $`\theta=t^{-1/2}`$, the probability of at least one dark photon remains separated from zero by a constant, whereas the oracle separation is at most $`t^{-1/2}`$. The [pair proof](../science/reflection_pair.md) converts this event gap into the matching square-root query lower bound. + +This is a physical field-only measurement. The final system is never read. Mixing bath labels and counting photons preserve total photon number, so the witness survives dephasing between different total-number sectors. In a chronological word encoding, the bath mixer is a known rotation on every photon label; its processing work is proportional to the represented word length. Zero additional unknown queries does not make that processing or the physical optical operation costless. + +### Why the original tree argument loses its answer + +The sister's original three-reflection construction carries unknown bit parity in a system answer register on a branching tree. From a fixed root input, a change of system coordinates $`G_x`$ removes the unknown edge bits, and it fixes that input. The joint output then differs from the known instance only by $`G_x`$ on the final system. Watrous's partial-trace identity immediately implies that the retained field is exactly unchanged. The system lower bound alone therefore supplies no field lower bound on this input. + +The [field proof](../science/reflection_tree.md) replaces the missing leaf transitions by known $`Z`$ actions on the answer qubit. There are still three reflection types with fixed rates $`1/3`$. Removing the edge bits now leaves a sign on leaf-loop emissions determined by the full parity. Within each known endpoint subspace the field is a pure vector. The trace distance of the two full fields is the sum of these subspace weights times their pure-state trace distances. This is a direct use of the textbook's distinguishability and pure-overlap formulas; the tree walk, conditional loop count and local-time estimate are supplied by the project. + +The proof gives a field half trace distance at least $`0.5071203359`$. Its oracle reduction uses two bit queries for each controlled SELECT, so the standard parity lower bound yields linear reflection-query cost. The hard dimension grows as $`\exp(\Theta(t))`$. A late-interval measurement of vacuum/one-photon coherence provides an explicit alternative to a general field-state discrimination measurement; its time-splitting map is derived in the same scientific page. + +### Which coherence matters? + +The three main witnesses retain different coherence: + +| Witness | Retained field information | Effect of total-number dephasing | +|---|---|---| +| Mean-one observer | Temporal coherence within its one-photon sector | The lower-bound event survives. | +| Two-reflection dark port | Coherence between bath labels before the fixed mixer | The dark-count lower bound survives. | +| Modified three-reflection tree | Coherence between total photon numbers | The two parity outputs become identical. | + +The last statement is exact. For the two parity field states of the tree witness, + +```math +\rho_1=e^{i\pi N_{\mathrm{total}}}\rho_0e^{-i\pi N_{\mathrm{total}}}. +``` + +Complete total-number dephasing removes this distinction. The triple result therefore concerns the specified coherent, phase-referenced field. It does not establish a linear lower bound for number-dephased fields or for fixed system dimension. The phases are fixed physical input data; an unknown-dependent choice of output embedding cannot remove them. + +The field threshold and the sister system threshold share a geometry, but their lower-bound outputs have to be checked separately. This is the main conceptual exchange between the two projects. The [30-milestone map](milestones.md) joins it to the original unitary-jump and observer results without counting the routine upper-bound lift as an independent discovery. + ## Connecting the outcomes and the prior work At fixed small error, classical counting records for the single-jump model require zero unknown-unitary queries at a chosen digital resolution. The worst-case query cost grows as the square root of the mean count for the coherent field and linearly in that mean for the reduced system. Adding the specified known noncommuting observer gives a one-bit task with worst-case linear query cost in time. The first distinction concerns what information is discarded. The second concerns the temporal coherence retained by a particular measurement. Ordinary forward phase estimation already explains the fixed-error square-root scale of the single-field complement. Earlier work also provides typical-window centering, Gaussian phase-clock purifications and coherent trajectory preparation. The project's [related-work account](../references/RELATED_WORK.md) attributes those mechanisms. The direct Poisson argument adds its explicit precision dependence and resource account in the stated model, while the observer construction supplies the bounded-output obstruction and matching sampler. The [Gaussian comparison](../science/gaussian_connection.md) exhibits a known output conversion and distinguishes it from an uncharged finite implementation. +The reflection-field threshold adds a different restriction to this output comparison: the supplied primitives are Hermitian involutions at equal fixed rates. Its upper lift uses inherited word cancellation, while its pair and modified-tree lower witnesses must remain field-visible after the system is discarded. The [reflection theorem](../science/reflection_threshold.md) and the sister's reduced-system theorem state their respective tasks and proof ownership. Their matching exponents do not imply that a system witness automatically transfers to its complementary output. + These primary research citations support the scientific claims. Watrous remains the sole educational anchor. The [milestone map](milestones.md) joins its foundations to the supplied derivations, ending with the scope of the complete output-dependent comparison. Numerical reproduction in [verification](../verification/README.md) checks finite instances and independent formulations; the analytical pages establish the uniform and asymptotic claims. [W]: https://cs.uwaterloo.ca/~watrous/TQI/ [W2]: https://cs.uwaterloo.ca/~watrous/TQI/TQI.2.pdf [W3]: https://cs.uwaterloo.ca/~watrous/TQI/TQI.3.pdf +[W2W3]: https://cs.uwaterloo.ca/~watrous/TQI/ diff --git a/llms.txt b/llms.txt index e9fe28c..70deedd 100644 --- a/llms.txt +++ b/llms.txt @@ -1,6 +1,8 @@ # Quantum Environment Fast Forwarding -This repository studies the query cost of the specified vacuum output of zero-Hamiltonian Lindblad dynamics with unitary jumps. The system is discarded; arbitrary untouched input references are preserved. Access is through phase-referenced controlled forward unitary oracles. Error means half diamond distance. +This repository studies the query cost of the specified vacuum output of zero-Hamiltonian Lindblad dynamics with unitary jumps. The system is discarded; arbitrary untouched input references are preserved. The general unitary construction uses phase-referenced controlled forward calls. The reflection subclass supplies controlled SELECT at equal fixed rates and has a constant/square-root/linear worst-case field hierarchy for one/two/three supplied reflections. Error means half diamond distance. + +Sister: https://github.com/GoGoKo699/Quantum-Dephasing-Threshold. It owns the reflection-word geometry and original reduced-system threshold. This repository owns the field-only reflection theorem, physical field embedding and separate field witnesses. The original system tree's root-input field is exactly independent of its hidden bits; the leaf-Z modification is required to prove the field lower bound. Preserve this ownership and failed-transfer explanation rather than treating equal time exponents as the same operational result. ## Scientific route @@ -8,6 +10,9 @@ This repository studies the query cost of the specified vacuum output of zero-Ha - science/model.md: fixed Hudson–Parthasarathy vacuum dilation, oracle contract, chronological trajectories and exact field encodings. - science/centered_environment.md: removal of a common system power, input-independent Poisson truncation, commuting jumps and the single-jump lower bound. - science/noncommuting_observer.md: one-photon temporal-mode kernel, explicit constant gap, hybrid lower bound, measurement pullback and matching one-bit sampler. +- science/reflection_threshold.md: fixed-rate phase-referenced reflection model, one/two/three field-only theorem, routine coherent word-reduction upper bounds and separate output-resource accounting. +- science/reflection_pair.md: fixed bath mixer, tilted qubit reflections, Poisson dark-port count and square-root field-only query lower bound. +- science/reflection_tree.md: exact field blindness of the original system witness, modified leaf-Z reflections, endpoint field states, leaf occupation bound, parity query reduction and total-number-dephasing limitation. - science/gaussian_connection.md: exact fixed representation change from a Gaussian phase clock to the unitary-jump complementary output, with its distinct access requirements. - science/resources.md: count loading, classical compilation and storage, finite-precision gates, individual oracles versus SELECT, and representation-dependent costs. - science/interpretation.md: relation among system, field and measured-record outputs, established reduced-system benchmark and physical meaning. @@ -19,9 +24,9 @@ This repository studies the query cost of the specified vacuum output of zero-Ha The single educational anchor is John Watrous, The Theory of Quantum Information (Cambridge University Press, 2018). The author page is https://cs.uwaterloo.ca/~watrous/TQI/. The book supplies finite-dimensional channels, Stinespring representations, measurements and state/channel distance. The project's field model, finite-window algorithms and query arguments are developed in the repository. -- Story route: README.md, then science/model.md, science/centered_environment.md, science/noncommuting_observer.md and science/interpretation.md. Track which output is retained and what each query can access. +- Story route: README.md, then science/model.md, science/centered_environment.md, science/noncommuting_observer.md, science/reflection_threshold.md and science/interpretation.md. Track the retained output, the general-unitary/reflection promise and what each query accesses. - Study route: learning/README.md, learning/watrous_bridge.md and learning/milestones.md. The common map has exactly 30 milestones: M01–M12 are background/preliminaries and M13–M30 are narrative/innovation. Its targets and dependency order belong to the project. -- Theorem route: science/model.md for the contract; science/centered_environment.md for the uniform-reference upper and lower bounds; science/noncommuting_observer.md for the kernel, bounded event and exact one-bit sampler; science/resources.md for the complete resource account. +- Theorem route: science/model.md for the general contract; science/centered_environment.md for the single-unitary bounds; science/noncommuting_observer.md for the kernel, event and exact bit sampler; science/reflection_threshold.md for its separate fixed-rate controlled-SELECT contract and proof routes; science/resources.md for general preparation costs. - Source comparison route: references/RELATED_WORK.md and science/gaussian_connection.md. Separate Watrous's foundational role from research citations for phase estimation, typical-window compression, coherent trajectory preparation and output metrology. - Reproduction route: verification/README.md, verification/requirements.txt and verification/audit_environment.py. Finite computations support the written proofs within the documented scope. @@ -33,6 +38,14 @@ Why can the field be simulated with square-root query cost? Read the centering l Why does a weak observer restore linear cost? Read the exact temporal-mode event, constant gap and insertion-position interpretation in science/noncommuting_observer.md. +Does every pair of reflections have linear field cost? No. The universal pair bound is square-root in time; the observer's unknown jump is a general unitary. See science/reflection_threshold.md. One reflection has the stronger constant-query parity reduction. + +Why does the pair lower bound survive tracing out the system? A fixed bath beamsplitter produces a Poisson dark count of mean t sin²(theta), which is directly measurable in the field. See science/reflection_pair.md. This measurement preserves total photon number. + +Why is the original three-reflection system lower bound insufficient? Its unknown prefix-parity coordinate change fixes the root input and acts only on the discarded final system, leaving that entire field unchanged. The replacement leaf-Z loops in science/reflection_tree.md make full parity field-visible without adding a fourth jump or changing rates. + +Does the modified triple prove hardness without a phase reference? No. Its odd-parity field is the even-parity field conjugated by exp(i pi N_total). Total-number dephasing makes them identical. The coherent-field proof also uses dimension exp(Theta(t)); no fixed-dimension linear law is established. + Does this require many observer photons or an unbounded observable? No. The hard family has observer mean count one and uses a photon-number-conserving projector. The observer rate is horizon dependent, 1/t. Can the same result be inferred from photon counting? The complete classical marked counting process is independent of the unknown unitaries. The relevant quantum coherences are specified in science/model.md and science/interpretation.md. @@ -43,8 +56,8 @@ What is charged? Unknown-unitary queries, known gates, classical preparation/sto What is already known? Read references/RELATED_WORK.md. Typical phase windows, Gaussian phase clocks, system-channel simulation and output metrology are inherited ingredients. The project does not claim priority for their general principles. -How are the formulas checked? Install verification/requirements.txt and run verification/audit_environment.py. Its explicit validation failures remain active under Python optimization. The committed results are finite numerical and exact-arithmetic checks, not proofs of general complexity statements. +How are the formulas checked? Install verification/requirements.txt and run verification/audit_environment.py for the original environment checks; verification/README.md gives the reflection-field commands and their finite scope. The committed results are finite numerical and exact-arithmetic checks, not proofs of general complexity statements. ## Interpretation constraints -Keep the fixed dilation, controlled-oracle phase convention, discarded system, reference-uniform error, horizon-indexed observer rate and field encoding attached to each claim. Do not infer physical emission speed, optimal precision dependence, or universal hardness of noncommuting jumps. Do not transfer the bath trace to a label-deletion operation. The H=0 parameter in the specified dilation does not remove coherent drift after changing the Lindblad representation. +Keep the fixed dilation, controlled-oracle phase convention, discarded system, reference-uniform error and declared field encoding attached to every claim. Distinguish the horizon-indexed observer rate from the equal fixed reflection rates, and supplied primitive count from intrinsic Lindblad rank. The tree's dimension and photon-number coherence are load-bearing. Do not infer physical emission speed, optimal precision dependence, universal noncommuting hardness or cheap encoding conversion. A pair's explicit chronological output can require linear output work despite square-root oracle calls. Do not transfer a physical bath trace to label deletion. The H=0 parameter does not remove coherent drift for general unitary jumps after changing representation; the reflection theorem additionally promises Hermitian involutions. diff --git a/references/RELATED_WORK.md b/references/RELATED_WORK.md index 81b4cd9..fa76d0a 100644 --- a/references/RELATED_WORK.md +++ b/references/RELATED_WORK.md @@ -40,6 +40,18 @@ The resulting $`\Omega(t)`$ query requirement identifies a boundary of the compl The condition $`H=0`$ fixes the stated microscopic coupling but does not remove coherent drift: $`\mathrm{Ad}_{e^{-i\theta X}}-\mathrm{id}=-i\theta[X,\cdot]+O(\theta^2)`$. At $`\theta=O(1/t)`$ the accumulated rotation remains finite. The observer transfers this sensitivity into temporal coherence of its emitted field. The result is an oracle-complexity boundary with a mean-one output and an explicit number-conserving test, not a new temporal metrology scaling law. +## Reflection primitives and the sister system task + +[Quantum Dephasing Threshold](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold) studies the reduced-system channel generated by one, two or three supplied Hermitian involutions at fixed total rate. Its [source commit 5495822](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/tree/549582272ce6f5a3274be12de1bc5b2f16ed290e) supplies the parity endpoint for one reflection, the alternating-word/Skellam line for two, and the branching-tree parity scaffold for three. Its original lower bound is a system-output result. + +The [field theorem](../science/reflection_threshold.md) fixes the same reflection rates and phase-referenced SELECT access inside this repository's specified HP vacuum dilation. The coherent upper bounds are routine lifts of the sister's cancellation identities and established Poisson-word preparation [Shang, An and Shao, Appendix B.1, Eqs. (51)–(53)]. They are credited as such. The count/word embedding and its separate output costs remain explicit. + +The field-only converses require more. A [qubit pair](../science/reflection_pair.md) produces an exact dark-port Poisson signal after a known passive bath mixing. For three reflections, the original tree's root-input field is exactly independent of every hidden bit: its edge labels are a system-coordinate gauge that fixes the input and disappears under the system trace. A [known leaf-Z modification](../science/reflection_tree.md) exposes the full parity in the coherent field, while retaining exactly three Hermitian involutions and rates $`1/3`$. The resulting linear lower bound uses target dimension $`\exp(\Theta(t))`$. Its witness loses all parity information under total-photon-number dephasing, unlike the pair counting witness. + +These new field witnesses and the failed-transfer diagnosis have their authoritative proof home here. The sister retains its independently readable system theorem and the field consequence, with explicit pointers rather than a duplicate full proof. A common worst-case exponent does not identify the system and field tasks, determine a unique Lindblad representation, or imply the same dimension and phase-reference qualifications. + +The lower-bound method inherits the dissipative parity-reduction strategy of [Childs and Li](https://arxiv.org/abs/1611.05543), and the quantum parity bound of [Beals et al.](https://arxiv.org/abs/quant-ph/9802049). The latter bound applies to arbitrary coherent and adaptive query algorithms, once the complete controlled SELECT is compiled into two ordinary bit queries. The elementary gauge identity is consistent with the established output-equivalence theory of [Guţă and Kiukas](https://arxiv.org/abs/1402.3535); their ergodic/stationary identification problem and local asymptotic normality do not state this finite-distance, growing-dimension, three-reflection oracle theorem. Gauge invariance and generic output-sensitivity methods are inherited foundations. + ## Access and output conventions The phase-referenced controlled oracle and the fixed output dilation are part of the problem definition. A reduced Lindblad generator alone does not specify an absolute field-phase convention. In the one-jump model, dephasing the output completely in photon number removes its dependence on $`U`$; this is a different target from the coherent complementary channel. diff --git a/references/references.bib b/references/references.bib index 3df7716..58ad814 100644 --- a/references/references.bib +++ b/references/references.bib @@ -225,3 +225,51 @@ @article{shang2026exponential primaryClass = {quant-ph}, note = {Author manuscript: arXiv:2509.09517v2, 22 May 2026} } + +@misc{lin2026dephasingthreshold, + author = {Lin, Ruge}, + title = {Quantum Dephasing Threshold}, + year = {2026}, + howpublished = {Research repository}, + url = {https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/tree/549582272ce6f5a3274be12de1bc5b2f16ed290e}, + note = {Pinned source commit 549582272ce6f5a3274be12de1bc5b2f16ed290e; involution-word geometry and reduced-system parity scaffold} +} + +@article{childs2017markovian, + author = {Childs, Andrew M. and Li, Tongyang}, + title = {Efficient simulation of sparse {Markovian} quantum dynamics}, + journal = {Quantum Information and Computation}, + volume = {17}, + number = {11--12}, + pages = {901--947}, + year = {2017}, + doi = {10.26421/QIC17.11-12}, + eprint = {1611.05543}, + archivePrefix = {arXiv}, + url = {https://arxiv.org/abs/1611.05543v3}, + note = {Author version 3, 9 October 2023; Section 7 gives the dissipative parity-reduction antecedent} +} + +@article{beals2001polynomials, + author = {Beals, Robert and Buhrman, Harry and Cleve, Richard and Mosca, Michele and de Wolf, Ronald}, + title = {Quantum Lower Bounds by Polynomials}, + journal = {Journal of the ACM}, + volume = {48}, + number = {4}, + pages = {778--797}, + year = {2001}, + doi = {10.1145/502090.502097}, + eprint = {quant-ph/9802049}, + archivePrefix = {arXiv}, + url = {https://arxiv.org/abs/quant-ph/9802049} +} + +@misc{guta2014equivalence, + author = {Gu{\c{t}}{\u{a}}, M{\u{a}}d{\u{a}}lin and Kiukas, Jukka}, + title = {Equivalence classes and local asymptotic normality in system identification for quantum {Markov} chains}, + year = {2014}, + eprint = {1402.3535}, + archivePrefix = {arXiv}, + url = {https://arxiv.org/abs/1402.3535}, + note = {Output-identifiability and system-coordinate gauge context} +} diff --git a/science/interpretation.md b/science/interpretation.md index 649d2db..74600ff 100644 --- a/science/interpretation.md +++ b/science/interpretation.md @@ -157,6 +157,14 @@ Over time $`t`$, the main jumps can therefore produce a finite coherent rotation Equations (P11) and (P12) are identities of the reduced generator. Shifting a jump by an identity changes the specified field dilation. In particular, a displacement depending on the unknown $`\theta`$ is not a free oracle-independent encoding change. The simulation task and its access model remain those of the original coupling $`L=U_\theta`$, with the known observer $`t^{-1/2}Z`$. +## Hermitian reflection primitives and field-only information + +Restricting every supplied jump to a reflection changes the single-primitive field law from square-root time to a constant query count: only photon-count parity changes its system action. For an arbitrary pair, coherent cancellation leaves a diffusive line endpoint. Three reflections can already retain a parity computation in their field. The [reflection theorem](reflection_threshold.md) fixes the common physical and oracle contract and proves the constant/square-root/linear worst-case hierarchy. + +The system and field lower witnesses must be distinguished. In the sister's original tree, the unknown answer at each endpoint is removable by a system-coordinate change fixing the root input, so its emitted field has no hidden-bit dependence. Replacing missing leaf transitions by a known $`Z`$ makes the field keep the parity through interference between photon-number sectors. This is a new specified dilation with a field-visible signal, not a consequence of simply discarding the system in the old proof. + +The [pair dark-port witness](reflection_pair.md) uses number-conserving bath mixing and counting. The [triple witness](reflection_tree.md) requires the declared field phase reference; complete total-number dephasing makes its parity states identical. The three-reflection linear lower bound also requires a target dimension growing exponentially in time. These limitations coexist with exactly fixed rates $`1/k`$ and zero Hamiltonian. + ## Reference - **[GJL26]** M. Gao, Z. Ji, and C. Liu, “Lévy–Khintchine Structure Enables Fast-Forwardable Lindbladian Simulation,” *Physical Review Letters* **137**, 160405 (2026). [DOI](https://doi.org/10.1103/qy4b-gzlq), [arXiv:2511.10253v2](https://arxiv.org/abs/2511.10253v2), Secs. III–IV and Appendices C.3 and D.2. diff --git a/science/model.md b/science/model.md index 5851c21..0161ac9 100644 --- a/science/model.md +++ b/science/model.md @@ -133,6 +133,8 @@ The full-field query upper bound uses (M9) in this exact global code. The observ An encoding is a representation of a state, not a proposal to emit its photons. The number-register algorithm may represent a field with mean photon number of order $`t`$ using logarithmically many qubits. No statement here reduces the optical energy, physical emission time, or cost of an arbitrary field decoder. The gate bound for the centered algorithm refers to the count code. Converting that output to a word list can require a number of output registers proportional to the mean photon count, even though the conversion uses no unknown-unitary queries. +For phase-fixed Hermitian involutions with equal rates, the [reflection threshold](reflection_threshold.md) specializes this output contract and declares controlled SELECT explicitly. Its field-only lower bounds do not follow merely from reduced-system hardness. + ## Counting records For unitary jumps, the norm of every conditional system trajectory is independent of its label word and times. Consequently, direct time-resolved photon counting gives independent Poisson point processes of rates $`\lambda_j`$, regardless of the $`U_j`$ and the input state. Coherent field output retains off-diagonal matrix elements between trajectories. These are the information used by the results below. diff --git a/science/reflection_pair.md b/science/reflection_pair.md new file mode 100644 index 0000000..f06b06c --- /dev/null +++ b/science/reflection_pair.md @@ -0,0 +1,150 @@ +# Field-only lower bound for two qubit reflections + +The [reflection theorem](reflection_threshold.md) has a matching pair lower bound already on a qubit. A fixed mixing of the two physical bath labels turns their unknown angle into a photon-count signal. + +## Fixed physical and oracle contract + +Use the identity-scattering Hudson–Parthasarathy vacuum dilation on two +independent bosonic baths over $`[0,t]`$, with $`H=0`$ and phase-fixed jumps + +```math +\begin{aligned} +R_\pm(\theta)&=\cos\theta\,Z\pm\sin\theta\,X,\\ +L_1&=R_+(\theta)/\sqrt2,\qquad L_2=R_-(\theta)/\sqrt2. +\end{aligned} +``` + +Both supplied primitives are Hermitian involutions. Their rates are exactly +$`1/2`$, so the total rate is one for every value of the parameter. The simulator +receives the phase-referenced controlled SELECT oracle for this ordered pair; +the comparison permits inverse calls, which coincide with forward calls. +The final system is discarded and the full two-bath field is retained. The +physical-field embedding is the oracle-independent chronological-word +embedding specified in [the model](model.md#exact-trajectory-expansion), not an oracle-dependent output +relabeling. The lower bound needs no special input state and therefore applies +also to the stronger reference-preserving half-diamond task. + +## Physical dark-count witness + +Apply the fixed, time-local 50:50 beamsplitter between bath labels. Its second +quantization is a photon-number-preserving, oracle-independent field unitary. +Equivalently, change the bath coordinates by the real orthogonal matrix + +```math +\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}. +``` + +The same HP evolution in these coordinates has bright and dark jumps + +```math +L_b=(L_1+L_2)/\sqrt2=\cos\theta\,Z,\qquad +L_d=(L_1-L_2)/\sqrt2=\sin\theta\,X. +``` + +Consequently $`L_b^\dagger L_b=\cos^2\theta\,I`$ and +$`L_d^\dagger L_d=\sin^2\theta\,I`$. The marked dark count is exactly Poisson with mean +$`t\sin^2\theta`$, independently of the initial system state and of any untouched +reference. One rigorous derivation uses the count generating operator: + +```math +\mathcal K_z(\rho)=\cos^2\theta\,Z\rho Z + +z\sin^2\theta\,X\rho X-\rho. +``` + +Taking the trace gives + +```math +\frac{d}{dt}\mathrm{Tr}e^{t\mathcal K_z}(\rho) + =\sin^2\theta(z-1)\mathrm{Tr}e^{t\mathcal K_z}(\rho), +\qquad +\mathbb E z^{N_d}=e^{t\sin^2\theta(z-1)}. +``` + +Thus the field-only event “at least one dark photon” has probability + +```math +p_\theta=1-e^{-t\sin^2\theta},\qquad p_0=0. +``` + +This test includes all temporal modes in the dark bath. It neither uses the +discarded system nor assumes a time-bin approximation. It needs coherence +between the two bath labels, which the physical beamsplitter accesses, but no +coherence measurement between distinct total-photon-number sectors. + +## Oracle lower bound + +For $`t\geq1`$, choose $`\theta=t^{-1/2}`$. Since $`\sin(x)/x`$ decreases on $`(0,1]`$, + +```math +t\sin^2(t^{-1/2})\ge\sin^2 1,\qquad +p_\theta\ge g_d:=1-e^{-\sin^2 1}>0. +``` + +The operator norm distance of the two SELECT oracles, including an additional +coherent control, is + +```math +\delta=\max_\pm\|R_\pm(\theta)-Z\| +=2\sin(\theta/2)\le\theta. +``` + +A query-by-query hybrid bounds the trace distance of the outputs of any +branchwise $`q`$-query algorithm by $`q\delta`$, including adaptive algorithms. +If it simulates both physical field channels within half-diamond error +$`\epsilon`$, applying the fixed field event and the triangle inequality yields + +```math +q\delta\ge g_d-2\epsilon,\qquad +q\ge(g_d-2\epsilon)\sqrt t. +``` + +For every fixed $`\epsilon\lt g_d/2`$, this proves an $`\Omega(\sqrt t)`$ field-only +lower bound in dimension two. Combined with the separately justified routine +coherent word-reduction upper bound, it establishes the matching two-reflection +fixed-error exponent. The distinct [three-reflection converse](reflection_tree.md) uses a growing tree and photon-number coherence. + +## Independent coherent-projector cross-check + +For input $`|0\rangle`$, let $`|\alpha_t\rangle`$ be the physical product coherent state having +amplitude $`+1/\sqrt2`$ throughout $`[0,t]`$ in each original bath. The exact +trajectory expansion implies + +```math +\langle\alpha_t|V_\theta|0\rangle +=e^{t[(R_++R_-)/2-I]}|0\rangle +=e^{-t(1-\cos\theta)}|0\rangle. +``` + +Its projector therefore has probability $`\exp[-2t(1-\cos\theta)]`$, equal to +one at $`\theta=0`$. This is a second field-only witness with a constant gap at +$`\theta=t^{-1/2}`$. The dark-count witness above has the cleaner physical +interpretation because its test preserves total photon number. + +## Resource boundaries and attribution + +The fixed field rotation and dark counting require zero unknown-reflection +queries. This is a query-complexity lower bound, not a gate or emission-time +bound. Applying a physical beamsplitter to a horizon-$`t`$ field, counting photons, +preparing a digital word code, producing an explicit photon list, converting +between encodings and emitting the physical field have separate costs. +The word-code embedding is an exact representation; it does not supply free +physical decoding. In the original chronological-word code the beamsplitter +acts as the known two-letter rotation on every photon label; explicitly +processing a length-$`N`$ word costs $`O(N)`$ such known label gates. Its action +cannot be replaced by deleting one original bath label. + +The coherent trajectory expansion, covariance under a fixed bath rotation, +Poisson counting for scalar jump intensities and the query hybrid are standard +ingredients. The new calculation here is their specific field-only witness +for the pair of reflections, which survives tracing out the final system. +It must be credited separately from the inherited routine upper-bound lift. + +## Numerical diagnostics + +[check_reflection_pair.py](../verification/check_reflection_pair.py) compares the full tilted jump generator against the +Poisson generating function at real and complex test points; resolves photon +probabilities using a block count master equation; tests four qubit inputs and +an input entangled with an untouched reference; and checks the independent +coherent-projector formula against an exponential and a finite Poisson +word-average series. The JSON result records errors and dependency versions. +These finite checks supplement, and do not replace, the analytic proof above. diff --git a/science/reflection_threshold.md b/science/reflection_threshold.md new file mode 100644 index 0000000..7a0f2d7 --- /dev/null +++ b/science/reflection_threshold.md @@ -0,0 +1,186 @@ +# Reflection primitives and the coherent-field threshold + +The number of supplied reflection primitives controls the worst-case query cost of the specified coherent field. This is the field-output counterpart of [Quantum Dephasing Threshold](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold): the word-reduction upper bounds transfer coherently, but the lower bounds require measurements of the retained field. + +This page owns the field theorem and its upper-bound/resource account. The [qubit pair witness](reflection_pair.md) and [three-reflection tree witness](reflection_tree.md) give the converse proofs. The sister repository owns the original reduced-system theorem, involution-word geometry and tree parity scaffold; its [source version](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/tree/549582272ce6f5a3274be12de1bc5b2f16ed290e) fixes those inherited ingredients. + +## Fixed physical output and oracle contract + +For $`k\in\{1,2,3\}`$ supplied Hermitian involutions, fix + +```math +\begin{aligned} +R_j&=R_j^\dagger,\qquad R_j^2=I,\\ +L_j&=\frac{R_j}{\sqrt{k}},\qquad +H=0,\qquad \lambda_j=\frac1k. +\end{aligned} +\qquad\text{(R1)} +``` + +The total jump rate is one. Time $`t`$ is physical time multiplied by that total rate. Use separate labelled bosonic fields, vacuum input, identity scattering and the Hudson–Parthasarathy convention in [model.md](model.md). The displayed matrices, including their signs, fix the jump phases; they are not supplied only modulo a global phase. + +The target is the entire emitted field, after discarding the final system, + +```math +\Gamma_{t,R}(\rho)=\mathrm{Tr}_S[V_{t,R}\rho V_{t,R}^\dagger]. +\qquad\text{(R2)} +``` + +The input may be entangled with an untouched reference. Accuracy means [half diamond distance](model.md#oracle-and-accuracy-conventions). + +The oracle is the phase-referenced coherent selection + +```math +S_R=\sum_{j=1}^k|j\rangle\langle j|\otimes R_j. +\qquad\text{(R3)} +``` + +One call to SELECT, its inverse, or an externally controlled version costs one query. Unused binary labels act as identity. Since the supplied matrices are reflections, inverse SELECT equals SELECT. Algorithms may use arbitrary known operations, ancillas, randomness, measurements and adaptive control; the number of serial calls is bounded on every branch. No matrix description, power oracle or oracle-dependent encoding is supplied. + +Fix the exact chronological-word physical embedding from (M8) of [the model](model.md#exact-trajectory-expansion): + +```math +\begin{aligned} +J_t|N,w\rangle +&=\sqrt{\frac{N!}{t^N}} + \int_{0\lt s_1\lt\cdots\lt s_N\lt t} + |\mathbf s,w\rangle\,d^N\mathbf s,\\ +V_{t,R}|\psi\rangle +&=\sum_{N=0}^{\infty}\sum_{w\in[k]^N} + \sqrt{\frac{e^{-t}t^N}{N!k^N}}\, + R_{w_N}\cdots R_{w_1}|\psi\rangle\otimes J_t|N,w\rangle . +\end{aligned} +\qquad\text{(R4)} +``` + +This embedding is independent of the unknown reflections. It includes every ordered emission time without a time grid and generally does not factor across baths. Deleting labels is not a physical bath trace. + +## The field theorem + +Let $`Q_k^F(t,\epsilon)`$ be the supremum, over finite target dimensions, of the least worst-case query cap for a simulator of (R2), uniformly over all legal tuples of that dimension. Tuples may include repeated reflections and identity. At $`\epsilon=0.1`$ and every real $`t\geq1`$, + +```math +\boxed{ +Q_1^F(t,0.1)=1,\qquad +Q_2^F(t,0.1)=\Theta(\sqrt t),\qquad +Q_3^F(t,0.1)=\Theta(t). +} +\qquad\text{(R5)} +``` + +The same time exponents hold for every smaller fixed positive error, with constants allowed to depend on it. + +| Primitives | Coherent upper mechanism | Field-only converse | +|---|---|---| +| One | Count parity; at most one controlled reflection | Qubit even/odd coherence | +| Two | Coherently cancel words to a line endpoint | Qubit dark-port photon count | +| Three | Coherent Poisson trajectory preparation | Modified leaf-phase tree, dimension exponential in time | + +This counts supplied oracle primitives, not an invariant Lindblad rank. The three-reflection converse uses dimension $`\exp(\Theta(t))`$ and gives no fixed-dimension long-time linear lower bound. No optimal joint time-and-precision law is claimed. The sister's reduced-system theorem uses unhalved diamond error $`0.01`$; (R5) uses the convention of this repository explicitly. + +## Routine coherent word reduction + +The cancellation $`R_jR_j=I`$ does not alter any field register. Let $`g=\mathrm{red}(w)`$ be the abstract reduced word and $`W_g`$ its represented operator. Grouping the orthonormal word states in (R4) gives + +```math +\begin{aligned} +p_g(t)&=\sum_{\substack{N,w:\\\mathrm{red}(w)=g}} + \frac{e^{-t}t^N}{N!k^N},\\ +|\chi_g(t)\rangle +&=\frac1{\sqrt{p_g(t)}} + \sum_{\substack{N,w:\\\mathrm{red}(w)=g}} + \sqrt{\frac{e^{-t}t^N}{N!k^N}}\,J_t|N,w\rangle,\\ +V_{t,R} +&=\sum_g\sqrt{p_g(t)}\,W_g\otimes|\chi_g(t)\rangle . +\end{aligned} +\qquad\text{(R6)} +``` + +Terms with zero weight are omitted. The $`\chi_g`$ are orthonormal and independent of the unknown matrices. The abstract grouping remains valid even when the actual tuple has additional relations. + +Equation (R6) is a direct coherent version of the sister's [word cancellation identity](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/blob/549582272ce6f5a3274be12de1bc5b2f16ed290e/science/pair-simulation.md), combined with known coherent Poisson preparation [SAS26, Appendix B.1, Eqs. (51)–(53)]. It is a routine upper-bound lift. Measuring or sampling $`g`$, or discarding reduction garbage, would generally remove coherences required by the field target. + +For one reflection, $`g`$ is just even or odd parity. Its weights are + +```math +p_{\rm e}=\frac{1+e^{-2t}}2,\qquad +p_{\rm o}=\frac{1-e^{-2t}}2. +\qquad\text{(R7)} +``` + +Prepare their known amplitudes and apply $`R`$ on the odd branch. This uses one controlled query, even for the joint isometry in the two-fibre encoding. + +For two reflections $`A,B`$, the abstract Cayley graph is a line. Give its endpoint a signed integer coordinate $`s`$, with known maps + +```math +T_A(s)=s+(-1)^s,\qquad +T_B(s)=s-(-1)^s. +\qquad\text{(R8)} +``` + +Uniform independent labels induce a symmetric continuous-time random walk on this line. Its law is $`p_s(t)=e^{-t}I_{|s|}(t)`$, and the reduced alternating word has length $`|s|`$. The inherited Bernstein tail estimate is + +```math +\Pr\{|S_t|\geq\sqrt{2tu}+u\}\leq2e^{-u}. +\qquad\text{(R9)} +``` + +For a coherent restriction to $`|s|\lt M`$ with omitted probability $`\delta`$, normalizing the retained amplitudes gives an isometry whose overlap with the exact isometry is $`\sqrt{1-\delta}`$, uniformly on every reference-assisted input. The resulting half diamond error is at most $`\sqrt\delta`$. Taking $`u=\log(C/\epsilon^2)`$ for a sufficiently large absolute constant $`C`$ yields + +```math +q=O\!\left(\sqrt{t\log(1/\epsilon)}+\log(1/\epsilon)\right). +\qquad\text{(R10)} +``` + +For three reflections, the general [coherent word construction](resources.md#general-exact-word-code) with a Poisson count cutoff gives $`O(t+\log(1/\epsilon))`$ queries. + +## An explicit output implementation and its separate costs + +The compressed fibre code in (R6) is legitimate because its embedding is known and oracle independent. That statement does not supply a cheap physical implementation of $`|g\rangle\mapsto|\chi_g(t)\rangle`$. A concrete simulator can instead retain the original count-and-word code throughout: + +1. Prepare the normalized coherent Poisson count up to $`N_{\max}=O(t+\log(1/\epsilon))`$, with coherent labels in padded slots. +2. For a pair, reversibly compute $`s`$ from the word. Apply $`W_s`$ when $`|s|\lt M`$, and identity otherwise. +3. Uncompute $`s`$ from the retained word. Discard only the final system and clean auxiliary registers. + +Every output word and its coherence are retained. Replacing words on a tail of probability $`\delta_s`$ by identity changes the joint output vector by at most $`2\sqrt{\delta_s}`$. Count truncation contributes at most $`\sqrt{\delta_N}`$ in half diamond distance. Choosing both probabilities of order $`\epsilon^2`$ and reserving a synthesis allowance proves (R10) in the original embedding. + +At fixed $`k`$, conservative costs are: + +| Resource | Explicit count-and-word implementation | +|---|---| +| Unknown serial queries | One for one reflection; (R10) for a pair; $`O(N_{\max})`$ for three | +| Output registers | $`O(N_{\max}\log(k+1)+\log(N_{\max}+1))`$ qubits | +| Pair endpoint arithmetic | $`O(N_{\max}\log(N_{\max}+1))`$ known reversible gates, including uncomputation | +| Preparation, synthesis and compilation | $`O(N_{\max}\mathrm{poly}(B,\log((N_{\max}+2)/\epsilon)))`$ known work, conservatively | + +Here $`B`$ is the bit length of the known classical parameters. The preparation uses explicitly compiled Poisson lists and finite rotations, with the arithmetic and synthesis conventions of [resources.md](resources.md); no QRAM or free amplitude loader is assumed. Coherent occupancy and label controls are charged. These bounds are sufficient and are not claimed gate optimal. + +Thus the square-root oracle bound coexists with roughly linear explicit output work at fixed error. The actual field has mean photon number $`t`$. Physical photon generation, emission time, energy and arbitrary decoding are separate resources. + +## One-reflection lower bound + +Use input $`|0\rangle`$ and compare the legal qubit reflections $`R=Z`$ and $`R=X`$. In the orthonormal even/odd fibre basis, the first output is pure with off-diagonal entry $`\sqrt{p_{\rm e}p_{\rm o}}`$. For $`R=X`$, even and odd trajectories end in orthogonal system states, so the field has the same diagonal entries and zero off-diagonal entry. Their half trace distance is + +```math +D(\rho_F^Z,\rho_F^X) +=\sqrt{p_{\rm e}p_{\rm o}} +=\frac{\sqrt{1-e^{-4t}}}{2} +\geq\frac{\sqrt{1-e^{-4}}}{2}\gt0.495. +\qquad\text{(R11)} +``` + +A zero-query procedure gives the same output for both unknown oracles. It cannot approximate both within half diamond error $`0.1`$. Together with the one-query construction, this proves the first part of (R5). + +## Proof route and boundaries + +The [pair proof](reflection_pair.md) gives a constant physical counting gap for nearby qubit reflection oracles. The [tree proof](reflection_tree.md) first shows that the original reduced-system parity witness is exactly field blind, then modifies only the leaf action to make the coherent field retain parity. + +The pair counting witness survives complete dephasing between different total photon numbers. The triple witness does not: its parity states become identical under that dephasing. The specified coherent field, including its phase reference, is therefore a load-bearing part of the triple converse. + +The [related-work comparison](../references/RELATED_WORK.md#reflection-primitives-and-the-sister-system-task) credits the inherited ingredients and distinguishes the new field witnesses from the reduced-system result. [Finite diagnostics](../verification/README.md#reflection-field-checks) check conventions and negative controls; the all-input and asymptotic claims rest on these proofs. + +## References + +- **[SAS26]** Z.-X. Shang, D. An, and C. Shao, “Exponential Lindbladian fast forwarding and exponential amplification of certain Gibbs state properties,” author version [arXiv:2509.09517v2](https://arxiv.org/html/2509.09517v2), Appendix B.1, Eqs. (51)–(53). +- **[QDT26]** R. Lin, *Quantum Dephasing Threshold*, [source commit 5495822](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/tree/549582272ce6f5a3274be12de1bc5b2f16ed290e), especially the pair simulation and lower-bound pages. + diff --git a/science/reflection_tree.md b/science/reflection_tree.md new file mode 100644 index 0000000..467d4eb --- /dev/null +++ b/science/reflection_tree.md @@ -0,0 +1,261 @@ +# A three-reflection field-only parity lower bound + +The [reflection theorem](reflection_threshold.md) needs a separate field-only converse for three primitives. The [sister's original tree construction](https://github.com/GoGoKo699/Quantum-Dephasing-Threshold/blob/549582272ce6f5a3274be12de1bc5b2f16ed290e/science/lower-bounds.md#5-three-reflections-a-finite-tree-parity-reduction) supplies its tree, radial drift estimate and two-query controlled-SELECT compiler. Its root-input field is nevertheless exactly independent of the unknown bits. The known leaf action below makes the coherent field retain the full parity without adding a fourth reflection or a variable observer rate. + +## Fixed output and oracle model + +Use the vacuum Hudson–Parthasarathy dilation with identity scattering, explicit Hamiltonian zero, and three separate labelled fields coupled by + +```math +L_j=R_j/\sqrt3,\qquad j=1,2,3. +``` + +All rates are fixed at 1/3. Each supplied matrix is exactly a Hermitian involution with its stated phase. A phase-referenced controlled SELECT of the three reflections, including its inverse, costs one query. We require simulation of the full field channel after discarding the final system, on arbitrary inputs and references, to half diamond error at most 0.1. No unknown-oracle-dependent output embedding is permitted. + +The physical embedding is the exact [chronological-word code](model.md#exact-trajectory-expansion). With $`w=(j_1,\ldots,j_N)`$ and normalized uniform ordered-time state $`|N,w\rangle_F`$, + +```math +\begin{aligned} +c_{N,w}&=\sqrt{e^{-t}t^N/(N!3^N)},\\ +V_t|\psi\rangle +&=\sum_{N,w}c_{N,w} + R_{j_N}\cdots R_{j_1}|\psi\rangle\otimes|N,w\rangle_F. +\end{aligned} +``` + +The code states are orthonormal and their physical-field embedding is independent of the unknown bits below. + +## Why the original system witness fails for the field + +In the source's original tree construction, all missing boundary edges are identity loops. Starting at root with answer zero, every trajectory ends at a vertex $`v`$ with answer equal to the unknown prefix parity at its depth. Hence two trajectories have nonzero final-system overlap exactly when their known endpoints agree. All unknown answer bits disappear from these overlaps. The complete coherent field is exactly independent of the unknown string for this input. Explicitly, on a tree of radius at least the parity depth, let $`p_x(d)=x_1\oplus\cdots\oplus x_d`$ with $`p_x(0)=0`$, and define $`D_x|v,a\rangle=|v,a\oplus p_x(\min\{|v|,m\})\rangle`$. It fixes the root input, and the original identity-loop reflections satisfy + +```math +\begin{aligned} +R_j^{(x)}&=D_xR_j^{(0)}D_x,\\ +V_x|\varnothing,0\rangle +&=(D_x\otimes I_F)V_0|\varnothing,0\rangle . +\end{aligned} +``` + +The system factor disappears under the partial trace. The system parity lower bound therefore cannot simply be reused after discarding the system. + +## Repair: known Z loops at the parity boundary + +For $`t\geq48`$, set + +```math +m=\lfloor t/48\rfloor\ge1. +``` + +Let the vertex set contain the empty word and all words of length at most $`m`$ on $`\{1,2,3\}`$ with unequal adjacent letters. A colour $`j`$ deletes the last letter if it is $`j`$, appends $`j`$ if this is possible below depth $`m`$, and otherwise is a self-loop at a leaf. Call the resulting known involution $`T_j`$. + +Let unknown input bits be $`x_1,\ldots,x_m`$, and let an answer qubit be attached to the vertex register. For a nonloop edge with upper depth $`\ell`$, define + +```math +R_j^{(x)}|v,a\rangle=|T_jv,a\mathbin\oplus x_\ell\rangle. +``` + +On a missing boundary edge, define instead + +```math +R_j^{(x)}|v,a\rangle=(-1)^a|v,a\rangle. +``` + +Thus the boundary loop acts by the known $`Z`$ on the answer, not by the identity. Edge bits are symmetric between endpoints, and each loop acts by an involution, so every $`R_j^{(x)}`$ is exactly Hermitian and unitary. There are still exactly three supplied reflection types and no rate, coupling phase, or Hamiltonian depends on the requested time except through the allowed growing finite target instance. + +The system dimension is + +```math +d=2(3\cdot2^m-2)=6\cdot2^m-4=\exp(\Theta(t)). +``` + +This is not a fixed-dimension lower bound. + +## Gauge reduction: the field depends only on the full parity + +Define $`p_x(d)=x_1\oplus\cdots\oplus x_d`$, $`p_x(0)=0`$, and + +```math +G_x|v,a\rangle=|v,a\mathbin\oplus p_x(|v|)\rangle, +\qquad P=p_x(m). +``` + +Conjugating all reflections by $`G_x`$ removes every nonloop bit flip. On a leaf loop it conjugates $`Z`$ to $`(-1)^P Z`$. The initial state $`|\varnothing,0\rangle`$ is fixed by $`G_x`$. After this conjugation the answer remains zero, the vertex moves by $`T_j`$, and each leaf self-loop contributes the scalar $`(-1)^P`$. The final $`G_x`$ is on the discarded system and has no effect on the field. Consequently all strings of the same parity produce exactly the same field state for this fixed known input. + +For a word $`w`$, let $`v(w)`$ be its endpoint under the known vertex walk and $`K(w)`$ its number of leaf self-loop events. The isometry on this input is therefore + +```math +V_P|\mathrm{root}\rangle +=\sum_{N,w}c_{N,w}(-1)^{P K(w)}|v(w)\rangle|N,w\rangle_F. +``` + +## Exact endpoint-fibre trace distance + +For each vertex define unnormalized field vectors + +```math +|F_v^P\rangle=\sum_{N,w:v(w)=v}c_{N,w}(-1)^{P K(w)}|N,w\rangle_F. +``` + +Different endpoint fibres are orthogonal field subspaces because they contain disjoint orthonormal word states. Put $`p_v=\|F_v^P\|^2`$, independent of $`P`$, and, for $`p_v\gt0`$, $`f_v^P=F_v^P/\sqrt{p_v}`$. The two field states are direct sums + +```math +\rho_P=\bigoplus_v p_v|f_v^P\rangle\langle f_v^P|. +``` + +Their normalized fibre overlaps are + +```math +\alpha_v=\langle f_v^0|f_v^1\rangle +=\mathbb E[(-1)^K\mid V_t=v]. +``` + +Let $`L_t`$ be the total amount of time spent at leaves by the continuous-time vertex process. Each leaf has exactly two loop colours, with total rate $`2/3`$; its nonloop exit rate is $`1/3`$. Conditional on the vertex skeleton (which ignores loops), the loop count is Poisson of mean $`(2/3)L_t`$. This is the standard marked-Poisson/thinning construction, so + +```math +\alpha_v=\mathbb E[e^{-(4/3)L_t}\mid V_t=v]\in[0,1]. +``` + +It follows exactly that + +```math +\begin{aligned} +D(\rho_0,\rho_1) +&=\tfrac12\|\rho_0-\rho_1\|_1 +=\sum_vp_v\sqrt{1-\alpha_v^2}\\ +&\ge 1-\mathbb E[e^{-(4/3)L_t}]. +\end{aligned} +``` + +This is a field-only calculation; no final-system measurement or reconstruction is used. + +## Uniform constant gap + +Let $`\tau_m`$ be the first hitting time of a leaf. Up to that time, the depth walk agrees with the infinite three-coloured tree. Its depth at time $`s`$ stochastically dominates + +```math +Y_s=\mathrm{Pois}(2s/3)-\mathrm{Pois}(s/3), +\quad \mathbb E Y_s=s/3,\quad\mathrm{Var}Y_s=s. +``` + +Taking $`s=t-1`$, using $`m\leq t/48`$, and applying Chebyshev, + +```math +\begin{aligned} +\Pr(\tau_m\le t-1) +&\ge1-\frac{t-1}{((t-1)/3-m)^2}\\ +&\ge1-\frac{2304(t-1)}{(15t-16)^2} +\ge\frac{1513}{1936}=:h_0. +\end{aligned} +``` + +The last rational function decreases for $`t\geq48`$ and has value $`423/1936`$ at $`t=48`$. + +Following a hit by $`t-1`$, the first leaf dwell $`E`$ is exponential of rate $`1/3`$. At least $`\min(E,1)`$ units of leaf time occur before the horizon. The strong Markov property gives + +```math +\mathbb E[e^{-(4/3)\min(E,1)}] +=\tfrac15+\tfrac45e^{-5/3}. +``` + +Consequently + +```math +\boxed{\quad +D(\rho_0,\rho_1) +\ge\frac{1513}{1936}\frac45(1-e^{-5/3}) +=0.5071203359\ldots>\frac12. +\quad} +``` + +The ideal equal-prior Helstrom measurement therefore distinguishes parity with success greater than 0.7535. It is a known field measurement, independent of the unknown bits. The two states are related by the known involution that multiplies word $`w`$ by $`(-1)^{K(w)}`$, so a symmetric Helstrom measurement may be chosen with equal individual success probabilities. Alternatively, uniform-average success alone suffices for the parity polynomial bound. Half diamond simulation error 0.1 reduces each event success probability by at most 0.1, leaving bounded-error parity success greater than 0.6535. + +## Oracle reduction and linear lower bound + +Exactly as in the source construction, a controlled SELECT call can be implemented with two ordinary bit-oracle calls. Reversibly compute the selected edge depth and an active flag for a controlled nonloop move, using address one on inactive branches. Query the addressed bit into a zero buffer, flip the answer conditional on the active flag and buffer, query again to erase the buffer, apply the known vertex move and the known controlled $`Z`$ on boundary-loop branches, and erase the known address/flag. The edge condition and depth are symmetric at its two endpoints. Unused binary labels are fixed and inactive. This implements the complete controlled SELECT exactly, including arbitrary coherent controls and inverse queries, without assuming a free controlled bit oracle or zero sentinel bit. + +A $`q`$-query field simulator thus yields a bounded-error parity algorithm with at most $`2q`$ bit queries. Quantum parity requires at least $`m/2`$ bit queries, so + +```math +q\ge m/4\ge t/384\qquad(t\ge48). +``` + +For $`1\leq t\lt48`$, use the one-reflection comparison from [the theorem](reflection_threshold.md#one-reflection-lower-bound), repeated in all three supplied labels: $`(Z,Z,Z)`$ versus $`(X,X,X)`$. A known passive bath mixing concentrates their coupling in one bright field. The half trace separation is $`\sqrt{1-e^{-4t}}/2\gt0.495`$, so a zero-query simulator cannot approximate both to error 0.1. Thus $`q\geq1\geq t/384`$ on this range as well. Together with the routine coherent trajectory upper bound, this proves the dimension-uniform three-reflection full-field order $`\Theta(t)`$ at fixed error. + +The inherited parity bound is the polynomial-method result of [Beals–Buhrman–Cleve–Mosca–de Wolf](https://arxiv.org/abs/quant-ph/9802049). It applies to all coherent, adaptive and randomized algorithms under a branchwise query cap. The source's original tree/drift and oracle compilation are credited rather than claimed anew. + +## An independent, simpler physical field measurement + +An operational witness avoids an abstract exponentially large Helstrom decoder. Let the last interval have length $`\delta=1/2`$. Count photons in the earlier interval $`[0,t-\delta]`$, retaining the labels in chronological order. The known vertex graph computes its endpoint $`v`$; photon counts themselves are independent of $`x`$. The conditional system is a basis state with answer equal to the prefix parity at its depth. If $`v`$ is not a leaf, return an unbiased bit. If $`v`$ is a leaf, its answer is the full parity $`P`$. + +For this leaf, let $`j,k`$ be its two missing colours. In the final interval define the normalized one-photon state + +```math +|1_M\rangle=(|1_j\rangle+|1_k\rangle)/\sqrt2, +``` + +where each photon is in the uniform temporal mode of that interval and all other modes are vacuum. Measure the norm-one observable + +```math +X_v=|\mathrm{vac}\rangle\langle1_M|+|1_M\rangle\langle\mathrm{vac}|. +``` + +Only the zero/one-photon sectors contribute, so its exact conditional expectation is + +```math +\langle X_v\rangle_P=(-1)^P 2e^{-\delta}\sqrt{2\delta/3} +=(-1)^P\frac{2e^{-1/2}}{\sqrt3}. +``` + +The depth chain is reversible with stationary leaf probability + +```math +\pi_m=\frac{3\cdot2^{m-1}}{3\cdot2^m-2}>\frac12. +``` + +By the spectral expansion of a reversible continuous-time chain, its diagonal transition probability $`P_{mm}(u)\geq\pi_m`$ for every $`u\geq0`$. Strong Markov at the first hit therefore implies + +```math +\Pr(D_{t-\delta}=m)\ge\pi_m\Pr(\tau_m\le t-\delta) +\ge h_0/2. +``` + +The adaptive field observable, set to zero on nonleaf outcomes, has expectation $`(-1)^P A`$ with + +```math +A\ge h_0 e^{-1/2}/\sqrt3=0.2736\ldots. +``` + +Its associated binary POVM $`(I+X)/2`$ identifies parity with success at least $`(1+A)/2\gt0.636`$, uniformly for every bit string. A simulator with half diamond error 0.1 still yields success greater than 0.536, enough for the same linear query lower bound. + +This measurement uses vacuum/one-photon coherence, so it requires the stipulated phase reference. The exact endpoint-fibre proof also uses physical coherences between total photon-number sectors. A photon-count record alone remains oracle-independent and yields no parity information. + +More precisely, a word ending at depth $`d`$ has $`N-K`$ nonloop steps and hence $`N-K\equiv d\pmod2`$. Within each endpoint fibre $`(-1)^K=(-1)^{N-d}`$. Therefore the two field states obey the exact identity + +```math +\rho_1=e^{i\pi N_{\mathrm{total}}}\rho_0e^{-i\pi N_{\mathrm{total}}}. +``` + +They become identical if total photon number is dephased. This construction establishes the threshold for the specified phase-referenced coherent field; it establishes no such lower bound for a photon-number-superselected or phase-insensitive output. The physical phases of the supplied matrices are fixed by their explicit edge-XOR / boundary-Z definitions; the sign distinction is not an unspecified oracle phase or an oracle-dependent encoding. + +## Field encoding and output work + +The lower bound applies to the stated physical-field channel or to any declared oracle-independent digital encoding compared through an explicit isometric embedding. One cannot merely delete a bath label from the global word register to perform a physical trace. + +The late-interval witness has an explicit known time-splitting map in the exact code. With $`s=t-\delta`$, + +```math +\begin{aligned} +|N,w\rangle_t\longmapsto +\sum_{r=0}^N& +\sqrt{\binom Nr(s/t)^r(\delta/t)^{N-r}}\\ +&{}\times |r,w_{1:r}\rangle_s +\otimes|N-r,w_{r+1:N}\rangle_\delta . +\end{aligned} +``` + +It follows by factoring the ordered-time simplexes. Thus measuring the early interval and implementing the late field POVM are explicit oracle-free operations; chronological labels and the boundary endpoint can be processed in $`O(N)`$ word operations. Finite truncation and finite precision add ordinary known-gate/compilation work, not unknown-reflection queries. The typical count is $`\Theta(t)`$. Producing, reading, or decoding this explicit trajectory output is therefore not a sublinear total-work claim. A physical field additionally requires its photons, energy, modes and elapsed emission time. None of this is supplied for free by the oracle lower or upper bounds. + +## Validation scope + +The companion [check_reflection_tree.py](../verification/check_reflection_tree.py) enumerates finite word sectors for small trees, computes full reduced field density matrices for every bit string, checks exact parity-only dependence and endpoint-fibre trace distance, and compares unsigned/signed endpoint weights against a separate radial Feynman–Kac matrix exponential (with an explicit Poisson-tail error). It also checks exact field blindness of the original identity-loop construction. These finite checks exercise the derivation; the asymptotic lower bound rests on the analytic arguments above. diff --git a/science/resources.md b/science/resources.md index 88e3e41..03d6e9c 100644 --- a/science/resources.md +++ b/science/resources.md @@ -108,6 +108,10 @@ After sampling $`n`$, compile only its $`O(n+1)`$-rotation uniform-position load These statements concern sampling one bit with the correct probability. They do not claim to prepare the complete reduced observer field in a logarithmic-size register. +## Reflection-word output costs + +The [reflection theorem](reflection_threshold.md#an-explicit-output-implementation-and-its-separate-costs) gives one-query, square-root-query and linear-query upper bounds for one, two and three supplied reflections. Its explicit count-and-word implementation still prepares and retains a number of slots proportional to the mean count at fixed precision. Endpoint reduction is performed reversibly and uncomputed; measuring or tracing its garbage would remove field coherence. The theorem accounts for known arithmetic, preparation, synthesis, output registers and any proposed fibre-code conversion separately from unknown SELECT calls. + ## Precision of a known Poisson mean The primary input model uses exactly specified finite-description means. If a mean is rounded, its effect can also be bounded directly. Compare $`V_\mu`$ and $`V_\nu`$ in the same declared count code, with the same oracle $`U`$ and the same physical temporal-mode embedding. Then diff --git a/verification/README.md b/verification/README.md index 9ed3fcf..ad42af9 100644 --- a/verification/README.md +++ b/verification/README.md @@ -66,3 +66,22 @@ The negative controls produce substantial discrepancies when a required conditio The finite cases test formulas and their physical representations. The reference-uniform error bounds, arbitrary-input claims, asymptotic query lower bounds and concentration estimates rest on the written proofs. A normalized Choi-matrix comparison is not itself a numerical computation of diamond distance. This suite does not assess external priority, physical field-generation hardware, or the cost of an arbitrary decoder. The auxiliary computation for the direct one-bit sampler is charged explicitly in [resources.md](../science/resources.md). Its count is sampled classically before the position circuit is compiled. Only the circuit for the sampled count is needed; no library of every possible count-dependent circuit is assumed. + +## Reflection-field threshold checks + +The [reflection-field theorem](../science/reflection_threshold.md) has a separate finite suite. It leaves the original 112-check audit above unchanged. From the repository root, run: + +```bash +python verification/verify_reflections.py --output verification/reflection_results.json +``` + +The aggregate [record](reflection_results.json) links the [pair report](reflection_results_pair.json) and [tree report](reflection_results_tree.json). The runner invokes both check programs, requires their successful exits and passing reports, and writes the three retained reports only after both programs succeed. Use another `--output` path to retain a fresh run. Each program also accepts `--output` independently. Every required comparison raises `ValidationError` explicitly and remains active with `python -O`. + +| Program | Independent finite scope | Comparisons and negative controls | +|---|---|---| +| [Two-reflection field](check_reflection_pair.py) | Six time/angle cases, four qubit inputs, and a Bell input with an untouched reference | Matrix exponentials of tilted jump generators and count-resolved master equations versus Poisson dark-count laws; the coherent-field projector formula versus a separate finite Poisson word-average series; reflection and bath-rotation identities | +| [Three-reflection field](check_reflection_tree.py) | Every bit string at tree depths one and two; all 364 chronological words of length at most five in each case; radial chains at times 48, 96, 192 and 480 | Full reduced-field matrices versus endpoint-fibre trace distances; unsigned and signed endpoint weights versus separate radial Feynman–Kac exponentials with explicit omitted Poisson mass; exact field blindness of identity boundary loops; parity-only dependence of leaf-$`Z`$ loops; loss of that signal after total-photon-number dephasing | + +The recorded pair run has maximum Poisson generating-function error below $`2.7\times10^{-15}`$ and count-probability error below $`9.5\times10^{-16}`$. The tree run's full field matrices and endpoint-fibre formula differ by less than $`1.3\times10^{-14}`$. Same-parity fields, the original identity-loop fields, and the number-dephased leaf-$`Z`$ fields agree exactly in the enumerated cases. These are finite floating-point diagnostics, with exact equality reported only for the computed arrays; they do not prove the all-time analytical identities. + +The analytical trace-distance lower bound $`0.5071203359\ldots`$ and query law $`q\ge t/384`$ are proved in the scientific account. Evaluating their constants in a script is a consistency check, not a numerical proof of asymptotic complexity. This suite makes no claim about an efficient physical field decoder, fixed-dimension linear hardness, external priority or hosted rendering. In particular, the triple witness requires the specified photon-number coherence; a photon-count record alone remains independent of the unknown bits. diff --git a/verification/check_reflection_pair.py b/verification/check_reflection_pair.py new file mode 100644 index 0000000..bd42814 --- /dev/null +++ b/verification/check_reflection_pair.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Finite diagnostics for two-reflection field witnesses; no asymptotic proof.""" +import argparse +import json +import platform +from pathlib import Path + +import numpy as np +import scipy +from scipy.linalg import expm +from scipy.stats import poisson + +I = np.eye(2, dtype=complex) +X = np.array([[0, 1], [1, 0]], dtype=complex) +Z = np.diag([1, -1]).astype(complex) + + +def ad(u): + # Column-vectorization: vec(u rho u^dagger)=(conj(u) tensor u) vec(rho). + return np.kron(u.conj(), u) + + +def require(condition, message): + """Keep scientific checks active under Python optimization.""" + if not condition: + raise ValidationError(message) + + +class ValidationError(RuntimeError): + """A required finite scientific comparison failed.""" + + +def run(output_path): + states = { + "zero": np.diag([1, 0]).astype(complex), + "plus": np.ones((2, 2), dtype=complex) / 2, + "mixed": I / 2, + "generic": np.array([[0.7, 0.1 + 0.2j], [0.1 - 0.2j, 0.3]]), + } + cases = [(0.0, 0.4), (0.2, 0.03), (1.0, 1.0), (3.0, 0.4), + (12.0, 0.9), (30.0, 1 / np.sqrt(30))] + rows = [] + max_pgf = max_counts = max_coherent = max_series = 0.0 + for t, theta in cases: + c, s = np.cos(theta), np.sin(theta) + rp, rm = c * Z + s * X, c * Z - s * X + lb, ld = (rp + rm) / 2, (rp - rm) / 2 + transform_error = max(np.linalg.norm(lb - c * Z), np.linalg.norm(ld - s * X)) + reflection_error = max(np.linalg.norm(rp @ rp - I), np.linalg.norm(rm @ rm - I)) + mu = t * s * s + # Resolve the count master equation into 0,...,nmax photons. Probability + # in each retained block is exact up to floating-point arithmetic; + # truncation of higher blocks never feeds back into lower blocks. + nmax = int(max(8, poisson.ppf(1 - 1e-13, mu))) + k0, jump = ad(lb) - np.eye(4), ad(ld) + master = np.kron(np.eye(nmax + 1), k0) + master += np.kron(np.diag(np.ones(nmax), -1), jump) + evolved = expm(t * master) + case = {"t": t, "theta": theta, "dark_mean": float(mu), + "count_cutoff": nmax, "states": {}, + "transform_error": float(transform_error), + "reflection_error": float(reflection_error)} + for name, rho in states.items(): + vec = rho.reshape(-1, order="F") + start = np.zeros(4 * (nmax + 1), dtype=complex) + start[:4] = vec + block_out = (evolved @ start).reshape((nmax + 1, 4)) + probs = np.real(block_out[:, 0] + block_out[:, 3]) + exact = poisson.pmf(np.arange(nmax + 1), mu) + count_error = float(np.max(np.abs(probs - exact))) + pgf_errors = [] + for z in [0, 0.25, 0.7, 1, 1.2, np.exp(0.8j)]: + tilted = ad(lb) + z * ad(ld) - np.eye(4) + out = expm(t * tilted) @ vec + pgf_errors.append(abs(out[0] + out[3] - np.exp(mu * (z - 1)))) + pgf_error = float(max(pgf_errors)) + max_pgf, max_counts = max(max_pgf, pgf_error), max(max_counts, count_error) + case["states"][name] = {"max_pgf_error": pgf_error, + "max_count_probability_error": count_error, + "dark_nonvacuum_probability": float(1 - probs[0])} + # Independent finite Poisson word-average series for the coherent test. + # Averaging every N-letter word produces A^N, A=(R_++R_-)/2. + avg = (rp + rm) / 2 + k = expm(t * (avg - I)) + cutoff = int(max(8, poisson.ppf(1 - 1e-14, t))) + term = np.exp(-t) * I + series = term.copy() + for n in range(1, cutoff + 1): + term = (t / n) * avg @ term + series += term + series_error = float(np.linalg.norm(series - k)) + coherent_p = float(np.vdot(k[:, 0], k[:, 0]).real) + coherent_exact = float(np.exp(-2 * t * (1 - c))) + coherent_error = abs(coherent_p - coherent_exact) + max_series, max_coherent = max(max_series, series_error), max(max_coherent, coherent_error) + case.update({"coherent_probability": coherent_p, + "coherent_formula_error": coherent_error, + "poisson_word_average_series_error": series_error, + "word_series_cutoff": cutoff}) + rows.append(case) + + # Explicit untouched-reference diagnostic: Bell input, jumps on system only. + bell = np.array([1, 0, 0, 1], complex) / np.sqrt(2) + rho_bell = np.outer(bell, bell.conj()) + t, theta = 3.0, 0.4 + lb, ld = np.cos(theta) * np.kron(Z, I), np.sin(theta) * np.kron(X, I) + ref_error = 0.0 + for z in [0, 0.7, np.exp(0.8j)]: + tilted = ad(lb) + z * ad(ld) - np.eye(16) + out = (expm(t * tilted) @ rho_bell.reshape(-1, order="F")).reshape((4, 4), order="F") + ref_error = max(ref_error, abs(np.trace(out) - np.exp(t * np.sin(theta)**2 * (z - 1)))) + + summary = {"max_transform_error": max(row["transform_error"] for row in rows), + "max_reflection_error": max(row["reflection_error"] for row in rows), + "max_pgf_error": max_pgf, + "max_count_probability_error": max_counts, + "max_coherent_formula_error": max_coherent, + "max_word_average_series_error": max_series, + "bell_reference_pgf_error": float(ref_error)} + require(all(np.isfinite(x) and x < 1e-11 for x in summary.values()), + "Two-reflection finite diagnostic exceeded the 1e-11 tolerance") + report = {"purpose": "finite numerical diagnostics, not asymptotic proof", + "python": platform.python_version(), "numpy": np.__version__, + "scipy": scipy.__version__, "status": "passed", + "tolerance": 1e-11, + "summary": summary, "cases": rows} + output_path.parent.mkdir(parents=True, exist_ok=True) + output_path.write_text(json.dumps(report, indent=2) + "\n") + print(json.dumps({"status": "passed", "summary": summary, + "results": str(output_path)}, indent=2)) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output", type=Path, + default=Path(__file__).with_name("reflection_pair_results.json")) + args = parser.parse_args() + run(args.output) + + +if __name__ == "__main__": + main() diff --git a/verification/check_reflection_tree.py b/verification/check_reflection_tree.py new file mode 100644 index 0000000..ff9683a --- /dev/null +++ b/verification/check_reflection_tree.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +"""Independent finite checks of the field-only leaf-loop parity construction.""" +from __future__ import annotations +import argparse +import itertools +import json +import math +import platform +from pathlib import Path +import numpy as np +import scipy +from scipy.linalg import expm + +def require(condition, message): + """Keep scientific checks active under Python optimization.""" + if not condition: + raise ValidationError(message) + +class ValidationError(RuntimeError): + """A required finite scientific comparison failed.""" + +def vertices(m): + out = [()] + for d in range(1, m + 1): + out.extend((w for w in itertools.product(range(3), repeat=d) if all((w[i] != w[i + 1] for i in range(d - 1))))) + return out + +def move(v, j, m): + if v and v[-1] == j: + return (v[:-1], False) + if len(v) < m: + return (v + (j,), False) + return (v, True) + +def trajectory(w, bits, boundary_z): + m = len(bits) + v, a, phase, loops = ((), 0, 1, 0) + for j in w: + nxt, loop = move(v, j, m) + if loop: + loops += 1 + if boundary_z: + phase *= (-1) ** a + else: + a ^= bits[max(len(v), len(nxt)) - 1] + v = nxt + return (v, a, phase, loops) + +def exact_reflections(bits, boundary_z): + vs = vertices(len(bits)) + vi = {v: i for i, v in enumerate(vs)} + rs = [] + for j in range(3): + r = np.zeros((2 * len(vs), 2 * len(vs))) + for v in vs: + for a in (0, 1): + nxt, loop = move(v, j, len(bits)) + b = a if loop else a ^ bits[max(len(v), len(nxt)) - 1] + z = (-1) ** a if loop and boundary_z else 1 + r[2 * vi[nxt] + b, 2 * vi[v] + a] = z + require(np.array_equal(r, r.T), 'Required three-reflection comparison failed: np.array_equal(r, r.T)') + require(np.array_equal(r @ r, np.eye(len(r))), 'Required three-reflection comparison failed: np.array_equal(r @ r, np.eye(len(r)))') + rs.append(r) + return rs + +def field_matrix(bits, t, nmax, boundary_z): + vs = vertices(len(bits)) + vi = {v: i for i, v in enumerate(vs)} + words = [w for n in range(nmax + 1) for w in itertools.product(range(3), repeat=n)] + a = np.zeros((2 * len(vs), len(words))) + p, b = (np.zeros(len(vs)), np.zeros(len(vs))) + for c, w in enumerate(words): + v, answer, phase, k = trajectory(w, bits, boundary_z) + n = len(w) + prob = math.exp(-t) * (t / 3) ** n / math.factorial(n) + a[2 * vi[v] + answer, c] = phase * math.sqrt(prob) + p[vi[v]] += prob + b[vi[v]] += prob * (-1) ** k + return (a.T @ a, p, b) + +def radial(t, m, nmax): + step = np.zeros((m + 1, m + 1)) + step[0, 1] = 1 + for d in range(1, m): + step[d, d - 1], step[d, d + 1] = (1 / 3, 2 / 3) + step[m, m - 1], step[m, m] = (1 / 3, 2 / 3) + signed = step.copy() + signed[m, m] = -2 / 3 + e0 = np.eye(m + 1)[0] + full_p = e0 @ expm(t * (step - np.eye(m + 1))) + full_b = e0 @ expm(t * (signed - np.eye(m + 1))) + p, b = (np.zeros(m + 1), np.zeros(m + 1)) + pv, bv = (e0.copy(), e0.copy()) + poisson = math.exp(-t) + for n in range(nmax + 1): + p += poisson * pv + b += poisson * bv + pv = pv @ step + bv = bv @ signed + poisson *= t / (n + 1) + tail = 1 - math.exp(-t) * sum((t ** n / math.factorial(n) for n in range(nmax + 1))) + return (p, b, full_p, full_b, tail) + +def run(out): + rows = [] + max_field_parity_error = 0.0 + max_blind_error = 0.0 + max_number_dephased_error = 0.0 + max_global_number_phase_identity_error = 0.0 + for m, t in ((1, 0.7), (2, 1.2)): + nmax = 5 + all_bits = list(itertools.product((0, 1), repeat=m)) + base = {} + blind_base = None + for bits in all_bits: + exact_reflections(bits, True) + exact_reflections(bits, False) + field, p, b = field_matrix(bits, t, nmax, True) + parity = sum(bits) % 2 + if parity in base: + max_field_parity_error = max(max_field_parity_error, float(np.max(np.abs(field - base[parity])))) + else: + base[parity] = field + blind, _, _ = field_matrix(bits, t, nmax, False) + if blind_base is None: + blind_base = blind + max_blind_error = max(max_blind_error, float(np.max(np.abs(blind - blind_base)))) + delta = base[0] - base[1] + counts = np.concatenate([np.full(3 ** n, n) for n in range(nmax + 1)]) + number_mask = counts[:, None] == counts[None, :] + max_number_dephased_error = max(max_number_dephased_error, float(np.max(np.abs(np.where(number_mask, delta, 0))))) + number_sign = (-1.0) ** counts + max_global_number_phase_identity_error = max(max_global_number_phase_identity_error, float(np.max(np.abs(base[1] - number_sign[:, None] * base[0] * number_sign[None, :])))) + direct_d = float(np.abs(np.linalg.eigvalsh(delta)).sum() / 2) + fibre_d = float(np.sqrt(np.maximum(p * p - b * b, 0)).sum()) + require(abs(direct_d - fibre_d) < 1e-10, 'Required three-reflection comparison failed: abs(direct_d - fibre_d) < 1e-10') + vs = vertices(m) + agg_p = np.array([sum((p[i] for i, v in enumerate(vs) if len(v) == d)) for d in range(m + 1)]) + agg_b = np.array([sum((b[i] for i, v in enumerate(vs) if len(v) == d)) for d in range(m + 1)]) + rp, rb, fullp, fullb, tail = radial(t, m, nmax) + require(np.max(np.abs(agg_p - rp)) < 1e-12, 'Required three-reflection comparison failed: np.max(np.abs(agg_p - rp)) < 1e-12') + require(np.max(np.abs(agg_b - rb)) < 1e-12, 'Required three-reflection comparison failed: np.max(np.abs(agg_b - rb)) < 1e-12') + require(np.max(np.abs(fullp - rp)) <= tail + 1e-12, 'Required three-reflection comparison failed: np.max(np.abs(fullp - rp)) <= tail + 1e-12') + require(np.max(np.abs(fullb - rb)) <= tail + 1e-12, 'Required three-reflection comparison failed: np.max(np.abs(fullb - rb)) <= tail + 1e-12') + require(np.all(fullb >= -1e-12), 'Required three-reflection comparison failed: np.all(fullb >= -1e-12)') + require(direct_d + 1e-12 >= sum(rp - rb), 'Required three-reflection comparison failed: direct_d + 1e-12 >= sum(rp - rb)') + rows.append({'m': m, 't': t, 'maximum_count': nmax, 'word_states': len(field), 'retained_probability': float(p.sum()), 'poisson_tail': tail, 'full_matrix_half_trace_distance': direct_d, 'endpoint_fibre_half_trace_distance': fibre_d, 'feynman_kac_bound_full': float(1 - fullb.sum()), 'radial_distance_full': float(np.sqrt(np.maximum(fullp ** 2 - fullb ** 2, 0)).sum())}) + require(max_field_parity_error < 1e-12, 'Required three-reflection comparison failed: max_field_parity_error < 1e-12') + require(max_blind_error < 1e-12, 'Required three-reflection comparison failed: max_blind_error < 1e-12') + require(max_number_dephased_error < 1e-12, 'Required three-reflection comparison failed: max_number_dephased_error < 1e-12') + require(max_global_number_phase_identity_error < 1e-12, 'Required three-reflection comparison failed: max_global_number_phase_identity_error < 1e-12') + h0 = 1513 / 1936 + asymptotic = h0 * 4 / 5 * (1 - math.exp(-5 / 3)) + operational_signal = h0 * math.exp(-0.5) / math.sqrt(3) + require(asymptotic > 0.5, 'Required three-reflection comparison failed: asymptotic > 0.5') + require((1 + operational_signal) / 2 - 0.1 > 0.5, 'Required three-reflection comparison failed: (1 + operational_signal) / 2 - 0.1 > 0.5') + theorem_checks = [] + for t in (48, 96, 192, 480): + m = int(t // 48) + _, _, fullp, fullb, _ = radial(t, m, 0) + bound = float(1 - fullb.sum()) + require(bound >= asymptotic - 1e-12, 'Required three-reflection comparison failed: bound >= asymptotic - 1e-12') + theorem_checks.append({'t': t, 'm': m, 'feynman_kac_distance_lower_bound': bound, 'exact_radial_fibre_distance': float(np.sqrt(np.maximum(fullp ** 2 - fullb ** 2, 0)).sum())}) + result = {'status': 'passed', 'python': platform.python_version(), 'numpy': np.__version__, 'scipy': scipy.__version__, 'finite_word_checks': rows, 'maximum_same_parity_field_matrix_error': max_field_parity_error, 'maximum_original_identity_loop_field_difference': max_blind_error, 'maximum_total_number_dephased_field_difference': max_number_dephased_error, 'maximum_global_number_phase_identity_error': max_global_number_phase_identity_error, 'uniform_analytic_distance_lower_bound': asymptotic, 'operational_signal_lower_bound': operational_signal, 'operational_success_after_half_diamond_error_0_1': (1 + operational_signal) / 2 - 0.1, 'large_time_radial_checks': theorem_checks, 'scope': 'Finite numerical checks supplement, but do not prove, the analytical lower bound.'} + out.parent.mkdir(parents=True, exist_ok=True) + out.write_text(json.dumps(result, indent=2) + '\n') + print(json.dumps(result, indent=2)) + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--output', type=Path, default=Path(__file__).with_name('reflection_triple_results.json')) + args = parser.parse_args() + run(args.output) +if __name__ == '__main__': + main() diff --git a/verification/hosted/capture_hosted_math.cjs b/verification/hosted/capture_hosted_math.cjs new file mode 100644 index 0000000..bd075f4 --- /dev/null +++ b/verification/hosted/capture_hosted_math.cjs @@ -0,0 +1,274 @@ +#!/usr/bin/env node +'use strict'; +// Read-only collector for the real GitHub host. See ../references/hosted-rendering.md. +// Importing this module has no network effects; dependencies load only in run(). +const fs = require('node:fs'); +const path = require('node:path'); +const cp = require('node:child_process'); +const crypto = require('node:crypto'); +const VIEWPORTS = [{width:1440,height:1000}, {width:760,height:1000}]; +const sha256 = bytes => crypto.createHash('sha256').update(bytes).digest('hex'); + +function argumentsFor(argv) { + const args = {pages:[], python:'python3'}; + for (let i=0; i['.','..'].includes(p))) throw new Error('Use exact owner/name'); + if (!/^[a-f0-9]{40}$/.test(args.revision)) throw new Error('Use a full lowercase commit SHA'); + if (new Set(args.pages).size!==args.pages.length || args.pages.some(p=>!safePath(p))) throw new Error('Use unique safe page paths'); + return args; +} +function safePath(p) { + return typeof p==='string' && p.length>0 && !p.includes('\\') && !p.includes('\0') && + !p.startsWith('/') && p.split('/').every(x=>x && x!=='.' && x!=='..'); +} +function git(root, argv) { + return cp.execFileSync('git',['--no-replace-objects',...argv],{cwd:root,encoding:'utf8',maxBuffer:32*1024*1024}); +} +function pinnedPages(args) { + const commit=git(args.root,['rev-parse',args.revision+'^{commit}']).trim(); + if (commit!==args.revision) throw new Error('Revision does not identify the supplied commit'); + const files=git(args.root,['ls-tree','-r','--name-only','-z',commit]).split('\0').filter(Boolean); + const pages=args.pages.length?args.pages:files.filter(p=>/\.(md|markdown|mdown|mkdn|mkd)$/i.test(p)); + if (!pages.length || pages.some(p=>!safePath(p) || !files.includes(p))) throw new Error('No pages or a page is absent from the pinned tree'); + // Git symlinks are not rendered Markdown source and must not be followed. + for (const p of pages) { + const item=git(args.root,['ls-tree',commit,'--',p]); + if (!/^100644 blob |^100755 blob /.test(item)) throw new Error('Page must be a regular tracked file: '+p); + } + return {pages,tree:git(args.root,['rev-parse',commit+'^{tree}']).trim()}; +} +function mathCompiler() { + const {mathjax}=require('mathjax-full/js/mathjax.js'); + const {TeX}=require('mathjax-full/js/input/tex.js'); + const {SVG}=require('mathjax-full/js/output/svg.js'); + const {liteAdaptor}=require('mathjax-full/js/adaptors/liteAdaptor.js'); + const {RegisterHTMLHandler}=require('mathjax-full/js/handlers/html.js'); + const {AllPackages}=require('mathjax-full/js/input/tex/AllPackages.js'); + const {SerializedMmlVisitor}=require('mathjax-full/js/core/MmlTree/SerializedMmlVisitor.js'); + const {STATE}=require('mathjax-full/js/core/MathItem.js'); + RegisterHTMLHandler(liteAdaptor()); + const doc=mathjax.document('',{InputJax:new TeX({packages:AllPackages,tags:'none'}),OutputJax:new SVG({fontCache:'none'})}); + const visitor=new SerializedMmlVisitor(); + return (tex,display)=>visitor.visitTree(doc.convert(tex,{display,end:STATE.CONVERT})); +} + +// Self-contained function executed inside the hosted page, also exercised by the +// local-browser regression fixture. It never injects styling or renders TeX there. +function inspectArticle(root, expected) { + function canonical(e, inherited='') { + const tag=e.localName; + if (['annotation','annotation-xml','mspace'].includes(tag)) return []; + const variant=e.getAttribute('mathvariant') || inherited; + if (['mi','mo','mn','mtext','ms'].includes(tag)) { + const text=e.textContent.trim(); + return text?[[tag,text,variant]]:[]; + } + // Preserve each structural child slot: flattening numerator and denominator + // together would confuse (a+b)/c with a/(b+c), and similarly for scripts. + const children=[...e.children].filter(c=>!['annotation','annotation-xml','mspace'].includes(c.localName)) + .map(c=>canonical(c,variant)); + if (['math','mrow','mstyle','semantics'].includes(tag)) return children.flat(); + const semantic={}; + for (const name of ['notation','accent','accentunder','linethickness','bevelled','open','close','separators']) if(e.hasAttribute(name)) semantic[name]=e.getAttribute(name); + // A table cell is an inferred row (a sequence), not a fixed-arity operator. + // GitHub inserts empty mrow alignment nodes; ignore those inside the cell + // while preserving the cell and row themselves, including empty cells. + return [[tag,semantic,tag==='mtd'?children.flat():children]]; + } + function plain(math) { + const copy=math.cloneNode(true); + for (const e of copy.querySelectorAll('annotation,annotation-xml')) e.remove(); + return copy.textContent; + } + function geometry(math, host) { + const boxes=[...math.querySelectorAll('mi,mo,mn,mtext,ms')].map(e=>e.getBoundingClientRect()).filter(b=>b.width && b.height); + if (!boxes.length) return {measurable:false}; + const left=Math.min(...boxes.map(b=>b.left)),right=Math.max(...boxes.map(b=>b.right)); + const top=Math.min(...boxes.map(b=>b.top)),bottom=Math.max(...boxes.map(b=>b.bottom)); + const width=right-left,height=bottom-top; + return {measurable:true,width,height,available_width:root.clientWidth, + overflow:width>root.clientWidth+4,collapsed:height>Math.max(200,3*width),host_width:host.getBoundingClientRect().width}; + } + let hosts=[...root.querySelectorAll('math-renderer')]; + // Some host versions expose native MathML without a custom-element wrapper. + if (!hosts.length) hosts=[...root.querySelectorAll('math')].filter(e=>!e.parentElement?.closest('math,annotation,annotation-xml')); + const pageErrors=[...root.querySelectorAll('merror,[data-mjx-error],.katex-error,math-renderer .flash-error')] + .map(e=>e.textContent.trim() || 'empty renderer error'); + const math=hosts.map((host,i)=>{ + const nodes=host.localName==='math'?[host]:[...host.querySelectorAll('math')].filter(e=>!e.parentElement?.closest('math,annotation,annotation-xml')); + const errors=[]; + if(nodes.length!==1) errors.push('Expected one accessible MathML representation; found '+nodes.length); + const actual=nodes[0],want=expected[i]; + let expectedSignature=null,actualSignature=null; + if(actual) actualSignature=JSON.stringify(canonical(actual)); + if(want) { + const parsed=new DOMParser().parseFromString(want.mml,'application/xml'); + if(parsed.querySelector('parsererror,merror')) errors.push('Source compiler returned invalid/error MathML'); + else expectedSignature=JSON.stringify(canonical(parsed.documentElement)); + } + if(!want) errors.push('Unexpected extra hosted expression'); + const match=!!actual && !!expectedSignature && expectedSignature===actualSignature; + if(!match) errors.push('Source-to-host MathML structure mismatch'); + const measure=actual?geometry(actual,host):{measurable:false}; + if(want && ['math-fence','dollar-display'].includes(want.kind) && (!measure.measurable || measure.overflow || measure.collapsed)) + errors.push('Display geometry is unmeasurable, overflowing or collapsed'); + return {rendered:!!actual,errors,text_source:'mathml',text:actual?plain(actual):'', + source_sha256:want?.source_sha256,structural_match:match, + expected_signature:expectedSignature,actual_signature:actualSignature,geometry:measure}; + }); + return {errors:pageErrors,math}; +} + +function classifyFailure(error) { + const message=String(error); + if (/ERR_BLOCKED_BY_ADMINISTRATOR|blocked by.*policy|URLBlocklist|policy denied/i.test(message)) return 'policy_denied'; + if (/HTTP (401|403)|redirected away|sign.in|authentication/i.test(message)) return 'access_required'; + if (/Cannot find module|Executable doesn't exist|browser executable/i.test(message)) return 'capability_unavailable'; + if (/ERR_NAME_NOT_RESOLVED|ENOTFOUND|ERR_CONNECTION|ERR_EMPTY_RESPONSE|ERR_INTERNET_DISCONNECTED|ECONNRESET|Timeout|timed out/i.test(message)) return 'transport_failure'; + return 'verification_failure'; +} +function writeJSON(filename, value) {fs.writeFileSync(filename,JSON.stringify(value,null,2)+'\n');} +function artifact(directory, relative, kind) { + const bytes=fs.readFileSync(path.join(directory,relative)); + return {path:relative,sha256:sha256(bytes),size_bytes:bytes.length,kind}; +} +function boundReport(inventory, tree, viewports, artifacts, failures, at) { + const boundaries=inventory.pages.map(p=>{ + const counts=viewports.map(v=>v.boundaries?.find(b=>b.path===p.path)?.captured_hosts); + return {path:p.path,url:p.url,revision:inventory.revision,source_sha256:p.source_sha256, + source_expressions:p.expressions.length, + captured_hosts:counts.length===VIEWPORTS.length && counts.every(n=>Number.isInteger(n) && n===counts[0])?counts[0]:null}; + }); + const wanted=inventory.pages.reduce((n,p)=>n+p.expressions.length,0); + failures=[...failures]; + if(JSON.stringify(viewports.map(v=>({width:v.width,height:v.height})))!==JSON.stringify(VIEWPORTS)) + failures.push('Missing, duplicate or unexpected viewport coverage'); + for(const viewport of viewports) { + if(JSON.stringify((viewport.boundaries||[]).map(b=>b.path))!==JSON.stringify(inventory.pages.map(p=>p.path))) + failures.push(viewport.width+': page coverage differs from inventory'); + for(const source of inventory.pages) { + const boundary=viewport.boundaries?.find(b=>b.path===source.path); + if(!boundary || boundary.source_sha256!==source.source_sha256 || boundary.revision!==inventory.revision || + boundary.url!==source.url || boundary.source_expressions!==source.expressions.length || boundary.captured_hosts!==source.expressions.length) + failures.push(viewport.width+': incomplete source/host coverage for '+source.path); + } + } + const structural=viewports.length===VIEWPORTS.length && viewports.every(v=>v.structural_matches===wanted); + const pass=!failures.length && structural && viewports.length===VIEWPORTS.length && viewports.every(v=>v.status==='pass'); + return {schema_version:1,kind:'hosted_math',repository:inventory.repository,revision:inventory.revision,tree, + renderer_profile:'github',captured_at:at,capture_method:'playwright-github',status:pass?'pass':'fail', + required_pages:inventory.pages.map(p=>p.path),boundaries,viewports,artifacts,failures, + structural_comparison:{status:structural?'pass':'fail',expressions_checked:structural?wanted:0}, + visual_review_required:true, + limits:'Observed GitHub MathML structure, counts, labels, relations and bounded geometry only. No independent scientific proof, exhaustive pixel review, host authenticity certificate or cross-browser guarantee.'}; +} + +async function run(args) { + const output=path.resolve(args.output); + if(fs.existsSync(output) && fs.readdirSync(output).length) throw new Error('Use an empty output directory; preserve earlier failed evidence'); + fs.mkdirSync(output,{recursive:true}); + const pinned=pinnedPages(args); + const helper=path.join(__dirname,'check_rendered_math.py'); + cp.execFileSync(args.python,[helper,'inventory','--root',args.root,'--repository',args.repository, + '--revision',args.revision,...pinned.pages.flatMap(p=>['--page',p]),'--output',path.join(output,'math-source.json')],{stdio:'pipe'}); + const inventory=JSON.parse(fs.readFileSync(path.join(output,'math-source.json'),'utf8')); + const at=new Date().toISOString(),failures=[],artifacts=[artifact(output,'math-source.json','source_inventory')],viewports=[]; + let browser; + const runtime={node:process.version}; + if(args.contract) { + fs.copyFileSync(path.resolve(args.contract),path.join(output,'math-contract.json')); + artifacts.push(artifact(output,'math-contract.json','text_contract')); + } + try { + const {chromium}=require('playwright'); + runtime.playwright=require('playwright/package.json').version; + runtime.mathjax=require('mathjax-full/package.json').version; + const compile=mathCompiler(); + const expected=Object.fromEntries(inventory.pages.map(p=>[p.path,p.expressions.map(e=>({...e, + mml:compile(e.tex,['math-fence','dollar-display'].includes(e.kind))}))])); + writeJSON(path.join(output,'expected-mathml.json'),expected); + artifacts.push(artifact(output,'expected-mathml.json','expected_mathml')); + browser=await chromium.launch({headless:true}); + runtime.browser=browser.version(); + for(const viewport of VIEWPORTS) { + const context=await browser.newContext({viewport,deviceScaleFactor:1,colorScheme:'light'}); + const capture={schema_version:1,repository:args.repository,revision:args.revision,renderer_profile:'github', + captured_at:at,capture_method:'playwright-github',pages:[]}; + let fatal=false; + try { + for(let index=0;index{ + for(let y=0,steps=0;ysetTimeout(r,50)); + } + window.scrollTo(0,0); + }); + await page.waitForTimeout(1000); + Object.assign(item,await article.evaluate(inspectArticle,expected[source.path])); + const html=prefix+'.html',png=prefix+'.png'; + fs.writeFileSync(path.join(output,html),await page.content()); + await page.screenshot({path:path.join(output,png),fullPage:true,timeout:30000}); + artifacts.push(artifact(output,html,'hosted_html'),artifact(output,png,'screenshot')); + item.artifacts={html,screenshot:png}; + } catch(error) { + item.errors.push(String(error)); + const category=classifyFailure(error); + failures.push(source.path+' at '+viewport.width+': '+category+': '+String(error)); + // Do not seek another route after an access or policy block. + fatal=['policy_denied','access_required','transport_failure'].includes(category); + } finally {capture.pages.push(item);await page.close();} + if(fatal) break; + } + } finally {await context.close();} + const captureFile='math-capture-'+viewport.width+'.json',resultFile='math-result-'+viewport.width+'.json'; + writeJSON(path.join(output,captureFile),capture);artifacts.push(artifact(output,captureFile,'hosted_capture')); + const command=[helper,'check','--inventory',path.join(output,'math-source.json'),'--capture',path.join(output,captureFile), + '--output',path.join(output,resultFile)]; + if(args.contract) command.push('--contract',path.resolve(args.contract)); + const check=cp.spawnSync(args.python,command,{encoding:'utf8'}); + if(check.error || !fs.existsSync(path.join(output,resultFile))) throw new Error('Math checker did not produce a result: '+(check.error||check.stderr)); + const result=JSON.parse(fs.readFileSync(path.join(output,resultFile),'utf8')); + artifacts.push(artifact(output,resultFile,'math_result')); + failures.push(...result.failures.map(f=>viewport.width+': '+f)); + const matches=capture.pages.reduce((n,p)=>n+p.math.filter(m=>m.structural_match && !m.errors.length).length,0); + viewports.push({...viewport,status:result.status,structural_matches:matches,capture_path:captureFile,result_path:resultFile,boundaries:result.boundaries}); + if(fatal) break; + } + } catch(error) {failures.push(classifyFailure(error)+': '+String(error));} + finally {if(browser) await browser.close();} + const report={...boundReport(inventory,pinned.tree,viewports,artifacts,failures,at),runtime}; + writeJSON(path.join(output,'hosted-report.json'),report); + console.log(JSON.stringify({status:report.status,report:path.join(output,'hosted-report.json'),sha256:sha256(fs.readFileSync(path.join(output,'hosted-report.json'))),pages:report.required_pages.length,failures:report.failures.length})); + return report.status==='pass'?0:1; +} +module.exports={argumentsFor,safePath,pinnedPages,mathCompiler,inspectArticle,classifyFailure,artifact,boundReport,VIEWPORTS,run}; +if(require.main===module) { + (async()=>{ + const args=argumentsFor(process.argv.slice(2)); + if(args.help) {console.log('capture_hosted_math.cjs --root REPO --repository owner/name --revision FULLSHA --output EMPTY_DIR [--page PATH ...] [--contract JSON] [--python python3]');return;} + process.exitCode=await run(args); + })().catch(error=>{console.error(String(error));process.exitCode=2;}); +} diff --git a/verification/hosted/check_rendered_math.py b/verification/hosted/check_rendered_math.py new file mode 100644 index 0000000..1d3bf98 --- /dev/null +++ b/verification/hosted/check_rendered_math.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python3 +r"""Check captured mathematical text against pinned GitHub Markdown source. + +Usage (Python 3.10+, standard library only): + check_rendered_math.py inventory --root REPO --repository owner/name \ + --revision FULL_COMMIT --page README.md --page science/results.md \ + --output math-source.json + check_rendered_math.py check --inventory math-source.json \ + --capture math-capture.json [--contract math-contract.json] [--output result.json] + +Inventory reads Git objects at the requested commit, not the working tree. +It recognizes math fences, $`...`$, $$...$$ and single-dollar inline math, +excluding ordinary code fences/spans. This is a bounded Markdown scanner, +not the hosting renderer's parser. Inspect its inventory before capture. + +Capture schema (collect actual full accessible math text in document order): + {"schema_version": 1, "repository": "owner/name", "revision": "40 hex", + "renderer_profile": "github", "captured_at": "ISO-8601 with timezone", + "capture_method": "how the actual hosted DOM was inspected", + "pages": [{"path": "README.md", "url": "exact pinned inventory URL", + "revision": "40 hex", "source_sha256": "inventory source hash", + "errors": [], "math": [{"rendered": true, "errors": [], + "text_source": "mathml", "text": "full text, not a sample"}]}]} +Allowed text_source values: mathml, mathjax-assistive, katex-accessibility, +renderer-accessibility. Extract one accessible representation per host; +exclude TeX annotation nodes and duplicate visual/accessibility copies. +Native MathML is valid. Empty math lists are valid for math-free pages. + +Optional contract strengthens content checks without pretending to translate +arbitrary TeX. Each entry selects a path/index (1-based) and source_sha256 +(the expression hash in inventory), with expected_text and/or required_text: + {"schema_version": 1, "expressions": [{"path": "README.md", "index": 1, + "source_sha256": "expression hash", "required_text": ["d", "(C1)"], + "expected_text": "|A|", "le": "≤", "leq": "≤", "ge": "≥", "geq": "≥", + "ne": "≠", "neq": "≠", "in": "∈", "notin": "∉", "subset": "⊂", + "subseteq": "⊆", "supset": "⊃", "supseteq": "⊇", "approx": "≈", + "simeq": "≃", "equiv": "≡", "propto": "∝", "cong": "≅", "sim": "∼", + "to": "→", "rightarrow": "→", "Rightarrow": "⇒", "implies": "⇒", + "mapsto": "↦", "leftrightarrow": "↔", "Leftrightarrow": "⇔", "iff": "⇔", +} +RELATION_SYMBOLS = set("<>=") | set(RELATIONS.values()) +COMMAND = re.compile(r"\\([A-Za-z]+)") +LABEL = re.compile(r"\\tag(\*)?\{([^{}]+)\}|\\text\{\s*\(([^{}()]+)\)\s*\}") +FENCE = re.compile(r"^ {0,3}(`{3,}|~{3,})([^\n]*)\n?$") +SHA = re.compile(r"[0-9a-f]{40}") +TEXT_SOURCES = {"mathml", "mathjax-assistive", "katex-accessibility", "renderer-accessibility"} + + +def digest(text: str) -> str: + return hashlib.sha256(text.encode("utf-8")).hexdigest() + + +def compact(text: str) -> str: + return "".join(c for c in unicodedata.normalize("NFKC", text) + if not c.isspace() and unicodedata.category(c) != "Cf") + + +def escaped(text: str, index: int) -> bool: + backslashes = 0 + while index > 0 and text[index - 1] == "\\": + backslashes += 1 + index -= 1 + return bool(backslashes % 2) + + +def tex_body(text: str) -> str: + """Drop unescaped TeX comments; do not expand user macros.""" + return "\n".join(line[:next((i for i, c in enumerate(line) + if c == "%" and not escaped(line, i)), len(line))] + for line in text.splitlines()) + + +def relations(tex: str) -> dict[str, int]: + expanded = COMMAND.sub(lambda m: RELATIONS.get(m.group(1), m.group(0)), tex_body(tex)) + return dict(sorted(Counter(c for c in expanded if c in RELATION_SYMBOLS).items())) + + +def labels(tex: str) -> list[str]: + return [compact(tag if star else f"({tag or text})") + for star, tag, text in LABEL.findall(tex_body(tex))] + + +def expressions(source: str) -> list[dict]: + """Return ordered source spans; reject unterminated recognized delimiters.""" + found: list[dict] = [] + + def add(tex: str, offset: int, end: int, kind: str) -> None: + found.append({"line_start": source.count("\n", 0, offset) + 1, + "line_end": source.count("\n", 0, end) + 1, + "kind": kind, "tex": tex, "source_sha256": digest(tex), + "relations": relations(tex), "labels": labels(tex)}) + + def prose(start: int, end: int) -> None: + i = start + while i < end: + if source[i] == "$" and not escaped(source, i): + opener, closer, kind = ("$`", "`$", "github-inline") if source.startswith("$`", i) else ( + ("$$", "$$", "dollar-display") if source.startswith("$$", i) + else ("$", "$", "dollar-inline")) + j = source.find(closer, i + len(opener), end) + while j >= 0 and escaped(source, j): + j = source.find(closer, j + len(closer), end) + if j < 0 or (kind == "dollar-inline" and "\n" in source[i:j]): + raise ValueError(f"unclosed {kind} at line {source.count(chr(10), 0, i) + 1}") + add(source[i + len(opener):j], i, j + len(closer) - 1, kind) + i = j + len(closer) + elif source[i] == "`" and not escaped(source, i): + n = 1 + while i + n < end and source[i + n] == "`": + n += 1 + j = source.find("`" * n, i + n, end) + i = j + n if j >= 0 else i + n + else: + i += 1 + + lines = source.splitlines(keepends=True) + offset = start = i = 0 + while i < len(lines): + match = FENCE.match(lines[i]) + if not match: + offset += len(lines[i]) + i += 1 + continue + prose(start, offset) + marker, info = match.groups() + begin = offset + offset += len(lines[i]) + body_start = offset + i += 1 + while i < len(lines): + closing = FENCE.match(lines[i]) + if closing and closing[1][0] == marker[0] and len(closing[1]) >= len(marker) and not closing[2].strip(): + break + offset += len(lines[i]) + i += 1 + if i == len(lines): + raise ValueError(f"unclosed code fence at line {source.count(chr(10), 0, begin) + 1}") + if info.strip() == "math": + add(source[body_start:offset], begin, offset, "math-fence") + offset += len(lines[i]) + i += 1 + start = offset + prose(start, len(source)) + for index, item in enumerate(found, 1): + item["index"] = index + return found + + +def safe_path(path: str) -> bool: + return isinstance(path, str) and bool(path) and "\\" not in path and not PurePosixPath(path).is_absolute() and all( + part not in {"", ".", ".."} for part in path.split("/")) + + +def make_inventory(repository: str, revision: str, sources: dict[str, str]) -> dict: + if not isinstance(repository, str) or not isinstance(revision, str) or not re.fullmatch( + r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", repository) or not SHA.fullmatch(revision): + raise ValueError("use owner/name and an exact lowercase 40-character commit SHA") + if not isinstance(sources, dict) or not sources or not all( + safe_path(p) and isinstance(s, str) for p, s in sources.items()): + raise ValueError("supply at least one safe repository-relative page path") + return {"schema_version": 1, "repository": repository, "revision": revision, + "renderer_profile": "github", "pages": [ + {"path": path, "url": f"https://github.com/{repository}/blob/{revision}/{quote(path, safe='/')}", + "source_sha256": digest(source), "source_text": source, "expressions": expressions(source)} + for path, source in sources.items()]} + + +def validate(inventory: dict, capture: dict, contract: dict | None = None) -> dict: + """Return failures rather than equating a passing text check with readiness.""" + failures: list[str] = [] + boundaries: list[dict] = [] + exceptions: list[dict] = [] + if not isinstance(inventory, dict) or not isinstance(capture, dict): + raise ValueError("inventory and capture must be JSON objects") + if type(inventory.get("schema_version")) is not int or type(capture.get("schema_version")) is not int or inventory["schema_version"] != 1 or capture["schema_version"] != 1: + raise ValueError("unsupported inventory or capture schema_version") + pages = inventory.get("pages") + if not isinstance(pages, list) or not pages or any(not isinstance(p, dict) for p in pages): + raise ValueError("inventory needs a nonempty pages array") + paths = [p.get("path") for p in pages] + if any(not isinstance(p, str) for p in paths) or len(set(paths)) != len(paths): + raise ValueError("inventory page paths must be unique strings") + rebuilt = make_inventory(inventory.get("repository", ""), inventory.get("revision", ""), + {p["path"]: p["source_text"] for p in pages}) + if inventory != rebuilt: + raise ValueError("inventory does not match its embedded source bytes/expression inventory") + for field in ("repository", "revision", "renderer_profile"): + if capture.get(field) != inventory[field]: + failures.append(f"capture {field} mismatch") + try: + timestamp = datetime.fromisoformat(capture.get("captured_at", "").replace("Z", "+00:00")) + if timestamp.tzinfo is None: + raise ValueError() + except (ValueError, AttributeError, TypeError): + failures.append("capture needs captured_at with a timezone") + if not isinstance(capture.get("capture_method"), str) or not capture["capture_method"].strip(): + failures.append("capture needs a nonempty capture_method") + captured_pages = capture.get("pages") + if not isinstance(captured_pages, list) or any(not isinstance(p, dict) for p in captured_pages): + raise ValueError("capture pages must be an array of objects") + captured_paths = [p.get("path") for p in captured_pages] + if captured_paths != paths: + failures.append("capture page paths/order differ from inventory (missing, extra or duplicate page)") + + contract = {"schema_version": 1, "expressions": []} if contract is None else contract + if not isinstance(contract, dict) or type(contract.get("schema_version")) is not int or contract["schema_version"] != 1 or not isinstance(contract.get("expressions"), list): + raise ValueError("invalid text contract schema") + rules: dict[tuple, dict] = {} + known = {(p["path"], e["index"]): e for p in pages for e in p["expressions"]} + for rule in contract["expressions"]: + if not isinstance(rule, dict): + raise ValueError("contract expressions must be objects") + key = (rule.get("path"), rule.get("index")) + if not isinstance(key[0], str) or type(key[1]) is not int or key not in known or key in rules or rule.get("source_sha256") != known[key]["source_sha256"]: + raise ValueError("unknown, duplicate or stale expression contract") + allowed = {"path", "index", "source_sha256", "required_text", "expected_text", "relation_override", + "allow_html_like_inequality", "reason", "evidence"} + if set(rule) - allowed: + raise ValueError("unknown contract field (contracts cannot skip checks)") + if "expected_text" in rule and (not isinstance(rule["expected_text"], str) or not compact(rule["expected_text"])): + raise ValueError("expected_text must be nonempty text") + if not isinstance(rule.get("required_text", []), list) or any( + not isinstance(v, str) or not compact(v) for v in rule.get("required_text", [])): + raise ValueError("required_text must be an array of nonempty text") + if "expected_text" not in rule and not rule.get("required_text"): + raise ValueError("each expression contract needs expected_text or required_text") + if "allow_html_like_inequality" in rule and not isinstance(rule["allow_html_like_inequality"], bool): + raise ValueError("allow_html_like_inequality must be boolean") + if "relation_override" in rule: + override = rule["relation_override"] + if not isinstance(override, dict) or any(k not in RELATION_SYMBOLS or type(v) is not int or v < 0 + for k, v in override.items()): + raise ValueError("relation_override must map known symbols to nonnegative integer counts") + if "relation_override" in rule or rule.get("allow_html_like_inequality"): + if not all(isinstance(rule.get(k), str) and rule[k].strip() for k in ("expected_text", "reason", "evidence")): + raise ValueError("renderer exception requires expected_text, reason and evidence") + exceptions.append(rule) + rules[key] = rule + + by_path = {p.get("path"): p for p in captured_pages if isinstance(p.get("path"), str)} + checked = 0 + for page in pages: + path = page["path"] + current = by_path.get(path) + if current is None: + continue + boundaries.append({"path": path, "source_sha256": page["source_sha256"], "url": current.get("url"), + "revision": current.get("revision"), "source_expressions": len(page["expressions"]), + "source_spans": [{k: e[k] for k in ("index", "line_start", "line_end", "source_sha256")} + for e in page["expressions"]]}) + for field, expected in (("url", page["url"]), ("revision", inventory["revision"]), ("source_sha256", page["source_sha256"])): + if current.get(field) != expected: + failures.append(f"{path}: captured {field} mismatch") + if current.get("errors") != []: + failures.append(f"{path}: renderer errors present or error evidence missing") + hosts = current.get("math") + if not isinstance(hosts, list): + failures.append(f"{path}: missing math-host array") + continue + boundaries[-1]["captured_hosts"] = len(hosts) + if len(hosts) != len(page["expressions"]): + failures.append(f"{path}: {len(page['expressions'])} source expressions, {len(hosts)} captured hosts") + for expr, host in zip(page["expressions"], hosts): + label = f"{path}:{expr['line_start']} expression {expr['index']}" + rule = rules.get((path, expr["index"]), {}) + if not isinstance(host, dict) or host.get("rendered") is not True or host.get("errors") != []: + failures.append(f"{label}: missing/unrendered host or renderer-error evidence") + continue + if host.get("text_source") not in TEXT_SOURCES or not isinstance(host.get("text"), str) or not compact(host["text"]): + failures.append(f"{label}: missing full accessible mathematical text/source") + continue + checked += 1 + text = compact(host["text"]) + expected = {k: v for k, v in rule.get("relation_override", expr["relations"]).items() if v} + actual = dict(sorted(Counter(c for c in text if c in RELATION_SYMBOLS).items())) + if expected != actual: + failures.append(f"{label}: relation mismatch; expected {expected}, captured {actual}") + for equation_label in expr["labels"]: + if equation_label not in text: + failures.append(f"{label}: missing equation label {equation_label}") + if re.search(r"<\s*[A-Za-z]", tex_body(expr["tex"])) and not rule.get("allow_html_like_inequality"): + failures.append(f"{label}: GitHub HTML-like inequality hazard; use supported syntax or a traced exact-text exception") + if "expected_text" in rule and compact(rule["expected_text"]) != text: + failures.append(f"{label}: full expected_text mismatch") + for required in rule.get("required_text", []): + if compact(required) not in text: + failures.append(f"{label}: missing required_text {required!r}") + return {"schema_version": 1, "status": "fail" if failures else "pass", + "repository": inventory["repository"], "revision": inventory["revision"], + "renderer_profile": inventory["renderer_profile"], "captured_at": capture.get("captured_at"), + "capture_method": capture.get("capture_method"), "boundaries": boundaries, + "expressions_checked": checked, "text_contracts": len(rules), "renderer_exceptions": exceptions, + "failures": failures, "visual_review_required": True, + "limits": "Counts, supported relations/visible labels and explicit text contracts only. No arbitrary TeX equivalence, scientific correctness, capture authentication or visual-layout certification."} + + +def read_json(path: Path) -> dict: + return json.loads(path.read_text(encoding="utf-8")) + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + commands = parser.add_subparsers(dest="command", required=True) + inv = commands.add_parser("inventory", help="read math source from an exact local Git commit") + inv.add_argument("--root", type=Path, required=True) + inv.add_argument("--repository", required=True) + inv.add_argument("--revision", required=True) + inv.add_argument("--page", action="append", required=True) + inv.add_argument("--output", type=Path, required=True) + check = commands.add_parser("check", help="check pinned extracted capture; does not fetch or render") + check.add_argument("--inventory", type=Path, required=True) + check.add_argument("--capture", type=Path, required=True) + check.add_argument("--contract", type=Path) + check.add_argument("--output", type=Path) + args = parser.parse_args(argv) + try: + if args.command == "inventory": + if not SHA.fullmatch(args.revision) or len(set(args.page)) != len(args.page) or not all(safe_path(p) for p in args.page): + raise ValueError("use an exact commit SHA and unique safe page paths") + commit = subprocess.check_output(["git", "--no-replace-objects", "rev-parse", f"{args.revision}^{{commit}}"], cwd=args.root, text=True).strip() + if commit != args.revision: + raise ValueError("revision does not identify the supplied commit") + sources = {p: subprocess.check_output(["git", "--no-replace-objects", "show", f"{commit}:{p}"], cwd=args.root).decode("utf-8") for p in args.page} + result = make_inventory(args.repository, commit, sources) + else: + result = validate(read_json(args.inventory), read_json(args.capture), read_json(args.contract) if args.contract else None) + output = json.dumps(result, indent=2, ensure_ascii=False) + "\n" + if args.output: + args.output.write_text(output, encoding="utf-8") + else: + print(output, end="") + return 1 if result.get("status") == "fail" else 0 + except (OSError, UnicodeError, ValueError, KeyError, TypeError, subprocess.CalledProcessError) as error: + print(f"ERROR: {error}", file=sys.stderr) + return 2 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/verification/reflection_results.json b/verification/reflection_results.json new file mode 100644 index 0000000..7f405fb --- /dev/null +++ b/verification/reflection_results.json @@ -0,0 +1,37 @@ +{ + "status": "passed", + "python": "3.12.14", + "numpy": "2.3.5", + "scipy": "1.17.0", + "checks_active_under_optimization": true, + "checks": [ + { + "name": "pair", + "program": "check_reflection_pair.py", + "status": "passed", + "report": "reflection_results_pair.json", + "summary": { + "max_transform_error": 0.0, + "max_reflection_error": 1.582025875713435e-16, + "max_pgf_error": 2.6645352591003757e-15, + "max_count_probability_error": 9.43689570931383e-16, + "max_coherent_formula_error": 1.1102230246251565e-16, + "max_word_average_series_error": 1.1140300925141704e-15, + "bell_reference_pgf_error": 1.1102230246251565e-16 + } + }, + { + "name": "tree", + "program": "check_reflection_tree.py", + "status": "passed", + "report": "reflection_results_tree.json", + "summary": { + "uniform_analytic_distance_lower_bound": 0.507120335911888, + "finite_word_cases": 2, + "original_field_blindness_error": 0.0, + "number_dephased_field_difference": 0.0 + } + } + ], + "scope": "Finite diagnostics supplement the analytical proofs; this is not an asymptotic, priority, or hosted-rendering certificate." +} diff --git a/verification/reflection_results_pair.json b/verification/reflection_results_pair.json new file mode 100644 index 0000000..7403ddb --- /dev/null +++ b/verification/reflection_results_pair.json @@ -0,0 +1,223 @@ +{ + "purpose": "finite numerical diagnostics, not asymptotic proof", + "python": "3.12.14", + "numpy": "2.3.5", + "scipy": "1.17.0", + "status": "passed", + "tolerance": 1e-11, + "summary": { + "max_transform_error": 0.0, + "max_reflection_error": 1.582025875713435e-16, + "max_pgf_error": 2.6645352591003757e-15, + "max_count_probability_error": 9.43689570931383e-16, + "max_coherent_formula_error": 1.1102230246251565e-16, + "max_word_average_series_error": 1.1140300925141704e-15, + "bell_reference_pgf_error": 1.1102230246251565e-16 + }, + "cases": [ + { + "t": 0.0, + "theta": 0.4, + "dark_mean": 0.0, + "count_cutoff": 8, + "states": { + "zero": { + "max_pgf_error": 0.0, + "max_count_probability_error": 0.0, + "dark_nonvacuum_probability": 0.0 + }, + "plus": { + "max_pgf_error": 0.0, + "max_count_probability_error": 0.0, + "dark_nonvacuum_probability": 0.0 + }, + "mixed": { + "max_pgf_error": 0.0, + "max_count_probability_error": 0.0, + "dark_nonvacuum_probability": 0.0 + }, + "generic": { + "max_pgf_error": 0.0, + "max_count_probability_error": 0.0, + "dark_nonvacuum_probability": 0.0 + } + }, + "transform_error": 0.0, + "reflection_error": 3.0102202242079384e-17, + "coherent_probability": 1.0, + "coherent_formula_error": 0.0, + "poisson_word_average_series_error": 0.0, + "word_series_cutoff": 8 + }, + { + "t": 0.2, + "theta": 0.03, + "dark_mean": 0.00017994600647958345, + "count_cutoff": 8, + "states": { + "zero": { + "max_pgf_error": 2.710505431213761e-20, + "max_count_probability_error": 5.421010862427522e-20, + "dark_nonvacuum_probability": 0.00017992981716807854 + }, + "plus": { + "max_pgf_error": 2.710505431213761e-20, + "max_count_probability_error": 5.421010862427522e-20, + "dark_nonvacuum_probability": 0.00017992981716807854 + }, + "mixed": { + "max_pgf_error": 2.710505431213761e-20, + "max_count_probability_error": 5.421010862427522e-20, + "dark_nonvacuum_probability": 0.00017992981716807854 + }, + "generic": { + "max_pgf_error": 2.220446049250313e-16, + "max_count_probability_error": 5.421010862427522e-20, + "dark_nonvacuum_probability": 0.00017992981716807854 + } + }, + "transform_error": 0.0, + "reflection_error": 1.5130152365436704e-18, + "coherent_probability": 0.9998200296961935, + "coherent_formula_error": 1.1102230246251565e-16, + "poisson_word_average_series_error": 5.551115123125783e-16, + "word_series_cutoff": 10 + }, + { + "t": 1.0, + "theta": 1.0, + "dark_mean": 0.7080734182735712, + "count_cutoff": 13, + "states": { + "zero": { + "max_pgf_error": 2.220446049250313e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.5074076968039681 + }, + "plus": { + "max_pgf_error": 2.220446049250313e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.5074076968039681 + }, + "mixed": { + "max_pgf_error": 2.220446049250313e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.5074076968039681 + }, + "generic": { + "max_pgf_error": 2.220446049250313e-16, + "max_count_probability_error": 5.551115123125783e-17, + "dark_nonvacuum_probability": 0.5074076968039682 + } + }, + "transform_error": 0.0, + "reflection_error": 3.312029663583673e-17, + "coherent_probability": 0.39876006322895113, + "coherent_formula_error": 5.551115123125783e-17, + "poisson_word_average_series_error": 1.2412670766236366e-16, + "word_series_cutoff": 16 + }, + { + "t": 3.0, + "theta": 0.4, + "dark_mean": 0.4549399359792519, + "count_cutoff": 12, + "states": { + "zero": { + "max_pgf_error": 2.482534153247273e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.36551392341139366 + }, + "plus": { + "max_pgf_error": 2.482534153247273e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.36551392341139366 + }, + "mixed": { + "max_pgf_error": 2.482534153247273e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.36551392341139366 + }, + "generic": { + "max_pgf_error": 2.2887833992611187e-16, + "max_count_probability_error": 1.1102230246251565e-16, + "dark_nonvacuum_probability": 0.36551392341139366 + } + }, + "transform_error": 0.0, + "reflection_error": 3.0102202242079384e-17, + "coherent_probability": 0.62273510951382, + "coherent_formula_error": 0.0, + "poisson_word_average_series_error": 4.613190423717512e-16, + "word_series_cutoff": 24 + }, + { + "t": 12.0, + "theta": 0.9, + "dark_mean": 7.363212568158523, + "count_cutoff": 35, + "states": { + "zero": { + "max_pgf_error": 2.6645352591003757e-15, + "max_count_probability_error": 4.996003610813204e-16, + "dark_nonvacuum_probability": 0.9993658420919148 + }, + "plus": { + "max_pgf_error": 2.6645352591003757e-15, + "max_count_probability_error": 4.718447854656915e-16, + "dark_nonvacuum_probability": 0.9993658420919148 + }, + "mixed": { + "max_pgf_error": 2.6645352591003757e-15, + "max_count_probability_error": 4.718447854656915e-16, + "dark_nonvacuum_probability": 0.9993658420919148 + }, + "generic": { + "max_pgf_error": 2.6645352591003757e-15, + "max_count_probability_error": 4.718447854656915e-16, + "dark_nonvacuum_probability": 0.9993658420919148 + } + }, + "transform_error": 0.0, + "reflection_error": 1.12901780570229e-16, + "coherent_probability": 0.00011376669274377213, + "coherent_formula_error": 0.0, + "poisson_word_average_series_error": 3.475288437451291e-18, + "word_series_cutoff": 47 + }, + { + "t": 30.0, + "theta": 0.18257418583505536, + "dark_mean": 0.9889381542010564, + "count_cutoff": 15, + "states": { + "zero": { + "max_pgf_error": 2.3314683517128287e-15, + "max_count_probability_error": 9.43689570931383e-16, + "dark_nonvacuum_probability": 0.6280285422760183 + }, + "plus": { + "max_pgf_error": 2.4424906541753444e-15, + "max_count_probability_error": 9.43689570931383e-16, + "dark_nonvacuum_probability": 0.6280285422760183 + }, + "mixed": { + "max_pgf_error": 2.4424906541753444e-15, + "max_count_probability_error": 9.43689570931383e-16, + "dark_nonvacuum_probability": 0.6280285422760183 + }, + "generic": { + "max_pgf_error": 2.4424906541753444e-15, + "max_count_probability_error": 9.43689570931383e-16, + "dark_nonvacuum_probability": 0.6280285422760183 + } + }, + "transform_error": 0.0, + "reflection_error": 1.582025875713435e-16, + "coherent_probability": 0.36890161120156884, + "coherent_formula_error": 5.551115123125783e-17, + "poisson_word_average_series_error": 1.1140300925141704e-15, + "word_series_cutoff": 81 + } + ] +} diff --git a/verification/reflection_results_tree.json b/verification/reflection_results_tree.json new file mode 100644 index 0000000..3337073 --- /dev/null +++ b/verification/reflection_results_tree.json @@ -0,0 +1,66 @@ +{ + "status": "passed", + "python": "3.12.14", + "numpy": "2.3.5", + "scipy": "1.17.0", + "finite_word_checks": [ + { + "m": 1, + "t": 0.7, + "maximum_count": 5, + "word_states": 364, + "retained_probability": 0.9999099736511174, + "poisson_tail": 9.002634888444216e-05, + "full_matrix_half_trace_distance": 0.47248178568259197, + "endpoint_fibre_half_trace_distance": 0.472481785682604, + "feynman_kac_bound_full": 0.1826648540612189, + "radial_distance_full": 0.47263365137995705 + }, + { + "m": 2, + "t": 1.2, + "maximum_count": 5, + "word_states": 364, + "retained_probability": 0.9984997749017708, + "poisson_tail": 0.0015002250982298904, + "full_matrix_half_trace_distance": 0.26615457532731396, + "endpoint_fibre_half_trace_distance": 0.26615457532732506, + "feynman_kac_bound_full": 0.09309726302186738, + "radial_distance_full": 0.2704200091034363 + } + ], + "maximum_same_parity_field_matrix_error": 0.0, + "maximum_original_identity_loop_field_difference": 0.0, + "maximum_total_number_dephased_field_difference": 0.0, + "maximum_global_number_phase_identity_error": 0.0, + "uniform_analytic_distance_lower_bound": 0.507120335911888, + "operational_signal_lower_bound": 0.27366906394670165, + "operational_success_after_half_diamond_error_0_1": 0.5368345319733508, + "large_time_radial_checks": [ + { + "t": 48, + "m": 1, + "feynman_kac_distance_lower_bound": 0.999999999999981, + "exact_radial_fibre_distance": 1.0000000000000002 + }, + { + "t": 96, + "m": 2, + "feynman_kac_distance_lower_bound": 0.9999999999999797, + "exact_radial_fibre_distance": 0.9999999999999982 + }, + { + "t": 192, + "m": 4, + "feynman_kac_distance_lower_bound": 0.9999999999999689, + "exact_radial_fibre_distance": 1.0000000000000007 + }, + { + "t": 480, + "m": 10, + "feynman_kac_distance_lower_bound": 1.0, + "exact_radial_fibre_distance": 0.9999999999999676 + } + ], + "scope": "Finite numerical checks supplement, but do not prove, the analytical lower bound." +} diff --git a/verification/verify_reflections.py b/verification/verify_reflections.py new file mode 100644 index 0000000..1290419 --- /dev/null +++ b/verification/verify_reflections.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Run the independent finite pair/tree field checks and retain their reports.""" +from __future__ import annotations + +import argparse +import json +import platform +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile + +import numpy as np +import scipy + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output", type=Path, + default=Path(__file__).with_name("reflection_results.json")) + args = parser.parse_args() + output = args.output + scripts = Path(__file__).resolve().parent + optimized = ["-O"] if sys.flags.optimize else [] + children = [("pair", "check_reflection_pair.py"), + ("tree", "check_reflection_tree.py")] + rows = [] + with tempfile.TemporaryDirectory(prefix="reflection-checks-") as temporary: + reports = [] + for name, script in children: + temporary_report = Path(temporary) / f"{name}.json" + command = [sys.executable, *optimized, str(scripts / script), + "--output", str(temporary_report)] + completed = subprocess.run(command, capture_output=True, text=True) + if completed.returncode != 0: + sys.stderr.write(completed.stderr or completed.stdout) + raise SystemExit(completed.returncode) + report = json.loads(temporary_report.read_text()) + if report.get("status") != "passed": + raise RuntimeError(f"{script} did not report a passing comparison") + destination = output.with_name(f"{output.stem}_{name}.json") + summary = report.get("summary") + if summary is None: + summary = { + "uniform_analytic_distance_lower_bound": + report["uniform_analytic_distance_lower_bound"], + "finite_word_cases": len(report["finite_word_checks"]), + "original_field_blindness_error": + report["maximum_original_identity_loop_field_difference"], + "number_dephased_field_difference": + report["maximum_total_number_dephased_field_difference"], + } + rows.append({"name": name, "program": script, "status": "passed", + "report": destination.name, "summary": summary}) + reports.append((temporary_report, destination)) + output.parent.mkdir(parents=True, exist_ok=True) + for source, destination in reports: + shutil.copyfile(source, destination) + result = {"status": "passed", "python": platform.python_version(), + "numpy": np.__version__, "scipy": scipy.__version__, + "checks_active_under_optimization": True, + "checks": rows, + "scope": "Finite diagnostics supplement the analytical proofs; " + "this is not an asymptotic, priority, or hosted-rendering certificate."} + output.write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + main()