Skip to main content
Documentation · DNA-Lang v0.4 & OpenQASM 3.0

Quantum Agent Lab Documentation

Reference for the supported DNA-Lang v0.4 syntax, OpenQASM 3.0 lowering, local browser simulation, three-tier execution governance, and the osiris-cli command line.

1. Supported DNA-Lang v0.4 Syntax

The current compiler accepts lowercase block declarations (organism, meta, gene, genome) with C-style comments (// and /* */). Gate aliases map directly to standard unitary operations: helix (H), bond (CX), twist(θ) (RZ), fold(θ) (RY), splice(θ) (RX), and cleave (measure), alongside standard OpenQASM gate names (h x y z s t sx rx ry rz cx cz swap).

// DNA-Lang v0.4 — Bell pair (accepted by the live editor compiler)
organism Bell {
  meta { author: "Quantum Agent Lab", purpose: "Bell pair smoke test" }

  gene bell_pair() on a, b {
    helix a;          // Hadamard (H)
    bond a, b;        // CNOT (CX)
    cleave a -> ca;   // Measure qubit a into classical bit ca
    cleave b -> cb;   // Measure qubit b into classical bit cb
  }

  genome {
    bell_pair() @ [0, 1];
  }
}

Note: Legacy uppercase blocks (ORGANISM, CHROMOSOME, EVOLUTION, PHENOTYPE) and Python statements are rejected by the compiler and are not part of DNA-Lang v0.4.

2. OpenQASM 3.0 & Bitstring Ordering

The workbench and osiris-cli also accept OpenQASM 3.0 directly, and lower circuits to OpenQASM 2.0 (preserving mid-circuit measure, reset, and classical if (...) statements) for QCCD trapped-ion syntax checkers and emulators. All simulator histograms print bitstrings in little-endian order q[n-1]…q[0].

// OpenQASM 3.0 — 5-qubit bit-flip repetition syndrome check (all-to-all)
OPENQASM 3.0;
include "stdgates.inc";
qubit[5] q;
bit[5] c;

h q[0];
cx q[0], q[1];
cx q[0], q[2];
x q[1];          // Inject bit-flip on data qubit q[1]
cx q[0], q[3];   // Parity check q[0] ^ q[1] -> ancilla q[3]
cx q[1], q[3];
cx q[1], q[4];   // Parity check q[1] ^ q[2] -> ancilla q[4]
cx q[2], q[4];
measure q -> c;  // Bitstrings printed in little-endian order q[n-1]...q[0]

3. Three-Tier Execution Governance

Tier 1 · Free Pre-Flight

Local statevector / noise simulation and zero-HQC syntax checks. Always labeled SIMULATED (hardware=false).

Tier 2 · Cloud Emulation

Org-authenticated cloud noise emulators gated by mandatory syntax pre-flight and per-job shot/HQC caps. Still SIMULATED (hardware=false).

Tier 3 · Live QPU Hardware

Requires owner/admin/operator role, mandatory pre-flight, budget caps, and a single-use HMAC-SHA256 approval token bound to the circuit SHA-256.

4. Local CLI Usage (osiris-cli)

# Compile & syntax-check locally (Tier 1, 0 HQC)
osiris verify examples/quantinuum/bitflip_qec.qasm --target H2-1SC --dry-run

# Cross-architecture static projection (QCCD vs Heavy-Hex)
osiris bench examples/quantinuum/bitflip_qec.qasm --compare quantinuum_h2_1,quantinuum_helios,ibm_fez

# Offline SHA-256 verification of a saved receipt
osiris ledger verify receipt.json