Renmusxd / RustQIP

Quantum computing using rust. Efficient and a borrow-checked no cloning theorem!
https://docs.rs/qip/
MIT License
229 stars 18 forks source link

Linear type and quantum logic #49

Open rht opened 9 months ago

rht commented 9 months ago

o/ I am currently figuring out how to do Birkhoff-von Neumann quantum logic operation in a quantum circuit, and found that the linear type (a subset of linear logic) has already been manifested in Rust, in particular in its borrow checker. I am looking for an advice / resource recommendation on:

Another interpretation of linear logic, is to be considered as a 2-player game, as can be found in [2]

In A ⊗ B, play continues with both games in parallel. If it is our turn in either game, then it is our turn overall; if it is their turn in both games, then it is their turn overall. If either game ends, then play continues in the other game; if both games end, then the overall game ends. If we have won both games, then we have won overall; if they have won either game, then they have won overall.

[1] https://arxiv.org/abs/1210.0613 [2] https://ncatlab.org/nlab/show/linear+logic#game_semantics_2

Renmusxd commented 9 months ago

Hi,

Its not so much that a single file is supporting the no-cloning stuff. Rather it's that qubit registers are tied to handles which don't support copy or clone, so the user is forced to only ever have a single handle to a given qubit. The upshot of this restriction is that it enforces the order of unitary gates. You cannot, for example, have two references to a single qubit before a unitary is applied, you cannot "clone" the state before the gate.