Skip to content

Playground: give eq its own files and examples - #64

Closed
ondrik wants to merge 5 commits into
fmlab-iis:mainfrom
ondrik:playground-eq-upstream
Closed

ondrik wants to merge 5 commits into
fmlab-iis:mainfrom
ondrik:playground-eq-upstream

Conversation

@ondrik

@ondrik ondrik commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Depends on #61 (the playground), which depends on #58 (the landing page). GitHub can't base a pull request on a branch in a fork, so this one also shows their commits. Once #58 and #61 are merged, only the last commit, Playground: give eq its own files and examples, remains. If you'd rather review it as part of #61, I can add the commit there and close this PR.

In the playground, switching the command to eq used to keep pre.hsl, circuit.qasm and post.hsl and add a.qasm and b.qasm next to them, and the example list mixed everything together. Now:

  • eq mode shows only a.qasm and b.qasm. ver and ex share one set of files (pre.hsl, circuit.qasm, post.hsl, plus any extras such as loop-invariant.hsl); eq has its own. Each set keeps your edits when you switch between commands.

  • The Example list shows only examples for the current command. Choosing an example keeps the command within its group, so ex stays ex. Opening ?example=<id> still switches to that example's command.

  • New equivalence examples, all checked with the native build and the WebAssembly build:

    Example Result
    CX = H·CZ·H (existing) [equal]
    SWAP = three CX gates [equal]
    Toffoli vs. its Clifford+T decomposition (7 T, 6 CX) [equal]
    The same decomposition with one T replaced by T† [unequal]
    XZ vs. ZX [equal]: they differ only by a global phase
  • [equal] and [unequal] are highlighted like [OK] and [failed].

  • The Notes say what eq checks: equality up to a global phase. I confirmed that relative phases are caught: CZ vs. identity and Z vs. identity are both [unequal].

Testing

  • node wasm/compare.mjs: all 11 examples give the same output natively and in WebAssembly.
  • Headless Chrome:
    • switching ver → eq → ex → eq gives the right tabs, examples and --loopsum visibility, and an edit to pre.hsl survives the round trip;
    • picking an example in ex mode stays in ex;
    • Reset in eq reloads the current eq example;
    • ?example=eq-toffoli-bug opens in eq mode;
    • no console errors.

This is the same change as ondrik#4, which is already live on the fork's GitHub Pages site.

🤖 Generated with Claude Code

https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY

ondrik and others added 5 commits October 18, 2026 23:19
A static landing page in site/ (no build step, self-hosted fonts) and a
workflow that deploys it to GitHub Pages on pushes to main that touch
site/** or the workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
wasm/build.sh compiles the unchanged AutoQ CLI to WebAssembly with
Emscripten, together with Z3 4.12.5 and the ANTLR 4.13.2 C++ runtime
(built once and cached). site/playground runs it in a Web Worker: it
writes the input files into the in-memory file system and calls main()
with the CLI arguments, so results match the native tool.

- CMake: an Emscripten-only branch (header-only Boost, prebuilt Z3 and
  ANTLR, ES-module link options). The native build is unchanged.
- cli/autoq.cc: skip feenableexcept() under Emscripten (no FP traps).
- src/util/memory.cpp: report the WebAssembly heap size under
  Emscripten; its getrusage() does not set ru_maxrss.
- pages.yml: build the playground in CI with a cached dependency build.
- wasm/compare.mjs checks every playground example against the native
  CLI; wasm/README.md documents the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
The hero and the nav already link to it; this adds a sentence at the start of Get started for readers who want to try AutoQ before installing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
In eq mode the editor now shows only a.qasm and b.qasm, and the example
list offers equivalence examples: CX = H·CZ·H, SWAP as three CX gates,
Toffoli against its Clifford+T decomposition, the same decomposition
with one T replaced by T† (unequal), and XZ vs ZX (equal up to global
phase). ver and ex keep sharing one workspace; each workspace keeps its
edits when switching commands. [equal]/[unequal] are highlighted like
[OK]/[failed].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
@ondrik

ondrik commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #61 instead (commit 159071f).

@ondrik ondrik closed this Oct 20, 2026
@ondrik
ondrik deleted the playground-eq-upstream branch October 20, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant