Analyze quantum algorithms by quantifying magic (non-stabilizerness) as the core quantum resource. Connect magic generation to number-theoretic complexity in Shor's algorithm and other quantum routines. Use when analyzing quantum algorithm resource costs, evaluating quantum advantage beyond gate counts, studying magic state distillation, or linking quantum resource theory to computational hardness. arXiv: 2605.05347
Scanned 9/11/2026
Install to Claude Code
npx -y skills add hiyenwong/ai_collection --skill quantum-magic-state-analysis --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Quantum Magic State Analysis?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hiyenwong-quantum-magic-state-analysis-ai-collection)More formats (shields.io, HTML) on the badges page.
---
name: quantum-magic-state-analysis
description: >
Analyze quantum algorithms by quantifying magic (non-stabilizerness) as the core quantum resource.
Connect magic generation to number-theoretic complexity in Shor's algorithm and other quantum routines.
Use when analyzing quantum algorithm resource costs, evaluating quantum advantage beyond gate counts,
studying magic state distillation, or linking quantum resource theory to computational hardness.
arXiv: 2605.05347
---
# Quantum Magic State Analysis
Analyze quantum algorithms through the lens of **magic** (non-stabilizerness) — the genuinely quantum
resource that enables exponential speedup over classical computation.
## Core Insight
Standard metrics (gate counts, qubit registers) miss *which* quantum resources matter. Magic quantifies
the non-classical "fuel" that must be created and maintained for quantum advantage.
**Key finding**: Shor's algorithm maximally exploits magic in practically relevant regimes, with magic
generation directly linked to the number-theoretic hardness of factoring.
## What is Magic?
- **Stabilizer states**: Classically simulable (Gottesman-Knill theorem). Zero magic.
- **Magic states**: Non-stabilizer states that enable universal quantum computation when combined with Clifford gates.
- **Magic = Non-stabilizerness**: The resource that Clifford circuits alone cannot generate.
## Quantifying Magic
### Key Measures
| Measure | Description | Computation |
|---------|-------------|-------------|
| **Mana** | Logarithmic negativity of Wigner function | `M(ρ) = log ||W_ρ||₁` |
| **Robustness of Magic** | Minimal mixing with stabilizer states | Convex optimization |
| **Stabilizer Nullity** | ν(ψ) = n - log₂(rank of stabilizer group) | Group-theoretic |
| **Min-relative entropy** | Distance to stabilizer polytope | `D_min(ρ||S)` |
### Magic in Shor's Algorithm
```
Phase 1: State preparation → Low magic (computational basis)
Phase 2: Hadamard superposition → Moderate magic (uniform superposition)
Phase 3: Modular exponentiation → HIGH magic (entanglement + non-Clifford)
Phase 4: QFT + measurement → Magic consumption → Result extraction
```
The modular exponentiation step is where magic is maximally generated — and this is exactly
where the number-theoretic hardness of factoring manifests.
## Analytical Framework
### Step 1: Identify Magic Sources
For any quantum circuit, identify which gates generate magic:
- **Clifford gates** (H, S, CNOT): No magic generation
- **Non-Clifford gates** (T, Toffoli, arbitrary rotations): Magic generation
- **Entangling operations**: Can distribute magic across qubits
### Step 2: Track Magic Flow
```
Magic_in → [Clifford layers] → Magic_preserved → [Non-Clifford] → Magic_generated → [Measurement] → Magic_consumed
```
### Step 3: Relate to Problem Hardness
The connection between magic and number-theoretic complexity:
- **Factoring hardness** ↔ **Magic generation rate** in Shor's circuit
- **Order-finding difficulty** ↔ **Amount of non-stabilizerness** required
- **Classical simulatability threshold** ↔ **Magic below distillation threshold**
## Practical Applications
### 1. Quantum Advantage Estimation
Estimate whether a quantum algorithm provides genuine advantage:
- If magic ≈ 0 → classically simulable → no advantage
- If magic scales exponentially → potential exponential advantage
- If magic scales polynomially → polynomial advantage at best
### 2. Resource Optimization
Minimize magic consumption:
- Use magic state distillation protocols
- Optimize T-gate count in fault-tolerant implementations
- Trade magic for circuit depth via gate synthesis
### 3. Algorithm Comparison
Compare algorithms by their magic efficiency:
- **Shor's**: O(log N) magic per step, maximally efficient for factoring
- **Grover's**: O(1) magic per oracle call, limited advantage
- **VQE/QAOA**: Variational — magic depends on ansatz expressivity
## Connection to Number Theory
The deep result from arXiv:2605.05347:
> The execution cost of quantum algorithms should be measured not just in gates and qubits,
> but in the **genuinely quantum resources** (magic) that must be created and maintained.
>
> For Shor's algorithm, magic generation is **directly proportional** to the number-theoretic
> complexity of the factoring problem — revealing that quantum advantage comes from
> efficiently harnessing the mathematical structure of the problem.
## Activation Keywords
- quantum magic state
- non-stabilizerness analysis
- Shor's algorithm resource cost
- quantum resource theory
- magic state distillation
- quantum advantage estimation
- stabilizer nullity
- mana computation
- quantum algorithm complexity
- 量子魔法态
- 量子资源理论
## Related Skills
- `quantum-error-correction-methods`: Fault-tolerant magic state distillation
- `quantum-ml-patterns`: Magic in variational quantum algorithms
- `quantum-number-theory-algorithms`: Number-theoretic algorithms and their quantum complexity
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!