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 are all multiple of (1/n)^\text{\#branch}
Leaf probabilities add up to 1
Leaf probabilities are all positive
Combined probabilities are all positive
Combined probabilities add up to 1 (corollary)
In quantum code, you have the following property:
The number of leaves is 2^\text{\#hat}
Leaf amplitudes are all multiple of \pm \left(\sqrt{1/2}\right)^2
Leaf a^2 add up to 1 (Leaf amplitudes does not add up to 0)
Leaf probabilities are positive or negative
Combined probabilities are all positive or negative
Combined a^2 add up to 1 (not corollary)
When we print, we print out combined probability 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
Table of Content