Open ode opened 3 years ago
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.
Also, measurements can lead to destructive state updates, maybe there should be a way to undo them.
well, clearly measurements shouldn't be done unless explicitly asked. Printing out the ket notation is a good alternative imo
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?
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
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!
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?