Skip to content

QEC: wire logical_t/logical_tdag/logical_ccz into frontend typechecker (source syntax for #283) #311

Description

@arniber21

What's wrong

Issue #283 / PR #288 ("QEC: magic-state-consuming logical T and CCZ operations") landed the QEC workload IR layer for logical T/T†/CCZ:

  • quon_qec/src/workload.rs: WorkloadBuilder::logical_t / logical_tdag / logical_ccz with validation
  • quon_qec/src/expand.rs: RoundKind::MagicT / MagicTdag / MagicCcz expansion + counters
  • quon_qec/src/experiment.rs: ExperimentRoundKind variants + Stim comment emission
  • quon_na/src/report.rs + quon_na/src/qec_schedule.rs: t_count / tdag_count / ccz_count / magic_state_demand resource-report fields

But the PR did not touch frontend/src/ at all. logical_t, logical_tdag, and logical_ccz are not registered in:

  • frontend/src/analysis/prelude_names.rs (quantum_builtins() — has logical_cx but not the new ops)
  • frontend/src/typecheck/builtins.rs / frontend/src/typecheck/mod.rs
  • frontend/src/lower.rs

As a result, the example programs added by that same PR do not compile:

$ cargo run -p quonc --release -- examples/na_qec/surface_d3_t.qn --target targets/neutral_atom/generic_rna_v0.json --emit-resource-report -
Error: type checking failed: unbound variable `logical_t`

$ cargo run -p quonc --release -- examples/na_qec/surface_d3_ccz.qn --target targets/neutral_atom/generic_rna_v0.json --emit-resource-report -
Error: type checking failed: unbound variable `logical_ccz`

This contradicts issue #283's acceptance criteria, which were checked off in the PR description:

  • "Source-level syntax, intrinsic calls, or standard-library functions exist for logical T/Tdag." (unmet — no frontend binding)
  • "At least one T example and one CCZ example compile through the neutral-atom target and emit schedule, QEC experiment, and resource artifacts." (unmet — both examples fail to compile)

What to build

Wire logical_t, logical_tdag, logical_ccz into the frontend the same way logical_cx is wired (prelude registration, type synthesis in typecheck/mod.rs, lowering in lower.rs) so that examples/na_qec/surface_d3_t.qn and examples/na_qec/surface_d3_ccz.qn actually compile through quonc end-to-end, matching #283's original acceptance criteria.

Found while

Verifying doc claims for a docs PR (na-ft-demo.mdx / benchmark_suite.md) — the docs are being written to accurately state that non-Clifford ops exist at the QEC-workload/resource-report layer but are not yet reachable from .qn source via quonc.

Blocked by

None - can start immediately; scoped extension of #283's frontend wiring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerFrontend / MLIR passes, type system, language semanticsneeds-triageMaintainer needs to evaluate this issueneutral-atomNeutral-atom backend target (quon_na, quantum.na, AOD/schedule)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions