The above is a quantum automata with the following probability matrix:
Quantum Automata:
each "probability" becomes "amplitude" a
a^2 for all out going edge of a specific node sum to 1
When you calculate, treat amplitude like probability. In the middle of amplitudes, you might have negative amplitudes. But after you combine, squared, and sum all the leaves, you get probability.
In probabilistic code, you have the following property:
The number of leaves is 2^\text{\#branch}
Leaf probabilities p are all +(1/n)
Leaf probabilities p add up to 1
Leaf probabilities p are all positive
Added leaf probabilities \sum_{\text{same label}} p are multiple of (1/n)^\text{\#branch}
Added leaf probabilities \sum_{\text{same label}} p must be positive
Leaf Combined probabilities \sum_{\text{all leaves}} p add up to 1
Label Combined probabilities \sum_{\text{all labels}} \sum_{\text{same label}} p add up to 1
In quantum code, you have the following property:
The number of leaves is 2^\text{\#hat}
Leaf amplitudes a are all \pm \left(\sqrt{1/2}\right)^\text{\#hat}
Leaf amplitudes a^2 add up to 1
Leaf amplitudes are positive or negative
Added leaf amplitudes \sum_{\text{same label}} a are multiple of \pm \left(\sqrt{1/2}\right)^\text{\#hat}
Added leaf amplitudes \sum_{\text{same label}} a can be positive, zero, or negative
Leaf Combined amplitudes \sum_{\text{all leaves}} a^2 add up to 1
Label Combined amplitudes \sum_{\text{all labels}} (\sum_{\text{same label}} a)^2 add up to 1
When we print, we print out label with probability (\sum_{\text{label}} a)^2
The fundamental difference between classical and quantum computation is that combining the same outcome probability/amplitude could cancel probability/amplitude out. You can imagine that nature is keeping track of forking tree since it knows which state to go back to (un-mix probability).
To fully capture the joint state, you need to keep track of the probability of every possible states. To simulate a random algorithm, you need only the transition matrix (all column sum to one) and track down one path. To simulate a quantum algorithm, you need the transition matrix (that is unitary), since you need to do addition and subtraction between branches.
You cannot track each bits individually because they might not be independent.
Also, although you can write probabilistic quantum instructions (do quantum instructions according to the result of fliping coins), but the calculation will be different. (You can't use the same matrix multiplication. Since probability square does not necessarily sum to one.)
(Add_1_to_Coin A)
Hat A
Print_All
The above code prints exactly the same whether we run the instruction in "()". Because when we calculate the probability, we squared it therefore dropping the negative sign that come from 1 \to 1.
(Add_1_to_Coin A)
Hat A
Hat A
Print_All
Two
Hat
cancels each other out. This is best to be proved with matrix representation of theHat
instruction.
Table of Content