Quantum Programming Notes — V2 (Grover Example)
What this page adds
This version shows a full simple Grover search example that connects:
The problem
Find the value 5 (binary 101) out of 8 possibilities.
000 001 010 011 100 101 110 111
Grover structure
1. Superposition
2. Oracle (mark 101)
3. Amplification
4. Repeat (optional)
5. Measure
Full example (Qiskit)
from qiskit import QuantumCircuit, Aer, execute
qc = QuantumCircuit(3,3)
# Step 1: superposition
qc.h([0,1,2])
# Step 2: oracle (mark |101>)
qc.x(1)
qc.ccz(0,1,2)
qc.x(1)
# Step 3: diffusion (amplification)
qc.h([0,1,2])
qc.x([0,1,2])
qc.h(2)
qc.ccx(0,1,2)
qc.h(2)
qc.x([0,1,2])
qc.h([0,1,2])
# Measure
qc.measure([0,1,2],[0,1,2])
sim = Aer.get_backend('qasm_simulator')
result = execute(qc, sim, shots=1024).result()
print(result.get_counts())
Expected result
{'101': ~high count}
The correct answer appears most often.
Compass needle insight
Your observation is excellent.
The oracle is like giving the needle a reference direction. Amplification rotates the needle toward it.
That is exactly the rotation idea in action.
Your key question: is this manipulating matter?
Yes — but very precisely.
You said:
"setting up physical events in the right order"
That is correct.
More precisely:
- Qubits are physical systems (circuits, ions, etc.)
- Gates are controlled physical interactions
- The program defines how those interactions happen
You are not moving everyday matter—you are controlling quantum states of physical systems.
So yes:
Program → sequence of physical operations → evolving quantum state → measurement
Plain language summary
- You build a circuit
- You control physical behavior of qubits
- You guide probabilities
- You measure the outcome
Quantum computing is programming physics at a very small scale.