Notepad/enter/Machine Tips (Quantum)/Resources/Code & Circuit Operations/Languages/LISP/QuiL.md

111 lines
7.6 KiB
Markdown
Raw Permalink Normal View History

# Quil
QuiL is the classic example of a language written specifically for a quantum machine.
The full document on the Quil language is [found here. ](https://quil-lang.github.io/#1Preamble)
# Quil Specification
**Authors:** Robert S. Smith; Rigetti & Co. Inc.; and contributors
**Language Version:** 2021.1 (DRAFT)
## Table of Contents
- [1. Preamble](https://quil-lang.github.io/#1Preamble)
- [1.1. An Introduction to Quil](https://quil-lang.github.io/#1-1An-Introduction-to-Quil)
- [1.2. Annexes](https://quil-lang.github.io/#1-2Annexes)
- [2. Operational Semantic Devices](https://quil-lang.github.io/#2Operational-Semantic-Devices)
- [2.1. Mathematical Preliminaries](https://quil-lang.github.io/#2-1Mathematical-Preliminaries)
- [2.2. The Quantum Abstract Machine](https://quil-lang.github.io/#2-2The-Quantum-Abstract-Machine)
- [3. Structure of a Quil Program](https://quil-lang.github.io/#3Structure-of-a-Quil-Program)
- [3.1. Meta-Syntax](https://quil-lang.github.io/#3-1Meta-Syntax)
- [3.2. Syntactic Rudiments](https://quil-lang.github.io/#3-2Syntactic-Rudiments)
- [3.2.1. Arithmetic Expressions](https://quil-lang.github.io/#3-2-1Arithmetic-Expressions)
- [3.3. Main Program Elements](https://quil-lang.github.io/#3-3Main-Program-Elements)
- [3.4. Comments](https://quil-lang.github.io/#3-4Comments)
- [4. Quantum Gates](https://quil-lang.github.io/#4Quantum-Gates)
- [4.1. Qubits and Quantum State](https://quil-lang.github.io/#4-1Qubits-and-Quantum-State)
- [4.2. Quantum Gate Definitions](https://quil-lang.github.io/#4-2Quantum-Gate-Definitions)
- [4.2.1. Structure of a Gate Definition](https://quil-lang.github.io/#4-2-1Structure-of-a-Gate-Definition)
- [4.2.2. Definition by Matrix](https://quil-lang.github.io/#4-2-2Definition-by-Matrix)
- [4.2.3. Definition by Permutation](https://quil-lang.github.io/#4-2-3Definition-by-Permutation)
- [4.2.4. Definition by Pauli Sum](https://quil-lang.github.io/#4-2-4Definition-by-Pauli-Sum)
- [4.2.4.1. Semantics](https://quil-lang.github.io/#4-2-4-1Semantics)
- [4.2.4.2. Example Syntax](https://quil-lang.github.io/#4-2-4-2Example-Syntax)
- [4.2.4.3. Example Semantic Reduction of CPHASE](https://quil-lang.github.io/#4-2-4-3Example-Semantic-Reduction-of-CPHASE)
- [4.3. Standard Gate Definitions](https://quil-lang.github.io/#4-3Standard-Gate-Definitions)
- [4.3.1. Pauli Gates](https://quil-lang.github.io/#4-3-1Pauli-Gates)
- [4.3.2. Hadamard Gate](https://quil-lang.github.io/#4-3-2Hadamard-Gate)
- [4.3.3. Phase Gates](https://quil-lang.github.io/#4-3-3Phase-Gates)
- [4.3.4. Controlled-Phase Gates](https://quil-lang.github.io/#4-3-4Controlled-Phase-Gates)
- [4.3.5. Cartesian Rotation Gates](https://quil-lang.github.io/#4-3-5Cartesian-Rotation-Gates)
- [4.3.6. Controlled-X Gates](https://quil-lang.github.io/#4-3-6Controlled-X-Gates)
- [4.3.7. Swap Gates](https://quil-lang.github.io/#4-3-7Swap-Gates)
- [4.3.8. Other Gates](https://quil-lang.github.io/#4-3-8Other-Gates)
- [4.4. Quantum Gate Applications](https://quil-lang.github.io/#4-4Quantum-Gate-Applications)
- [4.4.1. Syntax and Semantics](https://quil-lang.github.io/#4-4-1Syntax-and-Semantics)
- [4.4.2. DAGGER Gate Modifier](https://quil-lang.github.io/#4-4-2DAGGER-Gate-Modifier)
- [4.4.3. CONTROLLED Gate Modifier](https://quil-lang.github.io/#4-4-3CONTROLLED-Gate-Modifier)
- [4.4.4. FORKED Gate Modifier](https://quil-lang.github.io/#4-4-4FORKED-Gate-Modifier)
- [4.4.5. Chaining Modifiers](https://quil-lang.github.io/#4-4-5Chaining-Modifiers)
- [5. Quantum State Reset](https://quil-lang.github.io/#5Quantum-State-Reset)
- [6. Classical Memory](https://quil-lang.github.io/#6Classical-Memory)
- [6.1. Design Considerations](https://quil-lang.github.io/#6-1Design-Considerations)
- [6.2. Types](https://quil-lang.github.io/#6-2Types)
- [6.3. Declaring Memory](https://quil-lang.github.io/#6-3Declaring-Memory)
- [6.3.1. Declaring Memory](https://quil-lang.github.io/#6-3-1Declaring-Memory)
- [6.3.2. Declaring Aliased Memory](https://quil-lang.github.io/#6-3-2Declaring-Aliased-Memory)
- [6.3.3. Declaring Aliased Memory Declaration with an Offset](https://quil-lang.github.io/#6-3-3Declaring-Aliased-Memory-Declaration-with-an-Offset)
- [6.3.4. Portability of Aliased Declarations](https://quil-lang.github.io/#6-3-4Portability-of-Aliased-Declarations)
- [6.3.5. Duplicate Declaration Identifiers](https://quil-lang.github.io/#6-3-5Duplicate-Declaration-Identifiers)
- [6.3.6. Examples](https://quil-lang.github.io/#6-3-6Examples)
- [6.3.6.1. Register Machine with a Condition Bit](https://quil-lang.github.io/#6-3-6-1Register-Machine-with-a-Condition-Bit)
- [6.3.6.2. Memory-Mapped RAM](https://quil-lang.github.io/#6-3-6-2Memory-Mapped-RAM)
- [6.3.6.3. Computing Bits of an Angle](https://quil-lang.github.io/#6-3-6-3Computing-Bits-of-an-Angle)
- [6.4. Memory Access and Dereferencing](https://quil-lang.github.io/#6-4Memory-Access-and-Dereferencing)
- [6.5. Classical Instructions](https://quil-lang.github.io/#6-5Classical-Instructions)
- [7. Measurement](https://quil-lang.github.io/#7Measurement)
- [8. Classical Control](https://quil-lang.github.io/#8Classical-Control)
- [8.1. Halting the Program](https://quil-lang.github.io/#8-1Halting-the-Program)
- [8.2. Program Labels and Branching](https://quil-lang.github.io/#8-2Program-Labels-and-Branching)
- [9. Other Instructions and Directives](https://quil-lang.github.io/#9Other-Instructions-and-Directives)
- [9.1. No-Operation Instruction](https://quil-lang.github.io/#9-1No-Operation-Instruction)
- [9.2. Pragmas](https://quil-lang.github.io/#9-2Pragmas)
- [9.3. File Inclusion](https://quil-lang.github.io/#9-3File-Inclusion)
- [10. Circuits](https://quil-lang.github.io/#10Circuits)
- [10.1. Circuit Syntax](https://quil-lang.github.io/#10-1Circuit-Syntax)
- [10.2. Circuit Expansion](https://quil-lang.github.io/#10-2Circuit-Expansion)
- [11. History and Changes](https://quil-lang.github.io/#11History-and-Changes)
- [11.1. A History of Quil](https://quil-lang.github.io/#11-1A-History-of-Quil)
- [11.2. Changes](https://quil-lang.github.io/#11-2Changes)
- [12. Annex T: Pulse-Level Control](https://quil-lang.github.io/#12Annex-T--Pulse-Level-Control)
- [12.1. Frames](https://quil-lang.github.io/#12-1Frames)
- [12.1.1. DEFFRAME](https://quil-lang.github.io/#12-1-1DEFFRAME)
- [12.1.1.1. Frame Attributes](https://quil-lang.github.io/#12-1-1-1Frame-Attributes)
- [12.2. Waveforms](https://quil-lang.github.io/#12-2Waveforms)
- [12.2.1. Defining new waveforms](https://quil-lang.github.io/#12-2-1Defining-new-waveforms)
- [12.3. Pulses](https://quil-lang.github.io/#12-3Pulses)
- [12.4. Frame Mutations](https://quil-lang.github.io/#12-4Frame-Mutations)
- [12.4.1. Frequency](https://quil-lang.github.io/#12-4-1Frequency)
- [12.4.2. Phase](https://quil-lang.github.io/#12-4-2Phase)
- [12.4.3. Scale](https://quil-lang.github.io/#12-4-3Scale)
- [12.5. Capture](https://quil-lang.github.io/#12-5Capture)
- [12.6. Defining Calibrations](https://quil-lang.github.io/#12-6Defining-Calibrations)
- [12.7. Timing and Synchronization](https://quil-lang.github.io/#12-7Timing-and-Synchronization)
**Note:** This document is in _DRAFT STATUS_ and is for review purposes only. It is being developed by the [Quil-Lang group](https://github.com/quil-lang/) on GitHub.
## 1. Preamble
### 1.1. An Introduction to Quil
This is the language specification for Quil, a language for hybrid classical/quantum computations.
# TLDR
Quil is an instruction-based language; each line of a Quil program generally corresponds to a single, discrete action. Despite its resemblance, Quil is _not_ an assembly language.
- [QVM](https://github.com/quil-lang/qvm) is what runs on the backend and is the high-performance Quil simulator