quil-lang / quil

Specification of Quil: A Practical Quantum Instruction Set Architecture
https://quil-lang.github.io/
Apache License 2.0
104 stars 16 forks source link

Add DEFGATE AS CIRCUIT #43

Open stylewarning opened 4 years ago

stylewarning commented 4 years ago

It Would Be Nice to define gates by some circuit decomposition. This is different than DEFCIRCUIT since those are simply for expansion and not meant to represent "Gates".

DEFGATE CZ p q AS CIRCUIT:
    H p
    CNOT p q
    H p

This is not a DEFCIRCUIT! This is the expression of a unitary operation (which is not expanded!) as a sequence of gates.

Concrete qubit indices shouldn't be allowed.

stylewarning commented 4 years ago

(I'm open to another keyword besides CIRCUIT.)

stylewarning commented 4 years ago

Other ideas: AS PRODUCT, AS SEQUENCE, AS OTHER-GATES

Other note: If somebody implements this, you'd need to check for circularity.