From 07dfb293c321e80e04ec20273f2def4aae75f821 Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Fri, 16 Oct 2026 20:42:01 +0800 Subject: [PATCH 1/5] Align release documentation and strengthen integrity and rendering checks --- .github/workflows/hosted-render.yml | 33 ++++++++ .github/workflows/verify.yml | 1 + check_repository.py | 2 + docs/bandwidth.md | 21 +++-- docs/verification.md | 18 +++- tools/check_release.py | 82 ++++++++++++++++++ tools/inspect_hosted_render.py | 127 ++++++++++++++++++++++++++++ tools/test_release_checks.py | 58 +++++++++++++ 8 files changed, 334 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/hosted-render.yml create mode 100644 tools/check_release.py create mode 100644 tools/inspect_hosted_render.py create mode 100644 tools/test_release_checks.py diff --git a/.github/workflows/hosted-render.yml b/.github/workflows/hosted-render.yml new file mode 100644 index 0000000..f066f96 --- /dev/null +++ b/.github/workflows/hosted-render.yml @@ -0,0 +1,33 @@ +name: Inspect hosted mathematics +on: + pull_request: + paths: + - '**.md' + - 'tools/inspect_hosted_render.py' + - '.github/workflows/hosted-render.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + hosted-render: + runs-on: ubuntu-latest + timeout-minutes: 12 + env: + RENDER_REF: ${{ github.event.pull_request.head.sha || github.sha }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ env.RENDER_REF }} + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + - run: python -m pip install playwright==1.55.0 + - run: python -m playwright install --with-deps chromium + - run: python tools/inspect_hosted_render.py --ref "$RENDER_REF" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: hosted-render-${{ env.RENDER_REF }} + path: build/hosted-render/ + retention-days: 14 + if-no-files-found: warn diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 4b76867..a424fca 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -20,4 +20,5 @@ jobs: cache: pip - run: python -m pip install -r requirements.txt - run: python check_repository.py + - run: python tools/test_release_checks.py - run: python verify.py diff --git a/check_repository.py b/check_repository.py index f24bdc2..f84441d 100644 --- a/check_repository.py +++ b/check_repository.py @@ -8,6 +8,7 @@ from urllib.parse import unquote, urlsplit from verify import SUITES from tools.check_learning import check_learning +from tools.check_release import check_release ROOT = Path(__file__).resolve().parent 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).' @@ -61,6 +62,7 @@ def main() -> None: assert keys and len(keys) == len(set(keys)), 'Missing or duplicate bibliography keys' assert set(keys).issubset({x.upper() for x in anchors((ROOT/'docs/related-work.md').read_text())}) learning = check_learning(ROOT) + check_release(ROOT) print(f'PASS: {len(markdown)} reading files, {link_count} local links, {len(sources)} Python files, {len(SUITES)} verified suites, {len(keys)} references and {learning["milestones"]} milestones.') if __name__ == '__main__': diff --git a/docs/bandwidth.md b/docs/bandwidth.md index 56cf70f..8c4c6bb 100644 --- a/docs/bandwidth.md +++ b/docs/bandwidth.md @@ -207,18 +207,18 @@ This uses no assumption that the control leaves the clean helpers pure at interm The converse would also hold if final helpers were allowed to change: an exactly unitary payload channel makes its Choi state pure and factorized from the remaining output. Its reference-assisted cut still carries at least 2n bits. Keeping the return requirement in the task makes the comparison and the constructive statement unambiguous. -### 4.1 Fixed high-fidelity extension for 0<=s<=n +### 4.1 Approximate routing -Consider the entanglement fidelity F_e of the payload channel on the same Bell-reference test with initialized helpers and bus, after tracing out all remaining physical outputs. Suppose F_e>=1-epsilon. The global output is pure. Projecting it onto the ideal pure payload Choi vector gives an environmental vector, so the global output is within trace distance sqrt(epsilon) of a product of that ideal vector and some environmental pure state. The latter has cut entropy at least 2n. +The fixed-error clean-helper law for every $s\ge0$ is the $p=0$ case of the [mixed-helper theorem](mixed-helpers.md#1-task-and-matching-law). Its converse uses a payload-sized mutual-information estimate, rather than a continuity penalty proportional to the number of helpers. -The A Hilbert-space dimension is 2^{2n+s}. Entropy continuity therefore implies, for small epsilon, +For the Bell-reference test above, let $F_e\ge1-\eta$ be the payload Choi overlap with the ideal pure target after all other outputs are traced out. The payload trace distance from that target is at most $e=\sqrt\eta$. Applying the [payload-sized endpoint argument](mixed-helpers.md#2-converse-an-entropy-budget-with-a-payload-sized-continuity-bound) gives $$ -S_A(T)\ge2n-\sqrt\epsilon(2n+s)-h_2(\sqrt\epsilon). +S_A(T)\ge2n-4ne-\frac32h_2(e),\qquad e=\sqrt\eta. \tag{17} $$ -Replace the numerator 2n in the rate integration by this expression. At s<=n and fixed epsilon=0.01, it is at least 1.7n-h_2(0.1), preserving the asymptotic scaling in (1). This fidelity condition is not a worst-case diamond-error assertion. For s much larger than n, (17) alone need not be useful; no uniform approximate extension to that regime is asserted here. +Replace the required entropy change $2n$ in the rate integration by this expression. For fixed sufficiently small $\eta$ it is proportional to $n$, uniformly in $s$. High Choi fidelity here supplies a necessary test of routing accuracy; it is not identified with a worst-case diamond guarantee. The exact construction satisfies the stronger complete-operation specification. ## 5. Matching exact construction with returned clean helpers @@ -303,7 +303,14 @@ $$ \tag{23} $$ -Equations (16),(22),(23) prove (1). The exact list contains 2^{n-1} joint spectator translations per Ising gate; this is independent of s because there are n-1 unknown spectators in the blocks. Its internal controls are still free. The no-helper polynomial-list approximation and the separately charged finite-control compiler are described in [Control models](control-models.md). +Equations (16),(22),(23) prove (1). Synchronize the block translations using the same counter, restricted to the spectator bits of each block. Uniform marginal coverage of every block suffices because the contact is additive. The [exact synchronized schedule](accuracy-and-resources.md#3-short-exact-synchronized-block-schedules) uses + +$$ +K_{\mathrm{exact}}=2^{\max_i(b_i-1)} +=2^{\lceil(n+s)/(s+1)\rceil-1} +$$ + +intervals per Ising gate. All conjugated contacts commute, so no short-time approximation is involved. At $s=0$ this reduces to $2^{n-1}$; with $s=\Theta(n)$ it is bounded independently of $n$. Internal controls are still free. Approximate-list guarantees are in [Accuracy and resources](accuracy-and-resources.md#4-polynomial-contact-lists-at-fixed-uniform-accuracy); finite gate-speed costs are separate in [Control models](control-models.md). ## 6. Unknown helpers on identical hardware @@ -343,6 +350,6 @@ For s between zero and n, the exact optimal clean-helper interaction time has th The entries refer to ideal internal controls. In particular, the constant-time endpoint does not imply a constant-depth, bounded-strength implementation of the internal encodings or fanout. -Equation (13) supplies a converse for arbitrary mixed physical states because I is a continuous entropy deficit. The matching construction and law (1), however, are for s exactly initialized pure helpers. No matching achievability theorem parameterized only by entropy is asserted for an arbitrary thermal or mixed helper state. Their spectrum and permitted error can matter. The exact-helper law is not a hardware noise-tolerance theorem. +Equation (13) bounds arbitrary mixed physical states through their entropy deficit. The exact construction and law (1) use pure helpers. The [mixed-helper theorem](mixed-helpers.md) gives the matching fixed-error law for independent known product preparations, including their preparation references. The [correlated-state counterexample](mixed-helpers.md#7-why-the-product-state-assumption-cannot-be-dropped) explains why entropy alone does not determine achievable bandwidth for arbitrary helper states. Preparation robustness is distinct from ongoing dynamical noise. With bounded control strength, the displayed small-gate recursive implementation has linear total duration at a fixed internal/contact strength ratio G/J. That is a statement about a particular compiler, not a universal linear lower bound for all finite-speed protocols. The workspace law and this finite-control comparison use distinct resource models. diff --git a/docs/verification.md b/docs/verification.md index 0ed63ce..32bfd6c 100644 --- a/docs/verification.md +++ b/docs/verification.md @@ -9,6 +9,7 @@ Use Python 3.13 with the pinned NumPy 2.3.5 and SciPy 1.17.0 dependencies: ```bash python -m pip install -r requirements.txt python check_repository.py +python tools/test_release_checks.py python verify.py ``` @@ -41,4 +42,19 @@ The ensemble suite includes a selected collective state that violates an incorre ## Maintenance -`check_repository.py` checks syntax, local links and citation anchors, math delimiters, bibliography keys, the contact paragraph, the original license, exact suite coverage, and all check-source hashes. CI runs both the repository checker and complete numerical suite. Update the tracked result file only from a successful associated run after changing scientific check sources. Keep full generated cases in the ignored build directory or export them as a verification bundle. +`check_repository.py` checks syntax, local links and citation anchors, math delimiters, bibliography keys, the contact paragraph, the original license, the 30-milestone map, exact suite coverage, and all check-source hashes. The release checker additionally checks table-cell consistency across every reading page, duplicate equation tags, explicit success flags, and the digest of the tracked finite-size certificate file against its executed-output record. Seven regression tests exercise valid input and deliberately malformed material; these are structural tests, not extra scientific suites. CI runs these checks and the ten numerical suites. Update tracked scientific results only from a successful associated run after changing scientific check sources. Keep generated cases in the ignored build directory or export them as a verification bundle. + + +## Hosted rendering + +The separate `Inspect hosted mathematics` workflow opens the actual public GitHub pages at an immutable commit in Chromium. It checks eight entrypoint, learning, and mathematical pages at desktop and mobile widths, verifies the expected mathematics has rendered, checks MathJax errors and table structure, and records page-level overflow. Screenshots and a JSON report are retained as workflow artifacts for 14 days. It needs network access and a separate Playwright installation; it is not a dependency of the offline scientific verifier. + +To invoke the same check in a network-enabled environment: + +```bash +python -m pip install playwright==1.55.0 +python -m playwright install chromium +python tools/inspect_hosted_render.py --ref COMMIT_SHA +``` + +Replace `COMMIT_SHA` with a full 40-character commit hash in this repository. The script uses no authentication and only reads this repository's public pages. A blocked host or unfinished render fails the check; it is not silently replaced by a local preview. A hosted-browser diagnostic and a screenshot review are different evidence from mathematical verification. Neither establishes independent scientific review or validates a different hosting renderer. diff --git a/tools/check_release.py b/tools/check_release.py new file mode 100644 index 0000000..92777ef --- /dev/null +++ b/tools/check_release.py @@ -0,0 +1,82 @@ +"""Dependency-free checks of reader-facing syntax and tracked result integrity.""" +from __future__ import annotations +import hashlib +import json +from pathlib import Path +import re + + +def check_reading_text(text: str, label: str) -> int: + """Check Markdown structures that can silently change mathematical meaning.""" + fenced = re.compile(r'^([`~]{3,}).*$', re.M) + lines = text.splitlines() + in_fence = None + display = False + table_width = None + tables = 0 + tags = [] + for index, line in enumerate(lines, 1): + stripped = line.strip() + match = fenced.fullmatch(stripped) + if match: + mark = match[1] + if in_fence is None: + in_fence = mark[0] + elif mark[0] == in_fence: + in_fence = None + table_width = None + continue + if in_fence: + continue + if stripped == '$$': + display = not display + table_width = None + continue + if display: + tags.extend(re.findall(r'\\tag\{([^}]+)\}', line)) + continue + if stripped.startswith('|'): + # Unescaped vertical bars are GFM cell separators, including inside + # TeX. Use \lvert/\rvert in a cell rather than bare ket delimiters. + width = len(re.findall(r'(? dict[str, int]: + pages = [root/'README.md', root/'AGENTS.md', root/'llms.txt', *sorted((root/'docs').glob('*.md'))] + tables = 0 + for page in pages: + if page.is_symlink(): + raise AssertionError(f'Reading file is a symbolic link: {page}') + tables += check_reading_text(page.read_text(), str(page.relative_to(root))) + report = json.loads((root/'results/verification.json').read_text()) + if report.get('all_passed') is not True: + raise AssertionError('Recorded verification does not explicitly report success') + for suite in report['suites']: + summary = suite['summary'] + flags = (summary.get('all_passed'), summary.get('all_assertions_passed'), + summary.get('summary', {}).get('all_passed')) + if not any(flag is True for flag in flags): + raise AssertionError(f"No explicit success flag: {suite['script']}") + closure = next(x for x in report['suites'] if x['script'] == 'verify_scientific_closure.py') + certificate = root/'results/scientific-closure.json' + if hashlib.sha256(certificate.read_bytes()).hexdigest() != closure['output_sha256']: + raise AssertionError('Tracked scientific certificates differ from the recorded executed output') + return {'reading_files': len(pages), 'tables': tables, 'tracked_certificate_files': 1} + + +if __name__ == '__main__': + print('PASS:', check_release(Path(__file__).resolve().parents[1])) diff --git a/tools/inspect_hosted_render.py b/tools/inspect_hosted_render.py new file mode 100644 index 0000000..96c1449 --- /dev/null +++ b/tools/inspect_hosted_render.py @@ -0,0 +1,127 @@ +"""Inspect actual GitHub Markdown in Chromium; save screenshots and DOM diagnostics. + +Run separately from the offline scientific checks. It uses no credentials and +only reads public pages of this repository at a supplied immutable commit. +A blocked or unrendered page is a failure, never a successful visual check. +""" +from __future__ import annotations +import argparse +import json +from pathlib import Path +import re +import sys +from urllib.parse import quote + +REPOSITORY = 'GoGoKo699/Quantum-Routing-Bandwidth' +PAGES = ('README.md', 'docs/learning.md', 'docs/learning-bridges.md', + 'docs/milestones.md', 'docs/bandwidth.md', 'docs/mixed-helpers.md', + 'docs/accuracy-and-resources.md', 'docs/theorem-map.md') + +SNAPSHOT = r'''() => { + const article = document.querySelector('article.markdown-body') || document.querySelector('.markdown-body'); + if (!article) return {article: false}; + function elements(root) { + let out = [...root.querySelectorAll('*')]; + for (const item of [...out]) if (item.shadowRoot) out.push(...elements(item.shadowRoot)); + return out; + } + const all = elements(article); + const markers = all.filter(x => x.localName === 'math-renderer'); + const errors = all.filter(x => x.matches('mjx-merror,merror,.MathJax_Error,[data-mjx-error],[data-mml-node="merror"]')); + const nodes = markers.map(x => { + const inner = elements(x.shadowRoot || x); + return {ready: inner.some(y => y.matches('mjx-container,svg,math,img')), + error: /Math rendering failed|Undefined control sequence|ParseError|Unable to render expression/i.test(x.textContent || '')}; + }); + return {article: true, heading: article.querySelector('h1')?.textContent?.trim(), + markers: markers.length, ready: nodes.filter(x => x.ready).length, + errors: errors.map(x => (x.getAttribute('data-mjx-error') || x.textContent || '').slice(0,180)), + marker_errors: nodes.filter(x => x.error).length, + rendered_containers: all.filter(x => x.localName === 'mjx-container').length, + page_width: document.documentElement.scrollWidth, viewport: window.innerWidth, + table_columns: [...article.querySelectorAll('table')].map(t => [...t.rows].map(row => row.cells.length))}; +}''' + + +def source_math_count(text: str) -> int: + text = re.sub(r'```.*?```', '', text, flags=re.S) + displays = re.findall(r'\$\$.*?\$\$', text, re.S) + text = re.sub(r'\$\$.*?\$\$', '', text, flags=re.S) + return len(displays) + len(re.findall(r'(? None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--ref', required=True) + parser.add_argument('--output', type=Path, default=Path('build/hosted-render')) + args = parser.parse_args() + if not re.fullmatch(r'[0-9a-f]{40}', args.ref): + parser.error('--ref must be a full immutable Git commit SHA') + from playwright.sync_api import sync_playwright + root = Path(__file__).resolve().parents[1] + args.output.mkdir(parents=True, exist_ok=True) + report = {'repository': REPOSITORY, 'ref': args.ref, + 'scope': 'Actual public GitHub rendering; automated DOM/layout checks and screenshot evidence, not scientific review.', + 'pages': []} + with sync_playwright() as p: + browser = p.chromium.launch() + context = browser.new_context(viewport={'width': 1180, 'height': 900}, color_scheme='light') + page = context.new_page() + for name in PAGES: + row = {'file': name, 'checks': [], 'problems': []} + expected = source_math_count((root/name).read_text()) + row['expected_math'] = expected + url = f'https://github.com/{REPOSITORY}/blob/{args.ref}/{quote(name)}' + row['url'] = url + try: + response = page.goto(url, wait_until='domcontentloaded', timeout=45000) + row['http_status'] = response.status if response else None + if not response or response.status != 200: + raise RuntimeError(f'GitHub returned {row["http_status"]}') + page.locator('article.markdown-body, .markdown-body').first.wait_for(timeout=30000) + for width in (1180, 390): + page.set_viewport_size({'width': width, 'height': 900}) + markers = page.locator('math-renderer') + for i in range(markers.count()): + markers.nth(i).scroll_into_view_if_needed(timeout=5000) + page.wait_for_timeout(50) + # Give lazy MathJax rendering a bounded final settling period. + for _ in range(20): + state = page.evaluate(SNAPSHOT) + if state.get('ready', 0) >= expected: + break + page.wait_for_timeout(250) + state = page.evaluate(SNAPSHOT) + title = (root/name).read_text().splitlines()[0].removeprefix('# ') + if state.get('heading') != title: + row['problems'].append(f'{width}px: missing expected document title') + if state.get('markers') != expected or state.get('ready', 0) < expected: + row['problems'].append(f'{width}px: missing or unfinished mathematics') + if state.get('errors') or state.get('marker_errors'): + row['problems'].append(f'{width}px: mathematical rendering error') + if state.get('page_width', 0) > width+3: + row['problems'].append(f'{width}px: page-level horizontal overflow') + if any(len(set(cols)) > 1 for cols in state.get('table_columns', [])): + row['problems'].append(f'{width}px: inconsistent rendered table cells') + row['checks'].append(state) + page.evaluate('window.scrollTo(0,0)') + page.screenshot(path=str(args.output/f'{name.replace("/", "_")}-{width}.png'), full_page=True) + except Exception as exc: + row['problems'].append(str(exc)[:1000]) + row['passed'] = not row['problems'] + report['pages'].append(row) + print(json.dumps(row), flush=True) + if row.get('http_status') in (403, 429) or any('ERR_' in x for x in row['problems']): + # A transport or access failure cannot be repaired by repeatedly + # requesting all the other pages from the same inaccessible host. + break + context.close(); browser.close() + report['all_passed'] = len(report['pages']) == len(PAGES) and all(x['passed'] for x in report['pages']) + (args.output/'report.json').write_text(json.dumps(report, indent=2)+'\n') + print('HOSTED_RENDER_RESULT='+json.dumps(report), flush=True) + if not report['all_passed']: + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/tools/test_release_checks.py b/tools/test_release_checks.py new file mode 100644 index 0000000..77c2620 --- /dev/null +++ b/tools/test_release_checks.py @@ -0,0 +1,58 @@ +"""Regression tests for the release checker; these are not scientific suites.""" +from __future__ import annotations +import hashlib +import json +from pathlib import Path +import tempfile +import unittest +from check_release import check_reading_text, check_release + + +class ReadingChecks(unittest.TestCase): + def test_valid_math_and_table(self): + text = '| A | B |\n|---|---|\n| $\\lvert x\\rangle$ | $\\lVert X\\rVert$ |\n\n$$\n|x|\\tag{1}\n$$\n' + self.assertEqual(check_reading_text(text, 'fixture'), 1) + + def test_unescaped_ket_in_table(self): + with self.assertRaisesRegex(AssertionError, 'table cells'): + check_reading_text('| A | B |\n|---|---|\n| $|x\\rangle$ | yes |\n', 'fixture') + + def test_duplicate_tag(self): + with self.assertRaisesRegex(AssertionError, 'repeated equation'): + check_reading_text('$$\nx\\tag{1}\n$$\n\n$$\ny\\tag{1}\n$$\n', 'fixture') + + def test_fenced_examples_are_not_tables(self): + self.assertEqual(check_reading_text('```text\n| a |\n| a | b |\n$$\n```\n', 'fixture'), 0) + + def test_unclosed_fence(self): + with self.assertRaisesRegex(AssertionError, 'code fence'): + check_reading_text('```python\nx=1\n', 'fixture') + + def test_unclosed_math(self): + with self.assertRaisesRegex(AssertionError, 'display mathematics'): + check_reading_text('$$\nx\n', 'fixture') + + def test_result_integrity_and_explicit_success(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + (root/'docs').mkdir(); (root/'results').mkdir() + for name in ('README.md', 'AGENTS.md', 'llms.txt'): + (root/name).write_text('# Fixture\n') + content = b'{"all_passed": true}\n' + path = root/'results/scientific-closure.json';path.write_bytes(content) + result = {'all_passed': True, 'suites': [{'script': 'verify_scientific_closure.py', + 'output_sha256': hashlib.sha256(content).hexdigest(), 'summary': {'all_passed': True}}]} + summary = root/'results/verification.json'; summary.write_text(json.dumps(result)) + self.assertEqual(check_release(root)['tracked_certificate_files'], 1) + path.write_bytes(content+b' ') + with self.assertRaisesRegex(AssertionError, 'certificates differ'): + check_release(root) + path.write_bytes(content) + result['suites'][0]['summary']['all_passed'] = 'true' + summary.write_text(json.dumps(result)) + with self.assertRaisesRegex(AssertionError, 'explicit success flag'): + check_release(root) + + +if __name__ == '__main__': + unittest.main() From 9e1675147093ccd3490ad1af0716e2c3b5d69870 Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Fri, 16 Oct 2026 20:47:37 +0800 Subject: [PATCH 2/5] Record exact hosted markup for incomplete or missing math rendering --- tools/inspect_hosted_render.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/inspect_hosted_render.py b/tools/inspect_hosted_render.py index 96c1449..e7720ce 100644 --- a/tools/inspect_hosted_render.py +++ b/tools/inspect_hosted_render.py @@ -30,10 +30,14 @@ const errors = all.filter(x => x.matches('mjx-merror,merror,.MathJax_Error,[data-mjx-error],[data-mml-node="merror"]')); const nodes = markers.map(x => { const inner = elements(x.shadowRoot || x); - return {ready: inner.some(y => y.matches('mjx-container,svg,math,img')), + return {markup: x.outerHTML.slice(0,1800), shadow: x.shadowRoot?.innerHTML.slice(0,1800), ready: inner.some(y => y.matches('mjx-container,svg,math,img')), error: /Math rendering failed|Undefined control sequence|ParseError|Unable to render expression/i.test(x.textContent || '')}; }); - return {article: true, heading: article.querySelector('h1')?.textContent?.trim(), + const copy = article.cloneNode(true); + copy.querySelectorAll('math-renderer,pre,code').forEach(x => x.remove()); + const literal = (copy.textContent || '').split('\n').filter(x => x.includes('$')); + return {unready_details: nodes.filter(x => !x.ready), sample_ready: nodes.find(x => x.ready), + literal_math_lines: literal, article: true, heading: article.querySelector('h1')?.textContent?.trim(), markers: markers.length, ready: nodes.filter(x => x.ready).length, errors: errors.map(x => (x.getAttribute('data-mjx-error') || x.textContent || '').slice(0,180)), marker_errors: nodes.filter(x => x.error).length, From 5acaed1f04ecb1a23973a84c09c32f9c9bb35958 Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Fri, 16 Oct 2026 21:11:59 +0800 Subject: [PATCH 3/5] Preserve mathematical notation in GitHub's hosted renderer --- AGENTS.md | 6 +- README.md | 28 ++--- docs/accuracy-and-resources.md | 124 ++++++++++----------- docs/bandwidth.md | 150 ++++++++++++------------- docs/control-models.md | 72 ++++++------ docs/entropy-flow.md | 82 +++++++------- docs/learning-bridges.md | 56 +++++----- docs/learning.md | 46 ++++---- docs/mixed-helpers.md | 194 ++++++++++++++++----------------- docs/theorem-map.md | 84 +++++++------- docs/verification.md | 9 +- tools/check_release.py | 5 + tools/inspect_hosted_render.py | 13 ++- tools/test_release_checks.py | 4 + 14 files changed, 445 insertions(+), 428 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 5d1399e..ae38b5e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,6 +30,8 @@ Follow `docs/coaching.md` as the single protocol. Every round has Revise → Lea Credit conditional variance, entropy-fluctuation speed limits, Hamiltonian averaging, reversible compression, concentration inequalities, and prior routing/initialization work. Add foundational sources to both `docs/related-work.md` and `references.bib`. Keep journal-target judgments and development diaries out of reader-facing science. Preserve assumptions, proof domains, source provenance, and load-bearing limitations when removing redundancy. -Run `python check_repository.py` and `python verify.py`. The repository checker includes `tools/check_learning.py`, which validates the map, dependencies, source links, and learning entrypoints. The ten numerical suites remain separate. Replace tracked numerical results only after a relevant executed source change; furnishing alone does not justify new scientific provenance. Passing checks is not outside endorsement. +Run `python check_repository.py`, `python tools/test_release_checks.py`, and `python verify.py`. The repository checker includes `tools/check_learning.py`, which validates the map, dependencies, source links, and learning entrypoints. Release checks also validate reading-page tables, equation tags, and tracked certificate integrity. The ten numerical suites remain separate. Replace tracked numerical results only after a relevant executed source change; furnishing alone does not justify new scientific provenance. Passing checks is not outside endorsement. -Use GitHub dollar-delimited math with blank lines around displays, no display equations inside tables, and local navigation links. Inspect rendered README, learning pages, and representative math-heavy science pages for macro errors, missing subscripts, bra–ket rendering, and overflow. Test the actual GitHub renderer when accessible; identify a local MathJax preview as local, not as hosting verification. Report which checks actually ran. +For mathematical pages, prefer GitHub fenced math blocks and its backtick-protected inline math syntax, with blank lines around display blocks and no displays inside tables. Use supported upright commands such as `\mathrm{Tr}` and brace starred subscripts as `_{\ast}`. This repository's hosted checks exposed Markdown consumption of backslashes and a rejected `\operatorname` macro; local MathJax success alone is insufficient. These are hosting-specific precautions, not universal restrictions on TeX. The [official syntax](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions) describes protected forms. + +Inspect rendered README, learning pages, and representative math-heavy science pages for macro errors, missing subscripts, bra–ket rendering, and overflow. Use the separate `Inspect hosted mathematics` workflow to check actual GitHub at a pinned commit and retain screenshots. A local MathJax preview is local, not hosting verification. Report which checks actually ran; blocked access or unfinished rendering is not a pass. diff --git a/README.md b/README.md index 550bfcf..4b77600 100644 --- a/README.md +++ b/README.md @@ -19,18 +19,18 @@ The single educational anchor is **John Watrous, *The Theory of Quantum Informat ## Main result -Each module contains $n\ge1$ payload qubits and $s\ge0$ helpers. Every module-qubit–bus interaction has operator norm at most $J$; all contacts may act simultaneously. Internal operations confined to either module or the bus have zero charged duration. Both interfaces remain bounded. There are no measurements, resets, or extra initialized qubits. +Each module contains $`n\ge1`$ payload qubits and $`s\ge0`$ helpers. Every module-qubit–bus interaction has operator norm at most $`J`$; all contacts may act simultaneously. Internal operations confined to either module or the bus have zero charged duration. Both interfaces remain bounded. There are no measurements, resets, or extra initialized qubits. -For helpers independently prepared in the known state $\rho_p=(1-p)|0\rangle\langle0|+p|1\rangle\langle1|$, with $0\le p\le1/2$, the optimal fixed-error interaction time is +For helpers independently prepared in the known state $`\rho_p=(1-p)|0\rangle\langle0|+p|1\rangle\langle1|`$, with $`0\le p\le1/2`$, the optimal fixed-error interaction time is -$$ +```math T_{\epsilon,p}(n,s) =\Theta_\epsilon\!\left( \frac{n}{J\sqrt{(n+s)\{1+s[1-h_2(p)]\}}} \right). -$$ +``` -For every fixed $0<\epsilon\le0.1$, the constants are uniform in $n,s,p$. The error is a complete-operation half diamond distance, including arbitrary reference-entangled payload/bus inputs and the fixed helpers' inaccessible preparation references. The physical helper density matrix returns exactly in the construction; remaining correlations and bus errors are included in the error budget. Compression, routing, and decompression share one invariant high-probability sector, so initial preparation error does not accumulate gate by gate. +For every fixed $`0\lt \epsilon\le0.1`$, the constants are uniform in $`n,s,p`$. The error is a complete-operation half diamond distance, including arbitrary reference-entangled payload/bus inputs and the fixed helpers' inaccessible preparation references. The physical helper density matrix returns exactly in the construction; remaining correlations and bus errors are included in the error budget. Compression, routing, and decompression share one invariant high-probability sector, so initial preparation error does not accumulate gate by gate. The [full proof](docs/mixed-helpers.md) distinguishes zero error from fixed nonzero error. A correlated-state counterexample shows why entropy deficit alone is not a complete bandwidth invariant for arbitrary helper states. @@ -38,27 +38,27 @@ The [full proof](docs/mixed-helpers.md) distinguishes zero error from fixed nonz On identical hardware with the same payload, -$$ +```math T_{\mathrm{clean}}(n,s) =\Theta\!\left(\frac{n}{J\sqrt{(n+s)(s+1)}}\right), -$$ +``` -$$ +```math T_{\mathrm{unknown}}(n,s) =\Theta\!\left(\frac{n}{J\sqrt{n+s}}\right). -$$ +``` -These exact tasks restore helpers and an arbitrary bus, including reference correlations. The changed resource is the initial helper promise, not extra wiring. At $s=0$, the time is $\Theta(\sqrt n/J)$. Any full-rank mixed preparation has the unknown-helper scale at zero error; the fixed-error law is not uniform as $\epsilon\to0$. +These exact tasks restore helpers and an arbitrary bus, including reference correlations. The changed resource is the initial helper promise, not extra wiring. At $`s=0`$, the time is $`\Theta(\sqrt n/J)`$. Any full-rank mixed preparation has the unknown-helper scale at zero error; the fixed-error law is not uniform as $`\epsilon\to0`$. ## Quantitative realization and scope -After concentration into $r$ near-clean leader bits, balanced blocks need only +After concentration into $`r`$ near-clean leader bits, balanced blocks need only -$$ +```math K_{\mathrm{exact}}=2^{\lceil(n+s)/(r+1)\rceil-1} -$$ +``` -exact interaction intervals per Ising gate. Synchronizing each block's translations suffices because the contact is an additive sum. For fixed nonzero polarization and $s=\Theta(n)$, this gives $O(n)$ total **exact contact intervals**. Global internal compression is still free in this theorem, and no efficient elementary implementation of every encoding is implied. +exact interaction intervals per Ising gate. Synchronizing each block's translations suffices because the contact is an additive sum. For fixed nonzero polarization and $`s=\Theta(n)`$, this gives $`O(n)`$ total **exact contact intervals**. Global internal compression is still free in this theorem, and no efficient elementary implementation of every encoding is implied. Exact rational spectral certificates demonstrate finite-size advantages over every allowed unknown-helper protocol at the same complete-operation accuracy, not just over one selected implementation. The [resource analysis](docs/accuracy-and-resources.md) also shows that a fixed sum of contact norms removes the parametric initialization advantage, while a fixed quadratic contact budget retains it. diff --git a/docs/accuracy-and-resources.md b/docs/accuracy-and-resources.md index 262bfb1..0760c17 100644 --- a/docs/accuracy-and-resources.md +++ b/docs/accuracy-and-resources.md @@ -4,63 +4,63 @@ This document supplies quantitative guarantees for the bandwidth theorems: an al ## 1. Bandwidth and finite-error comparator -An exchange moves $n$ logical qubits in each direction. Define the one-direction bandwidth as $\mathcal B=n/T$; counting both directions multiplies it by two. No frequency bandwidth or bosonic channel capacity is meant. Write $N=n+s$ and +An exchange moves $`n`$ logical qubits in each direction. Define the one-direction bandwidth as $`\mathcal B=n/T`$; counting both directions multiplies it by two. No frequency bandwidth or bosonic channel capacity is meant. Write $`N=n+s`$ and -$$ +```math B_e(n)=2n-4ne-\tfrac32h_2(e),\qquad 0\le e\le0.1. -$$ +``` -Consider a protocol required to approximate the payload exchange tensored with identity on **arbitrary** helpers and bus, with half diamond error at most $e$. Purify the maximally mixed state of every physical qubit: place the left module's references inside the left cut, and the bus reference on the right. The accessible physical state is exactly $I/D$ throughout the unitary evolution. Initially the reference-assisted left entropy is zero. Pauli orthogonality gives +Consider a protocol required to approximate the payload exchange tensored with identity on **arbitrary** helpers and bus, with half diamond error at most $`e`$. Purify the maximally mixed state of every physical qubit: place the left module's references inside the left cut, and the bus reference on the right. The accessible physical state is exactly $`I/D`$ throughout the unitary evolution. Initially the reference-assisted left entropy is zero. Pauli orthogonality gives -$$ -\operatorname{Tr}\omega(H_{LC}^{\mathrm{int}})^2 +```math +\mathrm{Tr}\omega(H_{LC}^{\mathrm{int}})^2 =\|H_{LC}^{\mathrm{int}}\|_F^2\le NJ^2. -$$ +``` -The payload-sized mutual-information argument in [Mixed helpers, Section 2](mixed-helpers.md#2-converse-an-entropy-budget-with-a-payload-sized-continuity-bound) gives final cut entropy at least $B_e(n)$, independent of the helper dimension. Thus +The payload-sized mutual-information argument in [Mixed helpers, Section 2](mixed-helpers.md#2-converse-an-entropy-budget-with-a-payload-sized-continuity-bound) gives final cut entropy at least $`B_e(n)`$, independent of the helper dimension. Thus -$$ +```math \boxed{T_{\mathrm{unknown},e}\ge\frac{B_e(n)}{c_0J\sqrt N}, \qquad c_0=2\sqrt2/\ln2.}\tag{1} -$$ +``` -The published [DF19](related-work.md#df19) route proves the same inequality with $c_0$ replaced by $c_{\mathrm{DF}}=2\log_2 9$. At $e=0$, (1) has coefficient $\ln2/\sqrt2$. The maximally mixed bus is a legitimate reference test because this comparator must work on an arbitrary bus. This coefficient must not be silently used for a task that promises one fixed pure bus input. +The published [DF19](related-work.md#df19) route proves the same inequality with $`c_0`$ replaced by $`c_{\mathrm{DF}}=2\log_2 9`$. At $`e=0`$, (1) has coefficient $`\ln2/\sqrt2`$. The maximally mixed bus is a legitimate reference test because this comparator must work on an arbitrary bus. This coefficient must not be silently used for a task that promises one fixed pure bus input. -If only payload Choi infidelity $\zeta$ is specified, projection of a purification onto the ideal Choi vector gives payload trace distance at most $\sqrt\zeta$. Replace $e$ in $B_e$ by $\sqrt\zeta$ whenever it is at most $0.1$. This is a necessary-condition argument, not an equivalence between Choi fidelity and diamond accuracy. The entropy-continuity step is the [Audenaert bound](related-work.md#a07); its use on payload-sized subsystems is why no factor proportional to $s$ appears. +If only payload Choi infidelity $`\zeta`$ is specified, projection of a purification onto the ideal Choi vector gives payload trace distance at most $`\sqrt\zeta`$. Replace $`e`$ in $`B_e`$ by $`\sqrt\zeta`$ whenever it is at most $`0.1`$. This is a necessary-condition argument, not an equivalence between Choi fidelity and diamond accuracy. The entropy-continuity step is the [Audenaert bound](related-work.md#a07); its use on payload-sized subsystems is why no factor proportional to $`s`$ appears. -Equation (1) also makes the correlated-helper counterexample precise for arbitrary $s$. A both-maximally-mixed component with weight $w$ and total payload infidelity at most $\epsilon$ has conditional infidelity at most $\epsilon/w$. Its physical state has at most the chosen pure bus's one-bit entropy deficit. The same proof, with an extra $\sqrt2$ in the rate, gives $\Omega(n/[J\sqrt N])$ for sufficiently small fixed $\epsilon/w$, without any restriction $s\le n$. +Equation (1) also makes the correlated-helper counterexample precise for arbitrary $`s`$. A both-maximally-mixed component with weight $`w`$ and total payload infidelity at most $`\epsilon`$ has conditional infidelity at most $`\epsilon/w`$. Its physical state has at most the chosen pure bus's one-bit entropy deficit. The same proof, with an extra $`\sqrt2`$ in the rate, gives $`\Omega(n/[J\sqrt N])`$ for sufficiently small fixed $`\epsilon/w`$, without any restriction $`s\le n`$. ## 2. Finite-size advantage against every unknown-helper protocol A comparison of two explicit constructions is not an exclusion of faster alternatives. To certify an advantage over all protocols in the unknown-helper class, compare its lower bound (1) with the mixed-helper constructive upper bound at the same error and contacts. -Set $p=1/10$ and $e=\epsilon=1/100$. Choose the maximum integer $r$ whose compressed zero-prefix tail is at most $\delta=1/80000$. Let $q$ be that exact tail and let $\gamma_{N,r}$ be the balanced-block gain. The mixed-helper error obeys +Set $`p=1/10`$ and $`e=\epsilon=1/100`$. Choose the maximum integer $`r`$ whose compressed zero-prefix tail is at most $`\delta=1/80000`$. Let $`q`$ be that exact tail and let $`\gamma_{N,r}`$ be the balanced-block gain. The mixed-helper error obeys -$$ +```math E_{\mathrm{prep}}^2\le4(2q-q^2)\le\epsilon^2, \qquad JT_{\mathrm{mixed}}\le\frac{3\pi(2n+1)}{4\gamma_{N,r}}. -$$ +``` -All required spectral decisions can be made with integers. At Hamming weight $k$, the eigenvalue numerator is $9^{s-k}$ with denominator $10^s$, repeated $\binom sk$ times. If the largest $2^{s-r}$ labels contain all shells below $k_*$ and $u$ labels in shell $k_*$, then +All required spectral decisions can be made with integers. At Hamming weight $`k`$, the eigenvalue numerator is $`9^{s-k}`$ with denominator $`10^s`$, repeated $`\binom sk`$ times. If the largest $`2^{s-r}`$ labels contain all shells below $`k_{\ast}`$ and $`u`$ labels in shell $`k_{\ast}`$, then -$$ -q=\frac{\displaystyle\sum_{k>k_*}\binom sk9^{s-k} -+(\binom{s}{k_*}-u)9^{s-k_*}}{10^s}.\tag{2} -$$ +```math +q=\frac{\displaystyle\sum_{k\gt k_{\ast}}\binom sk9^{s-k} ++(\binom{s}{k_{\ast}}-u)9^{s-k_{\ast}}}{10^s}.\tag{2} +``` -The inequalities $q\le1/80000$ and failure of the next prefix length are checked by integer cross multiplication, not floating-point tail evaluation. Gains are rational because every $\mu_b$ is rational. +The inequalities $`q\le1/80000`$ and failure of the next prefix length are checked by integer cross multiplication, not floating-point tail evaluation. Gains are rational because every $`\mu_b`$ is rational. -For fully rational time enclosures, use $\pi<22/7$, $c_0<41/10$, $h_2(1/100)<1/10$, and $\sqrt N\le\lceil\sqrt N\rceil$. Consequently +For fully rational time enclosures, use $`\pi\lt 22/7`$, $`c_0\lt 41/10`$, $`h_2(1/100)\lt 1/10`$, and $`\sqrt N\le\lceil\sqrt N\rceil`$. Consequently -$$ +```math U=\frac{3(22/7)(2n+1)}{4\gamma_{N,r}},\qquad L=\frac{(49/25)n-3/20}{(41/10)\lceil\sqrt N\rceil} -$$ +``` -satisfy $JT_{\mathrm{mixed}}L$. The strict ratio $L/U>1$ certifies an advantage, not merely an observed numerical trend. +satisfy $`JT_{\mathrm{mixed}}\lt U`$ and $`JT_{\mathrm{unknown},e}\gt L`$. The strict ratio $`L/U\gt 1`$ certifies an advantage, not merely an observed numerical trend. -| Payload and helpers per module $n=s$ | Prefix bits $r$ | Gain | Mixed $JT$ upper | Unknown $JT$ lower | Certified advantage factor, at least | +| Payload and helpers per module $`n=s`$ | Prefix bits $`r`$ | Gain | Mixed $`JT`$ upper | Unknown $`JT`$ lower | Certified advantage factor, at least | |---:|---:|---:|---:|---:|---:| | 512 | 191 | 360 | 6.712 | 7.647 | 1.139 | | 1024 | 426 | 768 | 6.289 | 10.640 | 1.692 | @@ -68,100 +68,100 @@ satisfy $JT_{\mathrm{mixed}}L$. The strict rati Displayed upper values are rounded upward; lower values and advantage factors are rounded downward. These examples use the same number of contacts, the same payload, and the same error budget. Their helper input promises differ, exactly as in the resource comparison. Large systems are evaluated by exact spectral sums and proven timing formulas, **not simulated as large quantum circuits**. -The certificate does not depend on the smaller elementary entropy constant: replacing $41/10$ by $32/5>c_{\mathrm{DF}}$ still certifies an advantage at $n=s=1024$ and $2048$. In the latter case the factor exceeds $1.55$ using the published variance bound alone. The exact rational numbers and tail certificates are generated by [verify_scientific_closure.py](../checks/verify_scientific_closure.py). +The certificate does not depend on the smaller elementary entropy constant: replacing $`41/10`$ by $`32/5\gt c_{\mathrm{DF}}`$ still certifies an advantage at $`n=s=1024`$ and $`2048`$. In the latter case the factor exceeds $`1.55`$ using the published variance bound alone. The exact rational numbers and tail certificates are generated by [verify_scientific_closure.py](../checks/verify_scientific_closure.py). -The simple constant bounds themselves have elementary certificates: $\ln2>56/81$, $\sqrt2<99/70$, and $9^5<2^{16}$. Also $\ln100<5$ and $-\ln(0.99)\le1/99$ give $h_2(0.01)<0.1$. The decimal table is therefore not needed to decide the strict speed comparison. +The simple constant bounds themselves have elementary certificates: $`\ln2\gt 56/81`$, $`\sqrt2\lt 99/70`$, and $`9^5\lt 2^{16}`$. Also $`\ln100\lt 5`$ and $`-\ln(0.99)\le1/99`$ give $`h_2(0.01)\lt 0.1`$. The decimal table is therefore not needed to decide the strict speed comparison. ## 3. Short exact synchronized block schedules The contact after sign encoding is an **additive sum** over blocks. Averaging every joint combination of spectator labels is unnecessary: uniform marginal translation in each block suffices. -Suppose the $m=r+1$ blocks have sizes $b_i$, and write $w_i=b_i-1$, $w_{\max}=\max_i w_i$. Use +Suppose the $`m=r+1`$ blocks have sizes $`b_i`$, and write $`w_i=b_i-1`$, $`w_{\max}=\max_i w_i`$. Use -$$ +```math K_{\mathrm{exact}}=2^{w_{\max}} =2^{\lceil N/(r+1)\rceil-1}\tag{3} -$$ +``` -intervals. In interval $\ell=0,\ldots,K_{\mathrm{exact}}-1$, translate block $i$ by the low $w_i$ bits of $\ell$. Each of that block's $2^{w_i}$ translations occurs equally often. Thus +intervals. In interval $`\ell=0,\ldots,K_{\mathrm{exact}}-1`$, translate block $`i`$ by the low $`w_i`$ bits of $`\ell`$. Each of that block's $`2^{w_i}`$ translations occurs equally often. Thus -$$ +```math \frac1{K_{\mathrm{exact}}}\sum_\ell \sum_i Z_{q_i}D_{b_i}(x_i\oplus\ell_{[w_i]}) =\sum_i\mu_{b_i}Z_{q_i}\otimes I_{\mathrm{spectators}}.\tag{4} -$$ +``` Cross-block independence is not required because there are no products of the block coefficients in this Hamiltonian average. All conjugated contacts commute. Equal-duration evolution intervals therefore realize (4) exactly, not as a first-order approximation. Fanout conjugation preserves that identity on the whole helper basis, including the unfavorable sector. The physical helper marginal-return and common-sector arguments remain intact. -The full route uses $3(2n+1)K_{\mathrm{exact}}$ raw contact intervals. For the three finite certificates in Section 2, the exact lengths are respectively 32, 16, and 16 intervals per Ising gate; their total contact counts are 98,400, 98,352, and 196,656. At fixed $p<1/2$, fixed accuracy, and $s$ proportional to $n$, the compression theorem allows $r=\Theta(s)$, so the **exact** contact count is $O(n)$. At $r=0$, the no-helper length remains $2^{N-1}$. +The full route uses $`3(2n+1)K_{\mathrm{exact}}`$ raw contact intervals. For the three finite certificates in Section 2, the exact lengths are respectively 32, 16, and 16 intervals per Ising gate; their total contact counts are 98,400, 98,352, and 196,656. At fixed $`p\lt 1/2`$, fixed accuracy, and $`s`$ proportional to $`n`$, the compression theorem allows $`r=\Theta(s)`$, so the **exact** contact count is $`O(n)`$. At $`r=0`$, the no-helper length remains $`2^{N-1}`$. This reduction does not assign a small elementary-gate cost to compression or the internal block encodings. It removes an unnecessary product of averaging-list lengths, not the distinction between contact time and physical control time. [The raw-contact verifier](../checks/verify_workspace_construction.py) implements the synchronized schedule; the closure suite compares it with full joint averaging on every basis label in its finite tests. ## 4. Polynomial contact lists at fixed uniform accuracy -A polynomial alternative is available even where (3) is long. Choose $K$ independent uniform synchronized translation labels offline, then fix that list for every input and every gate. For any module basis label $x$, the dimensionless diagonal contact coefficient $F_\ell(x)$ lies in $[-N,N]$ and has the exact averaged coefficient as its mean. [Hoeffding's inequality](related-work.md#h63) and a union bound over the $2^N$ labels give +A polynomial alternative is available even where (3) is long. Choose $`K`$ independent uniform synchronized translation labels offline, then fix that list for every input and every gate. For any module basis label $`x`$, the dimensionless diagonal contact coefficient $`F_\ell(x)`$ lies in $`[-N,N]`$ and has the exact averaged coefficient as its mean. [Hoeffding's inequality](related-work.md#h63) and a union bound over the $`2^N`$ labels give -$$ -\Pr\!\left(\|\overline F_K-F_*\|>a\right) +```math +\Pr\!\left(\|\overline F_K-F_{\ast}\|\gt a\right) \le2^{N+1}\exp[-Ka^2/(2N^2)].\tag{5} -$$ +``` -With $M=3(2n+1)$, $\theta=\pi/4$, and gain $\gamma=\gamma_{N,r}$, the intended contact duration is $\theta/(J\gamma)$. Diagonal exponentiation gives one-gate operator error at most $\theta a/\gamma$. A telescoping product bound gives full-unitary error at most $M\theta a/\gamma$. Reusing a good list under the fixed target relabelings and basis conjugations leaves this guarantee unchanged. +With $`M=3(2n+1)`$, $`\theta=\pi/4`$, and gain $`\gamma=\gamma_{N,r}`$, the intended contact duration is $`\theta/(J\gamma)`$. Diagonal exponentiation gives one-gate operator error at most $`\theta a/\gamma`$. A telescoping product bound gives full-unitary error at most $`M\theta a/\gamma`$. Reusing a good list under the fixed target relabelings and basis conjugations leaves this guarantee unchanged. -For full-route operator error at most $\eta$ and offline failure probability at most $q_{\mathrm{off}}$, it suffices that +For full-route operator error at most $`\eta`$ and offline failure probability at most $`q_{\mathrm{off}}`$, it suffices that -$$ +```math K\ge\frac{2N^2M^2\theta^2}{\eta^2\gamma^2} \left[(N+1)\ln2+\ln(1/q_{\mathrm{off}})\right].\tag{6} -$$ +``` -Using $\gamma^2\ge N(r+1)/6$, this is $O(n^2N^2/[(r+1)\eta^2])$ per gate and $O(n^3N^2/[(r+1)\eta^2])$ over the route at fixed offline confidence. The better of this bound and (3) may be used. In the explicit finite certificates, the short **exact** list is vastly better than this conservative concentration estimate. +Using $`\gamma^2\ge N(r+1)/6`$, this is $`O(n^2N^2/[(r+1)\eta^2])`$ per gate and $`O(n^3N^2/[(r+1)\eta^2])`$ over the route at fixed offline confidence. The better of this bound and (3) may be used. In the explicit finite certificates, the short **exact** list is vastly better than this conservative concentration estimate. -For mixed preparation, take $\delta=\epsilon^2/32$ and $\eta=\epsilon/2$. The preparation isometry bound is at most $\epsilon/2$, while the approximation of the full physical unitary contributes at most $\eta$ to half diamond distance. The total is at most $\epsilon$. The asymptotic bandwidth law is unchanged at fixed error. +For mixed preparation, take $`\delta=\epsilon^2/32`$ and $`\eta=\epsilon/2`$. The preparation isometry bound is at most $`\epsilon/2`$, while the approximation of the full physical unitary contributes at most $`\eta`$ to half diamond distance. The total is at most $`\epsilon`$. The asymptotic bandwidth law is unchanged at fixed error. The compressed helper density is diagonal. Each translated, encoded, decoded interval is diagonal in helper labels, and target/bus basis changes do not rotate those labels. Hence the physical helper marginal still returns exactly for the specified input; payload/helper correlations are covered by the total error. Randomness chooses a list before execution and never mixes physical output channels or depends on unknown input data. The statement does not provide efficient verification of a large sampled list or an elementary-gate implementation of the compression permutation. ## 5. Error composition and reuse -For physical unitaries $U,V$ and any inserted pure preparation, operator error $\|U-V\|\le\eta$ implies half diamond error at most $\eta$. For pure input outputs $|u\rangle,|v\rangle$, this follows from their trace distance being bounded by $\|u-v\|$; reference extensions and mixed inputs follow by purification. It is also consistent with the completely bounded trace-norm framework in [W18, Chapter 3](related-work.md#w18). +For physical unitaries $`U,V`$ and any inserted pure preparation, operator error $`\|U-V\|\le\eta`$ implies half diamond error at most $`\eta`$. For pure input outputs $`|u\rangle,|v\rangle`$, this follows from their trace distance being bounded by $`\|u-v\|`$; reference extensions and mixed inputs follow by purification. It is also consistent with the completely bounded trace-norm framework in [W18, Chapter 3](related-work.md#w18). -If a route is exact on one invariant favorable preparation sector of bad weight $\Delta$, any number of ideal coherent uses on fresh payloads still agrees with the ideal on that same sector and differs by at most $2\sqrt\Delta$ on the inserted-preparation isometry. The bound includes references to all batches; it is not a claim that successive errors are independent. The fresh-batch check explicitly keeps two distinct payload pairs and the common bus, rather than just applying a power to one payload state. +If a route is exact on one invariant favorable preparation sector of bad weight $`\Delta`$, any number of ideal coherent uses on fresh payloads still agrees with the ideal on that same sector and differs by at most $`2\sqrt\Delta`$ on the inserted-preparation isometry. The bound includes references to all batches; it is not a claim that successive errors are independent. The fresh-batch check explicitly keeps two distinct payload pairs and the common bus, rather than just applying a power to one payload state. -Synthesis and dynamical errors are different. For a specified finite circuit with per-pulse operator errors $\eta_\ell$ and an integrable Hamiltonian perturbation $E(t)$ during contact evolution, telescoping and Duhamel's identity give +Synthesis and dynamical errors are different. For a specified finite circuit with per-pulse operator errors $`\eta_\ell`$ and an integrable Hamiltonian perturbation $`E(t)`$ during contact evolution, telescoping and Duhamel's identity give -$$ -\frac12\|\Phi_{\mathrm{actual}}-\Phi_*\|_\diamond +```math +\frac12\|\Phi_{\mathrm{actual}}-\Phi_{\ast}\|_\diamond \le2\sqrt\Delta+\eta_{\mathrm{list}} +\sum_\ell\eta_\ell+\int_0^T\|E(t)\|\,dt.\tag{7} -$$ +``` -This bound is for unitary control imperfections. A contact perturbation bounded by $e_j(t)$ per edge has the conservative contribution $\int\sum_j e_j(t)dt$. No cancellation of such errors is assumed. Under repeated uses, the new synthesis/dynamical contributions generally accumulate, unlike the initial common-sector error. Equation (7) is a stability statement, not a fault-tolerance threshold, a Markovian-noise model, or evidence of practical control accuracy. +This bound is for unitary control imperfections. A contact perturbation bounded by $`e_j(t)`$ per edge has the conservative contribution $`\int\sum_j e_j(t)dt`$. No cancellation of such errors is assumed. Under repeated uses, the new synthesis/dynamical contributions generally accumulate, unlike the initial common-sector error. Equation (7) is a stability statement, not a fault-tolerance threshold, a Markovian-noise model, or evidence of practical control accuracy. ## 6. What changes under a different interaction budget ### 6.1 Per-contact and quadratic budgets -The primary theorem uses $\|h_{jc}(t)\|\le J$ for each edge. The aggregate quadratic strength on a module cut can therefore grow like $J\sqrt N$. This is why increasing the module changes even the no-initialization bandwidth. +The primary theorem uses $`\|h_{jc}(t)\|\le J`$ for each edge. The aggregate quadratic strength on a module cut can therefore grow like $`J\sqrt N`$. This is why increasing the module changes even the no-initialization bandwidth. -If instead one imposes $\sum_j\|h_{jc}(t)\|^2\le\Lambda_2^2$ per module cut and allows arbitrary allocation, the same moment converse replaces $J\sqrt N$ by $\Lambda_2$. Equal allocation $J=\Lambda_2/\sqrt N$ in the construction attains it. Thus, within the same free-internal-control and fixed-error model, +If instead one imposes $`\sum_j\|h_{jc}(t)\|^2\le\Lambda_2^2`$ per module cut and allows arbitrary allocation, the same moment converse replaces $`J\sqrt N`$ by $`\Lambda_2`$. Equal allocation $`J=\Lambda_2/\sqrt N`$ in the construction attains it. Thus, within the same free-internal-control and fixed-error model, -$$ +```math T_{\epsilon,p}^{(2)} =\Theta_\epsilon\!\left(\frac{n}{\Lambda_2\sqrt{1+sd(p)}}\right). \tag{8} -$$ +``` -Unknown helpers have $\Theta_\epsilon(n/\Lambda_2)$ time. The relative initialization advantage survives this quadratic-budget comparison. The constraint is on the sum of **edge** squared norms, not necessarily on the Frobenius norm of a total Hamiltonian containing local terms. +Unknown helpers have $`\Theta_\epsilon(n/\Lambda_2)`$ time. The relative initialization advantage survives this quadratic-budget comparison. The constraint is on the sum of **edge** squared norms, not necessarily on the Frobenius norm of a total Hamiltonian containing local terms. ### 6.2 A fixed sum of contact strengths removes the parametric advantage -Under $\sum_j\|h_{jc}(t)\|\le\Lambda_1$ per cut, let $h$ be the entire crossing interaction, including any one-sided pieces. Its norm is at most $\Lambda_1$. The conditional entropy rate is at most $c_0\Lambda_1$, on every state and with arbitrary references. An exact or fixed sufficiently accurate payload exchange still requires cut entropy of order $n$, giving $\Omega(n/\Lambda_1)$. +Under $`\sum_j\|h_{jc}(t)\|\le\Lambda_1`$ per cut, let $`h`$ be the entire crossing interaction, including any one-sided pieces. Its norm is at most $`\Lambda_1`$. The conditional entropy rate is at most $`c_0\Lambda_1`$, on every state and with arbitrary references. An exact or fixed sufficiently accurate payload exchange still requires cut entropy of order $`n`$, giving $`\Omega(n/\Lambda_1)`$. -Sequential direct SWAPs at strength $\Lambda_1$, with $2n+1$ contacts and the free final internal permutation, give $O(n/\Lambda_1)$ independently of helper preparation. Therefore +Sequential direct SWAPs at strength $`\Lambda_1`$, with $`2n+1`$ contacts and the free final internal permutation, give $`O(n/\Lambda_1)`$ independently of helper preparation. Therefore -$$ +```math \boxed{T^{(1)}=\Theta_\epsilon(n/\Lambda_1)}\tag{9} -$$ +``` for clean, unknown, and independent mixed helpers in the corresponding exact/fixed-error tasks. This is an optimum over permitted allocations, not merely a uniform-rescaling example. Under this budget there is no parametrically growing initialization speedup. A norm bound on the total crossing interaction itself gives the same conclusion; a bound on the full Hamiltonian would additionally conflict with the free-internal-control convention. diff --git a/docs/bandwidth.md b/docs/bandwidth.md index 8c4c6bb..91beac6 100644 --- a/docs/bandwidth.md +++ b/docs/bandwidth.md @@ -13,15 +13,15 @@ There are no additional initialized degrees of freedom, measurements, resets, fe Let T_clean(n,s) and T_unknown(n,s) be the infimum interaction times for the respective exact tasks. The main laws are -$$ +```math \boxed{T_{\mathrm{clean}}(n,s)=\Theta\!\left(\frac{n}{J\sqrt{(n+s)(s+1)}}\right),} \tag{1} -$$ +``` -$$ +```math \boxed{T_{\mathrm{unknown}}(n,s)=\Theta\!\left(\frac{n}{J\sqrt{n+s}}\right).} \tag{2} -$$ +``` The constants in these comparisons do not depend on n or s. Thus the optimal times at fixed n and s differ by Theta(sqrt(s+1)). This is not a comparison that gives the clean case more physical contacts. @@ -35,10 +35,10 @@ The converse controls concentration in the contact spectrum through a conserved For a physical density operator omega on a D-dimensional Hilbert space, write -$$ +```math \mathcal I(\omega)=\log_2D-S(\omega). \tag{3} -$$ +``` This is an entropy deficit in bits. It is invariant under any unitary on the physical system. It is not the quadratic purity Tr omega^2 and is not an energy, work, or temperature. @@ -46,24 +46,24 @@ This is an entropy deficit in bits. It is invariant under any unitary on the phy For one module-bus cut, expand the genuine two-sided part of the contacts as -$$ +```math H_{\mathrm{int}}=\sum_{\mu=x,y,z}A_\mu\otimes\sigma_C^\mu, \qquad A_\mu=\sum_{j,a}c_{ja\mu}\sigma_j^a. \tag{4} -$$ +``` Terms acting on only one side do not contribute to the entropy derivative and are absorbed into the internal terms. Let -$$ +```math v_\mu^2=\sum_{j,a}c_{ja\mu}^2,\qquad v^2=\sum_\mu v_\mu^2. -$$ +``` Orthogonal projection onto the two-sided Pauli coefficients contracts the normalized Frobenius norm. If the original edge has norm at most J_j, its normalized Frobenius norm is at most J_j. Therefore -$$ +```math v^2\le\sum_jJ_j^2. \tag{5} -$$ +``` This does NOT assume that subtracting the cut-local terms contracts the operator norm. @@ -71,20 +71,20 @@ This does NOT assume that subtracting the cut-local terms contracts the operator For fixed mu, the summands on distinct sites commute. With normalized trace tau and v_mu>0, -$$ +```math \tau(e^{uA_\mu}) =\prod_j\cosh\!\left(u\sqrt{\sum_a c_{ja\mu}^2}\right) \le e^{u^2v_\mu^2/2}. \tag{6} -$$ +``` The scalar Gaussian integral identity e^{tx^2}=E_G exp(sqrt(2t)Gx), G standard normal, implies -$$ +```math \tau(e^{tA_\mu^2})\le(1-2tv_\mu^2)^{-1/2}, -\quad 0\le t<1/(2v_\mu^2). +\quad 0\le t\lt 1/(2v_\mu^2). \tag{7} -$$ +``` These expressions are unchanged when A_mu is tensored with identities on the remaining physical qubits. @@ -92,35 +92,35 @@ These expressions are unchanged when A_mu is tensored with identities on the rem Apply nonnegativity of relative entropy to omega and the normalized state exp(t A_mu^2)/Tr exp(t A_mu^2). Expanding this inequality, with natural logarithms in this calculation, gives -$$ -t\operatorname{Tr}(\omega A_\mu^2) +```math +t\mathrm{Tr}(\omega A_\mu^2) \le\mathcal I(\omega)\ln2+\ln\tau(e^{tA_\mu^2}). \tag{8} -$$ +``` No commutation between omega and A_mu is required. Choose t=1/(4v_mu^2). Equations (7)-(8) yield -$$ -\operatorname{Tr}(\omega A_\mu^2) +```math +\mathrm{Tr}(\omega A_\mu^2) \le4\ln2\,[\mathcal I(\omega)+1/2]v_\mu^2. \tag{9} -$$ +``` The v_mu=0 case is trivial. For Hermitian X_1,X_2,X_3, the operator inequality -$$ +```math (X_1+X_2+X_3)^2\preceq3(X_1^2+X_2^2+X_3^2) -$$ +``` follows because the difference is the sum over ib and f=0 otherwise; output leader q'=q xor f and output spectators r'=r xor q'. The collective magnetization of the output is (-1)^q |b-2w|. Thus a reversible permutation E obeys E^dagger(sum Z_j)E=Z_q D_b. Averaging all spectator XOR translations gives the scalar mean mu_b. All conjugated diagonal interactions commute. Equal-duration intervals therefore implement the averaged Hamiltonian **exactly**, with no vanishing-interval limit. Applying the block simulations simultaneously yields -$$ +```math H_{\mathrm{block}}=JZ_C\sum_{i=0}^{s}\mu_{b_i}Z_{q_i}, \tag{19} -$$ +``` with identity on every unknown spectator. @@ -251,27 +251,27 @@ with identity on every unknown spectator. Before (19), perform the module-internal fanout -$$ +```math F=\prod_{i=1}^{s}\mathrm{CNOT}_{q_0\to q_i}, -$$ +``` and undo F afterward. On inputs with the helpers in |0>^s, -$$ +```math F^\dagger e^{-itH_{\mathrm{block}}}F \bigl(|\psi\rangle\otimes|0\rangle^{\otimes s}\bigr) = \left(e^{-iJ\gamma_{n,s}tZ_{q_0}Z_C}|\psi\rangle\right) \otimes|0\rangle^{\otimes s}, \tag{20} -$$ +``` where -$$ +```math \gamma_{n,s}=\sum_i\mu_{b_i}. \tag{21} -$$ +``` The fanout creates and later removes correlations; it does not clone an unknown state. Formula (20) is a code-subspace isometry identity for clean helpers, not an identity on arbitrary helper inputs. It preserves arbitrary spectator data and arbitrary reference entanglement and works for an arbitrary bus state. @@ -279,16 +279,16 @@ The fanout creates and later removes correlations; it does not clone an unknown For the sign sum S_b, E S_b^2=b and E S_b^4=3b^2-2b. Interpolation between its first, second, and fourth moments gives -$$ +```math \sqrt{b/3}\le\mathbb E|S_b|=\mu_b\le\sqrt b. -$$ +``` Balanced block sizes obey b_i>=N/(2m). Cauchy-Schwarz supplies the upper bound. Hence -$$ +```math \boxed{\sqrt{(n+s)(s+1)/6}\le\gamma_{n,s}\le\sqrt{(n+s)(s+1)}.} \tag{22} -$$ +``` No optimal prefactor is claimed. The explicit block grouping need not maximize the gain at small n,s. @@ -298,42 +298,42 @@ Rotate the target and bus bases to realize the XX, YY, and ZZ versions of (20). A buffered sequence uses 2n+1 target-bus SWAPs. For j=1,...,n, swap L_j with C, then R_j with C. Finally swap L_1 with C and rotate only the L payload labels left by one position. The output is precisely the payload exchange with the bus restored; all helpers were restored after each elementary gate. Therefore -$$ +```math \boxed{T_{\mathrm{clean}}(n,s)\le\frac{3\pi(2n+1)}{4J\gamma_{n,s}}.} \tag{23} -$$ +``` Equations (16),(22),(23) prove (1). Synchronize the block translations using the same counter, restricted to the spectator bits of each block. Uniform marginal coverage of every block suffices because the contact is additive. The [exact synchronized schedule](accuracy-and-resources.md#3-short-exact-synchronized-block-schedules) uses -$$ +```math K_{\mathrm{exact}}=2^{\max_i(b_i-1)} =2^{\lceil(n+s)/(s+1)\rceil-1} -$$ +``` -intervals per Ising gate. All conjugated contacts commute, so no short-time approximation is involved. At $s=0$ this reduces to $2^{n-1}$; with $s=\Theta(n)$ it is bounded independently of $n$. Internal controls are still free. Approximate-list guarantees are in [Accuracy and resources](accuracy-and-resources.md#4-polynomial-contact-lists-at-fixed-uniform-accuracy); finite gate-speed costs are separate in [Control models](control-models.md). +intervals per Ising gate. All conjugated contacts commute, so no short-time approximation is involved. At $`s=0`$ this reduces to $`2^{n-1}`$; with $`s=\Theta(n)`$ it is bounded independently of $`n`$. Internal controls are still free. Approximate-list guarantees are in [Accuracy and resources](accuracy-and-resources.md#4-polynomial-contact-lists-at-fixed-uniform-accuracy); finite gate-speed costs are separate in [Control models](control-models.md). ## 6. Unknown helpers on identical hardware For the unknown-helper task, put every physical module qubit, including the s helpers, in a Bell pair with its own inaccessible reference. The bus can be fixed pure for the lower bound. The physical density matrix always obeys omega<=2I/D. Orthogonality of the pair-contact Pauli coefficients gives -$$ -\operatorname{Tr}\omega H_{\mathrm{int}}^2\le2(n+s)J^2. -$$ +```math +\mathrm{Tr}\omega H_{\mathrm{int}}^2\le2(n+s)J^2. +``` Only the payload must cross the cut, generating 2n bits. Equation (11) yields -$$ +```math T_{\mathrm{unknown}}(n,s)\ge\frac{\ln2}{2J}\frac{n}{\sqrt{n+s}}. \tag{24} -$$ +``` For the upper bound, use all N=n+s qubits in the occupied-data block amplifier. Its spectators, including the unknown helpers, are returned after each target-bus operation. Exchange only the n payload labels in the same buffered sequence: -$$ +```math T_{\mathrm{unknown}}(n,s) \le\frac{3\pi(2n+1)}{4J\mu_{n+s}}. \tag{25} -$$ +``` Since sqrt((n+s)/3)<=mu_(n+s)<=sqrt(n+s), (24)-(25) prove (2). Both cases have identical numbers and strengths of bus contacts, identical payloads, free internal controls, and helper return. The only altered promise is the initial helper state. diff --git a/docs/control-models.md b/docs/control-models.md index 8b64cb2..c492451 100644 --- a/docs/control-models.md +++ b/docs/control-models.md @@ -4,17 +4,17 @@ The matching bandwidth laws charge only contact time. This note distinguishes th ## 1. Two distinct clocks -In the interaction-time model, unitaries inside $L$, $R$, or $C$ are instantaneous. In the finite-control compiler, all one- and two-qubit gates within a module, and bus-only gates, have generator norm at most $G$. Disjoint gates may run in parallel; every internal pair is available. There is no native Toffoli, extra initialized workspace, or cross-module control. Define $\delta=\pi/(2G)$. Contacts are off during local gates in this explicit schedule. +In the interaction-time model, unitaries inside $`L`$, $`R`$, or $`C`$ are instantaneous. In the finite-control compiler, all one- and two-qubit gates within a module, and bus-only gates, have generator norm at most $`G`$. Disjoint gates may run in parallel; every internal pair is available. There is no native Toffoli, extra initialized workspace, or cross-module control. Define $`\delta=\pi/(2G)`$. Contacts are off during local gates in this explicit schedule. -An exact exchange uses $2n+1$ bus SWAPs: for each $j$, swap $L_j$ with $C$ and then $R_j$ with $C$; finally swap $L_1$ with $C$. The left payload then has labels $(R_n,R_1,\ldots,R_{n-1})$. Shift them left by one. The cycle is two involutions on positions modulo $n$, $x\mapsto-x$ then $x\mapsto-x-1$, each implementable by disjoint SWAPs. The bus returns to its input state. +An exact exchange uses $`2n+1`$ bus SWAPs: for each $`j`$, swap $`L_j`$ with $`C`$ and then $`R_j`$ with $`C`$; finally swap $`L_1`$ with $`C`$. The left payload then has labels $`(R_n,R_1,\ldots,R_{n-1})`$. Shift them left by one. The cycle is two involutions on positions modulo $`n`$, $`x\mapsto-x`$ then $`x\mapsto-x-1`$, each implementable by disjoint SWAPs. The bus returns to its input state. -The norm-$J$ Hamiltonian $J\operatorname{SWAP}$ implements a bus SWAP in $\pi/(2J)$ up to global phase. The final internal permutation costs at most $2\delta$, so a feasible sequential comparator is +The norm-$`J`$ Hamiltonian $`J\mathrm{SWAP}`$ implements a bus SWAP in $`\pi/(2J)`$ up to global phase. The final internal permutation costs at most $`2\delta`$, so a feasible sequential comparator is -$$ -T_{\mathrm{seq}}=\frac{(2n+1)\pi}{2J}+\frac\pi G\qquad(n>1).\tag{1} -$$ +```math +T_{\mathrm{seq}}=\frac{(2n+1)\pi}{2J}+\frac\pi G\qquad(n\gt 1).\tag{1} +``` -The final permutation is unnecessary at $n=1$. Comparing only with an unamplified three-Ising SWAP would give the amplified compiler an artificially weak comparator. +The final permutation is unnecessary at $`n=1`$. Comparing only with an unamplified three-Ising SWAP would give the amplified compiler an artificially weak comparator. ## 2. Exact finite-duration compiler @@ -44,9 +44,9 @@ Its net exponent of V on q is b-(a xor b)+a=2ab. It is exact on arbitrary superp CX and X are Hermitian involutions and can be implemented, up to a common global phase, in delta=pi/(2G) with norm-G generators. Controlled V has spectral phases 0 and pi/2 and can be implemented in delta/2 with norm G after a scalar shift. Thus this Toffoli takes (7/2)delta and E takes (11/2)delta. The full cycle takes -$$ +```math 2\cdot\frac{11}{2}\delta+3\cdot4\delta+\delta=24\delta -$$ +``` of internal-control time, plus its charged contact time. This is an explicit feasible cost, not the minimum synthesis time for this three-qubit operation. Further gate fusion could reduce constants without changing the recurrence below. @@ -54,32 +54,32 @@ of internal-control time, plus its charged contact time. This is an explicit fea For m=3^k data qubits assisting a designated target, the gain is a_k=(3/2)^k. Let D_k delta be the internal-control time for one amplified Ising operation. Disjoint triples are processed in parallel. Substitution of four lower-level simulations gives -$$ +```math D_0=0,\qquad D_k=4D_{k-1}+24, \qquad D_k=8(4^k-1). \tag{2} -$$ +``` There are 4^k raw contact intervals. The total number of elementary local gates (not depth) is -$$ +```math N_k=30(12^k-1)/11. -$$ +``` For a target-bus SWAP, three Ising operations and four layers of single-qubit basis changes suffice. These layers rotate q and C in parallel. Its total duration in this schedule is -$$ +```math t_k=\frac{3\pi}{4J(3/2)^k}+ \bigl[24\,4^k-20\bigr]\frac\pi{2G},\qquad k\ge1. \tag{3} -$$ +``` With m<=n, a suitable set of m data qubits can assist each target in turn; they are restored after each completed operation. All within-register pair connectivity has been granted, so no extra movement to arrange triples is silently required. The full route takes -$$ -\boxed{T_k=(2n+1)t_k+\pi/G\quad(n>1).} +```math +\boxed{T_k=(2n+1)t_k+\pi/G\quad(n\gt 1).} \tag{4} -$$ +``` The sequential option (1) is always included in optimization. The construction still preserves all unknown data, cross-register correlations, and an arbitrary bus state. Controls are fixed in advance, not selected from unknown input amplitudes. @@ -87,10 +87,10 @@ The sequential option (1) is always included in optimization. The construction s Set R=G/J. Relative to the direct norm-J target-bus SWAP, Equation (3) becomes -$$ +```math \boxed{s_k(R)=(3/2)^{1-k}+\frac{24\,4^k-20}{R}.} \tag{5} -$$ +``` The k=1 primitive has s_1=1+76/R. It never beats the stronger direct-SWAP comparator under this compiler, even though its Ising coupling gain is 3/2. @@ -110,25 +110,25 @@ These are ideal analytical timings, not experimental estimates or noisy fideliti For neighboring positive recursion levels, s_k=s_(k+1) at R=144*6^k. Thus once the preferred block fits, the optimal k depends on R, not on n. At fixed R, -$$ +```math \boxed{\min\{T_{\rm seq},T_1,T_2,\ldots\}=\Theta(n/J)} -$$ +``` within this explicitly compiled family. When R itself grows, balancing the two terms gives 6^k of order R and -$$ +```math T_{\rm compiled}=O\left(\frac nJ R^{-\nu}\right), \qquad \nu=\frac{\ln(3/2)}{\ln6}=0.2262943855\ldots, -$$ +``` in the regime where the optimal block is available. To use the whole m=n=3^k recursive register and retain the O(n^(log_3 2)/J) contact-time scaling, this compiler needs -$$ +```math G/J\ \text{of order at least}\ n^{\log_3 6} =n^{1.6309297536\ldots} -$$ +``` up to constants. This is precisely the size-dependent control resource that the free-control statement omits. @@ -145,27 +145,27 @@ For the no-helper construction, the exponentially long exact list is not necessa Select K independent, uniform spectator translations s_1,...,s_K OFFLINE, then fix that list for every run. The implemented diagonal coefficient is -$$ +```math \bar D_K(r)=K^{-1}\sum_{\ell=1}^K D_n(r\oplus s_\ell). -$$ +``` Every summand lies in [0,n] and has mean mu_n. Hoeffding's inequality followed by a union bound over the 2^(n-1) spectator labels gives -$$ -\Pr\left(\|\bar D_K-\mu_nI\|>a\right) +```math +\Pr\left(\|\bar D_K-\mu_nI\|\gt a\right) \le2\,2^{n-1}\exp(-2Ka^2/n^2). \tag{6} -$$ +``` All interval Hamiltonians commute exactly. An intended Ising angle theta=pi/4 therefore has full operator error at most theta a/mu_n. The entire route uses M=3(2n+1) such gates. Reusing a good list under target relabelings and basis conjugations, telescoping the product of unitaries bounds the final operator error by M theta a/mu_n, uniformly over all data and bus states. To obtain operator error at most eta with offline-list failure probability at most p, it suffices to choose -$$ +```math K\ge \frac{n^2M^2\theta^2}{2\eta^2\mu_n^2} \left[(n-1)\ln2+\ln(2/p)\right]. \tag{7} -$$ +``` For fixed p and eta, K=O(n^4/eta^2) per Ising gate and the total contact count is O(n^5/eta^2). The charged contact duration is unchanged. A full-unitary operator error eta implies channel diamond distance at most 2 eta. @@ -174,10 +174,10 @@ This gives both a probabilistic existence statement and a polynomial-time proced ## 4. Exact recursive interaction-time construction -On three data qubits, one Toffoli and two CNOTs encode the sign of $Z_q+Z_a+Z_b$ into $q$, giving $Z_q\operatorname{diag}(3,1,1,1)$. Four coherent spectator translations yield exactly $(3/2)Z_q$. On $n=3^k$ occupied qubits, apply this identity to disjoint triples, then triples of representatives. Each completed simulation restores every unused data subsystem, so the identity can be recursively substituted without an assumption about intermediate states. +On three data qubits, one Toffoli and two CNOTs encode the sign of $`Z_q+Z_a+Z_b`$ into $`q`$, giving $`Z_q\mathrm{diag}(3,1,1,1)`$. Four coherent spectator translations yield exactly $`(3/2)Z_q`$. On $`n=3^k`$ occupied qubits, apply this identity to disjoint triples, then triples of representatives. Each completed simulation restores every unused data subsystem, so the identity can be recursively substituted without an assumption about intermediate states. -The target-bus gain is $(3/2)^k$ with $4^k$ contact intervals per Ising gate. The buffered route therefore takes $3\pi(2n+1)/[4J(3/2)^k]=O(n^{\log_3 2}/J)$. This is an exact polynomial-control-list construction with free internal X, CNOT, and Toffoli gates. Its finite-strength decomposition is in Section 2, not an implied runtime benefit. +The target-bus gain is $`(3/2)^k`$ with $`4^k`$ contact intervals per Ising gate. The buffered route therefore takes $`3\pi(2n+1)/[4J(3/2)^k]=O(n^{\log_3 2}/J)`$. This is an exact polynomial-control-list construction with free internal X, CNOT, and Toffoli gates. Its finite-strength decomposition is in Section 2, not an implied runtime benefit. ## 5. Optimal gain within a specified averaging class -For the fixed collective contact $H=JZ_C\sum_{j=1}^nZ_j$, the normalized trace norm is $\|H\|_{1,\mathrm{norm}}=J\mu_n$. It is invariant under local conjugation and convex. A convex average equal to $gZ_qZ_C\otimes I$ must therefore have $|g|\le J\mu_n$. The exact sign-encoding construction attains this value. This is optimal amplification within convex Hamiltonian averaging of that fixed contact, not an optimal finite-gate synthesis theorem for arbitrary time-dependent contacts. Hamiltonian simulation by local conjugations and majorization is established prior work [VC02](related-work.md#vc02). +For the fixed collective contact $`H=JZ_C\sum_{j=1}^nZ_j`$, the normalized trace norm is $`\|H\|_{1,\mathrm{norm}}=J\mu_n`$. It is invariant under local conjugation and convex. A convex average equal to $`gZ_qZ_C\otimes I`$ must therefore have $`|g|\le J\mu_n`$. The exact sign-encoding construction attains this value. This is optimal amplification within convex Hamiltonian averaging of that fixed contact, not an optimal finite-gate synthesis theorem for arbitrary time-dependent contacts. Hamiltonian simulation by local conjugations and majorization is established prior work [VC02](related-work.md#vc02). diff --git a/docs/entropy-flow.md b/docs/entropy-flow.md index 17725d1..fff9f15 100644 --- a/docs/entropy-flow.md +++ b/docs/entropy-flow.md @@ -6,25 +6,25 @@ Let rho_AB be an arbitrary finite-dimensional state. A may include arbitrarily m The contact contribution can be written -$$ -\dot S_A=i\operatorname{Tr}\rho[h,\log_2\rho_A\otimes I_B], -$$ +```math +\dot S_A=i\mathrm{Tr}\rho[h,\log_2\rho_A\otimes I_B], +``` up to the irrelevant sign convention for the commutator. Since rho commutes with log rho, the same magnitude is obtained with the conditional modular difference K. Center both K and h, and apply Cauchy-Schwarz to the state-weighted inner product: -$$ +```math |\dot S_A| \le 2\sqrt{V(B|A)_\rho}\,\Delta_\rho h. -$$ +``` Using [DF19](related-work.md#df19), Corollary III.5, yields -$$ +```math \boxed{|\dot S_A|\le 2\log_2(2d_B^2+1)\,\Delta_\rho h -\le 2\log_2(2d_B^2+1)\sqrt{\operatorname{Tr}\rho h^2}.} +\le 2\log_2(2d_B^2+1)\sqrt{\mathrm{Tr}\rho h^2}.} \tag{1} -$$ +``` For a bus qubit, the coefficient is c_DF=2 log_2 9. This combines the cited conditional-variance inequality with a state-weighted commutator estimate. @@ -32,37 +32,37 @@ For a bus qubit, the coefficient is c_DF=2 log_2 9. This combines the cited cond Use natural logarithms in this paragraph. Set sigma=rho_A tensor I_B and K=ln rho-ln sigma. Let r_i and s_j denote eigenvalues of rho and sigma, and use the spectral-overlap distribution -$$ +```math p_{ij}=r_i|\langle i|j\rangle|^2, \qquad X_{ij}=\ln r_i-\ln s_j, -$$ +``` including only r_i>0 and s_j>0. Then E X^2=Tr rho K^2; this identity is valid even when the logarithms do not commute. The operator inequality rho<=d_B sigma follows, for example, by pinching in a basis of B and bounding each positive diagonal block by rho_A. Let B_0=sigma^{-1/2}rho sigma^{-1/2} on the support of sigma. Then -$$ -\mathbb E e^X=\operatorname{Tr}\rho^2\sigma^{-1} -=\operatorname{Tr}\sigma B_0^2\le d_B, -$$ +```math +\mathbb E e^X=\mathrm{Tr}\rho^2\sigma^{-1} +=\mathrm{Tr}\sigma B_0^2\le d_B, +``` and -$$ -\mathbb E e^{-X}=\operatorname{Tr}\Pi_\rho\sigma\le d_B. -$$ +```math +\mathbb E e^{-X}=\mathrm{Tr}\Pi_\rho\sigma\le d_B. +``` The scalar inequality x^2<=e^x+e^{-x}-2 gives -$$ -\operatorname{Tr}\rho K^2\le2(d_B-1). -$$ +```math +\mathrm{Tr}\rho K^2\le2(d_B-1). +``` Centering can only decrease this second moment. Therefore for a bus qubit, -$$ -\boxed{|\dot S_A|\le c_0\sqrt{\operatorname{Tr}\rho h^2}, +```math +\boxed{|\dot S_A|\le c_0\sqrt{\mathrm{Tr}\rho h^2}, \qquad c_0=\frac{2\sqrt2}{\ln2}.} \tag{2} -$$ +``` This is a sharper qubit coefficient than (1), but does not change the exponent. The d_B dependence of this elementary bound is worse for large d_B than the published logarithmic estimate, so it is not an improved general-dimensional SIE theorem. @@ -78,31 +78,31 @@ Internal pulses do not change S_A. General bounded-contact controls follow by th Let L be any set of physical qubits, R the other data region, and C a set of bus qubits. There is no direct L-R coupling. For each c in C, write the genuinely interacting part of all L-c edges as -$$ +```math H_{Lc}^{\rm int}(t) =\sum_{j\in L}\sum_{a,b=x,y,z} \gamma_{jcab}(t)\sigma_j^a\sigma_c^b. -$$ +``` Terms acting on only one side are absorbed into internal controls. If the original edge h_jc has operator norm at most J_jc(t), orthogonal projection onto its two-sided Pauli terms contracts its normalized Frobenius norm. Distinct j,c,a,b strings are orthogonal, so -$$ +```math \|H_{Lc}^{\rm int}(t)\|_F^2 \le\sum_{j\in L}J_{jc}(t)^2. \tag{3} -$$ +``` This step does NOT claim that removal of local terms contracts the operator norm. Consider a pure-state ensemble with -$$ +```math \mathbb E_\psi |\psi\rangle\langle\psi|=I/D. -$$ +``` Every input is acted on by the SAME input-independent controlled unitary. Its ensemble average remains I/D at all times, despite any correlations developed in individual members. Applying (2) separately to each c, averaging absolute values, and using Jensen gives -$$ +```math \begin{aligned} \mathbb E_\psi|\dot S_L(\psi_t)| &\le c_0\sum_{c\in C} @@ -111,16 +111,16 @@ $$ &\le c_0\sum_{c\in C}\sqrt{\sum_{j\in L}J_{jc}(t)^2}. \end{aligned} \tag{4} -$$ +``` The same theorem follows using published bound (1) with c_0 replaced by c_DF. Integrating proves -$$ +```math \boxed{\mathbb E_\psi|S_L(\psi_T)-S_L(\psi_0)| \le c_0\int_0^T\sum_{c\in C} \sqrt{\sum_{j\in L}J_{jc}(t)^2}\,dt.} \tag{5} -$$ +``` For uniform contacts, this is at most c_0 J |C| sqrt(|L|) T. There is no additive constant, factor n^delta, minimum segment length, or derivative condition. Compare the restricted-time-dependence average-input bound of [D26](related-work.md#d26). @@ -131,21 +131,21 @@ Additional known-initialized workspace is not free under this theorem. More gene ## 5. No-helper converse and sequential comparator -For $n$ unknown qubits in each module, test the channel on local Bell pairs with inaccessible references. With a chosen pure bus, the accessible physical state satisfies $\omega(t)\preceq2I/D$ at every time. Pauli orthogonality gives $\|H_{LC}^{\mathrm{int}}\|_F^2\le nJ^2$. Equations (2)-(3) imply a cut entropy rate at most $4J\sqrt n/\ln2$. An exact exchange raises the reference-assisted cut entropy from zero to $2n$ bits, hence +For $`n`$ unknown qubits in each module, test the channel on local Bell pairs with inaccessible references. With a chosen pure bus, the accessible physical state satisfies $`\omega(t)\preceq2I/D`$ at every time. Pauli orthogonality gives $`\|H_{LC}^{\mathrm{int}}\|_F^2\le nJ^2`$. Equations (2)-(3) imply a cut entropy rate at most $`4J\sqrt n/\ln2`$. An exact exchange raises the reference-assisted cut entropy from zero to $`2n`$ bits, hence -$$ +```math T\ge\frac{\ln2}{2J}\sqrt n. -$$ +``` -The published-variance constant alone gives $T\ge\sqrt n/(\sqrt2\log_2 9\,J)$, with the same scaling. If the required operation restores an arbitrary bus, purify a maximally mixed bus on the opposite side of the cut. The physical test is then exactly $I/D$, improving the first coefficient to $\ln2/\sqrt2$. This stronger coefficient belongs to the stronger task; the construction meets that task too. +The published-variance constant alone gives $`T\ge\sqrt n/(\sqrt2\log_2 9\,J)`$, with the same scaling. If the required operation restores an arbitrary bus, purify a maximally mixed bus on the opposite side of the cut. The physical test is then exactly $`I/D`$, improving the first coefficient to $`\ln2/\sqrt2`$. This stronger coefficient belongs to the stronger task; the construction meets that task too. -For normalized payload Choi fidelity $F_e\ge1-\epsilon$, the pure global output is within trace distance $\sqrt\epsilon$ of the ideal payload Choi vector times a pure environment vector. Entropy continuity yields +For normalized payload Choi fidelity $`F_e\ge1-\epsilon`$, the pure global output is within trace distance $`\sqrt\epsilon`$ of the ideal payload Choi vector times a pure environment vector. Entropy continuity yields -$$ +```math T\ge\frac{\ln2}{4J\sqrt n} \left[2n(1-\sqrt\epsilon)-h_2(\sqrt\epsilon)\right]. -$$ +``` This preserves the exponent at fixed sufficiently small error. It is a process-fidelity bound, not an identification of process fidelity with diamond distance. -For at most one active contact at a time, add the entropy changes of both register cuts. Their sum must grow by $4n$ bits, while its derivative is at most $4J/\ln2$. Consequently $T_{\mathrm{division}}\ge n\ln2/J$, even with free internal controls. See [Control models](control-models.md) for an explicit sequential schedule and the finite-speed comparison. +For at most one active contact at a time, add the entropy changes of both register cuts. Their sum must grow by $`4n`$ bits, while its derivative is at most $`4J/\ln2`$. Consequently $`T_{\mathrm{division}}\ge n\ln2/J`$, even with free internal controls. See [Control models](control-models.md) for an explicit sequential schedule and the finite-speed comparison. diff --git a/docs/learning-bridges.md b/docs/learning-bridges.md index ba2e962..8262514 100644 --- a/docs/learning-bridges.md +++ b/docs/learning-bridges.md @@ -6,70 +6,70 @@ These examples connect the [Watrous foundation](learning.md) to the [30-mileston **Foundation:** Watrous §§2.1.3, 2.2.2, and 5.2. **Milestones:** M03, M09, M18. -Take one payload qubit on each side and inaccessible references $L',R'$. Initially prepare +Take one payload qubit on each side and inaccessible references $`L',R'`$. Initially prepare -$$ +```math |\Omega_0\rangle =|\Phi^+\rangle_{LL'}\otimes|\Phi^+\rangle_{RR'}, \qquad |\Phi^+\rangle=(|00\rangle+|11\rangle)/\sqrt2. -$$ +``` -Across the cut $LL'$ versus $RR'$, this is a product: each Bell pair is wholly on one side. Its cut entropy is zero. After swapping only the physical payloads $L,R$, +Across the cut $`LL'`$ versus $`RR'`$, this is a product: each Bell pair is wholly on one side. Its cut entropy is zero. After swapping only the physical payloads $`L,R`$, -$$ +```math |\Omega_1\rangle =|\Phi^+\rangle_{RL'}\otimes|\Phi^+\rangle_{LR'}. -$$ +``` -Both pairs now cross the cut, and the reduced state on $LL'$ is $I_4/4$. Its entropy is two bits. Yet the single-qubit marginals of $L$ and $R$ were $I_2/2$ before the operation and remain $I_2/2$ afterward. Checking those marginals would miss the entire task. +Both pairs now cross the cut, and the reduced state on $`LL'`$ is $`I_4/4`$. Its entropy is two bits. Yet the single-qubit marginals of $`L`$ and $`R`$ were $`I_2/2`$ before the operation and remain $`I_2/2`$ afterward. Checking those marginals would miss the entire task. -The references never travel and cannot be used as clean helpers. Their role is to expose where unknown quantum information went. With $n$ payload qubits per side, the ideal exchange creates $2n$ bits across this reference-assisted cut. The bus and helpers occupy their specified sides of the complete cut in the [converse](mixed-helpers.md#2-converse-an-entropy-budget-with-a-payload-sized-continuity-bound). +The references never travel and cannot be used as clean helpers. Their role is to expose where unknown quantum information went. With $`n`$ payload qubits per side, the ideal exchange creates $`2n`$ bits across this reference-assisted cut. The bus and helpers occupy their specified sides of the complete cut in the [converse](mixed-helpers.md#2-converse-an-entropy-budget-with-a-payload-sized-continuity-bound). -A pure global test can have a mixed accessible physical state. For local helper purifications and the payload Bell pairs, the physical entropy deficit is $1+2s[1-h_2(p)]$ when a pure bus is chosen for the lower-bound test. Unitary internal processing preserves that deficit. The [entropy-rate argument](bandwidth.md#32-entropy-deficit-cut-rate) converts it into a bound on how fast the required correlations can be created. +A pure global test can have a mixed accessible physical state. For local helper purifications and the payload Bell pairs, the physical entropy deficit is $`1+2s[1-h_2(p)]`$ when a pure bus is chosen for the lower-bound test. Unitary internal processing preserves that deficit. The [entropy-rate argument](bandwidth.md#32-entropy-deficit-cut-rate) converts it into a bound on how fast the required correlations can be created. ## 2. Occupied spectators can assist without losing their data **Foundation:** Watrous §1.1.3 and Chapter 4. **Milestones:** M20–M23. -Let $q$ be a target qubit, $a,b$ two occupied spectator qubits, and $C$ the bus. Their physical contact is +Let $`q`$ be a target qubit, $`a,b`$ two occupied spectator qubits, and $`C`$ the bus. Their physical contact is -$$ +```math H=JZ_C(Z_q+Z_a+Z_b). -$$ +``` -Apply the reversible encoding $E$: first a Toffoli controlled by $a,b$ onto $q$, then CNOTs from $q$ to $a$ and $b$. Directly following the computational-basis labels gives +Apply the reversible encoding $`E`$: first a Toffoli controlled by $`a,b`$ onto $`q`$, then CNOTs from $`q`$ to $`a`$ and $`b`$. Directly following the computational-basis labels gives -$$ +```math E^\dagger(Z_q+Z_a+Z_b)E -=Z_q\otimes D_{ab},\qquad D_{ab}=\operatorname{diag}(3,1,1,1). -$$ +=Z_q\otimes D_{ab},\qquad D_{ab}=\mathrm{diag}(3,1,1,1). +``` The encoded interaction's sign depends on the target; its magnitude still depends on the spectators. Four coherent spectator XOR translations remove that dependence: -$$ +```math \frac14\sum_{u\in\{00,01,10,11\}}X_uD_{ab}X_u =\frac32 I_{ab}. -$$ +``` -Every diagonal entry sees the same multiset $\{3,1,1,1\}$. If $H_u$ denotes the decoded-frame translated contact, these Hamiltonians commute. Four equal intervals of total duration $t$, with their control frames restored, therefore give +Every diagonal entry sees the same multiset $`\{3,1,1,1\}`$. If $`H_u`$ denotes the decoded-frame translated contact, these Hamiltonians commute. Four equal intervals of total duration $`t`$, with their control frames restored, therefore give -$$ +```math \prod_u e^{-i(t/4)H_u} =e^{-i(3J/2)t Z_qZ_C}\otimes I_{ab}. -$$ +``` This is an identity on arbitrary superpositions and on inputs entangled with references. There is no average over unknown input labels, measurement, or discarded output. Spectators may become correlated during the sequence; the completed operation restores their entire subsystem. Watrous's mixed-unitary channels describe convex combinations of output operations. The construction above instead uses a prescribed coherent sequence of conjugated Hamiltonians. Commutation is what turns its Hamiltonian average into an exact finite-time identity. These are not the same physical operation. -Larger blocks give gain $\mu_b=\mathbb E|\epsilon_1+\cdots+\epsilon_b|$. Balanced blocks and reversible use of clean leaders give the [matching construction](bandwidth.md#5-matching-exact-construction-with-returned-clean-helpers). The [synchronized schedule](accuracy-and-resources.md#3-short-exact-synchronized-block-schedules) avoids enumerating the product of the blocks' lists. These gains charge contact time; they do not charge internal encoding or pulse duration. The [finite-control calculation](control-models.md#24-finite-control-consequence) is a separate clock. +Larger blocks give gain $`\mu_b=\mathbb E|\epsilon_1+\cdots+\epsilon_b|`$. Balanced blocks and reversible use of clean leaders give the [matching construction](bandwidth.md#5-matching-exact-construction-with-returned-clean-helpers). The [synchronized schedule](accuracy-and-resources.md#3-short-exact-synchronized-block-schedules) avoids enumerating the product of the blocks' lists. These gains charge contact time; they do not charge internal encoding or pulse duration. The [finite-control calculation](control-models.md#24-finite-control-consequence) is a separate clock. ## 3. A near-clean prefix is a joint promise, not perfect independent bits **Foundation:** Watrous §§4.3 and 5.3.1–5.3.2. **Milestones:** M25–M28. -Consider three independent helpers with $p=0.1$. Their eight basis probabilities are +Consider three independent helpers with $`p=0.1`$. Their eight basis probabilities are | Hamming weight | Number of labels | Probability per label | |---:|---:|---:| @@ -78,15 +78,15 @@ Consider three independent helpers with $p=0.1$. Their eight basis probabilities | 2 | 3 | 0.009 | | 3 | 1 | 0.001 | -The four largest eigenvalues sum to $0.972$. A fixed permutation maps their labels into $000,001,010,011$, where the first output bit is zero. Complete the permutation bijectively on the other four labels. The first bit is now zero with probability $0.972$; the other two helpers hold the remaining entropy and correlations. Nothing was cooled by a reset, and total entropy is unchanged. +The four largest eigenvalues sum to $`0.972`$. A fixed permutation maps their labels into $`000,001,010,011`$, where the first output bit is zero. Complete the permutation bijectively on the other four labels. The first bit is now zero with probability $`0.972`$; the other two helpers hold the remaining entropy and correlations. Nothing was cooled by a reset, and total entropy is unchanged. -For two modules, this choice gives a favorable-sector weight $0.972^2$ and an unfavorable weight +For two modules, this choice gives a favorable-sector weight $`0.972^2`$ and an unfavorable weight -$$ +```math \Delta=1-0.972^2=0.055216. -$$ +``` -Suppose the entire routing unitary is exactly correct on this common favorable sector and preserves it. With fixed helper purifications, its complete-operation half diamond error is at most $2\sqrt\Delta$, about $0.470$. This small example illustrates the mechanism; it does **not** certify a one-percent route. The [finite-size certificates](accuracy-and-resources.md#2-finite-size-advantage-against-every-unknown-helper-protocol) use larger helper pools and much smaller tails. +Suppose the entire routing unitary is exactly correct on this common favorable sector and preserves it. With fixed helper purifications, its complete-operation half diamond error is at most $`2\sqrt\Delta`$, about $`0.470`$. This small example illustrates the mechanism; it does **not** certify a one-percent route. The [finite-size certificates](accuracy-and-resources.md#2-finite-size-advantage-against-every-unknown-helper-protocol) use larger helper pools and much smaller tails. The general construction compresses once, keeps every entropy-bearing qubit as an occupied spectator, routes, and decompresses once. Its exact action on the common favorable sector is why the initial preparation error is not multiplied by the number of gates. It must agree with the ideal with one common phase on that sector; correct output labels without phase control are insufficient. diff --git a/docs/learning.md b/docs/learning.md index 6f23d49..7f89067 100644 --- a/docs/learning.md +++ b/docs/learning.md @@ -15,7 +15,7 @@ The map is project-defined, not a judgment about a learner's current knowledge. Use the [author's book page](https://jhwatrous.github.io/books-and-courses.html), its [standard-layout manuscript](https://jhwatrous.github.io/TQI.pdf), and its [errata](https://jhwatrous.github.io/TQI.errata.pdf). Section numbers below refer to that manuscript. Printed page labels and a PDF viewer's page counter differ; use the section identifiers. The author supplies the manuscript for personal use and prohibits redistribution. Link to it; do not add a copy, extracted chapters, or textbook figures to this repository. -The available errata is dated July 23, 2025 and refers to the published edition. In the part of §3.3.3 containing Theorem 3.56 (printed pages 183–184), the corrected conclusion has $2\sqrt\epsilon$, not $\sqrt{2\epsilon}$. Consult the errata alongside a passage rather than treating an uncorrected printed formula as authoritative. +The available errata is dated July 23, 2025 and refers to the published edition. In the part of §3.3.3 containing Theorem 3.56 (printed pages 183–184), the corrected conclusion has $`2\sqrt\epsilon`$, not $`\sqrt{2\epsilon}`$. Consult the errata alongside a passage rather than treating an uncorrected printed formula as authoritative. ## Selected sections @@ -39,40 +39,40 @@ Keep the physics notation of this repository. Translate the anchor, rather than | In Watrous | Here | Check before substituting | |---|---|---| -| A vector $u$ and outer product $uu^*$ | $\lvert\psi\rangle$ and $\lvert\psi\rangle\langle\psi\rvert$ | The asterisk on an operator is the adjoint, written $\dagger$ here. | -| Register spaces and density operators | $L,R,C$ and $\omega,\rho$ | Inaccessible reference systems are not controllable workspace. | -| Schatten two-norm $\lVert A\rVert_2$ | Normalized Frobenius norm $\lVert A\rVert_F$ in the proofs | Divide the Schatten norm by the square root of the full operator dimension. | -| Choi operator $J(\Phi)$ in §2.2.2 | A normalized Choi state when testing fidelity | Divide by input dimension. The bare $J$ in a contact bound denotes coupling strength, not a Choi operator. | -| Fidelity $F$ in Definition 3.11 | Squared pure-target overlap $F_e$ in the process tests | Root fidelity and squared overlap are not interchangeable. | -| Completely bounded trace norm in §3.3.2 | Diamond norm $\lVert\cdot\rVert_\diamond$ | The main error convention includes the factor $1/2$. | -| Entropic functions and relative entropy in Chapter 5 | $S$, $h_2$, and $\mathcal I$ | Entropies are in bits; moment-generating estimates explicitly use natural logarithms. | - -For an operator on a $D$-dimensional space, - -$$ -\|A\|_F^2=\frac{\operatorname{Tr}(A^\dagger A)}D, +| A vector $`u`$ and outer product $`uu^*`$ | $`\lvert\psi\rangle`$ and $`\lvert\psi\rangle\langle\psi\rvert`$ | The asterisk on an operator is the adjoint, written $`\dagger`$ here. | +| Register spaces and density operators | $`L,R,C`$ and $`\omega,\rho`$ | Inaccessible reference systems are not controllable workspace. | +| Schatten two-norm $`\lVert A\rVert_2`$ | Normalized Frobenius norm $`\lVert A\rVert_F`$ in the proofs | Divide the Schatten norm by the square root of the full operator dimension. | +| Choi operator $`J(\Phi)`$ in §2.2.2 | A normalized Choi state when testing fidelity | Divide by input dimension. The bare $`J`$ in a contact bound denotes coupling strength, not a Choi operator. | +| Fidelity $`F`$ in Definition 3.11 | Squared pure-target overlap $`F_e`$ in the process tests | Root fidelity and squared overlap are not interchangeable. | +| Completely bounded trace norm in §3.3.2 | Diamond norm $`\lVert\cdot\rVert_\diamond`$ | The main error convention includes the factor $`1/2`$. | +| Entropic functions and relative entropy in Chapter 5 | $`S`$, $`h_2`$, and $`\mathcal I`$ | Entropies are in bits; moment-generating estimates explicitly use natural logarithms. | + +For an operator on a $`D`$-dimensional space, + +```math +\|A\|_F^2=\frac{\mathrm{Tr}(A^\dagger A)}D, \qquad \|A\|_F=\frac{\|A\|_2}{\sqrt D}. -$$ +``` Thus the identity has normalized Frobenius norm one, whatever its dimension. Neither norm is the contact's operator norm. A statement proved for one must not be used as a bound for another without its dimension factor. -For a trace-preserving channel with input dimension $d_{\mathrm{in}}$, Watrous's Choi operator has trace $d_{\mathrm{in}}$. Set $\tau_\Phi=J(\Phi)/d_{\mathrm{in}}$. For a unitary target with normalized Choi vector $|\Psi_*\rangle$, +For a trace-preserving channel with input dimension $`d_{\mathrm{in}}`$, Watrous's Choi operator has trace $`d_{\mathrm{in}}`$. Set $`\tau_\Phi=J(\Phi)/d_{\mathrm{in}}`$. For a unitary target with normalized Choi vector $`|\Psi_{\ast}\rangle`$, -$$ -F_e=\langle\Psi_*|\tau_\Phi|\Psi_*\rangle -=F\!\left(\tau_\Phi,|\Psi_*\rangle\langle\Psi_*|\right)^2. -$$ +```math +F_e=\langle\Psi_{\ast}|\tau_\Phi|\Psi_{\ast}\rangle +=F\!\left(\tau_\Phi,|\Psi_{\ast}\rangle\langle\Psi_{\ast}|\right)^2. +``` -The right-hand $F$ is Watrous's root fidelity. High Choi fidelity alone is not the same statement as a dimension-independent worst-case diamond guarantee. +The right-hand $`F`$ is Watrous's root fidelity. High Choi fidelity alone is not the same statement as a dimension-independent worst-case diamond guarantee. The initialization budget is a familiar relative entropy: -$$ +```math \mathcal I(\omega)=\log_2D-S(\omega) =D\!\left(\omega\,\middle\|\,I/D\right). -$$ +``` -On the right $D(\cdot\|\cdot)$ is relative entropy; inside $I/D$, $D$ is the Hilbert-space dimension. This budget measures lack of entropy, not work, temperature, or quadratic purity. +On the right $`D(\cdot\|\cdot)`$ is relative entropy; inside $`I/D`$, $`D`$ is the Hilbert-space dimension. This budget measures lack of entropy, not work, temperature, or quadratic purity. ## From foundations to the project diff --git a/docs/mixed-helpers.md b/docs/mixed-helpers.md index 72a780c..fea1fb4 100644 --- a/docs/mixed-helpers.md +++ b/docs/mixed-helpers.md @@ -2,38 +2,38 @@ ## 1. Task and matching law -Use the same two-module, one-qubit-bus model as [the exact bandwidth theorem](bandwidth.md). Each module has $n\ge1$ payload qubits and $s\ge0$ helper qubits, with $N=n+s$ bounded-strength contacts. Every contact has operator norm at most $J$. Arbitrary module-internal controls and bus-only controls have zero charged duration. Both interfaces are bounded; there is no direct module-to-module coupling, measurement, reset, or extra initialized workspace. +Use the same two-module, one-qubit-bus model as [the exact bandwidth theorem](bandwidth.md). Each module has $`n\ge1`$ payload qubits and $`s\ge0`$ helper qubits, with $`N=n+s`$ bounded-strength contacts. Every contact has operator norm at most $`J`$. Arbitrary module-internal controls and bus-only controls have zero charged duration. Both interfaces are bounded; there is no direct module-to-module coupling, measurement, reset, or extra initialized workspace. The helpers in each module are independently prepared in the known state -$$ +```math \rho_p^{\otimes s},\qquad \rho_p=(1-p)|0\rangle\langle0|+p|1\rangle\langle1|, \qquad 0\le p\le\tfrac12. -$$ +``` -Define their entropy deficit per helper by $d(p)=1-h_2(p)$, in bits. The two modules' helper preparations are independent of one another and of the payload and bus. The payload and bus may have arbitrary external reference entanglement. +Define their entropy deficit per helper by $`d(p)=1-h_2(p)`$, in bits. The two modules' helper preparations are independent of one another and of the payload and bus. The payload and bus may have arbitrary external reference entanglement. A strong error convention makes restoration precise. Retain an inaccessible purification of each helper preparation, -$$ +```math |\chi_p\rangle_{HE} =\sum_{x\in\{0,1\}^s}\sqrt{q_x}|x\rangle_H|x\rangle_E, \qquad q_x=p^{|x|}(1-p)^{s-|x|}. -$$ +``` -Let $\Phi_U$ insert these fixed purifications and apply the physical protocol $U$. Let $\Phi_*$ insert the same purifications, exchange the payloads, and act as identity on the bus, helpers, and preparation references. Require +Let $`\Phi_U`$ insert these fixed purifications and apply the physical protocol $`U`$. Let $`\Phi_{\ast}`$ insert the same purifications, exchange the payloads, and act as identity on the bus, helpers, and preparation references. Require -$$ -\frac12\|\Phi_U-\Phi_*\|_\diamond\le\epsilon. +```math +\frac12\|\Phi_U-\Phi_{\ast}\|_\diamond\le\epsilon. \tag{1} -$$ +``` The supremum includes all payload/bus inputs and all their reference extensions. The helper purifications are fixed input resources, not additional freely chosen input qubits or controllable workspace. Different purifications of the same helper states give the same guarantee by an isometry on the inaccessible reference. -**Theorem.** For every fixed $0<\epsilon\le0.1$, the optimal interaction time under (1) satisfies +**Theorem.** For every fixed $`0\lt \epsilon\le0.1`$, the optimal interaction time under (1) satisfies -$$ +```math \boxed{ T_{\epsilon,p}(n,s) =\Theta_\epsilon\!\left( @@ -41,9 +41,9 @@ T_{\epsilon,p}(n,s) \right). } \tag{2} -$$ +``` -The constants may depend on $\epsilon$, but not on $n,s,p$. The statement is uniform even when $p$ varies with system size. In particular, it includes $p=0$, $p=1/2$, and arbitrarily weak polarization. It applies to all $s\ge0$, not only $s\le n$. +The constants may depend on $`\epsilon`$, but not on $`n,s,p`$. The statement is uniform even when $`p`$ varies with system size. In particular, it includes $`p=0`$, $`p=1/2`$, and arbitrarily weak polarization. It applies to all $`s\ge0`$, not only $`s\le n`$. The error covers the complete routing operation and helper restoration, rather than error per helper or per gate. The constructed protocol returns the physical helper density matrix **exactly** for this diagonal preparation. Residual data-helper correlations, bus errors, and changes in preparation-reference correlations are covered by (1); they are not asserted to vanish exactly. @@ -51,216 +51,216 @@ This is a preparation-error theorem with ideal unitary controls. It is not a the ## 2. Converse: an entropy budget with a payload-sized continuity bound -Purify the helpers locally as above. Put every payload qubit in a Bell pair with an inaccessible reference on its own side, and choose a pure bus for this lower-bound test. The complete state including references is pure. The accessible physical state $\omega$ has +Purify the helpers locally as above. Put every payload qubit in a Bell pair with an inaccessible reference on its own side, and choose a pure bus for this lower-bound test. The complete state including references is pure. The accessible physical state $`\omega`$ has -$$ +```math \mathcal I(\omega)=\log_2D-S(\omega)=1+2s\,d(p). \tag{3} -$$ +``` This entropy deficit is conserved by every admissible physical unitary, even while the helpers become correlated or locally more polarized. The [entropy-deficit cut bound](bandwidth.md#32-entropy-deficit-cut-rate) therefore gives -$$ +```math |\dot S_A| \le 4\sqrt{6/\ln2}\,J\sqrt{N\{3/2+2s\,d(p)\}}, \tag{4} -$$ +``` -where $A$ includes the entire physical left module, its payload references, and its helper-preparation references. Initially $S_A=0$. The underlying conditional entropy-rate estimate may equivalently use the published conditional-variance bound [DF19](related-work.md#df19), changing only a universal constant. +where $`A`$ includes the entire physical left module, its payload references, and its helper-preparation references. Initially $`S_A=0`$. The underlying conditional entropy-rate estimate may equivalently use the published conditional-variance bound [DF19](related-work.md#df19), changing only a universal constant. -It is unnecessary to pay an error-continuity factor proportional to the helper dimension. Let $a$ consist of the left payload and its original payload references, and let $b$ be the corresponding right subsystem. Each has dimension $2^{2n}$. The ideal exchanged-payload Choi vector is maximally entangled across $a:b$, so its mutual information is $4n$ bits. +It is unnecessary to pay an error-continuity factor proportional to the helper dimension. Let $`a`$ consist of the left payload and its original payload references, and let $`b`$ be the corresponding right subsystem. Each has dimension $`2^{2n}`$. The ideal exchanged-payload Choi vector is maximally entangled across $`a:b`$, so its mutual information is $`4n`$ bits. -Tracing the helper, bus, and preparation-reference outputs cannot increase trace distance. Equation (1) puts the actual $ab$ state within trace distance $\epsilon$ of that vector. Entropy continuity on $a$, $b$, and $ab$ gives +Tracing the helper, bus, and preparation-reference outputs cannot increase trace distance. Equation (1) puts the actual $`ab`$ state within trace distance $`\epsilon`$ of that vector. Entropy continuity on $`a`$, $`b`$, and $`ab`$ gives -$$ +```math I(a:b)\ge4n-8n\epsilon-3h_2(\epsilon). -$$ +``` By data processing of mutual information and purity of the complete output, -$$ +```math 2S_A=I(A:A^c)\ge I(a:b). -$$ +``` Consequently -$$ +```math S_A(T)\ge2n-4n\epsilon-\tfrac32h_2(\epsilon). \tag{5} -$$ +``` -For $0<\epsilon\le0.1$ the right-hand side is at least $b_\epsilon n$, where +For $`0\lt \epsilon\le0.1`$ the right-hand side is at least $`b_\epsilon n`$, where -$$ -b_\epsilon=2-4\epsilon-\tfrac32h_2(\epsilon)>0. -$$ +```math +b_\epsilon=2-4\epsilon-\tfrac32h_2(\epsilon)\gt 0. +``` -Equations (4)-(5), using $3/2+2sd(p)\le2[1+sd(p)]$, imply the explicit lower bound +Equations (4)-(5), using $`3/2+2sd(p)\le2[1+sd(p)]`$, imply the explicit lower bound -$$ +```math T_{\epsilon,p}\ge \frac{b_\epsilon}{4\sqrt{12/\ln2}} \frac{n}{J\sqrt{N[1+sd(p)]}}. \tag{6} -$$ +``` -This converse actually needs only the corresponding accuracy of the payload channel on its Bell-reference test, not helper return. The matching construction meets the stronger preparation-inclusive condition (1). The use of $a,b$ rather than the full helper-bearing cut removes the restriction $s\le n$ in the earlier direct entropy-continuity estimate. Singular states and instantaneous internal pulses are handled as in [Entropy flow](entropy-flow.md#3-supports-and-admissible-controls). +This converse actually needs only the corresponding accuracy of the payload channel on its Bell-reference test, not helper return. The matching construction meets the stronger preparation-inclusive condition (1). The use of $`a,b`$ rather than the full helper-bearing cut removes the restriction $`s\le n`$ in the earlier direct entropy-continuity estimate. Singular states and instantaneous internal pulses are handled as in [Entropy flow](entropy-flow.md#3-supports-and-admissible-controls). ## 3. Reversible concentration at finite error ### 3.1 Exact spectral criterion -Let $\lambda_1\ge\cdots\ge\lambda_{2^s}$ be the helper eigenvalues. A unitary can place weight at least $1-\delta$ in a subspace where $r$ specified helper bits are zero precisely when +Let $`\lambda_1\ge\cdots\ge\lambda_{2^s}`$ be the helper eigenvalues. A unitary can place weight at least $`1-\delta`$ in a subspace where $`r`$ specified helper bits are zero precisely when -$$ +```math \sum_{i=1}^{2^{s-r}}\lambda_i\ge1-\delta. \tag{7} -$$ +``` -Necessity is the variational characterization of the sum of the largest eigenvalues; sufficiency maps their eigenvectors into the zero-prefix subspace. For the product state above, decreasing eigenvalue order is increasing Hamming weight. A fixed permutation of the $s$ helper bits' full computational-basis labels implements this mapping. It uses no measured label, extra Hilbert-space dimension, or reset. +Necessity is the variational characterization of the sum of the largest eigenvalues; sufficiency maps their eigenvectors into the zero-prefix subspace. For the product state above, decreasing eigenvalue order is increasing Hamming weight. A fixed permutation of the $`s`$ helper bits' full computational-basis labels implements this mapping. It uses no measured label, extra Hilbert-space dimension, or reset. -The remaining $s-r$ qubits retain the compressed entropy. They are kept inside the module as arbitrary spectator qubits; nothing is discarded. After the routing operation the permutation is reversed. +The remaining $`s-r`$ qubits retain the compressed entropy. They are kept inside the module as arbitrary spectator qubits; nothing is discarded. After the routing operation the permutation is reversed. Reversible polarization concentration is established prior work; see Schulman and Vazirani's [Scalable NMR Quantum Computation](https://arxiv.org/abs/quant-ph/9804060), especially its explicit treatment of initially absent clean workspace. The statement here composes concentration with data-preserving contact amplification and a complete-operation error bound. It is not a claim to invent purity concentration. ### 3.2 An elementary uniform estimate -Write $\beta=1-2p$ and $x=s\beta^2$. The binary entropy series gives +Write $`\beta=1-2p`$ and $`x=s\beta^2`$. The binary entropy series gives -$$ +```math \frac{\beta^2}{2\ln2}\le d(p)\le\beta^2. \tag{8} -$$ +``` -Consider the helper labels with Hamming weight at most $s(1/2-\beta/4)$. Hoeffding's inequality applied first to the actual Bernoulli distribution and then to the uniform counting distribution gives +Consider the helper labels with Hamming weight at most $`s(1/2-\beta/4)`$. Hoeffding's inequality applied first to the actual Bernoulli distribution and then to the uniform counting distribution gives -$$ +```math \Pr_p(\text{outside})\le e^{-x/8}, \qquad |\text{inside}|\le2^s e^{-x/8}. \tag{9} -$$ +``` -The noninteger threshold is interpreted by its floor; the bounds remain valid. If $x\ge8\ln(1/\delta)$, choose +The noninteger threshold is interpreted by its floor; the bounds remain valid. If $`x\ge8\ln(1/\delta)`$, choose -$$ +```math r=\left\lfloor\frac{x}{8\ln2}\right\rfloor. -$$ +``` -Then (9) fits the inside labels into $2^{s-r}$ output labels with zero prefix and failure weight at most $\delta$. If the threshold is not met, choose $r=0$, which has exactly zero failure weight. This fallback uses the occupied-data protocol, not a failed preparation step. +Then (9) fits the inside labels into $`2^{s-r}`$ output labels with zero prefix and failure weight at most $`\delta`$. If the threshold is not met, choose $`r=0`$, which has exactly zero failure weight. This fallback uses the occupied-data protocol, not a failed preparation step. -For $0<\delta\le1/4$, these choices satisfy the simple conservative bound +For $`0\lt \delta\le1/4`$, these choices satisfy the simple conservative bound -$$ +```math r+1\ge c_\delta[1+sd(p)], \qquad c_\delta=\frac1{2+8\ln(1/\delta)+8\ln2}. \tag{10} -$$ +``` -For small $x$, (8) and the fallback prove (10). For large $x$, use $r+1>x/(8\ln2)$ and $sd(p)\le x$. Thus no fixed-$p$ asymptotic assumption or unproved substitution of entropy for a helper count is needed. For finite examples, criterion (7) is much sharper than (9). +For small $`x`$, (8) and the fallback prove (10). For large $`x`$, use $`r+1\gt x/(8\ln2)`$ and $`sd(p)\le x`$. Thus no fixed-$`p`$ asymptotic assumption or unproved substitution of entropy for a helper count is needed. For finite examples, criterion (7) is much sharper than (9). ## 4. Route on the good subspace; decompress once -After compression, a module still has exactly $N=n+s$ qubits. Use the target and the $r$ near-clean prefix bits as $r+1$ block leaders. All remaining qubits, including the $s-r$ entropy-bearing helpers, are occupied spectators. +After compression, a module still has exactly $`N=n+s`$ qubits. Use the target and the $`r`$ near-clean prefix bits as $`r+1`$ block leaders. All remaining qubits, including the $`s-r`$ entropy-bearing helpers, are occupied spectators. -The [balanced-block construction](bandwidth.md#5-matching-exact-construction-with-returned-clean-helpers) is an operator identity on arbitrary spectator inputs. Its use therefore requires no independence among the compressed spectators. With balanced block sizes $b_i$ and $\mu_b=\mathbb E|\epsilon_1+\cdots+\epsilon_b|$, its target-bus gain is +The [balanced-block construction](bandwidth.md#5-matching-exact-construction-with-returned-clean-helpers) is an operator identity on arbitrary spectator inputs. Its use therefore requires no independence among the compressed spectators. With balanced block sizes $`b_i`$ and $`\mu_b=\mathbb E|\epsilon_1+\cdots+\epsilon_b|`$, its target-bus gain is -$$ +```math \gamma_{N,r}=\sum_{i=0}^r\mu_{b_i}, \qquad \sqrt{N(r+1)/6}\le\gamma_{N,r}\le\sqrt{N(r+1)}. \tag{11} -$$ +``` -Exchange only the $n$ payloads with the buffered $2n+1$-SWAP schedule. On the subspace where both modules' prefix bits are zero, the complete operation is exactly the payload exchange tensored with identity on every helper and the bus, up to a common global phase. It costs +Exchange only the $`n`$ payloads with the buffered $`2n+1`$-SWAP schedule. On the subspace where both modules' prefix bits are zero, the complete operation is exactly the payload exchange tensored with identity on every helper and the bus, up to a common global phase. It costs -$$ +```math T\le\frac{3\pi(2n+1)}{4J\gamma_{N,r}}. \tag{12} -$$ +``` Compression and decompression are each applied once around the whole route. Their duration is free only because internal operations are free in this model. The interaction sequence is finite, but can be exponentially long. This does not supply a new efficient bounded-strength compiler. ### 4.1 Complete reference-preserving error, without accumulation -Let $P_G$ project onto the two-module good helper subspace before compression. Its complement has initial weight +Let $`P_G`$ project onto the two-module good helper subspace before compression. Its complement has initial weight -$$ +```math \Delta\le1-(1-\delta)^2\le2\delta. -$$ +``` -The actual and ideal full unitaries agree on every payload/bus input tensored with $P_G$, with the same phase. Both are norm-one unitaries on the bad subspace. For any normalized input including arbitrary payload/bus references and the fixed helper purifications, +The actual and ideal full unitaries agree on every payload/bus input tensored with $`P_G`$, with the same phase. Both are norm-one unitaries on the bad subspace. For any normalized input including arbitrary payload/bus references and the fixed helper purifications, -$$ -\|(U-U_*)|\Psi\rangle\| +```math +\|(U-U_{\ast})|\Psi\rangle\| \le2\|(I-P_G)|\Psi\rangle\| =2\sqrt\Delta. \tag{13} -$$ +``` -The pure-output trace distance is no larger than this vector norm, and mixed payload inputs follow by purification. Equivalently the fixed-preparation isometries differ in operator norm by at most $2\sqrt\Delta$, which bounds their half diamond distance. Set +The pure-output trace distance is no larger than this vector norm, and mixed payload inputs follow by purification. Equivalently the fixed-preparation isometries differ in operator norm by at most $`2\sqrt\Delta`$, which bounds their half diamond distance. Set -$$ +```math \delta=\epsilon^2/8. \tag{14} -$$ +``` -Then (13) proves (1), including the inaccessible helper references. There is no multiplication of $\delta$ by $n$ or by the number of elementary gates. The failure is one fixed low-weight input sector, not a fresh preparation failure sampled at every gate. +Then (13) proves (1), including the inaccessible helper references. There is no multiplication of $`\delta`$ by $`n`$ or by the number of elementary gates. The failure is one fixed low-weight input sector, not a fresh preparation failure sampled at every gate. -Without retaining a coherent helper purification, the diagonal mixture even gives a joint payload-bus-helper half diamond error at most $\Delta$, by convexity. The theorem uses the stronger square-root guarantee rather than relying on that weaker setting. +Without retaining a coherent helper purification, the diagonal mixture even gives a joint payload-bus-helper half diamond error at most $`\Delta`$, by convexity. The theorem uses the stronger square-root guarantee rather than relying on that weaker setting. ### 4.2 Exact marginal return and coherent reuse After exact spectator averaging, conjugating by the fanout gives, for a target-bus Ising gate, -$$ +```math JZ_qZ_C\left(\mu_{b_0}+\sum_{i=1}^r\mu_{b_i}Z_{h_i}\right) \otimes I_{\rm spectators}. \tag{15} -$$ +``` This is diagonal in every helper bit even outside the good subspace. The target/bus basis rotations do not act on those bits. The full route followed by decompression therefore has the form -$$ +```math U=\sum_x |x\rangle\langle x|_{H_LH_R}\otimes V_x -$$ +``` -in the original helper eigenbasis, with every $V_x$ unitary on payload and bus. Consequently the joint physical helper density matrix is restored exactly for the specified diagonal input, for every payload input. The bad-sector $V_x$ may correlate helpers with data or change preparation-reference coherences; these effects are counted in (1). +in the original helper eigenbasis, with every $`V_x`$ unitary on payload and bus. Consequently the joint physical helper density matrix is restored exactly for the specified diagonal input, for every payload input. The bad-sector $`V_x`$ may correlate helpers with data or change preparation-reference coherences; these effects are counted in (1). -The good and bad sectors are invariant, so any number of coherent uses on fresh payload registers still agrees with the ideal operation on the same original good sector. In the absence of any new physical noise, the same $2\sqrt\Delta$ bound applies to the **entire sequence**, including references to all payload batches. This is a bound on correlated preparation error, not an assertion of independent zero-error calls or indefinite fault tolerance under ongoing noise. +The good and bad sectors are invariant, so any number of coherent uses on fresh payload registers still agrees with the ideal operation on the same original good sector. In the absence of any new physical noise, the same $`2\sqrt\Delta`$ bound applies to the **entire sequence**, including references to all payload batches. This is a bound on correlated preparation error, not an assertion of independent zero-error calls or indefinite fault tolerance under ongoing noise. -Combining (10)-(14) with (6) proves (2). The constants obtained here deteriorate when $\epsilon$ tends to zero; no uniform zero-error limit is claimed. +Combining (10)-(14) with (6) proves (2). The constants obtained here deteriorate when $`\epsilon`$ tends to zero; no uniform zero-error limit is claimed. ## 5. Zero error and nonzero error are different tasks -For $0 int: fenced = re.compile(r'^([`~]{3,}).*$', re.M) lines = text.splitlines() in_fence = None + math_fence = False display = False table_width = None tables = 0 @@ -22,11 +23,15 @@ def check_reading_text(text: str, label: str) -> int: mark = match[1] if in_fence is None: in_fence = mark[0] + math_fence = stripped[len(mark):].strip() == 'math' elif mark[0] == in_fence: in_fence = None + math_fence = False table_width = None continue if in_fence: + if math_fence: + tags.extend(re.findall(r'\\tag\{([^}]+)\}', line)) continue if stripped == '$$': display = not display diff --git a/tools/inspect_hosted_render.py b/tools/inspect_hosted_render.py index e7720ce..8ed9858 100644 --- a/tools/inspect_hosted_render.py +++ b/tools/inspect_hosted_render.py @@ -15,7 +15,9 @@ REPOSITORY = 'GoGoKo699/Quantum-Routing-Bandwidth' PAGES = ('README.md', 'docs/learning.md', 'docs/learning-bridges.md', 'docs/milestones.md', 'docs/bandwidth.md', 'docs/mixed-helpers.md', - 'docs/accuracy-and-resources.md', 'docs/theorem-map.md') + 'docs/accuracy-and-resources.md', 'docs/theorem-map.md', + 'docs/entropy-flow.md', 'docs/control-models.md', 'docs/coaching.md', + 'docs/related-work.md', 'docs/verification.md') SNAPSHOT = r'''() => { const article = document.querySelector('article.markdown-body') || document.querySelector('.markdown-body'); @@ -27,11 +29,11 @@ } const all = elements(article); const markers = all.filter(x => x.localName === 'math-renderer'); - const errors = all.filter(x => x.matches('mjx-merror,merror,.MathJax_Error,[data-mjx-error],[data-mml-node="merror"]')); + const errors = all.filter(x => x.matches('mjx-merror,merror,.MathJax_Error,.flash-error,[data-mjx-error],[data-mml-node="merror"]')); const nodes = markers.map(x => { const inner = elements(x.shadowRoot || x); return {markup: x.outerHTML.slice(0,1800), shadow: x.shadowRoot?.innerHTML.slice(0,1800), ready: inner.some(y => y.matches('mjx-container,svg,math,img')), - error: /Math rendering failed|Undefined control sequence|ParseError|Unable to render expression/i.test(x.textContent || '')}; + error: /Math rendering failed|Undefined control sequence|ParseError|Unable to render expression|macros are not allowed|Missing (open|close) brace/i.test(x.textContent || '')}; }); const copy = article.cloneNode(true); copy.querySelectorAll('math-renderer,pre,code').forEach(x => x.remove()); @@ -48,10 +50,11 @@ def source_math_count(text: str) -> int: + math_fences = len(re.findall(r'^```math\s*\n.*?^```\s*$', text, flags=re.S|re.M)) text = re.sub(r'```.*?```', '', text, flags=re.S) displays = re.findall(r'\$\$.*?\$\$', text, re.S) text = re.sub(r'\$\$.*?\$\$', '', text, flags=re.S) - return len(displays) + len(re.findall(r'(? None: @@ -101,6 +104,8 @@ def main() -> None: row['problems'].append(f'{width}px: missing expected document title') if state.get('markers') != expected or state.get('ready', 0) < expected: row['problems'].append(f'{width}px: missing or unfinished mathematics') + if state.get('literal_math_lines'): + row['problems'].append(f'{width}px: unprocessed math delimiters') if state.get('errors') or state.get('marker_errors'): row['problems'].append(f'{width}px: mathematical rendering error') if state.get('page_width', 0) > width+3: diff --git a/tools/test_release_checks.py b/tools/test_release_checks.py index 77c2620..045ef05 100644 --- a/tools/test_release_checks.py +++ b/tools/test_release_checks.py @@ -21,6 +21,10 @@ def test_duplicate_tag(self): with self.assertRaisesRegex(AssertionError, 'repeated equation'): check_reading_text('$$\nx\\tag{1}\n$$\n\n$$\ny\\tag{1}\n$$\n', 'fixture') + def test_tags_in_math_fences(self): + with self.assertRaisesRegex(AssertionError, 'repeated equation'): + check_reading_text('```math\nx\\tag{1}\n```\n\n```math\ny\\tag{1}\n```\n', 'fixture') + def test_fenced_examples_are_not_tables(self): self.assertEqual(check_reading_text('```text\n| a |\n| a | b |\n$$\n```\n', 'fixture'), 0) From ff5f390c7955caf84e19b82669e4992c465cc76d Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Fri, 16 Oct 2026 21:39:17 +0800 Subject: [PATCH 4/5] Detect native MathML layout failures and retain inspected source evidence --- tools/inspect_hosted_render.py | 59 ++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/tools/inspect_hosted_render.py b/tools/inspect_hosted_render.py index 8ed9858..8da7dfb 100644 --- a/tools/inspect_hosted_render.py +++ b/tools/inspect_hosted_render.py @@ -6,6 +6,7 @@ """ from __future__ import annotations import argparse +import hashlib import json from pathlib import Path import re @@ -30,9 +31,19 @@ const all = elements(article); const markers = all.filter(x => x.localName === 'math-renderer'); const errors = all.filter(x => x.matches('mjx-merror,merror,.MathJax_Error,.flash-error,[data-mjx-error],[data-mml-node="merror"]')); + // MathML Core does not support the legacy mlabeledtr numbering element. + // Its presence can stack every token vertically without a parse error. + const nativeLayoutErrors = all.filter(x => + x.namespaceURI === 'http://www.w3.org/1998/Math/MathML' && + (x.localName === 'mlabeledtr' || + (x.localName === 'mtd' && x.parentElement?.localName !== 'mtr')) + ).map(x => ({element:x.localName, parent:x.parentElement?.localName, + text:(x.textContent || '').trim().slice(0,180)})); const nodes = markers.map(x => { const inner = elements(x.shadowRoot || x); + const rectangle = x.getBoundingClientRect(); return {markup: x.outerHTML.slice(0,1800), shadow: x.shadowRoot?.innerHTML.slice(0,1800), ready: inner.some(y => y.matches('mjx-container,svg,math,img')), + width:rectangle.width, height:rectangle.height, error: /Math rendering failed|Undefined control sequence|ParseError|Unable to render expression|macros are not allowed|Missing (open|close) brace/i.test(x.textContent || '')}; }); const copy = article.cloneNode(true); @@ -42,7 +53,8 @@ literal_math_lines: literal, article: true, heading: article.querySelector('h1')?.textContent?.trim(), markers: markers.length, ready: nodes.filter(x => x.ready).length, errors: errors.map(x => (x.getAttribute('data-mjx-error') || x.textContent || '').slice(0,180)), - marker_errors: nodes.filter(x => x.error).length, + marker_errors: nodes.filter(x => x.error).length, native_layout_errors:nativeLayoutErrors, + equation_geometry:nodes.map(x => ({width:x.width,height:x.height})), rendered_containers: all.filter(x => x.localName === 'mjx-container').length, page_width: document.documentElement.scrollWidth, viewport: window.innerWidth, table_columns: [...article.querySelectorAll('table')].map(t => [...t.rows].map(row => row.cells.length))}; @@ -57,6 +69,25 @@ def source_math_count(text: str) -> int: return math_fences + len(displays) + len(re.findall(r'(? list[str]: + problems = [] + if state.get('heading') != title: + problems.append('missing expected document title') + if state.get('markers') != expected or state.get('ready', 0) < expected: + problems.append('missing or unfinished mathematics') + if state.get('literal_math_lines'): + problems.append('unprocessed math delimiters') + if state.get('errors') or state.get('marker_errors'): + problems.append('mathematical rendering error') + if state.get('native_layout_errors'): + problems.append('unsupported native MathML equation layout') + if state.get('page_width', 0) > width+3: + problems.append('page-level horizontal overflow') + if any(len(set(cols)) > 1 for cols in state.get('table_columns', [])): + problems.append('inconsistent rendered table cells') + return [f'{width}px: {x}' for x in problems] + + def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--ref', required=True) @@ -69,7 +100,15 @@ def main() -> None: args.output.mkdir(parents=True, exist_ok=True) report = {'repository': REPOSITORY, 'ref': args.ref, 'scope': 'Actual public GitHub rendering; automated DOM/layout checks and screenshot evidence, not scientific review.', - 'pages': []} + 'source_sha256': {}, 'pages': []} + # Keep the exact public source associated with each inspected page alongside + # the screenshots. No authentication data or private repository is included. + for name in PAGES: + raw = (root/name).read_bytes() + destination = args.output/'sources'/name + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(raw) + report['source_sha256'][name] = hashlib.sha256(raw).hexdigest() with sync_playwright() as p: browser = p.chromium.launch() context = browser.new_context(viewport={'width': 1180, 'height': 900}, color_scheme='light') @@ -92,7 +131,6 @@ def main() -> None: for i in range(markers.count()): markers.nth(i).scroll_into_view_if_needed(timeout=5000) page.wait_for_timeout(50) - # Give lazy MathJax rendering a bounded final settling period. for _ in range(20): state = page.evaluate(SNAPSHOT) if state.get('ready', 0) >= expected: @@ -100,18 +138,7 @@ def main() -> None: page.wait_for_timeout(250) state = page.evaluate(SNAPSHOT) title = (root/name).read_text().splitlines()[0].removeprefix('# ') - if state.get('heading') != title: - row['problems'].append(f'{width}px: missing expected document title') - if state.get('markers') != expected or state.get('ready', 0) < expected: - row['problems'].append(f'{width}px: missing or unfinished mathematics') - if state.get('literal_math_lines'): - row['problems'].append(f'{width}px: unprocessed math delimiters') - if state.get('errors') or state.get('marker_errors'): - row['problems'].append(f'{width}px: mathematical rendering error') - if state.get('page_width', 0) > width+3: - row['problems'].append(f'{width}px: page-level horizontal overflow') - if any(len(set(cols)) > 1 for cols in state.get('table_columns', [])): - row['problems'].append(f'{width}px: inconsistent rendered table cells') + row['problems'].extend(snapshot_problems(state, expected, title, width)) row['checks'].append(state) page.evaluate('window.scrollTo(0,0)') page.screenshot(path=str(args.output/f'{name.replace("/", "_")}-{width}.png'), full_page=True) @@ -121,8 +148,6 @@ def main() -> None: report['pages'].append(row) print(json.dumps(row), flush=True) if row.get('http_status') in (403, 429) or any('ERR_' in x for x in row['problems']): - # A transport or access failure cannot be repaired by repeatedly - # requesting all the other pages from the same inaccessible host. break context.close(); browser.close() report['all_passed'] = len(report['pages']) == len(PAGES) and all(x['passed'] for x in report['pages']) From d88674540af1f93d6568dfe79bcbabc49e0ef1b1 Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Fri, 16 Oct 2026 21:50:12 +0800 Subject: [PATCH 5/5] Fix native equation-number layout and guard against silent rendering failures --- docs/accuracy-and-resources.md | 18 ++++++------ docs/bandwidth.md | 50 +++++++++++++++++----------------- docs/control-models.md | 14 +++++----- docs/entropy-flow.md | 10 +++---- docs/mixed-helpers.md | 32 +++++++++++----------- docs/verification.md | 6 ++-- tools/check_release.py | 20 ++++++++------ tools/test_release_checks.py | 36 +++++++++++++++++++----- 8 files changed, 106 insertions(+), 80 deletions(-) diff --git a/docs/accuracy-and-resources.md b/docs/accuracy-and-resources.md index 0760c17..6091f8d 100644 --- a/docs/accuracy-and-resources.md +++ b/docs/accuracy-and-resources.md @@ -21,7 +21,7 @@ The payload-sized mutual-information argument in [Mixed helpers, Section 2](mixe ```math \boxed{T_{\mathrm{unknown},e}\ge\frac{B_e(n)}{c_0J\sqrt N}, -\qquad c_0=2\sqrt2/\ln2.}\tag{1} +\qquad c_0=2\sqrt2/\ln2.}\qquad\text{(1)} ``` The published [DF19](related-work.md#df19) route proves the same inequality with $`c_0`$ replaced by $`c_{\mathrm{DF}}=2\log_2 9`$. At $`e=0`$, (1) has coefficient $`\ln2/\sqrt2`$. The maximally mixed bus is a legitimate reference test because this comparator must work on an arbitrary bus. This coefficient must not be silently used for a task that promises one fixed pure bus input. @@ -46,7 +46,7 @@ All required spectral decisions can be made with integers. At Hamming weight $`k ```math q=\frac{\displaystyle\sum_{k\gt k_{\ast}}\binom sk9^{s-k} -+(\binom{s}{k_{\ast}}-u)9^{s-k_{\ast}}}{10^s}.\tag{2} ++(\binom{s}{k_{\ast}}-u)9^{s-k_{\ast}}}{10^s}.\qquad\text{(2)} ``` The inequalities $`q\le1/80000`$ and failure of the next prefix length are checked by integer cross multiplication, not floating-point tail evaluation. Gains are rational because every $`\mu_b`$ is rational. @@ -80,7 +80,7 @@ Suppose the $`m=r+1`$ blocks have sizes $`b_i`$, and write $`w_i=b_i-1`$, $`w_{\ ```math K_{\mathrm{exact}}=2^{w_{\max}} -=2^{\lceil N/(r+1)\rceil-1}\tag{3} +=2^{\lceil N/(r+1)\rceil-1}\qquad\text{(3)} ``` intervals. In interval $`\ell=0,\ldots,K_{\mathrm{exact}}-1`$, translate block $`i`$ by the low $`w_i`$ bits of $`\ell`$. Each of that block's $`2^{w_i}`$ translations occurs equally often. Thus @@ -88,7 +88,7 @@ intervals. In interval $`\ell=0,\ldots,K_{\mathrm{exact}}-1`$, translate block $ ```math \frac1{K_{\mathrm{exact}}}\sum_\ell \sum_i Z_{q_i}D_{b_i}(x_i\oplus\ell_{[w_i]}) -=\sum_i\mu_{b_i}Z_{q_i}\otimes I_{\mathrm{spectators}}.\tag{4} +=\sum_i\mu_{b_i}Z_{q_i}\otimes I_{\mathrm{spectators}}.\qquad\text{(4)} ``` Cross-block independence is not required because there are no products of the block coefficients in this Hamiltonian average. All conjugated contacts commute. Equal-duration evolution intervals therefore realize (4) exactly, not as a first-order approximation. Fanout conjugation preserves that identity on the whole helper basis, including the unfavorable sector. The physical helper marginal-return and common-sector arguments remain intact. @@ -103,7 +103,7 @@ A polynomial alternative is available even where (3) is long. Choose $`K`$ indep ```math \Pr\!\left(\|\overline F_K-F_{\ast}\|\gt a\right) -\le2^{N+1}\exp[-Ka^2/(2N^2)].\tag{5} +\le2^{N+1}\exp[-Ka^2/(2N^2)].\qquad\text{(5)} ``` With $`M=3(2n+1)`$, $`\theta=\pi/4`$, and gain $`\gamma=\gamma_{N,r}`$, the intended contact duration is $`\theta/(J\gamma)`$. Diagonal exponentiation gives one-gate operator error at most $`\theta a/\gamma`$. A telescoping product bound gives full-unitary error at most $`M\theta a/\gamma`$. Reusing a good list under the fixed target relabelings and basis conjugations leaves this guarantee unchanged. @@ -112,7 +112,7 @@ For full-route operator error at most $`\eta`$ and offline failure probability a ```math K\ge\frac{2N^2M^2\theta^2}{\eta^2\gamma^2} -\left[(N+1)\ln2+\ln(1/q_{\mathrm{off}})\right].\tag{6} +\left[(N+1)\ln2+\ln(1/q_{\mathrm{off}})\right].\qquad\text{(6)} ``` Using $`\gamma^2\ge N(r+1)/6`$, this is $`O(n^2N^2/[(r+1)\eta^2])`$ per gate and $`O(n^3N^2/[(r+1)\eta^2])`$ over the route at fixed offline confidence. The better of this bound and (3) may be used. In the explicit finite certificates, the short **exact** list is vastly better than this conservative concentration estimate. @@ -132,7 +132,7 @@ Synthesis and dynamical errors are different. For a specified finite circuit wit ```math \frac12\|\Phi_{\mathrm{actual}}-\Phi_{\ast}\|_\diamond \le2\sqrt\Delta+\eta_{\mathrm{list}} -+\sum_\ell\eta_\ell+\int_0^T\|E(t)\|\,dt.\tag{7} ++\sum_\ell\eta_\ell+\int_0^T\|E(t)\|\,dt.\qquad\text{(7)} ``` This bound is for unitary control imperfections. A contact perturbation bounded by $`e_j(t)`$ per edge has the conservative contribution $`\int\sum_j e_j(t)dt`$. No cancellation of such errors is assumed. Under repeated uses, the new synthesis/dynamical contributions generally accumulate, unlike the initial common-sector error. Equation (7) is a stability statement, not a fault-tolerance threshold, a Markovian-noise model, or evidence of practical control accuracy. @@ -148,7 +148,7 @@ If instead one imposes $`\sum_j\|h_{jc}(t)\|^2\le\Lambda_2^2`$ per module cut an ```math T_{\epsilon,p}^{(2)} =\Theta_\epsilon\!\left(\frac{n}{\Lambda_2\sqrt{1+sd(p)}}\right). -\tag{8} +\qquad\text{(8)} ``` Unknown helpers have $`\Theta_\epsilon(n/\Lambda_2)`$ time. The relative initialization advantage survives this quadratic-budget comparison. The constraint is on the sum of **edge** squared norms, not necessarily on the Frobenius norm of a total Hamiltonian containing local terms. @@ -160,7 +160,7 @@ Under $`\sum_j\|h_{jc}(t)\|\le\Lambda_1`$ per cut, let $`h`$ be the entire cross Sequential direct SWAPs at strength $`\Lambda_1`$, with $`2n+1`$ contacts and the free final internal permutation, give $`O(n/\Lambda_1)`$ independently of helper preparation. Therefore ```math -\boxed{T^{(1)}=\Theta_\epsilon(n/\Lambda_1)}\tag{9} +\boxed{T^{(1)}=\Theta_\epsilon(n/\Lambda_1)}\qquad\text{(9)} ``` for clean, unknown, and independent mixed helpers in the corresponding exact/fixed-error tasks. This is an optimum over permitted allocations, not merely a uniform-rescaling example. Under this budget there is no parametrically growing initialization speedup. A norm bound on the total crossing interaction itself gives the same conclusion; a bound on the full Hamiltonian would additionally conflict with the free-internal-control convention. diff --git a/docs/bandwidth.md b/docs/bandwidth.md index 91beac6..2ab360e 100644 --- a/docs/bandwidth.md +++ b/docs/bandwidth.md @@ -15,12 +15,12 @@ Let T_clean(n,s) and T_unknown(n,s) be the infimum interaction times for the res ```math \boxed{T_{\mathrm{clean}}(n,s)=\Theta\!\left(\frac{n}{J\sqrt{(n+s)(s+1)}}\right),} -\tag{1} +\qquad\text{(1)} ``` ```math \boxed{T_{\mathrm{unknown}}(n,s)=\Theta\!\left(\frac{n}{J\sqrt{n+s}}\right).} -\tag{2} +\qquad\text{(2)} ``` The constants in these comparisons do not depend on n or s. Thus the optimal times at fixed n and s differ by Theta(sqrt(s+1)). This is not a comparison that gives the clean case more physical contacts. @@ -37,7 +37,7 @@ For a physical density operator omega on a D-dimensional Hilbert space, write ```math \mathcal I(\omega)=\log_2D-S(\omega). -\tag{3} +\qquad\text{(3)} ``` This is an entropy deficit in bits. It is invariant under any unitary on the physical system. It is not the quadratic purity Tr omega^2 and is not an energy, work, or temperature. @@ -49,7 +49,7 @@ For one module-bus cut, expand the genuine two-sided part of the contacts as ```math H_{\mathrm{int}}=\sum_{\mu=x,y,z}A_\mu\otimes\sigma_C^\mu, \qquad A_\mu=\sum_{j,a}c_{ja\mu}\sigma_j^a. -\tag{4} +\qquad\text{(4)} ``` Terms acting on only one side do not contribute to the entropy derivative and are absorbed into the internal terms. Let @@ -62,7 +62,7 @@ Orthogonal projection onto the two-sided Pauli coefficients contracts the normal ```math v^2\le\sum_jJ_j^2. -\tag{5} +\qquad\text{(5)} ``` This does NOT assume that subtracting the cut-local terms contracts the operator norm. @@ -75,7 +75,7 @@ For fixed mu, the summands on distinct sites commute. With normalized trace tau \tau(e^{uA_\mu}) =\prod_j\cosh\!\left(u\sqrt{\sum_a c_{ja\mu}^2}\right) \le e^{u^2v_\mu^2/2}. -\tag{6} +\qquad\text{(6)} ``` The scalar Gaussian integral identity e^{tx^2}=E_G exp(sqrt(2t)Gx), G standard normal, implies @@ -83,7 +83,7 @@ The scalar Gaussian integral identity e^{tx^2}=E_G exp(sqrt(2t)Gx), G standard n ```math \tau(e^{tA_\mu^2})\le(1-2tv_\mu^2)^{-1/2}, \quad 0\le t\lt 1/(2v_\mu^2). -\tag{7} +\qquad\text{(7)} ``` These expressions are unchanged when A_mu is tensored with identities on the remaining physical qubits. @@ -95,7 +95,7 @@ Apply nonnegativity of relative entropy to omega and the normalized state exp(t ```math t\mathrm{Tr}(\omega A_\mu^2) \le\mathcal I(\omega)\ln2+\ln\tau(e^{tA_\mu^2}). -\tag{8} +\qquad\text{(8)} ``` No commutation between omega and A_mu is required. Choose t=1/(4v_mu^2). Equations (7)-(8) yield @@ -103,7 +103,7 @@ No commutation between omega and A_mu is required. Choose t=1/(4v_mu^2). Equatio ```math \mathrm{Tr}(\omega A_\mu^2) \le4\ln2\,[\mathcal I(\omega)+1/2]v_\mu^2. -\tag{9} +\qquad\text{(9)} ``` The v_mu=0 case is trivial. @@ -119,7 +119,7 @@ follows because the difference is the sum over ib and f=0 otherwise; output leader q'=q xor f and output spectators r'=r xor q'. The collective magnetization of the output is (-1)^q |b-2w|. Thus a reversible permutation E obeys E^dagger(sum Z_j)E=Z_q D_b. Averaging all spectator XOR translations gives the scalar mean mu_b. @@ -242,7 +242,7 @@ All conjugated diagonal interactions commute. Equal-duration intervals therefore ```math H_{\mathrm{block}}=JZ_C\sum_{i=0}^{s}\mu_{b_i}Z_{q_i}, -\tag{19} +\qquad\text{(19)} ``` with identity on every unknown spectator. @@ -263,14 +263,14 @@ F^\dagger e^{-itH_{\mathrm{block}}}F = \left(e^{-iJ\gamma_{n,s}tZ_{q_0}Z_C}|\psi\rangle\right) \otimes|0\rangle^{\otimes s}, -\tag{20} +\qquad\text{(20)} ``` where ```math \gamma_{n,s}=\sum_i\mu_{b_i}. -\tag{21} +\qquad\text{(21)} ``` The fanout creates and later removes correlations; it does not clone an unknown state. Formula (20) is a code-subspace isometry identity for clean helpers, not an identity on arbitrary helper inputs. It preserves arbitrary spectator data and arbitrary reference entanglement and works for an arbitrary bus state. @@ -287,7 +287,7 @@ Balanced block sizes obey b_i>=N/(2m). Cauchy-Schwarz supplies the upper bound. ```math \boxed{\sqrt{(n+s)(s+1)/6}\le\gamma_{n,s}\le\sqrt{(n+s)(s+1)}.} -\tag{22} +\qquad\text{(22)} ``` No optimal prefactor is claimed. The explicit block grouping need not maximize the gain at small n,s. @@ -300,7 +300,7 @@ A buffered sequence uses 2n+1 target-bus SWAPs. For j=1,...,n, swap L_j with C, ```math \boxed{T_{\mathrm{clean}}(n,s)\le\frac{3\pi(2n+1)}{4J\gamma_{n,s}}.} -\tag{23} +\qquad\text{(23)} ``` Equations (16),(22),(23) prove (1). Synchronize the block translations using the same counter, restricted to the spectator bits of each block. Uniform marginal coverage of every block suffices because the contact is additive. The [exact synchronized schedule](accuracy-and-resources.md#3-short-exact-synchronized-block-schedules) uses @@ -324,7 +324,7 @@ Only the payload must cross the cut, generating 2n bits. Equation (11) yields ```math T_{\mathrm{unknown}}(n,s)\ge\frac{\ln2}{2J}\frac{n}{\sqrt{n+s}}. -\tag{24} +\qquad\text{(24)} ``` For the upper bound, use all N=n+s qubits in the occupied-data block amplifier. Its spectators, including the unknown helpers, are returned after each target-bus operation. Exchange only the n payload labels in the same buffered sequence: @@ -332,7 +332,7 @@ For the upper bound, use all N=n+s qubits in the occupied-data block amplifier. ```math T_{\mathrm{unknown}}(n,s) \le\frac{3\pi(2n+1)}{4J\mu_{n+s}}. -\tag{25} +\qquad\text{(25)} ``` Since sqrt((n+s)/3)<=mu_(n+s)<=sqrt(n+s), (24)-(25) prove (2). Both cases have identical numbers and strengths of bus contacts, identical payloads, free internal controls, and helper return. The only altered promise is the initial helper state. diff --git a/docs/control-models.md b/docs/control-models.md index c492451..4a3166c 100644 --- a/docs/control-models.md +++ b/docs/control-models.md @@ -11,7 +11,7 @@ An exact exchange uses $`2n+1`$ bus SWAPs: for each $`j`$, swap $`L_j`$ with $`C The norm-$`J`$ Hamiltonian $`J\mathrm{SWAP}`$ implements a bus SWAP in $`\pi/(2J)`$ up to global phase. The final internal permutation costs at most $`2\delta`$, so a feasible sequential comparator is ```math -T_{\mathrm{seq}}=\frac{(2n+1)\pi}{2J}+\frac\pi G\qquad(n\gt 1).\tag{1} +T_{\mathrm{seq}}=\frac{(2n+1)\pi}{2J}+\frac\pi G\qquad(n\gt 1).\qquad\text{(1)} ``` The final permutation is unnecessary at $`n=1`$. Comparing only with an unamplified three-Ising SWAP would give the amplified compiler an artificially weak comparator. @@ -57,7 +57,7 @@ For m=3^k data qubits assisting a designated target, the gain is a_k=(3/2)^k. Le ```math D_0=0,\qquad D_k=4D_{k-1}+24, \qquad D_k=8(4^k-1). -\tag{2} +\qquad\text{(2)} ``` There are 4^k raw contact intervals. The total number of elementary local gates (not depth) is @@ -71,14 +71,14 @@ For a target-bus SWAP, three Ising operations and four layers of single-qubit ba ```math t_k=\frac{3\pi}{4J(3/2)^k}+ \bigl[24\,4^k-20\bigr]\frac\pi{2G},\qquad k\ge1. -\tag{3} +\qquad\text{(3)} ``` With m<=n, a suitable set of m data qubits can assist each target in turn; they are restored after each completed operation. All within-register pair connectivity has been granted, so no extra movement to arrange triples is silently required. The full route takes ```math \boxed{T_k=(2n+1)t_k+\pi/G\quad(n\gt 1).} -\tag{4} +\qquad\text{(4)} ``` The sequential option (1) is always included in optimization. The construction still preserves all unknown data, cross-register correlations, and an arbitrary bus state. Controls are fixed in advance, not selected from unknown input amplitudes. @@ -89,7 +89,7 @@ Set R=G/J. Relative to the direct norm-J target-bus SWAP, Equation (3) becomes ```math \boxed{s_k(R)=(3/2)^{1-k}+\frac{24\,4^k-20}{R}.} -\tag{5} +\qquad\text{(5)} ``` The k=1 primitive has s_1=1+76/R. It never beats the stronger direct-SWAP comparator under this compiler, even though its Ising coupling gain is 3/2. @@ -154,7 +154,7 @@ Every summand lies in [0,n] and has mean mu_n. Hoeffding's inequality followed b ```math \Pr\left(\|\bar D_K-\mu_nI\|\gt a\right) \le2\,2^{n-1}\exp(-2Ka^2/n^2). -\tag{6} +\qquad\text{(6)} ``` All interval Hamiltonians commute exactly. An intended Ising angle theta=pi/4 therefore has full operator error at most theta a/mu_n. The entire route uses M=3(2n+1) such gates. Reusing a good list under target relabelings and basis conjugations, telescoping the product of unitaries bounds the final operator error by M theta a/mu_n, uniformly over all data and bus states. @@ -164,7 +164,7 @@ To obtain operator error at most eta with offline-list failure probability at mo ```math K\ge \frac{n^2M^2\theta^2}{2\eta^2\mu_n^2} \left[(n-1)\ln2+\ln(2/p)\right]. -\tag{7} +\qquad\text{(7)} ``` For fixed p and eta, K=O(n^4/eta^2) per Ising gate and the total contact count is O(n^5/eta^2). The charged contact duration is unchanged. A full-unitary operator error eta implies channel diamond distance at most 2 eta. diff --git a/docs/entropy-flow.md b/docs/entropy-flow.md index fff9f15..ae8cfbe 100644 --- a/docs/entropy-flow.md +++ b/docs/entropy-flow.md @@ -23,7 +23,7 @@ Using [DF19](related-work.md#df19), Corollary III.5, yields \boxed{|\dot S_A|\le 2\log_2(2d_B^2+1)\,\Delta_\rho h \le 2\log_2(2d_B^2+1)\sqrt{\mathrm{Tr}\rho h^2}.} -\tag{1} +\qquad\text{(1)} ``` For a bus qubit, the coefficient is c_DF=2 log_2 9. This combines the cited conditional-variance inequality with a state-weighted commutator estimate. @@ -61,7 +61,7 @@ Centering can only decrease this second moment. Therefore for a bus qubit, ```math \boxed{|\dot S_A|\le c_0\sqrt{\mathrm{Tr}\rho h^2}, \qquad c_0=\frac{2\sqrt2}{\ln2}.} -\tag{2} +\qquad\text{(2)} ``` This is a sharper qubit coefficient than (1), but does not change the exponent. The d_B dependence of this elementary bound is worse for large d_B than the published logarithmic estimate, so it is not an improved general-dimensional SIE theorem. @@ -89,7 +89,7 @@ Terms acting on only one side are absorbed into internal controls. If the origin ```math \|H_{Lc}^{\rm int}(t)\|_F^2 \le\sum_{j\in L}J_{jc}(t)^2. -\tag{3} +\qquad\text{(3)} ``` This step does NOT claim that removal of local terms contracts the operator norm. @@ -110,7 +110,7 @@ Every input is acted on by the SAME input-independent controlled unitary. Its en &\le c_0\sum_{c\in C}\|H_{Lc}^{\rm int}(t)\|_F\\ &\le c_0\sum_{c\in C}\sqrt{\sum_{j\in L}J_{jc}(t)^2}. \end{aligned} -\tag{4} +\qquad\text{(4)} ``` The same theorem follows using published bound (1) with c_0 replaced by c_DF. Integrating proves @@ -119,7 +119,7 @@ The same theorem follows using published bound (1) with c_0 replaced by c_DF. In \boxed{\mathbb E_\psi|S_L(\psi_T)-S_L(\psi_0)| \le c_0\int_0^T\sum_{c\in C} \sqrt{\sum_{j\in L}J_{jc}(t)^2}\,dt.} -\tag{5} +\qquad\text{(5)} ``` For uniform contacts, this is at most c_0 J |C| sqrt(|L|) T. There is no additive constant, factor n^delta, minimum segment length, or derivative condition. Compare the restricted-time-dependence average-input bound of [D26](related-work.md#d26). diff --git a/docs/mixed-helpers.md b/docs/mixed-helpers.md index fea1fb4..4688c9f 100644 --- a/docs/mixed-helpers.md +++ b/docs/mixed-helpers.md @@ -26,7 +26,7 @@ Let $`\Phi_U`$ insert these fixed purifications and apply the physical protocol ```math \frac12\|\Phi_U-\Phi_{\ast}\|_\diamond\le\epsilon. -\tag{1} +\qquad\text{(1)} ``` The supremum includes all payload/bus inputs and all their reference extensions. The helper purifications are fixed input resources, not additional freely chosen input qubits or controllable workspace. Different purifications of the same helper states give the same guarantee by an isometry on the inaccessible reference. @@ -40,7 +40,7 @@ T_{\epsilon,p}(n,s) \frac{n}{J\sqrt{(n+s)\{1+s[1-h_2(p)]\}}} \right). } -\tag{2} +\qquad\text{(2)} ``` The constants may depend on $`\epsilon`$, but not on $`n,s,p`$. The statement is uniform even when $`p`$ varies with system size. In particular, it includes $`p=0`$, $`p=1/2`$, and arbitrarily weak polarization. It applies to all $`s\ge0`$, not only $`s\le n`$. @@ -55,7 +55,7 @@ Purify the helpers locally as above. Put every payload qubit in a Bell pair with ```math \mathcal I(\omega)=\log_2D-S(\omega)=1+2s\,d(p). -\tag{3} +\qquad\text{(3)} ``` This entropy deficit is conserved by every admissible physical unitary, even while the helpers become correlated or locally more polarized. The [entropy-deficit cut bound](bandwidth.md#32-entropy-deficit-cut-rate) therefore gives @@ -63,7 +63,7 @@ This entropy deficit is conserved by every admissible physical unitary, even whi ```math |\dot S_A| \le 4\sqrt{6/\ln2}\,J\sqrt{N\{3/2+2s\,d(p)\}}, -\tag{4} +\qquad\text{(4)} ``` where $`A`$ includes the entire physical left module, its payload references, and its helper-preparation references. Initially $`S_A=0`$. The underlying conditional entropy-rate estimate may equivalently use the published conditional-variance bound [DF19](related-work.md#df19), changing only a universal constant. @@ -86,7 +86,7 @@ Consequently ```math S_A(T)\ge2n-4n\epsilon-\tfrac32h_2(\epsilon). -\tag{5} +\qquad\text{(5)} ``` For $`0\lt \epsilon\le0.1`$ the right-hand side is at least $`b_\epsilon n`$, where @@ -101,7 +101,7 @@ Equations (4)-(5), using $`3/2+2sd(p)\le2[1+sd(p)]`$, imply the explicit lower b T_{\epsilon,p}\ge \frac{b_\epsilon}{4\sqrt{12/\ln2}} \frac{n}{J\sqrt{N[1+sd(p)]}}. -\tag{6} +\qquad\text{(6)} ``` This converse actually needs only the corresponding accuracy of the payload channel on its Bell-reference test, not helper return. The matching construction meets the stronger preparation-inclusive condition (1). The use of $`a,b`$ rather than the full helper-bearing cut removes the restriction $`s\le n`$ in the earlier direct entropy-continuity estimate. Singular states and instantaneous internal pulses are handled as in [Entropy flow](entropy-flow.md#3-supports-and-admissible-controls). @@ -114,7 +114,7 @@ Let $`\lambda_1\ge\cdots\ge\lambda_{2^s}`$ be the helper eigenvalues. A unitary ```math \sum_{i=1}^{2^{s-r}}\lambda_i\ge1-\delta. -\tag{7} +\qquad\text{(7)} ``` Necessity is the variational characterization of the sum of the largest eigenvalues; sufficiency maps their eigenvectors into the zero-prefix subspace. For the product state above, decreasing eigenvalue order is increasing Hamming weight. A fixed permutation of the $`s`$ helper bits' full computational-basis labels implements this mapping. It uses no measured label, extra Hilbert-space dimension, or reset. @@ -129,7 +129,7 @@ Write $`\beta=1-2p`$ and $`x=s\beta^2`$. The binary entropy series gives ```math \frac{\beta^2}{2\ln2}\le d(p)\le\beta^2. -\tag{8} +\qquad\text{(8)} ``` Consider the helper labels with Hamming weight at most $`s(1/2-\beta/4)`$. Hoeffding's inequality applied first to the actual Bernoulli distribution and then to the uniform counting distribution gives @@ -138,7 +138,7 @@ Consider the helper labels with Hamming weight at most $`s(1/2-\beta/4)`$. Hoeff \Pr_p(\text{outside})\le e^{-x/8}, \qquad |\text{inside}|\le2^s e^{-x/8}. -\tag{9} +\qquad\text{(9)} ``` The noninteger threshold is interpreted by its floor; the bounds remain valid. If $`x\ge8\ln(1/\delta)`$, choose @@ -155,7 +155,7 @@ For $`0\lt \delta\le1/4`$, these choices satisfy the simple conservative bound r+1\ge c_\delta[1+sd(p)], \qquad c_\delta=\frac1{2+8\ln(1/\delta)+8\ln2}. -\tag{10} +\qquad\text{(10)} ``` For small $`x`$, (8) and the fallback prove (10). For large $`x`$, use $`r+1\gt x/(8\ln2)`$ and $`sd(p)\le x`$. Thus no fixed-$`p`$ asymptotic assumption or unproved substitution of entropy for a helper count is needed. For finite examples, criterion (7) is much sharper than (9). @@ -170,14 +170,14 @@ The [balanced-block construction](bandwidth.md#5-matching-exact-construction-wit \gamma_{N,r}=\sum_{i=0}^r\mu_{b_i}, \qquad \sqrt{N(r+1)/6}\le\gamma_{N,r}\le\sqrt{N(r+1)}. -\tag{11} +\qquad\text{(11)} ``` Exchange only the $`n`$ payloads with the buffered $`2n+1`$-SWAP schedule. On the subspace where both modules' prefix bits are zero, the complete operation is exactly the payload exchange tensored with identity on every helper and the bus, up to a common global phase. It costs ```math T\le\frac{3\pi(2n+1)}{4J\gamma_{N,r}}. -\tag{12} +\qquad\text{(12)} ``` Compression and decompression are each applied once around the whole route. Their duration is free only because internal operations are free in this model. The interaction sequence is finite, but can be exponentially long. This does not supply a new efficient bounded-strength compiler. @@ -196,14 +196,14 @@ The actual and ideal full unitaries agree on every payload/bus input tensored wi \|(U-U_{\ast})|\Psi\rangle\| \le2\|(I-P_G)|\Psi\rangle\| =2\sqrt\Delta. -\tag{13} +\qquad\text{(13)} ``` The pure-output trace distance is no larger than this vector norm, and mixed payload inputs follow by purification. Equivalently the fixed-preparation isometries differ in operator norm by at most $`2\sqrt\Delta`$, which bounds their half diamond distance. Set ```math \delta=\epsilon^2/8. -\tag{14} +\qquad\text{(14)} ``` Then (13) proves (1), including the inaccessible helper references. There is no multiplication of $`\delta`$ by $`n`$ or by the number of elementary gates. The failure is one fixed low-weight input sector, not a fresh preparation failure sampled at every gate. @@ -217,7 +217,7 @@ After exact spectator averaging, conjugating by the fanout gives, for a target-b ```math JZ_qZ_C\left(\mu_{b_0}+\sum_{i=1}^r\mu_{b_i}Z_{h_i}\right) \otimes I_{\rm spectators}. -\tag{15} +\qquad\text{(15)} ``` This is diagonal in every helper bit even outside the good subspace. The target/bus basis rotations do not act on those bits. The full route followed by decompression therefore has the form @@ -243,7 +243,7 @@ Thus for the exact version of (1), a full-rank preparation requires the same ope T_{0,p}(n,s)=\Theta\!\left(\frac{n}{J\sqrt{n+s}}\right), \qquad 0\lt p\le1/2. } -\tag{16} +\qquad\text{(16)} ``` This exact/full-rank obstruction is already explicitly noted in the Outlook of [UHMG26](related-work.md#uhmg26), which identifies approximate transfer with thermal ancillas as a further direction. Equation (2) supplies a matched answer for this modular routing problem, not a claim to have first noticed the obstruction. diff --git a/docs/verification.md b/docs/verification.md index e512729..1291e6d 100644 --- a/docs/verification.md +++ b/docs/verification.md @@ -42,13 +42,13 @@ The ensemble suite includes a selected collective state that violates an incorre ## Maintenance -`check_repository.py` checks syntax, local links and citation anchors, math delimiters, bibliography keys, the contact paragraph, the original license, the 30-milestone map, exact suite coverage, and all check-source hashes. The release checker additionally checks table-cell consistency across every reading page, duplicate equation tags in dollar displays and math fences, explicit success flags, and the digest of the tracked finite-size certificate file against its executed-output record. Eight regression tests exercise valid input and deliberately malformed material; these are structural tests, not extra scientific suites. CI runs these checks and the ten numerical suites. Update tracked scientific results only from a successful associated run after changing scientific check sources. Keep generated cases in the ignored build directory or export them as a verification bundle. +`check_repository.py` checks syntax, local links and citation anchors, math delimiters, bibliography keys, the contact paragraph, the original license, the 30-milestone map, exact suite coverage, and all check-source hashes. The release checker additionally checks table-cell consistency across every reading page, duplicate equation labels in dollar displays and math fences, unsafe legacy numbering syntax, explicit success flags, and the digest of the tracked finite-size certificate file against its executed-output record. Twelve regression tests exercise valid input and deliberately malformed material, including a ready-but-invalid native MathML layout; these are structural tests, not extra scientific suites. CI runs these checks and the ten numerical suites. Update tracked scientific results only from a successful associated run after changing scientific check sources. Keep generated cases in the ignored build directory or export them as a verification bundle. -Use protected GitHub mathematical syntax for formulas that contain Markdown-sensitive characters. Fenced math blocks preserve backslashes in norm and spacing commands; backtick-protected inline math preserves starred subscripts and punctuation boundaries. Prefer supported upright commands and explicitly braced starred indices. The [official syntax reference](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions) and the hosted check are complementary to local source validation. +Use protected GitHub mathematical syntax for formulas that contain Markdown-sensitive characters. Fenced math blocks preserve backslashes in norm and spacing commands; backtick-protected inline math preserves starred subscripts and punctuation boundaries. Prefer supported upright commands and explicitly braced starred indices. Preserve equation numbers with ordinary `\qquad\text{(n)}` content rather than `\tag{n}`. The latter can emit legacy `mlabeledtr` rows that stack tokens in native browser MathML even when parsing succeeds; the source checker rejects that numbering syntax in mathematical blocks. The [official syntax reference](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions) and the hosted check are complementary to local source validation. ## Hosted rendering -The separate `Inspect hosted mathematics` workflow opens thirteen actual public GitHub pages at an immutable commit in Chromium. It checks entrypoint, learning, and scientific pages at desktop and mobile widths, verifies the expected mathematics has rendered, detects GitHub and MathJax error messages and unprocessed delimiters, checks table structure, and records page-level overflow. Screenshots and a JSON report are retained as workflow artifacts for 14 days. It needs network access and a separate Playwright installation; it is not a dependency of the offline scientific verifier. +The separate `Inspect hosted mathematics` workflow opens thirteen actual public GitHub pages at an immutable commit in Chromium. It checks entrypoint, learning, and scientific pages at desktop and mobile widths, verifies the expected mathematics has rendered, detects GitHub and MathJax error messages and unprocessed delimiters, checks table structure, rejects unsupported native MathML table rows, and records equation geometry and page-level overflow. Screenshots, the exact inspected public sources with SHA-256 hashes, and a JSON report are retained as workflow artifacts for 14 days. It needs network access and a separate Playwright installation; it is not a dependency of the offline scientific verifier. To invoke the same check in a network-enabled environment: diff --git a/tools/check_release.py b/tools/check_release.py index 6095c36..1c83206 100644 --- a/tools/check_release.py +++ b/tools/check_release.py @@ -6,17 +6,23 @@ import re +def equation_labels(line: str, label: str, index: int) -> list[str]: + """Use inline number text, not legacy MathML table rows, for equation labels.""" + if re.search(r'\\tag\*?\s*\{', line): + raise AssertionError(f'{label}:{index}: legacy equation tag is unsafe in native MathML') + return re.findall(r'\\qquad\s*\\text\{\(([^(){}]+)\)\}', line) + + def check_reading_text(text: str, label: str) -> int: """Check Markdown structures that can silently change mathematical meaning.""" - fenced = re.compile(r'^([`~]{3,}).*$', re.M) - lines = text.splitlines() + fenced = re.compile(r'^([`~]{3,}).*$') in_fence = None math_fence = False display = False table_width = None tables = 0 tags = [] - for index, line in enumerate(lines, 1): + for index, line in enumerate(text.splitlines(), 1): stripped = line.strip() match = fenced.fullmatch(stripped) if match: @@ -31,18 +37,16 @@ def check_reading_text(text: str, label: str) -> int: continue if in_fence: if math_fence: - tags.extend(re.findall(r'\\tag\{([^}]+)\}', line)) + tags.extend(equation_labels(line, label, index)) continue if stripped == '$$': display = not display table_width = None continue if display: - tags.extend(re.findall(r'\\tag\{([^}]+)\}', line)) + tags.extend(equation_labels(line, label, index)) continue if stripped.startswith('|'): - # Unescaped vertical bars are GFM cell separators, including inside - # TeX. Use \lvert/\rvert in a cell rather than bare ket delimiters. width = len(re.findall(r'(? int: if display: raise AssertionError(f'{label}: unclosed display mathematics') if len(tags) != len(set(tags)): - raise AssertionError(f'{label}: repeated equation tag on one page') + raise AssertionError(f'{label}: repeated equation label on one page') return tables diff --git a/tools/test_release_checks.py b/tools/test_release_checks.py index 045ef05..159bcf0 100644 --- a/tools/test_release_checks.py +++ b/tools/test_release_checks.py @@ -1,4 +1,4 @@ -"""Regression tests for the release checker; these are not scientific suites.""" +"""Regression tests for release validation, distinct from scientific suites.""" from __future__ import annotations import hashlib import json @@ -6,24 +6,25 @@ import tempfile import unittest from check_release import check_reading_text, check_release +from inspect_hosted_render import snapshot_problems class ReadingChecks(unittest.TestCase): def test_valid_math_and_table(self): - text = '| A | B |\n|---|---|\n| $\\lvert x\\rangle$ | $\\lVert X\\rVert$ |\n\n$$\n|x|\\tag{1}\n$$\n' + text = '| A | B |\n|---|---|\n| $\\lvert x\\rangle$ | $\\lVert X\\rVert$ |\n\n$$\n|x|\\qquad\\text{(1)}\n$$\n' self.assertEqual(check_reading_text(text, 'fixture'), 1) def test_unescaped_ket_in_table(self): with self.assertRaisesRegex(AssertionError, 'table cells'): check_reading_text('| A | B |\n|---|---|\n| $|x\\rangle$ | yes |\n', 'fixture') - def test_duplicate_tag(self): + def test_duplicate_label(self): with self.assertRaisesRegex(AssertionError, 'repeated equation'): - check_reading_text('$$\nx\\tag{1}\n$$\n\n$$\ny\\tag{1}\n$$\n', 'fixture') + check_reading_text('$$\nx\\qquad\\text{(1)}\n$$\n\n$$\ny\\qquad\\text{(1)}\n$$\n', 'fixture') - def test_tags_in_math_fences(self): + def test_labels_in_math_fences(self): with self.assertRaisesRegex(AssertionError, 'repeated equation'): - check_reading_text('```math\nx\\tag{1}\n```\n\n```math\ny\\tag{1}\n```\n', 'fixture') + check_reading_text('```math\nx\\qquad\\text{(1)}\n```\n\n```math\ny\\qquad\\text{(1)}\n```\n', 'fixture') def test_fenced_examples_are_not_tables(self): self.assertEqual(check_reading_text('```text\n| a |\n| a | b |\n$$\n```\n', 'fixture'), 0) @@ -43,7 +44,7 @@ def test_result_integrity_and_explicit_success(self): for name in ('README.md', 'AGENTS.md', 'llms.txt'): (root/name).write_text('# Fixture\n') content = b'{"all_passed": true}\n' - path = root/'results/scientific-closure.json';path.write_bytes(content) + path = root/'results/scientific-closure.json'; path.write_bytes(content) result = {'all_passed': True, 'suites': [{'script': 'verify_scientific_closure.py', 'output_sha256': hashlib.sha256(content).hexdigest(), 'summary': {'all_passed': True}}]} summary = root/'results/verification.json'; summary.write_text(json.dumps(result)) @@ -57,6 +58,27 @@ def test_result_integrity_and_explicit_success(self): with self.assertRaisesRegex(AssertionError, 'explicit success flag'): check_release(root) + def test_legacy_tag_in_math_fence(self): + with self.assertRaisesRegex(AssertionError, 'legacy equation tag'): + check_reading_text('```math\nx=y\\tag{1}\n```\n', 'fixture') + + def test_legacy_tag_in_dollar_display(self): + with self.assertRaisesRegex(AssertionError, 'legacy equation tag'): + check_reading_text('$$\nx=y\\tag{1}\n$$\n', 'fixture') + + def test_ready_math_with_unsupported_layout_is_not_a_pass(self): + state = {'heading': 'Fixture', 'markers': 1, 'ready': 1, + 'page_width': 1180, 'errors': [], 'marker_errors': 0, + 'native_layout_errors': [{'element': 'mlabeledtr'}]} + self.assertEqual(snapshot_problems(state, 1, 'Fixture', 1180), + ['1180px: unsupported native MathML equation layout']) + + def test_valid_hosted_snapshot(self): + state = {'heading': 'Fixture', 'markers': 1, 'ready': 1, + 'page_width': 390, 'errors': [], 'marker_errors': 0, + 'native_layout_errors': [], 'table_columns': [[2, 2]]} + self.assertEqual(snapshot_problems(state, 1, 'Fixture', 390), []) + if __name__ == '__main__': unittest.main()