Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add example of magic state distillation #40

Merged
merged 6 commits into from
Oct 24, 2024
Merged

docs: Add example of magic state distillation #40

merged 6 commits into from
Oct 24, 2024

Conversation

croyzor
Copy link
Collaborator

@croyzor croyzor commented Oct 14, 2024

No description provided.

Comment on lines 4 to 6
map(X :: $, Y :: $, n :: #, f :: { X -o Y }) -> { Vec(X, n) -o Vec(Y, n) }
map(_, _, _, _) = { [] => [] }
map(X, Y, succ(n), f) = { cons(x,xs) => cons(f(x), map(X, Y, n, f)(xs)) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move these helper functions into a separate file in brat/examples?

redistill_if_bad(Qubit, Bit, Vec(Money, 4))
-o Qubit, Vec(Money, 4)
redistill_if_bad(q, false, ms) = q, ms
redistill_if_bad(q, true, ms) = let m, _ = measure(q) in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A discard function might be useful if we don't care about the measurement outcome

rus(Money, Qubit) -o Money, Qubit
rus = {
rus(timeout :: Nat) -> { Money, Qubit -o Money, Qubit }
rus(0) = { .. }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ .. } is amazing :D

croyzor and others added 5 commits October 24, 2024 09:21
* Driveby cleanups of some misnamed `examples/`
* Add monomorphic test so it compiles+validaties rather than having any type erasure issues (#18)
@croyzor croyzor merged commit c6c6f83 into main Oct 24, 2024
1 check passed
@croyzor croyzor deleted the docs/mgs branch October 24, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants