Skip to content

Commit

Permalink
docs: add operation constraint to quantum extension
Browse files Browse the repository at this point in the history
Closes #170
  • Loading branch information
ss2165 committed Sep 19, 2023
1 parent 7ff032b commit 18845fd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions specification/hugr.md
Original file line number Diff line number Diff line change
Expand Up @@ -1727,10 +1727,19 @@ allocation, and the compiler can add/remove/move these operations to use
more or fewer qubits. In some use cases, that may not be desirable, and
we may instead want to guarantee only a certain number of qubits are
used by the program. For this purpose TKET2 places additional
constraints on the `main` function that are in line with TKET1 backwards
compatibility. Namely the main function takes one `Array<N, Qubit>`
constraints on the HUGR that are in line with TKET1 backwards
compatibility:

1. The `main` function takes one `Array<N, Qubit>`
input and has one output of the same type (the same statically known
size). If further the program does not contain any `qalloc` or `qfree`
size).
2. All Operations that have a `FunctionType` involving `Qubit`:
1. Have as many `Qubit` input wires as output.
2. Guarantee semantics that when filtered to `Qubit` only, there is a
bijection such that the _nth_ input maps to the _nth_ output.

This means we can treat all `Qubit` operations as returning all qubits they take
in. If further the program does not contain any `qalloc` or `qfree`
operations we can state the program only uses `N` qubits.

### Higher-order (Tierkreis) Extension
Expand Down

0 comments on commit 18845fd

Please sign in to comment.