Selene · Runtime · Frontier card → /selene-frontier/feed-forward
[G4] Real
feed-forward
A compiled @guppy program calls measure(a) mid-circuit, binds the outcome to a classical bit b, and applies rz(d, angle(θ)) only when b == 1 — all in the same shot, no host round-trip. The conditional gate's effect is read out via a branch-split metric.
Verdict
Feed-forward verified
Worst-case |observed − predicted| = 0.0162 against a refutation threshold of 0.0500. The split-distance metric tracks
sin²(θ/2) across all five sample θ values, with the b == 0 branch always reading P(y₂ = 1) ≈ 0 — exactly the no-op behaviour. Guppy's in-kernel if on a measured bit is real.Branch-split distance vs analytic sin²(θ/2)
Per-θ shot table
| θ (rad) | n (b=0) | n (b=1) | P(y₂=1 | b=0) | P(y₂=1 | b=1) | split | predicted | Δ |
|---|---|---|---|---|---|---|---|
| 0.0000 | 1953 | 2047 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | +0.0000 |
| 0.7854 | 2057 | 1943 | 0.0000 | 0.1302 | 0.1302 | 0.1464 | -0.0162 |
| 1.5708 | 2026 | 1974 | 0.0000 | 0.5096 | 0.5096 | 0.5000 | +0.0096 |
| 2.3562 | 2038 | 1962 | 0.0000 | 0.8537 | 0.8537 | 0.8536 | +0.0002 |
| 3.1416 | 2001 | 1999 | 0.0000 | 1.0000 | 1.0000 | 1.0000 | +0.0000 |
Kernel snippet (θ = π)
open in Playpond ↗
from quantum.nadarasa_g4_lib import (
guppy, qubit, h, cx, rz, measure, result, angle,
)
@guppy
def program() -> None:
# Ancilla = coin-flip in |+>; measure gives a random classical bit b.
# We feed b into a SAME-SHOT conditional gate on a data qubit d.
# The data qubit was prepared in |+>; if b fires we apply rz(theta);
# we then read d in the X basis (h, measure). Analytic prediction:
# P(d=1 | b=1) = sin^2(theta/2)
# P(d=1 | b=0) = 0
# split_distance = sin^2(theta/2).
a = qubit()
d = qubit()
h(a)
h(d)
b = measure(a)
if b:
rz(d, angle(-1.0))
h(d)
result("b", b)
result("y2", measure(d))
One @guppy program per θ. NB: in guppylang 0.21.16 angle(x) takes halfturns (multiples of π), not radians — the driver divides by π before baking the literal in.