Repository navigation
Conversation
A quantum-information-framed single (non-composite) qubit: the standard
single-qubit gate set acting on the symbolic computational basis |b>,
where the bit label may be a concrete bit, a symbol, or a boolean
expression.
- Rust: `Qubit` (Namespace impl, dual-cased gate accessors) and
`qubit_system` / `qubit_system_for` builders in `crates/uhlenbeck/src/qubit.rs`;
gates X/Y/Z/H/S/T, Sdag/Tdag, Rx/Ry/Rz, P; action rules over a wildcard
bit fire on concrete, symbolic, and boolean labels; Pauli commutators,
Hermitian/dagger rules, <b'|b>=δ inner products, completeness Σ|b><b|.
- Python: `Qubit(Namespace)` mirror in a new `uhlenbeck.systems` subpackage,
builds + registers on init (idempotent reuse).
- Notebook: `notebooks/systems/qubit.ipynb` (authored + executed via nb).
- Tests: `crates/uhlenbeck/tests/qubit.rs` (Rust) and `tests/test_qubit.py`.
The boolean<->{0,1} coercion (the issue's main design question) needs no
special machinery: boolean true/false are integers 1/0, so concrete bits
fold inside pow/exp while symbolic/boolean labels stay symbolic.
Follow-ups filed as kata #8agy (Python/evaluate path for inner-product
rules) and #nyxn (triggering API for commutator_rules).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the single-qubit quantum system from kata #qat6 — a
quantum-information-framed single (non-composite) qubit.
What's here
crates/uhlenbeck/src/qubit.rs):Qubit(aNamespaceimpl with dual-cased gate accessors — lowercase default + uppercase
physics alias returning the same interned atom) and
qubit_system/qubit_system_for(ns)builders, re-exported fromlib.rs. Gates:Pauli
X/Y/Z,H,S/T+Sdag/Tdag, rotationsRx/Ry/Rz, phaseP; statesqubit(b),zero(),one().on concrete (
X|0>=|1>), symbolic (X|a>=|¬a>), and boolean(
X|a⊕b>=|¬(a⊕b)>) labels. Plus<b'|b>=δinner products,Hermitian/dagger rules, Pauli commutators (canonical order), and
completeness
Σ|b><b|.python/uhlenbeck/systems/qubit.py):Qubit(Namespace)mirroring the Rust accessors, builds + registers on init (idempotent
reuse). New
uhlenbeck.systemssubpackage.notebooks/systems/qubit.ipynb): tutorial authored +executed clean via
nb execute --uv.crates/uhlenbeck/tests/qubit.rs(Rust) andtests/test_qubit.py(Python).Design note — boolean ↔ {0,1} coercion
The issue's central design question resolves to no special machinery
needed: boolean
true/falseare the integers1/0, so aconcrete-bit label folds automatically inside
pow/exp(
(−1)^1=−1,i^1=i,exp(iπ·0/4)=1) while a symbolic orboolean-expression label leaves the phase symbolic (
(−1)^a,(−1)^(a⊕b)). One rule handles all three label kinds.Verification
cargo test -p uhlenbeckgreen (full suite);cargo fmt --all --checkand clippy clean.
uv run pytest tests/— full suite green.H·H|0>=|0>,HZH|0>=|1>, etc.).Follow-ups (filed)
evaluatepathfires
inner_product_rulestoday (IP evaluation is Rust-only viaeval_inner_product_once).commutator_rules/anticommutator_rules(declarative data with no user-facing trigger).
Qubit(register=False)can build a malformed system on analready-registered namespace (build-before-register dagger hazard).
🤖 Generated with Claude Code