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

Silq REPL #17

Open
ode opened this issue Oct 12, 2020 · 6 comments
Open

Silq REPL #17

ode opened this issue Oct 12, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@ode
Copy link

ode commented Oct 12, 2020

I think it'd be great to have a repl for the language, for toying with code before writing it down. Shouldn't be too hard to implement (not too sure). Thoughts?

@tgehr
Copy link
Collaborator

tgehr commented Oct 12, 2020

Reading is easy, but it's not entirely clear how it would evaluate and print for quantum state.
E.g.

> x:=H(0:𝔹);
???
> y:=dup(x);
???
> x
???
> dump()
/────────
QUANTUM STATE
(1+0i)·|1⟩₀⊗|1⟩₁

VARIABLES
x ↦ ref(0)
y ↦ ref(1)
────────/

How should this work? Otherwise, implementation should be pretty straightforward.

@tgehr
Copy link
Collaborator

tgehr commented Oct 12, 2020

Also, measurements can lead to destructive state updates, maybe there should be a way to undo them.

@ode
Copy link
Author

ode commented Oct 12, 2020

well, clearly measurements shouldn't be done unless explicitly asked. Printing out the ket notation is a good alternative imo

@tgehr
Copy link
Collaborator

tgehr commented Oct 12, 2020

In my example, x and y are entangled, so I am not sure how to show the partial state.
What would you show instead of ??? in the REPL output?

@ode
Copy link
Author

ode commented Oct 12, 2020

we could either disregard entanglement and only show the probabilities or do something like

> x = H(0:𝔹);
(1/√2) (|0⟩ + |1⟩)

> y = dup(x);
|xy⟩ = (1/√2) (|00⟩ + |11⟩)

in other words, detecting variables that are entangled and showing all of them when one of them is asked. Note that x evaluates to the same thing after typing in the second statement

@j6k4m8
Copy link

j6k4m8 commented Dec 19, 2020

As a user I like the probability approach @LordPos mentions — and I think for beginners it'll feel similar to what people have seen in tools like Quantum Experience etc!

@tgehr tgehr added the enhancement New feature or request label Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants