Sending a quantum state with two ordinary bits, checked for every case.
teleportation.pl · output · proof · check · try it in the playground
In quantum teleportation, Alice wants to give Bob a qubit (a quantum bit) without sending the qubit itself. They share a linked pair of qubits in advance. Alice makes a measurement, phones Bob two ordinary bits (one of four outcomes, 0 to 3), and Bob applies a fix that depends on the outcome.
Does Bob always end up with exactly the state Alice had — for every state and every outcome?
The program uses discrete quantum theory: a toy version where amplitudes are just “there or not”, and two ways of reaching the same result cancel each other out. A result survives only if it can be reached an odd number of ways.
It keeps the strange parts — superposition, interference, entanglement —
small enough to check exhaustively. Three states are tested: zero, one,
and plus (both at once).
% … the shared pair, Alice's measurement and Bob's fixes
received(S, M, Z) :-
qubit(Z),
findall(Path, path(S, M, Z, Path), Paths),
odd(Paths).
% …
teleported(S, M, Received) :+
name(S),
outcome(M),
findall(Z, received(S, M, Z), Received).
% …
false :+
teleported(S, _, Received),
sent(S, Sent),
Received \== Sent.
findall gathers all answers. The false :+ rule is a safety alarm:
if Bob’s state ever differs from Alice’s, the run stops with exit code 65.
teleported(zero, 0, [false]).
teleported(one, 0, [true]).
teleported(plus, 0, [false, true]).
teleported(plus, 3, [false, true]).
…12 answers in all: 3 states × 4 outcomes. In every one, Bob holds exactly
what Alice sent (zero is [false], one is [true], plus is both),
and the alarm never fires.
For each of the 12 cases, the proof says:
Step 3 is where the quantum work happens, and it is a “find all” step.
Verdict: checked_with_obligations. 31 steps, 12 on trust. Honestly put: the counting of paths sits inside those 12 obligations.
node bin/eyedia.js examples/teleportation.pl
Break Bob’s fix for outcome 0: in bob(0, Y, Z) :- kg(Y, Z). replace
kg(Y, Z) with id(Y, Z). Now Bob sometimes gets the wrong state, Eyedia
prints false. and exits with code 65.
Even a quantum protocol can be checked case by case with a few rules. Eyedia covers all 12 cases, and is upfront that the “all answers” lists are the part you are trusting.