On this page
Under the hood#
Question: what does check actually build and run, and what do the knobs --no-tier1, --no-tier2, --timeout and --no-window change?
The example is a distance-3 repetition code (qec/rep_d3_r3 and rep_d3_r100, three and a hundred syndrome rounds) on IBM Heron. Reference: Command reference, Obligations, Windowing (T4).
R3 = _show.FAMILIES / "qec/rep_d3_r3.qasm"
R100 = _show.FAMILIES / "qec/rep_d3_r100.qasm"
The program#
One syndrome round: entangle, measure two ancillas, apply a correction chosen by the outcomes, reset. rep_d3_r100 is the same text with for int i in [0:99].
_show.source("qec/rep_d3_r3.qasm")
OPENQASM 3.0;
// rep_d3_r3: distance-3 repetition code, 3 syndrome round(s), toy lookup decoder
qubit[5] q;
bit[2] c;
for int i in [0:2] {
barrier q;
cx q[0], q[3];
cx q[1], q[3];
cx q[1], q[4];
cx q[2], q[4];
c[0] = measure q[3];
c[1] = measure q[4];
if (c[0] && !c[1]) {
x q[0];
}
if (c[0] && c[1]) {
x q[1];
}
if (!c[0] && c[1]) {
x q[2];
}
reset q[3];
reset q[4];
barrier q;
}
1. The event graph#
explain shows the pipeline's size summary: nodes are timed events (start, end, valid, join...), edges are ordering constraints with latency intervals, obligations are the claims to discharge.
code, out = _show.run("explain", R3, "--contract", "ibm_heron")
assert code == 0 and "115 nodes" in out and "44 obligations" in out
ibm_heron (ibm): 115 nodes, 168 edges, 6 latency variables, 44 obligations
facts[block]: 9
facts[blockend]: 9
facts[eqbar]: 6
facts[gap]: 45
facts[ready]: 9
[exit 0]
--graph dot prints the whole graph in Graphviz DOT. The three-round graph is too big to read, so this draws the one-round program (rep_d3_r1):
code, dot = _show.run("explain", _show.FAMILIES / "qec/rep_d3_r1.qasm", "--contract", "ibm_heron", "--graph", "dot", show=False)
assert code == 0 and dot.startswith("digraph lteg")
print(dot.count("->"), "edges")
_show.dot(dot, "Timed event graph of rep_d3_r1 on IBM Heron: nodes are start, end and join events, "
"edges carry their minimum delay in dt", height=500)
46 edges
digraph lteg {
rankdir=LR; node [shape=box, fontsize=10];
n0 [label="origin/origin@-1"];
n1 [label="start/start@1"];
n2 [label="end/end@1"];
n3 [label="start/start@2"];
n4 [label="end/end@2"];
n5 [label="start/start@3"];
n6 [label="end/end@3"];
n7 [label="start/start@4"];
n8 [label="end/end@4"];
n9 [label="start/start@5"];
n10 [label="end/end@5"];
n11 [label="valid/valid@5"];
n12 [label="start/start@6"];
n13 [label="end/end@6"];
n14 [label="valid/valid@6"];
n15 [label="valid/cvalid@7"];
n16 [label="join/bready@7"];
n17 [label="start/bstart@7"];
n18 [label="start/start@9/n[cond@n7]"];
n19 [label="end/end@9/n[cond@n7]"];
n20 [label="end/bend@7"];
n21 [label="valid/cvalid@10"];
n22 [label="join/bready@10"];
n23 [label="start/bstart@10"];
n24 [label="start/start@12/n[cond@n10]"];
n25 [label="end/end@12/n[cond@n10]"];
n26 [label="end/bend@10"];
n27 [label="valid/cvalid@13"];
n28 [label="join/bready@13"];
n29 [label="start/bstart@13"];
n30 [label="start/start@15/n[cond@n13]"];
n31 [label="end/end@15/n[cond@n13]"];
n32 [label="end/bend@13"];
n33 [label="start/start@16"];
n34 [label="end/end@16"];
n35 [label="start/start@17"];
n36 [label="end/end@17"];
n0 -> n1 [label="0", fontsize=9];
n0 -> n1 [label="0", fontsize=9];
n1 -> n2 [label="20", fontsize=9];
n0 -> n3 [label="0", fontsize=9];
n2 -> n3 [label="0", fontsize=9];
n3 -> n4 [label="20", fontsize=9];
n4 -> n5 [label="0", fontsize=9];
n0 -> n5 [label="0", fontsize=9];
n5 -> n6 [label="20", fontsize=9];
n0 -> n7 [label="0", fontsize=9];
n6 -> n7 [label="0", fontsize=9];
n7 -> n8 [label="20", fontsize=9];
n4 -> n9 [label="0", fontsize=9];
n9 -> n10 [label="545", fontsize=9];
n10 -> n11 [label="ff.default in [0, 150]", fontsize=9, style=dashed];
n8 -> n12 [label="0", fontsize=9];
n12 -> n13 [label="545", fontsize=9];
n13 -> n14 [label="ff.default in [0, 150]", fontsize=9, style=dashed];
n11 -> n15 [label="0", fontsize=9];
n14 -> n15 [label="0", fontsize=9];
n2 -> n16 [label="0", fontsize=9];
n16 -> n17 [label="0", fontsize=9];
n15 -> n17 [label="0", fontsize=9];
n17 -> n18 [label="0", fontsize=9];
n18 -> n19 [label="8", fontsize=9];
n17 -> n20 [label="8", fontsize=9];
n11 -> n21 [label="0", fontsize=9];
n14 -> n21 [label="0", fontsize=9];
n6 -> n22 [label="0", fontsize=9];
n22 -> n23 [label="0", fontsize=9];
n21 -> n23 [label="0", fontsize=9];
n23 -> n24 [label="0", fontsize=9];
n24 -> n25 [label="8", fontsize=9];
n23 -> n26 [label="8", fontsize=9];
n11 -> n27 [label="0", fontsize=9];
n14 -> n27 [label="0", fontsize=9];
n8 -> n28 [label="0", fontsize=9];
n28 -> n29 [label="0", fontsize=9];
n27 -> n29 [label="0", fontsize=9];
n29 -> n30 [label="0", fontsize=9];
n30 -> n31 [label="8", fontsize=9];
n29 -> n32 [label="8", fontsize=9];
n10 -> n33 [label="0", fontsize=9];
n33 -> n34 [label="250", fontsize=9];
n13 -> n35 [label="0", fontsize=9];
n35 -> n36 [label="250", fontsize=9];
}
2. Solver tiers#
Obligations go through up to three solvers: Tier 0 exact evaluation, Tier 1 interval abstraction (can only prove), Tier 2 the Z3 SMT solver (proves or refutes). This uses --policy eq (every branch must take equal time), which this program satisfies under the vendor latency assumption, and count which tier closed each obligation.
def tiers(prog, *opts, policy="eq"):
code, out = _show.run("check", prog, "--contract", "ibm_heron", "--policy", policy,
"--format", "json", *opts, show=False)
d = json.loads(out)
return code, d["verdict"], Counter(
"unknown" if o["result"] == "unknown" else f"tier {o['tier']}" for o in d["obligations"])
cases = [("default", ()), ("--no-tier1", ("--no-tier1",)), ("--no-tier2", ("--no-tier2",)),
("--no-tier1 --no-tier2", ("--no-tier1", "--no-tier2"))]
rows = {name: tiers(R3, *o) for name, o in cases}
for name, (code, verdict, c) in rows.items():
print(f"{name:24} exit {code} {verdict:13} {dict(sorted(c.items()))}")
default exit 0 PROVED-UNDER {'tier 0': 14, 'tier 1': 66}
--no-tier1 exit 0 PROVED-UNDER {'tier 0': 14, 'tier 2': 66}
--no-tier2 exit 0 PROVED-UNDER {'tier 0': 14, 'tier 1': 66}
--no-tier1 --no-tier2 exit 3 UNKNOWN {'tier 0': 14, 'unknown': 66}
assert rows["default"][1] == "PROVED-UNDER" and rows["default"][2]["tier 1"] > 0
assert rows["--no-tier1"][1] == "PROVED-UNDER" and rows["--no-tier1"][2]["tier 1"] == 0 and rows["--no-tier1"][2]["tier 2"] > 0
assert rows["--no-tier2"][1] == "PROVED-UNDER"
assert rows["--no-tier1 --no-tier2"][0] == 3 and rows["--no-tier1 --no-tier2"][1] == "UNKNOWN"
The tier mix as a bar (hand-made SVG; one bar per run):
Turning Tier 1 off pushes its obligations to Z3: same verdict, different workhorse. Turning Tier 2 off is only safe when Tier 1 is enough; where it is not, the obligation is UNKNOWN, never guessed. Turning both off leaves just exact Tier 0, so the verdict is UNKNOWN (exit 3).
Tier 2 is also what produces counterexamples. Under the default sync policy the same program is refuted, and without Tier 2 that refutation becomes UNKNOWN:
for name, o in [("default", ()), ("--no-tier2", ("--no-tier2",))]:
code, verdict, c = tiers(R3, *o, policy="sync")
print(f"sync {name:12} exit {code} {verdict:8} {dict(sorted(c.items()))}")
if name == "default":
assert (code, verdict) == (1, "REFUTED")
else:
assert (code, verdict) == (3, "UNKNOWN")
sync default exit 1 REFUTED {'tier 0': 11, 'tier 1': 18, 'tier 2': 15}
sync --no-tier2 exit 3 UNKNOWN {'tier 0': 11, 'tier 1': 18, 'unknown': 15}
3. --timeout#
--timeout S bounds each SMT query (default 10 s). A query that runs out of time is UNKNOWN, not a guess. With an absurdly small budget:
code, verdict, c = tiers(R3, "--no-tier1", "--timeout", "0.001")
assert (code, verdict) == (3, "UNKNOWN") and c["unknown"] > 0 # exact split depends on machine speed, so not printed
print(code, verdict)
3 UNKNOWN
4. Windowing#
Unrolling a hundred rounds would build a graph about thirty times the size of the three-round one. For IBM, qtiming instead checks one iteration window, provided the loop is bracketed by full joins (the cut rules of T4). The three-round loop is small enough to unroll; the hundred-round loop exceeds the unroll limit of 64 and is windowed.
code, out = _show.run("check", R100, "--contract", "ibm_heron", "--policy", "eq")
assert code == 0 and out.startswith("PROVED-UNDER") and "window: loop of 100 iterations" in out
PROVED-UNDER (contract ibm_heron, policy eq, sha256 9cf4d27a06ae)
assumptions (weakest class: vendor):
ff.default: [0 ns, 600 ns] vendor: IBM blog, 2025-11-19 (feedforward about 600 ns); vendor claim, not a certified bound
O2b: 3 obligation(s): proved (tier 1, margin 0 ns)
O4: 20 obligation(s): proved (tier 0, margin 0 ns); proved (tier 1, margin 0 ns)
O7: 3 obligation(s): proved (tier 1, margin 0 ns)
note: window: loop of 100 iterations summarised by one iteration window (cut rules 1, 3, 4, 5 hold)
not checked by this build: O4a (off by default), O6 (blocking calls), O8 (grid), O9 (loop windows), O7 for SYNC with a spread bound
[exit 0]
Same verdict as the 3-round program, with 20 O4 obligations instead of 62. Now forbid windowing:
code, out = _show.run("check", R100, "--contract", "ibm_heron", "--policy", "eq", "--no-window")
assert code == 2 and "E-ELAB-LOOP-LIMIT" in out
error: E-ELAB-LOOP-LIMIT: for loop of 100 > unroll limit 64
hint: raise the unroll limit, or omit --no-window (IBM windowing)
[exit 2]
Without windowing a long loop is not silently truncated: it fails with a usage error (exit 2). Windowing is only sound for IBM; other personalities refuse to window and report UNKNOWN (E-GRAPH-CUT).
Note explain does not window: asking it for the 100-round graph gives the same error.
code, out = _show.run("explain", R100, "--contract", "ibm_heron")
assert code == 2 and "E-ELAB-LOOP-LIMIT" in out
error: E-ELAB-LOOP-LIMIT: for loop of 100 > unroll limit 64
hint: raise the unroll limit, or omit --no-window (IBM windowing)
[exit 2]
What just happened#
- The event graph is the shared intermediate form;
explain --graph dotexposes it. - Obligations are discharged by the cheapest solver that can: exact, interval, then SMT. Interval only proves; only exact and SMT refute.
- Disabling a tier trades speed for UNKNOWNs, never for wrong answers.
- Windowing lets
rep_d3_r100be checked in about the cost of one round, under the IBM cut rules.
Next: Reference: CLI.