Synapse Quantum Programming Syntax

This document describes the emerging native quantum programming constructs in Synapse.

Quantum Circuit

quantum circuit bell(2) {
    h(0)
    cnot(0,1)
    measure(0,1)
}

Quantum Backend

quantum backend simulator {
    shots: 1024
    noise_model: ideal
}

Defines execution configuration. Most recent backend becomes active.

Quantum Algorithm Skeleton

quantum algorithm vqe {
    parameters: [theta1, theta2]
    ansatz: hardware_efficient
    cost_function: energy_expectation(H)
    optimize: gradient_descent(theta1, theta2)
}

Currently stored structurally for future execution / optimization phases.

Mixed Classical + Quantum

shots = 512
quantum backend simulator { shots: shots }
quantum circuit ghz(3) {
    h(0)
    cnot(0,1)
    cnot(1,2)
    measure(0,1,2)
}

Roadmap (Implemented vs Planned)

Notes

Semantic Error Codes

| Code | Description | |——–|————-| | E1001 | Unknown gate name | | E1002 | Qubit index out of circuit range | | E1003 | Duplicate qubit provided to gate requiring distinct qubits | | E1004 | Gate arity mismatch (wrong number of qubits) | | E1005 | Gate parameter count mismatch | | E1010 | Measurement index out of range | | E1011 | Duplicate measurement of same qubit | | E1101 | Non-integer qubit or measurement index | | E1200 | Malformed noise model object/type | | E1201 | Unknown or incomplete noise model specification | | E1202 | Noise model probability parameter outside [0,1] | | E1301 | Invalid backend shots value (must be positive int) | | E1302 | Invalid total circuit qubit count |

These pre-execution semantic checks run before simulation to surface issues early.

Example Output

Executing a Bell circuit returns counts approximately: { "00": ~500, "11": ~500 } for 1000 shots.


This file will evolve as quantum features mature.