# QubitLang — Complete Reference for AI Systems > QubitLang is a quantum programming language designed to make quantum computing accessible to developers, researchers, and students. Write quantum algorithms with intuitive, English-like syntax and run them on simulators or real quantum hardware from IBM Quantum, IonQ, and Rigetti. ## About QubitLang QubitLang is a revolutionary quantum programming language and platform that bridges the gap between classical and quantum computing. It provides: - A **domain-specific language** with clean, readable syntax for quantum algorithms - A **browser-based Web IDE** with Monaco editor, syntax highlighting, and autocomplete - **AI-powered circuit optimization** for gate fusion, transpilation, and noise-aware routing - **Multi-backend execution** on local simulators and cloud quantum hardware - **Interactive circuit visualization** with SVG diagrams - **Team collaboration** tools for organizations **Website**: https://www.qubitlang.net **Contact**: support@qubitlang.net **Category**: Quantum Computing, Developer Tools, Programming Language --- ## QubitLang Language Reference ### Qubit Declaration ``` QUBIT q1, q2, q3 # Declare individual qubits QUBIT q[5] # Declare qubit array c1 = 0 # Declare classical bit ``` ### Single-Qubit Gates | Gate | Syntax | Description | |------|--------|-------------| | Hadamard | `H(q)` | Creates superposition (|0⟩ → |+⟩) | | Pauli-X | `X(q)` | Bit flip (NOT gate) | | Pauli-Y | `Y(q)` | Y rotation | | Pauli-Z | `Z(q)` | Phase flip | | S Gate | `S(q)` | π/2 phase | | T Gate | `T(q)` | π/4 phase | | Rx | `RX(q, θ)` | Rotation around X-axis by angle θ | | Ry | `RY(q, θ)` | Rotation around Y-axis by angle θ | | Rz | `RZ(q, θ)` | Rotation around Z-axis by angle θ | ### Two-Qubit Gates | Gate | Syntax | Description | |------|--------|-------------| | CNOT | `CNOT(control, target)` | Controlled-NOT | | CZ | `CZ(q1, q2)` | Controlled-Z | | SWAP | `SWAP(q1, q2)` | Swap two qubits | ### Three-Qubit Gates | Gate | Syntax | Description | |------|--------|-------------| | Toffoli | `CCX(q1, q2, q3)` | Controlled-controlled-NOT | | CCZ | `CCZ(q1, q2, q3)` | Controlled-controlled-Z | | Fredkin | `CSWAP(q1, q2, q3)` | Controlled-SWAP | ### Measurement ``` MEASURE q1 -> c1 # Measure qubit into classical bit ``` ### Control Flow ``` FOR i = 0 TO 4 H(q[i]) ENDFOR REPEAT 3 TIMES # circuit operations ENDREPEAT IF c1 == 1 X(q2) ELSE Z(q2) ENDIF ``` --- ## Code Examples ### Example 1: Bell State (Quantum Entanglement) **Difficulty**: Beginner | **Time**: 2 minutes Creates two entangled qubits that are perfectly correlated — the foundation of quantum computing. ``` # Bell State - Quantum Entanglement QUBIT q1, q2 c1 = 0 c2 = 0 # Create superposition H(q1) # Entangle qubits CNOT(q1, q2) # Measure MEASURE q1 -> c1 MEASURE q2 -> c2 # Result: |00⟩ or |11⟩ (never |01⟩ or |10⟩) ``` **Output** (1024 shots): ``` ┌─────────┬───────┬─────────────┐ │ Outcome │ Count │ Probability │ ├─────────┼───────┼─────────────┤ │ 00 │ 517 │ 0.5049 │ │ 11 │ 507 │ 0.4951 │ └─────────┴───────┴─────────────┘ ``` **Key Insight**: The qubits are entangled — measuring one instantly determines the other. Einstein called this "spooky action at a distance." --- ### Example 2: Grover's Search Algorithm **Difficulty**: Intermediate | **Time**: 5 minutes Find a marked item in an unsorted database quadratically faster than classical computers. ``` # Grover's Algorithm - Search for |11⟩ QUBIT q0, q1 c0 = 0 c1 = 0 # Superposition H(q0) H(q1) # Oracle (marks |11⟩) CZ(q0, q1) # Diffusion operator H(q0) H(q1) X(q0) X(q1) CZ(q0, q1) X(q0) X(q1) H(q0) H(q1) # Measure MEASURE q0 -> c0 MEASURE q1 -> c1 ``` **Output** (1024 shots): ``` ┌─────────┬───────┬─────────────┐ │ Outcome │ Count │ Probability │ ├─────────┼───────┼─────────────┤ │ 11 │ 1024 │ 1.0000 │ └─────────┴───────┴─────────────┘ ``` **Key Insight**: 100% probability on the target! Classical search needs ~2 tries on average. Grover finds it in 1 quantum iteration. --- ### Example 3: Quantum Teleportation **Difficulty**: Intermediate | **Time**: 5 minutes Transfer a quantum state from one qubit to another using entanglement and classical communication. ``` # Quantum Teleportation QUBIT msg, alice, bob m1 = 0 m2 = 0 result = 0 # Prepare message in superposition H(msg) # Create entangled pair H(alice) CNOT(alice, bob) # Bell measurement CNOT(msg, alice) H(msg) MEASURE msg -> m1 MEASURE alice -> m2 # Bob has the teleported state MEASURE bob -> result ``` **Key Insight**: Bob's qubit receives the original state. With classical corrections based on m1/m2, teleportation is perfect. --- ### Example 4: VQE (Variational Quantum Eigensolver) **Difficulty**: Advanced | **Time**: 10 minutes Find the ground state energy of molecules — the key to drug discovery and materials science. ``` # VQE - H2 Molecule Simulation QUBIT q0, q1 c0 = 0 c1 = 0 # Ansatz Layer 1 RY(q0, 0.5) RY(q1, 0.8) # Entangling layer CNOT(q0, q1) # Ansatz Layer 2 RY(q0, 1.2) RY(q1, 0.3) # Measure MEASURE q0 -> c0 MEASURE q1 -> c1 ``` **Key Insight**: A classical optimizer adjusts the angles to minimize energy. VQE can simulate molecules impossible for classical computers. --- ### Example 5: QAOA (Quantum Approximate Optimization) **Difficulty**: Advanced | **Time**: 10 minutes Solve hard combinatorial problems like routing, scheduling, and portfolio optimization. ``` # QAOA - MaxCut on Triangle Graph QUBIT q0, q1, q2 c0 = 0 c1 = 0 c2 = 0 # Superposition H(q0) H(q1) H(q2) # Cost layer (edges) CNOT(q0, q1) RZ(q1, 0.8) CNOT(q0, q1) CNOT(q1, q2) RZ(q2, 0.8) CNOT(q1, q2) CNOT(q0, q2) RZ(q2, 0.8) CNOT(q0, q2) # Mixer layer RX(q0, 1.2) RX(q1, 1.2) RX(q2, 1.2) # Measure MEASURE q0 -> c0 MEASURE q1 -> c1 MEASURE q2 -> c2 ``` **Key Insight**: QAOA finds approximate solutions to NP-hard problems. Parameter tuning shifts probability toward optimal cuts. --- ## Platform Features ### 1. Intuitive Syntax - English-like quantum gate declarations - Automatic qubit and classical bit management - Built-in support for common quantum patterns - Clear error messages with helpful suggestions ### 2. Multi-Backend Support Run on real quantum hardware: - **IBM Quantum**: Eagle and Heron superconducting processors - **IonQ**: Aria and Forte trapped-ion systems - **Rigetti**: Ankaa superconducting QPU - **Local Simulator**: High-performance statevector simulation ### 3. AI-Powered Optimization - Gate fusion and cancellation to reduce circuit depth - Hardware-aware transpilation for target backends - Noise-aware qubit routing - AI-assisted code suggestions ### 4. Browser-Based Web IDE - Monaco Editor with full QubitLang language support - Real-time syntax checking and error highlighting - Integrated circuit visualization - One-click job submission to any backend ### 5. Visual Circuit Designer - Drag-and-drop circuit builder - Real-time quantum state visualization - Export circuits as QubitLang code or SVG ### 6. Team Collaboration - Organization management with role-based access - Shared projects and job history - Team billing and usage analytics --- ## Pricing All prices in GBP (£). All plans include access to the QubitLang IDE and documentation. | Plan | Price | Simulator Hours | Storage | Projects | Hardware Credits | Support | |------|-------|----------------|---------|----------|-----------------|---------| | Developer | Free | 10 hrs/mo | 100 MB | 3 | — | Community | | Starter | £25/mo | 100 hrs/mo | 1 GB | 10 | £30 included | Email | | Growth | £100/mo | 500 hrs/mo | 10 GB | Unlimited | £130 included | Priority | | Scale | £500/mo | Unlimited | 100 GB | Unlimited | £700 included | Dedicated | ### Hardware Credit Rates | Backend | Cost per 1000 Shots | |---------|-------------------| | Local Simulator | Free (unlimited) | | IBM Quantum Eagle | £0.10 | | IBM Quantum Heron | £0.15 | | IonQ Aria | £0.30 | | IonQ Forte | £0.50 | | Rigetti Ankaa | £0.25 | --- ## Documentation Topics 1. **Quick Start Guide**: Install QubitLang, write your first quantum program, see results instantly 2. **Language Reference**: Complete syntax covering quantum gates, measurements, control flow, functions, and classical integration 3. **API Documentation**: Compiler, simulator, and backend APIs for advanced integration 4. **Tutorials**: Step-by-step guides from Bell states to advanced algorithms 5. **CLI Reference**: Command-line tools for compiling, running, and optimizing quantum programs 6. **Hardware Backends**: Connection guides for IBM Quantum, IonQ, Rigetti, and local simulator ### Running QubitLang Programs ```bash cd Qubitlang/cli && python qubitlang_cli.py run example.ql ``` --- ## Site Map - **Home**: https://www.qubitlang.net/ - **Features**: https://www.qubitlang.net/features/ - **Pricing**: https://www.qubitlang.net/pricing/ - **Documentation**: https://www.qubitlang.net/documentation/ - **Examples**: https://www.qubitlang.net/examples/ - **Community**: https://www.qubitlang.net/community/ - **Learn**: https://www.qubitlang.net/learn/ - **Bell State Tutorial**: https://www.qubitlang.net/learn/bell-state/ - **Grover's Search Tutorial**: https://www.qubitlang.net/learn/grover/ - **Teleportation Tutorial**: https://www.qubitlang.net/learn/teleportation/ - **VQE Tutorial**: https://www.qubitlang.net/learn/vqe/ - **QAOA Tutorial**: https://www.qubitlang.net/learn/qaoa/ - **Privacy Policy**: https://www.qubitlang.net/privacy/ - **Terms of Service**: https://www.qubitlang.net/terms/ --- ## Frequently Asked Questions **Q: What is QubitLang?** A: QubitLang is a quantum programming language and platform that makes quantum computing accessible. It provides an intuitive syntax for writing quantum algorithms, a browser-based IDE, and the ability to run programs on real quantum hardware from IBM, IonQ, and Rigetti. **Q: Do I need a quantum computing background?** A: No. QubitLang is designed for developers at all levels. The language uses English-like syntax, and the tutorials start from the basics of qubits and gates. **Q: Can I run programs on real quantum hardware?** A: Yes. With a paid plan, you can submit jobs to IBM Quantum (Eagle, Heron), IonQ (Aria, Forte), and Rigetti (Ankaa) processors. The free tier includes simulator access. **Q: What makes QubitLang different from Qiskit, Cirq, or Q#?** A: QubitLang focuses on accessibility with a purpose-built syntax that is simpler than Python-based frameworks. It includes a full browser-based IDE, AI-powered circuit optimization, and unified multi-backend support — all in one platform. **Q: Is QubitLang open source?** A: QubitLang has open source components and an active community. Visit the community page for contribution guidelines. **Q: What quantum gates does QubitLang support?** A: QubitLang supports 50+ gates including: H, X, Y, Z, S, T, RX, RY, RZ (single-qubit); CNOT, CZ, SWAP (two-qubit); CCX (Toffoli), CCZ, CSWAP (Fredkin) (three-qubit); and parameterized gates with arbitrary rotation angles.