qleisli 0.2.2

Experimental quantum language with linear ownership, exact contracts and independent finite IR verification
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::quantum::z;
use std::quantum::h;
use specification::phase;

basis fn copy_label(value: Bit) -> Bit { value }

unitary fn direct(q: Q<Bit>) -> Q<Bit> { z(q) }

unitary fn computed(q: Q<Bit>) -> Q<Bit> {
    with_computed(q, copy_label, phase) { |data, auxiliary|
        (data, h(h(z(auxiliary))))
    }
}

// Replacing computed(q) with direct(q) leaves the client unchanged.
pub unitary fn selected(q: Q<Bit>) -> Q<Bit> { computed(q) }