Skip to content

QEC: magic-state-consuming logical T and CCZ operations (#283) - #288

Merged
arniber21 merged 1 commit into
mainfrom
issue-283-magic-state-t-ccz
Jul 17, 2026
Merged

QEC: magic-state-consuming logical T and CCZ operations (#283)#288
arniber21 merged 1 commit into
mainfrom
issue-283-magic-state-t-ccz

Conversation

@arniber21

Copy link
Copy Markdown
Owner

Fixes #283.

What

Adds scoped logical non-Clifford operations (T, T†, CCZ) as compiler-visible operations with explicit resource accounting and QEC experiment metadata.

Changes

  • quon_qec/src/workload.rs: WorkloadOp::LogicalT, LogicalTdag, LogicalCcz + builder methods with validation
  • quon_qec/src/expand.rs: RoundKind::MagicT, MagicTdag, MagicCcz + expand arms + count helpers
  • quon_qec/src/experiment.rs: ExperimentRoundKind variants + Stim emit (comment-only)
  • quon_na/src/report.rs: Resource report fields t_count, tdag_count, ccz_count, magic_state_demand
  • quon_na/src/qec_schedule.rs: Populate magic-state fields from expanded workload
  • 9 unit tests + 3 expansion tests
  • Example programs: surface_d3_t.qn, surface_d3_ccz.qn
  • Docs: docs/neutral_atom/magic_state_operations.md

Acceptance criteria

  • Source-level operations exist for logical T/Tdag
  • Source-level operations exist for logical CCZ
  • Type checking enforces surface family, distances, arity, distinct ids
  • Lowering records magic-state consumption in QEC workload
  • Resource reports include T count, Tdag count, CCZ count, magic-state demand
  • QEC experiment JSON exposes non-Clifford operations
  • Unsupported families fail with actionable diagnostics
  • T and CCZ examples compile through NA target
  • Documentation states this is a compiler model, not a distillation factory

This is a compiler model of magic-state consumption, not a validated distillation factory or threshold claim.

Add scoped logical non-Clifford path for QEC-backed programs by modeling
magic-state-consuming T/Tdag/CCZ operations as compiler-visible operations
with explicit resource accounting and QEC experiment metadata.

- Add WorkloadOp::LogicalT, LogicalTdag, LogicalCcz to workload IR
- Add WorkloadBuilder methods with validation (surface-only, distinct ids,
  equal distances for CCZ)
- Add WorkloadError variants for non-Clifford failures
- Add RoundKind::MagicT, MagicTdag, MagicCcz to expand IR
- Add ExpandedWorkload helpers: t_count, tdag_count, ccz_count,
  magic_state_demand
- Add resource report fields: t_count, tdag_count, ccz_count,
  magic_state_demand
- Add ExperimentRoundKind variants + Stim emit (comment-only)
- Add expand arms for all three ops (compiler model, no physical gates)
- 9 unit tests + 3 expansion tests
- Add example .qn programs (surface_d3_t, surface_d3_ccz)
- Add docs/neutral_atom/magic_state_operations.md

This is a compiler model of magic-state consumption, not a validated
distillation factory or threshold claim.
@arniber21 arniber21 added the ready-for-human Requires human implementation label Jul 16, 2026
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quon Ready Ready Preview, Comment Jul 16, 2026 9:19am

@arniber21
arniber21 merged commit fc0ff6c into main Jul 17, 2026
15 of 18 checks passed
arniber21 added a commit that referenced this pull request Jul 24, 2026
Bind logical_t / logical_tdag / logical_ccz as frontend QEC builtins
mirroring logical_cx, completing the #283 QEC workload layer that landed
in #283/#288 without frontend wiring.

- prelude_names / builtins: register the three names + surface-only schemes.
- typecheck: let-bound rejection list, dispatch arms, synth_logical_t /
  synth_logical_tdag (shared surface-only check) and synth_logical_ccz
  (three surface blocks at equal distance), plus scan_qec_usage. New
  TypeError variants NonCliffordRequiresSurface / NonCliffordDistanceMismatch
  with diagnostic codes + Display, encoding the same constraints as
  quon_qec's WorkloadBuilder validators so lowering never hits a
  workload-layer rejection.
- lower: lowering arms building quantum.dynamic.qec_logical_t / _tdag /
  _ccz, threading logical ids through the result SSA map.
- mlir_bridge qec_dynamic: op names, attrs (a_id/b_id/c_id), verify +
  builders for the three ops; qec_collect: collection arms calling the
  workload builders.
- examples surface_d3_t.qn / surface_d3_ccz.qn now compile end-to-end
  through quonc; resource reports carry t_count / ccz_count respectively.
- tests: frontend typecheck tests (valid + family/distance rejection)
  mirroring qec_logical_cx_*, and qec_collect tests for the new ops.
- incidental: drop pre-existing dead imports in mlir_bridge pipeline.rs /
  zx_simplification.rs that blocked the -D warnings clippy gate.

No unwrap/expect/anyhow in production src; thiserror+Result throughout.
arniber21 added a commit that referenced this pull request Jul 24, 2026
Bind logical_t / logical_tdag / logical_ccz as frontend QEC builtins
mirroring logical_cx, completing the #283 QEC workload layer that landed
in #283/#288 without frontend wiring.

- prelude_names / builtins: register the three names + surface-only schemes.
- typecheck: let-bound rejection list, dispatch arms, synth_logical_t /
  synth_logical_tdag (shared surface-only check) and synth_logical_ccz
  (three surface blocks at equal distance), plus scan_qec_usage. New
  TypeError variants NonCliffordRequiresSurface / NonCliffordDistanceMismatch
  with diagnostic codes + Display, encoding the same constraints as
  quon_qec's WorkloadBuilder validators so lowering never hits a
  workload-layer rejection.
- lower: lowering arms building quantum.dynamic.qec_logical_t / _tdag /
  _ccz, threading logical ids through the result SSA map.
- mlir_bridge qec_dynamic: op names, attrs (a_id/b_id/c_id), verify +
  builders for the three ops; qec_collect: collection arms calling the
  workload builders.
- examples surface_d3_t.qn / surface_d3_ccz.qn now compile end-to-end
  through quonc; resource reports carry t_count / ccz_count respectively.
- tests: frontend typecheck tests (valid + family/distance rejection)
  mirroring qec_logical_cx_*, and qec_collect tests for the new ops.
- incidental: drop pre-existing dead imports in mlir_bridge pipeline.rs /
  zx_simplification.rs that blocked the -D warnings clippy gate.

No unwrap/expect/anyhow in production src; thiserror+Result throughout.
@arniber21
arniber21 deleted the issue-283-magic-state-t-ccz branch August 5, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Requires human implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QEC: implement magic-state-consuming logical T and CCZ operations

1 participant